2 * This file is part of the coreboot project.
4 * Copyright (C) 2004 Ronald G. Minnich
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; version 2 of
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #include <console/console.h>
22 #include <device/device.h>
23 #include <device/pci.h>
24 #include <device/pci_ids.h>
25 #include <device/pci_ops.h>
28 typedef struct southbridge_intel_i82801dx_config config_t;
30 static void ide_init(struct device *dev)
32 /* Get the chip configuration */
33 config_t *config = dev->chip_info;
35 /* Enable IDE devices so the Linux IDE driver will work. */
36 uint16_t ideTimingConfig;
38 ideTimingConfig = pci_read_config16(dev, IDE_TIM_PRI);
39 ideTimingConfig &= ~IDE_DECODE_ENABLE;
40 if (!config || config->ide0_enable) {
41 /* Enable primary IDE interface. */
42 ideTimingConfig |= IDE_DECODE_ENABLE;
43 printk(BIOS_DEBUG, "IDE0: Primary IDE interface is enabled\n");
45 printk(BIOS_INFO, "IDE0: Primary IDE interface is disabled\n");
47 pci_write_config16(dev, IDE_TIM_PRI, ideTimingConfig);
49 ideTimingConfig = pci_read_config16(dev, IDE_TIM_SEC);
50 ideTimingConfig &= ~IDE_DECODE_ENABLE;
51 if (!config || config->ide1_enable) {
52 /* Enable secondary IDE interface. */
53 ideTimingConfig |= IDE_DECODE_ENABLE;
54 printk(BIOS_DEBUG, "IDE1: Secondary IDE interface is enabled\n");
56 printk(BIOS_INFO, "IDE1: Secondary IDE interface is disabled\n");
58 pci_write_config16(dev, IDE_TIM_SEC, ideTimingConfig);
61 static struct device_operations ide_ops = {
62 .read_resources = pci_dev_read_resources,
63 .set_resources = pci_dev_set_resources,
64 .enable_resources = pci_dev_enable_resources,
67 .enable = i82801dx_enable,
71 static const struct pci_driver i82801db_ide __pci_driver = {
73 .vendor = PCI_VENDOR_ID_INTEL,
78 static const struct pci_driver i82801dbm_ide __pci_driver = {
80 .vendor = PCI_VENDOR_ID_INTEL,