Kyösti Mälkki (kyosti.malkki(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/8351
-gerrit
commit c6b2a66a56188b51cf97f664a4e301945dc83dec
Author: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Date: Wed Feb 4 15:37:45 2015 +0200
AMD fam10: Refactor variables in scan_chain
We only need one of devx and dev. This function should be called
with dev already adjusted if link_num > 3.
Change-Id: I7166bbb88143bc28802c9530c4da16db67868d8e
Signed-off-by: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
---
src/northbridge/amd/amdfam10/northbridge.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/src/northbridge/amd/amdfam10/northbridge.c b/src/northbridge/amd/amdfam10/northbridge.c
index f2b18d0..f28c726 100644
--- a/src/northbridge/amd/amdfam10/northbridge.c
+++ b/src/northbridge/amd/amdfam10/northbridge.c
@@ -168,7 +168,6 @@ static u32 amdfam10_scan_chain(device_t dev, u32 nodeid, struct bus *link, bool
u32 ht_unitid_base[4]; // here assume only 4 HT device on chain
u32 max_bus;
u32 min_bus;
- device_t devx;
u32 busses;
u32 segn = max>>8;
#if CONFIG_SB_HT_CHAIN_ON_BUS0 > 1
@@ -182,14 +181,13 @@ static u32 amdfam10_scan_chain(device_t dev, u32 nodeid, struct bus *link, bool
regpos = 0x170 + 4 * (link->link_num & 3); // it is only on sublink0
reg = pci_read_config32(dev, regpos);
if(reg & 1) return max; // already ganged no sblink1
- devx = get_node_pci(nodeid, 4);
- } else {
- devx = dev;
+
+ dev = get_node_pci(nodeid, 4);
}
/* Check for connected link. */
link->cap = 0x80 + ((link->link_num & 3) * 0x20);
- if (!is_non_coherent_link(devx, link))
+ if (!is_non_coherent_link(dev, link))
return max;
/* See if there is an available configuration space mapping
@@ -233,7 +231,7 @@ static u32 amdfam10_scan_chain(device_t dev, u32 nodeid, struct bus *link, bool
/* Read the existing primary/secondary/subordinate bus
* number configuration.
*/
- busses = pci_read_config32(devx, link->cap + 0x14);
+ busses = pci_read_config32(dev, link->cap + 0x14);
/* Configure the bus numbers for this bridge: the configuration
* transactions will not be propagates by the bridge if it is
@@ -241,7 +239,7 @@ static u32 amdfam10_scan_chain(device_t dev, u32 nodeid, struct bus *link, bool
*/
busses &= 0xffff00ff;
busses |= ((u32)(link->secondary) << 8);
- pci_write_config32(devx, link->cap + 0x14, busses);
+ pci_write_config32(dev, link->cap + 0x14, busses);
/* set the config map space */
Kyösti Mälkki (kyosti.malkki(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/8352
-gerrit
commit 5382062a78c7aadabd342c3388aab24a065d3aec
Author: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Date: Wed Feb 4 11:20:27 2015 +0200
AMD K8 fam10: Fix preprocessor use with SB_HT_CHAIN_ON_BUS0
Change-Id: I6bbd1b5eaa66a640e0a2e132c8d67f38f103caf5
Signed-off-by: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
---
src/northbridge/amd/amdfam10/northbridge.c | 40 ++++++++++++------------------
src/northbridge/amd/amdk8/northbridge.c | 29 ++++++++--------------
2 files changed, 27 insertions(+), 42 deletions(-)
diff --git a/src/northbridge/amd/amdfam10/northbridge.c b/src/northbridge/amd/amdfam10/northbridge.c
index f28c726..a7d06fc 100644
--- a/src/northbridge/amd/amdfam10/northbridge.c
+++ b/src/northbridge/amd/amdfam10/northbridge.c
@@ -169,10 +169,6 @@ static u32 amdfam10_scan_chain(device_t dev, u32 nodeid, struct bus *link, bool
u32 max_bus;
u32 min_bus;
u32 busses;
- u32 segn = max>>8;
-#if CONFIG_SB_HT_CHAIN_ON_BUS0 > 1
- u32 busn = max&0xff;
-#endif
u32 max_devfn;
if (link->link_num > 3) {
@@ -201,28 +197,24 @@ static u32 amdfam10_scan_chain(device_t dev, u32 nodeid, struct bus *link, bool
* We have no idea how many busses are behind this bridge yet,
* so we set the subordinate bus number to 0xff for the moment.
*/
-#if CONFIG_SB_HT_CHAIN_ON_BUS0 > 0
- // first chain will on bus 0
- if (is_sblink) { // actually max is 0 here
- min_bus = max;
- }
- #if CONFIG_SB_HT_CHAIN_ON_BUS0 > 1
- // second chain will be on 0x40, third 0x80, forth 0xc0
- // i would refined that to 2, 3, 4 ==> 0, 0x, 40, 0x80, 0xc0
- // >4 will use more segments, We can have 16 segmment and every segment have 256 bus, For that case need the kernel support mmio pci config.
- else {
- min_bus = ((busn>>3) + 1) << 3; // one node can have 8 link and segn is the same
- }
- max = min_bus | (segn<<8);
- #else
- //other ...
- else {
+ u32 segn = max >> 8;
+ if (CONFIG_SB_HT_CHAIN_ON_BUS0 == 0) {
min_bus = ++max;
+ } else if (is_sblink) {
+ // first chain will on bus 0
+ min_bus = max; /* actually max is 0 here */
+ } else if (CONFIG_SB_HT_CHAIN_ON_BUS0 == 1) {
+ min_bus = ++max;
+ } else if (CONFIG_SB_HT_CHAIN_ON_BUS0 > 1) {
+ u32 busn = max & 0xff;
+ // second chain will be on 0x40, third 0x80, forth 0xc0
+ // i would refined that to 2, 3, 4 ==> 0, 0x, 40, 0x80, 0xc0
+ // >4 will use more segments,
+ // We can have 16 segmment and every segment have 256 bus,
+ // For that case need the kernel support mmio pci config.
+ min_bus = ((busn>>3) + 1) << 3; // one node can have 8 link and segn is the same
+ max = min_bus | (segn<<8);
}
- #endif
-#else
- min_bus = ++max;
-#endif
max_bus = 0xfc | (segn<<8);
link->secondary = min_bus;
diff --git a/src/northbridge/amd/amdk8/northbridge.c b/src/northbridge/amd/amdk8/northbridge.c
index 29fa2a4..f775c25 100644
--- a/src/northbridge/amd/amdk8/northbridge.c
+++ b/src/northbridge/amd/amdk8/northbridge.c
@@ -141,26 +141,19 @@ static u32 amdk8_scan_chain(device_t dev, u32 nodeid, struct bus *link, bool is_
* We have no idea how many busses are behind this bridge yet,
* so we set the subordinate bus number to 0xff for the moment.
*/
-#if CONFIG_SB_HT_CHAIN_ON_BUS0 > 0
- // first chain will on bus 0
- if(is_sblink) { // actually max is 0 here
- min_bus = max;
- }
- #if CONFIG_SB_HT_CHAIN_ON_BUS0 > 1
- // second chain will be on 0x40, third 0x80, forth 0xc0
- else {
- min_bus = ((max>>6) + 1) * 0x40;
- }
- max = min_bus;
- #else
- //other ...
- else {
+ if (CONFIG_SB_HT_CHAIN_ON_BUS0 == 0) {
min_bus = ++max;
+ } else if (is_sblink) {
+ // first chain will on bus 0
+ min_bus = max; /* actually max is 0 here */
+ } else if (CONFIG_SB_HT_CHAIN_ON_BUS0 == 1) {
+ min_bus = ++max;
+ } else if (CONFIG_SB_HT_CHAIN_ON_BUS0 > 1) {
+ // second chain will be on 0x40, third 0x80, forth 0xc0
+ min_bus = ((max>>6) + 1) * 0x40;
+ max = min_bus;
}
- #endif
-#else
- min_bus = ++max;
-#endif
+
max_bus = 0xff;
link->secondary = min_bus;
Kyösti Mälkki (kyosti.malkki(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/8351
-gerrit
commit a8a2ca0057a1d2aa1f2518d5470653b54b9f883c
Author: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Date: Wed Feb 4 15:37:45 2015 +0200
AMD fam10: Refactor variables in scan_chain
We only need one of devx and dev. This function should be called
with dev already adjusted if link_num > 3.
Change-Id: I7166bbb88143bc28802c9530c4da16db67868d8e
Signed-off-by: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
---
src/northbridge/amd/amdfam10/northbridge.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/src/northbridge/amd/amdfam10/northbridge.c b/src/northbridge/amd/amdfam10/northbridge.c
index f2b18d0..f28c726 100644
--- a/src/northbridge/amd/amdfam10/northbridge.c
+++ b/src/northbridge/amd/amdfam10/northbridge.c
@@ -168,7 +168,6 @@ static u32 amdfam10_scan_chain(device_t dev, u32 nodeid, struct bus *link, bool
u32 ht_unitid_base[4]; // here assume only 4 HT device on chain
u32 max_bus;
u32 min_bus;
- device_t devx;
u32 busses;
u32 segn = max>>8;
#if CONFIG_SB_HT_CHAIN_ON_BUS0 > 1
@@ -182,14 +181,13 @@ static u32 amdfam10_scan_chain(device_t dev, u32 nodeid, struct bus *link, bool
regpos = 0x170 + 4 * (link->link_num & 3); // it is only on sublink0
reg = pci_read_config32(dev, regpos);
if(reg & 1) return max; // already ganged no sblink1
- devx = get_node_pci(nodeid, 4);
- } else {
- devx = dev;
+
+ dev = get_node_pci(nodeid, 4);
}
/* Check for connected link. */
link->cap = 0x80 + ((link->link_num & 3) * 0x20);
- if (!is_non_coherent_link(devx, link))
+ if (!is_non_coherent_link(dev, link))
return max;
/* See if there is an available configuration space mapping
@@ -233,7 +231,7 @@ static u32 amdfam10_scan_chain(device_t dev, u32 nodeid, struct bus *link, bool
/* Read the existing primary/secondary/subordinate bus
* number configuration.
*/
- busses = pci_read_config32(devx, link->cap + 0x14);
+ busses = pci_read_config32(dev, link->cap + 0x14);
/* Configure the bus numbers for this bridge: the configuration
* transactions will not be propagates by the bridge if it is
@@ -241,7 +239,7 @@ static u32 amdfam10_scan_chain(device_t dev, u32 nodeid, struct bus *link, bool
*/
busses &= 0xffff00ff;
busses |= ((u32)(link->secondary) << 8);
- pci_write_config32(devx, link->cap + 0x14, busses);
+ pci_write_config32(dev, link->cap + 0x14, busses);
/* set the config map space */