diff options
author | Li-Ta Lo <ollie@lanl.gov> | 2004-04-26 17:51:20 +0000 |
---|---|---|
committer | Li-Ta Lo <ollie@lanl.gov> | 2004-04-26 17:51:20 +0000 |
commit | 5782d273eb79ed32d344273cf344b1580a936183 (patch) | |
tree | 37f7e3d68dcab4cc42fb09ca54d5250d910e9763 /src/devices/device.c | |
parent | 1e1a34fdd184a85569b645923b743ec5524fab1d (diff) | |
download | coreboot-5782d273eb79ed32d344273cf344b1580a936183.tar.xz |
check in the current code for IBM/E325, can somebody help to fix it ?
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1538 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/devices/device.c')
-rw-r--r-- | src/devices/device.c | 67 |
1 files changed, 40 insertions, 27 deletions
diff --git a/src/devices/device.c b/src/devices/device.c index 0186aa977a..d2b7e24f74 100644 --- a/src/devices/device.c +++ b/src/devices/device.c @@ -354,15 +354,13 @@ void compute_allocate_resource( resource->flags &= ~IORESOURCE_STORED; base += size; - printk_spew( - "%s %02x * [0x%08lx - 0x%08lx] %s\n", - dev_path(dev), - resource->index, - resource->base, resource->base + resource->size -1, - (resource->flags & IORESOURCE_IO)? "io": - (resource->flags & IORESOURCE_PREFETCH)? "prefmem": "mem"); + printk_spew("%s %02x * [0x%08lx - 0x%08lx] %s\n", + dev_path(dev), + resource->index, resource->base, + resource->base + resource->size - 1, + (resource->flags & IORESOURCE_IO)? "io": + (resource->flags & IORESOURCE_PREFETCH)? "prefmem": "mem"); } - } /* A pci bridge resource does not need to be a power * of two size, but it does have a minimum granularity. @@ -373,10 +371,10 @@ void compute_allocate_resource( bridge->size = round(base, 1UL << bridge->gran) - bridge->base; printk_spew("%s compute_allocate_%s: base: %08lx size: %08lx align: %d gran: %d done\n", - dev_path(dev), - (bridge->flags & IORESOURCE_IO)? "io": - (bridge->flags & IORESOURCE_PREFETCH)? "prefmem" : "mem", - base, bridge->size, bridge->align, bridge->gran); + dev_path(dev), + (bridge->flags & IORESOURCE_IO)? "io": + (bridge->flags & IORESOURCE_PREFETCH)? "prefmem" : "mem", + base, bridge->size, bridge->align, bridge->gran); } @@ -420,7 +418,8 @@ static void allocate_vga_resource(void) /** Assign the computed resources to the bridges and devices on the bus. * Recurse to any bridges found on this bus first. Then do the devices - * on this bus. + * on this bus. + * * @param bus Pointer to the structure for this bus */ void assign_resources(struct bus *bus) @@ -443,15 +442,23 @@ void assign_resources(struct bus *bus) printk_debug("ASSIGNED RESOURCES, bus %d\n", bus->secondary); } +/** + * @brief Enable the resources for a specific device + * + * @param dev the device whose resources are to be enabled + * + * Enable resources of the device by calling the device specific + * enable_resources() method. + * + * The parent's resources should be enabled first to avoid having enabling + * order problem. This is done by calling the parent's enable_resources() + * method and let the method to call it's children's enable_resoruces() via + * enable_childrens_resources(). + */ void enable_resources(struct device *dev) { - /* Enable the resources for a specific device. - * The parents resources should be enabled first to avoid - * having enabling ordering problems. - */ if (!dev->ops || !dev->ops->enable_resources) { - printk_err("%s missing enable_resources\n", - dev_path(dev)); + printk_err("%s missing enable_resources\n", dev_path(dev)); return; } if (!dev->enable) { @@ -464,12 +471,13 @@ void enable_resources(struct device *dev) * @brief Determine the existence of dynamic devices and construct dynamic * device tree. * - * Start for the root device 'dev_root', scan the buses in the system, build - * the dynamic device tree according to the result of the probe. + * Start for the root device 'dev_root', scan the buses in the system + * recursively, build the dynamic device tree according to the result + * of the probe. * - * This function have no idea how to scan and probe the buses and devices at - * all. It depends on the bus/device specific scan_bus() method to do it. - * The scan_bus() function also have to create the device structure and attach + * This function has no idea how to scan and probe buses and devices at all. + * It depends on the bus/device specific scan_bus() method to do it. The + * scan_bus() function also have to create the device structure and attach * it to the device tree. */ void dev_enumerate(void) @@ -488,9 +496,14 @@ void dev_enumerate(void) /** * @brief Configure devices on the devices tree. * - * Starting at the root, compute what resources are needed and allocate them. - * I/O starts at PCI_IO_START. Since the assignment is hierarchical we - * set the values into the dev_root struct. + * Starting at the root of the dynamic device tree, travel recursively, + * compute resources needed by each device and allocate them. + * + * I/O resources start at DEVICE_IO_START and grow upward. MEM resources start + * at DEVICE_MEM_START and grow downward. + * + * Since the assignment is hierarchical we set the values into the dev_root + * struct. */ void dev_configure(void) { |