the following patch was just integrated into master:
commit 16ae95c4bce956c115deaa7b5d42b3472a72e9e9
Author: Patrick Georgi <patrick(a)georgi-clan.de>
Date: Sat Aug 31 08:26:52 2013 +0200
Add Kconfig options for Linux as payload
These allow to define a kernel image, initrd and command line.
Change-Id: I40155b812728a176b6d15871e1e6c96e4ad693c8
Signed-off-by: Patrick Georgi <patrick(a)georgi-clan.de>
Reviewed-on: http://review.coreboot.org/3893
Reviewed-by: Ronald G. Minnich <rminnich(a)gmail.com>
Tested-by: build bot (Jenkins)
See http://review.coreboot.org/3893 for details.
-gerrit
the following patch was just integrated into master:
commit 2f39eae41d750817143f9372f67de6b1ee96b4a6
Author: Patrick Georgi <patrick(a)georgi-clan.de>
Date: Sat Aug 31 08:16:27 2013 +0200
Remove NRV2B compression support
It wasn't even hooked up to the build system anymore.
Change-Id: I4b962ffd945b39451e19da3ec2f7b8e0eecf2e53
Signed-off-by: Patrick Georgi <patrick(a)georgi-clan.de>
Reviewed-on: http://review.coreboot.org/3892
Reviewed-by: Ronald G. Minnich <rminnich(a)gmail.com>
Tested-by: build bot (Jenkins)
See http://review.coreboot.org/3892 for details.
-gerrit
the following patch was just integrated into master:
commit de36d333c27c258bc05ecc0b6649fbdafcae619f
Author: Patrick Georgi <patrick(a)georgi-clan.de>
Date: Tue Aug 27 20:22:21 2013 +0200
Add a (b)zImage parser to cbfstool
In the great tradition of LinuxBIOS this allows adding
a kernel as payload. add-payload is extended to also
allow adding an initial ramdisk (-I filename) and a
command line (-C console=ttyS0).
Change-Id: Iaca499a98b0adf0134e78d6bf020b6531a626aaa
Signed-off-by: Patrick Georgi <patrick.georgi(a)secunet.com>
Signed-off-by: Patrick Georgi <patrick(a)georgi-clan.de>
Reviewed-on: http://review.coreboot.org/3302
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich(a)gmail.com>
See http://review.coreboot.org/3302 for details.
-gerrit
the following patch was just integrated into master:
commit a9542183e04ce352f0b2264736cd0ede55d7948e
Author: Stefan Tauner <stefan.tauner(a)gmx.at>
Date: Fri Aug 30 15:32:52 2013 +0200
Add .gitignore
Change-Id: I8fadb09aed552d23a232bbcbc719fd25070aa501
Signed-off-by: Stefan Tauner <stefan.tauner(a)gmx.at>
Reviewed-on: http://review.coreboot.org/3890
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <patrick(a)georgi-clan.de>
See http://review.coreboot.org/3890 for details.
-gerrit
Patrick Georgi (patrick(a)georgi-clan.de) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3893
-gerrit
commit 42c5e4ed5f20f2ce8ee74b135e875551d2a58677
Author: Patrick Georgi <patrick(a)georgi-clan.de>
Date: Sat Aug 31 08:26:52 2013 +0200
Add Kconfig options for Linux as payload
These allow to define a kernel image, initrd and command line.
Change-Id: I40155b812728a176b6d15871e1e6c96e4ad693c8
Signed-off-by: Patrick Georgi <patrick(a)georgi-clan.de>
---
src/Kconfig | 31 +++++++++++++++++++++++++++++++
src/arch/x86/Makefile.inc | 14 ++++++++++++++
2 files changed, 45 insertions(+)
diff --git a/src/Kconfig b/src/Kconfig
index f714cb2..be2cb24 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -539,6 +539,16 @@ 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
@@ -617,6 +627,13 @@ config PAYLOAD_FILE
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 "$(obj)/seabios/out/bios.bin.elf"
@@ -640,6 +657,20 @@ config COMPRESSED_PAYLOAD_LZMA
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"
diff --git a/src/arch/x86/Makefile.inc b/src/arch/x86/Makefile.inc
index 5c28676..b3b82b9 100644
--- a/src/arch/x86/Makefile.inc
+++ b/src/arch/x86/Makefile.inc
@@ -74,6 +74,16 @@ $(obj)/coreboot.pre1: $(CBFSTOOL)
mv $(obj)/coreboot.rom $@
endif
+ifeq ($(CONFIG_PAYLOAD_LINUX),y)
+LINUX_ADDITIONAL_CONFIG:=
+ifneq ($(strip $(call strip_quotes,$(CONFIG_LINUX_COMMAND_LINE))),)
+ LINUX_ADDITIONAL_CONFIG+=-C $(CONFIG_LINUX_COMMAND_LINE)
+endif
+ifneq ($(strip $(call strip_quotes,$(CONFIG_LINUX_INITRD))),)
+ LINUX_ADDITIONAL_CONFIG+=-I $(CONFIG_LINUX_INITRD)
+endif
+endif
+
$(obj)/coreboot.rom: $(obj)/coreboot.pre $(objcbfs)/coreboot_ram.elf $(CBFSTOOL) $(call strip_quotes,$(COREBOOT_ROM_DEPENDENCIES)) $$(INTERMEDIATE) $$(VBOOT_STUB_ELF)
@printf " CBFS $(subst $(obj)/,,$(@))\n"
cp $(obj)/coreboot.pre $@.tmp
@@ -85,6 +95,10 @@ ifeq ($(CONFIG_PAYLOAD_ELF),y)
@printf " PAYLOAD $(CONFIG_PAYLOAD_FILE) (compression: $(CBFS_PAYLOAD_COMPRESS_FLAG))\n"
$(CBFSTOOL) $@.tmp add-payload -f $(CONFIG_PAYLOAD_FILE) -n $(CONFIG_CBFS_PREFIX)/payload -c $(CBFS_PAYLOAD_COMPRESS_FLAG)
endif
+ifeq ($(CONFIG_PAYLOAD_LINUX),y)
+ @printf " PAYLOAD $(CONFIG_PAYLOAD_FILE) (compression: $(CBFS_PAYLOAD_COMPRESS_FLAG))\n"
+ $(CBFSTOOL) $@.tmp add-payload -f $(CONFIG_PAYLOAD_FILE) -n $(CONFIG_CBFS_PREFIX)/payload -c $(CBFS_PAYLOAD_COMPRESS_FLAG) $(LINUX_ADDITIONAL_CONFIG)
+endif
ifeq ($(CONFIG_PAYLOAD_SEABIOS),y)
@printf " PAYLOAD SeaBIOS (internal, compression: $(CBFS_PAYLOAD_COMPRESS_FLAG))\n"
$(CBFSTOOL) $@.tmp add-payload -f $(CONFIG_PAYLOAD_FILE) -n $(CONFIG_CBFS_PREFIX)/payload -c $(CBFS_PAYLOAD_COMPRESS_FLAG)
Patrick Georgi (patrick(a)georgi-clan.de) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3891
-gerrit
commit d3ddc8bd65837a203831171caf48b9e6e7750737
Author: Nico Huber <nico.huber(a)secunet.com>
Date: Wed Jun 26 12:28:32 2013 +0200
libpayload: Add a simple timeout API
Most timeouts in libpayload are currently implemented with loops that
delay program execution by a specific time in each iteration. Like:
int timeout = 100;
while (check_what_we_are_waiting_for() && timeout) {
explicit_mdelay(1);
--timeout;
}
This pattern relies on the assumption that any per-iteration call to
a (most likely lower-level) function doesn't delay the execution by
itself. That's never true but works well as long as the explicit delays
are long enough... Stop! We don't want them to be long! as this would
cause higher latencies.
The obvious solution is to wait until a point in time instead. So, add
a simple API for that now and port misbehaving timeout loops when they
start to bother. The example above would become:
deadline_t timeout = new_timeout_ms(100);
while (check_what_we_are_waiting_for() && !timeout_mdelay(timeout, 1)) ;
Change-Id: I19dcab5be7d81b5cf26167512a7089b275196d7a
Signed-off-by: Nico Huber <nico.huber(a)secunet.com>
---
payloads/libpayload/include/libpayload.h | 1 +
payloads/libpayload/include/timeout.h | 149 +++++++++++++++++++++++++++++++
payloads/libpayload/libc/time.c | 17 ++++
3 files changed, 167 insertions(+)
diff --git a/payloads/libpayload/include/libpayload.h b/payloads/libpayload/include/libpayload.h
index f23fb87..12f5957 100644
--- a/payloads/libpayload/include/libpayload.h
+++ b/payloads/libpayload/include/libpayload.h
@@ -63,6 +63,7 @@
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
+#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
#define LITTLE_ENDIAN 1234
#define BIG_ENDIAN 4321
diff --git a/payloads/libpayload/include/timeout.h b/payloads/libpayload/include/timeout.h
new file mode 100644
index 0000000..278f5e4
--- /dev/null
+++ b/payloads/libpayload/include/timeout.h
@@ -0,0 +1,149 @@
+/*
+ * This file is part of the libpayload project.
+ *
+ * Copyright (C) 2013 secunet Security Networks AG
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _LIBPAYLOAD_TIMEOUT_H
+#define _LIBPAYLOAD_TIMEOUT_H
+
+#include <libpayload.h>
+#include <stdint.h>
+
+#define NSECS_PER_SEC 1000000000L
+#define USECS_PER_SEC 1000000L
+#define MSECS_PER_SEC 1000
+
+typedef const uint64_t deadline_t;
+
+/* For a TSC, 0 won't be reached within years. How about non-x86 platforms? */
+#define NEVER_TIMEOUT ((deadline_t)0)
+
+/**
+ * Starts a new timeout from now
+ *
+ * @param ns nanoseconds to timeout after
+ */
+static inline deadline_t new_timeout_ns(const unsigned long ns)
+{
+ return timer_raw_value() +
+ DIV_ROUND_UP((uint64_t)ns * timer_hz(), NSECS_PER_SEC);
+}
+
+/**
+ * Starts a new timeout from now
+ *
+ * @param us microseconds to timeout after
+ */
+static inline deadline_t new_timeout_us(const unsigned long us)
+{
+ return timer_raw_value() +
+ DIV_ROUND_UP((uint64_t)us * timer_hz(), USECS_PER_SEC);
+}
+
+/**
+ * Starts a new timeout from now
+ *
+ * @param ms milliseconds to timeout after
+ */
+static inline deadline_t new_timeout_ms(const unsigned long ms)
+{
+ return timer_raw_value() +
+ DIV_ROUND_UP((uint64_t)ms * timer_hz(), MSECS_PER_SEC);
+}
+
+/**
+ * Starts a new timeout from now
+ *
+ * @param s seconds to timeout after
+ */
+static inline deadline_t new_timeout_s(const unsigned long s)
+{
+ return timer_raw_value() + ((uint64_t)s * timer_hz());
+}
+
+/**
+ * Checks if a deadline has expired
+ *
+ * @param dl the deadline to check
+ * @return 1 if dl has expired, 0 if not
+ */
+static inline int timed_out(deadline_t dl)
+{
+ return timer_raw_value() >= dl;
+}
+
+int delay_until(deadline_t delay_end, deadline_t);
+
+/**
+ * Delay for a specified time but break at a deadline
+ *
+ * @param dl deadline to satisfy
+ * @param ns number of nanoseconds to delay for
+ * @return -1 if dl has already expired, 0 if not
+ */
+static inline int timeout_ndelay(deadline_t dl, unsigned long ns)
+{
+ return delay_until(new_timeout_ns(ns), dl);
+}
+
+/**
+ * Delay for a specified time but break at a deadline
+ *
+ * @param dl deadline to satisfy
+ * @param us number of microseconds to delay for
+ * @return -1 if dl has already expired, 0 if not
+ */
+static inline int timeout_udelay(deadline_t dl, unsigned long us)
+{
+ return delay_until(new_timeout_us(us), dl);
+}
+
+/**
+ * Delay for a specified time but break at a deadline
+ *
+ * @param dl deadline to satisfy
+ * @param ms number of milliseconds to delay for
+ * @return -1 if dl has already expired, 0 if not
+ */
+static inline int timeout_mdelay(deadline_t dl, const unsigned long ms)
+{
+ return delay_until(new_timeout_ms(ms), dl);
+}
+
+/**
+ * Delay for a specified time but break at a deadline
+ *
+ * @param dl deadline to satisfy
+ * @param s number of seconds to delay for
+ * @return -1 if dl has already expired, 0 if not
+ */
+static inline int timeout_delay(deadline_t dl, const unsigned long s)
+{
+ return delay_until(new_timeout_s(s), dl);
+}
+
+#endif
diff --git a/payloads/libpayload/libc/time.c b/payloads/libpayload/libc/time.c
index 7b6bf47..421ef24 100644
--- a/payloads/libpayload/libc/time.c
+++ b/payloads/libpayload/libc/time.c
@@ -37,6 +37,7 @@
#ifdef CONFIG_ARCH_X86
#include <arch/rdtsc.h>
#endif
+#include <timeout.h>
extern u32 cpu_khz;
@@ -189,3 +190,19 @@ void delay(unsigned int s)
{
_delay((uint64_t)s * timer_hz());
}
+
+/**
+ * Delay until a specified point in time but break at a deadline
+ *
+ * @param delay_end point in time to delay until
+ * @param dl deadline to satisfy
+ * @return -1 if dl has already expired, 0 if not
+ */
+int delay_until(deadline_t delay_end, deadline_t dl)
+{
+ if (timed_out(dl))
+ return -1;
+ deadline_t de = MIN(delay_end, dl);
+ while (timer_raw_value() < de) ;
+ return 0;
+}
Stefan Tauner (stefan.tauner(a)gmx.at) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3890
-gerrit
commit 9c9cbb57d4bc866c9baac040e237d5ef21c41071
Author: Stefan Tauner <stefan.tauner(a)gmx.at>
Date: Fri Aug 30 15:32:52 2013 +0200
Add .gitignore
Change-Id: I8fadb09aed552d23a232bbcbc719fd25070aa501
Signed-off-by: Stefan Tauner <stefan.tauner(a)gmx.at>
---
.gitignore | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..f89904f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+.config
+.config.old
+.xcompile
+build/
Patrick Georgi (patrick(a)georgi-clan.de) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3889
-gerrit
commit 0c071cb7d0b10d4510f9ec3200e1e4e9d9bdc376
Author: Nico Huber <nico.huber(a)secunet.com>
Date: Fri Jun 14 15:34:59 2013 +0200
libpayload: Set heap's header size to 64-bit
Change-Id: Ic82d6477c53da62a1325400f2e596d7d557d5d1e
Signed-off-by: Patrick Georgi <patrick.georgi(a)secunet.com>
---
payloads/libpayload/libc/malloc.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/payloads/libpayload/libc/malloc.c b/payloads/libpayload/libc/malloc.c
index c03cc73..851ef57 100644
--- a/payloads/libpayload/libc/malloc.c
+++ b/payloads/libpayload/libc/malloc.c
@@ -37,9 +37,6 @@
* We're also susceptible to the usual buffer overrun poisoning, though the
* risk is within acceptable ranges for this implementation (don't overrun
* your buffers, kids!).
- *
- * The header format (hdrtype_t) supports heaps of up to 32MiB (given that int
- * is 32 bits long).
*/
#define IN_MALLOC_C
@@ -50,7 +47,7 @@ extern char _heap, _eheap; /* Defined in the ldscript. */
static void *hstart = (void *)&_heap;
static void *hend = (void *)&_eheap;
-typedef unsigned int hdrtype_t;
+typedef u64 hdrtype_t;
#define HDRSIZE (sizeof(hdrtype_t))
#define SIZE_BITS ((HDRSIZE << 3) - 7)