aboutsummaryrefslogtreecommitdiff
path: root/src/fw
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2017-04-19 15:36:09 -0700
committerKevin O'Connor <kevin@koconnor.net>2017-04-25 13:03:12 -0400
commit19fdcca467ad3436d68ef88899b4dcd78154a9c6 (patch)
tree6ce1909fc43904e05a10d12519e93e63d825bf12 /src/fw
parent5fbf246bdb9c1ee3f474d3f343e2a79db060c93c (diff)
downloadseabios-hppa-19fdcca467ad3436d68ef88899b4dcd78154a9c6.zip
seabios-hppa-19fdcca467ad3436d68ef88899b4dcd78154a9c6.tar.gz
seabios-hppa-19fdcca467ad3436d68ef88899b4dcd78154a9c6.tar.bz2
coreboot: Adapt to upstream CBMEM console changes
coreboot's CBMEM console format changed with https://review.coreboot.org/#/c/18301. This patch adapts the SeaBIOS implementation to support the new format. (SeaBIOS versions with this patch will continue to work fine with older version of coreboot. SeaBIOS versions without this patch may fail to log messages to the CBMEM console if run with newer versions of coreboot, but should not experience any more serious issues than that.) Signed-off-by: Julius Werner <jwerner@chromium.org>
Diffstat (limited to 'src/fw')
-rw-r--r--src/fw/coreboot.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/fw/coreboot.c b/src/fw/coreboot.c
index 4957b80..7214f8a 100644
--- a/src/fw/coreboot.c
+++ b/src/fw/coreboot.c
@@ -80,10 +80,12 @@ struct cb_cbmem_ref {
#define CB_TAG_CBMEM_CONSOLE 0x17
struct cbmem_console {
- u32 buffer_size;
- u32 buffer_cursor;
- u8 buffer_body[0];
+ u32 size;
+ u32 cursor;
+ u8 body[0];
} PACKED;
+#define CBMC_CURSOR_MASK ((1 << 28) - 1)
+#define CBMC_OVERFLOW (1 << 31)
static struct cbmem_console *cbcon = NULL;
static u16
@@ -220,9 +222,16 @@ void coreboot_debug_putc(char c)
return;
if (!cbcon)
return;
- u32 cursor = cbcon->buffer_cursor++;
- if (cursor < cbcon->buffer_size)
- cbcon->buffer_body[cursor] = c;
+ u32 cursor = cbcon->cursor & CBMC_CURSOR_MASK;
+ u32 flags = cbcon->cursor & ~CBMC_CURSOR_MASK;
+ if (cursor >= cbcon->size)
+ return; // Old coreboot version with legacy overflow mechanism.
+ cbcon->body[cursor++] = c;
+ if (cursor >= cbcon->size) {
+ cursor = 0;
+ flags |= CBMC_OVERFLOW;
+ }
+ cbcon->cursor = flags | cursor;
}
/****************************************************************