Marc Jones (marc.jones(a)se-eng.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/8055
-gerrit
commit bec2f1b75e701e9d55284afead8618df2f5e29e8
Author: Julius Werner <jwerner(a)chromium.org>
Date: Fri Jun 6 16:10:56 2014 -0700
Add and consistently use wrapper macro for romstage static variables
x86 systems run their romstage as execute-in-place from flash, which
prevents them from having writable data segments. In several code pieces
that get linked into both romstage and ramstage, this has been worked
around by using a local variable and having the 'static' storage class
guarded by #ifndef __PRE_RAM__.
However, x86 is the only architecture using execute-in-place (for now),
so it does not make sense to impose the restriction globally. Rather
than fixing the #ifdef at every occurrence, this should really be
wrapped in a way that makes it easier to modify in a single place. The
chromeos/cros_vpd.c file already had a nice approach for a wrapper
macro, but unfortunately restricted it to one file... this patch moves
it to stddef.h and employs it consistently throughout coreboot.
BRANCH=nyan
BUG=None
TEST=Measured boot time on Nyan_Big before and after, confirmed that it
gained 6ms from caching the FMAP in vboot_loader.c.
Original-Change-Id: Ia53b94ab9c6a303b979db7ff20b79e14bc51f9f8
Original-Signed-off-by: Julius Werner <jwerner(a)chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/203033
Original-Reviewed-by: Aaron Durbin <adurbin(a)chromium.org>
Original-Reviewed-by: Stefan Reinauer <reinauer(a)chromium.org>
(cherry picked from commit c8127e4ac9811517f6147cf019ba6a948cdaa4a5)
Signed-off-by: Marc Jones <marc.jones(a)se-eng.com>
Change-Id: I44dacc10214351992b775aca52d6b776a74ee922
---
src/include/stddef.h | 7 +++++++
src/lib/lzma.c | 7 +------
src/lib/timestamp.c | 2 +-
src/vendorcode/google/chromeos/cros_vpd.c | 18 ++++--------------
src/vendorcode/google/chromeos/fmap.c | 5 +----
5 files changed, 14 insertions(+), 25 deletions(-)
diff --git a/src/include/stddef.h b/src/include/stddef.h
index 137de04..bd6c3ba 100644
--- a/src/include/stddef.h
+++ b/src/include/stddef.h
@@ -38,4 +38,11 @@ typedef unsigned int wint_t;
#define ROMSTAGE_CONST
#endif
+/* Work around non-writable data segment in execute-in-place romstage on x86. */
+#if defined(__PRE_RAM__) && CONFIG_ARCH_X86
+#define MAYBE_STATIC
+#else
+#define MAYBE_STATIC static
+#endif
+
#endif /* STDDEF_H */
diff --git a/src/lib/lzma.c b/src/lib/lzma.c
index ea5f15f..8efa1e6 100644
--- a/src/lib/lzma.c
+++ b/src/lib/lzma.c
@@ -24,12 +24,7 @@ unsigned long ulzma(unsigned char * src, unsigned char * dst)
int res;
CLzmaDecoderState state;
SizeT mallocneeds;
-#if !defined(__PRE_RAM__)
- /* in ramstage, this can go in BSS */
- static
-#endif
- /* in pre-ram, it must go on the stack */
- unsigned char scratchpad[15980];
+ MAYBE_STATIC unsigned char scratchpad[15980];
unsigned char *cp;
memcpy(properties, src, LZMA_PROPERTIES_SIZE);
diff --git a/src/lib/timestamp.c b/src/lib/timestamp.c
index f0ee48d..f7f92cd 100644
--- a/src/lib/timestamp.c
+++ b/src/lib/timestamp.c
@@ -60,7 +60,7 @@ static void timestamp_real_init(tsc_t base)
void timestamp_add(enum timestamp_id id, tsc_t ts_time)
{
struct timestamp_entry *tse;
- struct timestamp_table *ts_table = NULL;
+ MAYBE_STATIC struct timestamp_table *ts_table = NULL;
if (!boot_cpu())
return;
diff --git a/src/vendorcode/google/chromeos/cros_vpd.c b/src/vendorcode/google/chromeos/cros_vpd.c
index 26b01ee..df2b5bf 100644
--- a/src/vendorcode/google/chromeos/cros_vpd.c
+++ b/src/vendorcode/google/chromeos/cros_vpd.c
@@ -15,16 +15,6 @@
#include "lib_vpd.h"
#include "vpd_tables.h"
-/*
- * Static variables are available in ramstage (all platforms), and romstage for
- * some platforms (ex, ARM, which uses SRAM).
- */
-#if defined(__PRE_RAM__) && CONFIG_ARCH_X86
-#define STATIC_VAR
-#else
-#define STATIC_VAR static
-#endif
-
/* Currently we only support Google VPD 2.0, which has a fixed offset. */
enum {
GOOGLE_VPD_2_0_OFFSET = 0x600,
@@ -39,10 +29,10 @@ struct vpd_gets_arg {
static int cros_vpd_load(uint8_t **vpd_address, int32_t *vpd_size)
{
- STATIC_VAR int cached = 0;
- STATIC_VAR uint8_t *cached_address = NULL;
- STATIC_VAR int32_t cached_size = 0;
- STATIC_VAR int result = -1;
+ MAYBE_STATIC int cached = 0;
+ MAYBE_STATIC uint8_t *cached_address = NULL;
+ MAYBE_STATIC int32_t cached_size = 0;
+ MAYBE_STATIC int result = -1;
struct google_vpd_info info;
int32_t base;
diff --git a/src/vendorcode/google/chromeos/fmap.c b/src/vendorcode/google/chromeos/fmap.c
index bc56a19..8bea8f7 100644
--- a/src/vendorcode/google/chromeos/fmap.c
+++ b/src/vendorcode/google/chromeos/fmap.c
@@ -92,10 +92,7 @@ const struct fmap_area *find_fmap_area(const struct fmap *fmap,
int find_fmap_entry(const char name[], void **pointer)
{
-#ifndef __PRE_RAM__
- static
-#endif
- const struct fmap *fmap = NULL;
+ MAYBE_STATIC const struct fmap *fmap = NULL;
const struct fmap_area *area;
void *base = NULL;
the following patch was just integrated into master:
commit dafa12adfc567e71df83a2f5924f51a595db963c
Author: Nicolas Reinecke <nr(a)das-labor.org>
Date: Mon Dec 29 20:24:52 2014 +0100
intel/model_206ax: update microcode
tested on ivy and sandy (t520/t420s & t530)
Change-Id: Ie527e8c4804821764ecc42f7495573eff67828f7
Signed-off-by: Nicolas Reinecke <nr(a)das-labor.org>
Reviewed-on: http://review.coreboot.org/7976
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter(a)users.sourceforge.net>
Reviewed-by: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Reviewed-by: Ronald G. Minnich <rminnich(a)gmail.com>
Reviewed-by: Edward O'Callaghan <eocallaghan(a)alterapraxis.com>
See http://review.coreboot.org/7976 for details.
-gerrit
the following patch was just integrated into master:
commit 24a53dddb9b0b545ab9208722ff7b684114b4e91
Author: Vadim Bendebury <vbendeb(a)chromium.org>
Date: Tue May 27 18:03:38 2014 -0700
ipq806x: clean up UART driver tx_byte function
The driver as it was copied from u-boot provided a function to
transmit multiple characters in one invocation. This feature was not
ported to coreboot, there is no need to maintain the complexity when
only one character at a time is transmitted. It is also very desirable
to get rid of a 1024 byte array allocated on the stack.
The array was necessary to allow to convert multiple newline
characters in the transmit data flow into two character sequences
CRLF. Now just a single word is enough to keep one or two characters
to transmit.
[EDIT km: newline translation is now part of printk]
BUG=chrome-os-partner:27784
TEST=verified that coreboot with the new code prints generates console
output.
Original-Change-Id: I73869c5f4ca87210b34811b583386554bafff1e7
Original-Signed-off-by: Vadim Bendebury <vbendeb(a)chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/201782
Original-Reviewed-by: Stefan Reinauer <reinauer(a)chromium.org>
Original-Reviewed-by: Trevor Bourget <tbourget(a)codeaurora.org>
(cherry picked from commit eab3dc9d30c7e8355a2563e18ada78e4070e6151)
Signed-off-by: Marc Jones <marc.jones(a)se-eng.com>
Change-Id: I4274b8f7188bf9636906b39bcd9ec7adf0e1222e
Signed-off-by: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Reviewed-on: http://review.coreboot.org/8011
Tested-by: build bot (Jenkins)
Reviewed-by: Marc Jones <marc.jones(a)se-eng.com>
See http://review.coreboot.org/8011 for details.
-gerrit
the following patch was just integrated into master:
commit 0780d67ffe8ef754ace0912114e2b1e772554990
Author: Hung-Te Lin <hungte(a)chromium.org>
Date: Fri May 16 10:14:05 2014 +0800
util/cbfstool: Fix byte-ordering for payload type field.
In https://chromium-review.googlesource.com/181272 the payload->type has been
changed to big-endian (network ordering) but the cbfs_image is still parsing
type as host ordering, which caused printing cbfs image verbosely
(cbfstool imge print -v) to fail to find entry field and print numerous
garbage output.
Payload fields should be always parsed in big-endian (network ordering).
BUG=none
TEST=make; cbfstool image.bin print -v -v -v # see payloads correctly
Original-Change-Id: If1ac355b8847fb54988069f694bd2f317ce49a1a
Original-Signed-off-by: Hung-Te Lin <hungte(a)chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/200158
Original-Reviewed-by: Ronald Minnich <rminnich(a)chromium.org>
(cherry picked from commit 423f7dd28f8b071692d57401e144232d5ee2e479)
Signed-off-by: Marc Jones <marc.jones(a)se-eng.com>
Change-Id: I5a4694e887c7ff48d8d0713bb5808c29256141a9
Reviewed-on: http://review.coreboot.org/8005
Reviewed-by: Ronald G. Minnich <rminnich(a)gmail.com>
Tested-by: build bot (Jenkins)
See http://review.coreboot.org/8005 for details.
-gerrit