diff options
Diffstat (limited to 'bl1')
-rw-r--r-- | bl1/aarch64/bl1_entrypoint.S | 121 | ||||
-rw-r--r-- | bl1/bl1.ld.S | 6 | ||||
-rw-r--r-- | bl1/bl1_main.c | 53 |
3 files changed, 28 insertions, 152 deletions
diff --git a/bl1/aarch64/bl1_entrypoint.S b/bl1/aarch64/bl1_entrypoint.S index 8babb33c..4fc52918 100644 --- a/bl1/aarch64/bl1_entrypoint.S +++ b/bl1/aarch64/bl1_entrypoint.S @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2014, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2013-2015, ARM Limited and Contributors. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -29,7 +29,7 @@ */ #include <arch.h> -#include <asm_macros.S> +#include <el3_common_macros.S> .globl bl1_entrypoint @@ -42,116 +42,19 @@ */ func bl1_entrypoint - /* --------------------------------------------- - * Set the CPU endianness before doing anything - * that might involve memory reads or writes. - * --------------------------------------------- - */ - mrs x0, sctlr_el3 - bic x0, x0, #SCTLR_EE_BIT - msr sctlr_el3, x0 - isb - - /* --------------------------------------------- - * Perform any processor specific actions upon - * reset e.g. cache, tlb invalidations etc. - * --------------------------------------------- - */ - bl reset_handler - - /* --------------------------------------------- - * Enable the instruction cache, stack pointer - * and data access alignment checks - * --------------------------------------------- - */ - mov x1, #(SCTLR_I_BIT | SCTLR_A_BIT | SCTLR_SA_BIT) - mrs x0, sctlr_el3 - orr x0, x0, x1 - msr sctlr_el3, x0 - isb - - /* --------------------------------------------- - * Set the exception vector to something sane. - * --------------------------------------------- - */ - adr x0, bl1_exceptions - msr vbar_el3, x0 - isb - - /* --------------------------------------------- - * Enable the SError interrupt now that the - * exception vectors have been setup. - * --------------------------------------------- - */ - msr daifclr, #DAIF_ABT_BIT - /* --------------------------------------------------------------------- - * The initial state of the Architectural feature trap register - * (CPTR_EL3) is unknown and it must be set to a known state. All - * feature traps are disabled. Some bits in this register are marked as - * Reserved and should not be modified. - * - * CPTR_EL3.TCPAC: This causes a direct access to the CPACR_EL1 from EL1 - * or the CPTR_EL2 from EL2 to trap to EL3 unless it is trapped at EL2. - * CPTR_EL3.TTA: This causes access to the Trace functionality to trap - * to EL3 when executed from EL0, EL1, EL2, or EL3. If system register - * access to trace functionality is not supported, this bit is RES0. - * CPTR_EL3.TFP: This causes instructions that access the registers - * associated with Floating Point and Advanced SIMD execution to trap - * to EL3 when executed from any exception level, unless trapped to EL1 - * or EL2. + * If the reset address is programmable then bl1_entrypoint() is + * executed only on the cold boot path. Therefore, we can skip the warm + * boot mailbox mechanism. * --------------------------------------------------------------------- */ - mrs x0, cptr_el3 - bic w0, w0, #TCPAC_BIT - bic w0, w0, #TTA_BIT - bic w0, w0, #TFP_BIT - msr cptr_el3, x0 - - /* ------------------------------------------------------- - * Will not return from this macro if it is a warm boot. - * ------------------------------------------------------- - */ - wait_for_entrypoint - - bl platform_mem_init - - /* --------------------------------------------- - * Init C runtime environment. - * - Zero-initialise the NOBITS sections. - * There are 2 of them: - * - the .bss section; - * - the coherent memory section. - * - Copy the data section from BL1 image - * (stored in ROM) to the correct location - * in RAM. - * --------------------------------------------- - */ - ldr x0, =__BSS_START__ - ldr x1, =__BSS_SIZE__ - bl zeromem16 - -#if USE_COHERENT_MEM - ldr x0, =__COHERENT_RAM_START__ - ldr x1, =__COHERENT_RAM_UNALIGNED_SIZE__ - bl zeromem16 -#endif - - ldr x0, =__DATA_RAM_START__ - ldr x1, =__DATA_ROM_START__ - ldr x2, =__DATA_SIZE__ - bl memcpy16 - - /* -------------------------------------------- - * Allocate a stack whose memory will be marked - * as Normal-IS-WBWA when the MMU is enabled. - * There is no risk of reading stale stack - * memory after enabling the MMU as only the - * primary cpu is running at the moment. - * -------------------------------------------- - */ - mrs x0, mpidr_el1 - bl platform_set_stack + el3_entrypoint_common \ + _set_endian=1 \ + _warm_boot_mailbox=!PROGRAMMABLE_RESET_ADDRESS \ + _secondary_cold_boot=1 \ + _init_memory=1 \ + _init_c_runtime=1 \ + _exception_vectors=bl1_exceptions /* --------------------------------------------- * Architectural init. can be generic e.g. diff --git a/bl1/bl1.ld.S b/bl1/bl1.ld.S index d682384a..df9a7994 100644 --- a/bl1/bl1.ld.S +++ b/bl1/bl1.ld.S @@ -51,6 +51,12 @@ SECTIONS *(.text*) *(.rodata*) + /* Ensure 8-byte alignment for descriptors and ensure inclusion */ + . = ALIGN(8); + __PARSER_LIB_DESCS_START__ = .; + KEEP(*(.img_parser_lib_descs)) + __PARSER_LIB_DESCS_END__ = .; + /* * Ensure 8-byte alignment for cpu_ops so that its fields are also * aligned. Also ensure cpu_ops inclusion. diff --git a/bl1/bl1_main.c b/bl1/bl1_main.c index a5db0855..e3225319 100644 --- a/bl1/bl1_main.c +++ b/bl1/bl1_main.c @@ -31,7 +31,7 @@ #include <arch.h> #include <arch_helpers.h> #include <assert.h> -#include <auth.h> +#include <auth_mod.h> #include <bl_common.h> #include <debug.h> #include <platform.h> @@ -126,9 +126,9 @@ void bl1_main(void) * Ensure that MMU/Caches and coherency are turned on */ val = read_sctlr_el3(); - assert(val | SCTLR_M_BIT); - assert(val | SCTLR_C_BIT); - assert(val | SCTLR_I_BIT); + assert(val & SCTLR_M_BIT); + assert(val & SCTLR_C_BIT); + assert(val & SCTLR_I_BIT); /* * Check that Cache Writeback Granule (CWG) in CTR_EL0 matches the * provided platform value @@ -157,40 +157,20 @@ void bl1_main(void) /* Find out how much free trusted ram remains after BL1 load */ bl1_tzram_layout = bl1_plat_sec_mem_layout(); + INFO("BL1: Loading BL2\n"); + #if TRUSTED_BOARD_BOOT /* Initialize authentication module */ - auth_init(); - - /* - * Load the BL2 certificate into the BL2 region. This region will be - * overwritten by the image, so the authentication module is responsible - * for storing the relevant data from the certificate (keys, hashes, - * etc.) so it can be used later. - */ - err = load_image(bl1_tzram_layout, - BL2_CERT_NAME, - BL2_BASE, - &bl2_image_info, - NULL); - if (err) { - ERROR("Failed to load BL2 certificate.\n"); - panic(); - } - - err = auth_verify_obj(AUTH_BL2_IMG_CERT, bl2_image_info.image_base, - bl2_image_info.image_size); - if (err) { - ERROR("Failed to validate BL2 certificate.\n"); - panic(); - } + auth_mod_init(); #endif /* TRUSTED_BOARD_BOOT */ /* Load the BL2 image */ - err = load_image(bl1_tzram_layout, - BL2_IMAGE_NAME, + err = load_auth_image(bl1_tzram_layout, + BL2_IMAGE_ID, BL2_BASE, &bl2_image_info, &bl2_ep); + if (err) { /* * TODO: print failure to load BL2 but also add a tzwdog timer @@ -200,19 +180,6 @@ void bl1_main(void) panic(); } -#if TRUSTED_BOARD_BOOT - err = auth_verify_obj(AUTH_BL2_IMG, bl2_image_info.image_base, - bl2_image_info.image_size); - if (err) { - ERROR("Failed to validate BL2 image.\n"); - panic(); - } - - /* After working with data, invalidate the data cache */ - inv_dcache_range(bl2_image_info.image_base, - (size_t)bl2_image_info.image_size); -#endif /* TRUSTED_BOARD_BOOT */ - /* * Create a new layout of memory for BL2 as seen by BL1 i.e. * tell it the amount of total and free memory available. |