Martin Roth merged this change.

View Change

Approvals: build bot (Jenkins): Verified Arthur Heymans: Looks good to me, approved
intel/i945,gm45,pineview,x4x: Fix stage cache location

The cache is at the end of TSEG. As SMM_RESERVED_SIZE was
half of TSEG size, offseting from the start gave same
position.

Change-Id: I2d5df90b40ff7cd9fde3cbe3cc5090aac74825f7
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/34671
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
---
M src/northbridge/intel/gm45/ram_calc.c
M src/northbridge/intel/i945/ram_calc.c
M src/northbridge/intel/pineview/ram_calc.c
M src/northbridge/intel/x4x/ram_calc.c
4 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/src/northbridge/intel/gm45/ram_calc.c b/src/northbridge/intel/gm45/ram_calc.c
index 719c59f..6795f7a 100644
--- a/src/northbridge/intel/gm45/ram_calc.c
+++ b/src/northbridge/intel/gm45/ram_calc.c
@@ -126,13 +126,12 @@

void stage_cache_external_region(void **base, size_t *size)
{
- /*
- * The ramstage cache lives in the TSEG region at RESERVED_SMM_OFFSET.
+ /* The stage cache lives at the end of the TSEG region.
* The top of RAM is defined to be the TSEG base address.
*/
*size = CONFIG_SMM_RESERVED_SIZE;
- *base = (void *)(northbridge_get_tseg_base()
- + CONFIG_SMM_RESERVED_SIZE);
+ *base = (void *)((uintptr_t)northbridge_get_tseg_base()
+ + northbridge_get_tseg_size() - CONFIG_SMM_RESERVED_SIZE);
}

/* platform_enter_postcar() determines the stack to use after
diff --git a/src/northbridge/intel/i945/ram_calc.c b/src/northbridge/intel/i945/ram_calc.c
index dbe74c4..ac1499e 100644
--- a/src/northbridge/intel/i945/ram_calc.c
+++ b/src/northbridge/intel/i945/ram_calc.c
@@ -92,13 +92,12 @@

void stage_cache_external_region(void **base, size_t *size)
{
- /*
- * The ramstage cache lives in the TSEG region at RESERVED_SMM_OFFSET.
+ /* The stage cache lives at the end of the TSEG region.
* The top of RAM is defined to be the TSEG base address.
*/
*size = CONFIG_SMM_RESERVED_SIZE;
- *base = (void *)(northbridge_get_tseg_base()
- + CONFIG_SMM_RESERVED_SIZE);
+ *base = (void *)((uintptr_t)northbridge_get_tseg_base()
+ + northbridge_get_tseg_size() - CONFIG_SMM_RESERVED_SIZE);
}

/* platform_enter_postcar() determines the stack to use after
diff --git a/src/northbridge/intel/pineview/ram_calc.c b/src/northbridge/intel/pineview/ram_calc.c
index a3caaf7..2f3ff6e 100644
--- a/src/northbridge/intel/pineview/ram_calc.c
+++ b/src/northbridge/intel/pineview/ram_calc.c
@@ -142,13 +142,12 @@

void stage_cache_external_region(void **base, size_t *size)
{
- /*
- * The ramstage cache lives in the TSEG region at RESERVED_SMM_OFFSET.
+ /* The stage cache lives at the end of the TSEG region.
* The top of RAM is defined to be the TSEG base address.
*/
*size = CONFIG_SMM_RESERVED_SIZE;
- *base = (void *)(northbridge_get_tseg_base()
- + CONFIG_SMM_RESERVED_SIZE);
+ *base = (void *)((uintptr_t)northbridge_get_tseg_base()
+ + northbridge_get_tseg_size() - CONFIG_SMM_RESERVED_SIZE);
}

/* platform_enter_postcar() determines the stack to use after
diff --git a/src/northbridge/intel/x4x/ram_calc.c b/src/northbridge/intel/x4x/ram_calc.c
index 54295a9..dda8387 100644
--- a/src/northbridge/intel/x4x/ram_calc.c
+++ b/src/northbridge/intel/x4x/ram_calc.c
@@ -137,13 +137,12 @@

void stage_cache_external_region(void **base, size_t *size)
{
- /*
- * The ramstage cache lives in the TSEG region at RESERVED_SMM_OFFSET.
+ /* The stage cache lives at the end of the TSEG region.
* The top of RAM is defined to be the TSEG base address.
*/
*size = CONFIG_SMM_RESERVED_SIZE;
- *base = (void *)(northbridge_get_tseg_base()
- + CONFIG_SMM_RESERVED_SIZE);
+ *base = (void *)((uintptr_t)northbridge_get_tseg_base()
+ + northbridge_get_tseg_size() - CONFIG_SMM_RESERVED_SIZE);
}

/* platform_enter_postcar() determines the stack to use after

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

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I2d5df90b40ff7cd9fde3cbe3cc5090aac74825f7
Gerrit-Change-Number: 34671
Gerrit-PatchSet: 2
Gerrit-Owner: Kyösti Mälkki <kyosti.malkki@gmail.com>
Gerrit-Reviewer: Arthur Heymans <arthur@aheymans.xyz>
Gerrit-Reviewer: Damien Zammit
Gerrit-Reviewer: Kyösti Mälkki <kyosti.malkki@gmail.com>
Gerrit-Reviewer: Martin Roth <martinroth@google.com>
Gerrit-Reviewer: Patrick Rudolph <siro@das-labor.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-MessageType: merged