2 * This file is part of the coreboot project.
4 * Copyright (C) 2007 Uwe Hermann <uwe@hermann-uwe.de>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
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>
28 * Initialize the IDE controller.
30 * Depending on the configuration variables 'ide0_enable' and 'ide1_enable'
31 * enable or disable the primary and secondary IDE interface, respectively.
33 * @param dev The device to use.
35 static void ide_init(struct device *dev)
38 struct southbridge_amd_cs5530_config *conf = dev->chip_info;
40 reg8 = pci_read_config8(dev, DECODE_CONTROL_REG2);
42 /* Enable/disable the primary IDE interface. */
43 if (conf->ide0_enable) {
44 reg8 |= PRIMARY_IDE_ENABLE;
46 reg8 &= ~(PRIMARY_IDE_ENABLE);
49 /* Enable/disable the secondary IDE interface. */
50 if (conf->ide1_enable) {
51 reg8 |= SECONDARY_IDE_ENABLE;
53 reg8 &= ~(SECONDARY_IDE_ENABLE);
56 pci_write_config8(dev, DECODE_CONTROL_REG2, reg8);
58 printk_info("%s IDE interface %s\n", "Primary",
59 conf->ide0_enable ? "enabled" : "disabled");
60 printk_info("%s IDE interface %s\n", "Secondary",
61 conf->ide1_enable ? "enabled" : "disabled");
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 .scan_bus = scan_static_bus,
74 static const struct pci_driver ide_driver __pci_driver = {
76 .vendor = PCI_VENDOR_ID_CYRIX,
77 .device = PCI_DEVICE_ID_CYRIX_5530_IDE,