[coreboot-gerrit] New patch to review for coreboot: a2a856e AMD K8 fam10: Drop extra HT scan_chain parameters
Kyösti Mälkki (kyosti.malkki@gmail.com)
gerrit at coreboot.org
Sat Feb 28 16:16:35 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/8565
-gerrit
commit a2a856e20689bbbff2d0ead4b9b20dac8b9581ea
Author: Kyösti Mälkki <kyosti.malkki at gmail.com>
Date: Sun Feb 22 08:27:13 2015 +0200
AMD K8 fam10: Drop extra HT scan_chain parameters
Change-Id: Ice7cb89c19585cf725b6f73c33443050f8d65418
Signed-off-by: Kyösti Mälkki <kyosti.malkki at gmail.com>
---
src/device/hypertransport.c | 28 ++++++++++++++++++++++++++--
src/include/device/hypertransport.h | 3 +--
src/northbridge/amd/amdfam10/northbridge.c | 23 +----------------------
src/northbridge/amd/amdk8/northbridge.c | 23 +++--------------------
4 files changed, 31 insertions(+), 46 deletions(-)
diff --git a/src/device/hypertransport.c b/src/device/hypertransport.c
index 40cc2d5..ec0601b 100644
--- a/src/device/hypertransport.c
+++ b/src/device/hypertransport.c
@@ -248,7 +248,7 @@ static void ht_collapse_early_enumeration(struct bus *bus,
}
}
-unsigned int hypertransport_scan_chain(struct bus *bus, unsigned min_devfn,
+static unsigned int do_hypertransport_scan_chain(struct bus *bus, unsigned min_devfn,
unsigned max_devfn, unsigned int max,
unsigned *ht_unitid_base,
unsigned offset_unitid)
@@ -479,6 +479,30 @@ end_of_chain:
return max;
}
+unsigned int hypertransport_scan_chain(struct bus *bus, unsigned int max)
+{
+ int i;
+ unsigned int max_devfn;
+ u32 ht_unitid_base[4];
+
+ for (i = 0; i < 4; i++)
+ ht_unitid_base[i] = 0x20;
+
+ if (bus->secondary == 0)
+ max_devfn = (CONFIG_CDB << 3) - 1;
+ else
+ max_devfn = (0x20 << 3) - 1;
+
+ max = do_hypertransport_scan_chain(bus, 0, max_devfn, max,
+ ht_unitid_base, offset_unit_id(bus->secondary == 0));
+
+ bus->hcdn_reg = 0;
+ for (i = 0; i < 4; i++)
+ bus->hcdn_reg |= (ht_unitid_base[i] & 0xff) << (i*8);
+
+ return max;
+}
+
/**
* Scan a PCI bridge and the buses behind the bridge.
*
@@ -498,7 +522,7 @@ 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,
+ return do_hypertransport_scan_chain(bus, min_devfn, max_devfn, max,
ht_unitid_base, offset_unitid);
}
diff --git a/src/include/device/hypertransport.h b/src/include/device/hypertransport.h
index 0080e8d..6034b27 100644
--- a/src/include/device/hypertransport.h
+++ b/src/include/device/hypertransport.h
@@ -10,8 +10,7 @@
#define ConnectionPending (1 << 4)
bool ht_is_non_coherent_link(struct bus *link);
-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 int hypertransport_scan_chain(struct bus *bus, unsigned int max);
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 612c9a6..cf47a78 100644
--- a/src/northbridge/amd/amdfam10/northbridge.c
+++ b/src/northbridge/amd/amdfam10/northbridge.c
@@ -154,12 +154,6 @@ static void ht_route_link(struct bus *link)
static u32 amdfam10_scan_chain(struct bus *link, u32 max)
{
- int i;
- u32 ht_unitid_base[4]; // here assume only 4 HT device on chain
- u32 max_devfn;
-
- u32 nodeid = amdfam10_nodeid(link->dev);
-
/* See if there is an available configuration space mapping
* register in function 1.
*/
@@ -189,17 +183,7 @@ static u32 amdfam10_scan_chain(struct bus *link, u32 max)
/* Now we can scan all of the subordinate busses i.e. the
* chain on the hypertranport link
*/
- for(i=0;i<4;i++) {
- ht_unitid_base[i] = 0x20;
- }
-
- //if ext conf is enabled, only need use 0x1f
- if (link->secondary == 0)
- max_devfn = (0x17<<3) | 7;
- else
- max_devfn = (0x1f<<3) | 7;
-
- max = hypertransport_scan_chain(link, 0, max_devfn, max, ht_unitid_base, offset_unit_id(link->secondary == 0));
+ max = hypertransport_scan_chain(link, max);
/* We know the number of busses behind this bridge. Set the
* subordinate bus number to it's real value
@@ -213,11 +197,6 @@ static u32 amdfam10_scan_chain(struct bus *link, u32 max)
set_config_map_reg(link);
- /* Use ht_unitid_base to update hcdn_reg. */
- link->hcdn_reg = 0;
- for (i = 0; i < 4;i++)
- link->hcdn_reg |= (ht_unitid_base[i] & 0xff) << (i*8);
-
store_ht_c_conf_bus(link);
return max;
}
diff --git a/src/northbridge/amd/amdk8/northbridge.c b/src/northbridge/amd/amdk8/northbridge.c
index 4b47eba..872be51 100644
--- a/src/northbridge/amd/amdk8/northbridge.c
+++ b/src/northbridge/amd/amdk8/northbridge.c
@@ -102,11 +102,9 @@ static u32 amdk8_nodeid(device_t dev)
static u32 amdk8_scan_chain(struct bus *link, u32 max)
{
- int i;
+ int index;
u32 config_busses;
u32 free_reg, config_reg;
- u32 ht_unitid_base[4]; // here assume only 4 HT device on chain
- u32 max_devfn;
u32 nodeid = amdk8_nodeid(link->dev);
@@ -167,16 +165,7 @@ static u32 amdk8_scan_chain(struct bus *link, u32 max)
/* Now we can scan all of the subordinate busses i.e. the
* chain on the hypertranport link
*/
- for(i=0;i<4;i++) {
- ht_unitid_base[i] = 0x20;
- }
-
- if (link->secondary == 0)
- max_devfn = (0x17<<3) | 7;
- else
- max_devfn = (0x1f<<3) | 7;
-
- max = hypertransport_scan_chain(link, 0, max_devfn, max, ht_unitid_base, offset_unit_id(link->secondary == 0));
+ max = hypertransport_scan_chain(link, max);
/* We know the number of busses behind this bridge. Set the
* subordinate bus number to it's real value
@@ -189,13 +178,7 @@ static u32 amdk8_scan_chain(struct bus *link, u32 max)
(link->subordinate << 24);
f1_write_config32(config_reg, config_busses);
-
- // use config_reg and ht_unitid_base to update hcdn_reg
- link->hcdn_reg = 0;
- for (i = 0; i < 4; i++)
- link->hcdn_reg |= (ht_unitid_base[i] & 0xff) << (i*8);
-
- int index = (config_reg-0xe0) >> 2;
+ index = (config_reg-0xe0) >> 2;
sysconf.hcdn_reg[index] = link->hcdn_reg;
return max;
More information about the coreboot-gerrit
mailing list