AMD K8 fam10: Drop redundant parameters on scan_chain()

Change-Id: I6041b666e6792cf97b8273ed54832d86af8ed23e
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: http://review.coreboot.org/8563
Tested-by: build bot (Jenkins)
Reviewed-by: Edward O'Callaghan <edward.ocallaghan@koparo.com>
Reviewed-by: Timothy Pearson <tpearson@raptorengineeringinc.com>
This commit is contained in:
Kyösti Mälkki 2015-02-28 12:03:20 +02:00
parent 0a3d4e4b03
commit 328531ffc7
2 changed files with 11 additions and 21 deletions

View File

@ -172,17 +172,16 @@ static void ht_route_link(struct bus *link, scan_state mode)
} }
static u32 amdfam10_scan_chain(device_t dev, u32 nodeid, struct bus *link, bool is_sblink, static u32 amdfam10_scan_chain(struct bus *link, u32 max)
u32 max)
{ {
// I want to put sb chain in bus 0 can I?
int i; int i;
unsigned int next_unitid; unsigned int next_unitid;
u32 ht_unitid_base[4]; // here assume only 4 HT device on chain u32 ht_unitid_base[4]; // here assume only 4 HT device on chain
u32 max_devfn; u32 max_devfn;
u32 nodeid = amdfam10_nodeid(link->dev);
bool is_sblink = (nodeid == 0) && (link->link_num == sysconf.sblk);
/* See if there is an available configuration space mapping /* See if there is an available configuration space mapping
* register in function 1. * register in function 1.
*/ */
@ -289,20 +288,15 @@ static void trim_ht_chain(struct device *dev)
static void amdfam10_scan_chains(device_t dev) static void amdfam10_scan_chains(device_t dev)
{ {
unsigned nodeid;
struct bus *link; struct bus *link;
unsigned sblink = sysconf.sblk;
unsigned int max = dev->bus->subordinate; unsigned int max = dev->bus->subordinate;
nodeid = amdfam10_nodeid(dev);
/* Do sb ht chain at first, in case s2885 put sb chain (8131/8111) on link2, but put 8151 on link0 */ /* Do sb ht chain at first, in case s2885 put sb chain (8131/8111) on link2, but put 8151 on link0 */
trim_ht_chain(dev); trim_ht_chain(dev);
for (link = dev->link_list; link; link = link->next) { for (link = dev->link_list; link; link = link->next) {
bool is_sblink = (nodeid == 0) && (link->link_num == sblink);
if (link->ht_link_up) if (link->ht_link_up)
max = amdfam10_scan_chain(dev, nodeid, link, is_sblink, max); max = amdfam10_scan_chain(link, max);
} }
dev->bus->subordinate = max; dev->bus->subordinate = max;

View File

@ -116,8 +116,7 @@ static u32 amdk8_nodeid(device_t dev)
return (dev->path.pci.devfn >> 3) - 0x18; return (dev->path.pci.devfn >> 3) - 0x18;
} }
static u32 amdk8_scan_chain(device_t dev, u32 nodeid, struct bus *link, bool is_sblink, static u32 amdk8_scan_chain(struct bus *link, u32 max)
u32 max)
{ {
int i; int i;
unsigned int next_unitid; unsigned int next_unitid;
@ -126,6 +125,10 @@ static u32 amdk8_scan_chain(device_t dev, u32 nodeid, struct bus *link, bool is_
u32 ht_unitid_base[4]; // here assume only 4 HT device on chain u32 ht_unitid_base[4]; // here assume only 4 HT device on chain
u32 max_devfn; u32 max_devfn;
u32 nodeid = amdk8_nodeid(link->dev);
unsigned int sblink = (pci_read_config32(link->dev, 0x64)>>8) & 3;
bool is_sblink = (nodeid == 0) && (link->link_num == sblink);
/* See if there is an available configuration space mapping /* See if there is an available configuration space mapping
* register in function 1. * register in function 1.
*/ */
@ -259,21 +262,14 @@ static void trim_ht_chain(struct device *dev)
static void amdk8_scan_chains(device_t dev) static void amdk8_scan_chains(device_t dev)
{ {
unsigned nodeid;
struct bus *link; struct bus *link;
unsigned sblink = 0;
unsigned int max = dev->bus->subordinate; unsigned int max = dev->bus->subordinate;
nodeid = amdk8_nodeid(dev);
if (nodeid == 0)
sblink = (pci_read_config32(dev, 0x64)>>8) & 3;
trim_ht_chain(dev); trim_ht_chain(dev);
for (link = dev->link_list; link; link = link->next) { for (link = dev->link_list; link; link = link->next) {
bool is_sblink = (nodeid == 0) && (link->link_num == sblink);
if (link->ht_link_up) if (link->ht_link_up)
max = amdk8_scan_chain(dev, nodeid, link, is_sblink, max); max = amdk8_scan_chain(link, max);
} }
dev->bus->subordinate = max; dev->bus->subordinate = max;