[coreboot-gerrit] Patch set updated for coreboot: soc/intel/apollolake: enable RAM cache for cbmem region in ramstage

Andrey Petrov (andrey.petrov@intel.com) gerrit at coreboot.org
Sat Apr 23 23:56:07 CEST 2016


Andrey Petrov (andrey.petrov at intel.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14095

-gerrit

commit cff753c04adfaa0cff3a142faf7ff53cc517ee32
Author: Andrey Petrov <andrey.petrov at intel.com>
Date:   Sat Apr 23 13:15:51 2016 -0700

    soc/intel/apollolake: enable RAM cache for cbmem region in ramstage
    
    Use postcar infrastructure to enable caching of area where ramstage
    runs.
    
    Change-Id: I3f2f6e82f3b9060c7350ddff754cd3dbcf457671
    Signed-off-by: Andrey Petrov <andrey.petrov at intel.com>
---
 src/soc/intel/apollolake/romstage.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/soc/intel/apollolake/romstage.c b/src/soc/intel/apollolake/romstage.c
index 1c016a0..26a5beb 100644
--- a/src/soc/intel/apollolake/romstage.c
+++ b/src/soc/intel/apollolake/romstage.c
@@ -16,12 +16,14 @@
  * GNU General Public License for more details.
  */
 
+#include <assert.h>
 #include <arch/cpu.h>
 #include <arch/io.h>
 #include <arch/symbols.h>
 #include <cbfs.h>
 #include <cbmem.h>
 #include <console/console.h>
+#include <cpu/x86/mtrr.h>
 #include <device/pci_def.h>
 #include <device/device.h>
 #include <fsp/api.h>
@@ -109,6 +111,7 @@ asmlinkage void car_stage_entry(void)
 	struct range_entry fsp_mem, reg_car;
 	struct postcar_frame pcf;
 	size_t  mrc_data_size;
+	uintptr_t top_of_ram;
 
 	printk(BIOS_DEBUG, "Starting romstage...\n");
 
@@ -150,6 +153,16 @@ asmlinkage void car_stage_entry(void)
 	if (postcar_frame_init(&pcf, 1*KiB))
 		die("Unable to initialize postcar frame.\n");
 
+	/*
+	 * We need to make sure ramstage will be run cached. At this point exact
+	 * location of ramstage in cbmem is not known. Instruct postcar to cache
+	 * 16 megs under cbmem top which is a safe bet to cover ramstage.
+	 */
+	top_of_ram = (uintptr_t) cbmem_top();
+	/* cbmem_top() needs to be at least 16 MiB aligned */
+	assert(ALIGN_DOWN(top_of_ram, 16*MiB) == top_of_ram);
+	postcar_frame_add_mtrr(&pcf, top_of_ram - 16*MiB, 16*MiB, MTRR_TYPE_WRBACK);
+
 	run_postcar_phase(&pcf);
 }
 



More information about the coreboot-gerrit mailing list