Alexandru Gagniuc (mr.nuke.me(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13319
-gerrit
commit 7553d4155ee5bf64fbc8b19b768fc183a8abf5a4
Author: Alexandru Gagniuc <alexandrux.gagniuc(a)intel.com>
Date: Tue Oct 27 10:27:30 2015 -0700
arch/x86: Add option to disable default mmap_boot implementation
On certain platforms, the boot media is either not memory-mapped, or
not mapped at the top of 4G. This makes the default mmap_boot
implementation uinsuitable. Add an option to allow such platforms to
define their own mapping implementation.
Change-Id: I8293126fd9cc1fd3d75072f7811e659765348e4a
Signed-off-by: Alexandru Gagniuc <alexandrux.gagniuc(a)intel.com>
---
src/arch/x86/Kconfig | 6 ++++++
src/arch/x86/Makefile.inc | 8 ++++----
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/arch/x86/Kconfig b/src/arch/x86/Kconfig
index 738e7d1..d3d33b4 100644
--- a/src/arch/x86/Kconfig
+++ b/src/arch/x86/Kconfig
@@ -77,6 +77,12 @@ config RAMBASE
hex
default 0x100000
+# This indicates the boot media is mapped at top of 4G. This variable is used
+# to decide whether to pull in the default mmap_boot.c implementation.
+config X86_TOP4G_BOOTMEDIA_MAP
+ bool
+ default y
+
# This is something you almost certainly don't want to mess with.
# How many SIPIs do we send when starting up APs and cores?
# The answer in 2000 or so was '2'. Nowadays, on many systems,
diff --git a/src/arch/x86/Makefile.inc b/src/arch/x86/Makefile.inc
index bd9e348..75f06df 100644
--- a/src/arch/x86/Makefile.inc
+++ b/src/arch/x86/Makefile.inc
@@ -107,7 +107,7 @@ CFLAGS_bootblock+=-Wa,--divide
bootblock-y += boot.c
bootblock-y += memcpy.c
bootblock-y += memset.c
-bootblock-y += mmap_boot.c
+bootblock-$(CONFIG_X86_TOP4G_BOOTMEDIA_MAP) += mmap_boot.c
bootblock-y += id.S
$(obj)/arch/x86/id.bootblock.o: $(obj)/build.h
@@ -356,7 +356,7 @@ romstage-$(CONFIG_ARCH_RAMSTAGE_X86_32) += cpu_common.c
romstage-y += memset.c
romstage-y += memcpy.c
romstage-y += memmove.c
-romstage-y += mmap_boot.c
+romstage-$(CONFIG_X86_TOP4G_BOOTMEDIA_MAP) += mmap_boot.c
romstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
@@ -386,7 +386,7 @@ ramstage-y += memset.c
ramstage-y += memcpy.c
ramstage-y += memmove.c
ramstage-y += ebda.c
-ramstage-y += mmap_boot.c
+ramstage-$(CONFIG_X86_TOP4G_BOOTMEDIA_MAP) += mmap_boot.c
ramstage-$(CONFIG_COOP_MULTITASKING) += thread.c
ramstage-$(CONFIG_COOP_MULTITASKING) += thread_switch.S
ramstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
@@ -394,7 +394,7 @@ ramstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
smm-y += memset.c
smm-y += memcpy.c
smm-y += memmove.c
-smm-y += mmap_boot.c
+smm-$(CONFIG_X86_TOP4G_BOOTMEDIA_MAP) += mmap_boot.c
ifeq ($(CONFIG_ARCH_RAMSTAGE_X86_32),y)
rmodules_x86_32-y += memset.c
Alexandru Gagniuc (mr.nuke.me(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13312
-gerrit
commit 4c3feb6b0c608d469ffffcb8bf48192b98969ac2
Author: Andrey Petrov <andrey.petrov(a)intel.com>
Date: Thu Oct 22 09:41:07 2015 -0700
soc/apollolake: clear whole contents of cache-as-ram
Some code makes assumption on memory to be cleared. In particular
we must clear area occupied by car.data. FSP seems to be also
making assumption stack memory is zeroed. This can be further
reworked to clear only areas that have to be cleared for the sake
of saving cycles.
Change-Id: I9d75cb0a15f2bebf47d53daf7e4d76865a4c166b
Signed-off-by: Andrey Petrov <andrey.petrov(a)intel.com>
---
src/soc/intel/apollolake/bootblock/cache_as_ram.S | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/src/soc/intel/apollolake/bootblock/cache_as_ram.S b/src/soc/intel/apollolake/bootblock/cache_as_ram.S
index e451f66..5bbf6cc 100644
--- a/src/soc/intel/apollolake/bootblock/cache_as_ram.S
+++ b/src/soc/intel/apollolake/bootblock/cache_as_ram.S
@@ -104,15 +104,11 @@ clear_var_mtrr:
post_code(0x26)
- /* Write something to each cache line */
- mov eax, 0xcafebabe
+ /* Clear the cache memory region. This will also fill up the cache */
mov edi, CONFIG_DCACHE_RAM_BASE
- mov ecx, (0x80000 >> 6)
-cache_init_loop:
- mov [edi], eax
- sfence
- add edi, 64
- loop cache_init_loop
+ mov ecx, CONFIG_DCACHE_RAM_SIZE >> 2
+ xor eax, eax
+ rep stos dword ptr es:[edi], eax
post_code(0x27)
Alexandru Gagniuc (mr.nuke.me(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13313
-gerrit
commit b6a687e76978ccf8e14088a56c21e82c5661a407
Author: Alexandru Gagniuc <alexandrux.gagniuc(a)intel.com>
Date: Thu Oct 22 09:21:34 2015 -0700
soc/apollolake/cache_as_ram: 'call' don't 'jmp' to bootblock_main
After working without a stack for so long, it's easy to overlook that
you have a stack, and that it works. The tendency to manually control
the stack still exists. Just call 'bootblock_car_main', and avoid
manually setting up a return pointer.
Change-Id: I257ba497dfa69902eff0686a5d2169db9b13434a
Signed-off-by: Alexandru Gagniuc <alexandrux.gagniuc(a)intel.com>
---
src/soc/intel/apollolake/bootblock/cache_as_ram.S | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/soc/intel/apollolake/bootblock/cache_as_ram.S b/src/soc/intel/apollolake/bootblock/cache_as_ram.S
index 5bbf6cc..6ecfa86 100644
--- a/src/soc/intel/apollolake/bootblock/cache_as_ram.S
+++ b/src/soc/intel/apollolake/bootblock/cache_as_ram.S
@@ -135,9 +135,8 @@ car_init_done:
before_carstage:
post_code(0x2b)
- /* Call romstage.c main function. */
- push .halt_forever /* In case bootblock_car_main returns */
- jmp bootblock_car_main
+ /* Call bootblock C environment main function. */
+ call bootblock_car_main
/* Never reached */