diff options
author | danh-arm <dan.handley@arm.com> | 2014-07-28 14:28:40 +0100 |
---|---|---|
committer | danh-arm <dan.handley@arm.com> | 2014-07-28 14:28:40 +0100 |
commit | 6397bf6a99d785caa9b50016cd6c8eb76083c117 (patch) | |
tree | 5e9ffd003cb8046b7eba285907bdedf4bd8c20ba /plat | |
parent | 9fd412770f1a7d9c68731a21f157a326db3c5725 (diff) | |
parent | 8c106902368c40e14c558a0ab91cc57defdc7e81 (diff) |
Merge pull request #172 from soby-mathew/sm/asm_assert
Introduce asm assert and optimize crash reporting
Diffstat (limited to 'plat')
-rw-r--r-- | plat/common/aarch64/platform_helpers.S | 19 | ||||
-rw-r--r-- | plat/fvp/aarch64/fvp_helpers.S | 30 | ||||
-rw-r--r-- | plat/fvp/bl1_fvp_setup.c | 2 | ||||
-rw-r--r-- | plat/fvp/bl2_fvp_setup.c | 2 | ||||
-rw-r--r-- | plat/fvp/bl31_fvp_setup.c | 2 | ||||
-rw-r--r-- | plat/fvp/bl32_fvp_setup.c | 2 | ||||
-rw-r--r-- | plat/fvp/fvp_def.h | 7 | ||||
-rw-r--r-- | plat/fvp/include/plat_macros.S | 78 | ||||
-rw-r--r-- | plat/fvp/platform.mk | 3 |
9 files changed, 124 insertions, 21 deletions
diff --git a/plat/common/aarch64/platform_helpers.S b/plat/common/aarch64/platform_helpers.S index f6ac13e..5e2d1b1 100644 --- a/plat/common/aarch64/platform_helpers.S +++ b/plat/common/aarch64/platform_helpers.S @@ -37,6 +37,8 @@ .weak platform_is_primary_cpu .weak platform_check_mpidr .weak plat_report_exception + .weak plat_crash_console_init + .weak plat_crash_console_putc /* ----------------------------------------------------- * int platform_get_core_pos(int mpidr); @@ -79,3 +81,20 @@ func platform_check_mpidr */ func plat_report_exception ret + + /* ----------------------------------------------------- + * Placeholder function which should be redefined by + * each platform. + * ----------------------------------------------------- + */ +func plat_crash_console_init + mov x0, #0 + ret + + /* ----------------------------------------------------- + * Placeholder function which should be redefined by + * each platform. + * ----------------------------------------------------- + */ +func plat_crash_console_putc + ret diff --git a/plat/fvp/aarch64/fvp_helpers.S b/plat/fvp/aarch64/fvp_helpers.S index 3cd0b46..823588e 100644 --- a/plat/fvp/aarch64/fvp_helpers.S +++ b/plat/fvp/aarch64/fvp_helpers.S @@ -32,6 +32,7 @@ #include <asm_macros.S> #include <bl_common.h> #include <gic_v2.h> +#include <pl011.h> #include "../drivers/pwrc/fvp_pwrc.h" #include "../fvp_def.h" @@ -39,6 +40,8 @@ .globl plat_secondary_cold_boot_setup .globl platform_mem_init .globl plat_report_exception + .globl plat_crash_console_init + .globl plat_crash_console_putc .macro fvp_choose_gicmmap param1, param2, x_tmp, w_tmp, res ldr \x_tmp, =VE_SYSREGS_BASE + V2M_SYS_ID @@ -187,3 +190,30 @@ func plat_report_exception add x1, x1, #V2M_SYS_LED str w0, [x1] ret + + /* Define a crash console for the plaform */ +#define FVP_CRASH_CONSOLE_BASE PL011_UART0_BASE + + /* --------------------------------------------- + * 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, FVP_CRASH_CONSOLE_BASE + mov_imm x1, PL011_UART0_CLK_IN_HZ + mov_imm x2, PL011_BAUDRATE + b console_core_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, FVP_CRASH_CONSOLE_BASE + b console_core_putc diff --git a/plat/fvp/bl1_fvp_setup.c b/plat/fvp/bl1_fvp_setup.c index bfd0f55..b146fdb 100644 --- a/plat/fvp/bl1_fvp_setup.c +++ b/plat/fvp/bl1_fvp_setup.c @@ -73,7 +73,7 @@ void bl1_early_platform_setup(void) const size_t bl1_size = BL1_RAM_LIMIT - BL1_RAM_BASE; /* Initialize the console to provide early debug support */ - console_init(PL011_UART0_BASE); + console_init(PL011_UART0_BASE, PL011_UART0_CLK_IN_HZ, PL011_BAUDRATE); /* Allow BL1 to see the whole Trusted RAM */ bl1_tzram_layout.total_base = TZRAM_BASE; diff --git a/plat/fvp/bl2_fvp_setup.c b/plat/fvp/bl2_fvp_setup.c index beba804..c0ad340 100644 --- a/plat/fvp/bl2_fvp_setup.c +++ b/plat/fvp/bl2_fvp_setup.c @@ -168,7 +168,7 @@ struct entry_point_info *bl2_plat_get_bl31_ep_info(void) void bl2_early_platform_setup(meminfo_t *mem_layout) { /* Initialize the console to provide early debug support */ - console_init(PL011_UART0_BASE); + console_init(PL011_UART0_BASE, PL011_UART0_CLK_IN_HZ, PL011_BAUDRATE); /* Setup the BL2 memory layout */ bl2_tzram_layout = *mem_layout; diff --git a/plat/fvp/bl31_fvp_setup.c b/plat/fvp/bl31_fvp_setup.c index 96f4772..ca72aa9 100644 --- a/plat/fvp/bl31_fvp_setup.c +++ b/plat/fvp/bl31_fvp_setup.c @@ -143,7 +143,7 @@ void bl31_early_platform_setup(bl31_params_t *from_bl2, void *plat_params_from_bl2) { /* Initialize the console to provide early debug support */ - console_init(PL011_UART0_BASE); + console_init(PL011_UART0_BASE, PL011_UART0_CLK_IN_HZ, PL011_BAUDRATE); /* Initialize the platform config for future decision making */ fvp_config_setup(); diff --git a/plat/fvp/bl32_fvp_setup.c b/plat/fvp/bl32_fvp_setup.c index 901c585..aa49ff3 100644 --- a/plat/fvp/bl32_fvp_setup.c +++ b/plat/fvp/bl32_fvp_setup.c @@ -72,7 +72,7 @@ void bl32_early_platform_setup(void) * Initialize a different console than already in use to display * messages from TSP */ - console_init(PL011_UART1_BASE); + console_init(PL011_UART1_BASE, PL011_UART1_CLK_IN_HZ, PL011_BAUDRATE); /* Initialize the platform config for future decision making */ fvp_config_setup(); diff --git a/plat/fvp/fvp_def.h b/plat/fvp/fvp_def.h index 89c8b02..21edb3b 100644 --- a/plat/fvp/fvp_def.h +++ b/plat/fvp/fvp_def.h @@ -198,6 +198,13 @@ #define PL011_UART2_BASE 0x1c0b0000 #define PL011_UART3_BASE 0x1c0c0000 +#define PL011_BAUDRATE 115200 + +#define PL011_UART0_CLK_IN_HZ 24000000 +#define PL011_UART1_CLK_IN_HZ 24000000 +#define PL011_UART2_CLK_IN_HZ 24000000 +#define PL011_UART3_CLK_IN_HZ 24000000 + /******************************************************************************* * TrustZone address space controller related constants ******************************************************************************/ diff --git a/plat/fvp/include/plat_macros.S b/plat/fvp/include/plat_macros.S index 602eaf1..727b958 100644 --- a/plat/fvp/include/plat_macros.S +++ b/plat/fvp/include/plat_macros.S @@ -27,31 +27,79 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ - +#include <cci400.h> #include <gic_v2.h> #include <plat_config.h> +#include "platform_def.h" .section .rodata.gic_reg_name, "aS" -gic_regs: .asciz "gic_iar", "gic_ctlr", "" +gic_regs: + .asciz "gic_hppir", "gic_ahppir", "gic_ctlr", "" +gicd_pend_reg: + .asciz "gicd_ispendr regs (Offsets 0x200 - 0x278)\n Offset:\t\t\tvalue\n" +newline: + .asciz "\n" +spacer: + .asciz ":\t\t0x" -/* Currently we have only 2 GIC registers to report */ -#define GIC_REG_SIZE (2 * 8) /* --------------------------------------------- * The below macro prints out relevant GIC * registers whenever an unhandled exception is * taken in BL31. + * Clobbers: x0 - x10, x16, sp * --------------------------------------------- */ .macro plat_print_gic_regs - adr x0, plat_config; - ldr w0, [x0, #CONFIG_GICC_BASE_OFFSET] - /* gic base address is now in x0 */ - ldr w1, [x0, #GICC_IAR] - ldr w2, [x0, #GICC_CTLR] - sub sp, sp, #GIC_REG_SIZE - stp x1, x2, [sp] /* we store the gic registers as 64 bit */ - adr x0, gic_regs - mov x1, sp - bl print_string_value - add sp, sp, #GIC_REG_SIZE + adr x0, plat_config + ldr w16, [x0, #CONFIG_GICC_BASE_OFFSET] + cbz x16, 1f + /* gic base address is now in x16 */ + adr x6, gic_regs /* Load the gic reg list to x6 */ + /* Load the gic regs to gp regs used by str_in_crash_buf_print */ + ldr w8, [x16, #GICC_HPPIR] + ldr w9, [x16, #GICC_AHPPIR] + ldr w10, [x16, #GICC_CTLR] + /* Store to the crash buf and print to cosole */ + bl str_in_crash_buf_print + + /* Print the GICD_ISPENDR regs */ + add x7, x16, #GICD_ISPENDR + adr x4, gicd_pend_reg + bl asm_print_str +2: + sub x4, x7, x16 + cmp x4, #0x280 + b.eq 1f + bl asm_print_hex + adr x4, spacer + bl asm_print_str + ldr x4, [x7], #8 + bl asm_print_hex + adr x4, newline + bl asm_print_str + b 2b +1: + .endm + +.section .rodata.cci_reg_name, "aS" +cci_iface_regs: + .asciz "cci_snoop_ctrl_cluster0", "cci_snoop_ctrl_cluster1" , "" + + /* ------------------------------------------------ + * The below macro prints out relevant interconnect + * registers whenever an unhandled exception is + * taken in BL31. + * Clobbers: x0 - x9, sp + * ------------------------------------------------ + */ + .macro plat_print_interconnect_regs + adr x6, cci_iface_regs + /* Store in x7 the base address of the first interface */ + mov_imm x7, (CCI400_BASE + SLAVE_IFACE3_OFFSET) + ldr w8, [x7, #SNOOP_CTRL_REG] + /* Store in x7 the base address of the second interface */ + mov_imm x7, (CCI400_BASE + SLAVE_IFACE4_OFFSET) + ldr w9, [x7, #SNOOP_CTRL_REG] + /* Store to the crash buf and print to console */ + bl str_in_crash_buf_print .endm diff --git a/plat/fvp/platform.mk b/plat/fvp/platform.mk index b22a339..f6275b7 100644 --- a/plat/fvp/platform.mk +++ b/plat/fvp/platform.mk @@ -45,8 +45,7 @@ $(eval $(call add_define,TSP_RAM_LOCATION_ID)) PLAT_INCLUDES := -Iplat/fvp/include/ -PLAT_BL_COMMON_SOURCES := drivers/arm/pl011/pl011.c \ - drivers/arm/pl011/pl011_console.c \ +PLAT_BL_COMMON_SOURCES := drivers/arm/pl011/pl011_console.S \ drivers/io/io_fip.c \ drivers/io/io_memmap.c \ drivers/io/io_semihosting.c \ |