diff options
author | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2015-02-22 08:27:13 +0200 |
---|---|---|
committer | Kyösti Mälkki <kyosti.malkki@gmail.com> | 2015-06-05 10:19:02 +0200 |
commit | ed7bc2c9cfc690cdb23cc9eb317511431c779e89 (patch) | |
tree | 88363a0893bb02721035b4da1616f81eb07d27df | |
parent | e8ea71278c6998f03abd690491fad5f884c618f2 (diff) |
AMD K8 fam10: Drop extra HT scan_chain() parameters
Change-Id: Ice7cb89c19585cf725b6f73c33443050f8d65418
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: http://review.coreboot.org/8565
Tested-by: build bot (Jenkins)
Reviewed-by: Edward O'Callaghan <edward.ocallaghan@koparo.com>
Reviewed-by: Timothy Pearson <tpearson@raptorengineeringinc.com>
-rw-r--r-- | src/device/hypertransport.c | 28 | ||||
-rw-r--r-- | src/include/device/hypertransport.h | 3 | ||||
-rw-r--r-- | src/northbridge/amd/amdfam10/northbridge.c | 19 | ||||
-rw-r--r-- | src/northbridge/amd/amdk8/northbridge.c | 22 |
4 files changed, 31 insertions, 41 deletions
diff --git a/src/device/hypertransport.c b/src/device/hypertransport.c index 5aea5e62c4..07a320db5a 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 *ht_unitid_base, unsigned offset_unitid) @@ -477,6 +477,30 @@ end_of_chain: return next_unitid; } +unsigned int hypertransport_scan_chain(struct bus *bus) +{ + 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; + + unsigned int next_unitid = do_hypertransport_scan_chain(bus, 0, max_devfn, + 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 next_unitid; +} + /** * Scan a PCI bridge and the buses behind the bridge. * @@ -495,7 +519,7 @@ static void hypertransport_scan_chain_x(struct bus *bus, unsigned int ht_unitid_base[4]; unsigned int offset_unitid = 1; - unsigned int next_unitid = hypertransport_scan_chain(bus, min_devfn, max_devfn, + unsigned int next_unitid = do_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. */ diff --git a/src/include/device/hypertransport.h b/src/include/device/hypertransport.h index b2ebecfdb1..bc8ccd48a4 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 *ht_unit_base, unsigned offset_unitid); +unsigned int hypertransport_scan_chain(struct bus *bus); void ht_scan_bridge(struct device *dev); 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 26a835b545..bcb6e3f936 100644 --- a/src/northbridge/amd/amdfam10/northbridge.c +++ b/src/northbridge/amd/amdfam10/northbridge.c @@ -174,10 +174,7 @@ static void ht_route_link(struct bus *link, scan_state mode) static u32 amdfam10_scan_chain(struct bus *link, u32 max) { - int i; unsigned int next_unitid; - u32 ht_unitid_base[4]; // here assume only 4 HT device on chain - u32 max_devfn; /* See if there is an available configuration space mapping * register in function 1. @@ -208,17 +205,8 @@ 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; - - next_unitid = hypertransport_scan_chain(link, 0, max_devfn, ht_unitid_base, offset_unit_id(link->secondary == 0)); + next_unitid = hypertransport_scan_chain(link); /* Now that nothing is overlapping it is safe to scan the children. */ pci_scan_bus(link, 0x00, ((next_unitid - 1) << 3) | 7); @@ -235,11 +223,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 link->subordinate; diff --git a/src/northbridge/amd/amdk8/northbridge.c b/src/northbridge/amd/amdk8/northbridge.c index 2783ad1302..1c62647eb3 100644 --- a/src/northbridge/amd/amdk8/northbridge.c +++ b/src/northbridge/amd/amdk8/northbridge.c @@ -118,12 +118,10 @@ static u32 amdk8_nodeid(device_t dev) static u32 amdk8_scan_chain(struct bus *link, u32 max) { - int i; unsigned int next_unitid; + 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); /* See if there is an available configuration space mapping @@ -183,16 +181,8 @@ 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; - next_unitid = hypertransport_scan_chain(link, 0, max_devfn, ht_unitid_base, offset_unit_id(link->secondary == 0)); + next_unitid = hypertransport_scan_chain(link); /* Now that nothing is overlapping it is safe to scan the children. */ pci_scan_bus(link, 0x00, ((next_unitid - 1) << 3) | 7); @@ -207,13 +197,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 link->subordinate; |