Round 2 of i82801AX fixes to get it into a usable shape.
[coreboot.git] / src / southbridge / intel / i82801ax / i82801ax_ide.c
index 04a7a12a488c5ccc4ab99d8250b738d5a794d94a..98bc542d0786f44ce8952d80bf3929c17c3d85c3 100644 (file)
@@ -31,33 +31,24 @@ typedef struct southbridge_intel_i82801ax_config config_t;
 
 static void ide_init(struct device *dev)
 {
-       /* Get the chip configuration */
-       config_t *config = dev->chip_info;
+       u16 reg16;
+       config_t *conf = dev->chip_info;
 
-       /* Enable IDE devices so the Linux IDE driver will work. */
-       uint16_t ideTimingConfig;
+       reg16 = pci_read_config16(dev, IDE_TIM_PRI);
+       reg16 &= ~IDE_DECODE_ENABLE;
+       if (!conf || conf->ide0_enable)
+               reg16 |= IDE_DECODE_ENABLE;
+       printk(BIOS_DEBUG, "IDE: %s: %s\n", "Primary IDE interface",
+              conf->ide0_enable ? "on" : "off");
+       pci_write_config16(dev, IDE_TIM_PRI, reg16);
 
-       ideTimingConfig = pci_read_config16(dev, IDE_TIM_PRI);
-       ideTimingConfig &= ~IDE_DECODE_ENABLE;
-       if (!config || config->ide0_enable) {
-               /* Enable primary IDE interface. */
-               ideTimingConfig |= IDE_DECODE_ENABLE;
-               printk(BIOS_DEBUG, "IDE0: Primary IDE interface is enabled\n");
-       } else {
-               printk(BIOS_INFO, "IDE0: Primary IDE interface is disabled\n");
-       }
-       pci_write_config16(dev, IDE_TIM_PRI, ideTimingConfig);
-
-       ideTimingConfig = pci_read_config16(dev, IDE_TIM_SEC);
-       ideTimingConfig &= ~IDE_DECODE_ENABLE;
-       if (!config || config->ide1_enable) {
-               /* Enable secondary IDE interface. */
-               ideTimingConfig |= IDE_DECODE_ENABLE;
-               printk(BIOS_DEBUG, "IDE1: Secondary IDE interface is enabled\n");
-       } else {
-               printk(BIOS_INFO, "IDE1: Secondary IDE interface is disabled\n");
-       }
-       pci_write_config16(dev, IDE_TIM_SEC, ideTimingConfig);
+       reg16 = pci_read_config16(dev, IDE_TIM_SEC);
+       reg16 &= ~IDE_DECODE_ENABLE;
+       if (!conf || conf->ide1_enable)
+               reg16 |= IDE_DECODE_ENABLE;
+       printk(BIOS_DEBUG, "IDE: %s: %s\n", "Primary IDE interface",
+              conf->ide0_enable ? "on" : "off");
+       pci_write_config16(dev, IDE_TIM_SEC, reg16);
 }
 
 static struct device_operations ide_ops = {
@@ -69,17 +60,16 @@ static struct device_operations ide_ops = {
        .enable                 = i82801ax_enable,
 };
 
-/* 82801AA */
+/* 82801AA (ICH) */
 static const struct pci_driver i82801aa_ide __pci_driver = {
        .ops    = &ide_ops,
        .vendor = PCI_VENDOR_ID_INTEL,
        .device = 0x2411,
 };
 
-/* 82801AB */
+/* 82801AB (ICH0) */
 static const struct pci_driver i82801ab_ide __pci_driver = {
        .ops    = &ide_ops,
        .vendor = PCI_VENDOR_ID_INTEL,
        .device = 0x2421,
 };
-