Alexandru Gagniuc (mr.nuke.me(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/11785
-gerrit
commit 4c39e7920dc64d5735d8a9ec522629e7b773ced1
Author: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
Date: Fri Oct 2 16:17:41 2015 -0700
arch/x86: Link walkcbfs.S instead on including it in bootblock.S
The code flow doesn't fall through to walkcbfs, as it does in the rest
of bootblock.S. Instead, walkcbfs is called (albeit via a jmp). The
linker cannot know this when walkcbfs.S is included directly.
When we use a CAR bootblock, we lose several hundred bytes because
walkcbfs is not garbage-collected, yet it isn't used. This problem
is solved by assembling walkcbfs.S separately, and linking it.
Change-Id: Ib3a976db09b9ff270b7677cb4f9db80b0b025e22
Signed-off-by: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
---
src/arch/x86/Makefile.inc | 1 +
src/arch/x86/bootblock.S | 2 --
src/arch/x86/walkcbfs.S | 2 ++
3 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/arch/x86/Makefile.inc b/src/arch/x86/Makefile.inc
index 7c07de2..95ebb6a 100644
--- a/src/arch/x86/Makefile.inc
+++ b/src/arch/x86/Makefile.inc
@@ -85,6 +85,7 @@ endif
# the right order. Make sure the auto generated bootblock.inc is a proper
# dependency. Make the same true for the linker sript.
bootblock-y += bootblock.S
+bootblock-y += walkcbfs.S
$(obj)/arch/x86/bootblock.bootblock.o: $(objgenerated)/bootblock.inc
bootblock-y += bootblock.ld
diff --git a/src/arch/x86/bootblock.S b/src/arch/x86/bootblock.S
index 7276c7a..bea178d 100644
--- a/src/arch/x86/bootblock.S
+++ b/src/arch/x86/bootblock.S
@@ -47,5 +47,3 @@
* needs to come after bootblock.inc.
*/
#include <generated/bootblock.inc>
-
-#include <arch/x86/walkcbfs.S>
diff --git a/src/arch/x86/walkcbfs.S b/src/arch/x86/walkcbfs.S
index 9c26d3c..0b91f57 100644
--- a/src/arch/x86/walkcbfs.S
+++ b/src/arch/x86/walkcbfs.S
@@ -18,6 +18,8 @@
#define CBFS_FILE_STRUCTSIZE (CBFS_FILE_OFFSET + 4)
+.global walkcbfs_asm
+
/*
* input %esi: filename
* input %esp: return address (not pointer to return address!)
Alexandru Gagniuc (mr.nuke.me(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/11786
-gerrit
commit b281d4ff65be44c7dfcd5f433679158a5a65f0c1
Author: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
Date: Fri Oct 2 17:01:22 2015 -0700
drivers/uart/Kconfig: Select 8250 mem when 8250 mem32 is enabled
Users of DRIVERS_UART_8250MEM_32 would have to also select
DRIVERS_UART_8250MEM to avoid missing Kconfig dependencies. Instead,
do what the OXPCIE driver dies and select the appropriate options.
Change-Id: I40d93df024fcb3a9ad6dc51d6a5966e7b1b6c07f
Signed-off-by: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
---
src/drivers/uart/Kconfig | 2 +-
src/soc/intel/skylake/Kconfig | 1 -
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/drivers/uart/Kconfig b/src/drivers/uart/Kconfig
index cbfd479..f4ad011 100644
--- a/src/drivers/uart/Kconfig
+++ b/src/drivers/uart/Kconfig
@@ -20,7 +20,7 @@ config DRIVERS_UART_8250MEM
config DRIVERS_UART_8250MEM_32
bool
default n
- depends on DRIVERS_UART_8250MEM
+ select DRIVERS_UART_8250MEM
config HAVE_UART_SPECIAL
bool
diff --git a/src/soc/intel/skylake/Kconfig b/src/soc/intel/skylake/Kconfig
index ae50bd2..bf747d4 100644
--- a/src/soc/intel/skylake/Kconfig
+++ b/src/soc/intel/skylake/Kconfig
@@ -141,7 +141,6 @@ config UART_DEBUG
default n
select CONSOLE_SERIAL
select DRIVERS_UART
- select DRIVERS_UART_8250MEM
select DRIVERS_UART_8250MEM_32
config CHIPSET_BOOTBLOCK_INCLUDE
Alexandru Gagniuc (mr.nuke.me(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/11786
-gerrit
commit 5cd46855f59ce125b6efa2f1c36c5a232ced9713
Author: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
Date: Fri Oct 2 17:01:22 2015 -0700
drivers/uart/Kconfig: Select 8250 mem when 8250 mem32 is enabled
Users of DRIVERS_UART_8250MEM_32 would have to also select
DRIVERS_UART_8250MEM to avoid missing Kconfig dependencies. Instead,
do what the OXPCIE driver dies and select the appropriate options.
Change-Id: I40d93df024fcb3a9ad6dc51d6a5966e7b1b6c07f
Signed-off-by: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
---
src/drivers/uart/Kconfig | 2 +-
src/soc/intel/skylake/Kconfig | 1 -
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/drivers/uart/Kconfig b/src/drivers/uart/Kconfig
index cbfd479..f4ad011 100644
--- a/src/drivers/uart/Kconfig
+++ b/src/drivers/uart/Kconfig
@@ -20,7 +20,7 @@ config DRIVERS_UART_8250MEM
config DRIVERS_UART_8250MEM_32
bool
default n
- depends on DRIVERS_UART_8250MEM
+ select DRIVERS_UART_8250MEM
config HAVE_UART_SPECIAL
bool
diff --git a/src/soc/intel/skylake/Kconfig b/src/soc/intel/skylake/Kconfig
index ae50bd2..bf747d4 100644
--- a/src/soc/intel/skylake/Kconfig
+++ b/src/soc/intel/skylake/Kconfig
@@ -141,7 +141,6 @@ config UART_DEBUG
default n
select CONSOLE_SERIAL
select DRIVERS_UART
- select DRIVERS_UART_8250MEM
select DRIVERS_UART_8250MEM_32
config CHIPSET_BOOTBLOCK_INCLUDE
Alexandru Gagniuc (mr.nuke.me(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/11785
-gerrit
commit c87afa912fce29c57659528e7de1c5a75d974023
Author: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
Date: Fri Oct 2 16:17:41 2015 -0700
arch/x86: Link walkcbfs.S instead on including it in bootblock.S
The code flow doesn't fall through to walkcbfs, as it does in the rest
of bootblock.S. Instead, walkcbfs is called (albeit via a jmp). The
linker cannot know this when walkcbfs.S is included directly.
When we use a CAR bootblock, we lose several hundred bytes because
walkcbfs is not garbage-collected, yet it isn't used. This problem
is solved by assembling walkcbfs.S separately, and linking it.
Change-Id: Ib3a976db09b9ff270b7677cb4f9db80b0b025e22
Signed-off-by: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
---
src/arch/x86/Makefile.inc | 1 +
src/arch/x86/bootblock.S | 2 --
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/arch/x86/Makefile.inc b/src/arch/x86/Makefile.inc
index 7c07de2..95ebb6a 100644
--- a/src/arch/x86/Makefile.inc
+++ b/src/arch/x86/Makefile.inc
@@ -85,6 +85,7 @@ endif
# the right order. Make sure the auto generated bootblock.inc is a proper
# dependency. Make the same true for the linker sript.
bootblock-y += bootblock.S
+bootblock-y += walkcbfs.S
$(obj)/arch/x86/bootblock.bootblock.o: $(objgenerated)/bootblock.inc
bootblock-y += bootblock.ld
diff --git a/src/arch/x86/bootblock.S b/src/arch/x86/bootblock.S
index 7276c7a..bea178d 100644
--- a/src/arch/x86/bootblock.S
+++ b/src/arch/x86/bootblock.S
@@ -47,5 +47,3 @@
* needs to come after bootblock.inc.
*/
#include <generated/bootblock.inc>
-
-#include <arch/x86/walkcbfs.S>
Alexandru Gagniuc (mr.nuke.me(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/11784
-gerrit
commit 85968b8b2f62746a2dabb5639991f71bbba3d12c
Author: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
Date: Fri Oct 2 12:42:26 2015 -0700
arch/x86: Allow boot flow which runs CAR setup in bootblock
On systems with non-memory-mapped boot media we simply do not have
enough space for romstage. This means that CAR setup and early boot
media (e.g. SPI) drivers need to be implemented with minimal overhead.
The bootblock is the best place to do this.
Note that this patch does introduce a somewhat awkward boot flow:
reset(gas) -> bootblock main (romcc) -> car setup (gas) -> car (gcc)
However, we've chosen this path as it is least intrusive on the
existing infrastructure. In the future, we will investigate the
possiblity of eliminating the romcc step.
Change-Id: Icbf5804b66b9517f9ceb352bed86978dcf92228f
Signed-off-by: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
---
src/arch/x86/Kconfig | 6 ++++++
src/arch/x86/bootblock_simple.c | 27 ++++++++++++++++++++++-----
2 files changed, 28 insertions(+), 5 deletions(-)
diff --git a/src/arch/x86/Kconfig b/src/arch/x86/Kconfig
index 88b2592..59eeb87 100644
--- a/src/arch/x86/Kconfig
+++ b/src/arch/x86/Kconfig
@@ -56,6 +56,12 @@ config ARCH_RAMSTAGE_X86_64
bool
default n
+# This is a new bootflow, in which CAR setup is performed in the bootblock, then
+# calls into C code (in the bootblock)
+config CAR_BOOTBLOCK
+ bool
+ default n
+
# This is an SMP option. It relates to starting up APs.
# It is usually set in mainboard/*/Kconfig.
# TODO: Improve description.
diff --git a/src/arch/x86/bootblock_simple.c b/src/arch/x86/bootblock_simple.c
index adeecf7..1c8eb02 100644
--- a/src/arch/x86/bootblock_simple.c
+++ b/src/arch/x86/bootblock_simple.c
@@ -2,6 +2,24 @@
#include <bootblock_common.h>
#include <halt.h>
+static void advance_to_romstage(unsigned long bist)
+{
+ const char* target1 = "fallback/romstage";
+ unsigned long entry;
+ entry = findstage(target1);
+ if (entry) call(entry, bist);
+ halt();
+
+}
+
+static void advance_to_car_setup(unsigned long bist)
+{
+ __asm__ volatile(
+ "jmp bootblock_pre_car_entry"
+ :: "a" (bist)
+ );
+}
+
static void main(unsigned long bist)
{
if (boot_cpu()) {
@@ -15,9 +33,8 @@ static void main(unsigned long bist)
#endif
}
- const char* target1 = "fallback/romstage";
- unsigned long entry;
- entry = findstage(target1);
- if (entry) call(entry, bist);
- halt();
+ if (IS_ENABLED(CONFIG_CAR_BOOTBLOCK))
+ advance_to_car_setup(bist);
+ else
+ advance_to_romstage(bist);
}
Alexandru Gagniuc (mr.nuke.me(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/11783
-gerrit
commit 02a8d1af7a8c02fd4d5a19743900e26a1e2bc30b
Author: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
Date: Fri Oct 2 12:17:56 2015 -0700
arch/x86/bootblock: Link in object files selected with bootblock-y
As part of preparing for systems with non-memory-mapped media, we want
to be able to call into C code. This change allows us to link C code
directly into the bootblock. The steps of going from bootblock main()
to CAR setup to C code will be implemented in subsequent patches.
Note that a few files selected with bootblock-y will now be compiled
for the bootblock as well, but since we enabled garbage collection,
they will not be included in the final binary.
Change-Id: I5ca6dcaf176f5469c6a3bb925859399123493bc6
Signed-off-by: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
---
src/arch/x86/Makefile.inc | 7 +++++--
src/arch/x86/failover.ld | 3 +++
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/arch/x86/Makefile.inc b/src/arch/x86/Makefile.inc
index fba07c7..7c07de2 100644
--- a/src/arch/x86/Makefile.inc
+++ b/src/arch/x86/Makefile.inc
@@ -110,10 +110,13 @@ $(objgenerated)/bootblock.inc: $(src)/arch/x86/$(subst ",,$(CONFIG_BOOTBLOCK_SOU
$< > $(objgenerated)/bootblock.inc.d
$(ROMCC) -c -S $(bootblock_romccflags) -I. $(CPPFLAGS_bootblock) $< -o $@
-$(objcbfs)/bootblock.debug: $(obj)/arch/x86/bootblock.bootblock.o $(obj)/arch/x86/bootblock.bootblock.ld
+# $(obj)/arch/x86/bootblock.bootblock.ld is part of $(bootblock-objs)
+$(objcbfs)/bootblock.debug: $$(bootblock-objs)
@printf " LINK $(subst $(obj)/,,$(@))\n"
$(LD_bootblock) $(LDFLAGS_common) $(LDFLAGS_x86) -static \
- -o $@ -L$(obj) $< -T $(obj)/arch/x86/bootblock.bootblock.ld
+ -o $@ -L$(obj) \
+ $(filter %.o,$(bootblock-objs)) \
+ -T $(obj)/arch/x86/bootblock.bootblock.ld \
endif # CONFIG_ARCH_BOOTBLOCK_X86_32 / CONFIG_ARCH_BOOTBLOCK_X86_64
diff --git a/src/arch/x86/failover.ld b/src/arch/x86/failover.ld
index d7aa47e..89d5449 100644
--- a/src/arch/x86/failover.ld
+++ b/src/arch/x86/failover.ld
@@ -41,6 +41,8 @@ SECTIONS
*(.rom.text);
*(.rom.data);
*(.rom.data.*);
+ *(.text);
+ *(.text.*);
*(.rodata.*);
_erom = .;
} >rom = 0xff
@@ -63,6 +65,7 @@ SECTIONS
*(.note)
*(.comment.*)
*(.note.*)
+ *(.eh_frame)
*(.iplt)
*(.rel.*)
*(.igot.*)
Alexandru Gagniuc (mr.nuke.me(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/11782
-gerrit
commit 4dcfef350b7cd4d89da4b9e38fd176570170eb09
Author: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
Date: Fri Oct 2 12:24:00 2015 -0700
arch/x86/Makefile.inc: Simplify rule for bootblock.debug
The only difference between the ifeq/else/endif guarded rules is the
linker flags specific to x86. Set those flags elsewhere, in a
variable, and only use one rule for bootblock.debug.
Change-Id: I986a93e0418f05fb273512d7efe0573052493332
Signed-off-by: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
---
src/arch/x86/Makefile.inc | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/arch/x86/Makefile.inc b/src/arch/x86/Makefile.inc
index 1bda5f6..fba07c7 100644
--- a/src/arch/x86/Makefile.inc
+++ b/src/arch/x86/Makefile.inc
@@ -74,6 +74,13 @@ CBFS_BASE_ADDRESS=$(call int-add, $(call int-subtract, 0xffffffff $(CONFIG_CBFS_
ifeq ($(CONFIG_ARCH_BOOTBLOCK_X86_32)$(CONFIG_ARCH_BOOTBLOCK_X86_64),y)
+# x86-specific linker flags
+ifeq ($(CONFIG_ARCH_BOOTBLOCK_X86_32),y)
+LDFLAGS_x86 := -m elf_i386 --oformat elf32-i386
+else
+LDFLAGS_x86 := -m elf_x86_64 --oformat elf64-x86-64
+endif
+
# Add the assembly file that pulls in the rest of the dependencies in
# the right order. Make sure the auto generated bootblock.inc is a proper
# dependency. Make the same true for the linker sript.
@@ -105,11 +112,8 @@ $(objgenerated)/bootblock.inc: $(src)/arch/x86/$(subst ",,$(CONFIG_BOOTBLOCK_SOU
$(objcbfs)/bootblock.debug: $(obj)/arch/x86/bootblock.bootblock.o $(obj)/arch/x86/bootblock.bootblock.ld
@printf " LINK $(subst $(obj)/,,$(@))\n"
-ifeq ($(CONFIG_ARCH_BOOTBLOCK_X86_32),y)
- $(LD_bootblock) $(LDFLAGS_common) -m elf_i386 --oformat elf32-i386 -static -o $@ -L$(obj) $< -T $(obj)/arch/x86/bootblock.bootblock.ld
-else
- $(LD_bootblock) $(LDFLAGS_common) -m elf_x86_64 --oformat elf64-x86-64 -static -o $@ -L$(obj) $< -T $(obj)/arch/x86/bootblock.bootblock.ld
-endif
+ $(LD_bootblock) $(LDFLAGS_common) $(LDFLAGS_x86) -static \
+ -o $@ -L$(obj) $< -T $(obj)/arch/x86/bootblock.bootblock.ld
endif # CONFIG_ARCH_BOOTBLOCK_X86_32 / CONFIG_ARCH_BOOTBLOCK_X86_64
Alexandru Gagniuc (mr.nuke.me(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/11781
-gerrit
commit 66c50e7720d20c2964a4cfefa254148d7b22449f
Author: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
Date: Fri Oct 2 10:59:13 2015 -0700
x86/bootblock: Use LDFLAGS_bootblock to enable garbage collection
The x86 bootblock linking is a mess. The bootblock is treated in
a very special manner, and never received the update to link-time
garbage collection.
On newer x86 platforms, the boot media is no longer memory-mapped.
That means we need to do a lot more setup in the bootblock. ROMCC is
unsuitable for this task, and walkcbfs only works on memory-mapped
CBFS. We need to revise the x86 bootflow for this new case.
The approach this patch series takes is to perform CAR setup in the
bootblock, and load the following stage (either romstage or verstage)
from the boot media. This approach is not new, but has been done on
our ARM ports for years.
Since we will be adding .c files to the bootblock, it is prudent to
use link-time garbage collection. This is also consistent to how we
do things on other architectures. Unification FTW!
Change-Id: I16b78456df56e0053984a9aca9367e2542adfdc9
Signed-off-by: Alexandru Gagniuc <mr.nuke.me(a)gmail.com>
---
src/arch/x86/Makefile.inc | 4 ++--
src/arch/x86/id.ld | 2 +-
src/cpu/intel/fit/fit.ld | 2 +-
src/cpu/x86/16bit/reset16.ld | 2 +-
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/arch/x86/Makefile.inc b/src/arch/x86/Makefile.inc
index f16edcd..1bda5f6 100644
--- a/src/arch/x86/Makefile.inc
+++ b/src/arch/x86/Makefile.inc
@@ -106,9 +106,9 @@ $(objgenerated)/bootblock.inc: $(src)/arch/x86/$(subst ",,$(CONFIG_BOOTBLOCK_SOU
$(objcbfs)/bootblock.debug: $(obj)/arch/x86/bootblock.bootblock.o $(obj)/arch/x86/bootblock.bootblock.ld
@printf " LINK $(subst $(obj)/,,$(@))\n"
ifeq ($(CONFIG_ARCH_BOOTBLOCK_X86_32),y)
- $(LD_bootblock) -m elf_i386 --oformat elf32-i386 -static -o $@ -L$(obj) $< -T $(obj)/arch/x86/bootblock.bootblock.ld
+ $(LD_bootblock) $(LDFLAGS_common) -m elf_i386 --oformat elf32-i386 -static -o $@ -L$(obj) $< -T $(obj)/arch/x86/bootblock.bootblock.ld
else
- $(LD_bootblock) -m elf_x86_64 --oformat elf64-x86-64 -static -o $@ -L$(obj) $< -T $(obj)/arch/x86/bootblock.bootblock.ld
+ $(LD_bootblock) $(LDFLAGS_common) -m elf_x86_64 --oformat elf64-x86-64 -static -o $@ -L$(obj) $< -T $(obj)/arch/x86/bootblock.bootblock.ld
endif
diff --git a/src/arch/x86/id.ld b/src/arch/x86/id.ld
index cfd091d..99d13f1 100644
--- a/src/arch/x86/id.ld
+++ b/src/arch/x86/id.ld
@@ -1,6 +1,6 @@
SECTIONS {
. = (0xffffffff - CONFIG_ID_SECTION_OFFSET) - (__id_end - __id_start) + 1;
.id (.): {
- *(.id)
+ KEEP(*(.id))
}
}
diff --git a/src/cpu/intel/fit/fit.ld b/src/cpu/intel/fit/fit.ld
index 9ccfe82..5817e1d 100644
--- a/src/cpu/intel/fit/fit.ld
+++ b/src/cpu/intel/fit/fit.ld
@@ -1,6 +1,6 @@
SECTIONS {
. = 0xffffffc0;
.fit_pointer (.): {
- *(.fit_pointer)
+ KEEP(*(.fit_pointer))
}
}
diff --git a/src/cpu/x86/16bit/reset16.ld b/src/cpu/x86/16bit/reset16.ld
index a31a580..d0c4096 100644
--- a/src/cpu/x86/16bit/reset16.ld
+++ b/src/cpu/x86/16bit/reset16.ld
@@ -9,7 +9,7 @@ SECTIONS {
_ROMTOP = 0xfffffff0;
. = _ROMTOP;
.reset . : {
- *(.reset)
+ KEEP(*(.reset));
. = 15 ;
BYTE(0x00);
}