summaryrefslogtreecommitdiff
path: root/src/device
diff options
context:
space:
mode:
authorKyösti Mälkki <kyosti.malkki@gmail.com>2015-03-19 21:04:23 +0200
committerKyösti Mälkki <kyosti.malkki@gmail.com>2015-06-04 11:22:53 +0200
commit580e7223bb617cfa14bf24e48bb39bac47c4e8e0 (patch)
tree13d7034347e8497dcbf7699746830727b33084bd /src/device
parent2d2367cd95dc6ab2dd51b1005675e42bab417769 (diff)
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>
Diffstat (limited to 'src/device')
-rw-r--r--src/device/device.c16
-rw-r--r--src/device/hypertransport.c4
-rw-r--r--src/device/pci_device.c17
-rw-r--r--src/device/pciexp_device.c4
-rw-r--r--src/device/pcix_device.c6
-rw-r--r--src/device/root_device.c24
6 files changed, 21 insertions, 50 deletions
diff --git a/src/device/device.c b/src/device/device.c
index a8900a69c6..6bdeae1e0a 100644
--- a/src/device/device.c
+++ b/src/device/device.c
@@ -913,16 +913,13 @@ int reset_bus(struct bus *bus)
* 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 @@ static unsigned int scan_bus(struct device *busdev, unsigned int max)
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 @@ static unsigned int scan_bus(struct device *busdev, unsigned int max)
}
}
}
- 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 @@ void dev_enumerate(void)
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 799038c5ed..584ac78457 100644
--- a/src/device/hypertransport.c
+++ b/src/device/hypertransport.c
@@ -502,9 +502,9 @@ static void hypertransport_scan_chain_x(struct bus *bus,
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 07b1993b0a..6332209a12 100644
--- a/src/device/pci_device.c
+++ b/src/device/pci_device.c
@@ -1215,11 +1215,9 @@ static void pci_bridge_route(struct bus *link, scan_state state)
* 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 @@ unsigned int do_pci_scan_bridge(struct device *dev, unsigned int max,
do_scan_bus(bus, 0x00, 0xff);
pci_bridge_route(bus, PCI_ROUTE_FINAL);
-
- return bus->subordinate;
}
/**
@@ -1258,12 +1254,10 @@ unsigned int do_pci_scan_bridge(struct device *dev, unsigned int max,
* 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 @@ unsigned int pci_scan_bridge(struct device *dev, unsigned int max)
* 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 5311397cb7..ee24456747 100644
--- a/src/device/pciexp_device.c
+++ b/src/device/pciexp_device.c
@@ -432,9 +432,9 @@ void pciexp_scan_bus(struct bus *bus, unsigned int min_devfn,
}
}
-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 cfa2f91c2f..7ed64df662 100644
--- a/src/device/pcix_device.c
+++ b/src/device/pcix_device.c
@@ -112,12 +112,12 @@ const char *pcix_speed(u16 sstatus)
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 @@ unsigned int pcix_scan_bridge(device_t dev, unsigned int max)
/* 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 4eae12ac44..01852758a2 100644
--- a/src/device/root_device.c
+++ b/src/device/root_device.c
@@ -45,11 +45,9 @@ const char mainboard_name[] = CONFIG_MAINBOARD_VENDOR " " CONFIG_MAINBOARD_PART_
* 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 @@ static unsigned int scan_static_bus(device_t bus, unsigned int passthru)
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 @@ unsigned int scan_smbus(device_t bus, unsigned int passthru)
}
printk(BIOS_SPEW, "%s for %s done\n", __func__, dev_path(bus));
-
- return passthru;
}
/**
@@ -121,23 +113,19 @@ unsigned int scan_smbus(device_t bus, unsigned int passthru)
* 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)