Commit e21a788e authored by Andre Przywara's avatar Andre Przywara
Browse files

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: default avatarAndre Przywara <andre.przywara@arm.com>
parent e8ada80a
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
* ----------------------------------------------- * -----------------------------------------------
*/ */
func console_cbmc_register func console_cbmc_register
str x0, [x1, #CONSOLE_T_CBMC_BASE] str x0, [x1, #CONSOLE_T_BASE]
ldr w2, [x0] ldr w2, [x0]
str w2, [x1, #CONSOLE_T_CBMC_SIZE] str w2, [x1, #CONSOLE_T_CBMC_SIZE]
mov x0, x1 mov x0, x1
...@@ -54,7 +54,7 @@ endfunc console_cbmc_register ...@@ -54,7 +54,7 @@ endfunc console_cbmc_register
*/ */
func console_cbmc_putc func console_cbmc_putc
ldr w2, [x1, #CONSOLE_T_CBMC_SIZE] 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 */ add x1, x1, #8 /* keep address of body in x1 */
ldr w16, [x1, #-4] /* load cursor (one u32 before body) */ ldr w16, [x1, #-4] /* load cursor (one u32 before body) */
...@@ -93,7 +93,7 @@ endfunc console_cbmc_putc ...@@ -93,7 +93,7 @@ endfunc console_cbmc_putc
func console_cbmc_flush func console_cbmc_flush
mov x5, x30 mov x5, x30
ldr x1, [x0, #CONSOLE_T_CBMC_SIZE] 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 */ add x1, x1, #8 /* add size of console header */
bl clean_dcache_range /* (clobbers x2 and x3) */ bl clean_dcache_range /* (clobbers x2 and x3) */
mov x0, #0 mov x0, #0
......
...@@ -9,14 +9,12 @@ ...@@ -9,14 +9,12 @@
#include <drivers/console.h> #include <drivers/console.h>
#define CONSOLE_T_CBMC_BASE CONSOLE_T_DRVDATA #define CONSOLE_T_CBMC_SIZE CONSOLE_T_DRVDATA
#define CONSOLE_T_CBMC_SIZE (CONSOLE_T_DRVDATA + REGSZ)
#ifndef __ASSEMBLER__ #ifndef __ASSEMBLER__
typedef struct { typedef struct {
console_t console; console_t console;
uintptr_t base;
uint32_t size; uint32_t size;
} console_cbmc_t; } console_cbmc_t;
......
...@@ -75,7 +75,7 @@ static void expand_and_mmap(uintptr_t baseaddr, size_t size) ...@@ -75,7 +75,7 @@ static void expand_and_mmap(uintptr_t baseaddr, size_t size)
static void setup_cbmem_console(uintptr_t baseaddr) static void setup_cbmem_console(uintptr_t baseaddr)
{ {
static console_cbmc_t console; 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. */ /* CBMEM console structure stores its size in first header field. */
uint32_t size = *(uint32_t *)baseaddr; uint32_t size = *(uint32_t *)baseaddr;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment