Stefan Reinauer (stefan.reinauer(a)coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/10829
-gerrit
commit 8b210e9bc3020d8357974ddeeb1cee162613050e
Author: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Date: Tue Jun 30 17:09:17 2015 -0700
payloads: Reorganize Makefile.incs for external payloads
This is not going as far as I would like it to go, but
some of the external payloads have to be fixed up first.
Long term, I would like to directly add payloads/external/*
to subdirs-y and remove one layer of indirection from the
build process.
For now, moving the payload Makefile targets into payloads/
is already a small improvement.
Change-Id: Ie4eb492eb804e0aaaf1a4d90af2f876f27a32a75
Signed-off-by: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
---
Makefile.inc | 1 +
payloads/external/Makefile.inc | 52 ++++++++++++++++++++++++++++++++++++++++++
src/arch/x86/Makefile.inc | 32 --------------------------
3 files changed, 53 insertions(+), 32 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc
index 2f1fe82..2963ebe 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -59,6 +59,7 @@ subdirs-y += src/superio $(wildcard src/drivers/*) src/cpu src/vendorcode
subdirs-y += util/cbfstool util/sconfig util/nvramtool util/broadcom
subdirs-y += $(wildcard src/arch/*)
subdirs-y += src/mainboard/$(MAINBOARDDIR)
+subdirs-y += payloads/external
subdirs-y += site-local
diff --git a/payloads/external/Makefile.inc b/payloads/external/Makefile.inc
new file mode 100644
index 0000000..33ed47f
--- /dev/null
+++ b/payloads/external/Makefile.inc
@@ -0,0 +1,52 @@
+################################################################################
+##
+## This file is part of the coreboot project.
+##
+## Copyright (C) 2009-2010 coresystems GmbH
+## Copyright (C) 2015 Google Inc.
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; version 2 of the License.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc.
+##
+
+seabios:
+ $(MAKE) -C payloads/external/SeaBIOS -f Makefile.inc \
+ HOSTCC="$(HOSTCC)" \
+ CC=$(word 1,$(CC_x86_32)) CFLAGS="$(patsubst $(word 1,$(CC_x86_32))%,,$(CC_x86_32))" \
+ LD=$(word 1,$(LD_x86_32)) LDFLAGS="$(patsubst $(word 1,$(LD_x86_32))%,,$(LD_x86_32))" \
+ OBJDUMP="$(OBJDUMP_x86_32)" \
+ OBJCOPY="$(OBJCOPY_x86_32)" STRIP="$(STRIP_x86_32)" \
+ AS="$(AS_x86_32)" IASL="$(IASL)" \
+ CONFIG_SEABIOS_MASTER=$(CONFIG_SEABIOS_MASTER) \
+ CONFIG_SEABIOS_STABLE=$(CONFIG_SEABIOS_STABLE) \
+ CONFIG_SEABIOS_THREAD_OPTIONROMS=$(CONFIG_SEABIOS_THREAD_OPTIONROMS) \
+ CONFIG_SEABIOS_VGA_COREBOOT=$(CONFIG_SEABIOS_VGA_COREBOOT) \
+ CONFIG_CONSOLE_SERIAL=$(CONFIG_CONSOLE_SERIAL) \
+ CONFIG_TTYS0_BASE=$(CONFIG_TTYS0_BASE) \
+ CONFIG_SEABIOS_MALLOC_UPPERMEMORY=$(CONFIG_SEABIOS_MALLOC_UPPERMEMORY)
+
+filo:
+ $(MAKE) -C payloads/external/FILO -f Makefile.inc \
+ HOSTCC="$(HOSTCC)" \
+ CC="$(CC_x86_32)" LD="$(LD_x86_32)" OBJDUMP="$(OBJDUMP_x86_32)" \
+ OBJCOPY="$(OBJCOPY_x86_32)" STRIP="$(STRIP_x86_32)" \
+ CONFIG_FILO_MASTER=$(CONFIG_FILO_MASTER) \
+ CONFIG_FILO_STABLE=$(CONFIG_FILO_STABLE)
+
+
+grub2:
+ $(MAKE) -C payloads/external/GRUB2 -f Makefile.inc \
+ HOSTCC="$(HOSTCC)" \
+ CC="$(CC_x86_32)" LD="$(LD_x86_32)" OBJDUMP="$(OBJDUMP_x86_32)" \
+ OBJCOPY="$(OBJCOPY_x86_32)" STRIP="$(STRIP_x86_32)" \
+ CONFIG_GRUB2_MASTER=$(CONFIG_GRUB2_MASTER)
diff --git a/src/arch/x86/Makefile.inc b/src/arch/x86/Makefile.inc
index f502bbe..4549c82 100644
--- a/src/arch/x86/Makefile.inc
+++ b/src/arch/x86/Makefile.inc
@@ -334,36 +334,4 @@ endif
endif # CONFIG_ARCH_RAMSTAGE_X86_32 / CONFIG_ARCH_RAMSTAGE_X86_64
-################################################################################
-seabios:
- $(MAKE) -C payloads/external/SeaBIOS -f Makefile.inc \
- HOSTCC="$(HOSTCC)" \
- CC=$(word 1,$(CC_x86_32)) CFLAGS="$(patsubst $(word 1,$(CC_x86_32))%,,$(CC_x86_32))" \
- LD=$(word 1,$(LD_x86_32)) LDFLAGS="$(patsubst $(word 1,$(LD_x86_32))%,,$(LD_x86_32))" \
- OBJDUMP="$(OBJDUMP_x86_32)" \
- OBJCOPY="$(OBJCOPY_x86_32)" STRIP="$(STRIP_x86_32)" \
- AS="$(AS_x86_32)" IASL="$(IASL)" \
- CONFIG_SEABIOS_MASTER=$(CONFIG_SEABIOS_MASTER) \
- CONFIG_SEABIOS_STABLE=$(CONFIG_SEABIOS_STABLE) \
- CONFIG_SEABIOS_THREAD_OPTIONROMS=$(CONFIG_SEABIOS_THREAD_OPTIONROMS) \
- CONFIG_SEABIOS_VGA_COREBOOT=$(CONFIG_SEABIOS_VGA_COREBOOT) \
- CONFIG_CONSOLE_SERIAL=$(CONFIG_CONSOLE_SERIAL) \
- CONFIG_TTYS0_BASE=$(CONFIG_TTYS0_BASE) \
- CONFIG_SEABIOS_MALLOC_UPPERMEMORY=$(CONFIG_SEABIOS_MALLOC_UPPERMEMORY)
-
-filo:
- $(MAKE) -C payloads/external/FILO -f Makefile.inc \
- HOSTCC="$(HOSTCC)" \
- CC="$(CC_x86_32)" LD="$(LD_x86_32)" OBJDUMP="$(OBJDUMP_x86_32)" \
- OBJCOPY="$(OBJCOPY_x86_32)" STRIP="$(STRIP_x86_32)" \
- CONFIG_FILO_MASTER=$(CONFIG_FILO_MASTER) \
- CONFIG_FILO_STABLE=$(CONFIG_FILO_STABLE)
-
-
-grub2:
- $(MAKE) -C payloads/external/GRUB2 -f Makefile.inc \
- HOSTCC="$(HOSTCC)" \
- CC="$(CC_x86_32)" LD="$(LD_x86_32)" OBJDUMP="$(OBJDUMP_x86_32)" \
- OBJCOPY="$(OBJCOPY_x86_32)" STRIP="$(STRIP_x86_32)" \
- CONFIG_GRUB2_MASTER=$(CONFIG_GRUB2_MASTER)
Stefan Reinauer (stefan.reinauer(a)coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/10828
-gerrit
commit 2b2e1e594e0825599c967c521b60adf02852b925
Author: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Date: Tue Jun 30 15:58:56 2015 -0700
payloads: Reorganize Kconfig for external payloads
The integration of external payloads in coreboot
is a bit messy. You have to change the to level Kconfig
file for every payload (something that we recently fixed
for mainboards and chipsets). This means that updating
e.g. the SeaBIOS version requires a change outside of the
SeaBIOS directory.
With this patch you can create a new directory under
payloads/external and place a Kconfig and Kconfig.name
file in there, and the payload will automatically show
up when you do "make menuconfig".
Change-Id: I293abcb8eae581d4b3934e64897c0d339a27e7c1
Signed-off-by: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
---
payloads/external/FILO/Kconfig | 20 ++++
payloads/external/FILO/Kconfig.name | 8 ++
payloads/external/GRUB2/Kconfig | 15 +++
payloads/external/GRUB2/Kconfig.name | 8 ++
payloads/external/SeaBIOS/Kconfig | 58 ++++++++++
payloads/external/SeaBIOS/Kconfig.name | 9 ++
payloads/external/linux/Kconfig | 20 ++++
payloads/external/linux/Kconfig.name | 9 ++
payloads/external/tianocore/Kconfig | 6 +
payloads/external/tianocore/Kconfig.name | 8 ++
src/Kconfig | 184 +------------------------------
11 files changed, 164 insertions(+), 181 deletions(-)
diff --git a/payloads/external/FILO/Kconfig b/payloads/external/FILO/Kconfig
new file mode 100644
index 0000000..0215aca
--- /dev/null
+++ b/payloads/external/FILO/Kconfig
@@ -0,0 +1,20 @@
+choice
+ prompt "FILO version"
+ default FILO_STABLE
+ depends on PAYLOAD_FILO
+
+config FILO_STABLE
+ bool "0.6.0"
+ help
+ Stable FILO version
+
+config FILO_MASTER
+ bool "HEAD"
+ help
+ Newest FILO version
+
+endchoice
+
+config PAYLOAD_FILE
+ depends on PAYLOAD_FILO
+ default "payloads/external/FILO/filo/build/filo.elf"
diff --git a/payloads/external/FILO/Kconfig.name b/payloads/external/FILO/Kconfig.name
new file mode 100644
index 0000000..244077d
--- /dev/null
+++ b/payloads/external/FILO/Kconfig.name
@@ -0,0 +1,8 @@
+config PAYLOAD_FILO
+ bool "FILO"
+ help
+ Select this option if you want to build a coreboot image
+ with a FILO payload. If you don't know what this is
+ about, just leave it enabled.
+
+ See http://coreboot.org/Payloads for more information.
diff --git a/payloads/external/GRUB2/Kconfig b/payloads/external/GRUB2/Kconfig
new file mode 100644
index 0000000..008efa5
--- /dev/null
+++ b/payloads/external/GRUB2/Kconfig
@@ -0,0 +1,15 @@
+choice
+ prompt "GRUB2 version"
+ default GRUB2_MASTER
+ depends on PAYLOAD_GRUB2
+
+config GRUB2_MASTER
+ bool "HEAD"
+ help
+ Newest GRUB2 version
+
+endchoice
+
+config PAYLOAD_FILE
+ depends on PAYLOAD_GRUB2
+ default "payloads/external/GRUB2/grub2/build/default_payload.elf"
diff --git a/payloads/external/GRUB2/Kconfig.name b/payloads/external/GRUB2/Kconfig.name
new file mode 100644
index 0000000..c3a8ddf
--- /dev/null
+++ b/payloads/external/GRUB2/Kconfig.name
@@ -0,0 +1,8 @@
+config PAYLOAD_GRUB2
+ bool "GRUB2"
+ help
+ Select this option if you want to build a coreboot image
+ with a GRUB2 payload. If you don't know what this is
+ about, just leave it enabled.
+
+ See http://coreboot.org/Payloads for more information.
diff --git a/payloads/external/SeaBIOS/Kconfig b/payloads/external/SeaBIOS/Kconfig
new file mode 100644
index 0000000..5df19f8
--- /dev/null
+++ b/payloads/external/SeaBIOS/Kconfig
@@ -0,0 +1,58 @@
+choice
+ prompt "SeaBIOS version"
+ default SEABIOS_STABLE
+ depends on PAYLOAD_SEABIOS
+
+config SEABIOS_STABLE
+ bool "1.7.5"
+ help
+ Stable SeaBIOS version
+config SEABIOS_MASTER
+ bool "master"
+ help
+ Newest SeaBIOS version
+
+endchoice
+
+config SEABIOS_PS2_TIMEOUT
+ prompt "PS/2 keyboard controller initialization timeout (milliseconds)" if PAYLOAD_SEABIOS
+ default 0
+ depends on EXPERT
+ int
+ help
+ Some PS/2 keyboard controllers don't respond to commands immediately
+ after powering on. This specifies how long SeaBIOS will wait for the
+ keyboard controller to become ready before giving up.
+
+config SEABIOS_THREAD_OPTIONROMS
+ prompt "Hardware init during option ROM execution" if PAYLOAD_SEABIOS
+ default n
+ bool
+ help
+ Allow hardware init to run in parallel with optionrom execution.
+
+ This can reduce boot time, but can cause some timing
+ variations during option ROM code execution. It is not
+ known if all option ROMs will behave properly with this option.
+
+config SEABIOS_MALLOC_UPPERMEMORY
+ bool
+ default y
+ depends on PAYLOAD_SEABIOS
+ help
+ Use the "Upper Memory Block" area (0xc0000-0xf0000) for internal
+ "low memory" allocations. If this is not selected, the memory is
+ instead allocated from the "9-segment" (0x90000-0xa0000).
+ This is not typically needed, but may be required on some platforms
+ to allow USB and SATA buffers to be written correctly by the
+ hardware. In general, if this is desired, the option will be
+ set to 'N' by the chipset Kconfig.
+
+config PAYLOAD_FILE
+ depends on PAYLOAD_SEABIOS
+ default "payloads/external/SeaBIOS/seabios/out/bios.bin.elf"
+
+config PAYLOAD_VGABIOS_FILE
+ string
+ depends on PAYLOAD_SEABIOS && SEABIOS_VGA_COREBOOT
+ default "payloads/external/SeaBIOS/seabios/out/vgabios.bin"
diff --git a/payloads/external/SeaBIOS/Kconfig.name b/payloads/external/SeaBIOS/Kconfig.name
new file mode 100644
index 0000000..9ab235d
--- /dev/null
+++ b/payloads/external/SeaBIOS/Kconfig.name
@@ -0,0 +1,9 @@
+config PAYLOAD_SEABIOS
+ bool "SeaBIOS"
+ depends on ARCH_X86
+ help
+ Select this option if you want to build a coreboot image
+ with a SeaBIOS payload. If you don't know what this is
+ about, just leave it enabled.
+
+ See http://coreboot.org/Payloads for more information.
diff --git a/payloads/external/linux/Kconfig b/payloads/external/linux/Kconfig
new file mode 100644
index 0000000..9956a23
--- /dev/null
+++ b/payloads/external/linux/Kconfig
@@ -0,0 +1,20 @@
+config PAYLOAD_FILE
+ string "Linux path and filename"
+ depends on PAYLOAD_LINUX
+ default "bzImage"
+ help
+ The path and filename of the bzImage kernel to use as payload.
+
+config LINUX_COMMAND_LINE
+ string "Linux command line"
+ depends on PAYLOAD_LINUX
+ default ""
+ help
+ A command line to add to the Linux kernel.
+
+config LINUX_INITRD
+ string "Linux initrd"
+ depends on PAYLOAD_LINUX
+ default ""
+ help
+ An initrd image to add to the Linux kernel.
diff --git a/payloads/external/linux/Kconfig.name b/payloads/external/linux/Kconfig.name
new file mode 100644
index 0000000..ae1d906
--- /dev/null
+++ b/payloads/external/linux/Kconfig.name
@@ -0,0 +1,9 @@
+config PAYLOAD_LINUX
+ bool "A Linux payload"
+ help
+ Select this option if you have a Linux bzImage which coreboot
+ should run as soon as the basic hardware initialization
+ is completed.
+
+ You will be able to specify the location and file name of the
+ payload image later.
diff --git a/payloads/external/tianocore/Kconfig b/payloads/external/tianocore/Kconfig
new file mode 100644
index 0000000..e6d3a3b
--- /dev/null
+++ b/payloads/external/tianocore/Kconfig
@@ -0,0 +1,6 @@
+config PAYLOAD_FILE
+ string "Tianocore firmware volume"
+ depends on PAYLOAD_TIANOCORE
+ default "COREBOOT.fd"
+ help
+ The result of a corebootPkg build
diff --git a/payloads/external/tianocore/Kconfig.name b/payloads/external/tianocore/Kconfig.name
new file mode 100644
index 0000000..d57f7e1
--- /dev/null
+++ b/payloads/external/tianocore/Kconfig.name
@@ -0,0 +1,8 @@
+config PAYLOAD_TIANOCORE
+ bool "Tiano Core"
+ help
+ Select this option if you want to build a coreboot image
+ with a Tiano Core payload. If you don't know what this is
+ about, just leave it enabled.
+
+ See http://coreboot.org/Payloads for more information.
diff --git a/src/Kconfig b/src/Kconfig
index 94b3508..a2129ad 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -667,144 +667,11 @@ config PAYLOAD_ELF
You will be able to specify the location and file name of the
payload image later.
-config PAYLOAD_LINUX
- bool "A Linux payload"
- help
- Select this option if you have a Linux bzImage which coreboot
- should run as soon as the basic hardware initialization
- is completed.
-
- You will be able to specify the location and file name of the
- payload image later.
-
-config PAYLOAD_SEABIOS
- bool "SeaBIOS"
- depends on ARCH_X86
- help
- Select this option if you want to build a coreboot image
- with a SeaBIOS payload. If you don't know what this is
- about, just leave it enabled.
-
- See http://coreboot.org/Payloads for more information.
-
-config PAYLOAD_FILO
- bool "FILO"
- help
- Select this option if you want to build a coreboot image
- with a FILO payload. If you don't know what this is
- about, just leave it enabled.
-
- See http://coreboot.org/Payloads for more information.
-
-config PAYLOAD_GRUB2
- bool "GRUB2"
- help
- Select this option if you want to build a coreboot image
- with a GRUB2 payload. If you don't know what this is
- about, just leave it enabled.
-
- See http://coreboot.org/Payloads for more information.
-
-config PAYLOAD_TIANOCORE
- bool "Tiano Core"
- help
- Select this option if you want to build a coreboot image
- with a Tiano Core payload. If you don't know what this is
- about, just leave it enabled.
-
- See http://coreboot.org/Payloads for more information.
-
-endchoice
-
-choice
- prompt "SeaBIOS version"
- default SEABIOS_STABLE
- depends on PAYLOAD_SEABIOS
-
-config SEABIOS_STABLE
- bool "1.7.5"
- help
- Stable SeaBIOS version
-config SEABIOS_MASTER
- bool "master"
- help
- Newest SeaBIOS version
-
-endchoice
-
-config SEABIOS_PS2_TIMEOUT
- prompt "PS/2 keyboard controller initialization timeout (milliseconds)" if PAYLOAD_SEABIOS
- default 0
- depends on EXPERT
- int
- help
- Some PS/2 keyboard controllers don't respond to commands immediately
- after powering on. This specifies how long SeaBIOS will wait for the
- keyboard controller to become ready before giving up.
-
-config SEABIOS_THREAD_OPTIONROMS
- prompt "Hardware init during option ROM execution" if PAYLOAD_SEABIOS
- default n
- bool
- help
- Allow hardware init to run in parallel with optionrom execution.
-
- This can reduce boot time, but can cause some timing
- variations during option ROM code execution. It is not
- known if all option ROMs will behave properly with this option.
-
-config SEABIOS_MALLOC_UPPERMEMORY
- bool
- default y
- depends on PAYLOAD_SEABIOS
- help
- Use the "Upper Memory Block" area (0xc0000-0xf0000) for internal
- "low memory" allocations. If this is not selected, the memory is
- instead allocated from the "9-segment" (0x90000-0xa0000).
- This is not typically needed, but may be required on some platforms
- to allow USB and SATA buffers to be written correctly by the
- hardware. In general, if this is desired, the option will be
- set to 'N' by the chipset Kconfig.
-
-config SEABIOS_VGA_COREBOOT
- prompt "Include generated option rom that implements legacy VGA BIOS compatibility" if PAYLOAD_SEABIOS
- default n
- depends on !VGA_BIOS && (MAINBOARD_DO_NATIVE_VGA_INIT || MAINBOARD_HAS_NATIVE_VGA_INIT_TEXTMODECFG)
- bool
- help
- Coreboot can initialize the GPU of some mainboards.
-
- After initializing the GPU, the information about it can be passed to the payload.
- Provide an option rom that implements this legacy VGA BIOS compatibility requirement.
-
-choice
- prompt "GRUB2 version"
- default GRUB2_MASTER
- depends on PAYLOAD_GRUB2
-
-config GRUB2_MASTER
- bool "HEAD"
- help
- Newest GRUB2 version
+source "payloads/external/*/Kconfig.name"
endchoice
-choice
- prompt "FILO version"
- default FILO_STABLE
- depends on PAYLOAD_FILO
-
-config FILO_STABLE
- bool "0.6.0"
- help
- Stable FILO version
-
-config FILO_MASTER
- bool "HEAD"
- help
- Newest FILO version
-
-endchoice
+source "payloads/external/*/Kconfig"
config PAYLOAD_FILE
string "Payload path and filename"
@@ -813,60 +680,15 @@ config PAYLOAD_FILE
help
The path and filename of the ELF executable file to use as payload.
-config PAYLOAD_FILE
- string "Linux path and filename"
- depends on PAYLOAD_LINUX
- default "bzImage"
- help
- The path and filename of the bzImage kernel to use as payload.
-
-config PAYLOAD_FILE
- depends on PAYLOAD_SEABIOS
- default "payloads/external/SeaBIOS/seabios/out/bios.bin.elf"
-
-config PAYLOAD_VGABIOS_FILE
- string
- depends on PAYLOAD_SEABIOS && SEABIOS_VGA_COREBOOT
- default "payloads/external/SeaBIOS/seabios/out/vgabios.bin"
-
-config PAYLOAD_FILE
- depends on PAYLOAD_FILO
- default "payloads/external/FILO/filo/build/filo.elf"
-
-config PAYLOAD_FILE
- depends on PAYLOAD_GRUB2
- default "payloads/external/GRUB2/grub2/build/default_payload.elf"
-
-config PAYLOAD_FILE
- string "Tianocore firmware volume"
- depends on PAYLOAD_TIANOCORE
- default "COREBOOT.fd"
- help
- The result of a corebootPkg build
-
# TODO: Defined if no payload? Breaks build?
config COMPRESSED_PAYLOAD_LZMA
bool "Use LZMA compression for payloads"
default y
- depends on PAYLOAD_ELF || PAYLOAD_SEABIOS || PAYLOAD_FILO || PAYLOAD_TIANOCORE || PAYLOAD_GRUB2
+ depends on !PAYLOAD_NONE && !PAYLOAD_LINUX
help
In order to reduce the size payloads take up in the ROM chip
coreboot can compress them using the LZMA algorithm.
-config LINUX_COMMAND_LINE
- string "Linux command line"
- depends on PAYLOAD_LINUX
- default ""
- help
- A command line to add to the Linux kernel.
-
-config LINUX_INITRD
- string "Linux initrd"
- depends on PAYLOAD_LINUX
- default ""
- help
- An initrd image to add to the Linux kernel.
-
endmenu
menu "Debugging"
Stefan Reinauer (stefan.reinauer(a)coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/10827
-gerrit
commit 34c7c8d402b9c192ff6bef20c2bf7a5cbec6d586
Author: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Date: Tue Jul 7 21:31:55 2015 +0200
stddef.h: Disable check_member() macro when compiling with CLANG
CLANG assumes that _Static_assert() is a C++11 only feature and
errs out when encountering the check_member macro complaining about
a reinterpret_cast.
Change-Id: Id8c6b47b4f5716e6184aec9e0bc4b0e1c7aaf17c
Signed-off-by: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
---
src/include/stddef.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/include/stddef.h b/src/include/stddef.h
index 3bbf914..f87c65f 100644
--- a/src/include/stddef.h
+++ b/src/include/stddef.h
@@ -32,9 +32,13 @@ typedef unsigned int wint_t;
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
+#if !defined(__clang__)
#define check_member(structure, member, offset) _Static_assert( \
offsetof(struct structure, member) == offset, \
"`struct " #structure "` offset for `" #member "` is not " #offset )
+#else
+#define check_member(structure, member, offset)
+#endif
/**
* container_of - cast a member of a structure out to the containing structure
Patrick Georgi (pgeorgi(a)google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/10741
-gerrit
commit 4a628b25c2a910c5c3e80421ab1d7cf08dc3e82c
Author: Furquan Shaikh <furquan(a)google.com>
Date: Fri Nov 14 11:57:00 2014 -0800
documentation: Add documentation for timestamp library
[pg: removed discussion of timestamp internals that isn't current anymore in
favor of some notes for users: when to run which function, what _not_ to do.
Also moved to markdown-ish layout. Will do further style cleanups later.]
BUG=chrome-os-partner:32973
BRANCH=None
TEST=None
Change-Id: I6ea7237f2fa749ce3a493f378f9937e642f3b678
Signed-off-by: Marc Jones <marc.jones(a)se-eng.com>
Signed-off-by: Patrick Georgi <pgeorgi(a)chromium.org>
Original-Commit-Id: 97e2a3ebd9552c2a91d9ea62be515059428631cb
Original-Change-Id: I4b184ffad6fcd93d63343a9bca34ad013e9d4263
Original-Signed-off-by: Furquan Shaikh <furquan(a)google.com>
Original-Reviewed-on: https://chromium-review.googlesource.com/229861
Original-Tested-by: Furquan Shaikh <furquan(a)chromium.org>
Original-Reviewed-by: Aaron Durbin <adurbin(a)chromium.org>
Original-Commit-Queue: Furquan Shaikh <furquan(a)chromium.org>
---
Documentation/timestamp.md | 200 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 200 insertions(+)
diff --git a/Documentation/timestamp.md b/Documentation/timestamp.md
new file mode 100644
index 0000000..b6b437e
--- /dev/null
+++ b/Documentation/timestamp.md
@@ -0,0 +1,200 @@
+Table of Contents
+=================
+Introduction
+ Transition from cache to cbmem
+
+Data structures used
+ cache_state
+ table
+ entries
+
+Function APIs
+ timestamp_init
+ timestamp_add
+ timestamp_add_now
+ timestamp_sync
+
+Use / Test Cases
+ Case 1: Timestamp Region Exists
+ Case 2: No timestamp region, fresh boot, cbmem_initialize called after
+ timestamp_init
+ Case 3: No timestamp region, fresh boot, cbmem_initialize called before
+ timestamp_init
+ Case 4: No timestamp region, resume, cbmem_initialize called after
+ timestamp_init
+ Case 5: No timestamp region, resume, cbmem_initialize called before
+ timestamp_init
+
+
+Introduction
+============
+The aim of the timestamp library is to make it easier for different boards
+to save timestamps in cbmem / stash (until cbmem is brought up) by
+providing a simple API to initialize, add and sync timestamps. In order
+to make the timestamps persistent and accessible from the kernel, we
+need to ensure that all the saved timestamps end up in cbmem under
+the CBMEM_ID_TIMESTAMP tag. However, until the cbmem area is available,
+the timestamps can be saved to a SoC-defined \_timestamp region or in a
+local stage-specific stash. The work of identifying the right location for
+storing timestamps is done by the library and is not exposed to the user.
+
+Working of timestamp library from a user perspective can be outlined in
+the following steps:
+1. Initialize the base time and reset cbmem timestamp area
+2. Start adding timestamps
+
+Behind the scenes, the timestamp library takes care of:
+1. Identifying the correct location for storing timestamps (cbmem or timestamp
+ region or local stash).
+2. Once cbmem is up, ensure that all timestamps are synced from timestamp
+ region or local stash into the cbmem area.
+3. Add a new cbmem timestamp area based on whether a reset of the cbmem
+ timestamp region is required or not.
+
+Transition from cache to cbmem
+------------------------------
+To move timestamps from the cache to cbmem (and initialize the cbmem area in
+the first place), we use the CBMEM_INIT_HOOK infrastructure of coreboot.
+
+When cbmem is initialized, the hook is called, which creates the area,
+copies all timestamps to cbmem and disables the cache.
+
+After such a transition, timestamp_init() must not be run again.
+
+
+Data structures used
+====================
+The main structure that maintains information about the timestamp cache is:
+struct __attribute__((__packed__)) timestamp_cache {
+ uint16_t cache_state;
+ struct timestamp_table table;
+ struct timestamp_entry entries[MAX_TIMESTAMP_CACHE];
+};
+
+cache_state
+-----------
+The state of the cache is maintained by cache_state attribute which can
+be any one of the following:
+
+enum {
+ TIMESTAMP_CACHE_UNINITIALIZED = 0,
+ TIMESTAMP_CACHE_INITIALIZED,
+ TIMESTAMP_CACHE_NOT_NEEDED,
+};
+
+By default, if the cache is stored in local stash (bss area), then
+it will be reset to uninitialized state. However, if the cache is
+stored in timestamp region, then it might have garbage in any of the
+attributes. Thus, if timestamp region is being used by any board, it is
+initialized to default values by the library.
+
+Once the cache is initialized, its state is set to
+CACHE_INITIALIZED. Henceforth, the calls to cache i.e. timestamp_add
+know that the state reflected is valid and timestamps can be directly
+saved in the cache.
+
+Once the cbmem area is up (i.e. call to timestamp_sync_cache_to_cbmem),
+we do not need to store the timestamps in local stash / timestamp area
+anymore. Thus, the cache state is set to CACHE_NOT_NEEDED, which allows
+timestamp_add to store all timestamps directly into the cbmem area.
+
+
+table
+-----
+This field is represented by a structure which provides overall
+information about the entries in the timestamp area:
+
+struct timestamp_table {
+ uint64_t base_time;
+ uint32_t max_entries;
+ uint32_t num_entries;
+ struct timestamp_entry entries[0]; /* Variable number of entries */
+} __attribute__((packed));
+
+It indicates the base time for all timestamp entries, maximum number
+of entries that can be stored, total number of entries that currently
+exist and an entry structure to hold variable number of entries.
+
+
+entries
+-------
+This field holds the details of each timestamp entry, upto a maximum
+of MAX_TIMESTAMP_CACHE which is defined as 16 entries. Each entry is
+defined by:
+
+struct timestamp_entry {
+ uint32_t entry_id;
+ uint64_t entry_stamp;
+} __attribute__((packed));
+
+entry_id holds the timestamp id corresponding to this entry and
+entry_stamp holds the actual timestamp.
+
+
+For timestamps stored in the cbmem area, a timestamp_table is allocated
+with space for MAX_TIMESTAMPS equal to 30. Thus, the cbmem area holds
+base_time, max_entries (which is 30), current number of entries and the
+actual entries represented by timestamp_entry.
+
+
+Function APIs
+=============
+
+timestamp_init
+--------------
+This function initializes the timestamp cache and should be run as early
+as possible. On platforms with SRAM, this might mean in bootblock, on
+x86 with its CAR backed memory in romstage, this means romstage before
+memory init.
+
+timestamp_add
+-------------
+This function accepts from user a timestamp id and time to record in the
+timestamp table. It stores the entry in the appropriate table in cbmem
+or _timestamp region or local stash.
+
+
+timestamp_add_now
+-----------------
+This function calls timestamp_add with user-provided id and current time.
+
+
+Use / Test Cases
+================
+
+The following cases have been considered while designing the timestamp
+library. It is important to ensure that any changes made to this library satisfy
+each of the following use cases:
+
+Case 1: Timestamp Region Exists (Fresh Boot / Resume)
+-----------------------------------------------------
+
+In this case, the library needs to call timestamp_init as early as possible to
+enable the timestamp cache. Once cbmem is available, the values will be
+transferred automatically.
+
+All regions are automatically reset on initialization.
+
+Case 2: No timestamp region, fresh boot, cbmem_initialize called after timestamp_init
+-------------------------------------------------------------------------------------
+
+timestamp_init will setup a local cache. cbmem must be initialized before that
+cache vanishes - as happens when jumping to the next stage.
+
+Case 3: No timestamp region, fresh boot, cbmem_initialize called before timestamp_init
+--------------------------------------------------------------------------------------
+
+This case is not supported right now, just don't call timestamp_init after
+cbmem_initialize. (patches to make this more robust are welcome)
+
+Case 4: No timestamp region, resume, cbmem_initialize called after timestamp_init
+---------------------------------------------------------------------------------
+
+We always reset the cbmem region before using it, so pre-suspend timestamps
+will be gone.
+
+Case 5: No timestamp region, resume, cbmem_initialize called before timestamp_init
+----------------------------------------------------------------------------------
+
+We always reset the cbmem region before using it, so pre-suspend timestamps
+will be gone.
the following patch was just integrated into master:
commit 06f1f8fed62408cebf3ea32bcb486e5bcb450c23
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Thu Nov 6 09:58:07 2014 -0600
timestamp: remove conditional #if CONFIG_COLLECT_TIMESTAMPS
Empty functions are provided when !CONFIG_COLLECT_TIMESTAMPS
so stop guarding the compilation.
BUG=None
BRANCH=None
TEST=Built
Original-Change-Id: Ib0f23e1204e048a9b928568da02e9661f6aa0a35
Original-Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/228190
Original-Reviewed-by: Furquan Shaikh <furquan(a)chromium.org>
Original-Reviewed-by: Julius Werner <jwerner(a)chromium.org>
(cherry picked from commit 9aa69fd43d77f5f7acdc9f361016c595dd16104e)
Signed-off-by: Marc Jones <marc.jones(a)se-eng.com>
Change-Id: I14418c8ef3ccb57ac6fce05b422e1c21b1d38392
Reviewed-on: http://review.coreboot.org/10742
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin(a)chromium.org>
See http://review.coreboot.org/10742 for details.
-gerrit