summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/arch/x86/include/arch/romstage.h9
-rw-r--r--src/arch/x86/postcar_loader.c18
2 files changed, 27 insertions, 0 deletions
diff --git a/src/arch/x86/include/arch/romstage.h b/src/arch/x86/include/arch/romstage.h
index 2ac225875f..15c93f24bd 100644
--- a/src/arch/x86/include/arch/romstage.h
+++ b/src/arch/x86/include/arch/romstage.h
@@ -88,4 +88,13 @@ void run_postcar_phase(struct postcar_frame *pcf);
*/
void late_car_teardown(void);
+/*
+ * Cache the TSEG region at the top of ram. This region 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.
+ */
+void postcar_enable_tseg_cache(struct postcar_frame *pcf);
+
#endif /* __ARCH_ROMSTAGE_H__ */
diff --git a/src/arch/x86/postcar_loader.c b/src/arch/x86/postcar_loader.c
index 10a9ca2ace..c6149ab26a 100644
--- a/src/arch/x86/postcar_loader.c
+++ b/src/arch/x86/postcar_loader.c
@@ -17,6 +17,7 @@
#include <cpu/cpu.h>
#include <cpu/x86/msr.h>
#include <cpu/x86/mtrr.h>
+#include <cpu/x86/smm.h>
#include <program_loading.h>
#include <rmodule.h>
#include <romstage_handoff.h>
@@ -187,6 +188,23 @@ static void load_postcar_cbfs(struct prog *prog, struct postcar_frame *pcf)
stage_cache_add(STAGE_POSTCAR, prog);
}
+/*
+ * Cache the TSEG region at the top of ram. This region 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.
+ */
+void postcar_enable_tseg_cache(struct postcar_frame *pcf)
+{
+ uintptr_t smm_base;
+ size_t smm_size;
+
+ smm_region(&smm_base, &smm_size);
+ postcar_frame_add_mtrr(pcf, smm_base, smm_size,
+ MTRR_TYPE_WRBACK);
+}
+
void run_postcar_phase(struct postcar_frame *pcf)
{
struct prog prog =