printk_foo -> printk(BIOS_FOO, ...)
[coreboot.git] / src / southbridge / via / vt8231 / vt8231_ide.c
index 70f256990c23e057f7bcc3b25e3f0dc199a5341a..c1df5ef5cd100b6bcbc36503b71d1329ee009a8e 100644 (file)
@@ -3,33 +3,38 @@
 #include <device/pci.h>
 #include <device/pci_ops.h>
 #include <device/pci_ids.h>
-#include "vt8231.h"
 #include "chip.h"
 
 static void ide_init(struct device *dev)
 {
-       struct southbridge_via_vt8231_config *conf;
+       struct southbridge_via_vt8231_config *conf = (struct southbridge_via_vt8231_config *)dev->chip_info;
        unsigned char enables;
 
        if (!conf->enable_native_ide) {
                // Run the IDE controller in 'compatiblity mode - i.e. don't use PCI
                // interrupts.  Using PCI ints confuses linux for some reason.
-               
-               printk_info("%s: enabling compatibility IDE addresses\n", __FUNCTION__);
+               /* Setting reg 0x42 here does not work. It is set in mainboard/romstage.c
+               * It probably can only be changed while the IDE is disabled
+               * or it is possibly a timing issue. Ben Hewson 29 Apr 2007.
+               */
+
+               /*              
+               printk(BIOS_INFO, "%s: enabling compatibility IDE addresses\n", __func__);
                enables = pci_read_config8(dev, 0x42);
-               printk_debug("enables in reg 0x42 0x%x\n", enables);
+               printk(BIOS_DEBUG, "enables in reg 0x42 0x%x\n", enables);
                enables &= ~0xc0;               // compatability mode
                pci_write_config8(dev, 0x42, enables);
                enables = pci_read_config8(dev, 0x42);
-               printk_debug("enables in reg 0x42 read back as 0x%x\n", enables);
+               printk(BIOS_DEBUG, "enables in reg 0x42 read back as 0x%x\n", enables);
+               */
        }
        
        enables = pci_read_config8(dev, 0x40);
-       printk_debug("enables in reg 0x40 0x%x\n", enables);
+       printk(BIOS_DEBUG, "enables in reg 0x40 0x%x\n", enables);
        enables |= 3;
        pci_write_config8(dev, 0x40, enables);
        enables = pci_read_config8(dev, 0x40);
-       printk_debug("enables in reg 0x40 read back as 0x%x\n", enables);
+       printk(BIOS_DEBUG, "enables in reg 0x40 read back as 0x%x\n", enables);
        
        // Enable prefetch buffers
        enables = pci_read_config8(dev, 0x41);
@@ -53,7 +58,7 @@ static void ide_init(struct device *dev)
        // kevinh@ispiri.com - the standard linux drivers seem ass slow when 
        // used in native mode - I've changed back to classic
        enables = pci_read_config8(dev, 0x9);
-       printk_debug("enables in reg 0x9 0x%x\n", enables);
+       printk(BIOS_DEBUG, "enables in reg 0x9 0x%x\n", enables);
        // by the book, set the low-order nibble to 0xa. 
        if (conf->enable_native_ide) {
                enables &= ~0xf;
@@ -65,11 +70,11 @@ static void ide_init(struct device *dev)
        
        pci_write_config8(dev, 0x9, enables);
        enables = pci_read_config8(dev, 0x9);
-       printk_debug("enables in reg 0x9 read back as 0x%x\n", enables);
+       printk(BIOS_DEBUG, "enables in reg 0x9 read back as 0x%x\n", enables);
        
        // standard bios sets master bit. 
        enables = pci_read_config8(dev, 0x4);
-       printk_debug("command in reg 0x4 0x%x\n", enables);
+       printk(BIOS_DEBUG, "command in reg 0x4 0x%x\n", enables);
        enables |= 7;
        
        // No need for stepping - kevinh@ispiri.com
@@ -77,7 +82,7 @@ static void ide_init(struct device *dev)
        
        pci_write_config8(dev, 0x4, enables);
        enables = pci_read_config8(dev, 0x4);
-       printk_debug("command in reg 0x4 reads back as 0x%x\n", enables);
+       printk(BIOS_DEBUG, "command in reg 0x4 reads back as 0x%x\n", enables);
        
        if (!conf->enable_native_ide) {
                // Use compatability mode - per award bios
@@ -101,7 +106,7 @@ static struct device_operations ide_ops = {
        .ops_pci          = 0,
 };
 
-static struct pci_driver northbridge_driver __pci_driver = {
+static const struct pci_driver northbridge_driver __pci_driver = {
        .ops    = &ide_ops,
        .vendor = PCI_VENDOR_ID_VIA,
        .device = PCI_DEVICE_ID_VIA_82C586_1,