Merge changes from topic "console_t_cleanup" into integration

* changes:
  marvell: Consolidate console register calls
  uniphier: Use generic console_t data structure
  spe: Use generic console_t data structure
  LS 16550: Use generic console_t data structure
  stm32: Use generic console_t data structure
  rcar: Use generic console_t data structure
  a3700: Use generic console_t data structure
  16550: Use generic console_t data structure
  imx: Use generic console_t data structure
This commit is contained in:
Mark Dykes 2020-02-25 23:39:33 +00:00 committed by TrustedFirmware Code Review
commit 896d684de6
47 changed files with 136 additions and 211 deletions

View File

@ -154,15 +154,10 @@
#ifndef __ASSEMBLER__
typedef struct {
console_t console;
uintptr_t base;
} console_imx_uart_t;
int console_imx_uart_register(uintptr_t baseaddr,
uint32_t clock,
uint32_t baud,
console_imx_uart_t *console);
console_t *console);
#endif /*__ASSEMBLER__*/
#endif /* IMX_UART_H */

View File

@ -110,7 +110,7 @@ endfunc console_a3700_core_init
.globl console_a3700_register
/* -----------------------------------------------
* int console_a3700_register(console_16550_t *console,
* int console_a3700_register(console_t *console,
uintptr_t base, uint32_t clk, uint32_t baud)
* Function to initialize and register a new a3700
* console. Storage passed in for the console struct
@ -118,7 +118,7 @@ endfunc console_a3700_core_init
* In: x0 - UART register base address
* w1 - UART clock in Hz
* w2 - Baud rate
* x3 - pointer to empty console_a3700_t struct
* x3 - pointer to empty console_t struct
* Out: return 1 on success, 0 on error
* Clobber list : x0, x1, x2, x6, x7, x14
* -----------------------------------------------
@ -127,7 +127,7 @@ func console_a3700_register
mov x7, x30
mov x6, x3
cbz x6, register_fail
str x0, [x6, #CONSOLE_T_A3700_BASE]
str x0, [x6, #CONSOLE_T_BASE]
bl console_a3700_core_init
cbz x0, register_fail
@ -178,7 +178,7 @@ putc_error:
endfunc console_a3700_core_putc
/* --------------------------------------------------------
* int console_a3700_putc(int c, console_a3700_t *console)
* int console_a3700_putc(int c, console_t *console)
* Function to output a character over the console. It
* returns the character printed on success or -1 on error.
* In : w0 - character to be printed
@ -188,7 +188,7 @@ endfunc console_a3700_core_putc
* --------------------------------------------------------
*/
func console_a3700_putc
ldr x1, [x1, #CONSOLE_T_A3700_BASE]
ldr x1, [x1, #CONSOLE_T_BASE]
b console_a3700_core_putc
endfunc console_a3700_putc
@ -208,7 +208,7 @@ func console_a3700_core_getc
endfunc console_a3700_core_getc
/* ---------------------------------------------
* int console_a3700_getc(console_a3700_t *console)
* int console_a3700_getc(console_t *console)
* Function to get a character from the console.
* It returns the character grabbed on success
* or -1 on if no character is available.
@ -218,7 +218,7 @@ endfunc console_a3700_core_getc
* ---------------------------------------------
*/
func console_a3700_getc
ldr x0, [x0, #CONSOLE_T_A3700_BASE]
ldr x0, [x0, #CONSOLE_T_BASE]
b console_a3700_core_getc
endfunc console_a3700_getc
@ -237,7 +237,7 @@ func console_a3700_core_flush
endfunc console_a3700_core_flush
/* ---------------------------------------------
* int console_a3700_flush(console_a3700_t *console)
* int console_a3700_flush(console_t *console)
* Function to force a write of all buffered
* data that hasn't been output.
* In : x0 - pointer to console_t structure
@ -246,7 +246,7 @@ endfunc console_a3700_core_flush
* ---------------------------------------------
*/
func console_a3700_flush
ldr x0, [x0, #CONSOLE_T_A3700_BASE]
ldr x0, [x0, #CONSOLE_T_BASE]
b console_a3700_core_flush
endfunc console_a3700_flush

View File

@ -20,14 +20,14 @@
/* -----------------------------------------------
* int console_rcar_register(
* uintptr_t base, uint32_t clk, uint32_t baud,
* console_rcar_t *console)
* console_t *console)
* Function to initialize and register a new rcar
* console. Storage passed in for the console struct
* *must* be persistent (i.e. not from the stack).
* In: x0 - UART register base address
* w1 - UART clock in Hz
* w2 - Baud rate
* x3 - pointer to empty console_rcar_t struct
* x3 - pointer to empty console_t struct
* Out: return 1 on success, 0 on error
* Clobber list : x0, x1, x2, x6, x7, x14
* -----------------------------------------------
@ -36,7 +36,7 @@ func console_rcar_register
mov x7, x30
mov x6, x3
cbz x6, register_fail
str x0, [x6, #CONSOLE_T_RCAR_BASE]
str x0, [x6, #CONSOLE_T_BASE]
bl rcar_log_init
cbz x0, register_fail
@ -68,11 +68,11 @@ func console_rcar_init
endfunc console_rcar_init
/* --------------------------------------------------------
* int console_rcar_putc(int c, console_rcar_t *console)
* int console_rcar_putc(int c, console_t *console)
* Function to output a character over the console. It
* returns the character printed on success or -1 on error.
* In : w0 - character to be printed
* x1 - pointer to console_rcar_t structure
* x1 - pointer to console_t structure
* Out : return -1 on error else return character.
* Clobber list : x2
* --------------------------------------------------------

View File

@ -126,14 +126,14 @@
/* -----------------------------------------------
* int console_rcar_register(
* uintptr_t base, uint32_t clk, uint32_t baud,
* console_rcar_t *console)
* console_t *console)
* Function to initialize and register a new rcar
* console. Storage passed in for the console struct
* *must* be persistent (i.e. not from the stack).
* In: x0 - UART register base address
* w1 - UART clock in Hz
* w2 - Baud rate
* x3 - pointer to empty console_rcar_t struct
* x3 - pointer to empty console_t struct
* Out: return 1 on success, 0 on error
* Clobber list : x0, x1, x2, x6, x7, x14
* -----------------------------------------------
@ -142,7 +142,7 @@ func console_rcar_register
mov x7, x30
mov x6, x3
cbz x6, register_fail
str x0, [x6, #CONSOLE_T_RCAR_BASE]
str x0, [x6, #CONSOLE_T_BASE]
bl console_rcar_init

View File

@ -91,14 +91,14 @@ endfunc console_stm32_core_init
/* -------------------------------------------------------
* int console_stm32_register(uintptr_t baseaddr,
* uint32_t clock, uint32_t baud,
* struct console_stm32 *console);
* console_t *console);
* Function to initialize and register a new STM32
* console. Storage passed in for the console struct
* *must* be persistent (i.e. not from the stack).
* In: r0 - UART register base address
* r1 - UART clock in Hz
* r2 - Baud rate
* r3 - pointer to empty console_stm32 struct
* r3 - pointer to empty console_t struct
* Out: return 1 on success, 0 on error
* Clobber list : r0, r1, r2
* -------------------------------------------------------
@ -108,7 +108,7 @@ func console_stm32_register
mov r4, r3
cmp r4, #0
beq register_fail
str r0, [r4, #CONSOLE_T_STM32_BASE]
str r0, [r4, #CONSOLE_T_BASE]
bl console_stm32_core_init
cmp r0, #0
@ -157,7 +157,7 @@ putc_error:
endfunc console_stm32_core_putc
/* ------------------------------------------------------------
* int console_stm32_putc(int c, struct console_stm32 *console)
* int console_stm32_putc(int c, console_t *console)
* Function to output a character over the console. It
* returns the character printed on success or -1 on error.
* In: r0 - character to be printed
@ -171,7 +171,7 @@ func console_stm32_putc
cmp r1, #0
ASM_ASSERT(ne)
#endif /* ENABLE_ASSERTIONS */
ldr r1, [r1, #CONSOLE_T_STM32_BASE]
ldr r1, [r1, #CONSOLE_T_BASE]
b console_stm32_core_putc
endfunc console_stm32_putc
@ -219,7 +219,7 @@ flush_error:
endfunc console_stm32_core_flush
/* ------------------------------------------------------
* int console_stm32_flush(struct console_stm32 *console)
* int console_stm32_flush(console_t *console)
* Function to force a write of all buffered
* data that hasn't been output.
* In : r0 - pointer to console_t structure
@ -232,6 +232,6 @@ func console_stm32_flush
cmp r0, #0
ASM_ASSERT(ne)
#endif /* ENABLE_ASSERTIONS */
ldr r0, [r0, #CONSOLE_T_STM32_BASE]
ldr r0, [r0, #CONSOLE_T_BASE]
b console_stm32_core_flush
endfunc console_stm32_flush

View File

@ -91,7 +91,7 @@ endfunc console_16550_core_init
/* -------------------------------------------------------
* int console_16550_register(uintptr_t baseaddr,
* uint32_t clock, uint32_t baud,
* console_16550_t *console);
* console_t *console);
* Function to initialize and register a new 16550
* console. Storage passed in for the console struct
* *must* be persistent (i.e. not from the stack).
@ -101,7 +101,7 @@ endfunc console_16550_core_init
* In: r0 - UART register base address
* r1 - UART clock in Hz
* r2 - Baud rate (ignored if r1 is 0)
* r3 - pointer to empty console_16550_t struct
* r3 - pointer to empty console_t struct
* Out: return 1 on success, 0 on error
* Clobber list : r0, r1, r2
* -------------------------------------------------------
@ -111,7 +111,7 @@ func console_16550_register
mov r4, r3
cmp r4, #0
beq register_fail
str r0, [r4, #CONSOLE_T_16550_BASE]
str r0, [r4, #CONSOLE_T_BASE]
/* A clock rate of zero means to skip the initialisation. */
cmp r1, #0
@ -167,7 +167,7 @@ func console_16550_core_putc
endfunc console_16550_core_putc
/* --------------------------------------------------------
* int console_16550_putc(int c, console_16550_t *console)
* int console_16550_putc(int c, console_t *console)
* Function to output a character over the console. It
* returns the character printed on success or -1 on error.
* In : r0 - character to be printed
@ -181,7 +181,7 @@ func console_16550_putc
cmp r1, #0
ASM_ASSERT(ne)
#endif /* ENABLE_ASSERTIONS */
ldr r1, [r1, #CONSOLE_T_16550_BASE]
ldr r1, [r1, #CONSOLE_T_BASE]
b console_16550_core_putc
endfunc console_16550_putc
@ -213,7 +213,7 @@ no_char:
endfunc console_16550_core_getc
/* ---------------------------------------------
* int console_16550_getc(console_16550_t *console)
* int console_16550_getc(console_t *console)
* Function to get a character from the console.
* It returns the character grabbed on success
* or -1 on if no character is available.
@ -227,7 +227,7 @@ func console_16550_getc
cmp r0, #0
ASM_ASSERT(ne)
#endif /* ENABLE_ASSERTIONS */
ldr r0, [r0, #CONSOLE_T_16550_BASE]
ldr r0, [r0, #CONSOLE_T_BASE]
b console_16550_core_getc
endfunc console_16550_getc
@ -257,7 +257,7 @@ func console_16550_core_flush
endfunc console_16550_core_flush
/* ---------------------------------------------
* int console_16550_flush(console_pl011_t *console)
* int console_16550_flush(console_t *console)
* Function to force a write of all buffered
* data that hasn't been output.
* In : r0 - pointer to console_t structure
@ -270,6 +270,6 @@ func console_16550_flush
cmp r0, #0
ASM_ASSERT(ne)
#endif /* ENABLE_ASSERTIONS */
ldr r0, [r0, #CONSOLE_T_16550_BASE]
ldr r0, [r0, #CONSOLE_T_BASE]
b console_16550_core_flush
endfunc console_16550_flush

View File

@ -88,7 +88,7 @@ endfunc console_16550_core_init
/* -----------------------------------------------
* int console_16550_register(uintptr_t baseaddr,
* uint32_t clock, uint32_t baud,
* console_16550_t *console);
* console_t *console);
* Function to initialize and register a new 16550
* console. Storage passed in for the console struct
* *must* be persistent (i.e. not from the stack).
@ -98,7 +98,7 @@ endfunc console_16550_core_init
* In: x0 - UART register base address
* w1 - UART clock in Hz
* w2 - Baud rate (ignored if w1 is 0)
* x3 - pointer to empty console_16550_t struct
* x3 - pointer to empty console_t struct
* Out: return 1 on success, 0 on error
* Clobber list : x0, x1, x2, x6, x7, x14
* -----------------------------------------------
@ -107,7 +107,7 @@ func console_16550_register
mov x7, x30
mov x6, x3
cbz x6, register_fail
str x0, [x6, #CONSOLE_T_16550_BASE]
str x0, [x6, #CONSOLE_T_BASE]
/* A clock rate of zero means to skip the initialisation. */
cbz w1, register_16550
@ -161,7 +161,7 @@ func console_16550_core_putc
endfunc console_16550_core_putc
/* --------------------------------------------------------
* int console_16550_putc(int c, console_16550_t *console)
* int console_16550_putc(int c, console_t *console)
* Function to output a character over the console. It
* returns the character printed on success or -1 on error.
* In : w0 - character to be printed
@ -175,7 +175,7 @@ func console_16550_putc
cmp x1, #0
ASM_ASSERT(ne)
#endif /* ENABLE_ASSERTIONS */
ldr x1, [x1, #CONSOLE_T_16550_BASE]
ldr x1, [x1, #CONSOLE_T_BASE]
b console_16550_core_putc
endfunc console_16550_putc
@ -206,7 +206,7 @@ no_char:
endfunc console_16550_core_getc
/* ---------------------------------------------
* int console_16550_getc(console_16550_t *console)
* int console_16550_getc(console_t *console)
* Function to get a character from the console.
* It returns the character grabbed on success
* or -1 on if no character is available.
@ -220,7 +220,7 @@ func console_16550_getc
cmp x1, #0
ASM_ASSERT(ne)
#endif /* ENABLE_ASSERTIONS */
ldr x0, [x0, #CONSOLE_T_16550_BASE]
ldr x0, [x0, #CONSOLE_T_BASE]
b console_16550_core_getc
endfunc console_16550_getc
@ -250,7 +250,7 @@ func console_16550_core_flush
endfunc console_16550_core_flush
/* ---------------------------------------------
* int console_16550_flush(console_pl011_t *console)
* int console_16550_flush(console_t *console)
* Function to force a write of all buffered
* data that hasn't been output.
* In : x0 - pointer to console_t structure
@ -263,6 +263,6 @@ func console_16550_flush
cmp x0, #0
ASM_ASSERT(ne)
#endif /* ENABLE_ASSERTIONS */
ldr x0, [x0, #CONSOLE_T_16550_BASE]
ldr x0, [x0, #CONSOLE_T_BASE]
b console_16550_core_flush
endfunc console_16550_flush

View File

@ -54,17 +54,10 @@
#define UART_CTRL_TXFIFO_RESET (1 << 15)
#define UARTLSR_TXFIFOEMPTY (1 << 6)
#define CONSOLE_T_A3700_BASE CONSOLE_T_DRVDATA
#ifndef __ASSEMBLER__
#include <stdint.h>
typedef struct {
console_t console;
uintptr_t base;
} console_a3700_t;
/*
* Initialize a new a3700 console instance and register it with the console
* framework. The |console| pointer must point to storage that will be valid
@ -72,7 +65,7 @@ typedef struct {
* Its contents will be reinitialized from scratch.
*/
int console_a3700_register(uintptr_t baseaddr, uint32_t clock, uint32_t baud,
console_a3700_t *console);
console_t *console);
#endif /*__ASSEMBLER__*/

View File

@ -7,17 +7,10 @@
#ifndef RCAR_PRINTF_H
#define RCAR_PRINTF_H
#define CONSOLE_T_RCAR_BASE CONSOLE_T_DRVDATA
#ifndef __ASSEMBLER__
#include <stdint.h>
typedef struct {
console_t console;
uintptr_t base;
} console_rcar_t;
/*
* Initialize a new rcar console instance and register it with the console
* framework. The |console| pointer must point to storage that will be valid
@ -25,7 +18,7 @@ typedef struct {
* Its contents will be reinitialized from scratch.
*/
int console_rcar_register(uintptr_t baseaddr, uint32_t clock, uint32_t baud,
console_rcar_t *console);
console_t *console);
#endif /*__ASSEMBLER__*/

View File

@ -9,17 +9,10 @@
#include <drivers/console.h>
#define CONSOLE_T_STM32_BASE CONSOLE_T_DRVDATA
#ifndef __ASSEMBLER__
#include <stdint.h>
struct console_stm32 {
console_t console;
uintptr_t base;
};
/*
* Initialize a new STM32 console instance and register it with the console
* framework. The |console| pointer must point to storage that will be valid
@ -27,7 +20,7 @@ struct console_stm32 {
* Its contents will be reinitialized from scratch.
*/
int console_stm32_register(uintptr_t baseaddr, uint32_t clock, uint32_t baud,
struct console_stm32 *console);
console_t *console);
#endif /*__ASSEMBLER__*/

View File

@ -71,17 +71,10 @@
#define UARTLSR_RDR_BIT (0) /* Rx Data Ready Bit */
#define UARTLSR_RDR (1 << UARTLSR_RDR_BIT) /* Rx Data Ready */
#define CONSOLE_T_16550_BASE CONSOLE_T_DRVDATA
#ifndef __ASSEMBLER__
#include <stdint.h>
typedef struct {
console_t console;
uintptr_t base;
} console_16550_t;
/*
* Initialize a new 16550 console instance and register it with the console
* framework. The |console| pointer must point to storage that will be valid
@ -94,7 +87,7 @@ typedef struct {
* case as well.
*/
int console_16550_register(uintptr_t baseaddr, uint32_t clock, uint32_t baud,
console_16550_t *console);
console_t *console);
#endif /*__ASSEMBLER__*/

View File

@ -28,7 +28,7 @@
static entry_point_info_t bl32_image_ep_info;
static entry_point_info_t bl33_image_ep_info;
static console_16550_t console;
static console_t console;
static const gicv2_driver_data_t sunxi_gic_data = {
.gicd_base = SUNXI_GICD_BASE,

View File

@ -54,13 +54,8 @@
#include <stdint.h>
typedef struct {
console_t console;
uintptr_t base;
} console_lpuart_t;
int console_lpuart_register(uintptr_t baseaddr, uint32_t clock, uint32_t baud,
console_lpuart_t *console);
console_t *console);
#endif /*__ASSEMBLER__*/
#endif /* IMX8_LPUART_H */

View File

@ -11,13 +11,8 @@
#ifndef __ASSEMBLER__
typedef struct {
console_t console;
uintptr_t base;
} console_uart_t;
int console_imx_uart_register(uintptr_t baseaddr, uint32_t clock, uint32_t baud,
console_uart_t *console);
console_t *console);
#endif /*__ASSEMBLER__*/
#endif /* IMX_UART_H */

View File

@ -150,7 +150,7 @@ static void imx7_setup_wdog_clocks(void)
void bl2_el3_early_platform_setup(u_register_t arg1, u_register_t arg2,
u_register_t arg3, u_register_t arg4)
{
static console_imx_uart_t console;
static console_t console;
int console_scope = CONSOLE_FLAG_BOOT | CONSOLE_FLAG_RUNTIME;
/* Initialize common components */
@ -170,7 +170,7 @@ void bl2_el3_early_platform_setup(u_register_t arg1, u_register_t arg2,
PLAT_IMX7_BOOT_UART_CLK_IN_HZ,
PLAT_IMX7_CONSOLE_BAUDRATE,
&console);
console_set_scope(&console.console, console_scope);
console_set_scope(&console, console_scope);
/* Open handles to persistent storage */
plat_imx7_io_setup();

View File

@ -97,7 +97,7 @@ void bl31_tzc380_setup(void)
void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
u_register_t arg2, u_register_t arg3)
{
static console_uart_t console;
static console_t console;
int i;
/* Enable CSU NS access permission */
@ -114,7 +114,7 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
console_imx_uart_register(IMX_BOOT_UART_BASE, IMX_BOOT_UART_CLK_IN_HZ,
IMX_CONSOLE_BAUDRATE, &console);
/* This console is only used for boot stage */
console_set_scope(&console.console, CONSOLE_FLAG_BOOT);
console_set_scope(&console, CONSOLE_FLAG_BOOT);
/*
* tell BL3-1 where the non-secure software image is located

View File

@ -133,7 +133,7 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
imx8m_caam_init();
#if DEBUG_CONSOLE
static console_uart_t console;
static console_t console;
console_imx_uart_register(IMX_BOOT_UART_BASE, IMX_BOOT_UART_CLK_IN_HZ,
IMX_CONSOLE_BAUDRATE, &console);

View File

@ -295,7 +295,7 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
u_register_t arg2, u_register_t arg3)
{
#if DEBUG_CONSOLE
static console_lpuart_t console;
static console_t console;
#endif
if (sc_ipc_open(&ipc_handle, SC_IPC_BASE) != SC_ERR_NONE)
panic();

View File

@ -255,7 +255,7 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
u_register_t arg2, u_register_t arg3)
{
#if DEBUG_CONSOLE
static console_lpuart_t console;
static console_t console;
#endif
if (sc_ipc_open(&ipc_handle, SC_IPC_BASE) != SC_ERR_NONE)
panic();

View File

@ -51,7 +51,7 @@ boot_source_type boot_source = BOOT_SOURCE;
void bl2_el3_early_platform_setup(u_register_t x0, u_register_t x1,
u_register_t x2, u_register_t x4)
{
static console_16550_t console;
static console_t console;
handoff reverse_handoff_ptr;
generic_delay_timer_init();

View File

@ -37,7 +37,7 @@ entry_point_info_t *bl31_plat_get_next_image_ep_info(uint32_t type)
void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
u_register_t arg2, u_register_t arg3)
{
static console_16550_t console;
static console_t console;
console_16550_register(PLAT_UART0_BASE, PLAT_UART_CLOCK, PLAT_BAUDRATE,
&console);

View File

@ -50,7 +50,7 @@ boot_source_type boot_source = BOOT_SOURCE;
void bl2_el3_early_platform_setup(u_register_t x0, u_register_t x1,
u_register_t x2, u_register_t x4)
{
static console_16550_t console;
static console_t console;
handoff reverse_handoff_ptr;
generic_delay_timer_init();

View File

@ -45,7 +45,7 @@ entry_point_info_t *bl31_plat_get_next_image_ep_info(uint32_t type)
void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
u_register_t arg2, u_register_t arg3)
{
static console_16550_t console;
static console_t console;
console_16550_register(PLAT_UART0_BASE, PLAT_UART_CLOCK, PLAT_BAUDRATE,
&console);

View File

@ -81,7 +81,7 @@ endfunc console_ls_16550_core_init
.globl console_ls_16550_register
/* -----------------------------------------------
* int console_ls_16550_register(console_ls_16550_t *console,
* int console_ls_16550_register(console_t *console,
* uintptr_t base, uint32_t clk, uint32_t baud)
* Function to initialize and register a new 16550
* console. Storage passed in for the console struct
@ -89,7 +89,7 @@ endfunc console_ls_16550_core_init
* In: x0 - UART register base address
* w1 - UART clock in Hz
* w2 - Baud rate
* x3 - pointer to empty console_ls_16550_t struct
* x3 - pointer to empty console_t struct
* Out: return 1 on success, 0 on error
* Clobber list : x0, x1, x2, x6, x7, x14
* -----------------------------------------------
@ -98,7 +98,7 @@ func console_ls_16550_register
mov x7, x30
mov x6, x3
cbz x6, register_fail
str x0, [x6, #CONSOLE_T_16550_BASE]
str x0, [x6, #CONSOLE_T_BASE]
bl console_ls_16550_core_init
cbz x0, register_fail
@ -150,7 +150,7 @@ func console_ls_16550_core_putc
endfunc console_ls_16550_core_putc
/* --------------------------------------------------------
* int console_16550_putc(int c, console_ls_16550_t *console)
* int console_16550_putc(int c, console_t *console)
* Function to output a character over the console. It
* returns the character printed on success or -1 on error.
* In : w0 - character to be printed
@ -164,7 +164,7 @@ func console_ls_16550_putc
cmp x1, #0
ASM_ASSERT(ne)
#endif /* ENABLE_ASSERTIONS */
ldr x1, [x1, #CONSOLE_T_16550_BASE]
ldr x1, [x1, #CONSOLE_T_BASE]
b console_ls_16550_core_putc
endfunc console_ls_16550_putc
@ -195,7 +195,7 @@ no_char:
endfunc console_ls_16550_core_getc
/* ---------------------------------------------
* int console_ls_16550_getc(console_ls_16550_t *console)
* int console_ls_16550_getc(console_t *console)
* Function to get a character from the console.
* It returns the character grabbed on success
* or -1 on if no character is available.
@ -209,7 +209,7 @@ func console_ls_16550_getc
cmp x1, #0
ASM_ASSERT(ne)
#endif /* ENABLE_ASSERTIONS */
ldr x0, [x0, #CONSOLE_T_16550_BASE]
ldr x0, [x0, #CONSOLE_T_BASE]
b console_ls_16550_core_getc
endfunc console_ls_16550_getc
@ -239,7 +239,7 @@ func console_ls_16550_core_flush
endfunc console_ls_16550_core_flush
/* ---------------------------------------------
* int console_ls_16550_flush(console_ls_16550_t *console)
* int console_ls_16550_flush(console_t *console)
* Function to force a write of all buffered
* data that hasn't been output.
* In : x0 - pointer to console_t structure
@ -252,6 +252,6 @@ func console_ls_16550_flush
cmp x0, #0
ASM_ASSERT(ne)
#endif /* ENABLE_ASSERTIONS */
ldr x0, [x0, #CONSOLE_T_16550_BASE]
ldr x0, [x0, #CONSOLE_T_BASE]
b console_ls_16550_core_flush
endfunc console_ls_16550_flush

View File

@ -61,17 +61,10 @@
#define UARTLSR_OVRF (1 << 2) /* Rx Overrun Error */
#define UARTLSR_RDR (1 << 2) /* Rx Data Ready */
#define CONSOLE_T_16550_BASE CONSOLE_T_DRVDATA
#ifndef __ASSEMBLER__
#include <stdint.h>
typedef struct {
console_t console;
uintptr_t base;
} console_ls_16550_t;
/*
* Initialize a new 16550 console instance and register it with the console
* framework. The |console| pointer must point to storage that will be valid
@ -79,7 +72,7 @@ typedef struct {
* Its contents will be reinitialized from scratch.
*/
int console_ls_16550_register(uintptr_t baseaddr, uint32_t clock, uint32_t baud,
console_ls_16550_t *console);
console_t *console);
#endif /*__ASSEMBLER__*/

View File

@ -23,7 +23,7 @@ meminfo_t *bl1_plat_sec_mem_layout(void)
******************************************************************************/
void ls_bl1_early_platform_setup(void)
{
static console_ls_16550_t console;
static console_t console;
#if !LS1043_DISABLE_TRUSTED_WDOG
/* TODO: Enable watchdog */

View File

@ -23,7 +23,7 @@ static meminfo_t bl2_tzram_layout __aligned(CACHE_WRITEBACK_GRANULE);
******************************************************************************/
void ls_bl2_early_platform_setup(meminfo_t *mem_layout)
{
static console_ls_16550_t console;
static console_t console;
/* Initialize the console to provide early debug support */
console_ls_16550_register(LS_TF_UART_BASE, LS_TF_UART_CLOCK,

View File

@ -67,7 +67,7 @@ entry_point_info_t *bl31_plat_get_next_image_ep_info(uint32_t type)
void ls_bl31_early_platform_setup(void *from_bl2,
void *plat_params_from_bl2)
{
static console_ls_16550_t console;
static console_t console;
/* Initialize the console to provide early debug support */
console_ls_16550_register(LS_TF_UART_BASE, LS_TF_UART_CLOCK,
@ -182,7 +182,7 @@ void ls_bl31_platform_setup(void)
******************************************************************************/
void ls_bl31_plat_runtime_setup(void)
{
static console_ls_16550_t console;
static console_t console;
/* Initialize the runtime console */
console_ls_16550_register(PLAT_LS1043_UART_BASE, PLAT_LS1043_UART_CLOCK,

View File

@ -30,7 +30,7 @@ gicv2_driver_data_t ls_gic_data = {
******************************************************************************/
void ls_tsp_early_platform_setup(void)
{
static console_ls_16550_t console;
static console_t console;
/*
* Initialize a different console than already in use to display
* messages from TSP

View File

@ -14,16 +14,15 @@
#ifdef PLAT_a3700
#include <drivers/marvell/uart/a3700_console.h>
static console_a3700_t marvell_boot_console;
static console_a3700_t marvell_runtime_console;
#define console_marvell_register console_a3700_register
#else
#include <drivers/ti/uart/uart_16550.h>
static console_16550_t marvell_boot_console;
static console_16550_t marvell_runtime_console;
#define console_marvell_register console_16550_register
#endif
static console_t marvell_boot_console;
static console_t marvell_runtime_console;
/*******************************************************************************
* Functions that set up the console
******************************************************************************/
@ -32,15 +31,10 @@ static console_16550_t marvell_runtime_console;
void marvell_console_boot_init(void)
{
int rc =
#ifdef PLAT_a3700
console_a3700_register(
#else
console_16550_register(
#endif
PLAT_MARVELL_BOOT_UART_BASE,
PLAT_MARVELL_BOOT_UART_CLK_IN_HZ,
MARVELL_CONSOLE_BAUDRATE,
&marvell_boot_console);
console_marvell_register(PLAT_MARVELL_BOOT_UART_BASE,
PLAT_MARVELL_BOOT_UART_CLK_IN_HZ,
MARVELL_CONSOLE_BAUDRATE,
&marvell_boot_console);
if (rc == 0) {
/*
* The crash console doesn't use the multi console API, it uses
@ -50,40 +44,33 @@ void marvell_console_boot_init(void)
panic();
}
console_set_scope(&marvell_boot_console.console,
CONSOLE_FLAG_BOOT);
console_set_scope(&marvell_boot_console, CONSOLE_FLAG_BOOT);
}
void marvell_console_boot_end(void)
{
(void)console_flush();
(void)console_unregister(&marvell_boot_console.console);
(void)console_unregister(&marvell_boot_console);
}
/* Initialize the runtime console */
void marvell_console_runtime_init(void)
{
int rc =
#ifdef PLAT_a3700
console_a3700_register(
#else
console_16550_register(
#endif
PLAT_MARVELL_BOOT_UART_BASE,
PLAT_MARVELL_BOOT_UART_CLK_IN_HZ,
MARVELL_CONSOLE_BAUDRATE,
&marvell_runtime_console);
console_marvell_register(PLAT_MARVELL_BOOT_UART_BASE,
PLAT_MARVELL_BOOT_UART_CLK_IN_HZ,
MARVELL_CONSOLE_BAUDRATE,
&marvell_runtime_console);
if (rc == 0)
panic();
console_set_scope(&marvell_runtime_console.console,
CONSOLE_FLAG_RUNTIME);
console_set_scope(&marvell_runtime_console, CONSOLE_FLAG_RUNTIME);
}
void marvell_console_runtime_end(void)
{
(void)console_flush();
(void)console_unregister(&marvell_runtime_console.console);
(void)console_unregister(&marvell_runtime_console);
}

View File

@ -100,7 +100,7 @@ entry_point_info_t *bl31_plat_get_next_image_ep_info(uint32_t type)
void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
u_register_t arg2, u_register_t arg3)
{
static console_16550_t console;
static console_t console;
console_16550_register(MT8173_UART0_BASE, MT8173_UART_CLOCK, MT8173_BAUDRATE, &console);

View File

@ -112,7 +112,7 @@ entry_point_info_t *bl31_plat_get_next_image_ep_info(uint32_t type)
void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
u_register_t arg2, u_register_t arg3)
{
static console_16550_t console;
static console_t console;
params_early_setup(arg1);

View File

@ -49,14 +49,14 @@
/* -------------------------------------------------
* int console_spe_register(uintptr_t baseaddr,
* uint32_t clock, uint32_t baud,
* console_spe_t *console);
* console_t *console);
* Function to initialize and register a new spe
* console. Storage passed in for the console struct
* *must* be persistent (i.e. not from the stack).
* In: x0 - UART register base address
* w1 - UART clock in Hz
* w2 - Baud rate
* x3 - pointer to empty console_spe_t struct
* x3 - pointer to empty console_t struct
* Out: return 1 on success, 0 on error
* Clobber list : x0, x1, x2, x6, x7, x14
* -------------------------------------------------
@ -122,7 +122,7 @@ putc_error:
endfunc console_spe_core_putc
/* --------------------------------------------------------
* int console_spe_putc(int c, console_spe_t *console)
* int console_spe_putc(int c, console_t *console)
* Function to output a character over the console. It
* returns the character printed on success or -1 on error.
* In : w0 - character to be printed
@ -137,7 +137,7 @@ func console_spe_putc
endfunc console_spe_putc
/* ---------------------------------------------
* int console_spe_getc(console_spe_t *console)
* int console_spe_getc(console_t *console)
* Function to get a character from the console.
* It returns the character grabbed on success
* or -1 if no character is available.
@ -174,7 +174,7 @@ flush_error:
endfunc console_spe_core_flush
/* ---------------------------------------------
* int console_spe_flush(console_spe_t *console)
* int console_spe_flush(console_t *console)
* Function to force a write of all buffered
* data that hasn't been output.
* In : x0 - pointer to console_t structure

View File

@ -11,11 +11,6 @@
#include <drivers/console.h>
typedef struct {
console_t console;
uintptr_t base;
} console_spe_t;
/*
* Initialize a new spe console instance and register it with the console
* framework. The |console| pointer must point to storage that will be valid
@ -23,6 +18,6 @@ typedef struct {
* Its contents will be reinitialized from scratch.
*/
int console_spe_register(uintptr_t baseaddr, uint32_t clock, uint32_t baud,
console_spe_t *console);
console_t *console);
#endif /* SPE_H */

View File

@ -92,7 +92,7 @@ static uint32_t tegra132_uart_addresses[TEGRA132_MAX_UART_PORTS + 1] = {
******************************************************************************/
void plat_enable_console(int32_t id)
{
static console_16550_t uart_console;
static console_t uart_console;
uint32_t console_clock;
if ((id > 0) && (id < TEGRA132_MAX_UART_PORTS)) {
@ -109,7 +109,7 @@ void plat_enable_console(int32_t id)
console_clock,
TEGRA_CONSOLE_BAUDRATE,
&uart_console);
console_set_scope(&uart_console.console, CONSOLE_FLAG_BOOT |
console_set_scope(&uart_console, CONSOLE_FLAG_BOOT |
CONSOLE_FLAG_RUNTIME | CONSOLE_FLAG_CRASH);
}
}

View File

@ -150,7 +150,7 @@ static uint32_t tegra186_uart_addresses[TEGRA186_MAX_UART_PORTS + 1] = {
******************************************************************************/
void plat_enable_console(int32_t id)
{
static console_16550_t uart_console;
static console_t uart_console;
uint32_t console_clock;
if ((id > 0) && (id < TEGRA186_MAX_UART_PORTS)) {
@ -167,7 +167,7 @@ void plat_enable_console(int32_t id)
console_clock,
TEGRA_CONSOLE_BAUDRATE,
&uart_console);
console_set_scope(&uart_console.console, CONSOLE_FLAG_BOOT |
console_set_scope(&uart_console, CONSOLE_FLAG_BOOT |
CONSOLE_FLAG_RUNTIME | CONSOLE_FLAG_CRASH);
}
}

View File

@ -163,18 +163,18 @@ void plat_enable_console(int32_t id)
uint32_t console_clock = 0U;
#if ENABLE_CONSOLE_SPE
static console_spe_t spe_console;
static console_t spe_console;
if (id == TEGRA_CONSOLE_SPE_ID) {
(void)console_spe_register(TEGRA_CONSOLE_SPE_BASE,
console_clock,
TEGRA_CONSOLE_BAUDRATE,
&spe_console);
console_set_scope(&spe_console.console, CONSOLE_FLAG_BOOT |
console_set_scope(&spe_console, CONSOLE_FLAG_BOOT |
CONSOLE_FLAG_RUNTIME | CONSOLE_FLAG_CRASH);
}
#else
static console_16550_t uart_console;
static console_t uart_console;
if ((id > 0) && (id < TEGRA194_MAX_UART_PORTS)) {
/*
@ -190,7 +190,7 @@ void plat_enable_console(int32_t id)
console_clock,
TEGRA_CONSOLE_BAUDRATE,
&uart_console);
console_set_scope(&uart_console.console, CONSOLE_FLAG_BOOT |
console_set_scope(&uart_console, CONSOLE_FLAG_BOOT |
CONSOLE_FLAG_RUNTIME | CONSOLE_FLAG_CRASH);
}
#endif

View File

@ -119,7 +119,7 @@ static uint32_t tegra210_uart_addresses[TEGRA210_MAX_UART_PORTS + 1] = {
******************************************************************************/
void plat_enable_console(int32_t id)
{
static console_16550_t uart_console;
static console_t uart_console;
uint32_t console_clock;
if ((id > 0) && (id < TEGRA210_MAX_UART_PORTS)) {
@ -136,7 +136,7 @@ void plat_enable_console(int32_t id)
console_clock,
TEGRA_CONSOLE_BAUDRATE,
&uart_console);
console_set_scope(&uart_console.console, CONSOLE_FLAG_BOOT |
console_set_scope(&uart_console, CONSOLE_FLAG_BOOT |
CONSOLE_FLAG_RUNTIME | CONSOLE_FLAG_CRASH);
}
}

View File

@ -70,8 +70,8 @@ void plat_ea_handler(unsigned int ea_reason, uint64_t syndrome, void *cookie,
#include <drivers/renesas/rcar/console/console.h>
static console_rcar_t rcar_boot_console;
static console_rcar_t rcar_runtime_console;
static console_t rcar_boot_console;
static console_t rcar_runtime_console;
void rcar_console_boot_init(void)
{
@ -81,7 +81,7 @@ void rcar_console_boot_init(void)
if (!ret)
panic();
console_set_scope(&rcar_boot_console.console, CONSOLE_FLAG_BOOT);
console_set_scope(&rcar_boot_console, CONSOLE_FLAG_BOOT);
}
void rcar_console_boot_end(void)
@ -96,7 +96,7 @@ void rcar_console_runtime_init(void)
if (!ret)
panic();
console_set_scope(&rcar_boot_console.console, CONSOLE_FLAG_RUNTIME);
console_set_scope(&rcar_boot_console, CONSOLE_FLAG_RUNTIME);
}
void rcar_console_runtime_end(void)

View File

@ -57,7 +57,7 @@ void params_early_setup(u_register_t plat_param_from_bl2)
void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
u_register_t arg2, u_register_t arg3)
{
static console_16550_t console;
static console_t console;
params_early_setup(arg1);

View File

@ -52,7 +52,7 @@ unsigned int plat_is_my_cpu_primary(void);
void sp_min_early_platform_setup2(u_register_t arg0, u_register_t arg1,
u_register_t arg2, u_register_t arg3)
{
static console_16550_t console;
static console_t console;
params_early_setup(arg1);

View File

@ -102,7 +102,7 @@ static const mmap_region_t plat_rpi3_mmap[] = {
/*******************************************************************************
* Function that sets up the console
******************************************************************************/
static console_16550_t rpi3_console;
static console_t rpi3_console;
void rpi3_console_init(unsigned int base_clk_rate)
{
@ -123,7 +123,7 @@ void rpi3_console_init(unsigned int base_clk_rate)
panic();
}
console_set_scope(&rpi3_console.console, console_scope);
console_set_scope(&rpi3_console, console_scope);
}
/*******************************************************************************

View File

@ -17,7 +17,7 @@
*/
.globl uniphier_console_putc
func uniphier_console_putc
ldr x1, [x1, #CONSOLE_T_DRVDATA]
ldr x1, [x1, #CONSOLE_T_BASE]
/* Wait until the transmitter FIFO gets empty */
0: ldr w2, [x1, #UNIPHIER_UART_LSR]
@ -36,7 +36,7 @@ endfunc uniphier_console_putc
*/
.globl uniphier_console_getc
func uniphier_console_getc
ldr x0, [x0, #CONSOLE_T_DRVDATA]
ldr x0, [x0, #CONSOLE_T_BASE]
ldr w1, [x0, #UNIPHIER_UART_LSR]
tbz w1, #UNIPHIER_UART_LSR_DR_BIT, 0f
@ -55,7 +55,7 @@ endfunc uniphier_console_getc
*/
.global uniphier_console_flush
func uniphier_console_flush
ldr x0, [x0, #CONSOLE_T_DRVDATA]
ldr x0, [x0, #CONSOLE_T_BASE]
/* wait until the transmitter gets empty */
0: ldr w1, [x0, #UNIPHIER_UART_LSR]

View File

@ -17,28 +17,21 @@
#define UNIPHIER_UART_OFFSET 0x100
#define UNIPHIER_UART_NR_PORTS 4
struct uniphier_console {
struct console console;
uintptr_t base;
};
/* These callbacks are implemented in assembly to use crash_console_helpers.S */
int uniphier_console_putc(int character, struct console *console);
int uniphier_console_getc(struct console *console);
int uniphier_console_flush(struct console *console);
static struct uniphier_console uniphier_console = {
.console = {
.flags = CONSOLE_FLAG_BOOT |
static console_t uniphier_console = {
.flags = CONSOLE_FLAG_BOOT |
#if DEBUG
CONSOLE_FLAG_RUNTIME |
CONSOLE_FLAG_RUNTIME |
#endif
CONSOLE_FLAG_CRASH |
CONSOLE_FLAG_TRANSLATE_CRLF,
.putc = uniphier_console_putc,
.getc = uniphier_console_getc,
.flush = uniphier_console_flush,
},
CONSOLE_FLAG_CRASH |
CONSOLE_FLAG_TRANSLATE_CRLF,
.putc = uniphier_console_putc,
.getc = uniphier_console_getc,
.flush = uniphier_console_flush,
};
static const uintptr_t uniphier_uart_base[] = {
@ -86,7 +79,7 @@ void uniphier_console_setup(unsigned int soc)
plat_error_handler(-EINVAL);
uniphier_console.base = base;
console_register(&uniphier_console.console);
console_register(&uniphier_console);
/*
* The hardware might be still printing characters queued up in the

View File

@ -31,7 +31,7 @@
#include <stm32mp1_context.h>
#include <stm32mp1_dbgmcu.h>
static struct console_stm32 console;
static console_t console;
static struct stm32mp_auth_ops stm32mp1_auth_ops;
static void print_reset_reason(void)
@ -273,7 +273,7 @@ void bl2_el3_plat_arch_setup(void)
panic();
}
console_set_scope(&console.console, CONSOLE_FLAG_BOOT |
console_set_scope(&console, CONSOLE_FLAG_BOOT |
CONSOLE_FLAG_CRASH | CONSOLE_FLAG_TRANSLATE_CRLF);
stm32mp_print_cpuinfo();

View File

@ -35,7 +35,7 @@
******************************************************************************/
static entry_point_info_t bl33_image_ep_info;
static struct console_stm32 console;
static console_t console;
/*******************************************************************************
* Interrupt handler for FIQ (secure IRQ)
@ -142,7 +142,7 @@ void sp_min_early_platform_setup2(u_register_t arg0, u_register_t arg1,
#ifdef DEBUG
console_flags |= CONSOLE_FLAG_RUNTIME;
#endif
console_set_scope(&console.console, console_flags);
console_set_scope(&console, console_flags);
}
}

View File

@ -13,7 +13,7 @@
void bl31_console_setup(void)
{
static console_16550_t console;
static console_t console;
/* Initialize the console to provide early debug support */
console_16550_register(K3_USART_BASE, K3_USART_CLK_SPEED,