Krystian Hebel has uploaded this change for review.

View Change

AGESA: Fix discovery of IO APICs number

Number of IO APICs are hardcoded. This fix reads this number from
the default values obtained by creating a structure for a parameter
block of an AGESA.

While it is possible to modify NumberOfIoApics in callouts, every
platform currently in the tree goes with the default value.

Signed-off-by: Krystian Hebel <krystian.hebel@3mdeb.com>
Change-Id: Ib3ddfe606720143659e57fbbca7f7a3e655a7664
---
M src/drivers/amd/agesa/state_machine.c
M src/northbridge/amd/agesa/agesa_helper.h
M src/northbridge/amd/agesa/family15tn/northbridge.c
M src/northbridge/amd/agesa/family16kb/northbridge.c
4 files changed, 21 insertions(+), 2 deletions(-)

git pull ssh://review.coreboot.org:29418/coreboot refs/changes/89/34589/1
diff --git a/src/drivers/amd/agesa/state_machine.c b/src/drivers/amd/agesa/state_machine.c
index 750d192..7964f4e 100644
--- a/src/drivers/amd/agesa/state_machine.c
+++ b/src/drivers/amd/agesa/state_machine.c
@@ -297,6 +297,23 @@
return (final < AGESA_FATAL) ? 0 : -1;
}

+int amd_get_ioapic_num(void) {
+ AMD_INTERFACE_PARAMS aip;
+ AMD_EARLY_PARAMS *params;
+ int ret;
+
+ agesa_locate_image(&aip.StdHeader);
+
+ amd_create_struct(&aip, AMD_INIT_EARLY, NULL, 0);
+
+ params = (AMD_EARLY_PARAMS *)aip.NewStructPtr;
+ ret = params->PlatformConfig.NumberOfIoApics;
+
+ amd_release_struct(&aip);
+
+ return ret;
+}
+
#if ENV_RAMSTAGE

static void amd_bs_ramstage_init(void *arg)
diff --git a/src/northbridge/amd/agesa/agesa_helper.h b/src/northbridge/amd/agesa/agesa_helper.h
index 17819e9..97eba2f 100644
--- a/src/northbridge/amd/agesa/agesa_helper.h
+++ b/src/northbridge/amd/agesa/agesa_helper.h
@@ -39,6 +39,8 @@
void amd_initmmio(void);
void amd_initenv(void);

+int amd_get_ioapic_num(void);
+
void *GetHeapBase(void);
void EmptyHeap(void);

diff --git a/src/northbridge/amd/agesa/family15tn/northbridge.c b/src/northbridge/amd/agesa/family15tn/northbridge.c
index c6457a3..e9a1e05 100644
--- a/src/northbridge/amd/agesa/family15tn/northbridge.c
+++ b/src/northbridge/amd/agesa/family15tn/northbridge.c
@@ -870,7 +870,7 @@
* for their APIC id and therefore must reside at 0..15
*/

- u8 plat_num_io_apics = 3; /* FIXME */
+ u8 plat_num_io_apics = amd_get_ioapic_num();

if ((node_nums * core_max) + plat_num_io_apics >= 0x10) {
lapicid_start = (plat_num_io_apics - 1) / core_max;
diff --git a/src/northbridge/amd/agesa/family16kb/northbridge.c b/src/northbridge/amd/agesa/family16kb/northbridge.c
index 928d9d2..b3b68f9 100644
--- a/src/northbridge/amd/agesa/family16kb/northbridge.c
+++ b/src/northbridge/amd/agesa/family16kb/northbridge.c
@@ -896,7 +896,7 @@
* for their APIC id and therefore must reside at 0..15
*/

- u8 plat_num_io_apics = 3; /* FIXME */
+ u8 plat_num_io_apics = amd_get_ioapic_num();

if ((node_nums * core_max) + plat_num_io_apics >= 0x10) {
lapicid_start = (plat_num_io_apics - 1) / core_max;

To view, visit change 34589. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Ib3ddfe606720143659e57fbbca7f7a3e655a7664
Gerrit-Change-Number: 34589
Gerrit-PatchSet: 1
Gerrit-Owner: Krystian Hebel <krystian.hebel@3mdeb.com>
Gerrit-MessageType: newchange