printk_foo -> printk(BIOS_FOO, ...)
[coreboot.git] / src / southbridge / amd / sb600 / sb600_lpc.c
index c342e31f42e506155632722c14d06a8f734dc6c4..1f3253f55b9e54993fbee6e3400f1cd3df07792b 100644 (file)
@@ -70,26 +70,35 @@ static void sb600_lpc_read_resources(device_t dev)
 
        pci_get_resource(dev, 0xA0); /* SPI ROM base address */
 
-       /* Add an extra subtractive resource for both memory and I/O */
+       /* Add an extra subtractive resource for both memory and I/O. */
        res = new_resource(dev, IOINDEX_SUBTRACTIVE(0, 0));
-       res->flags =
-           IORESOURCE_IO | IORESOURCE_SUBTRACTIVE | IORESOURCE_ASSIGNED;
+       res->base = 0;
+       res->size = 0x1000;
+       res->flags = IORESOURCE_IO | IORESOURCE_SUBTRACTIVE |
+                    IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
 
        res = new_resource(dev, IOINDEX_SUBTRACTIVE(1, 0));
-       res->flags =
-           IORESOURCE_MEM | IORESOURCE_SUBTRACTIVE | IORESOURCE_ASSIGNED;
+       res->base = 0xff800000;
+       res->size = 0x00800000; /* 8 MB for flash */
+       res->flags = IORESOURCE_MEM | IORESOURCE_SUBTRACTIVE |
+                    IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
+
+       res = new_resource(dev, 3); /* IOAPIC */
+       res->base = 0xfec00000;
+       res->size = 0x00001000;
+       res->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
 
        compact_resources(dev);
 }
 
-/**     
+/**
  * @brief Enable resources for children devices
- *      
+ *
  * @param dev the device whos children's resources are to be enabled
- *      
+ *
  * This function is call by the global enable_resources() indirectly via the
  * device_operation::enable_resources() method of devices.
- *      
+ *
  * Indirect mutual recursion:
  *      enable_childrens_resources() -> enable_resources()
  *      enable_resources() -> device_operation::enable_resources()
@@ -111,18 +120,17 @@ static void sb600_lpc_enable_childrens_resources(device_t dev)
                for (child = dev->link[link].children; child;
                     child = child->sibling) {
                        enable_resources(child);
-                       if (child->have_resources
+                       if (child->enabled
                            && (child->path.type == DEVICE_PATH_PNP)) {
                                for (i = 0; i < child->resources; i++) {
                                        struct resource *res;
-                                       unsigned long base, end;        /*  don't need long long */
+                                       u32 base, end;  /*  don't need long long */
                                        res = &child->resource[i];
                                        if (!(res->flags & IORESOURCE_IO))
                                                continue;
                                        base = res->base;
                                        end = resource_end(res);
-                                       printk_debug
-                                           ("sb600 lpc decode:%s, base=0x%08x, end=0x%08x\n",
+                                       printk(BIOS_DEBUG, "sb600 lpc decode:%s, base=0x%08x, end=0x%08x\n",
                                             dev_path(child), base, end);
                                        switch (base) {
                                        case 0x60:      /*  KB */
@@ -165,7 +173,7 @@ static void sb600_lpc_enable_childrens_resources(device_t dev)
                                        case 0xfd60:
                                                reg_x |= (1 << 23);
                                                break;
-                                             default:
+                                       default:
                                                if (var_num >= 3)
                                                        continue;       /* only 3 var ; compact them ? */
                                                switch (var_num) {
@@ -188,6 +196,7 @@ static void sb600_lpc_enable_childrens_resources(device_t dev)
        }
        pci_write_config32(dev, 0x44, reg);
        pci_write_config32(dev, 0x48, reg_x);
+       /* Set WideIO for as many IOs found (fall through is on purpose) */
        switch (var_num) {
        case 2:
                pci_write_config16(dev, 0x90, reg_var[2]);
@@ -218,7 +227,7 @@ static struct device_operations lpc_ops = {
        /* .enable           = sb600_enable, */
        .ops_pci = &lops_pci,
 };
-static struct pci_driver lpc_driver __pci_driver = {
+static const struct pci_driver lpc_driver __pci_driver = {
        .ops = &lpc_ops,
        .vendor = PCI_VENDOR_ID_ATI,
        .device = PCI_DEVICE_ID_ATI_SB600_LPC,