devicetree: Change scan_bus() prototype in device ops
The input/output value max is no longer used for tracking the
bus enumeration sequence, everything is handled in the context
of devicetree bus objects.
Change-Id: I545088bd8eaf205b1436d8c52d3bc7faf4cfb0f9
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: http://review.coreboot.org/8541
Tested-by: build bot (Jenkins)
Tested-by: Raptor Engineering Automated Test Stand <noreply@raptorengineeringinc.com>
Reviewed-by: Timothy Pearson <tpearson@raptorengineeringinc.com>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
diff --git a/src/device/device.c b/src/device/device.c
index a8900a6..6bdeae1 100644
--- a/src/device/device.c
+++ b/src/device/device.c
@@ -913,16 +913,13 @@
* required, reset the bus and scan it again.
*
* @param busdev Pointer to the bus device.
- * @param max Current bus number.
- * @return The maximum bus number found, after scanning all subordinate buses.
*/
-static unsigned int scan_bus(struct device *busdev, unsigned int max)
+static void scan_bus(struct device *busdev)
{
- unsigned int new_max;
int do_scan_bus;
if (!busdev->enabled)
- return max;
+ return;
printk(BIOS_SPEW, "%s scanning...\n", dev_path(busdev));
@@ -931,7 +928,7 @@
do_scan_bus = 1;
while (do_scan_bus) {
struct bus *link;
- new_max = busdev->ops->scan_bus(busdev, max);
+ busdev->ops->scan_bus(busdev);
do_scan_bus = 0;
for (link = busdev->link_list; link; link = link->next) {
if (link->reset_needed) {
@@ -942,20 +939,17 @@
}
}
}
- return new_max;
}
void scan_bridges(struct bus *bus)
{
struct device *child;
- unsigned int max = bus->secondary;
for (child = bus->children; child; child = child->sibling) {
if (!child->ops || !child->ops->scan_bus)
continue;
- max = scan_bus(child, max);
+ scan_bus(child);
}
- bus->subordinate = max;
}
/**
@@ -999,7 +993,7 @@
printk(BIOS_ERR, "dev_root missing scan_bus operation");
return;
}
- scan_bus(root, 0);
+ scan_bus(root);
post_log_clear();
printk(BIOS_INFO, "done\n");
}
diff --git a/src/device/hypertransport.c b/src/device/hypertransport.c
index 799038c..584ac78 100644
--- a/src/device/hypertransport.c
+++ b/src/device/hypertransport.c
@@ -502,9 +502,9 @@
pci_scan_bus(bus, 0x00, ((next_unitid - 1) << 3) | 7);
}
-unsigned int ht_scan_bridge(struct device *dev, unsigned int max)
+void ht_scan_bridge(struct device *dev)
{
- return do_pci_scan_bridge(dev, max, hypertransport_scan_chain_x);
+ do_pci_scan_bridge(dev, hypertransport_scan_chain_x);
}
/** Default device operations for hypertransport bridges */
diff --git a/src/device/pci_device.c b/src/device/pci_device.c
index 07b1993..6332209 100644
--- a/src/device/pci_device.c
+++ b/src/device/pci_device.c
@@ -1215,11 +1215,9 @@
* This function is the default scan_bus() method for PCI bridge devices.
*
* @param dev Pointer to the bridge device.
- * @param max The highest bus number assigned up to now.
* @param do_scan_bus TODO
- * @return The maximum bus number found, after scanning all subordinate buses.
*/
-unsigned int do_pci_scan_bridge(struct device *dev, unsigned int max,
+void do_pci_scan_bridge(struct device *dev,
void (*do_scan_bus) (struct bus * bus,
unsigned min_devfn,
unsigned max_devfn))
@@ -1245,8 +1243,6 @@
do_scan_bus(bus, 0x00, 0xff);
pci_bridge_route(bus, PCI_ROUTE_FINAL);
-
- return bus->subordinate;
}
/**
@@ -1258,12 +1254,10 @@
* This function is the default scan_bus() method for PCI bridge devices.
*
* @param dev Pointer to the bridge device.
- * @param max The highest bus number assigned up to now.
- * @return The maximum bus number found, after scanning all subordinate buses.
*/
-unsigned int pci_scan_bridge(struct device *dev, unsigned int max)
+void pci_scan_bridge(struct device *dev)
{
- return do_pci_scan_bridge(dev, max, pci_scan_bus);
+ do_pci_scan_bridge(dev, pci_scan_bus);
}
/**
@@ -1272,14 +1266,11 @@
* This function is the default scan_bus() method for PCI domains.
*
* @param dev Pointer to the domain.
- * @param max The highest bus number assigned up to now.
- * @return The maximum bus number found, after scanning all subordinate busses.
*/
-unsigned int pci_domain_scan_bus(device_t dev, unsigned int unused)
+void pci_domain_scan_bus(device_t dev)
{
struct bus *link = dev->link_list;
pci_scan_bus(link, PCI_DEVFN(0, 0), 0xff);
- return unused;
}
/**
diff --git a/src/device/pciexp_device.c b/src/device/pciexp_device.c
index 5311397..ee24456 100644
--- a/src/device/pciexp_device.c
+++ b/src/device/pciexp_device.c
@@ -432,9 +432,9 @@
}
}
-unsigned int pciexp_scan_bridge(device_t dev, unsigned int max)
+void pciexp_scan_bridge(device_t dev)
{
- return do_pci_scan_bridge(dev, max, pciexp_scan_bus);
+ do_pci_scan_bridge(dev, pciexp_scan_bus);
}
/** Default device operations for PCI Express bridges */
diff --git a/src/device/pcix_device.c b/src/device/pcix_device.c
index cfa2f91..7ed64df 100644
--- a/src/device/pcix_device.c
+++ b/src/device/pcix_device.c
@@ -112,12 +112,12 @@
return result;
}
-unsigned int pcix_scan_bridge(device_t dev, unsigned int max)
+void pcix_scan_bridge(device_t dev)
{
unsigned int pos;
u16 sstatus;
- max = do_pci_scan_bridge(dev, max, pci_scan_bus);
+ do_pci_scan_bridge(dev, pci_scan_bus);
/* Find the PCI-X capability. */
pos = pci_find_capability(dev, PCI_CAP_ID_PCIX);
@@ -129,8 +129,6 @@
/* Print the PCI-X bus speed. */
printk(BIOS_DEBUG, "PCI: %02x: %s\n", dev->link_list->secondary,
pcix_speed(sstatus));
-
- return max;
}
/** Default device operations for PCI-X bridges */
diff --git a/src/device/root_device.c b/src/device/root_device.c
index 4eae12a..0185275 100644
--- a/src/device/root_device.c
+++ b/src/device/root_device.c
@@ -45,11 +45,9 @@
* file under some static bus in order to be enumerated at run time.
*
* @param bus Pointer to the device to which the static buses are attached to.
- * @param max Maximum bus number currently used before scanning.
- * @return The largest bus number used.
*/
-static unsigned int scan_static_bus(device_t bus, unsigned int passthru)
+static void scan_static_bus(device_t bus)
{
device_t child;
struct bus *link;
@@ -67,22 +65,18 @@
child->enabled ? "enabled" : "disabled");
}
}
-
- return passthru;
}
-unsigned int scan_lpc_bus(device_t bus, unsigned int passthru)
+void scan_lpc_bus(device_t bus)
{
printk(BIOS_SPEW, "%s for %s\n", __func__, dev_path(bus));
- scan_static_bus(bus, 0);
+ scan_static_bus(bus);
printk(BIOS_SPEW, "%s for %s done\n", __func__, dev_path(bus));
-
- return passthru;
}
-unsigned int scan_smbus(device_t bus, unsigned int passthru)
+void scan_smbus(device_t bus)
{
device_t child;
struct bus *link;
@@ -111,8 +105,6 @@
}
printk(BIOS_SPEW, "%s for %s done\n", __func__, dev_path(bus));
-
- return passthru;
}
/**
@@ -121,23 +113,19 @@
* This function is the default scan_bus() method of the root device.
*
* @param root The root device structure.
- * @param max The current bus number scanned so far, usually 0x00.
- * @return The largest bus number used.
*/
-static unsigned int root_dev_scan_bus(device_t bus, unsigned int passthru)
+static void root_dev_scan_bus(device_t bus)
{
struct bus *link;
printk(BIOS_SPEW, "%s for %s\n", __func__, dev_path(bus));
- scan_static_bus(bus, 0);
+ scan_static_bus(bus);
for (link = bus->link_list; link; link = link->next)
scan_bridges(link);
printk(BIOS_SPEW, "%s for %s done\n", __func__, dev_path(bus));
-
- return passthru;
}
static void root_dev_reset(struct bus *bus)