2 * This file is part of the coreboot project.
4 * Copyright (C) 2005 Tyan Computer
5 * (Written by Yinghai Lu <yinghailu@gmail.com> for Tyan Computer)
6 * Copyright (C) 2005 Digital Design Corporation
7 * (Written by Steven J. Magnani <steve@digidescorp.com> for Digital Design)
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 #include <console/console.h>
25 #include <device/device.h>
26 #include <device/pci.h>
27 #include <device/pci_ids.h>
30 typedef struct southbridge_intel_i82801bx_config config_t;
32 static void ide_init(struct device *dev)
34 /* Get the chip configuration */
35 config_t *config = dev->chip_info;
37 /* TODO: Needs to be tested for compatibility with ICH5(R). */
38 /* Enable IDE devices so the Linux IDE driver will work. */
39 uint16_t ideTimingConfig;
41 ideTimingConfig = pci_read_config16(dev, IDE_TIM_PRI);
42 ideTimingConfig &= ~IDE_DECODE_ENABLE;
43 if (!config || config->ide0_enable) {
44 /* Enable primary IDE interface. */
45 ideTimingConfig |= IDE_DECODE_ENABLE;
46 printk(BIOS_DEBUG, "IDE0: Primary IDE interface is enabled\n");
48 printk(BIOS_INFO, "IDE0: Primary IDE interface is disabled\n");
50 pci_write_config16(dev, IDE_TIM_PRI, ideTimingConfig);
52 ideTimingConfig = pci_read_config16(dev, IDE_TIM_SEC);
53 ideTimingConfig &= ~IDE_DECODE_ENABLE;
54 if (!config || config->ide1_enable) {
55 /* Enable secondary IDE interface. */
56 ideTimingConfig |= IDE_DECODE_ENABLE;
57 printk(BIOS_DEBUG, "IDE1: Secondary IDE interface is enabled\n");
59 printk(BIOS_INFO, "IDE1: Secondary IDE interface is disabled\n");
61 pci_write_config16(dev, IDE_TIM_SEC, ideTimingConfig);
64 static struct device_operations ide_ops = {
65 .read_resources = pci_dev_read_resources,
66 .set_resources = pci_dev_set_resources,
67 .enable_resources = pci_dev_enable_resources,
70 .enable = i82801bx_enable,
74 static const struct pci_driver i82801aa_ide __pci_driver = {
76 .vendor = PCI_VENDOR_ID_INTEL,
81 static const struct pci_driver i82801ab_ide __pci_driver = {
83 .vendor = PCI_VENDOR_ID_INTEL,
88 static const struct pci_driver i82801ba_ide __pci_driver = {
90 .vendor = PCI_VENDOR_ID_INTEL,
95 static const struct pci_driver i82801ca_ide __pci_driver = {
97 .vendor = PCI_VENDOR_ID_INTEL,
102 static const struct pci_driver i82801db_ide __pci_driver = {
104 .vendor = PCI_VENDOR_ID_INTEL,
109 static const struct pci_driver i82801dbm_ide __pci_driver = {
111 .vendor = PCI_VENDOR_ID_INTEL,
115 /* 82801EB & 82801ER */
116 static const struct pci_driver i82801ex_ide __pci_driver = {
118 .vendor = PCI_VENDOR_ID_INTEL,