From e21a788ee197ec66f6b8552e2274297bf4a095a8 Mon Sep 17 00:00:00 2001 From: Andre Przywara Date: Sat, 25 Jan 2020 01:07:19 +0000 Subject: [PATCH] coreboot: Use generic base address Since now the generic console_t structure holds the UART base address as well, let's use that generic location for the coreboot memory console. This removes the base member from the coreboot specific data structure, but keeps the struct console_cbmc_t and its size member. Change-Id: I7f1dffd41392ba3fe5c07090aea761a42313fb5b Signed-off-by: Andre Przywara --- drivers/coreboot/cbmem_console/aarch64/cbmem_console.S | 6 +++--- include/drivers/coreboot/cbmem_console.h | 4 +--- lib/coreboot/coreboot_table.c | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/coreboot/cbmem_console/aarch64/cbmem_console.S b/drivers/coreboot/cbmem_console/aarch64/cbmem_console.S index fd04c2e7e..a4a7bf8f3 100644 --- a/drivers/coreboot/cbmem_console/aarch64/cbmem_console.S +++ b/drivers/coreboot/cbmem_console/aarch64/cbmem_console.S @@ -35,7 +35,7 @@ * ----------------------------------------------- */ func console_cbmc_register - str x0, [x1, #CONSOLE_T_CBMC_BASE] + str x0, [x1, #CONSOLE_T_BASE] ldr w2, [x0] str w2, [x1, #CONSOLE_T_CBMC_SIZE] mov x0, x1 @@ -54,7 +54,7 @@ endfunc console_cbmc_register */ func console_cbmc_putc ldr w2, [x1, #CONSOLE_T_CBMC_SIZE] - ldr x1, [x1, #CONSOLE_T_CBMC_BASE] + ldr x1, [x1, #CONSOLE_T_BASE] add x1, x1, #8 /* keep address of body in x1 */ ldr w16, [x1, #-4] /* load cursor (one u32 before body) */ @@ -93,7 +93,7 @@ endfunc console_cbmc_putc func console_cbmc_flush mov x5, x30 ldr x1, [x0, #CONSOLE_T_CBMC_SIZE] - ldr x0, [x0, #CONSOLE_T_CBMC_BASE] + ldr x0, [x0, #CONSOLE_T_BASE] add x1, x1, #8 /* add size of console header */ bl clean_dcache_range /* (clobbers x2 and x3) */ mov x0, #0 diff --git a/include/drivers/coreboot/cbmem_console.h b/include/drivers/coreboot/cbmem_console.h index 40c90e6bb..30b39f14d 100644 --- a/include/drivers/coreboot/cbmem_console.h +++ b/include/drivers/coreboot/cbmem_console.h @@ -9,14 +9,12 @@ #include -#define CONSOLE_T_CBMC_BASE CONSOLE_T_DRVDATA -#define CONSOLE_T_CBMC_SIZE (CONSOLE_T_DRVDATA + REGSZ) +#define CONSOLE_T_CBMC_SIZE CONSOLE_T_DRVDATA #ifndef __ASSEMBLER__ typedef struct { console_t console; - uintptr_t base; uint32_t size; } console_cbmc_t; diff --git a/lib/coreboot/coreboot_table.c b/lib/coreboot/coreboot_table.c index 63bdc6359..253fac2ac 100644 --- a/lib/coreboot/coreboot_table.c +++ b/lib/coreboot/coreboot_table.c @@ -75,7 +75,7 @@ static void expand_and_mmap(uintptr_t baseaddr, size_t size) static void setup_cbmem_console(uintptr_t baseaddr) { static console_cbmc_t console; - assert(!console.base); /* should only have one CBMEM console */ + assert(!console.console.base); /* should only have one CBMEM console */ /* CBMEM console structure stores its size in first header field. */ uint32_t size = *(uint32_t *)baseaddr;