summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLi-Ta Lo <ollie@lanl.gov>2004-05-10 16:05:16 +0000
committerLi-Ta Lo <ollie@lanl.gov>2004-05-10 16:05:16 +0000
commit9f0d0f9669a2421398700292dbb377eff125c4fe (patch)
tree06fbda9fba79c00cda2e4774f00cef981211ab33 /src
parent75337f7500cbddc1bea2927573c8eadaa4455d7f (diff)
rename walk_static_devices
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1552 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src')
-rw-r--r--src/devices/device.c10
-rw-r--r--src/devices/pnp_device.c6
-rw-r--r--src/devices/root_device.c28
-rw-r--r--src/southbridge/amd/amd8111/amd8111_lpc.c6
4 files changed, 26 insertions, 24 deletions
diff --git a/src/devices/device.c b/src/devices/device.c
index 60e79c5a58..ec8bb8e66e 100644
--- a/src/devices/device.c
+++ b/src/devices/device.c
@@ -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)
{
diff --git a/src/devices/pnp_device.c b/src/devices/pnp_device.c
index 9bee8e471f..5f4ede1ec4 100644
--- a/src/devices/pnp_device.c
+++ b/src/devices/pnp_device.c
@@ -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,
diff --git a/src/devices/root_device.c b/src/devices/root_device.c
index 301db1889d..10cebbaf38 100644
--- a/src/devices/root_device.c
+++ b/src/devices/root_device.c
@@ -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,
diff --git a/src/southbridge/amd/amd8111/amd8111_lpc.c b/src/southbridge/amd/amd8111/amd8111_lpc.c
index b6e25d2c5e..79c9f70fe1 100644
--- a/src/southbridge/amd/amd8111/amd8111_lpc.c
+++ b/src/southbridge/amd/amd8111/amd8111_lpc.c
@@ -84,7 +84,7 @@ static void setup_ioapic(void)
return;
}
printk_spew("for IRQ, reg 0x%08x value 0x%08x 0x%08x\n",
- a->reg, a->value_low, a->value_high);
+ a->reg, a->value_low, a->value_high);
}
}
@@ -141,7 +141,7 @@ static void lpc_init(struct device *dev)
pci_write_config8(dev, 0x40, byte);
nmi_option = NMI_OFF;
get_option(&nmi_option, "nmi");
- if(nmi_option) {
+ if (nmi_option) {
byte |= (1 << 7); /* set NMI */
pci_write_config8(dev, 0x40, byte);
}
@@ -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,
};