rockchip: Move to MULTI_CONSOLE_API
authorJulius Werner <jwerner@chromium.org>
Wed, 2 Aug 2017 23:31:04 +0000 (16:31 -0700)
committerJulius Werner <jwerner@chromium.org>
Fri, 19 Jan 2018 23:21:12 +0000 (15:21 -0800)
This patch changes all Rockchip platforms to use the new
MULTI_CONSOLE_API. The platform-specific plat_crash_console
implementations are removed so that the platform can use the ones from
the common platform code instead.

Also change the registers used in plat_crash_print_regs. The existing
use of x16 and x17 has always been illegal, since those registers are
reserved for use by the linker as a temporary scratch registers in
intra-procedure-call veneers and can never be expected to maintain their
values across a function call.

Change-Id: I8249424150be8d5543ed4af93b56756795a5288f
Signed-off-by: Julius Werner <jwerner@chromium.org>
plat/rockchip/common/aarch64/plat_helpers.S
plat/rockchip/common/bl31_plat_setup.c
plat/rockchip/common/include/plat_macros.S
plat/rockchip/rk3328/platform.mk
plat/rockchip/rk3368/platform.mk
plat/rockchip/rk3399/platform.mk

index 24cb8e45afd4b490aefe9157a4d7eef7b49c67d5..f415f87723ad29596b632e8a85d89300eeb8c6b3 100644 (file)
@@ -19,8 +19,6 @@
        .globl  plat_secondary_cold_boot_setup
        .globl  plat_report_exception
        .globl  platform_is_primary_cpu
-       .globl  plat_crash_console_init
-       .globl  plat_crash_console_putc
        .globl  plat_my_core_pos
        .globl  plat_reset_handler
        .globl  plat_panic_handler
@@ -82,32 +80,6 @@ func platform_is_primary_cpu
        ret
 endfunc platform_is_primary_cpu
 
-       /* --------------------------------------------------------------------
-        * int plat_crash_console_init(void)
-        * Function to initialize the crash console
-        * without a C Runtime to print crash report.
-        * Clobber list : x0, x1, x2
-        * --------------------------------------------------------------------
-        */
-func plat_crash_console_init
-       mov_imm x0, PLAT_RK_UART_BASE
-       mov_imm x1, PLAT_RK_UART_CLOCK
-       mov_imm x2, PLAT_RK_UART_BAUDRATE
-       b       console_core_init
-endfunc plat_crash_console_init
-
-       /* --------------------------------------------------------------------
-        * int plat_crash_console_putc(void)
-        * Function to print a character on the crash
-        * console without a C Runtime.
-        * Clobber list : x1, x2
-        * --------------------------------------------------------------------
-        */
-func plat_crash_console_putc
-       mov_imm x1, PLAT_RK_UART_BASE
-       b       console_core_putc
-endfunc plat_crash_console_putc
-
        /* --------------------------------------------------------------------
         * void plat_panic_handler(void)
         * Call system reset function on panic. Set up an emergency stack so we
index 28a83880fc2503148e32bc38e48c8c3f4b0f20a3..6199edae2fc3ae51f0362800da10206d553a8e15 100644 (file)
@@ -71,15 +71,19 @@ void params_early_setup(void *plat_param_from_bl2)
 void bl31_early_platform_setup(bl31_params_t *from_bl2,
                               void *plat_params_from_bl2)
 {
+       static console_16550_t console;
+
        params_early_setup(plat_params_from_bl2);
 
 #if COREBOOT
        if (coreboot_serial.type)
-               console_init(coreboot_serial.baseaddr,
-                            coreboot_serial.input_hertz, coreboot_serial.baud);
+               console_16550_register(coreboot_serial.baseaddr,
+                                      coreboot_serial.input_hertz,
+                                      coreboot_serial.baud,
+                                      &console);
 #else
-       console_init(PLAT_RK_UART_BASE, PLAT_RK_UART_CLOCK,
-                    PLAT_RK_UART_BAUDRATE);
+       console_16550_register(PLAT_RK_UART_BASE, PLAT_RK_UART_CLOCK,
+                              PLAT_RK_UART_BAUDRATE, &console);
 #endif
 
        VERBOSE("bl31_setup\n");
index be1a9fa5dc1f28375d2aafef7d4ded8d41b3ab0e..6b3cb6a72dff9b58b55b12c34415cda181e2fed2 100644 (file)
@@ -38,14 +38,14 @@ cci_iface_regs:
         * The below utility macro prints out relevant GIC
         * and CCI registers whenever an unhandled
         * exception is taken in BL31.
-        * Expects: GICD base in x16, GICC base in x17
+        * Expects: GICD base in x26, GICC base in x27
         * Clobbers: x0 - x10, sp
         * ---------------------------------------------
         */
        .macro plat_crash_print_regs
 
-       mov_imm x16, PLAT_RK_GICD_BASE
-       mov_imm x17, PLAT_RK_GICC_BASE
+       mov_imm x26, PLAT_RK_GICD_BASE
+       mov_imm x27, PLAT_RK_GICC_BASE
 
        /* Check for GICv3 system register access */
        mrs     x7, id_aa64pfr0_el1
@@ -72,19 +72,19 @@ print_gicv2:
        /* Load the gicc reg list to x6 */
        adr     x6, gicc_regs
        /* Load the gicc regs to gp regs used by str_in_crash_buf_print */
-       ldr     w8, [x17, #GICC_HPPIR]
-       ldr     w9, [x17, #GICC_AHPPIR]
-       ldr     w10, [x17, #GICC_CTLR]
+       ldr     w8, [x27, #GICC_HPPIR]
+       ldr     w9, [x27, #GICC_AHPPIR]
+       ldr     w10, [x27, #GICC_CTLR]
        /* Store to the crash buf and print to console */
        bl      str_in_crash_buf_print
 
 print_gic_common:
        /* Print the GICD_ISPENDR regs */
-       add     x7, x16, #GICD_ISPENDR
+       add     x7, x26, #GICD_ISPENDR
        adr     x4, gicd_pend_reg
        bl      asm_print_str
 gicd_ispendr_loop:
-       sub     x4, x7, x16
+       sub     x4, x7, x26
        cmp     x4, #0x280
        b.eq    exit_print_gic_regs
        bl      asm_print_hex
index b4b2bc45a5ffcfbc805ad9fdcee14ccf82d14256..6e4d5b4dc0cd23a45139d80917a2c374fa48b416 100644 (file)
@@ -49,6 +49,7 @@ BL31_SOURCES          +=      ${RK_GIC_SOURCES}                               \
                                ${RK_PLAT_SOC}/drivers/soc/soc.c
 
 ENABLE_PLAT_COMPAT     :=      0
+MULTI_CONSOLE_API      :=      1
 
 include lib/coreboot/coreboot.mk
 
index c6e9bcd46358e2c523208e27dbc314b4ae4f2038..ad204e9ebebdb26cbee3e2a6716dfeca6d2778ad 100644 (file)
@@ -49,6 +49,7 @@ BL31_SOURCES          +=      ${RK_GIC_SOURCES}                               \
                                ${RK_PLAT_SOC}/drivers/ddr/ddr_rk3368.c         \
 
 ENABLE_PLAT_COMPAT     :=      0
+MULTI_CONSOLE_API      :=      1
 
 include lib/coreboot/coreboot.mk
 
index f9d141d4f829b5ca0fcb473c126a6119f8ce553a..9e369e482c4c98714c472c1b74a4b4139a9dc31f 100644 (file)
@@ -64,6 +64,7 @@ BL31_SOURCES  +=      ${RK_GIC_SOURCES}                               \
                        ${RK_PLAT_SOC}/drivers/dram/suspend.c
 
 ENABLE_PLAT_COMPAT     :=      0
+MULTI_CONSOLE_API      :=      1
 
 include lib/coreboot/coreboot.mk