]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
16550: Use generic console_t data structure
authorAndre Przywara <andre.przywara@arm.com>
Sat, 25 Jan 2020 00:58:35 +0000 (00:58 +0000)
committerAndre Przywara <andre.przywara@arm.com>
Tue, 25 Feb 2020 09:34:38 +0000 (09:34 +0000)
Since now the generic console_t structure holds the UART base address as
well, let's use that generic location and drop the UART driver specific
data structure at all.

Change-Id: I5c2fe3b6a667acf80c808cfec4a64059a2c9c25f
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
19 files changed:
drivers/ti/uart/aarch32/16550_console.S
drivers/ti/uart/aarch64/16550_console.S
include/drivers/ti/uart/uart_16550.h
plat/allwinner/common/sunxi_bl31_setup.c
plat/intel/soc/agilex/bl2_plat_setup.c
plat/intel/soc/agilex/bl31_plat_setup.c
plat/intel/soc/stratix10/bl2_plat_setup.c
plat/intel/soc/stratix10/bl31_plat_setup.c
plat/marvell/common/marvell_console.c
plat/mediatek/mt8173/bl31_plat_setup.c
plat/mediatek/mt8183/bl31_plat_setup.c
plat/nvidia/tegra/soc/t132/plat_setup.c
plat/nvidia/tegra/soc/t186/plat_setup.c
plat/nvidia/tegra/soc/t194/plat_setup.c
plat/nvidia/tegra/soc/t210/plat_setup.c
plat/rockchip/common/bl31_plat_setup.c
plat/rockchip/common/sp_min_plat_setup.c
plat/rpi/common/rpi3_common.c
plat/ti/k3/common/k3_console.c

index 5cd9b30cd89f50db890c877b666f774eb707a601..bc0b3ab1c24991536e4dddddc67c0b60675228e0 100644 (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
index 80c1b86462294eab40f3ac5024743ea91c805d40..064022798c2a4bfcd35f08a28f25c5dcdb62e7f0 100644 (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
index 2b95fa33a685c69fdeaed656097e2dd3f27afd00..bddd9970ca9bb502e48f4999d7c3b7a09c80d5f9 100644 (file)
 #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__*/
 
index a24527c5d08860d6bee22fa11047dd7e0303f1c3..e836a345bfc9aa0ff2fcc20694c02d6e968f218c 100644 (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,
index f32820777fc68ad758c8e4ae56b9db0bb4ec1837..468b356b572f1e47ee58d202c3289978651b0bed 100644 (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();
index 4b1144095575075105fe274967a58ae3813f0e97..6f32aff4adcac6491e602fed3e8ef4d2e53fab62 100644 (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);
index 78ca253e79ca2200a740599a2d4c52c9c3184b43..d0c8e4c7b0ff33649b64e6230a1da2b4bc0ab6e5 100644 (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();
index 4c3123815a6146f7e2bfeb9c9b454b7eee52cf49..5813c8f8ce2198ae2ccc832389bf58dfa4070a88 100644 (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);
index 22c5eb3afd98a967253f632a40b8f6c00f6693f8..33931afdaf64fae84dea4ba92546ce02737e3d20 100644 (file)
@@ -20,8 +20,8 @@ static console_a3700_t marvell_runtime_console;
 #else
 #include <drivers/ti/uart/uart_16550.h>
 
-static console_16550_t marvell_boot_console;
-static console_16550_t marvell_runtime_console;
+static console_t marvell_boot_console;
+static console_t marvell_runtime_console;
 #endif
 
 /*******************************************************************************
@@ -50,15 +50,14 @@ 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 */
@@ -77,13 +76,12 @@ void marvell_console_runtime_init(void)
        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);
 }
index 73a479b506cb403e398ad64247a4562b46303b07..bd7d0b0ee0f58f3ee3bee1f23d8f8878693d4d15 100644 (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);
 
index 8204d771706c732f9809f769217307a2cc5d1608..e96b4ad0c530227dbb6b7b2b8cb292e26f6fb36c 100644 (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);
 
index 4bfc2de0e9eea03b8f333466e660820e4d20a25f..43acdd6425d934d59f7bb07d59b910efd54051b8 100644 (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);
        }
 }
index 06a328427f5c3297bda974a4c2f77c7aca8ef519..7028bfc5d2974848f602f64eda6655c029035c02 100644 (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);
        }
 }
index 3640ade0a205f206ac34e985d442bcf0b2a00b53..7f2b00d1bd79e1fcae59db36c9d76afba7f79fa4 100644 (file)
@@ -174,7 +174,7 @@ void plat_enable_console(int32_t id)
                        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)) {
                /*
index c32772de86a2ea782be4451958bfc118b0b47d54..7afbe0d9a4616c0cbaba192e88c504704df27e20 100644 (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);
        }
 }
index c4a03592ea87dc8daef1df5652ae185fe0df3b3c..98ef415c9fabba220910d699474c2fef4efac7a0 100644 (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);
 
index 6d15075f2a848003fa6de64bf785d988a4c34e1a..0237b167fbd86eeb63ce2b51ed6b57ccd230443e 100644 (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);
 
index ff3369427d2a4149c34cae4891eac85c37e06020..27281f2ba8bb1c8d9f62546b10c92059cc2eb940 100644 (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);
 }
 
 /*******************************************************************************
index ba0ddacec5e6d418d64f5405be1482b386d5e7cc..8c44c17e249b1d9683393fbc3ca927d3a2c94c63 100644 (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,