Stefan Reinauer (stefan.reinauer(a)coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4144
-gerrit
commit ccc89fc7ae090f1c044b9dd9a502a11754085d46
Author: Gabe Black <gabeblack(a)google.com>
Date: Thu Apr 25 17:21:58 2013 -0700
elog: Make sure the elog data structures are initialized in elog_clear.
If elog_clear is called before other elog functions, for instance if it's
called through an SMI immediately after the system boots, then the elog data
structures won't have been set up and the system will go off the deep end.
This change adds a call to elog_init to elog_clear to make sure things things
are always initialized before we start using them.
Before this change, this command would cause
the system to lock up if run immediately after boot:
echo 1 > /sys/firmware/gsmi/clear_eventlog
After this change, that results in the log being cleared correctly.
Change-Id: I45027f0dbfa40ca8c581954a93b14b4fedce91ed
Signed-off-by: Gabe Black <gabeblack(a)google.com>
Reviewed-on: https://gerrit.chromium.org/gerrit/49303
Reviewed-by: Duncan Laurie <dlaurie(a)chromium.org>
Reviewed-by: Stefan Reinauer <reinauer(a)google.com>
Commit-Queue: Gabe Black <gabeblack(a)chromium.org>
Tested-by: Gabe Black <gabeblack(a)chromium.org>
---
src/drivers/elog/elog.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/drivers/elog/elog.c b/src/drivers/elog/elog.c
index 6e89b5f..6de5123 100644
--- a/src/drivers/elog/elog.c
+++ b/src/drivers/elog/elog.c
@@ -746,6 +746,10 @@ int elog_clear(void)
elog_debug("elog_clear()\n");
+ /* Make sure ELOG structures are initialized */
+ if (elog_init() < 0)
+ return -1;
+
/* Erase flash area */
elog_flash_erase_area();
Stefan Reinauer (stefan.reinauer(a)coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4141
-gerrit
commit 0cdd6d04441003aaf57d52fbefb8228cf5c444aa
Author: Aaron Durbin <adurbin(a)chromium.org>
Date: Tue Apr 23 10:25:34 2013 -0500
x86: use proper types for interrupt callbacks
The mainboard_interrupt_handlers() argument for the function
pointer was using void * as the type. This does not allow the compiler
to catch type differences for the arguments. Thus, some code has been
committed which violates the new interrupt callbacks not taking any
arguments. Make sure the compiler provides a type checking benefit.
Change-Id: Ie20699a368e70c33a9a9912e0fcd63f1e6bb4f18
Signed-off-by: Aaron Durbin <adurbin(a)chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/48970
---
src/arch/x86/include/arch/interrupt.h | 4 ++--
src/device/oprom/realmode/x86.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/arch/x86/include/arch/interrupt.h b/src/arch/x86/include/arch/interrupt.h
index 8c9b4a9..9753c50 100644
--- a/src/arch/x86/include/arch/interrupt.h
+++ b/src/arch/x86/include/arch/interrupt.h
@@ -23,9 +23,9 @@
/* setup interrupt handlers for mainboard */
#if CONFIG_PCI_OPTION_ROM_RUN_REALMODE
-extern void mainboard_interrupt_handlers(int intXX, void *intXX_func);
+extern void mainboard_interrupt_handlers(int intXX, int (*intXX_func)(void));
#elif CONFIG_PCI_OPTION_ROM_RUN_YABEL
#include <device/oprom/yabel/biosemu.h>
#else
-static inline void mainboard_interrupt_handlers(int intXX, void *intXX_func) { }
+static inline void mainboard_interrupt_handlers(int intXX, int (*intXX_func)(void)) { }
#endif
diff --git a/src/device/oprom/realmode/x86.c b/src/device/oprom/realmode/x86.c
index 338294d..4385c03 100644
--- a/src/device/oprom/realmode/x86.c
+++ b/src/device/oprom/realmode/x86.c
@@ -118,7 +118,7 @@ static int intXX_unknown_handler(void)
}
/* setup interrupt handlers for mainboard */
-void mainboard_interrupt_handlers(int intXX, void *intXX_func)
+void mainboard_interrupt_handlers(int intXX, int (*intXX_func)(void))
{
intXX_handler[intXX] = intXX_func;
}
Stefan Reinauer (stefan.reinauer(a)coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/4139
-gerrit
commit 6a7dfb2ec77be337a29f08e3f2179d8010fd2125
Author: Stefan Reinauer <reinauer(a)chromium.org>
Date: Fri Apr 19 14:22:29 2013 -0700
cbmem utility: compatibility with older coreboot versions
Commit b8ad224 changed the memory address in lb_cbmem_ref coreboot
table entries from a pointer to a uint64_t. This change was introduced
to make the cbmem utility work on both 32bit and 64bit userland.
Unfortunately, this broke the cbmem utility running on older versions
of coreboot because they were still providing a 32bit only field for
the address while the cbmem utility would now take the following 4
bytes as upper 32bits of a pointer that can obviously not be
mmapped. This change checks if the size of the lb_cbmem_ref structure
provided by coreboot is smaller than expected, and if so, ignore the
upper 32bit of the address read.
Signed-off-by: Stefan Reinauer <reinauer(a)google.com>
Change-Id: If4c8e9b72b2a38c961c11d7071b728e61e5f1d18
Commit-Queue: Stefan Reinauer <reinauer(a)google.com>
Tested-by: Stefan Reinauer <reinauer(a)google.com>
Reviewed-by: Aaron Durbin <adurbin(a)chromium.org>
---
util/cbmem/cbmem.c | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/util/cbmem/cbmem.c b/util/cbmem/cbmem.c
index 74e0fd4..e05a72a 100644
--- a/util/cbmem/cbmem.c
+++ b/util/cbmem/cbmem.c
@@ -22,6 +22,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <inttypes.h>
#include <getopt.h>
#include <errno.h>
#include <fcntl.h>
@@ -128,6 +129,25 @@ static struct lb_cbmem_ref timestamps;
static struct lb_cbmem_ref console;
static struct lb_memory_range cbmem;
+/* This is a work-around for a nasty problem introduced by initially having
+ * pointer sized entries in the lb_cbmem_ref structures. This caused problems
+ * on 64bit x86 systems because coreboot is 32bit on those systems.
+ * When the problem was found, it was corrected, but there are a lot of
+ * systems out there with a firmware that does not produce the right
+ * lb_cbmem_ref structure. Hence we try to autocorrect this issue here.
+ */
+static struct lb_cbmem_ref parse_cbmem_ref(struct lb_cbmem_ref *cbmem_ref)
+{
+ struct lb_cbmem_ref ret;
+
+ ret = *cbmem_ref;
+
+ if (cbmem_ref->size < sizeof(*cbmem_ref))
+ ret.cbmem_addr = (uint32_t)ret.cbmem_addr;
+
+ return ret;
+}
+
static int parse_cbtable(u64 address)
{
int i, found = 0;
@@ -184,12 +204,12 @@ static int parse_cbtable(u64 address)
}
case LB_TAG_TIMESTAMPS: {
debug(" Found timestamp table.\n");
- timestamps = *(struct lb_cbmem_ref *) lbr_p;
+ timestamps = parse_cbmem_ref((struct lb_cbmem_ref *) lbr_p);
continue;
}
case LB_TAG_CBMEM_CONSOLE: {
debug(" Found cbmem console.\n");
- console = *(struct lb_cbmem_ref *) lbr_p;
+ console = parse_cbmem_ref((struct lb_cbmem_ref *) lbr_p);
continue;
}
case LB_TAG_FORWARD: {