[coreboot] Subtractive Resources

Myles Watson mylesgw at gmail.com
Fri Nov 7 16:18:51 CET 2008


I'm running into a problem when resources are read.

The amd8111 adds two subtractive resources on link 0.  The problem is that
it has no link 0.

static void amd8111_lpc_read_resources(struct device * dev)
{
    struct resource *res;

    printk(BIOS_DEBUG,"%s calls read_resources with %s bus %s \n",
            __func__, dev->dtsname, dev->bus? dev->bus->dev->dtsname:
"NULL");
    /* Get the normal pci resources of this device */
    pci_dev_read_resources(dev);

    /* 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 = new_resource(dev, IOINDEX_SUBTRACTIVE(1, 0));
    res->flags = IORESOURCE_MEM | IORESOURCE_SUBTRACTIVE |
IORESOURCE_ASSIGNED;
    printk(BIOS_DEBUG,"%s after read_resources\n", __func__);
}

Either of these changes fix it, but I'd like a little more understanding of
why we're trying to do this.

I like the first change better because it quits trying sooner.

Index: device/device.c
===================================================================
--- device/device.c     (revision 984)
+++ device/device.c     (working copy)
@@ -311,7 +311,7 @@

                /* Read in subtractive resources behind the current device.
*/
                links = 0;
-               for (i = 0; i < curdev->resources; i++) {
+               for (i = 0; i < curdev->resources && curdev->links>0; i++) {
                        struct resource *resource;
                        unsigned int link;
                        resource = &curdev->resource[i];
@@ -326,7 +326,8 @@
                        }
                        if (!(links & (1 << link))) {
                                links |= (1 << link);
-                               read_resources(&curdev->link[link]);
+                               if (curdev->link[link].dev)
+                                       read_resources(&curdev->link[link]);
                        }
                }
        }


Signed-off-by: Myles Watson <mylesgw at gmail.com>

Thanks,
Myles
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.coreboot.org/pipermail/coreboot/attachments/20081107/d60d9f41/attachment.html>


More information about the coreboot mailing list