[coreboot-gerrit] Patch set updated for coreboot: 0529538 HyperTransport: Move pci_scan_bus() call

Kyösti Mälkki (kyosti.malkki@gmail.com) gerrit at coreboot.org
Sat Mar 28 00:56:26 CET 2015


Kyösti Mälkki (kyosti.malkki at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/8687

-gerrit

commit 0529538485786c10ffeb4e14e7de9e53a63eea40
Author: Kyösti Mälkki <kyosti.malkki at gmail.com>
Date:   Thu Mar 12 16:16:59 2015 +0200

    HyperTransport: Move pci_scan_bus() call
    
    Allows to remove parameter max from the call, it is not involved
    with the unitid assignment.
    
    Change-Id: I087622f4ff69474f0b27cfd8709106ab8ac4ca98
    Signed-off-by: Kyösti Mälkki <kyosti.malkki at gmail.com>
---
 src/device/hypertransport.c                | 13 ++++++++-----
 src/include/device/hypertransport.h        |  2 +-
 src/northbridge/amd/amdfam10/northbridge.c |  6 +++++-
 src/northbridge/amd/amdk8/northbridge.c    |  6 +++++-
 4 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/src/device/hypertransport.c b/src/device/hypertransport.c
index d27e66b..1f73047 100644
--- a/src/device/hypertransport.c
+++ b/src/device/hypertransport.c
@@ -249,7 +249,7 @@ static void ht_collapse_early_enumeration(struct bus *bus,
 }
 
 unsigned int hypertransport_scan_chain(struct bus *bus, unsigned min_devfn,
-				       unsigned max_devfn, unsigned int max,
+				       unsigned max_devfn,
 				       unsigned *ht_unitid_base,
 				       unsigned offset_unitid)
 {
@@ -474,9 +474,7 @@ end_of_chain:
 			last_func->sibling = old_devices;
 	}
 
-	/* Now that nothing is overlapping it is safe to scan the children. */
-	max = pci_scan_bus(bus, 0x00, ((next_unitid - 1) << 3) | 7, max);
-	return max;
+	return next_unitid;
 }
 
 /**
@@ -498,8 +496,13 @@ static unsigned int hypertransport_scan_chain_x(struct bus *bus,
 {
 	unsigned int ht_unitid_base[4];
 	unsigned int offset_unitid = 1;
-	return hypertransport_scan_chain(bus, min_devfn, max_devfn, max,
+
+	unsigned int next_unitid = hypertransport_scan_chain(bus, min_devfn, max_devfn,
 					 ht_unitid_base, offset_unitid);
+
+	/* Now that nothing is overlapping it is safe to scan the children. */
+	max = pci_scan_bus(bus, 0x00, ((next_unitid - 1) << 3) | 7, max);
+	return max;
 }
 
 unsigned int ht_scan_bridge(struct device *dev, unsigned int max)
diff --git a/src/include/device/hypertransport.h b/src/include/device/hypertransport.h
index e927d61..03e327d 100644
--- a/src/include/device/hypertransport.h
+++ b/src/include/device/hypertransport.h
@@ -4,7 +4,7 @@
 #include <device/hypertransport_def.h>
 
 unsigned int hypertransport_scan_chain(struct bus *bus,
-	unsigned min_devfn, unsigned max_devfn, unsigned int max, unsigned *ht_unit_base, unsigned offset_unitid);
+	unsigned min_devfn, unsigned max_devfn, unsigned *ht_unit_base, unsigned offset_unitid);
 unsigned int ht_scan_bridge(struct device *dev, unsigned int max);
 extern struct device_operations default_ht_ops_bus;
 
diff --git a/src/northbridge/amd/amdfam10/northbridge.c b/src/northbridge/amd/amdfam10/northbridge.c
index 9206de7..b6e08a2 100644
--- a/src/northbridge/amd/amdfam10/northbridge.c
+++ b/src/northbridge/amd/amdfam10/northbridge.c
@@ -163,6 +163,7 @@ static u32 amdfam10_scan_chain(device_t dev, u32 nodeid, struct bus *link, bool
 
 
 		int i;
+		unsigned int next_unitid;
 		u32 ht_c_index;
 		u32 ht_unitid_base[4]; // here assume only 4 HT device on chain
 		u32 max_bus;
@@ -257,7 +258,10 @@ static u32 amdfam10_scan_chain(device_t dev, u32 nodeid, struct bus *link, bool
 		else
 			max_devfn = (0x1f<<3) | 7;
 
-		max = hypertransport_scan_chain(link, 0, max_devfn, max, ht_unitid_base, offset_unit_id(is_sblink));
+		next_unitid = hypertransport_scan_chain(link, 0, max_devfn, ht_unitid_base, offset_unit_id(is_sblink));
+
+		/* Now that nothing is overlapping it is safe to scan the children. */
+		max = pci_scan_bus(link, 0x00, ((next_unitid - 1) << 3) | 7, max);
 
 		/* We know the number of busses behind this bridge.  Set the
 		 * subordinate bus number to it's real value
diff --git a/src/northbridge/amd/amdk8/northbridge.c b/src/northbridge/amd/amdk8/northbridge.c
index a17aa65..77eedb5 100644
--- a/src/northbridge/amd/amdk8/northbridge.c
+++ b/src/northbridge/amd/amdk8/northbridge.c
@@ -105,6 +105,7 @@ static u32 amdk8_scan_chain(device_t dev, u32 nodeid, struct bus *link, bool is_
 				u32 max)
 {
 		int i;
+		unsigned int next_unitid;
 		u32 busses, config_busses;
 		u32 free_reg, config_reg;
 		u32 ht_unitid_base[4]; // here assume only 4 HT device on chain
@@ -209,7 +210,10 @@ static u32 amdk8_scan_chain(device_t dev, u32 nodeid, struct bus *link, bool is_
 		else
 			max_devfn = (0x1f<<3) | 7;
 
-		max = hypertransport_scan_chain(link, 0, max_devfn, max, ht_unitid_base, offset_unit_id(is_sblink));
+		next_unitid = hypertransport_scan_chain(link, 0, max_devfn, ht_unitid_base, offset_unit_id(is_sblink));
+
+		/* Now that nothing is overlapping it is safe to scan the children. */
+		max = pci_scan_bus(link, 0x00, ((next_unitid - 1) << 3) | 7, max);
 
 		/* We know the number of busses behind this bridge.  Set the
 		 * subordinate bus number to it's real value



More information about the coreboot-gerrit mailing list