rename walk_static_devices

git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1552 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
Li-Ta Lo 2004-05-10 16:05:16 +00:00
parent 75337f7500
commit 9f0d0f9669
4 changed files with 26 additions and 24 deletions

View File

@ -37,8 +37,8 @@ static struct device **last_dev_p = &dev_root.next;
/**
* @brief Allocate a new device structure.
*
* Allocte a new device structure and attached it to the device tree as a child
* of the parent bus.
* Allocte a new device structure and attached it to the device tree as a
* child of the parent bus.
*
* @param parent parent bus the newly created device attached to.
* @param path path to the device to be created.
@ -76,7 +76,7 @@ device_t alloc_dev(struct bus *parent, struct device_path *path)
dev->link[link].link = link;
}
/* Add the new device to the children of the bus. */
/* Add the new device as a children of the bus. */
dev->bus = parent;
if (child) {
child->sibling = dev;
@ -452,8 +452,10 @@ void assign_resources(struct bus *bus)
*
* 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
* method and let that method to call it's children's enable_resoruces() via
* enable_childrens_resources().
*
* Indirect mutual recursion:
*/
void enable_resources(struct device *dev)
{

View File

@ -10,7 +10,6 @@
#include <device/device.h>
#include <device/pnp.h>
/* PNP fundamental operations */
void pnp_write_config(device_t dev, uint8_t reg, uint8_t value)
@ -53,7 +52,6 @@ void pnp_set_irq(device_t dev, unsigned index, unsigned irq)
pnp_write_config(dev, index, irq);
}
void pnp_set_drq(device_t dev, unsigned drq, unsigned index)
{
/* Index == 0x74 */
@ -76,7 +74,6 @@ static void pnp_set_resource(device_t dev, struct resource *resource)
}
/* Now store the resource */
resource->flags |= IORESOURCE_STORED;
if (resource->flags & IORESOURCE_IO) {
pnp_set_iobase(dev, resource->index, resource->base);
} else if (resource->flags & IORESOURCE_DRQ) {
@ -84,12 +81,11 @@ static void pnp_set_resource(device_t dev, struct resource *resource)
} else if (resource->flags & IORESOURCE_IRQ) {
pnp_set_irq(dev, resource->index, resource->base);
} else {
/* Don't let me think I stored the resource */
resource->flags &= ~IORESOURCE_STORED;
printk_err("ERROR: %s %02x unknown resource type\n",
dev_path(dev), resource->index);
return;
}
resource->flags |= IORESOURCE_STORED;
printk_debug("%s %02x <- [0x%08lx - 0x%08lx] %s\n", dev_path(dev),
resource->index, resource->base,

View File

@ -11,7 +11,7 @@ void root_dev_read_resources(device_t root)
{
int res = 0;
printk_spew("%s . Root is %p\n", __FUNCTION__, root);
printk_spew("%s . Root is %p\n", __FUNCTION__, dev_path(root));
/* Initialize the system wide io space constraints */
root->resource[res].base = 0x400;
root->resource[res].size = 0;
@ -63,11 +63,12 @@ void root_dev_set_resources(device_t root)
/**
* @brief Scan devices on static buses.
*
* The existence of devices on certain buses can be completely determined at
* compile time by the config file. Typical expamles are the 'PNP' devices
* on an legacy ISA/LPC bus. There is no need of probing of any kind, the
* only thing we have to do is to walk through the bus and enable or disable
* devices as indicated in the config file.
* The enumeration of certain buses is purely static. The existence of
* devices on those buses can be completely determined at compile time
* by the config file. Typical expamles are the 'PNP' devices on a legacy
* ISA/LPC bus. There is no need of probing of any kind, the only thing
* we have to do is to walk through the bus and enable or disable devices
* as indicated in the config file.
*
* This function is the default scan_bus() method for LPC bridges.
*
@ -80,7 +81,7 @@ unsigned int scan_static_bus(device_t bus, unsigned int max)
device_t child;
unsigned link;
printk_debug("%s entered\n", __FUNCTION__);
printk_debug("%s for %s\n", __FUNCTION__, dev_path(bus));
for (link = 0; link < bus->links; link++) {
for (child = bus->link[link].children; child; child = child->sibling) {
@ -110,7 +111,10 @@ unsigned int scan_static_bus(device_t bus, unsigned int max)
*
* @param dev the device whos children's resources are to be enabled
*
* This function is call by the enable_resource()
* This function is call by the enable_resource() indirectly via the
* enable_resources() method of devices.
*
* Indirect mutual recursion:
*/
void enable_childrens_resources(device_t dev)
{
@ -144,10 +148,10 @@ unsigned int root_dev_scan_pci_bus(device_t root, unsigned int max)
*
* This is the default device operation for root devices in PCI based systems.
* The static enumeration code chip_control::enumerate() of mainboards usually
* override this operation with their own device operations. An notable example
* is mainboard operations for AMD K8 mainboards. They replace the scan_bus()
* method with amdk8_scan_root_bus() due to the special device layout of AMD K8
* systems.
* override this operation with their own device operations. An notable
* example is mainboard operations for AMD K8 mainboards. They replace the
* scan_bus() method with amdk8_scan_root_bus() due to the special device
* layout of AMD K8 systems.
*/
struct device_operations default_dev_ops_root = {
.read_resources = root_dev_read_resources,

View File

@ -193,7 +193,7 @@ static struct device_operations lpc_ops = {
.set_resources = pci_dev_set_resources,
.enable_resources = pci_dev_enable_resources,
.init = lpc_init,
.scan_bus = walk_static_devices,
.scan_bus = scan_static_bus,
.enable = amd8111_enable,
};