We define IO_APIC_ADDR in <arch/ioapic.h>, let's use it.
[coreboot.git] / src / southbridge / amd / sb600 / sb600_lpc.c
index 1f3253f55b9e54993fbee6e3400f1cd3df07792b..6a17f72318cef9d38987aef94440498e75e5a8f5 100644 (file)
@@ -27,6 +27,7 @@
 #include <pc80/isa-dma.h>
 #include <bitops.h>
 #include <arch/io.h>
+#include <arch/ioapic.h>
 #include "sb600.h"
 
 static void lpc_init(device_t dev)
@@ -84,7 +85,7 @@ static void sb600_lpc_read_resources(device_t dev)
                     IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
 
        res = new_resource(dev, 3); /* IOAPIC */
-       res->base = 0xfec00000;
+       res->base = IO_APIC_ADDR;
        res->size = 0x00001000;
        res->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
 
@@ -96,36 +97,26 @@ static void sb600_lpc_read_resources(device_t dev)
  *
  * @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()
- *      device_operation::enable_resources() -> enable_children_resources()
  */
 static void sb600_lpc_enable_childrens_resources(device_t dev)
 {
-       u32 link;
+       struct bus *link;
        u32 reg, reg_x;
-       int i;
        int var_num = 0;
        u16 reg_var[3];
 
        reg = pci_read_config32(dev, 0x44);
        reg_x = pci_read_config32(dev, 0x48);
 
-       for (link = 0; link < dev->links; link++) {
+       for (link = dev->link_list; link; link = link->next) {
                device_t child;
-               for (child = dev->link[link].children; child;
+               for (child = link->children; child;
                     child = child->sibling) {
-                       enable_resources(child);
                        if (child->enabled
                            && (child->path.type == DEVICE_PATH_PNP)) {
-                               for (i = 0; i < child->resources; i++) {
-                                       struct resource *res;
+                               struct resource *res;
+                               for (res = child->resource_list; res; res = res->next) {
                                        u32 base, end;  /*  don't need long long */
-                                       res = &child->resource[i];
                                        if (!(res->flags & IORESOURCE_IO))
                                                continue;
                                        base = res->base;