aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2013-06-24 11:24:57 +0200
committerKevin O'Connor <kevin@koconnor.net>2013-07-14 14:31:16 -0400
commitebf03f7fb15a3d04950a96e62901e420c2e2d425 (patch)
tree599e126f416544cb0eb2fe657b946bd203cac992
parent2a9aeabdfb34374ecac25e7a8d21c9e368618cd4 (diff)
downloadseabios-ebf03f7fb15a3d04950a96e62901e420c2e2d425.tar.gz
coreboot: add cbmem console support
Add support for logging to the coreboot cbmem console. Limitation: only supported in 32bit mode. Use 'cbmem -c' to see the logs (coreboot and seabios) after bootup. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
-rw-r--r--src/coreboot.c32
-rw-r--r--src/output.c2
-rw-r--r--src/util.h1
3 files changed, 35 insertions, 0 deletions
diff --git a/src/coreboot.c b/src/coreboot.c
index 6ad4cfc..c66e6e3 100644
--- a/src/coreboot.c
+++ b/src/coreboot.c
@@ -69,6 +69,21 @@ struct cb_forward {
#define CB_TAG_FORWARD 0x11
+struct cb_cbmem_ref {
+ u32 tag;
+ u32 size;
+ u64 cbmem_addr;
+};
+
+#define CB_TAG_CBMEM_CONSOLE 0x17
+
+struct cbmem_console {
+ u32 buffer_size;
+ u32 buffer_cursor;
+ u8 buffer_body[0];
+} PACKED;
+static struct cbmem_console *cbcon = NULL;
+
static u16
ipchksum(char *buf, int count)
{
@@ -162,6 +177,13 @@ coreboot_preinit(void)
// confuses grub. So, override it.
add_e820(0, 16*1024, E820_RAM);
+ struct cb_cbmem_ref *cbref = find_cb_subtable(cbh, CB_TAG_CBMEM_CONSOLE);
+ if (cbref) {
+ cbcon = (void*)(u32)cbref->cbmem_addr;
+ dprintf(1, "----- [ seabios log starts here ] -----\n");
+ dprintf(1, "Found coreboot cbmem console @ %llx\n", cbref->cbmem_addr);
+ }
+
struct cb_mainboard *cbmb = find_cb_subtable(cbh, CB_TAG_MAINBOARD);
if (cbmb) {
CBvendor = &cbmb->strings[cbmb->vendor_idx];
@@ -182,6 +204,16 @@ fail:
return;
}
+void debug_cbmem(char c)
+{
+ if (!CONFIG_COREBOOT)
+ return;
+ if (!cbcon)
+ return;
+ if (cbcon->buffer_cursor == cbcon->buffer_size)
+ return;
+ cbcon->buffer_body[cbcon->buffer_cursor++] = c;
+}
/****************************************************************
* BIOS table copying
diff --git a/src/output.c b/src/output.c
index d548766..fb2dd76 100644
--- a/src/output.c
+++ b/src/output.c
@@ -81,6 +81,8 @@ putc_debug(struct putcinfo *action, char c)
if (CONFIG_DEBUG_IO && runningOnQEMU())
// Send character to debug port.
outb(c, GET_GLOBAL(DebugOutputPort));
+ if (!MODESEGMENT)
+ debug_cbmem(c);
if (c == '\n')
debug_serial('\r');
debug_serial(c);
diff --git a/src/util.h b/src/util.h
index 996c29a..8bde0b2 100644
--- a/src/util.h
+++ b/src/util.h
@@ -327,6 +327,7 @@ int apic_id_is_present(u8 apic_id);
// coreboot.c
extern const char *CBvendor, *CBpart;
struct cbfs_file;
+void debug_cbmem(char c);
void cbfs_run_payload(struct cbfs_file *file);
void coreboot_platform_setup(void);
void cbfs_payload_setup(void);