Commit 093dce70 authored by Mark Dykes's avatar Mark Dykes Committed by TrustedFirmware Code Review
Browse files

Merge "pl011: Use generic console_t data structure" into integration

parents ad8922fc f695e1e0
...@@ -91,14 +91,14 @@ endfunc console_pl011_core_init ...@@ -91,14 +91,14 @@ endfunc console_pl011_core_init
/* ------------------------------------------------------- /* -------------------------------------------------------
* int console_pl011_register(uintptr_t baseaddr, * int console_pl011_register(uintptr_t baseaddr,
* uint32_t clock, uint32_t baud, * uint32_t clock, uint32_t baud,
* console_pl011_t *console); * console_t *console);
* Function to initialize and register a new PL011 * Function to initialize and register a new PL011
* console. Storage passed in for the console struct * console. Storage passed in for the console struct
* *must* be persistent (i.e. not from the stack). * *must* be persistent (i.e. not from the stack).
* In: r0 - UART register base address * In: r0 - UART register base address
* r1 - UART clock in Hz * r1 - UART clock in Hz
* r2 - Baud rate * r2 - Baud rate
* r3 - pointer to empty console_pl011_t struct * r3 - pointer to empty console_t struct
* Out: return 1 on success, 0 on error * Out: return 1 on success, 0 on error
* Clobber list : r0, r1, r2 * Clobber list : r0, r1, r2
* ------------------------------------------------------- * -------------------------------------------------------
...@@ -108,7 +108,7 @@ func console_pl011_register ...@@ -108,7 +108,7 @@ func console_pl011_register
mov r4, r3 mov r4, r3
cmp r4, #0 cmp r4, #0
beq register_fail beq register_fail
str r0, [r4, #CONSOLE_T_PL011_BASE] str r0, [r4, #CONSOLE_T_BASE]
bl console_pl011_core_init bl console_pl011_core_init
cmp r0, #0 cmp r0, #0
...@@ -159,7 +159,7 @@ putc_error: ...@@ -159,7 +159,7 @@ putc_error:
endfunc console_pl011_core_putc endfunc console_pl011_core_putc
/* -------------------------------------------------------- /* --------------------------------------------------------
* int console_pl011_putc(int c, console_pl011_t *console) * int console_pl011_putc(int c, console_t *console)
* Function to output a character over the console. It * Function to output a character over the console. It
* returns the character printed on success or -1 on error. * returns the character printed on success or -1 on error.
* In: r0 - character to be printed * In: r0 - character to be printed
...@@ -173,7 +173,7 @@ func console_pl011_putc ...@@ -173,7 +173,7 @@ func console_pl011_putc
cmp r1, #0 cmp r1, #0
ASM_ASSERT(ne) ASM_ASSERT(ne)
#endif /* ENABLE_ASSERTIONS */ #endif /* ENABLE_ASSERTIONS */
ldr r1, [r1, #CONSOLE_T_PL011_BASE] ldr r1, [r1, #CONSOLE_T_BASE]
b console_pl011_core_putc b console_pl011_core_putc
endfunc console_pl011_putc endfunc console_pl011_putc
...@@ -203,7 +203,7 @@ getc_error: ...@@ -203,7 +203,7 @@ getc_error:
endfunc console_pl011_core_getc endfunc console_pl011_core_getc
/* ------------------------------------------------ /* ------------------------------------------------
* int console_pl011_getc(console_pl011_t *console) * int console_pl011_getc(console_t *console)
* Function to get a character from the console. * Function to get a character from the console.
* It returns the character grabbed on success * It returns the character grabbed on success
* or -1 if no character is available. * or -1 if no character is available.
...@@ -217,7 +217,7 @@ func console_pl011_getc ...@@ -217,7 +217,7 @@ func console_pl011_getc
cmp r0, #0 cmp r0, #0
ASM_ASSERT(ne) ASM_ASSERT(ne)
#endif /* ENABLE_ASSERTIONS */ #endif /* ENABLE_ASSERTIONS */
ldr r0, [r0, #CONSOLE_T_PL011_BASE] ldr r0, [r0, #CONSOLE_T_BASE]
b console_pl011_core_getc b console_pl011_core_getc
endfunc console_pl011_getc endfunc console_pl011_getc
...@@ -248,7 +248,7 @@ flush_error: ...@@ -248,7 +248,7 @@ flush_error:
endfunc console_pl011_core_flush endfunc console_pl011_core_flush
/* --------------------------------------------- /* ---------------------------------------------
* int console_pl011_flush(console_pl011_t *console) * int console_pl011_flush(console_t *console)
* Function to force a write of all buffered * Function to force a write of all buffered
* data that hasn't been output. * data that hasn't been output.
* In : r0 - pointer to console_t structure * In : r0 - pointer to console_t structure
...@@ -261,6 +261,6 @@ func console_pl011_flush ...@@ -261,6 +261,6 @@ func console_pl011_flush
cmp r0, #0 cmp r0, #0
ASM_ASSERT(ne) ASM_ASSERT(ne)
#endif /* ENABLE_ASSERTIONS */ #endif /* ENABLE_ASSERTIONS */
ldr r0, [r0, #CONSOLE_T_PL011_BASE] ldr r0, [r0, #CONSOLE_T_BASE]
b console_pl011_core_flush b console_pl011_core_flush
endfunc console_pl011_flush endfunc console_pl011_flush
...@@ -80,14 +80,14 @@ endfunc console_pl011_core_init ...@@ -80,14 +80,14 @@ endfunc console_pl011_core_init
/* ----------------------------------------------- /* -----------------------------------------------
* int console_pl011_register(uintptr_t baseaddr, * int console_pl011_register(uintptr_t baseaddr,
* uint32_t clock, uint32_t baud, * uint32_t clock, uint32_t baud,
* console_pl011_t *console); * console_t *console);
* Function to initialize and register a new PL011 * Function to initialize and register a new PL011
* console. Storage passed in for the console struct * console. Storage passed in for the console struct
* *must* be persistent (i.e. not from the stack). * *must* be persistent (i.e. not from the stack).
* In: x0 - UART register base address * In: x0 - UART register base address
* w1 - UART clock in Hz * w1 - UART clock in Hz
* w2 - Baud rate * w2 - Baud rate
* x3 - pointer to empty console_pl011_t struct * x3 - pointer to empty console_t struct
* Out: return 1 on success, 0 on error * Out: return 1 on success, 0 on error
* Clobber list : x0, x1, x2, x6, x7, x14 * Clobber list : x0, x1, x2, x6, x7, x14
* ----------------------------------------------- * -----------------------------------------------
...@@ -96,7 +96,7 @@ func console_pl011_register ...@@ -96,7 +96,7 @@ func console_pl011_register
mov x7, x30 mov x7, x30
mov x6, x3 mov x6, x3
cbz x6, register_fail cbz x6, register_fail
str x0, [x6, #CONSOLE_T_PL011_BASE] str x0, [x6, #CONSOLE_T_BASE]
bl console_pl011_core_init bl console_pl011_core_init
cbz x0, register_fail cbz x0, register_fail
...@@ -143,7 +143,7 @@ func console_pl011_core_putc ...@@ -143,7 +143,7 @@ func console_pl011_core_putc
endfunc console_pl011_core_putc endfunc console_pl011_core_putc
/* -------------------------------------------------------- /* --------------------------------------------------------
* int console_pl011_putc(int c, console_pl011_t *console) * int console_pl011_putc(int c, console_t *console)
* Function to output a character over the console. It * Function to output a character over the console. It
* returns the character printed on success or -1 on error. * returns the character printed on success or -1 on error.
* In : w0 - character to be printed * In : w0 - character to be printed
...@@ -157,7 +157,7 @@ func console_pl011_putc ...@@ -157,7 +157,7 @@ func console_pl011_putc
cmp x1, #0 cmp x1, #0
ASM_ASSERT(ne) ASM_ASSERT(ne)
#endif /* ENABLE_ASSERTIONS */ #endif /* ENABLE_ASSERTIONS */
ldr x1, [x1, #CONSOLE_T_PL011_BASE] ldr x1, [x1, #CONSOLE_T_BASE]
b console_pl011_core_putc b console_pl011_core_putc
endfunc console_pl011_putc endfunc console_pl011_putc
...@@ -189,7 +189,7 @@ no_char: ...@@ -189,7 +189,7 @@ no_char:
endfunc console_pl011_core_getc endfunc console_pl011_core_getc
/* --------------------------------------------- /* ---------------------------------------------
* int console_pl011_getc(console_pl011_t *console) * int console_pl011_getc(console_t *console)
* Function to get a character from the console. * Function to get a character from the console.
* It returns the character grabbed on success * It returns the character grabbed on success
* or -1 if no character is available. * or -1 if no character is available.
...@@ -203,7 +203,7 @@ func console_pl011_getc ...@@ -203,7 +203,7 @@ func console_pl011_getc
cmp x0, #0 cmp x0, #0
ASM_ASSERT(ne) ASM_ASSERT(ne)
#endif /* ENABLE_ASSERTIONS */ #endif /* ENABLE_ASSERTIONS */
ldr x0, [x0, #CONSOLE_T_PL011_BASE] ldr x0, [x0, #CONSOLE_T_BASE]
b console_pl011_core_getc b console_pl011_core_getc
endfunc console_pl011_getc endfunc console_pl011_getc
...@@ -231,7 +231,7 @@ func console_pl011_core_flush ...@@ -231,7 +231,7 @@ func console_pl011_core_flush
endfunc console_pl011_core_flush endfunc console_pl011_core_flush
/* --------------------------------------------- /* ---------------------------------------------
* int console_pl011_flush(console_pl011_t *console) * int console_pl011_flush(console_t *console)
* Function to force a write of all buffered * Function to force a write of all buffered
* data that hasn't been output. * data that hasn't been output.
* In : x0 - pointer to console_t structure * In : x0 - pointer to console_t structure
...@@ -244,6 +244,6 @@ func console_pl011_flush ...@@ -244,6 +244,6 @@ func console_pl011_flush
cmp x0, #0 cmp x0, #0
ASM_ASSERT(ne) ASM_ASSERT(ne)
#endif /* ENABLE_ASSERTIONS */ #endif /* ENABLE_ASSERTIONS */
ldr x0, [x0, #CONSOLE_T_PL011_BASE] ldr x0, [x0, #CONSOLE_T_BASE]
b console_pl011_core_flush b console_pl011_core_flush
endfunc console_pl011_flush endfunc console_pl011_flush
...@@ -81,17 +81,10 @@ ...@@ -81,17 +81,10 @@
#endif /* !PL011_GENERIC_UART */ #endif /* !PL011_GENERIC_UART */
#define CONSOLE_T_PL011_BASE CONSOLE_T_DRVDATA
#ifndef __ASSEMBLER__ #ifndef __ASSEMBLER__
#include <stdint.h> #include <stdint.h>
typedef struct {
console_t console;
uintptr_t base;
} console_pl011_t;
/* /*
* Initialize a new PL011 console instance and register it with the console * Initialize a new PL011 console instance and register it with the console
* framework. The |console| pointer must point to storage that will be valid * framework. The |console| pointer must point to storage that will be valid
...@@ -99,7 +92,7 @@ typedef struct { ...@@ -99,7 +92,7 @@ typedef struct {
* Its contents will be reinitialized from scratch. * Its contents will be reinitialized from scratch.
*/ */
int console_pl011_register(uintptr_t baseaddr, uint32_t clock, uint32_t baud, int console_pl011_register(uintptr_t baseaddr, uint32_t clock, uint32_t baud,
console_pl011_t *console); console_t *console);
#endif /*__ASSEMBLER__*/ #endif /*__ASSEMBLER__*/
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
/******************************************************************************* /*******************************************************************************
* Functions that set up the console * Functions that set up the console
******************************************************************************/ ******************************************************************************/
static console_pl011_t arm_boot_console; static console_t arm_boot_console;
static console_pl011_t arm_runtime_console; static console_t arm_runtime_console;
/* Initialize the console to provide early debug support */ /* Initialize the console to provide early debug support */
void __init arm_console_boot_init(void) void __init arm_console_boot_init(void)
...@@ -35,13 +35,13 @@ void __init arm_console_boot_init(void) ...@@ -35,13 +35,13 @@ void __init arm_console_boot_init(void)
panic(); panic();
} }
console_set_scope(&arm_boot_console.console, CONSOLE_FLAG_BOOT); console_set_scope(&arm_boot_console, CONSOLE_FLAG_BOOT);
} }
void arm_console_boot_end(void) void arm_console_boot_end(void)
{ {
(void)console_flush(); (void)console_flush();
(void)console_unregister(&arm_boot_console.console); (void)console_unregister(&arm_boot_console);
} }
/* Initialize the runtime console */ /* Initialize the runtime console */
...@@ -54,7 +54,7 @@ void arm_console_runtime_init(void) ...@@ -54,7 +54,7 @@ void arm_console_runtime_init(void)
if (rc == 0) if (rc == 0)
panic(); panic();
console_set_scope(&arm_runtime_console.console, CONSOLE_FLAG_RUNTIME); console_set_scope(&arm_runtime_console, CONSOLE_FLAG_RUNTIME);
} }
void arm_console_runtime_end(void) void arm_console_runtime_end(void)
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
/******************************************************************************* /*******************************************************************************
* Initialize the UART * Initialize the UART
******************************************************************************/ ******************************************************************************/
static console_pl011_t arm_tsp_runtime_console; static console_t arm_tsp_runtime_console;
void arm_tsp_early_platform_setup(void) void arm_tsp_early_platform_setup(void)
{ {
...@@ -43,7 +43,7 @@ void arm_tsp_early_platform_setup(void) ...@@ -43,7 +43,7 @@ void arm_tsp_early_platform_setup(void)
if (rc == 0) if (rc == 0)
panic(); panic();
console_set_scope(&arm_tsp_runtime_console.console, console_set_scope(&arm_tsp_runtime_console,
CONSOLE_FLAG_BOOT | CONSOLE_FLAG_RUNTIME); CONSOLE_FLAG_BOOT | CONSOLE_FLAG_RUNTIME);
} }
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
/* Data structure which holds the extents of the trusted RAM for BL1 */ /* Data structure which holds the extents of the trusted RAM for BL1 */
static meminfo_t bl1_tzram_layout; static meminfo_t bl1_tzram_layout;
static console_pl011_t console; static console_t console;
enum { enum {
BOOT_NORMAL = 0, BOOT_NORMAL = 0,
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#define BL2_RW_BASE (BL_CODE_END) #define BL2_RW_BASE (BL_CODE_END)
static meminfo_t bl2_el3_tzram_layout; static meminfo_t bl2_el3_tzram_layout;
static console_pl011_t console; static console_t console;
enum { enum {
BOOT_MODE_RECOVERY = 0, BOOT_MODE_RECOVERY = 0,
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
static entry_point_info_t bl32_ep_info; static entry_point_info_t bl32_ep_info;
static entry_point_info_t bl33_ep_info; static entry_point_info_t bl33_ep_info;
static console_pl011_t console; static console_t console;
/****************************************************************************** /******************************************************************************
* On a GICv2 system, the Group 1 secure interrupts are treated as Group 0 * On a GICv2 system, the Group 1 secure interrupts are treated as Group 0
......
...@@ -41,7 +41,7 @@ enum { ...@@ -41,7 +41,7 @@ enum {
/* Data structure which holds the extents of the trusted RAM for BL1 */ /* Data structure which holds the extents of the trusted RAM for BL1 */
static meminfo_t bl1_tzram_layout; static meminfo_t bl1_tzram_layout;
static console_pl011_t console; static console_t console;
/****************************************************************************** /******************************************************************************
* On a GICv2 system, the Group 1 secure interrupts are treated as Group 0 * On a GICv2 system, the Group 1 secure interrupts are treated as Group 0
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#define BL2_RW_BASE (BL_CODE_END) #define BL2_RW_BASE (BL_CODE_END)
static meminfo_t bl2_el3_tzram_layout; static meminfo_t bl2_el3_tzram_layout;
static console_pl011_t console; static console_t console;
extern int load_lpm3(void); extern int load_lpm3(void);
enum { enum {
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
static entry_point_info_t bl32_ep_info; static entry_point_info_t bl32_ep_info;
static entry_point_info_t bl33_ep_info; static entry_point_info_t bl33_ep_info;
static console_pl011_t console; static console_t console;
/****************************************************************************** /******************************************************************************
* On a GICv2 system, the Group 1 secure interrupts are treated as Group 0 * On a GICv2 system, the Group 1 secure interrupts are treated as Group 0
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
#define AXI_CONF_BASE 0x820 #define AXI_CONF_BASE 0x820
static unsigned int uart_base; static unsigned int uart_base;
static console_pl011_t console; static console_t console;
static uintptr_t hikey960_sec_entrypoint; static uintptr_t hikey960_sec_entrypoint;
static void hikey960_pwr_domain_standby(plat_local_state_t cpu_state) static void hikey960_pwr_domain_standby(plat_local_state_t cpu_state)
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
/* Data structure which holds the extents of the trusted RAM for BL1 */ /* Data structure which holds the extents of the trusted RAM for BL1 */
static meminfo_t bl1_tzram_layout; static meminfo_t bl1_tzram_layout;
static meminfo_t bl2_tzram_layout; static meminfo_t bl2_tzram_layout;
static console_pl011_t console; static console_t console;
/* /*
* Cannot use default weak implementation in bl1_main.c because BL1 RW data is * Cannot use default weak implementation in bl1_main.c because BL1 RW data is
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include "plat_private.h" #include "plat_private.h"
static meminfo_t bl2_tzram_layout __aligned(CACHE_WRITEBACK_GRANULE); static meminfo_t bl2_tzram_layout __aligned(CACHE_WRITEBACK_GRANULE);
static console_pl011_t console; static console_t console;
/******************************************************************************* /*******************************************************************************
* Transfer SCP_BL2 from Trusted RAM using the SCP Download protocol. * Transfer SCP_BL2 from Trusted RAM using the SCP Download protocol.
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
static entry_point_info_t bl32_image_ep_info; static entry_point_info_t bl32_image_ep_info;
static entry_point_info_t bl33_image_ep_info; static entry_point_info_t bl33_image_ep_info;
static console_pl011_t console; static console_t console;
static void hisi_tzpc_sec_init(void) static void hisi_tzpc_sec_init(void)
{ {
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include <drivers/console.h> #include <drivers/console.h>
#include <drivers/arm/pl011.h> #include <drivers/arm/pl011.h>
static console_pl011_t console; static console_t console;
void qemu_console_init(void) void qemu_console_init(void)
{ {
...@@ -17,7 +17,7 @@ void qemu_console_init(void) ...@@ -17,7 +17,7 @@ void qemu_console_init(void)
PLAT_QEMU_BOOT_UART_CLK_IN_HZ, PLAT_QEMU_BOOT_UART_CLK_IN_HZ,
PLAT_QEMU_CONSOLE_BAUDRATE, &console); PLAT_QEMU_CONSOLE_BAUDRATE, &console);
console_set_scope(&console.console, CONSOLE_FLAG_BOOT | console_set_scope(&console, CONSOLE_FLAG_BOOT |
CONSOLE_FLAG_RUNTIME); CONSOLE_FLAG_RUNTIME);
} }
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include <lib/mmio.h> #include <lib/mmio.h>
#include <sq_common.h> #include <sq_common.h>
static console_pl011_t console; static console_t console;
static entry_point_info_t bl32_image_ep_info; static entry_point_info_t bl32_image_ep_info;
static entry_point_info_t bl33_image_ep_info; static entry_point_info_t bl33_image_ep_info;
...@@ -69,8 +69,7 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1, ...@@ -69,8 +69,7 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
PLAT_SQ_BOOT_UART_CLK_IN_HZ, PLAT_SQ_BOOT_UART_CLK_IN_HZ,
SQ_CONSOLE_BAUDRATE, &console); SQ_CONSOLE_BAUDRATE, &console);
console_set_scope(&console.console, CONSOLE_FLAG_BOOT | console_set_scope(&console, CONSOLE_FLAG_BOOT | CONSOLE_FLAG_RUNTIME);
CONSOLE_FLAG_RUNTIME);
/* There are no parameters from BL2 if BL31 is a reset vector */ /* There are no parameters from BL2 if BL31 is a reset vector */
assert(arg0 == 0U); assert(arg0 == 0U);
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
static entry_point_info_t bl32_image_ep_info; static entry_point_info_t bl32_image_ep_info;
static entry_point_info_t bl33_image_ep_info; static entry_point_info_t bl33_image_ep_info;
static console_pl011_t versal_runtime_console; static console_t versal_runtime_console;
/* /*
* Return a pointer to the 'entry_point_info' structure of the next image for * Return a pointer to the 'entry_point_info' structure of the next image for
...@@ -71,7 +71,7 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1, ...@@ -71,7 +71,7 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
if (rc == 0) if (rc == 0)
panic(); panic();
console_set_scope(&versal_runtime_console.console, CONSOLE_FLAG_BOOT | console_set_scope(&versal_runtime_console, CONSOLE_FLAG_BOOT |
CONSOLE_FLAG_RUNTIME); CONSOLE_FLAG_RUNTIME);
/* Initialize the platform config for future decision making */ /* Initialize the platform config for future decision making */
......
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