Commit 896d684d authored by Mark Dykes's avatar Mark Dykes Committed by TrustedFirmware Code Review
Browse files

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
parents c723ef01 7db9a0b9
......@@ -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 */
......@@ -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
......@@ -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
* --------------------------------------------------------
......
......@@ -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
......
......@@ -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
......@@ -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
......@@ -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
......@@ -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__*/
......
......@@ -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__*/
......
......@@ -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__*/
......
......@@ -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__*/
......
......@@ -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,
......
......@@ -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 */
......@@ -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 */
......@@ -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();
......
......@@ -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
......
......@@ -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);
......
......@@ -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();
......
......@@ -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();
......
......@@ -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();
......
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