Angel Pons has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/45926 )
Change subject: arch/x86: Define `postcar_frame_add_cbmem_top`
......................................................................
arch/x86: Define `postcar_frame_add_cbmem_top`
This function is to be used to cache a region below cbmem_top().
Change-Id: I3eab4e55c3670094e32ba86550c3d602c0bbef07
Signed-off-by: Angel Pons <th3fanbus(a)gmail.com>
---
M src/arch/x86/include/arch/romstage.h
M src/arch/x86/postcar_loader.c
2 files changed, 11 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/26/45926/1
diff --git a/src/arch/x86/include/arch/romstage.h b/src/arch/x86/include/arch/romstage.h
index 28d29bf..cb4aa73 100644
--- a/src/arch/x86/include/arch/romstage.h
+++ b/src/arch/x86/include/arch/romstage.h
@@ -33,6 +33,10 @@
*/
void postcar_frame_add_mtrr(struct postcar_frame *pcf,
uintptr_t addr, size_t size, int type);
+/*
+ * Add variable MTRR covering the given down-aligned size below cbmem_top().
+ */
+void postcar_frame_add_cbmem_top(struct postcar_frame *pcf, size_t size, uintptr_t alignment);
/*
* Add variable MTRR covering the memory-mapped ROM with given MTRR type.
diff --git a/src/arch/x86/postcar_loader.c b/src/arch/x86/postcar_loader.c
index 241ba8c..366f378 100644
--- a/src/arch/x86/postcar_loader.c
+++ b/src/arch/x86/postcar_loader.c
@@ -153,6 +153,13 @@
stage_cache_add(STAGE_POSTCAR, prog);
}
+void postcar_frame_add_cbmem_top(struct postcar_frame *pcf, size_t size, uintptr_t alignment)
+{
+ uintptr_t top_of_ram = ALIGN_DOWN((uintptr_t)cbmem_top(), alignment);
+
+ postcar_frame_add_mtrr(pcf, top_of_ram - size, size, MTRR_TYPE_WRBACK);
+}
+
/*
* Cache the TSEG region at the top of ram. This region is
* not restricted to SMM mode until SMM has been relocated.
--
To view, visit https://review.coreboot.org/c/coreboot/+/45926
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I3eab4e55c3670094e32ba86550c3d602c0bbef07
Gerrit-Change-Number: 45926
Gerrit-PatchSet: 1
Gerrit-Owner: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-MessageType: newchange
Angel Pons has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/45924 )
Change subject: nb/intel/sandybridge: Use `postcar_enable_tseg_cache`
......................................................................
nb/intel/sandybridge: Use `postcar_enable_tseg_cache`
This may not be necessary at all if all CPUs using this code support
SMRRs. Update the corresponding code to reflect that with a TODO.
Change-Id: Ibf5a851a6684c9aa96d1c30a8f8dc068d00f3b81
Signed-off-by: Angel Pons <th3fanbus(a)gmail.com>
---
M src/northbridge/intel/sandybridge/memmap.c
1 file changed, 4 insertions(+), 6 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/24/45924/1
diff --git a/src/northbridge/intel/sandybridge/memmap.c b/src/northbridge/intel/sandybridge/memmap.c
index 7f46d66..38fa6e9 100644
--- a/src/northbridge/intel/sandybridge/memmap.c
+++ b/src/northbridge/intel/sandybridge/memmap.c
@@ -51,11 +51,9 @@
postcar_frame_add_mtrr(pcf, top_of_ram - 8 * MiB, 8 * MiB, MTRR_TYPE_WRBACK);
/*
- * Cache 8MiB at the top of ram. Top of RAM on sandybridge systems
- * is where the TSEG region resides. However, it is not restricted
- * to SMM mode until SMM has been relocated. By setting the region
- * to cacheable it provides faster access when relocating the SMM
- * handler as well as using the TSEG region for other purposes.
+ * Cache the TSEG region using regular MTRRs. This is only useful
+ * when SMRRs are not supported, however. TODO(hell__): Determine
+ * if all SNB/IVB CPUs support SMRRs, and if so remove this call.
*/
- postcar_frame_add_mtrr(pcf, top_of_ram, 8 * MiB, MTRR_TYPE_WRBACK);
+ postcar_enable_tseg_cache(pcf);
}
--
To view, visit https://review.coreboot.org/c/coreboot/+/45924
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: Ibf5a851a6684c9aa96d1c30a8f8dc068d00f3b81
Gerrit-Change-Number: 45924
Gerrit-PatchSet: 1
Gerrit-Owner: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Patrick Rudolph <siro(a)das-labor.org>
Gerrit-MessageType: newchange
Angel Pons has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/45921 )
Change subject: nb/intel/ironlake/memmap.c: Use `postcar_enable_tseg_cache`
......................................................................
nb/intel/ironlake/memmap.c: Use `postcar_enable_tseg_cache`
With SMM_TSEG_SIZE being fixed at 8 MiB, the code caches 8 MiB below
TSEG and the TSEG region itself. Make the latter more obvious.
Change-Id: I7ac7db0237f4b948eba06f728a16e3760708c016
Signed-off-by: Angel Pons <th3fanbus(a)gmail.com>
---
M src/northbridge/intel/ironlake/memmap.c
1 file changed, 4 insertions(+), 5 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/21/45921/1
diff --git a/src/northbridge/intel/ironlake/memmap.c b/src/northbridge/intel/ironlake/memmap.c
index 221ae92..4ec8e3a 100644
--- a/src/northbridge/intel/ironlake/memmap.c
+++ b/src/northbridge/intel/ironlake/memmap.c
@@ -37,11 +37,10 @@
{
uintptr_t top_of_ram;
- /* Cache at least 8 MiB below the top of ram, and at most 8 MiB
- * above top of the ram. This satisfies MTRR alignment requirement
- * with different TSEG size configurations.
- */
+ /* Cache 8 MiB below the top of RAM */
top_of_ram = ALIGN_DOWN((uintptr_t)cbmem_top(), 8*MiB);
postcar_frame_add_mtrr(pcf, top_of_ram - 8*MiB, 8*MiB, MTRR_TYPE_WRBACK);
- postcar_frame_add_mtrr(pcf, top_of_ram, 8*MiB, MTRR_TYPE_WRBACK);
+
+ /* Cache TSEG region */
+ postcar_enable_tseg_cache(pcf);
}
--
To view, visit https://review.coreboot.org/c/coreboot/+/45921
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I7ac7db0237f4b948eba06f728a16e3760708c016
Gerrit-Change-Number: 45921
Gerrit-PatchSet: 1
Gerrit-Owner: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Patrick Rudolph <siro(a)das-labor.org>
Gerrit-MessageType: newchange