Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/37035 )
Change subject: lib/cbmem_console.c: Drop CAR_GLOBAL_MIGRATION support ......................................................................
lib/cbmem_console.c: Drop CAR_GLOBAL_MIGRATION support
Change-Id: I5c970a07c7114bff81f0048cac8eafaec35a2386 Signed-off-by: Arthur Heymans arthur@aheymans.xyz --- M src/lib/cbmem_console.c 1 file changed, 15 insertions(+), 25 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/35/37035/1
diff --git a/src/lib/cbmem_console.c b/src/lib/cbmem_console.c index 7876ff5..a75541c 100644 --- a/src/lib/cbmem_console.c +++ b/src/lib/cbmem_console.c @@ -49,7 +49,7 @@ _Static_assert(CONFIG_CONSOLE_CBMEM_BUFFER_SIZE <= MAX_SIZE, "cbmem_console format cannot support buffers larger than 256MB!");
-static struct cbmem_console *cbmem_console_p CAR_GLOBAL; +static struct cbmem_console *cbmem_console_p;
/* * While running from ROM, before DRAM is initialized, some area in cache as @@ -65,11 +65,6 @@ #define STATIC_CONSOLE_SIZE 1024 static u8 static_console[STATIC_CONSOLE_SIZE];
-static struct cbmem_console *current_console(void) -{ - return car_get_ptr(cbmem_console_p); -} - static void current_console_set(struct cbmem_console *new_console_p) { car_set_ptr(cbmem_console_p, new_console_p); @@ -112,21 +107,19 @@
void cbmemc_tx_byte(unsigned char data) { - struct cbmem_console *cbm_cons_p = current_console(); - - if (!cbm_cons_p || !cbm_cons_p->size) + if (!cbmem_console_p || !cbmem_console_p->size) return;
- u32 flags = cbm_cons_p->cursor & ~CURSOR_MASK; - u32 cursor = cbm_cons_p->cursor & CURSOR_MASK; + u32 flags = cbmem_console_p->cursor & ~CURSOR_MASK; + u32 cursor = cbmem_console_p->cursor & CURSOR_MASK;
- cbm_cons_p->body[cursor++] = data; - if (cursor >= cbm_cons_p->size) { + cbmem_console_p->body[cursor++] = data; + if (cursor >= cbmem_console_p->size) { cursor = 0; flags |= OVERFLOW; }
- cbm_cons_p->cursor = flags | cursor; + cbmem_console_p->cursor = flags | cursor; }
/* @@ -166,7 +159,7 @@ const size_t size = CONFIG_CONSOLE_CBMEM_BUFFER_SIZE; /* If CBMEM entry already existed, old contents are not altered. */ struct cbmem_console *cbmem_cons_p = cbmem_add(CBMEM_ID_CONSOLE, size); - struct cbmem_console *previous_cons_p = current_console(); + struct cbmem_console *previous_cons_p = cbmem_console_p;
init_console_ptr(cbmem_cons_p, size); copy_console_buffer(previous_cons_p); @@ -178,19 +171,16 @@ #if CONFIG(CONSOLE_CBMEM_DUMP_TO_UART) void cbmem_dump_console(void) { - struct cbmem_console *cbm_cons_p; u32 cursor; - - cbm_cons_p = current_console(); - if (!cbm_cons_p) + if (!cbmem_console_p) return;
uart_init(0); - if (cbm_cons_p->cursor & OVERFLOW) - for (cursor = cbm_cons_p->cursor & CURSOR_MASK; - cursor < cbm_cons_p->size; cursor++) - uart_tx_byte(0, cbm_cons_p->body[cursor]); - for (cursor = 0; cursor < (cbm_cons_p->cursor & CURSOR_MASK); cursor++) - uart_tx_byte(0, cbm_cons_p->body[cursor]); + if (cbmem_console_p->cursor & OVERFLOW) + for (cursor = cbmem_console_p->cursor & CURSOR_MASK; + cursor < cbmem_console_p->size; cursor++) + uart_tx_byte(0, cbmem_console_p->body[cursor]); + for (cursor = 0; cursor < (cbmem_console_p->cursor & CURSOR_MASK); cursor++) + uart_tx_byte(0, cbmem_console_p->body[cursor]); } #endif
Hello build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/37035
to look at the new patch set (#2).
Change subject: lib/cbmem_console.c: Drop CAR_GLOBAL_MIGRATION support ......................................................................
lib/cbmem_console.c: Drop CAR_GLOBAL_MIGRATION support
Change-Id: I5c970a07c7114bff81f0048cac8eafaec35a2386 Signed-off-by: Arthur Heymans arthur@aheymans.xyz --- M src/lib/cbmem_console.c 1 file changed, 16 insertions(+), 27 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/35/37035/2
Kyösti Mälkki has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37035 )
Change subject: lib/cbmem_console.c: Drop CAR_GLOBAL_MIGRATION support ......................................................................
Patch Set 8: Code-Review+2
Patrick Georgi has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37035 )
Change subject: lib/cbmem_console.c: Drop CAR_GLOBAL_MIGRATION support ......................................................................
Patch Set 8:
(1 comment)
https://review.coreboot.org/c/coreboot/+/37035/8/src/lib/cbmem_console.c File src/lib/cbmem_console.c:
https://review.coreboot.org/c/coreboot/+/37035/8/src/lib/cbmem_console.c@67 PS8, Line 67: current_console Any reason not to rename cbmem_console_p into current_console and replace current_console_set calls with assignments, too? The removal of current_console() leads to a weird asymmetry.
Patrick Georgi has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/37035 )
Change subject: lib/cbmem_console.c: Drop CAR_GLOBAL_MIGRATION support ......................................................................
Patch Set 9:
(1 comment)
https://review.coreboot.org/c/coreboot/+/37035/8/src/lib/cbmem_console.c File src/lib/cbmem_console.c:
https://review.coreboot.org/c/coreboot/+/37035/8/src/lib/cbmem_console.c@67 PS8, Line 67: current_console
Any reason not to rename cbmem_console_p into current_console and replace current_console_set calls […]
If we want to go that route, CB:37374 does it.
Patrick Georgi has submitted this change. ( https://review.coreboot.org/c/coreboot/+/37035 )
Change subject: lib/cbmem_console.c: Drop CAR_GLOBAL_MIGRATION support ......................................................................
lib/cbmem_console.c: Drop CAR_GLOBAL_MIGRATION support
Change-Id: I5c970a07c7114bff81f0048cac8eafaec35a2386 Signed-off-by: Arthur Heymans arthur@aheymans.xyz Reviewed-on: https://review.coreboot.org/c/coreboot/+/37035 Reviewed-by: Kyösti Mälkki kyosti.malkki@gmail.com Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M src/lib/cbmem_console.c 1 file changed, 16 insertions(+), 27 deletions(-)
Approvals: build bot (Jenkins): Verified Kyösti Mälkki: Looks good to me, approved
diff --git a/src/lib/cbmem_console.c b/src/lib/cbmem_console.c index 7876ff5..7bd247d 100644 --- a/src/lib/cbmem_console.c +++ b/src/lib/cbmem_console.c @@ -16,7 +16,6 @@ #include <console/cbmem_console.h> #include <console/uart.h> #include <cbmem.h> -#include <arch/early_variables.h> #include <symbols.h>
/* @@ -49,7 +48,7 @@ _Static_assert(CONFIG_CONSOLE_CBMEM_BUFFER_SIZE <= MAX_SIZE, "cbmem_console format cannot support buffers larger than 256MB!");
-static struct cbmem_console *cbmem_console_p CAR_GLOBAL; +static struct cbmem_console *cbmem_console_p;
/* * While running from ROM, before DRAM is initialized, some area in cache as @@ -65,14 +64,9 @@ #define STATIC_CONSOLE_SIZE 1024 static u8 static_console[STATIC_CONSOLE_SIZE];
-static struct cbmem_console *current_console(void) -{ - return car_get_ptr(cbmem_console_p); -} - static void current_console_set(struct cbmem_console *new_console_p) { - car_set_ptr(cbmem_console_p, new_console_p); + cbmem_console_p = new_console_p; }
static int buffer_valid(struct cbmem_console *cbm_cons_p, u32 total_space) @@ -112,21 +106,19 @@
void cbmemc_tx_byte(unsigned char data) { - struct cbmem_console *cbm_cons_p = current_console(); - - if (!cbm_cons_p || !cbm_cons_p->size) + if (!cbmem_console_p || !cbmem_console_p->size) return;
- u32 flags = cbm_cons_p->cursor & ~CURSOR_MASK; - u32 cursor = cbm_cons_p->cursor & CURSOR_MASK; + u32 flags = cbmem_console_p->cursor & ~CURSOR_MASK; + u32 cursor = cbmem_console_p->cursor & CURSOR_MASK;
- cbm_cons_p->body[cursor++] = data; - if (cursor >= cbm_cons_p->size) { + cbmem_console_p->body[cursor++] = data; + if (cursor >= cbmem_console_p->size) { cursor = 0; flags |= OVERFLOW; }
- cbm_cons_p->cursor = flags | cursor; + cbmem_console_p->cursor = flags | cursor; }
/* @@ -166,7 +158,7 @@ const size_t size = CONFIG_CONSOLE_CBMEM_BUFFER_SIZE; /* If CBMEM entry already existed, old contents are not altered. */ struct cbmem_console *cbmem_cons_p = cbmem_add(CBMEM_ID_CONSOLE, size); - struct cbmem_console *previous_cons_p = current_console(); + struct cbmem_console *previous_cons_p = cbmem_console_p;
init_console_ptr(cbmem_cons_p, size); copy_console_buffer(previous_cons_p); @@ -178,19 +170,16 @@ #if CONFIG(CONSOLE_CBMEM_DUMP_TO_UART) void cbmem_dump_console(void) { - struct cbmem_console *cbm_cons_p; u32 cursor; - - cbm_cons_p = current_console(); - if (!cbm_cons_p) + if (!cbmem_console_p) return;
uart_init(0); - if (cbm_cons_p->cursor & OVERFLOW) - for (cursor = cbm_cons_p->cursor & CURSOR_MASK; - cursor < cbm_cons_p->size; cursor++) - uart_tx_byte(0, cbm_cons_p->body[cursor]); - for (cursor = 0; cursor < (cbm_cons_p->cursor & CURSOR_MASK); cursor++) - uart_tx_byte(0, cbm_cons_p->body[cursor]); + if (cbmem_console_p->cursor & OVERFLOW) + for (cursor = cbmem_console_p->cursor & CURSOR_MASK; + cursor < cbmem_console_p->size; cursor++) + uart_tx_byte(0, cbmem_console_p->body[cursor]); + for (cursor = 0; cursor < (cbmem_console_p->cursor & CURSOR_MASK); cursor++) + uart_tx_byte(0, cbmem_console_p->body[cursor]); } #endif