We define IO_APIC_ADDR in <arch/ioapic.h>, let's use it.
[coreboot.git] / src / southbridge / amd / sb700 / sb700_lpc.c
index ab0a5ba6ccc92548191e32a427ed36ac50723429..a3a50c6c9b7cca20a10f6e5f36e657e3973b140e 100644 (file)
@@ -27,6 +27,7 @@
 #include <pc80/isa-dma.h>
 #include <bitops.h>
 #include <arch/io.h>
+#include <arch/ioapic.h>
 #include "sb700.h"
 
 static void lpc_init(device_t dev)
@@ -42,7 +43,11 @@ static void lpc_init(device_t dev)
        pci_write_config32(sm_dev, 0x64, dword);
 
        /* Initialize isa dma */
+#if CONFIG_SOUTHBRIDGE_AMD_SB700_SKIP_ISA_DMA_INIT
+       printk(BIOS_DEBUG, "Skipping isa_dma_init() to avoid getting stuck.\n");
+#else
        isa_dma_init();
+#endif
 
        /* Enable DMA transaction on the LPC bus */
        byte = pci_read_config8(dev, 0x40);
@@ -58,7 +63,6 @@ static void lpc_init(device_t dev)
        byte = pci_read_config8(dev, 0x78);
        byte &= ~(1 << 1);
        pci_write_config8(dev, 0x78, byte);
-
 }
 
 static void sb700_lpc_read_resources(device_t dev)
@@ -84,7 +88,7 @@ static void sb700_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;
 
@@ -100,25 +104,17 @@ static void sb700_lpc_set_resources(struct device *dev)
        /* Specical case. SPI Base Address. The SpiRomEnable should be set. */
        res = find_resource(dev, 0xA0);
        pci_write_config32(dev, 0xA0, res->base | 1 << 1);
-
 }
 
 /**
  * @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.
+ * @param dev the device whose children's resources are to be enabled
  *
- * Indirect mutual recursion:
- *      enable_childrens_resources() -> enable_resources()
- *      enable_resources() -> device_operation::enable_resources()
- *      device_operation::enable_resources() -> enable_children_resources()
  */
 static void sb700_lpc_enable_childrens_resources(device_t dev)
 {
-       u32 link;
+       struct bus *link;
        u32 reg, reg_x;
        int var_num = 0;
        u16 reg_var[3];
@@ -126,11 +122,10 @@ static void sb700_lpc_enable_childrens_resources(device_t dev)
        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)) {
                                struct resource *res;