get_bus_conf.c: reindent with indent

Change-Id: Ia0c37339aa69b92a1b518fa5e49adc4a7628ae5d
Signed-off-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-on: http://review.coreboot.org/3979
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
Tested-by: build bot (Jenkins)
This commit is contained in:
Paul Menzel 2013-10-18 09:42:55 +02:00 committed by Jonathan A. Kollasch
parent cd9abf95e7
commit 6a4e9b547a
16 changed files with 1201 additions and 1150 deletions

View File

@ -15,8 +15,7 @@
// Global variables for MB layouts and these will be shared by irqtable mptable and acpi_tables // Global variables for MB layouts and these will be shared by irqtable mptable and acpi_tables
struct mb_sysconf_t mb_sysconf; struct mb_sysconf_t mb_sysconf;
static unsigned pci1234x[] = static unsigned pci1234x[] = { //Here you only need to set value in pci1234 for HT-IO that could be installed or not
{ //Here you only need to set value in pci1234 for HT-IO that could be installed or not
//You may need to preset pci1234 for HTIO board, please refer to src/northbridge/amd/amdk8/get_sblk_pci1234.c for detail //You may need to preset pci1234 for HTIO board, please refer to src/northbridge/amd/amdk8/get_sblk_pci1234.c for detail
0x0000ff0, 0x0000ff0,
0x0000ff0, 0x0000ff0,
@ -27,8 +26,8 @@ static unsigned pci1234x[] =
// 0x0000ff0, // 0x0000ff0,
// 0x0000ff0 // 0x0000ff0
}; };
static unsigned hcdnx[] =
{ //HT Chain device num, actually it is unit id base of every ht device in chain, assume every chain only have 4 ht device at most static unsigned hcdnx[] = { //HT Chain device num, actually it is unit id base of every ht device in chain, assume every chain only have 4 ht device at most
0x20202020, 0x20202020,
0x20202020, 0x20202020,
// 0x20202020, // 0x20202020,
@ -39,8 +38,6 @@ static unsigned hcdnx[] =
// 0x20202020, // 0x20202020,
}; };
static unsigned get_bus_conf_done = 0; static unsigned get_bus_conf_done = 0;
static unsigned get_hcid(unsigned i) static unsigned get_hcid(unsigned i)
@ -53,7 +50,7 @@ static unsigned get_hcid(unsigned i)
device_t dev; device_t dev;
dev = dev_find_slot(busn, PCI_DEVFN(devn,0)); dev = dev_find_slot(busn, PCI_DEVFN(devn, 0));
switch (dev->device) { switch (dev->device) {
case 0x7458: //8132 case 0x7458: //8132
@ -83,7 +80,8 @@ void get_bus_conf(void)
int i, j; int i, j;
struct mb_sysconf_t *m; struct mb_sysconf_t *m;
if(get_bus_conf_done == 1) return; //do it only once if (get_bus_conf_done == 1)
return; //do it only once
get_bus_conf_done = 1; get_bus_conf_done = 1;
@ -92,7 +90,7 @@ void get_bus_conf(void)
m = sysconf.mb; m = sysconf.mb;
sysconf.hc_possible_num = ARRAY_SIZE(pci1234x); sysconf.hc_possible_num = ARRAY_SIZE(pci1234x);
for(i=0;i<sysconf.hc_possible_num; i++) { for (i = 0; i < sysconf.hc_possible_num; i++) {
sysconf.pci1234[i] = pci1234x[i]; sysconf.pci1234[i] = pci1234x[i];
sysconf.hcdn[i] = hcdnx[i]; sysconf.hcdn[i] = hcdnx[i];
} }
@ -106,41 +104,45 @@ void get_bus_conf(void)
m->bus_8111_0 = m->bus_8132_0; m->bus_8111_0 = m->bus_8132_0;
/* 8111 */ /* 8111 */
dev = dev_find_slot(m->bus_8111_0, PCI_DEVFN(sysconf.sbdn,0)); dev = dev_find_slot(m->bus_8111_0, PCI_DEVFN(sysconf.sbdn, 0));
if (dev) { if (dev) {
m->bus_8111_1 = pci_read_config8(dev, PCI_SECONDARY_BUS); m->bus_8111_1 = pci_read_config8(dev, PCI_SECONDARY_BUS);
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI %02x:%02x.0, using defaults\n", m->bus_8111_0, sysconf.sbdn); "ERROR - could not find PCI %02x:%02x.0, using defaults\n",
m->bus_8111_0, sysconf.sbdn);
} }
/* 8132-1 */ /* 8132-1 */
dev = dev_find_slot(m->bus_8132_0, PCI_DEVFN(m->sbdn3,0)); dev = dev_find_slot(m->bus_8132_0, PCI_DEVFN(m->sbdn3, 0));
if (dev) { if (dev) {
m->bus_8132_1 = pci_read_config8(dev, PCI_SECONDARY_BUS); m->bus_8132_1 = pci_read_config8(dev, PCI_SECONDARY_BUS);
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI %02x:%02x.0, using defaults\n", m->bus_8132_0, m->sbdn3); "ERROR - could not find PCI %02x:%02x.0, using defaults\n",
m->bus_8132_0, m->sbdn3);
} }
/* 8132-2 */ /* 8132-2 */
dev = dev_find_slot(m->bus_8132_0, PCI_DEVFN(m->sbdn3+1,0)); dev = dev_find_slot(m->bus_8132_0, PCI_DEVFN(m->sbdn3 + 1, 0));
if (dev) { if (dev) {
m->bus_8132_2 = pci_read_config8(dev, PCI_SECONDARY_BUS); m->bus_8132_2 = pci_read_config8(dev, PCI_SECONDARY_BUS);
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI %02x:%02x.0, using defaults\n", m->bus_8132_0, m->sbdn3+1); "ERROR - could not find PCI %02x:%02x.0, using defaults\n",
m->bus_8132_0, m->sbdn3 + 1);
} }
/* HT chain 1 */ /* HT chain 1 */
j=0; j = 0;
for(i=1; i< sysconf.hc_possible_num; i++) { for (i = 1; i < sysconf.hc_possible_num; i++) {
if(!(sysconf.pci1234[i] & 0x1) ) continue; if (!(sysconf.pci1234[i] & 0x1))
continue;
// check hcid type here // check hcid type here
sysconf.hcid[i] = get_hcid(i); sysconf.hcid[i] = get_hcid(i);
switch(sysconf.hcid[i]) { switch (sysconf.hcid[i]) {
case 1: //8132 case 1: //8132
case 3: //8131 case 3: //8131
@ -150,21 +152,29 @@ void get_bus_conf(void)
m->sbdn3a[j] = sysconf.hcdn[i] & 0xff; m->sbdn3a[j] = sysconf.hcdn[i] & 0xff;
/* 8132-1 */ /* 8132-1 */
dev = dev_find_slot(m->bus_8132a[j][0], PCI_DEVFN(m->sbdn3a[j],0)); dev =
dev_find_slot(m->bus_8132a[j][0],
PCI_DEVFN(m->sbdn3a[j], 0));
if (dev) { if (dev) {
m->bus_8132a[j][1] = pci_read_config8(dev, PCI_SECONDARY_BUS); m->bus_8132a[j][1] =
} pci_read_config8(dev, PCI_SECONDARY_BUS);
else { } else {
printk(BIOS_DEBUG, "ERROR - could not find PCI %02x:%02x.0, using defaults\n", m->bus_8132a[j][0], m->sbdn3a[j]); printk(BIOS_DEBUG,
"ERROR - could not find PCI %02x:%02x.0, using defaults\n",
m->bus_8132a[j][0], m->sbdn3a[j]);
} }
/* 8132-2 */ /* 8132-2 */
dev = dev_find_slot(m->bus_8132a[j][0], PCI_DEVFN(m->sbdn3a[j]+1,0)); dev =
dev_find_slot(m->bus_8132a[j][0],
PCI_DEVFN(m->sbdn3a[j] + 1, 0));
if (dev) { if (dev) {
m->bus_8132a[j][2] = pci_read_config8(dev, PCI_SECONDARY_BUS); m->bus_8132a[j][2] =
} pci_read_config8(dev, PCI_SECONDARY_BUS);
else { } else {
printk(BIOS_DEBUG, "ERROR - could not find PCI %02x:%02x.0, using defaults\n", m->bus_8132a[j][0], m->sbdn3a[j]+1); printk(BIOS_DEBUG,
"ERROR - could not find PCI %02x:%02x.0, using defaults\n",
m->bus_8132a[j][0], m->sbdn3a[j] + 1);
} }
break; break;
@ -174,14 +184,18 @@ void get_bus_conf(void)
m->bus_8151[j][0] = (sysconf.pci1234[i] >> 16) & 0xff; m->bus_8151[j][0] = (sysconf.pci1234[i] >> 16) & 0xff;
m->sbdn5[j] = sysconf.hcdn[i] & 0xff; m->sbdn5[j] = sysconf.hcdn[i] & 0xff;
/* 8151 */ /* 8151 */
dev = dev_find_slot(m->bus_8151[j][0], PCI_DEVFN(m->sbdn5[j]+1, 0)); dev =
dev_find_slot(m->bus_8151[j][0],
PCI_DEVFN(m->sbdn5[j] + 1, 0));
if (dev) { if (dev) {
m->bus_8151[j][1] = pci_read_config8(dev, PCI_SECONDARY_BUS); m->bus_8151[j][1] =
pci_read_config8(dev, PCI_SECONDARY_BUS);
// printk(BIOS_DEBUG, "bus_8151_1=%d\n",bus_8151[j][1]); // printk(BIOS_DEBUG, "bus_8151_1=%d\n",bus_8151[j][1]);
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI %02x:%02x.0, using defaults\n", m->bus_8151[j][0], m->sbdn5[j]+1); "ERROR - could not find PCI %02x:%02x.0, using defaults\n",
m->bus_8151[j][0], m->sbdn5[j] + 1);
} }
break; break;
@ -190,19 +204,18 @@ void get_bus_conf(void)
j++; j++;
} }
/*I/O APICs: APIC ID Version State Address*/ /*I/O APICs: APIC ID Version State Address*/
#if CONFIG_LOGICAL_CPUS #if CONFIG_LOGICAL_CPUS
apicid_base = get_apicid_base(3); apicid_base = get_apicid_base(3);
#else #else
apicid_base = CONFIG_MAX_PHYSICAL_CPUS; apicid_base = CONFIG_MAX_PHYSICAL_CPUS;
#endif #endif
m->apicid_8111 = apicid_base+0; m->apicid_8111 = apicid_base + 0;
m->apicid_8132_1 = apicid_base+1; m->apicid_8132_1 = apicid_base + 1;
m->apicid_8132_2 = apicid_base+2; m->apicid_8132_2 = apicid_base + 2;
for(i=0;i<j;i++) { for (i = 0; i < j; i++) {
m->apicid_8132a[i][0] = apicid_base + 3 + i*2; m->apicid_8132a[i][0] = apicid_base + 3 + i * 2;
m->apicid_8132a[i][1] = apicid_base + 3 + i*2 + 1; m->apicid_8132a[i][1] = apicid_base + 3 + i * 2 + 1;
} }
} }

View File

@ -10,7 +10,6 @@
#include <cpu/amd/amdk8_sysconf.h> #include <cpu/amd/amdk8_sysconf.h>
#include <stdlib.h> #include <stdlib.h>
// Global variables for MB layouts and these will be shared by irqtable mptable and acpi_tables // Global variables for MB layouts and these will be shared by irqtable mptable and acpi_tables
//busnum is default //busnum is default
unsigned char bus_bcm5780[7]; unsigned char bus_bcm5780[7];
@ -19,9 +18,7 @@ unsigned char bus_bcm5785_1 = 8;
unsigned char bus_bcm5785_1_1 = 9; unsigned char bus_bcm5785_1_1 = 9;
unsigned apicid_bcm5785[3]; unsigned apicid_bcm5785[3];
unsigned pci1234x[] = { //Here you only need to set value in pci1234 for HT-IO that could be installed or not
unsigned pci1234x[] =
{ //Here you only need to set value in pci1234 for HT-IO that could be installed or not
//You may need to preset pci1234 for HTIO board, please refer to src/northbridge/amd/amdk8/get_sblk_pci1234.c for detail //You may need to preset pci1234 for HTIO board, please refer to src/northbridge/amd/amdk8/get_sblk_pci1234.c for detail
0x0000ff0, 0x0000ff0,
// 0x0000ff0, // 0x0000ff0,
@ -32,8 +29,8 @@ unsigned pci1234x[] =
// 0x0000ff0, // 0x0000ff0,
// 0x0000ff0 // 0x0000ff0
}; };
unsigned hcdnx[] =
{ //HT Chain device num, actually it is unit id base of every ht device in chain, assume every chain only have 4 ht device at most unsigned hcdnx[] = { //HT Chain device num, actually it is unit id base of every ht device in chain, assume every chain only have 4 ht device at most
0x20202020, 0x20202020,
// 0x20202020, // 0x20202020,
// 0x20202020, // 0x20202020,
@ -43,10 +40,9 @@ unsigned hcdnx[] =
// 0x20202020, // 0x20202020,
// 0x20202020, // 0x20202020,
}; };
unsigned sbdn2; unsigned sbdn2;
static unsigned get_bus_conf_done = 0; static unsigned get_bus_conf_done = 0;
void get_bus_conf(void) void get_bus_conf(void)
@ -57,12 +53,13 @@ void get_bus_conf(void)
device_t dev; device_t dev;
int i; int i;
if(get_bus_conf_done==1) return; //do it only once if (get_bus_conf_done == 1)
return; //do it only once
get_bus_conf_done = 1; get_bus_conf_done = 1;
sysconf.hc_possible_num = ARRAY_SIZE(pci1234x); sysconf.hc_possible_num = ARRAY_SIZE(pci1234x);
for(i=0;i<sysconf.hc_possible_num; i++) { for (i = 0; i < sysconf.hc_possible_num; i++) {
sysconf.pci1234[i] = pci1234x[i]; sysconf.pci1234[i] = pci1234x[i];
sysconf.hcdn[i] = hcdnx[i]; sysconf.hcdn[i] = hcdnx[i];
} }
@ -76,36 +73,40 @@ void get_bus_conf(void)
bus_bcm5780[0] = bus_bcm5785_0; bus_bcm5780[0] = bus_bcm5785_0;
/* bcm5785 */ /* bcm5785 */
dev = dev_find_slot(bus_bcm5785_0, PCI_DEVFN(sysconf.sbdn,0)); dev = dev_find_slot(bus_bcm5785_0, PCI_DEVFN(sysconf.sbdn, 0));
if (dev) { if (dev) {
bus_bcm5785_1 = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_bcm5785_1 = pci_read_config8(dev, PCI_SECONDARY_BUS);
dev = dev_find_slot(bus_bcm5785_1, PCI_DEVFN(0x0d,0)); dev = dev_find_slot(bus_bcm5785_1, PCI_DEVFN(0x0d, 0));
if(dev) { if (dev) {
bus_bcm5785_1_1 = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_bcm5785_1_1 =
pci_read_config8(dev, PCI_SECONDARY_BUS);
} }
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI %02x:07.0, using defaults\n", bus_bcm5785_0); "ERROR - could not find PCI %02x:07.0, using defaults\n",
bus_bcm5785_0);
} }
/* bcm5780 */ /* bcm5780 */
for(i = 1; i < 7; i++) { for (i = 1; i < 7; i++) {
dev = dev_find_slot(bus_bcm5780[0], PCI_DEVFN(sbdn2 + i - 1,0)); dev =
if(dev) { dev_find_slot(bus_bcm5780[0], PCI_DEVFN(sbdn2 + i - 1, 0));
bus_bcm5780[i] = pci_read_config8(dev, PCI_SECONDARY_BUS); if (dev) {
} bus_bcm5780[i] =
else { pci_read_config8(dev, PCI_SECONDARY_BUS);
printk(BIOS_DEBUG, "ERROR - could not find PCI %02x:01.0, using defaults\n", bus_bcm5780[i]); } else {
printk(BIOS_DEBUG,
"ERROR - could not find PCI %02x:01.0, using defaults\n",
bus_bcm5780[i]);
} }
} }
/*I/O APICs: APIC ID Version State Address*/ /*I/O APICs: APIC ID Version State Address*/
#if CONFIG_LOGICAL_CPUS #if CONFIG_LOGICAL_CPUS
apicid_base = get_apicid_base(3); apicid_base = get_apicid_base(3);
#else #else
apicid_base = CONFIG_MAX_PHYSICAL_CPUS; apicid_base = CONFIG_MAX_PHYSICAL_CPUS;
#endif #endif
for(i=0;i<3;i++) for (i = 0; i < 3; i++)
apicid_bcm5785[i] = apicid_base+i; apicid_bcm5785[i] = apicid_base + i;
} }

View File

@ -33,15 +33,12 @@
#include <cpu/amd/amdk8_sysconf.h> #include <cpu/amd/amdk8_sysconf.h>
#include <stdlib.h> #include <stdlib.h>
// Global variables for MB layouts and these will be shared by irqtable mptable and acpi_tables // Global variables for MB layouts and these will be shared by irqtable mptable and acpi_tables
//busnum is default //busnum is default
unsigned char bus_sis966[8]; //1 unsigned char bus_sis966[8]; //1
unsigned apicid_sis966; unsigned apicid_sis966;
unsigned pci1234x[] = { //Here you only need to set value in pci1234 for HT-IO that could be installed or not
unsigned pci1234x[] =
{ //Here you only need to set value in pci1234 for HT-IO that could be installed or not
//You may need to preset pci1234 for HTIO board, please refer to src/northbridge/amd/amdk8/get_sblk_pci1234.c for detail //You may need to preset pci1234 for HTIO board, please refer to src/northbridge/amd/amdk8/get_sblk_pci1234.c for detail
0x0000ff0, 0x0000ff0,
// 0x0000ff0, // 0x0000ff0,
@ -52,8 +49,8 @@ unsigned pci1234x[] =
// 0x0000ff0, // 0x0000ff0,
// 0x0000ff0 // 0x0000ff0
}; };
unsigned hcdnx[] =
{ //HT Chain device num, actually it is unit id base of every ht device in chain, assume every chain only have 4 ht device at most unsigned hcdnx[] = { //HT Chain device num, actually it is unit id base of every ht device in chain, assume every chain only have 4 ht device at most
0x20202020, 0x20202020,
// 0x20202020, // 0x20202020,
// 0x20202020, // 0x20202020,
@ -75,12 +72,13 @@ void get_bus_conf(void)
device_t dev; device_t dev;
int i; int i;
if(get_bus_conf_done==1) return; //do it only once if (get_bus_conf_done == 1)
return; //do it only once
get_bus_conf_done = 1; get_bus_conf_done = 1;
sysconf.hc_possible_num = ARRAY_SIZE(pci1234x); sysconf.hc_possible_num = ARRAY_SIZE(pci1234x);
for(i=0;i<sysconf.hc_possible_num; i++) { for (i = 0; i < sysconf.hc_possible_num; i++) {
sysconf.pci1234[i] = pci1234x[i]; sysconf.pci1234[i] = pci1234x[i];
sysconf.hcdn[i] = hcdnx[i]; sysconf.hcdn[i] = hcdnx[i];
} }
@ -90,40 +88,43 @@ void get_bus_conf(void)
sysconf.sbdn = (sysconf.hcdn[0] & 0xff); // first byte of first chain sysconf.sbdn = (sysconf.hcdn[0] & 0xff); // first byte of first chain
sbdn = sysconf.sbdn; sbdn = sysconf.sbdn;
for(i=0; i<8; i++) { for (i = 0; i < 8; i++) {
bus_sis966[i] = 0; bus_sis966[i] = 0;
} }
bus_sis966[0] = (sysconf.pci1234[0] >> 16) & 0xff; bus_sis966[0] = (sysconf.pci1234[0] >> 16) & 0xff;
/* SIS966 */ /* SIS966 */
dev = dev_find_slot(bus_sis966[0], PCI_DEVFN(sbdn + 0x06,0)); dev = dev_find_slot(bus_sis966[0], PCI_DEVFN(sbdn + 0x06, 0));
if (dev) { if (dev) {
bus_sis966[1] = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_sis966[1] = pci_read_config8(dev, PCI_SECONDARY_BUS);
bus_sis966[2] = pci_read_config8(dev, PCI_SUBORDINATE_BUS); bus_sis966[2] = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
bus_sis966[2]++; bus_sis966[2]++;
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI 1:%02x.0, using defaults\n", sbdn + 0x06); "ERROR - could not find PCI 1:%02x.0, using defaults\n",
sbdn + 0x06);
bus_sis966[1] = 2; bus_sis966[1] = 2;
bus_sis966[2] = 3; bus_sis966[2] = 3;
} }
for(i=2; i<8;i++) { for (i = 2; i < 8; i++) {
dev = dev_find_slot(bus_sis966[0], PCI_DEVFN(sbdn + 0x0a + i - 2 , 0)); dev =
dev_find_slot(bus_sis966[0],
PCI_DEVFN(sbdn + 0x0a + i - 2, 0));
if (dev) { if (dev) {
bus_sis966[i] = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_sis966[i] =
pci_read_config8(dev, PCI_SECONDARY_BUS);
} }
} }
/*I/O APICs: APIC ID Version State Address*/ /*I/O APICs: APIC ID Version State Address*/
#if CONFIG_LOGICAL_CPUS #if CONFIG_LOGICAL_CPUS
apicid_base = get_apicid_base(1); apicid_base = get_apicid_base(1);
#else #else
apicid_base = CONFIG_MAX_PHYSICAL_CPUS; apicid_base = CONFIG_MAX_PHYSICAL_CPUS;
#endif #endif
apicid_sis966 = apicid_base+0; apicid_sis966 = apicid_base + 0;
} }

View File

@ -31,15 +31,12 @@
#include <cpu/amd/amdk8_sysconf.h> #include <cpu/amd/amdk8_sysconf.h>
#include <stdlib.h> #include <stdlib.h>
// Global variables for MB layouts and these will be shared by irqtable mptable and acpi_tables // Global variables for MB layouts and these will be shared by irqtable mptable and acpi_tables
//busnum is default //busnum is default
unsigned char bus_mcp55[8]; //1 unsigned char bus_mcp55[8]; //1
unsigned apicid_mcp55; unsigned apicid_mcp55;
unsigned pci1234x[] = { //Here you only need to set value in pci1234 for HT-IO that could be installed or not
unsigned pci1234x[] =
{ //Here you only need to set value in pci1234 for HT-IO that could be installed or not
//You may need to preset pci1234 for HTIO board, please refer to src/northbridge/amd/amdk8/get_sblk_pci1234.c for detail //You may need to preset pci1234 for HTIO board, please refer to src/northbridge/amd/amdk8/get_sblk_pci1234.c for detail
0x0000ff0, 0x0000ff0,
// 0x0000ff0, // 0x0000ff0,
@ -50,8 +47,8 @@ unsigned pci1234x[] =
// 0x0000ff0, // 0x0000ff0,
// 0x0000ff0 // 0x0000ff0
}; };
unsigned hcdnx[] =
{ //HT Chain device num, actually it is unit id base of every ht device in chain, assume every chain only have 4 ht device at most unsigned hcdnx[] = { //HT Chain device num, actually it is unit id base of every ht device in chain, assume every chain only have 4 ht device at most
0x20202020, 0x20202020,
// 0x20202020, // 0x20202020,
// 0x20202020, // 0x20202020,
@ -73,12 +70,13 @@ void get_bus_conf(void)
device_t dev; device_t dev;
int i; int i;
if(get_bus_conf_done==1) return; //do it only once if (get_bus_conf_done == 1)
return; //do it only once
get_bus_conf_done = 1; get_bus_conf_done = 1;
sysconf.hc_possible_num = ARRAY_SIZE(pci1234x); sysconf.hc_possible_num = ARRAY_SIZE(pci1234x);
for(i=0;i<sysconf.hc_possible_num; i++) { for (i = 0; i < sysconf.hc_possible_num; i++) {
sysconf.pci1234[i] = pci1234x[i]; sysconf.pci1234[i] = pci1234x[i];
sysconf.hcdn[i] = hcdnx[i]; sysconf.hcdn[i] = hcdnx[i];
} }
@ -88,40 +86,42 @@ void get_bus_conf(void)
sysconf.sbdn = (sysconf.hcdn[0] & 0xff); // first byte of first chain sysconf.sbdn = (sysconf.hcdn[0] & 0xff); // first byte of first chain
sbdn = sysconf.sbdn; sbdn = sysconf.sbdn;
for(i=0; i<8; i++) { for (i = 0; i < 8; i++) {
bus_mcp55[i] = 0; bus_mcp55[i] = 0;
} }
bus_mcp55[0] = (sysconf.pci1234[0] >> 16) & 0xff; bus_mcp55[0] = (sysconf.pci1234[0] >> 16) & 0xff;
/* MCP55 */ /* MCP55 */
dev = dev_find_slot(bus_mcp55[0], PCI_DEVFN(sbdn + 0x06,0)); dev = dev_find_slot(bus_mcp55[0], PCI_DEVFN(sbdn + 0x06, 0));
if (dev) { if (dev) {
bus_mcp55[1] = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_mcp55[1] = pci_read_config8(dev, PCI_SECONDARY_BUS);
bus_mcp55[2] = pci_read_config8(dev, PCI_SUBORDINATE_BUS); bus_mcp55[2] = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
bus_mcp55[2]++; bus_mcp55[2]++;
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI 1:%02x.0, using defaults\n", sbdn + 0x06); "ERROR - could not find PCI 1:%02x.0, using defaults\n",
sbdn + 0x06);
bus_mcp55[1] = 2; bus_mcp55[1] = 2;
bus_mcp55[2] = 3; bus_mcp55[2] = 3;
} }
for(i=2; i<8;i++) { for (i = 2; i < 8; i++) {
dev = dev_find_slot(bus_mcp55[0], PCI_DEVFN(sbdn + 0x0a + i - 2 , 0)); dev =
dev_find_slot(bus_mcp55[0],
PCI_DEVFN(sbdn + 0x0a + i - 2, 0));
if (dev) { if (dev) {
bus_mcp55[i] = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_mcp55[i] = pci_read_config8(dev, PCI_SECONDARY_BUS);
} }
} }
/*I/O APICs: APIC ID Version State Address*/ /*I/O APICs: APIC ID Version State Address*/
#if CONFIG_LOGICAL_CPUS #if CONFIG_LOGICAL_CPUS
apicid_base = get_apicid_base(1); apicid_base = get_apicid_base(1);
#else #else
apicid_base = CONFIG_MAX_PHYSICAL_CPUS; apicid_base = CONFIG_MAX_PHYSICAL_CPUS;
#endif #endif
apicid_mcp55 = apicid_base+0; apicid_mcp55 = apicid_base + 0;
} }

View File

@ -15,8 +15,7 @@
// Global variables for MB layouts and these will be shared by irqtable mptable and acpi_tables // Global variables for MB layouts and these will be shared by irqtable mptable and acpi_tables
struct mb_sysconf_t mb_sysconf; struct mb_sysconf_t mb_sysconf;
static unsigned pci1234x[] = static unsigned pci1234x[] = { //Here you only need to set value in pci1234 for HT-IO that could be installed or not
{ //Here you only need to set value in pci1234 for HT-IO that could be installed or not
//You may need to preset pci1234 for HTIO board, please refer to src/northbridge/amd/amdk8/get_sblk_pci1234.c for detail //You may need to preset pci1234 for HTIO board, please refer to src/northbridge/amd/amdk8/get_sblk_pci1234.c for detail
0x0000ff0, // SB chain m 0x0000ff0, // SB chain m
0x0000000, // HTX 0x0000000, // HTX
@ -27,8 +26,8 @@ static unsigned pci1234x[] =
// 0x0000ff0, // 0x0000ff0,
// 0x0000ff0 // 0x0000ff0
}; };
static unsigned hcdnx[] =
{ //HT Chain device num, actually it is unit id base of every ht device in chain, assume every chain only have 4 ht device at most static unsigned hcdnx[] = { //HT Chain device num, actually it is unit id base of every ht device in chain, assume every chain only have 4 ht device at most
0x20202020, 0x20202020,
0x20202020, 0x20202020,
0x20202020, 0x20202020,
@ -39,8 +38,6 @@ static unsigned hcdnx[] =
// 0x20202020, // 0x20202020,
}; };
static unsigned get_bus_conf_done = 0; static unsigned get_bus_conf_done = 0;
static unsigned get_hcid(unsigned i) static unsigned get_hcid(unsigned i)
@ -53,7 +50,7 @@ static unsigned get_hcid(unsigned i)
device_t dev; device_t dev;
dev = dev_find_slot(busn, PCI_DEVFN(devn,0)); dev = dev_find_slot(busn, PCI_DEVFN(devn, 0));
switch (dev->device) { switch (dev->device) {
case 0x7458: //8132 case 0x7458: //8132
@ -83,7 +80,8 @@ void get_bus_conf(void)
int i, j; int i, j;
struct mb_sysconf_t *m; struct mb_sysconf_t *m;
if(get_bus_conf_done == 1) return; //do it only once if (get_bus_conf_done == 1)
return; //do it only once
get_bus_conf_done = 1; get_bus_conf_done = 1;
@ -92,7 +90,7 @@ void get_bus_conf(void)
m = sysconf.mb; m = sysconf.mb;
sysconf.hc_possible_num = ARRAY_SIZE(pci1234x); sysconf.hc_possible_num = ARRAY_SIZE(pci1234x);
for(i=0;i<sysconf.hc_possible_num; i++) { for (i = 0; i < sysconf.hc_possible_num; i++) {
sysconf.pci1234[i] = pci1234x[i]; sysconf.pci1234[i] = pci1234x[i];
sysconf.hcdn[i] = hcdnx[i]; sysconf.hcdn[i] = hcdnx[i];
} }
@ -106,41 +104,45 @@ void get_bus_conf(void)
m->bus_8111_0 = m->bus_8132_0; m->bus_8111_0 = m->bus_8132_0;
/* 8111 */ /* 8111 */
dev = dev_find_slot(m->bus_8111_0, PCI_DEVFN(sysconf.sbdn,0)); dev = dev_find_slot(m->bus_8111_0, PCI_DEVFN(sysconf.sbdn, 0));
if (dev) { if (dev) {
m->bus_8111_1 = pci_read_config8(dev, PCI_SECONDARY_BUS); m->bus_8111_1 = pci_read_config8(dev, PCI_SECONDARY_BUS);
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI %02x:%02x.0, using defaults\n", m->bus_8111_0, sysconf.sbdn); "ERROR - could not find PCI %02x:%02x.0, using defaults\n",
m->bus_8111_0, sysconf.sbdn);
} }
/* 8132-1 */ /* 8132-1 */
dev = dev_find_slot(m->bus_8132_0, PCI_DEVFN(m->sbdn3,0)); dev = dev_find_slot(m->bus_8132_0, PCI_DEVFN(m->sbdn3, 0));
if (dev) { if (dev) {
m->bus_8132_1 = pci_read_config8(dev, PCI_SECONDARY_BUS); m->bus_8132_1 = pci_read_config8(dev, PCI_SECONDARY_BUS);
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI %02x:%02x.0, using defaults\n", m->bus_8132_0, m->sbdn3); "ERROR - could not find PCI %02x:%02x.0, using defaults\n",
m->bus_8132_0, m->sbdn3);
} }
/* 8132-2 */ /* 8132-2 */
dev = dev_find_slot(m->bus_8132_0, PCI_DEVFN(m->sbdn3+1,0)); dev = dev_find_slot(m->bus_8132_0, PCI_DEVFN(m->sbdn3 + 1, 0));
if (dev) { if (dev) {
m->bus_8132_2 = pci_read_config8(dev, PCI_SECONDARY_BUS); m->bus_8132_2 = pci_read_config8(dev, PCI_SECONDARY_BUS);
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI %02x:%02x.0, using defaults\n", m->bus_8132_0, m->sbdn3+1); "ERROR - could not find PCI %02x:%02x.0, using defaults\n",
m->bus_8132_0, m->sbdn3 + 1);
} }
/* HT chain 1 */ /* HT chain 1 */
j=0; j = 0;
for(i=1; i< sysconf.hc_possible_num; i++) { for (i = 1; i < sysconf.hc_possible_num; i++) {
if(!(sysconf.pci1234[i] & 0x1) ) continue; if (!(sysconf.pci1234[i] & 0x1))
continue;
// check hcid type here // check hcid type here
sysconf.hcid[i] = get_hcid(i); sysconf.hcid[i] = get_hcid(i);
switch(sysconf.hcid[i]) { switch (sysconf.hcid[i]) {
case 1: //8132 case 1: //8132
case 3: //8131 case 3: //8131
@ -150,21 +152,29 @@ void get_bus_conf(void)
m->sbdn3a[j] = sysconf.hcdn[i] & 0xff; m->sbdn3a[j] = sysconf.hcdn[i] & 0xff;
/* 8132-1 */ /* 8132-1 */
dev = dev_find_slot(m->bus_8132a[j][0], PCI_DEVFN(m->sbdn3a[j],0)); dev =
dev_find_slot(m->bus_8132a[j][0],
PCI_DEVFN(m->sbdn3a[j], 0));
if (dev) { if (dev) {
m->bus_8132a[j][1] = pci_read_config8(dev, PCI_SECONDARY_BUS); m->bus_8132a[j][1] =
} pci_read_config8(dev, PCI_SECONDARY_BUS);
else { } else {
printk(BIOS_DEBUG, "ERROR - could not find PCI %02x:%02x.0, using defaults\n", m->bus_8132a[j][0], m->sbdn3a[j]); printk(BIOS_DEBUG,
"ERROR - could not find PCI %02x:%02x.0, using defaults\n",
m->bus_8132a[j][0], m->sbdn3a[j]);
} }
/* 8132-2 */ /* 8132-2 */
dev = dev_find_slot(m->bus_8132a[j][0], PCI_DEVFN(m->sbdn3a[j]+1,0)); dev =
dev_find_slot(m->bus_8132a[j][0],
PCI_DEVFN(m->sbdn3a[j] + 1, 0));
if (dev) { if (dev) {
m->bus_8132a[j][2] = pci_read_config8(dev, PCI_SECONDARY_BUS); m->bus_8132a[j][2] =
} pci_read_config8(dev, PCI_SECONDARY_BUS);
else { } else {
printk(BIOS_DEBUG, "ERROR - could not find PCI %02x:%02x.0, using defaults\n", m->bus_8132a[j][0], m->sbdn3a[j]+1); printk(BIOS_DEBUG,
"ERROR - could not find PCI %02x:%02x.0, using defaults\n",
m->bus_8132a[j][0], m->sbdn3a[j] + 1);
} }
break; break;
@ -174,13 +184,17 @@ void get_bus_conf(void)
m->bus_8151[j][0] = (sysconf.pci1234[i] >> 16) & 0xff; m->bus_8151[j][0] = (sysconf.pci1234[i] >> 16) & 0xff;
m->sbdn5[j] = sysconf.hcdn[i] & 0xff; m->sbdn5[j] = sysconf.hcdn[i] & 0xff;
/* 8151 */ /* 8151 */
dev = dev_find_slot(m->bus_8151[j][0], PCI_DEVFN(m->sbdn5[j]+1, 0)); dev =
dev_find_slot(m->bus_8151[j][0],
PCI_DEVFN(m->sbdn5[j] + 1, 0));
if (dev) { if (dev) {
m->bus_8151[j][1] = pci_read_config8(dev, PCI_SECONDARY_BUS); m->bus_8151[j][1] =
} pci_read_config8(dev, PCI_SECONDARY_BUS);
else { } else {
printk(BIOS_DEBUG, "ERROR - could not find PCI %02x:%02x.0, using defaults\n", m->bus_8151[j][0], m->sbdn5[j]+1); printk(BIOS_DEBUG,
"ERROR - could not find PCI %02x:%02x.0, using defaults\n",
m->bus_8151[j][0], m->sbdn5[j] + 1);
} }
break; break;
@ -189,19 +203,18 @@ void get_bus_conf(void)
j++; j++;
} }
/*I/O APICs: APIC ID Version State Address*/ /*I/O APICs: APIC ID Version State Address*/
#if CONFIG_LOGICAL_CPUS #if CONFIG_LOGICAL_CPUS
apicid_base = get_apicid_base(3); apicid_base = get_apicid_base(3);
#else #else
apicid_base = CONFIG_MAX_PHYSICAL_CPUS; apicid_base = CONFIG_MAX_PHYSICAL_CPUS;
#endif #endif
m->apicid_8111 = apicid_base+0; m->apicid_8111 = apicid_base + 0;
m->apicid_8132_1 = apicid_base+1; m->apicid_8132_1 = apicid_base + 1;
m->apicid_8132_2 = apicid_base+2; m->apicid_8132_2 = apicid_base + 2;
for(i=0;i<j;i++) { for (i = 0; i < j; i++) {
m->apicid_8132a[i][0] = apicid_base + 3 + i*2; m->apicid_8132a[i][0] = apicid_base + 3 + i * 2;
m->apicid_8132a[i][1] = apicid_base + 3 + i*2 + 1; m->apicid_8132a[i][1] = apicid_base + 3 + i * 2 + 1;
} }
} }

View File

@ -38,8 +38,7 @@
// Global variables for MB layouts and these will be shared by irqtable mptable and acpi_tables // Global variables for MB layouts and these will be shared by irqtable mptable and acpi_tables
struct mb_sysconf_t mb_sysconf; struct mb_sysconf_t mb_sysconf;
static unsigned pci1234x[] = static unsigned pci1234x[] = { //Here you only need to set value in pci1234 for HT-IO that could be installed or not
{ //Here you only need to set value in pci1234 for HT-IO that could be installed or not
//You may need to preset pci1234 for HTIO board, please refer to src/northbridge/amd/amdk8/get_sblk_pci1234.c for detail //You may need to preset pci1234 for HTIO board, please refer to src/northbridge/amd/amdk8/get_sblk_pci1234.c for detail
0x0000ff0, 0x0000ff0,
0x0000ff0, 0x0000ff0,
@ -50,8 +49,8 @@ static unsigned pci1234x[] =
// 0x0000ff0, // 0x0000ff0,
// 0x0000ff0 // 0x0000ff0
}; };
static unsigned hcdnx[] =
{ //HT Chain device num, actually it is unit id base of every ht device in chain, assume every chain only have 4 ht device at most static unsigned hcdnx[] = { //HT Chain device num, actually it is unit id base of every ht device in chain, assume every chain only have 4 ht device at most
0x20202020, 0x20202020,
0x20202020, 0x20202020,
// 0x20202020, // 0x20202020,
@ -62,8 +61,6 @@ static unsigned hcdnx[] =
// 0x20202020, // 0x20202020,
}; };
static unsigned get_bus_conf_done = 0; static unsigned get_bus_conf_done = 0;
void get_bus_conf(void) void get_bus_conf(void)
@ -75,7 +72,8 @@ void get_bus_conf(void)
int i; int i;
struct mb_sysconf_t *m; struct mb_sysconf_t *m;
if(get_bus_conf_done==1) return; //do it only once if (get_bus_conf_done == 1)
return; //do it only once
get_bus_conf_done = 1; get_bus_conf_done = 1;
@ -85,7 +83,7 @@ void get_bus_conf(void)
sysconf.hc_possible_num = ARRAY_SIZE(pci1234x); sysconf.hc_possible_num = ARRAY_SIZE(pci1234x);
for(i=0;i<sysconf.hc_possible_num; i++) { for (i = 0; i < sysconf.hc_possible_num; i++) {
sysconf.pci1234[i] = pci1234x[i]; sysconf.pci1234[i] = pci1234x[i];
sysconf.hcdn[i] = hcdnx[i]; sysconf.hcdn[i] = hcdnx[i];
} }
@ -99,36 +97,41 @@ void get_bus_conf(void)
m->bus_bcm5780[0] = m->bus_bcm5785_0; m->bus_bcm5780[0] = m->bus_bcm5785_0;
/* bcm5785 */ /* bcm5785 */
dev = dev_find_slot(m->bus_bcm5785_0, PCI_DEVFN(sysconf.sbdn,0)); dev = dev_find_slot(m->bus_bcm5785_0, PCI_DEVFN(sysconf.sbdn, 0));
if (dev) { if (dev) {
m->bus_bcm5785_1 = pci_read_config8(dev, PCI_SECONDARY_BUS); m->bus_bcm5785_1 = pci_read_config8(dev, PCI_SECONDARY_BUS);
dev = dev_find_slot(m->bus_bcm5785_1, PCI_DEVFN(0xd,0)); dev = dev_find_slot(m->bus_bcm5785_1, PCI_DEVFN(0xd, 0));
if(dev) { if (dev) {
m->bus_bcm5785_1_1 = pci_read_config8(dev, PCI_SECONDARY_BUS); m->bus_bcm5785_1_1 =
pci_read_config8(dev, PCI_SECONDARY_BUS);
} }
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI %02x:%02x.0, using defaults\n", m->bus_bcm5785_0, sysconf.sbdn); "ERROR - could not find PCI %02x:%02x.0, using defaults\n",
m->bus_bcm5785_0, sysconf.sbdn);
} }
/* bcm5780 */ /* bcm5780 */
for(i = 1; i < 7; i++) { for (i = 1; i < 7; i++) {
dev = dev_find_slot(m->bus_bcm5780[0], PCI_DEVFN(m->sbdn2 + i - 1,0)); dev =
if(dev) { dev_find_slot(m->bus_bcm5780[0],
m->bus_bcm5780[i] = pci_read_config8(dev, PCI_SECONDARY_BUS); PCI_DEVFN(m->sbdn2 + i - 1, 0));
} if (dev) {
else { m->bus_bcm5780[i] =
printk(BIOS_DEBUG, "ERROR - could not find PCI %02x:%02x.0, using defaults\n", m->bus_bcm5780[0], m->sbdn2+i-1); pci_read_config8(dev, PCI_SECONDARY_BUS);
} else {
printk(BIOS_DEBUG,
"ERROR - could not find PCI %02x:%02x.0, using defaults\n",
m->bus_bcm5780[0], m->sbdn2 + i - 1);
} }
} }
/*I/O APICs: APIC ID Version State Address*/ /*I/O APICs: APIC ID Version State Address*/
#if CONFIG_LOGICAL_CPUS #if CONFIG_LOGICAL_CPUS
apicid_base = get_apicid_base(3); apicid_base = get_apicid_base(3);
#else #else
apicid_base = CONFIG_MAX_PHYSICAL_CPUS; apicid_base = CONFIG_MAX_PHYSICAL_CPUS;
#endif #endif
for(i=0;i<3;i++) for (i = 0; i < 3; i++)
m->apicid_bcm5785[i] = apicid_base+i; m->apicid_bcm5785[i] = apicid_base + i;
} }

View File

@ -39,8 +39,7 @@
// Global variables for MB layouts and these will be shared by irqtable mptable and acpi_tables // Global variables for MB layouts and these will be shared by irqtable mptable and acpi_tables
struct mb_sysconf_t mb_sysconf; struct mb_sysconf_t mb_sysconf;
unsigned pci1234x[] = unsigned pci1234x[] = { //Here you only need to set value in pci1234 for HT-IO that could be installed or not
{ //Here you only need to set value in pci1234 for HT-IO that could be installed or not
//You may need to preset pci1234 for HTIO board, please refer to src/northbridge/amd/amdk8/get_sblk_pci1234.c for detail //You may need to preset pci1234 for HTIO board, please refer to src/northbridge/amd/amdk8/get_sblk_pci1234.c for detail
0x0000ff0, 0x0000ff0,
0x0000ff0, 0x0000ff0,
@ -51,8 +50,8 @@ unsigned pci1234x[] =
// 0x0000ff0, // 0x0000ff0,
// 0x0000ff0 // 0x0000ff0
}; };
unsigned hcdnx[] =
{ //HT Chain device num, actually it is unit id base of every ht device in chain, assume every chain only have 4 ht device at most unsigned hcdnx[] = { //HT Chain device num, actually it is unit id base of every ht device in chain, assume every chain only have 4 ht device at most
0x20202020, 0x20202020,
0x20202020, 0x20202020,
0x20202020, 0x20202020,
@ -63,9 +62,6 @@ unsigned hcdnx[] =
// 0x20202020, // 0x20202020,
}; };
static unsigned get_bus_conf_done = 0; static unsigned get_bus_conf_done = 0;
void get_bus_conf(void) void get_bus_conf(void)
@ -77,7 +73,8 @@ void get_bus_conf(void)
device_t dev; device_t dev;
int i; int i;
if(get_bus_conf_done==1) return; //do it only once if (get_bus_conf_done == 1)
return; //do it only once
get_bus_conf_done = 1; get_bus_conf_done = 1;
@ -87,7 +84,7 @@ void get_bus_conf(void)
memset(m, 0, sizeof(struct mb_sysconf_t)); memset(m, 0, sizeof(struct mb_sysconf_t));
sysconf.hc_possible_num = ARRAY_SIZE(pci1234x); sysconf.hc_possible_num = ARRAY_SIZE(pci1234x);
for(i=0;i<sysconf.hc_possible_num; i++) { for (i = 0; i < sysconf.hc_possible_num; i++) {
sysconf.pci1234[i] = pci1234x[i]; sysconf.pci1234[i] = pci1234x[i];
sysconf.hcdn[i] = hcdnx[i]; sysconf.hcdn[i] = hcdnx[i];
} }
@ -99,21 +96,26 @@ void get_bus_conf(void)
m->bus_mcp55[0] = (sysconf.pci1234[0] >> 16) & 0xff; m->bus_mcp55[0] = (sysconf.pci1234[0] >> 16) & 0xff;
/* MCP55 */ /* MCP55 */
dev = dev_find_slot(m->bus_mcp55[0], PCI_DEVFN(sysconf.sbdn + 0x06,0)); dev = dev_find_slot(m->bus_mcp55[0], PCI_DEVFN(sysconf.sbdn + 0x06, 0));
if (dev) { if (dev) {
m->bus_mcp55[1] = pci_read_config8(dev, PCI_SECONDARY_BUS); m->bus_mcp55[1] = pci_read_config8(dev, PCI_SECONDARY_BUS);
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI 1:%02x.0, using defaults\n", sysconf.sbdn + 0x06); "ERROR - could not find PCI 1:%02x.0, using defaults\n",
sysconf.sbdn + 0x06);
} }
for(i=2; i<8;i++) { for (i = 2; i < 8; i++) {
dev = dev_find_slot(m->bus_mcp55[0], PCI_DEVFN(sysconf.sbdn + 0x0a + i - 2 , 0)); dev =
dev_find_slot(m->bus_mcp55[0],
PCI_DEVFN(sysconf.sbdn + 0x0a + i - 2, 0));
if (dev) { if (dev) {
m->bus_mcp55[i] = pci_read_config8(dev, PCI_SECONDARY_BUS); m->bus_mcp55[i] =
} pci_read_config8(dev, PCI_SECONDARY_BUS);
else { } else {
printk(BIOS_DEBUG, "ERROR - could not find PCI %02x:%02x.0, using defaults\n", m->bus_mcp55[0], sysconf.sbdn + 0x0a + i - 2 ); printk(BIOS_DEBUG,
"ERROR - could not find PCI %02x:%02x.0, using defaults\n",
m->bus_mcp55[0], sysconf.sbdn + 0x0a + i - 2);
} }
} }
@ -123,6 +125,6 @@ void get_bus_conf(void)
#else #else
apicid_base = CONFIG_MAX_PHYSICAL_CPUS; apicid_base = CONFIG_MAX_PHYSICAL_CPUS;
#endif #endif
m->apicid_mcp55 = apicid_base+0; m->apicid_mcp55 = apicid_base + 0;
} }

View File

@ -9,32 +9,30 @@
#include <stdlib.h> #include <stdlib.h>
#include <cpu/amd/amdk8_sysconf.h> #include <cpu/amd/amdk8_sysconf.h>
// Global variables for MB layouts and these will be shared by irqtable mptable and acpi_tables // Global variables for MB layouts and these will be shared by irqtable mptable and acpi_tables
//busnum is default //busnum is default
unsigned char bus_ck804_0; //1 unsigned char bus_ck804_0; //1
unsigned char bus_ck804_1; //2 unsigned char bus_ck804_1; //2
unsigned char bus_ck804_2; //3 unsigned char bus_ck804_2; //3
unsigned char bus_ck804_3; //4 unsigned char bus_ck804_3; //4
unsigned char bus_ck804_4; //5 unsigned char bus_ck804_4; //5
unsigned char bus_ck804_5; //6 unsigned char bus_ck804_5; //6
unsigned char bus_8131_0; //7 unsigned char bus_8131_0; //7
unsigned char bus_8131_1; //8 unsigned char bus_8131_1; //8
unsigned char bus_8131_2; //9 unsigned char bus_8131_2; //9
unsigned char bus_ck804b_0;//a unsigned char bus_ck804b_0; //a
unsigned char bus_ck804b_1;//b unsigned char bus_ck804b_1; //b
unsigned char bus_ck804b_2;//c unsigned char bus_ck804b_2; //c
unsigned char bus_ck804b_3;//d unsigned char bus_ck804b_3; //d
unsigned char bus_ck804b_4;//e unsigned char bus_ck804b_4; //e
unsigned char bus_ck804b_5;//f unsigned char bus_ck804b_5; //f
unsigned apicid_ck804; unsigned apicid_ck804;
unsigned apicid_8131_1; unsigned apicid_8131_1;
unsigned apicid_8131_2; unsigned apicid_8131_2;
unsigned apicid_ck804b; unsigned apicid_ck804b;
unsigned sblk; unsigned sblk;
unsigned pci1234[] = unsigned pci1234[] = { //Here you only need to set value in pci1234 for HT-IO that could be installed or not
{ //Here you only need to set value in pci1234 for HT-IO that could be installed or not
//You may need to preset pci1234 for HTIO board, please refer to src/northbridge/amd/amdk8/get_sblk_pci1234.c for detail //You may need to preset pci1234 for HTIO board, please refer to src/northbridge/amd/amdk8/get_sblk_pci1234.c for detail
0x0000ff0, 0x0000ff0,
0x0000ff0, 0x0000ff0,
@ -45,10 +43,10 @@ unsigned pci1234[] =
// 0x0000ff0, // 0x0000ff0,
// 0x0000ff0 // 0x0000ff0
}; };
unsigned hc_possible_num; unsigned hc_possible_num;
unsigned sbdn; unsigned sbdn;
unsigned hcdn[] = unsigned hcdn[] = { //HT Chain device num, actually it is unit id base of every ht device in chain, assume every chain only have 4 ht device at most
{ //HT Chain device num, actually it is unit id base of every ht device in chain, assume every chain only have 4 ht device at most
0x20202020, 0x20202020,
0x20202020, 0x20202020,
0x20202020, 0x20202020,
@ -58,11 +56,10 @@ unsigned hcdn[] =
// 0x20202020, // 0x20202020,
// 0x20202020, // 0x20202020,
}; };
unsigned sbdn3; unsigned sbdn3;
unsigned sbdnb; unsigned sbdnb;
static unsigned get_bus_conf_done = 0; static unsigned get_bus_conf_done = 0;
void get_bus_conf(void) void get_bus_conf(void)
@ -72,7 +69,8 @@ void get_bus_conf(void)
device_t dev; device_t dev;
if(get_bus_conf_done==1) return; //do it only once if (get_bus_conf_done == 1)
return; //do it only once
get_bus_conf_done = 1; get_bus_conf_done = 1;
@ -90,7 +88,7 @@ void get_bus_conf(void)
bus_ck804_0 = (pci1234[0] >> 16) & 0xff; bus_ck804_0 = (pci1234[0] >> 16) & 0xff;
/* CK804 */ /* CK804 */
dev = dev_find_slot(bus_ck804_0, PCI_DEVFN(sbdn + 0x09,0)); dev = dev_find_slot(bus_ck804_0, PCI_DEVFN(sbdn + 0x09, 0));
if (dev) { if (dev) {
bus_ck804_1 = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_ck804_1 = pci_read_config8(dev, PCI_SECONDARY_BUS);
#if 0 #if 0
@ -100,9 +98,10 @@ void get_bus_conf(void)
bus_ck804_5 = pci_read_config8(dev, PCI_SUBORDINATE_BUS); bus_ck804_5 = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
bus_ck804_5++; bus_ck804_5++;
#endif #endif
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI 1:%02x.0, using defaults\n", sbdn + 0x09); "ERROR - could not find PCI 1:%02x.0, using defaults\n",
sbdn + 0x09);
bus_ck804_1 = 2; bus_ck804_1 = 2;
#if 0 #if 0
@ -113,155 +112,168 @@ void get_bus_conf(void)
} }
#if 0 #if 0
dev = dev_find_slot(bus_ck804_0, PCI_DEVFN(sbdn + 0x0b,0)); dev = dev_find_slot(bus_ck804_0, PCI_DEVFN(sbdn + 0x0b, 0));
if (dev) { if (dev) {
bus_ck804_2 = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_ck804_2 = pci_read_config8(dev, PCI_SECONDARY_BUS);
bus_ck804_3 = pci_read_config8(dev, PCI_SUBORDINATE_BUS); bus_ck804_3 = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
bus_ck804_3++; bus_ck804_3++;
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI 1:%02x.0, using defaults\n", sbdn + 0x0b); "ERROR - could not find PCI 1:%02x.0, using defaults\n",
sbdn + 0x0b);
bus_ck804_3 = bus_ck804_2+1; bus_ck804_3 = bus_ck804_2 + 1;
} }
dev = dev_find_slot(bus_ck804_0, PCI_DEVFN(sbdn + 0x0c,0)); dev = dev_find_slot(bus_ck804_0, PCI_DEVFN(sbdn + 0x0c, 0));
if (dev) { if (dev) {
bus_ck804_3 = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_ck804_3 = pci_read_config8(dev, PCI_SECONDARY_BUS);
bus_ck804_4 = pci_read_config8(dev, PCI_SUBORDINATE_BUS); bus_ck804_4 = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
bus_ck804_4++; bus_ck804_4++;
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI 1:%02x.0, using defaults\n", sbdn + 0x0c); "ERROR - could not find PCI 1:%02x.0, using defaults\n",
sbdn + 0x0c);
bus_ck804_4 = bus_ck804_3+1; bus_ck804_4 = bus_ck804_3 + 1;
} }
dev = dev_find_slot(bus_ck804_0, PCI_DEVFN(sbdn + 0x0d, 0));
dev = dev_find_slot(bus_ck804_0, PCI_DEVFN(sbdn + 0x0d,0));
if (dev) { if (dev) {
bus_ck804_4 = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_ck804_4 = pci_read_config8(dev, PCI_SECONDARY_BUS);
bus_ck804_5 = pci_read_config8(dev, PCI_SUBORDINATE_BUS); bus_ck804_5 = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
bus_ck804_5++; bus_ck804_5++;
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI 1:%02x.0, using defaults\n",sbdn + 0x0d); "ERROR - could not find PCI 1:%02x.0, using defaults\n",
sbdn + 0x0d);
bus_ck804_5 = bus_ck804_4+1; bus_ck804_5 = bus_ck804_4 + 1;
} }
#endif #endif
dev = dev_find_slot(bus_ck804_0, PCI_DEVFN(sbdn+ 0x0e,0)); dev = dev_find_slot(bus_ck804_0, PCI_DEVFN(sbdn + 0x0e, 0));
if (dev) { if (dev) {
bus_ck804_5 = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_ck804_5 = pci_read_config8(dev, PCI_SECONDARY_BUS);
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI 1:%02x.0, using defaults\n", sbdn+ 0x0e); "ERROR - could not find PCI 1:%02x.0, using defaults\n",
sbdn + 0x0e);
} }
bus_8131_0 = (pci1234[1] >> 16) & 0xff; bus_8131_0 = (pci1234[1] >> 16) & 0xff;
/* 8131-1 */ /* 8131-1 */
dev = dev_find_slot(bus_8131_0, PCI_DEVFN(sbdn3,0)); dev = dev_find_slot(bus_8131_0, PCI_DEVFN(sbdn3, 0));
if (dev) { if (dev) {
bus_8131_1 = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_8131_1 = pci_read_config8(dev, PCI_SECONDARY_BUS);
bus_8131_2 = pci_read_config8(dev, PCI_SUBORDINATE_BUS); bus_8131_2 = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
bus_8131_2++; bus_8131_2++;
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI %02x:01.0, using defaults\n", bus_8131_0); "ERROR - could not find PCI %02x:01.0, using defaults\n",
bus_8131_0);
bus_8131_1 = bus_8131_0+1; bus_8131_1 = bus_8131_0 + 1;
bus_8131_2 = bus_8131_0+2; bus_8131_2 = bus_8131_0 + 2;
} }
/* 8131-2 */ /* 8131-2 */
dev = dev_find_slot(bus_8131_0, PCI_DEVFN(sbdn3,0)); dev = dev_find_slot(bus_8131_0, PCI_DEVFN(sbdn3, 0));
if (dev) { if (dev) {
bus_8131_2 = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_8131_2 = pci_read_config8(dev, PCI_SECONDARY_BUS);
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI %02x:02.0, using defaults\n", bus_8131_0); "ERROR - could not find PCI %02x:02.0, using defaults\n",
bus_8131_0);
bus_8131_2 = bus_8131_1+1; bus_8131_2 = bus_8131_1 + 1;
} }
/* CK804b */ /* CK804b */
if(pci1234[2] & 0xf) { //if the second cpu is installed if (pci1234[2] & 0xf) { //if the second cpu is installed
bus_ck804b_0 = (pci1234[2]>>16) & 0xff; bus_ck804b_0 = (pci1234[2] >> 16) & 0xff;
#if 0 #if 0
dev = dev_find_slot(bus_ck804b_0, PCI_DEVFN(sbdnb + 0x09,0)); dev = dev_find_slot(bus_ck804b_0, PCI_DEVFN(sbdnb + 0x09, 0));
if (dev) { if (dev) {
bus_ck804b_1 = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_ck804b_1 = pci_read_config8(dev, PCI_SECONDARY_BUS);
bus_ck804b_2 = pci_read_config8(dev, PCI_SUBORDINATE_BUS); bus_ck804b_2 =
pci_read_config8(dev, PCI_SUBORDINATE_BUS);
bus_ck804b_2++; bus_ck804b_2++;
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI %02x:%02x.0, using defaults\n", bus_ck804b_0,sbdnb+0x09); "ERROR - could not find PCI %02x:%02x.0, using defaults\n",
bus_ck804b_0, sbdnb + 0x09);
bus_ck804b_1 = bus_ck804b_0+1; bus_ck804b_1 = bus_ck804b_0 + 1;
bus_ck804b_2 = bus_ck804b_0+2; bus_ck804b_2 = bus_ck804b_0 + 2;
} }
dev = dev_find_slot(bus_ck804b_0, PCI_DEVFN(sbdnb + 0x0b,0)); dev = dev_find_slot(bus_ck804b_0, PCI_DEVFN(sbdnb + 0x0b, 0));
if (dev) { if (dev) {
bus_ck804b_2 = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_ck804b_2 = pci_read_config8(dev, PCI_SECONDARY_BUS);
bus_ck804b_3 = pci_read_config8(dev, PCI_SUBORDINATE_BUS); bus_ck804b_3 =
pci_read_config8(dev, PCI_SUBORDINATE_BUS);
bus_ck804b_3++; bus_ck804b_3++;
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI %02x:%02x.0, using defaults\n", bus_ck804b_0,sbdnb+0x0b); "ERROR - could not find PCI %02x:%02x.0, using defaults\n",
bus_ck804b_0, sbdnb + 0x0b);
bus_ck804b_2 = bus_ck804b_0+1; bus_ck804b_2 = bus_ck804b_0 + 1;
bus_ck804b_3 = bus_ck804b_0+2; bus_ck804b_3 = bus_ck804b_0 + 2;
} }
dev = dev_find_slot(bus_ck804b_0, PCI_DEVFN(sbdnb + 0x0c,0)); dev = dev_find_slot(bus_ck804b_0, PCI_DEVFN(sbdnb + 0x0c, 0));
if (dev) { if (dev) {
bus_ck804b_3 = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_ck804b_3 = pci_read_config8(dev, PCI_SECONDARY_BUS);
bus_ck804b_4 = pci_read_config8(dev, PCI_SUBORDINATE_BUS); bus_ck804b_4 =
pci_read_config8(dev, PCI_SUBORDINATE_BUS);
bus_ck804b_4++; bus_ck804b_4++;
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI %02x:%02x.0, using defaults\n", bus_ck804b_0,sbdnb+0x0c); "ERROR - could not find PCI %02x:%02x.0, using defaults\n",
bus_ck804b_0, sbdnb + 0x0c);
bus_ck804b_4 = bus_ck804b_3+1; bus_ck804b_4 = bus_ck804b_3 + 1;
} }
dev = dev_find_slot(bus_ck804b_0, PCI_DEVFN(sbdnb + 0x0d,0)); dev = dev_find_slot(bus_ck804b_0, PCI_DEVFN(sbdnb + 0x0d, 0));
if (dev) { if (dev) {
bus_ck804b_4 = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_ck804b_4 = pci_read_config8(dev, PCI_SECONDARY_BUS);
bus_ck804b_5 = pci_read_config8(dev, PCI_SUBORDINATE_BUS); bus_ck804b_5 =
pci_read_config8(dev, PCI_SUBORDINATE_BUS);
bus_ck804b_5++; bus_ck804b_5++;
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI %02x:%02x.0, using defaults\n", bus_ck804b_0,sbdnb+0x0d); "ERROR - could not find PCI %02x:%02x.0, using defaults\n",
bus_ck804b_0, sbdnb + 0x0d);
bus_ck804b_5 = bus_ck804b_4+1; bus_ck804b_5 = bus_ck804b_4 + 1;
} }
#endif #endif
dev = dev_find_slot(bus_ck804b_0, PCI_DEVFN(sbdnb + 0x0e,0)); dev = dev_find_slot(bus_ck804b_0, PCI_DEVFN(sbdnb + 0x0e, 0));
if (dev) { if (dev) {
bus_ck804b_5 = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_ck804b_5 = pci_read_config8(dev, PCI_SECONDARY_BUS);
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI %02x:%02x.0, using defaults\n", bus_ck804b_0,sbdnb+0x0e); "ERROR - could not find PCI %02x:%02x.0, using defaults\n",
bus_ck804b_0, sbdnb + 0x0e);
#if 1 #if 1
bus_ck804b_5 = bus_ck804b_4+1; bus_ck804b_5 = bus_ck804b_4 + 1;
#endif #endif
} }
} }
/*I/O APICs: APIC ID Version State Address*/ /*I/O APICs: APIC ID Version State Address*/
#if CONFIG_LOGICAL_CPUS #if CONFIG_LOGICAL_CPUS
apicid_base = get_apicid_base(4); apicid_base = get_apicid_base(4);
#else #else
apicid_base = CONFIG_MAX_PHYSICAL_CPUS; apicid_base = CONFIG_MAX_PHYSICAL_CPUS;
#endif #endif
apicid_ck804 = apicid_base+0; apicid_ck804 = apicid_base + 0;
apicid_8131_1 = apicid_base+1; apicid_8131_1 = apicid_base + 1;
apicid_8131_2 = apicid_base+2; apicid_8131_2 = apicid_base + 2;
apicid_ck804b = apicid_base+3; apicid_ck804b = apicid_base + 3;
} }

View File

@ -31,16 +31,14 @@
#include <cpu/amd/amdk8_sysconf.h> #include <cpu/amd/amdk8_sysconf.h>
#include <stdlib.h> #include <stdlib.h>
// Global variables for MB layouts and these will be shared by irqtable mptable and acpi_tables // Global variables for MB layouts and these will be shared by irqtable mptable and acpi_tables
//busnum is default //busnum is default
unsigned char bus_mcp55[8]; //1 unsigned char bus_mcp55[8]; //1
unsigned apicid_mcp55; unsigned apicid_mcp55;
unsigned char bus_pcix[3]; // under bus_mcp55_2 unsigned char bus_pcix[3]; // under bus_mcp55_2
unsigned pci1234x[] = unsigned pci1234x[] = { //Here you only need to set value in pci1234 for HT-IO that could be installed or not
{ //Here you only need to set value in pci1234 for HT-IO that could be installed or not
//You may need to preset pci1234 for HTIO board, please refer to src/northbridge/amd/amdk8/get_sblk_pci1234.c for detail //You may need to preset pci1234 for HTIO board, please refer to src/northbridge/amd/amdk8/get_sblk_pci1234.c for detail
0x0000ff0, 0x0000ff0,
0x0000ff0, 0x0000ff0,
@ -51,8 +49,8 @@ unsigned pci1234x[] =
// 0x0000ff0, // 0x0000ff0,
// 0x0000ff0 // 0x0000ff0
}; };
unsigned hcdnx[] =
{ //HT Chain device num, actually it is unit id base of every ht device in chain, assume every chain only have 4 ht device at most unsigned hcdnx[] = { //HT Chain device num, actually it is unit id base of every ht device in chain, assume every chain only have 4 ht device at most
0x20202020, 0x20202020,
0x20202020, 0x20202020,
// 0x20202020, // 0x20202020,
@ -62,10 +60,9 @@ unsigned hcdnx[] =
// 0x20202020, // 0x20202020,
// 0x20202020, // 0x20202020,
}; };
unsigned sbdnb; unsigned sbdnb;
static unsigned get_bus_conf_done = 0; static unsigned get_bus_conf_done = 0;
void get_bus_conf(void) void get_bus_conf(void)
@ -77,12 +74,13 @@ void get_bus_conf(void)
device_t dev; device_t dev;
int i; int i;
if(get_bus_conf_done==1) return; //do it only once if (get_bus_conf_done == 1)
return; //do it only once
get_bus_conf_done = 1; get_bus_conf_done = 1;
sysconf.hc_possible_num = ARRAY_SIZE(pci1234x); sysconf.hc_possible_num = ARRAY_SIZE(pci1234x);
for(i=0;i<sysconf.hc_possible_num; i++) { for (i = 0; i < sysconf.hc_possible_num; i++) {
sysconf.pci1234[i] = pci1234x[i]; sysconf.pci1234[i] = pci1234x[i];
sysconf.hcdn[i] = hcdnx[i]; sysconf.hcdn[i] = hcdnx[i];
} }
@ -94,58 +92,61 @@ void get_bus_conf(void)
sbdnb = (sysconf.hcdn[1] & 0xff); // first byte of second chain sbdnb = (sysconf.hcdn[1] & 0xff); // first byte of second chain
for(i=0; i<8; i++) { for (i = 0; i < 8; i++) {
bus_mcp55[i] = 0; bus_mcp55[i] = 0;
} }
for(i=0; i<3; i++) { for (i = 0; i < 3; i++) {
bus_pcix[i] = 0; bus_pcix[i] = 0;
} }
bus_mcp55[0] = (sysconf.pci1234[0] >> 16) & 0xff; bus_mcp55[0] = (sysconf.pci1234[0] >> 16) & 0xff;
/* MCP55 */ /* MCP55 */
dev = dev_find_slot(bus_mcp55[0], PCI_DEVFN(sbdn + 0x06,0)); dev = dev_find_slot(bus_mcp55[0], PCI_DEVFN(sbdn + 0x06, 0));
if (dev) { if (dev) {
bus_mcp55[1] = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_mcp55[1] = pci_read_config8(dev, PCI_SECONDARY_BUS);
bus_mcp55[2] = pci_read_config8(dev, PCI_SUBORDINATE_BUS); bus_mcp55[2] = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
bus_mcp55[2]++; bus_mcp55[2]++;
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI 1:%02x.0, using defaults\n", sbdn + 0x06); "ERROR - could not find PCI 1:%02x.0, using defaults\n",
sbdn + 0x06);
bus_mcp55[1] = 2; bus_mcp55[1] = 2;
bus_mcp55[2] = 3; bus_mcp55[2] = 3;
} }
for(i=2; i<8;i++) { for (i = 2; i < 8; i++) {
dev = dev_find_slot(bus_mcp55[0], PCI_DEVFN(sbdn + 0x0a + i - 2 , 0)); dev =
dev_find_slot(bus_mcp55[0],
PCI_DEVFN(sbdn + 0x0a + i - 2, 0));
if (dev) { if (dev) {
bus_mcp55[i] = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_mcp55[i] = pci_read_config8(dev, PCI_SECONDARY_BUS);
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI %02x:%02x.0, using defaults\n", bus_mcp55[0], sbdn + 0x0a + i - 2 ); "ERROR - could not find PCI %02x:%02x.0, using defaults\n",
bus_mcp55[0], sbdn + 0x0a + i - 2);
} }
} }
if(bus_mcp55[2]) { if (bus_mcp55[2]) {
for(i=0;i<2; i++) { for (i = 0; i < 2; i++) {
dev = dev_find_slot(bus_mcp55[2], PCI_DEVFN(0, i)); dev = dev_find_slot(bus_mcp55[2], PCI_DEVFN(0, i));
if(dev) { if (dev) {
bus_pcix[0] = bus_mcp55[2]; bus_pcix[0] = bus_mcp55[2];
bus_pcix[i+1] = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_pcix[i + 1] =
pci_read_config8(dev, PCI_SECONDARY_BUS);
} }
} }
} }
/*I/O APICs: APIC ID Version State Address*/ /*I/O APICs: APIC ID Version State Address*/
#if CONFIG_LOGICAL_CPUS #if CONFIG_LOGICAL_CPUS
apicid_base = get_apicid_base(1); apicid_base = get_apicid_base(1);
#else #else
apicid_base = CONFIG_MAX_PHYSICAL_CPUS; apicid_base = CONFIG_MAX_PHYSICAL_CPUS;
#endif #endif
apicid_mcp55 = apicid_base+0; apicid_mcp55 = apicid_base + 0;
} }

View File

@ -31,16 +31,14 @@
#include <cpu/amd/amdk8_sysconf.h> #include <cpu/amd/amdk8_sysconf.h>
#include <stdlib.h> #include <stdlib.h>
// Global variables for MB layouts and these will be shared by irqtable mptable and acpi_tables // Global variables for MB layouts and these will be shared by irqtable mptable and acpi_tables
//busnum is default //busnum is default
unsigned char bus_mcp55[8]; //1 unsigned char bus_mcp55[8]; //1
unsigned apicid_mcp55; unsigned apicid_mcp55;
unsigned char bus_pcix[3]; // under bus_mcp55_2 unsigned char bus_pcix[3]; // under bus_mcp55_2
unsigned pci1234x[] = unsigned pci1234x[] = { //Here you only need to set value in pci1234 for HT-IO that could be installed or not
{ //Here you only need to set value in pci1234 for HT-IO that could be installed or not
//You may need to preset pci1234 for HTIO board, please refer to src/northbridge/amd/amdk8/get_sblk_pci1234.c for detail //You may need to preset pci1234 for HTIO board, please refer to src/northbridge/amd/amdk8/get_sblk_pci1234.c for detail
0x0000ff0, 0x0000ff0,
0x0000ff0, 0x0000ff0,
@ -51,8 +49,8 @@ unsigned pci1234x[] =
// 0x0000ff0, // 0x0000ff0,
// 0x0000ff0 // 0x0000ff0
}; };
unsigned hcdnx[] =
{ //HT Chain device num, actually it is unit id base of every ht device in chain, assume every chain only have 4 ht device at most unsigned hcdnx[] = { //HT Chain device num, actually it is unit id base of every ht device in chain, assume every chain only have 4 ht device at most
0x20202020, 0x20202020,
0x20202020, 0x20202020,
// 0x20202020, // 0x20202020,
@ -62,10 +60,9 @@ unsigned hcdnx[] =
// 0x20202020, // 0x20202020,
// 0x20202020, // 0x20202020,
}; };
unsigned sbdnb; unsigned sbdnb;
static unsigned get_bus_conf_done = 0; static unsigned get_bus_conf_done = 0;
void get_bus_conf(void) void get_bus_conf(void)
@ -77,12 +74,13 @@ void get_bus_conf(void)
device_t dev; device_t dev;
int i; int i;
if(get_bus_conf_done==1) return; //do it only once if (get_bus_conf_done == 1)
return; //do it only once
get_bus_conf_done = 1; get_bus_conf_done = 1;
sysconf.hc_possible_num = ARRAY_SIZE(pci1234x); sysconf.hc_possible_num = ARRAY_SIZE(pci1234x);
for(i=0;i<sysconf.hc_possible_num; i++) { for (i = 0; i < sysconf.hc_possible_num; i++) {
sysconf.pci1234[i] = pci1234x[i]; sysconf.pci1234[i] = pci1234x[i];
sysconf.hcdn[i] = hcdnx[i]; sysconf.hcdn[i] = hcdnx[i];
} }
@ -94,58 +92,61 @@ void get_bus_conf(void)
sbdnb = (sysconf.hcdn[1] & 0xff); // first byte of second chain sbdnb = (sysconf.hcdn[1] & 0xff); // first byte of second chain
for(i=0; i<8; i++) { for (i = 0; i < 8; i++) {
bus_mcp55[i] = 0; bus_mcp55[i] = 0;
} }
for(i=0; i<3; i++) { for (i = 0; i < 3; i++) {
bus_pcix[i] = 0; bus_pcix[i] = 0;
} }
bus_mcp55[0] = (sysconf.pci1234[0] >> 16) & 0xff; bus_mcp55[0] = (sysconf.pci1234[0] >> 16) & 0xff;
/* MCP55 */ /* MCP55 */
dev = dev_find_slot(bus_mcp55[0], PCI_DEVFN(sbdn + 0x06,0)); dev = dev_find_slot(bus_mcp55[0], PCI_DEVFN(sbdn + 0x06, 0));
if (dev) { if (dev) {
bus_mcp55[1] = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_mcp55[1] = pci_read_config8(dev, PCI_SECONDARY_BUS);
bus_mcp55[2] = pci_read_config8(dev, PCI_SUBORDINATE_BUS); bus_mcp55[2] = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
bus_mcp55[2]++; bus_mcp55[2]++;
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI 1:%02x.0, using defaults\n", sbdn + 0x06); "ERROR - could not find PCI 1:%02x.0, using defaults\n",
sbdn + 0x06);
bus_mcp55[1] = 2; bus_mcp55[1] = 2;
bus_mcp55[2] = 3; bus_mcp55[2] = 3;
} }
for(i=2; i<8;i++) { for (i = 2; i < 8; i++) {
dev = dev_find_slot(bus_mcp55[0], PCI_DEVFN(sbdn + 0x0a + i - 2 , 0)); dev =
dev_find_slot(bus_mcp55[0],
PCI_DEVFN(sbdn + 0x0a + i - 2, 0));
if (dev) { if (dev) {
bus_mcp55[i] = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_mcp55[i] = pci_read_config8(dev, PCI_SECONDARY_BUS);
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI %02x:%02x.0, using defaults\n", bus_mcp55[0], sbdn + 0x0a + i - 2 ); "ERROR - could not find PCI %02x:%02x.0, using defaults\n",
bus_mcp55[0], sbdn + 0x0a + i - 2);
} }
} }
if(bus_mcp55[2]) { if (bus_mcp55[2]) {
for(i=0;i<2; i++) { for (i = 0; i < 2; i++) {
dev = dev_find_slot(bus_mcp55[2], PCI_DEVFN(0, i)); dev = dev_find_slot(bus_mcp55[2], PCI_DEVFN(0, i));
if(dev) { if (dev) {
bus_pcix[0] = bus_mcp55[2]; bus_pcix[0] = bus_mcp55[2];
bus_pcix[i+1] = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_pcix[i + 1] =
pci_read_config8(dev, PCI_SECONDARY_BUS);
} }
} }
} }
/*I/O APICs: APIC ID Version State Address*/ /*I/O APICs: APIC ID Version State Address*/
#if CONFIG_LOGICAL_CPUS #if CONFIG_LOGICAL_CPUS
apicid_base = get_apicid_base(1); apicid_base = get_apicid_base(1);
#else #else
apicid_base = CONFIG_MAX_PHYSICAL_CPUS; apicid_base = CONFIG_MAX_PHYSICAL_CPUS;
#endif #endif
apicid_mcp55 = apicid_base+0; apicid_mcp55 = apicid_base + 0;
} }

View File

@ -10,7 +10,6 @@
#include <cpu/amd/amdk8_sysconf.h> #include <cpu/amd/amdk8_sysconf.h>
#include <stdlib.h> #include <stdlib.h>
// Global variables for MB layouts and these will be shared by irqtable mptable and acpi_tables // Global variables for MB layouts and these will be shared by irqtable mptable and acpi_tables
//busnum is default //busnum is default
unsigned char bus_8131_0 = 1; unsigned char bus_8131_0 = 1;
@ -18,12 +17,11 @@ unsigned char bus_8131_1 = 2;
unsigned char bus_8131_2 = 3; unsigned char bus_8131_2 = 3;
unsigned char bus_8111_0 = 1; unsigned char bus_8111_0 = 1;
unsigned char bus_8111_1 = 4; unsigned char bus_8111_1 = 4;
unsigned apicid_8111 ; unsigned apicid_8111;
unsigned apicid_8131_1; unsigned apicid_8131_1;
unsigned apicid_8131_2; unsigned apicid_8131_2;
unsigned pci1234x[] = unsigned pci1234x[] = { //Here you only need to set value in pci1234 for HT-IO that could be installed or not
{ //Here you only need to set value in pci1234 for HT-IO that could be installed or not
//You may need to preset pci1234 for HTIO board, please refer to src/northbridge/amd/amdk8/get_sblk_pci1234.c for detail //You may need to preset pci1234 for HTIO board, please refer to src/northbridge/amd/amdk8/get_sblk_pci1234.c for detail
0x0000ff0, 0x0000ff0,
// 0x0000ff0, // 0x0000ff0,
@ -34,8 +32,8 @@ unsigned pci1234x[] =
// 0x0000ff0, // 0x0000ff0,
// 0x0000ff0 // 0x0000ff0
}; };
unsigned hcdnx[] =
{ //HT Chain device num, actually it is unit id base of every ht device in chain, assume every chain only have 4 ht device at most unsigned hcdnx[] = { //HT Chain device num, actually it is unit id base of every ht device in chain, assume every chain only have 4 ht device at most
0x20202020, 0x20202020,
// 0x20202020, // 0x20202020,
// 0x20202020, // 0x20202020,
@ -45,10 +43,9 @@ unsigned hcdnx[] =
// 0x20202020, // 0x20202020,
// 0x20202020, // 0x20202020,
}; };
unsigned sbdn3; unsigned sbdn3;
static unsigned get_bus_conf_done = 0; static unsigned get_bus_conf_done = 0;
void get_bus_conf(void) void get_bus_conf(void)
@ -59,12 +56,13 @@ void get_bus_conf(void)
device_t dev; device_t dev;
int i; int i;
if(get_bus_conf_done==1) return; //do it only once if (get_bus_conf_done == 1)
return; //do it only once
get_bus_conf_done = 1; get_bus_conf_done = 1;
sysconf.hc_possible_num = ARRAY_SIZE(pci1234x); sysconf.hc_possible_num = ARRAY_SIZE(pci1234x);
for(i=0;i<sysconf.hc_possible_num; i++) { for (i = 0; i < sysconf.hc_possible_num; i++) {
sysconf.pci1234[i] = pci1234x[i]; sysconf.pci1234[i] = pci1234x[i];
sysconf.hcdn[i] = hcdnx[i]; sysconf.hcdn[i] = hcdnx[i];
} }
@ -78,32 +76,34 @@ void get_bus_conf(void)
bus_8111_0 = bus_8131_0; bus_8111_0 = bus_8131_0;
/* 8111 */ /* 8111 */
dev = dev_find_slot(bus_8111_0, PCI_DEVFN(sysconf.sbdn,0)); dev = dev_find_slot(bus_8111_0, PCI_DEVFN(sysconf.sbdn, 0));
if (dev) { if (dev) {
bus_8111_1 = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_8111_1 = pci_read_config8(dev, PCI_SECONDARY_BUS);
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI %02x:03.0, using defaults\n", bus_8111_0); "ERROR - could not find PCI %02x:03.0, using defaults\n",
bus_8111_0);
} }
/* 8131-1 */ /* 8131-1 */
dev = dev_find_slot(bus_8131_0, PCI_DEVFN(sbdn3,0)); dev = dev_find_slot(bus_8131_0, PCI_DEVFN(sbdn3, 0));
if (dev) { if (dev) {
bus_8131_1 = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_8131_1 = pci_read_config8(dev, PCI_SECONDARY_BUS);
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI %02x:01.0, using defaults\n", bus_8131_0); "ERROR - could not find PCI %02x:01.0, using defaults\n",
bus_8131_0);
} }
/* 8132-2 */ /* 8132-2 */
dev = dev_find_slot(bus_8131_0, PCI_DEVFN(sbdn3+1,0)); dev = dev_find_slot(bus_8131_0, PCI_DEVFN(sbdn3 + 1, 0));
if (dev) { if (dev) {
bus_8131_2 = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_8131_2 = pci_read_config8(dev, PCI_SECONDARY_BUS);
} else {
printk(BIOS_DEBUG,
"ERROR - could not find PCI %02x:02.0, using defaults\n",
bus_8131_0);
} }
else {
printk(BIOS_DEBUG, "ERROR - could not find PCI %02x:02.0, using defaults\n", bus_8131_0);
}
/*I/O APICs: APIC ID Version State Address*/ /*I/O APICs: APIC ID Version State Address*/
#if CONFIG_LOGICAL_CPUS #if CONFIG_LOGICAL_CPUS
@ -111,7 +111,7 @@ void get_bus_conf(void)
#else #else
apicid_base = CONFIG_MAX_PHYSICAL_CPUS; apicid_base = CONFIG_MAX_PHYSICAL_CPUS;
#endif #endif
apicid_8111 = apicid_base+0; apicid_8111 = apicid_base + 0;
apicid_8131_1 = apicid_base+1; apicid_8131_1 = apicid_base + 1;
apicid_8131_2 = apicid_base+2; apicid_8131_2 = apicid_base + 2;
} }

View File

@ -19,12 +19,11 @@ unsigned char bus_8111_0 = 1;
unsigned char bus_8111_1 = 4; unsigned char bus_8111_1 = 4;
unsigned char bus_8151_0 = 5; unsigned char bus_8151_0 = 5;
unsigned char bus_8151_1 = 6; unsigned char bus_8151_1 = 6;
unsigned apicid_8111 ; unsigned apicid_8111;
unsigned apicid_8131_1; unsigned apicid_8131_1;
unsigned apicid_8131_2; unsigned apicid_8131_2;
unsigned pci1234x[] = unsigned pci1234x[] = { //Here you only need to set value in pci1234 for HT-IO that could be installed or not
{ //Here you only need to set value in pci1234 for HT-IO that could be installed or not
//You may need to preset pci1234 for HTIO board, please refer to src/northbridge/amd/amdk8/get_sblk_pci1234.c for detail //You may need to preset pci1234 for HTIO board, please refer to src/northbridge/amd/amdk8/get_sblk_pci1234.c for detail
0x0000ff0, 0x0000ff0,
0x0000ff0, 0x0000ff0,
@ -35,8 +34,8 @@ unsigned pci1234x[] =
// 0x0000ff0, // 0x0000ff0,
// 0x0000ff0 // 0x0000ff0
}; };
unsigned hcdnx[] =
{ //HT Chain device num, actually it is unit id base of every ht device in chain, assume every chain only have 4 ht device at most unsigned hcdnx[] = { //HT Chain device num, actually it is unit id base of every ht device in chain, assume every chain only have 4 ht device at most
0x20202020, 0x20202020,
0x20202020, 0x20202020,
// 0x20202020, // 0x20202020,
@ -46,11 +45,10 @@ unsigned hcdnx[] =
// 0x20202020, // 0x20202020,
// 0x20202020, // 0x20202020,
}; };
unsigned sbdn3; unsigned sbdn3;
unsigned sbdn5; unsigned sbdn5;
static unsigned get_bus_conf_done = 0; static unsigned get_bus_conf_done = 0;
void get_bus_conf(void) void get_bus_conf(void)
@ -61,12 +59,13 @@ void get_bus_conf(void)
device_t dev; device_t dev;
int i; int i;
if(get_bus_conf_done==1) return; //do it only once if (get_bus_conf_done == 1)
return; //do it only once
get_bus_conf_done = 1; get_bus_conf_done = 1;
sysconf.hc_possible_num = ARRAY_SIZE(pci1234x); sysconf.hc_possible_num = ARRAY_SIZE(pci1234x);
for(i=0;i<sysconf.hc_possible_num; i++) { for (i = 0; i < sysconf.hc_possible_num; i++) {
sysconf.pci1234[i] = pci1234x[i]; sysconf.pci1234[i] = pci1234x[i];
sysconf.hcdn[i] = hcdnx[i]; sysconf.hcdn[i] = hcdnx[i];
} }
@ -81,37 +80,40 @@ void get_bus_conf(void)
bus_8111_0 = bus_8131_0; bus_8111_0 = bus_8131_0;
/* 8111 */ /* 8111 */
dev = dev_find_slot(bus_8111_0, PCI_DEVFN(sysconf.sbdn,0)); dev = dev_find_slot(bus_8111_0, PCI_DEVFN(sysconf.sbdn, 0));
if (dev) { if (dev) {
bus_8111_1 = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_8111_1 = pci_read_config8(dev, PCI_SECONDARY_BUS);
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI %02x:03.0, using defaults\n", bus_8111_0); "ERROR - could not find PCI %02x:03.0, using defaults\n",
bus_8111_0);
} }
/* 8131-1 */ /* 8131-1 */
dev = dev_find_slot(bus_8131_0, PCI_DEVFN(sbdn3,0)); dev = dev_find_slot(bus_8131_0, PCI_DEVFN(sbdn3, 0));
if (dev) { if (dev) {
bus_8131_1 = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_8131_1 = pci_read_config8(dev, PCI_SECONDARY_BUS);
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI %02x:01.0, using defaults\n", bus_8131_0); "ERROR - could not find PCI %02x:01.0, using defaults\n",
bus_8131_0);
} }
/* 8132-2 */ /* 8132-2 */
dev = dev_find_slot(bus_8131_0, PCI_DEVFN(sbdn3+1,0)); dev = dev_find_slot(bus_8131_0, PCI_DEVFN(sbdn3 + 1, 0));
if (dev) { if (dev) {
bus_8131_2 = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_8131_2 = pci_read_config8(dev, PCI_SECONDARY_BUS);
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI %02x:02.0, using defaults\n", bus_8131_0); "ERROR - could not find PCI %02x:02.0, using defaults\n",
bus_8131_0);
} }
/* HT chain 1 */ /* HT chain 1 */
// it is on node0, so it must be there // it is on node0, so it must be there
bus_8151_0 = (sysconf.pci1234[1] >> 16) & 0xff; bus_8151_0 = (sysconf.pci1234[1] >> 16) & 0xff;
/* 8151 */ /* 8151 */
dev = dev_find_slot(bus_8151_0, PCI_DEVFN(sbdn5+1, 0)); dev = dev_find_slot(bus_8151_0, PCI_DEVFN(sbdn5 + 1, 0));
if (dev) { if (dev) {
bus_8151_1 = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_8151_1 = pci_read_config8(dev, PCI_SECONDARY_BUS);
@ -124,7 +126,7 @@ void get_bus_conf(void)
#else #else
apicid_base = CONFIG_MAX_PHYSICAL_CPUS; apicid_base = CONFIG_MAX_PHYSICAL_CPUS;
#endif #endif
apicid_8111 = apicid_base+0; apicid_8111 = apicid_base + 0;
apicid_8131_1 = apicid_base+1; apicid_8131_1 = apicid_base + 1;
apicid_8131_2 = apicid_base+2; apicid_8131_2 = apicid_base + 2;
} }

View File

@ -12,23 +12,21 @@
// Global variables for MB layouts and these will be shared by irqtable mptable and acpi_tables // Global variables for MB layouts and these will be shared by irqtable mptable and acpi_tables
//busnum is default //busnum is default
unsigned char bus_ck804_0; //1 unsigned char bus_ck804_0; //1
unsigned char bus_ck804_1; //2 unsigned char bus_ck804_1; //2
unsigned char bus_ck804_2; //3 unsigned char bus_ck804_2; //3
unsigned char bus_ck804_3; //4 unsigned char bus_ck804_3; //4
unsigned char bus_ck804_4; //5 unsigned char bus_ck804_4; //5
unsigned char bus_ck804_5; //6 unsigned char bus_ck804_5; //6
unsigned char bus_8131_0; //7 unsigned char bus_8131_0; //7
unsigned char bus_8131_1; //8 unsigned char bus_8131_1; //8
unsigned char bus_8131_2; //9 unsigned char bus_8131_2; //9
unsigned char bus_coproc_0; unsigned char bus_coproc_0;
unsigned apicid_ck804; unsigned apicid_ck804;
unsigned apicid_8131_1; unsigned apicid_8131_1;
unsigned apicid_8131_2; unsigned apicid_8131_2;
unsigned pci1234x[] = { //Here you only need to set value in pci1234 for HT-IO that could be installed or not
unsigned pci1234x[] =
{ //Here you only need to set value in pci1234 for HT-IO that could be installed or not
//You may need to preset pci1234 for HTIO board, please refer to src/northbridge/amd/amdk8/get_sblk_pci1234.c for detail //You may need to preset pci1234 for HTIO board, please refer to src/northbridge/amd/amdk8/get_sblk_pci1234.c for detail
0x0000000, 0x0000000,
0x0000200, 0x0000200,
@ -39,8 +37,8 @@ unsigned pci1234x[] =
// 0x0000ff0, // 0x0000ff0,
// 0x0000ff0 // 0x0000ff0
}; };
unsigned hcdnx[] =
{ //HT Chain device num, actually it is unit id base of every ht device in chain, assume every chain only have 4 ht device at most unsigned hcdnx[] = { //HT Chain device num, actually it is unit id base of every ht device in chain, assume every chain only have 4 ht device at most
0x20202020, 0x20202020,
0x20202020, 0x20202020,
0x20202020, 0x20202020,
@ -54,8 +52,6 @@ unsigned hcdnx[] =
unsigned sbdn3; unsigned sbdn3;
unsigned coprocdn; unsigned coprocdn;
static unsigned get_bus_conf_done = 0; static unsigned get_bus_conf_done = 0;
void get_bus_conf(void) void get_bus_conf(void)
@ -67,12 +63,13 @@ void get_bus_conf(void)
device_t dev; device_t dev;
int i; int i;
if(get_bus_conf_done==1) return; //do it only once if (get_bus_conf_done == 1)
return; //do it only once
get_bus_conf_done = 1; get_bus_conf_done = 1;
sysconf.hc_possible_num = ARRAY_SIZE(pci1234x); sysconf.hc_possible_num = ARRAY_SIZE(pci1234x);
for(i=0;i<sysconf.hc_possible_num; i++) { for (i = 0; i < sysconf.hc_possible_num; i++) {
sysconf.pci1234[i] = pci1234x[i]; sysconf.pci1234[i] = pci1234x[i];
sysconf.hcdn[i] = hcdnx[i]; sysconf.hcdn[i] = hcdnx[i];
} }
@ -86,79 +83,82 @@ void get_bus_conf(void)
bus_ck804_0 = (sysconf.pci1234[0] >> 16) & 0xff; bus_ck804_0 = (sysconf.pci1234[0] >> 16) & 0xff;
/* CK804 */ /* CK804 */
dev = dev_find_slot(bus_ck804_0, PCI_DEVFN(sbdn + 0x09,0)); dev = dev_find_slot(bus_ck804_0, PCI_DEVFN(sbdn + 0x09, 0));
if (dev) { if (dev) {
bus_ck804_1 = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_ck804_1 = pci_read_config8(dev, PCI_SECONDARY_BUS);
bus_ck804_4 = pci_read_config8(dev, PCI_SUBORDINATE_BUS); bus_ck804_4 = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
bus_ck804_4++; bus_ck804_4++;
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI 1:%02x.0, using defaults\n", sbdn + 0x09); "ERROR - could not find PCI 1:%02x.0, using defaults\n",
sbdn + 0x09);
bus_ck804_1 = 2; bus_ck804_1 = 2;
bus_ck804_4 = 3; bus_ck804_4 = 3;
} }
dev = dev_find_slot(bus_ck804_0, PCI_DEVFN(sbdn + 0x0d,0)); dev = dev_find_slot(bus_ck804_0, PCI_DEVFN(sbdn + 0x0d, 0));
if (dev) { if (dev) {
bus_ck804_4 = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_ck804_4 = pci_read_config8(dev, PCI_SECONDARY_BUS);
bus_ck804_5 = pci_read_config8(dev, PCI_SUBORDINATE_BUS); bus_ck804_5 = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
bus_ck804_5++; bus_ck804_5++;
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI 1:%02x.0, using defaults\n",sbdn + 0x0d); "ERROR - could not find PCI 1:%02x.0, using defaults\n",
sbdn + 0x0d);
bus_ck804_5 = bus_ck804_4+1; bus_ck804_5 = bus_ck804_4 + 1;
} }
dev = dev_find_slot(bus_ck804_0, PCI_DEVFN(sbdn+ 0x0e,0)); dev = dev_find_slot(bus_ck804_0, PCI_DEVFN(sbdn + 0x0e, 0));
if (dev) { if (dev) {
bus_ck804_5 = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_ck804_5 = pci_read_config8(dev, PCI_SECONDARY_BUS);
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI 1:%02x.0, using defaults\n", sbdn+ 0x0e); "ERROR - could not find PCI 1:%02x.0, using defaults\n",
sbdn + 0x0e);
} }
bus_8131_0 = (sysconf.pci1234[1] >> 16) & 0xff; bus_8131_0 = (sysconf.pci1234[1] >> 16) & 0xff;
/* 8131-1 */ /* 8131-1 */
dev = dev_find_slot(bus_8131_0, PCI_DEVFN(sbdn3,0)); dev = dev_find_slot(bus_8131_0, PCI_DEVFN(sbdn3, 0));
if (dev) { if (dev) {
bus_8131_1 = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_8131_1 = pci_read_config8(dev, PCI_SECONDARY_BUS);
bus_8131_2 = pci_read_config8(dev, PCI_SUBORDINATE_BUS); bus_8131_2 = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
bus_8131_2++; bus_8131_2++;
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI %02x:01.0, using defaults\n", bus_8131_0); "ERROR - could not find PCI %02x:01.0, using defaults\n",
bus_8131_0);
bus_8131_1 = bus_8131_0+1; bus_8131_1 = bus_8131_0 + 1;
bus_8131_2 = bus_8131_0+2; bus_8131_2 = bus_8131_0 + 2;
} }
/* 8131-2 */ /* 8131-2 */
dev = dev_find_slot(bus_8131_0, PCI_DEVFN(sbdn3+1,0)); dev = dev_find_slot(bus_8131_0, PCI_DEVFN(sbdn3 + 1, 0));
if (dev) { if (dev) {
bus_8131_2 = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_8131_2 = pci_read_config8(dev, PCI_SECONDARY_BUS);
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI %02x:02.0, using defaults\n", bus_8131_0); "ERROR - could not find PCI %02x:02.0, using defaults\n",
bus_8131_0);
bus_8131_2 = bus_8131_1+1; bus_8131_2 = bus_8131_1 + 1;
} }
if(sysconf.pci1234[2] & 1) { if (sysconf.pci1234[2] & 1) {
bus_coproc_0 = (sysconf.pci1234[2] >> 16) & 0xff; bus_coproc_0 = (sysconf.pci1234[2] >> 16) & 0xff;
coprocdn = (sysconf.hcdn[2] & 0xff); coprocdn = (sysconf.hcdn[2] & 0xff);
} }
/*I/O APICs: APIC ID Version State Address*/ /*I/O APICs: APIC ID Version State Address*/
#if CONFIG_LOGICAL_CPUS #if CONFIG_LOGICAL_CPUS
apicid_base = get_apicid_base(3); apicid_base = get_apicid_base(3);
#else #else
apicid_base = CONFIG_MAX_PHYSICAL_CPUS; apicid_base = CONFIG_MAX_PHYSICAL_CPUS;
#endif #endif
apicid_ck804 = apicid_base+0; apicid_ck804 = apicid_base + 0;
apicid_8131_1 = apicid_base+1; apicid_8131_1 = apicid_base + 1;
apicid_8131_2 = apicid_base+2; apicid_8131_2 = apicid_base + 2;
} }

View File

@ -12,21 +12,20 @@
// Global variables for MB layouts and these will be shared by irqtable mptable and acpi_tables // Global variables for MB layouts and these will be shared by irqtable mptable and acpi_tables
//busnum is default //busnum is default
unsigned char bus_ck804_0; //1 unsigned char bus_ck804_0; //1
unsigned char bus_ck804_1; //2 unsigned char bus_ck804_1; //2
unsigned char bus_ck804_2; //3 unsigned char bus_ck804_2; //3
unsigned char bus_ck804_3; //4 unsigned char bus_ck804_3; //4
unsigned char bus_ck804_4; //5 unsigned char bus_ck804_4; //5
unsigned char bus_ck804_5; //6 unsigned char bus_ck804_5; //6
unsigned char bus_8131_0; //7 unsigned char bus_8131_0; //7
unsigned char bus_8131_1; //8 unsigned char bus_8131_1; //8
unsigned char bus_8131_2; //9 unsigned char bus_8131_2; //9
unsigned apicid_ck804; unsigned apicid_ck804;
unsigned apicid_8131_1; unsigned apicid_8131_1;
unsigned apicid_8131_2; unsigned apicid_8131_2;
unsigned pci1234x[] = unsigned pci1234x[] = { //Here you only need to set value in pci1234 for HT-IO that could be installed or not
{ //Here you only need to set value in pci1234 for HT-IO that could be installed or not
//You may need to preset pci1234 for HTIO board, please refer to src/northbridge/amd/amdk8/get_sblk_pci1234.c for detail //You may need to preset pci1234 for HTIO board, please refer to src/northbridge/amd/amdk8/get_sblk_pci1234.c for detail
0x0000ff0, 0x0000ff0,
0x0000ff0, 0x0000ff0,
@ -37,8 +36,8 @@ unsigned pci1234x[] =
// 0x0000ff0, // 0x0000ff0,
// 0x0000ff0 // 0x0000ff0
}; };
unsigned hcdnx[] =
{ //HT Chain device num, actually it is unit id base of every ht device in chain, assume every chain only have 4 ht device at most unsigned hcdnx[] = { //HT Chain device num, actually it is unit id base of every ht device in chain, assume every chain only have 4 ht device at most
0x20202020, 0x20202020,
0x20202020, 0x20202020,
// 0x20202020, // 0x20202020,
@ -51,8 +50,6 @@ unsigned hcdnx[] =
unsigned sbdn3; unsigned sbdn3;
static unsigned get_bus_conf_done = 0; static unsigned get_bus_conf_done = 0;
void get_bus_conf(void) void get_bus_conf(void)
@ -64,12 +61,13 @@ void get_bus_conf(void)
device_t dev; device_t dev;
int i; int i;
if(get_bus_conf_done==1) return; //do it only once if (get_bus_conf_done == 1)
return; //do it only once
get_bus_conf_done = 1; get_bus_conf_done = 1;
sysconf.hc_possible_num = ARRAY_SIZE(pci1234x); sysconf.hc_possible_num = ARRAY_SIZE(pci1234x);
for(i=0;i<sysconf.hc_possible_num; i++) { for (i = 0; i < sysconf.hc_possible_num; i++) {
sysconf.pci1234[i] = pci1234x[i]; sysconf.pci1234[i] = pci1234x[i];
sysconf.hcdn[i] = hcdnx[i]; sysconf.hcdn[i] = hcdnx[i];
} }
@ -83,67 +81,69 @@ void get_bus_conf(void)
bus_ck804_0 = (sysconf.pci1234[0] >> 16) & 0xff; bus_ck804_0 = (sysconf.pci1234[0] >> 16) & 0xff;
/* CK804 */ /* CK804 */
dev = dev_find_slot(bus_ck804_0, PCI_DEVFN(sbdn + 0x09,0)); dev = dev_find_slot(bus_ck804_0, PCI_DEVFN(sbdn + 0x09, 0));
if (dev) { if (dev) {
bus_ck804_1 = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_ck804_1 = pci_read_config8(dev, PCI_SECONDARY_BUS);
bus_ck804_4 = pci_read_config8(dev, PCI_SUBORDINATE_BUS); bus_ck804_4 = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
bus_ck804_4++; bus_ck804_4++;
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI 1:%02x.0, using defaults\n", sbdn + 0x09); "ERROR - could not find PCI 1:%02x.0, using defaults\n",
sbdn + 0x09);
bus_ck804_1 = 2; bus_ck804_1 = 2;
bus_ck804_4 = 3; bus_ck804_4 = 3;
} }
dev = dev_find_slot(bus_ck804_0, PCI_DEVFN(sbdn + 0x0d,0)); dev = dev_find_slot(bus_ck804_0, PCI_DEVFN(sbdn + 0x0d, 0));
if (dev) { if (dev) {
bus_ck804_4 = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_ck804_4 = pci_read_config8(dev, PCI_SECONDARY_BUS);
bus_ck804_5 = pci_read_config8(dev, PCI_SUBORDINATE_BUS); bus_ck804_5 = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
bus_ck804_5++; bus_ck804_5++;
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI 1:%02x.0, using defaults\n",sbdn + 0x0d); "ERROR - could not find PCI 1:%02x.0, using defaults\n",
sbdn + 0x0d);
bus_ck804_5 = bus_ck804_4+1; bus_ck804_5 = bus_ck804_4 + 1;
} }
dev = dev_find_slot(bus_ck804_0, PCI_DEVFN(sbdn+ 0x0e,0)); dev = dev_find_slot(bus_ck804_0, PCI_DEVFN(sbdn + 0x0e, 0));
if (dev) { if (dev) {
bus_ck804_5 = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_ck804_5 = pci_read_config8(dev, PCI_SECONDARY_BUS);
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI 1:%02x.0, using defaults\n", sbdn+ 0x0e); "ERROR - could not find PCI 1:%02x.0, using defaults\n",
sbdn + 0x0e);
} }
bus_8131_0 = (sysconf.pci1234[1] >> 16) & 0xff; bus_8131_0 = (sysconf.pci1234[1] >> 16) & 0xff;
/* 8131-1 */ /* 8131-1 */
dev = dev_find_slot(bus_8131_0, PCI_DEVFN(sbdn3,0)); dev = dev_find_slot(bus_8131_0, PCI_DEVFN(sbdn3, 0));
if (dev) { if (dev) {
bus_8131_1 = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_8131_1 = pci_read_config8(dev, PCI_SECONDARY_BUS);
bus_8131_2 = pci_read_config8(dev, PCI_SUBORDINATE_BUS); bus_8131_2 = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
bus_8131_2++; bus_8131_2++;
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI %02x:01.0, using defaults\n", bus_8131_0); "ERROR - could not find PCI %02x:01.0, using defaults\n",
bus_8131_0);
bus_8131_1 = bus_8131_0+1; bus_8131_1 = bus_8131_0 + 1;
bus_8131_2 = bus_8131_0+2; bus_8131_2 = bus_8131_0 + 2;
} }
/* 8131-2 */ /* 8131-2 */
dev = dev_find_slot(bus_8131_0, PCI_DEVFN(sbdn3+1,0)); dev = dev_find_slot(bus_8131_0, PCI_DEVFN(sbdn3 + 1, 0));
if (dev) { if (dev) {
bus_8131_2 = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_8131_2 = pci_read_config8(dev, PCI_SECONDARY_BUS);
} else {
printk(BIOS_DEBUG,
"ERROR - could not find PCI %02x:02.0, using defaults\n",
bus_8131_0);
bus_8131_2 = bus_8131_1 + 1;
} }
else {
printk(BIOS_DEBUG, "ERROR - could not find PCI %02x:02.0, using defaults\n", bus_8131_0);
bus_8131_2 = bus_8131_1+1;
}
/*I/O APICs: APIC ID Version State Address*/ /*I/O APICs: APIC ID Version State Address*/
#if CONFIG_LOGICAL_CPUS #if CONFIG_LOGICAL_CPUS
@ -151,7 +151,7 @@ void get_bus_conf(void)
#else #else
apicid_base = CONFIG_MAX_PHYSICAL_CPUS; apicid_base = CONFIG_MAX_PHYSICAL_CPUS;
#endif #endif
apicid_ck804 = apicid_base+0; apicid_ck804 = apicid_base + 0;
apicid_8131_1 = apicid_base+1; apicid_8131_1 = apicid_base + 1;
apicid_8131_2 = apicid_base+2; apicid_8131_2 = apicid_base + 2;
} }

View File

@ -12,28 +12,27 @@
// Global variables for MB layouts and these will be shared by irqtable mptable and acpi_tables // Global variables for MB layouts and these will be shared by irqtable mptable and acpi_tables
//busnum is default //busnum is default
unsigned char bus_ck804_0; //1 unsigned char bus_ck804_0; //1
unsigned char bus_ck804_1; //2 unsigned char bus_ck804_1; //2
unsigned char bus_ck804_2; //3 unsigned char bus_ck804_2; //3
unsigned char bus_ck804_3; //4 unsigned char bus_ck804_3; //4
unsigned char bus_ck804_4; //5 unsigned char bus_ck804_4; //5
unsigned char bus_ck804_5; //6 unsigned char bus_ck804_5; //6
unsigned char bus_8131_0; //7 unsigned char bus_8131_0; //7
unsigned char bus_8131_1; //8 unsigned char bus_8131_1; //8
unsigned char bus_8131_2; //9 unsigned char bus_8131_2; //9
unsigned char bus_ck804b_0;//a unsigned char bus_ck804b_0; //a
unsigned char bus_ck804b_1;//b unsigned char bus_ck804b_1; //b
unsigned char bus_ck804b_2;//c unsigned char bus_ck804b_2; //c
unsigned char bus_ck804b_3;//d unsigned char bus_ck804b_3; //d
unsigned char bus_ck804b_4;//e unsigned char bus_ck804b_4; //e
unsigned char bus_ck804b_5;//f unsigned char bus_ck804b_5; //f
unsigned apicid_ck804; unsigned apicid_ck804;
unsigned apicid_8131_1; unsigned apicid_8131_1;
unsigned apicid_8131_2; unsigned apicid_8131_2;
unsigned apicid_ck804b; unsigned apicid_ck804b;
unsigned pci1234x[] = unsigned pci1234x[] = { //Here you only need to set value in pci1234 for HT-IO that could be installed or not
{ //Here you only need to set value in pci1234 for HT-IO that could be installed or not
//You may need to preset pci1234 for HTIO board, please refer to src/northbridge/amd/amdk8/get_sblk_pci1234.c for detail //You may need to preset pci1234 for HTIO board, please refer to src/northbridge/amd/amdk8/get_sblk_pci1234.c for detail
0x0000ff0, 0x0000ff0,
0x0000ff0, 0x0000ff0,
@ -44,8 +43,8 @@ unsigned pci1234x[] =
// 0x0000ff0, // 0x0000ff0,
// 0x0000ff0 // 0x0000ff0
}; };
unsigned hcdnx[] =
{ //HT Chain device num, actually it is unit id base of every ht device in chain, assume every chain only have 4 ht device at most unsigned hcdnx[] = { //HT Chain device num, actually it is unit id base of every ht device in chain, assume every chain only have 4 ht device at most
0x20202020, 0x20202020,
0x20202020, 0x20202020,
0x20202020, 0x20202020,
@ -59,8 +58,6 @@ unsigned hcdnx[] =
unsigned sbdn3; unsigned sbdn3;
unsigned sbdnb; unsigned sbdnb;
static unsigned get_bus_conf_done = 0; static unsigned get_bus_conf_done = 0;
void get_bus_conf(void) void get_bus_conf(void)
@ -72,12 +69,13 @@ void get_bus_conf(void)
device_t dev; device_t dev;
int i; int i;
if(get_bus_conf_done==1) return; //do it only once if (get_bus_conf_done == 1)
return; //do it only once
get_bus_conf_done = 1; get_bus_conf_done = 1;
sysconf.hc_possible_num = ARRAY_SIZE(pci1234x); sysconf.hc_possible_num = ARRAY_SIZE(pci1234x);
for(i=0;i<sysconf.hc_possible_num; i++) { for (i = 0; i < sysconf.hc_possible_num; i++) {
sysconf.pci1234[i] = pci1234x[i]; sysconf.pci1234[i] = pci1234x[i];
sysconf.hcdn[i] = hcdnx[i]; sysconf.hcdn[i] = hcdnx[i];
} }
@ -94,76 +92,80 @@ void get_bus_conf(void)
bus_ck804_0 = (sysconf.pci1234[0] >> 16) & 0xff; bus_ck804_0 = (sysconf.pci1234[0] >> 16) & 0xff;
/* CK804 */ /* CK804 */
dev = dev_find_slot(bus_ck804_0, PCI_DEVFN(sbdn + 0x09,0)); dev = dev_find_slot(bus_ck804_0, PCI_DEVFN(sbdn + 0x09, 0));
if (dev) { if (dev) {
bus_ck804_1 = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_ck804_1 = pci_read_config8(dev, PCI_SECONDARY_BUS);
bus_ck804_5 = pci_read_config8(dev, PCI_SUBORDINATE_BUS); bus_ck804_5 = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
bus_ck804_5++; bus_ck804_5++;
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI 1:%02x.0, using defaults\n", sbdn + 0x09); "ERROR - could not find PCI 1:%02x.0, using defaults\n",
sbdn + 0x09);
bus_ck804_1 = 2; bus_ck804_1 = 2;
bus_ck804_5 = 3; bus_ck804_5 = 3;
} }
dev = dev_find_slot(bus_ck804_0, PCI_DEVFN(sbdn+ 0x0e,0)); dev = dev_find_slot(bus_ck804_0, PCI_DEVFN(sbdn + 0x0e, 0));
if (dev) { if (dev) {
bus_ck804_5 = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_ck804_5 = pci_read_config8(dev, PCI_SECONDARY_BUS);
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI 1:%02x.0, using defaults\n", sbdn+ 0x0e); "ERROR - could not find PCI 1:%02x.0, using defaults\n",
sbdn + 0x0e);
} }
bus_8131_0 = (sysconf.pci1234[1] >> 16) & 0xff; bus_8131_0 = (sysconf.pci1234[1] >> 16) & 0xff;
/* 8131-1 */ /* 8131-1 */
dev = dev_find_slot(bus_8131_0, PCI_DEVFN(sbdn3,0)); dev = dev_find_slot(bus_8131_0, PCI_DEVFN(sbdn3, 0));
if (dev) { if (dev) {
bus_8131_1 = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_8131_1 = pci_read_config8(dev, PCI_SECONDARY_BUS);
bus_8131_2 = pci_read_config8(dev, PCI_SUBORDINATE_BUS); bus_8131_2 = pci_read_config8(dev, PCI_SUBORDINATE_BUS);
bus_8131_2++; bus_8131_2++;
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI %02x:01.0, using defaults\n", bus_8131_0); "ERROR - could not find PCI %02x:01.0, using defaults\n",
bus_8131_0);
bus_8131_1 = bus_8131_0+1; bus_8131_1 = bus_8131_0 + 1;
bus_8131_2 = bus_8131_0+2; bus_8131_2 = bus_8131_0 + 2;
} }
/* 8131-2 */ /* 8131-2 */
dev = dev_find_slot(bus_8131_0, PCI_DEVFN(sbdn3,0)); dev = dev_find_slot(bus_8131_0, PCI_DEVFN(sbdn3, 0));
if (dev) { if (dev) {
bus_8131_2 = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_8131_2 = pci_read_config8(dev, PCI_SECONDARY_BUS);
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI %02x:02.0, using defaults\n", bus_8131_0); "ERROR - could not find PCI %02x:02.0, using defaults\n",
bus_8131_0);
bus_8131_2 = bus_8131_1+1; bus_8131_2 = bus_8131_1 + 1;
} }
/* CK804b */ /* CK804b */
if(sysconf.pci1234[2] & 0x0f) { //if the second cpu is installed if (sysconf.pci1234[2] & 0x0f) { //if the second cpu is installed
bus_ck804b_0 = (sysconf.pci1234[2]>>16) & 0xff; bus_ck804b_0 = (sysconf.pci1234[2] >> 16) & 0xff;
dev = dev_find_slot(bus_ck804b_0, PCI_DEVFN(sbdnb + 0x0e,0)); dev = dev_find_slot(bus_ck804b_0, PCI_DEVFN(sbdnb + 0x0e, 0));
if (dev) { if (dev) {
bus_ck804b_5 = pci_read_config8(dev, PCI_SECONDARY_BUS); bus_ck804b_5 = pci_read_config8(dev, PCI_SECONDARY_BUS);
} } else {
else { printk(BIOS_DEBUG,
printk(BIOS_DEBUG, "ERROR - could not find PCI %02x:%02x.0, using defaults\n", bus_ck804b_0,sbdnb+0x0e); "ERROR - could not find PCI %02x:%02x.0, using defaults\n",
bus_ck804b_5 = bus_ck804b_4+1; bus_ck804b_0, sbdnb + 0x0e);
bus_ck804b_5 = bus_ck804b_4 + 1;
} }
} }
/*I/O APICs: APIC ID Version State Address*/ /*I/O APICs: APIC ID Version State Address*/
#if CONFIG_LOGICAL_CPUS #if CONFIG_LOGICAL_CPUS
apicid_base = get_apicid_base(4); apicid_base = get_apicid_base(4);
#else #else
apicid_base = CONFIG_MAX_PHYSICAL_CPUS; apicid_base = CONFIG_MAX_PHYSICAL_CPUS;
#endif #endif
apicid_ck804 = apicid_base+0; apicid_ck804 = apicid_base + 0;
apicid_8131_1 = apicid_base+1; apicid_8131_1 = apicid_base + 1;
apicid_8131_2 = apicid_base+2; apicid_8131_2 = apicid_base + 2;
apicid_ck804b = apicid_base+3; apicid_ck804b = apicid_base + 3;
} }