Commit 44abeaa6 authored by danh-arm's avatar danh-arm Committed by GitHub
Browse files

Merge pull request #713 from yatharth-arm/yk/AArch32_porting

Add basic AArch32 support for BL1 & BL2
parents 131f7cd4 03a3042b
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <cpu_data.h> #include <cpu_data.h>
#include <cpu_macros.S> #include <cpu_macros.S>
#if IMAGE_BL1 || IMAGE_BL32
/* /*
* The reset handler common to all platforms. After a matching * The reset handler common to all platforms. After a matching
* cpu_ops structure entry is found, the correponding reset_handler * cpu_ops structure entry is found, the correponding reset_handler
...@@ -65,6 +66,9 @@ func reset_handler ...@@ -65,6 +66,9 @@ func reset_handler
bx lr bx lr
endfunc reset_handler endfunc reset_handler
#endif /* IMAGE_BL1 || IMAGE_BL32 */
#if IMAGE_BL32 /* The power down core and cluster is needed only in BL32 */
/* /*
* The prepare core power down function for all platforms. After * The prepare core power down function for all platforms. After
* the cpu_ops pointer is retrieved from cpu_data, the corresponding * the cpu_ops pointer is retrieved from cpu_data, the corresponding
...@@ -132,6 +136,8 @@ func init_cpu_ops ...@@ -132,6 +136,8 @@ func init_cpu_ops
pop {r4 - r6, pc} pop {r4 - r6, pc}
endfunc init_cpu_ops endfunc init_cpu_ops
#endif /* IMAGE_BL32 */
/* /*
* The below function returns the cpu_ops structure matching the * The below function returns the cpu_ops structure matching the
* midr of the core. It reads the MIDR and finds the matching * midr of the core. It reads the MIDR and finds the matching
......
/*
* Copyright (c) 2016, 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:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of ARM nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <asm_macros.S>
.globl semihosting_call
func semihosting_call
svc #0x123456
bx lr
endfunc semihosting_call
/*
* Copyright (c) 2016, 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:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of ARM nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <asm_macros.S>
#include <bl_common.h>
#include <v2m_def.h>
.globl plat_report_exception
/* -------------------------------------------------------
* void plat_report_exception(unsigned int type)
* Function to report an unhandled exception
* with platform-specific means.
* On FVP platform, it updates the LEDs
* to indicate where we are.
* SYS_LED[0] - 0x0
* SYS_LED[2:1] - 0x0
* SYS_LED[7:3] - Exception Mode.
* Clobbers: r0-r1
* -------------------------------------------------------
*/
func plat_report_exception
lsl r0, r0, #V2M_SYS_LED_EC_SHIFT
ldr r1, =V2M_SYSREGS_BASE
add r1, r1, #V2M_SYS_LED
str r0, [r1]
bx lr
endfunc plat_report_exception
...@@ -31,10 +31,8 @@ ...@@ -31,10 +31,8 @@
PLAT_INCLUDES += -Iinclude/plat/arm/board/common/ \ PLAT_INCLUDES += -Iinclude/plat/arm/board/common/ \
-Iinclude/plat/arm/board/common/drivers -Iinclude/plat/arm/board/common/drivers
PLAT_BL_COMMON_SOURCES += drivers/arm/pl011/${ARCH}/pl011_console.S PLAT_BL_COMMON_SOURCES += drivers/arm/pl011/${ARCH}/pl011_console.S \
ifeq (${ARCH}, aarch64) plat/arm/board/common/${ARCH}/board_arm_helpers.S
PLAT_BL_COMMON_SOURCES += plat/arm/board/common/aarch64/board_arm_helpers.S
endif
BL1_SOURCES += plat/arm/board/common/drivers/norflash/norflash.c BL1_SOURCES += plat/arm/board/common/drivers/norflash/norflash.c
......
...@@ -34,9 +34,22 @@ ...@@ -34,9 +34,22 @@
#include "../drivers/pwrc/fvp_pwrc.h" #include "../drivers/pwrc/fvp_pwrc.h"
#include "../fvp_def.h" #include "../fvp_def.h"
.globl plat_secondary_cold_boot_setup
.globl plat_get_my_entrypoint .globl plat_get_my_entrypoint
.globl plat_is_my_cpu_primary .globl plat_is_my_cpu_primary
/* --------------------------------------------------------------------
* void plat_secondary_cold_boot_setup (void);
*
* For AArch32, cold-booting secondary CPUs is not yet
* implemented and they panic.
* --------------------------------------------------------------------
*/
func plat_secondary_cold_boot_setup
cb_panic:
b cb_panic
endfunc plat_secondary_cold_boot_setup
/* --------------------------------------------------------------------- /* ---------------------------------------------------------------------
* unsigned long plat_get_my_entrypoint (void); * unsigned long plat_get_my_entrypoint (void);
* *
......
...@@ -31,9 +31,13 @@ ...@@ -31,9 +31,13 @@
#include <plat_arm.h> #include <plat_arm.h>
#include "fvp_private.h" #include "fvp_private.h"
#if LOAD_IMAGE_V2
void bl31_early_platform_setup(void *from_bl2,
void *plat_params_from_bl2)
#else
void bl31_early_platform_setup(bl31_params_t *from_bl2, void bl31_early_platform_setup(bl31_params_t *from_bl2,
void *plat_params_from_bl2) void *plat_params_from_bl2)
#endif
{ {
arm_bl31_early_platform_setup(from_bl2, plat_params_from_bl2); arm_bl31_early_platform_setup(from_bl2, plat_params_from_bl2);
......
...@@ -109,12 +109,14 @@ FVP_CPU_LIBS += lib/cpus/aarch64/cortex_a35.S \ ...@@ -109,12 +109,14 @@ FVP_CPU_LIBS += lib/cpus/aarch64/cortex_a35.S \
lib/cpus/aarch64/cortex_a57.S \ lib/cpus/aarch64/cortex_a57.S \
lib/cpus/aarch64/cortex_a72.S \ lib/cpus/aarch64/cortex_a72.S \
lib/cpus/aarch64/cortex_a73.S lib/cpus/aarch64/cortex_a73.S
else
FVP_CPU_LIBS += lib/cpus/aarch32/cortex_a32.S
endif endif
BL1_SOURCES += drivers/io/io_semihosting.c \ BL1_SOURCES += drivers/io/io_semihosting.c \
lib/semihosting/semihosting.c \ lib/semihosting/semihosting.c \
lib/semihosting/aarch64/semihosting_call.S \ lib/semihosting/${ARCH}/semihosting_call.S \
plat/arm/board/fvp/aarch64/fvp_helpers.S \ plat/arm/board/fvp/${ARCH}/fvp_helpers.S \
plat/arm/board/fvp/fvp_bl1_setup.c \ plat/arm/board/fvp/fvp_bl1_setup.c \
plat/arm/board/fvp/fvp_err.c \ plat/arm/board/fvp/fvp_err.c \
plat/arm/board/fvp/fvp_io_storage.c \ plat/arm/board/fvp/fvp_io_storage.c \
...@@ -126,7 +128,7 @@ BL1_SOURCES += drivers/io/io_semihosting.c \ ...@@ -126,7 +128,7 @@ BL1_SOURCES += drivers/io/io_semihosting.c \
BL2_SOURCES += drivers/io/io_semihosting.c \ BL2_SOURCES += drivers/io/io_semihosting.c \
drivers/delay_timer/delay_timer.c \ drivers/delay_timer/delay_timer.c \
lib/semihosting/semihosting.c \ lib/semihosting/semihosting.c \
lib/semihosting/aarch64/semihosting_call.S \ lib/semihosting/${ARCH}/semihosting_call.S \
plat/arm/board/fvp/fvp_bl2_setup.c \ plat/arm/board/fvp/fvp_bl2_setup.c \
plat/arm/board/fvp/fvp_err.c \ plat/arm/board/fvp/fvp_err.c \
plat/arm/board/fvp/fvp_io_storage.c \ plat/arm/board/fvp/fvp_io_storage.c \
......
...@@ -31,9 +31,10 @@ ...@@ -31,9 +31,10 @@
#include <plat_arm.h> #include <plat_arm.h>
#include "../fvp_private.h" #include "../fvp_private.h"
void sp_min_early_platform_setup(void) void sp_min_early_platform_setup(void *from_bl2,
void *plat_params_from_bl2)
{ {
arm_sp_min_early_platform_setup(); arm_sp_min_early_platform_setup(from_bl2, plat_params_from_bl2);
/* Initialize the platform config for future decision making */ /* Initialize the platform config for future decision making */
fvp_config_setup(); fvp_config_setup();
......
...@@ -184,6 +184,12 @@ ...@@ -184,6 +184,12 @@
#define PLAT_CSS_PRIMARY_CPU_SHIFT 8 #define PLAT_CSS_PRIMARY_CPU_SHIFT 8
#define PLAT_CSS_PRIMARY_CPU_BIT_WIDTH 4 #define PLAT_CSS_PRIMARY_CPU_BIT_WIDTH 4
/*
* PLAT_CSS_MAX_SCP_BL2_SIZE is calculated using the current
* SCP_BL2 size plus a little space for growth.
*/
#define PLAT_CSS_MAX_SCP_BL2_SIZE 0x1D000
/* /*
* Define a list of Group 1 Secure and Group 0 interrupts as per GICv3 * Define a list of Group 1 Secure and Group 0 interrupts as per GICv3
* terminology. On a GICv2 system or mode, the lists will be merged and treated * terminology. On a GICv2 system or mode, the lists will be merged and treated
......
/*
* Copyright (c) 2016, 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:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of ARM nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <bl_common.h>
#include <desc_image_load.h>
#include <platform.h>
#include <platform_def.h>
/*******************************************************************************
* Following descriptor provides BL image/ep information that gets used
* by BL2 to load the images and also subset of this information is
* passed to next BL image. The image loading sequence is managed by
* populating the images in required loading order. The image execution
* sequence is managed by populating the `next_handoff_image_id` with
* the next executable image id.
******************************************************************************/
static bl_mem_params_node_t bl2_mem_params_descs[] = {
#ifdef SCP_BL2_BASE
/* Fill SCP_BL2 related information if it exists */
{
.image_id = SCP_BL2_IMAGE_ID,
SET_STATIC_PARAM_HEAD(ep_info, PARAM_IMAGE_BINARY,
VERSION_2, entry_point_info_t, SECURE | NON_EXECUTABLE),
SET_STATIC_PARAM_HEAD(image_info, PARAM_IMAGE_BINARY,
VERSION_2, image_info_t, 0),
.image_info.image_base = SCP_BL2_BASE,
.image_info.image_max_size = PLAT_CSS_MAX_SCP_BL2_SIZE,
.next_handoff_image_id = INVALID_IMAGE_ID,
},
#endif /* SCP_BL2_BASE */
/* Fill BL32 related information */
{
.image_id = BL32_IMAGE_ID,
SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
VERSION_2, entry_point_info_t,
SECURE | EXECUTABLE | EP_FIRST_EXE),
.ep_info.pc = BL32_BASE,
.ep_info.spsr = SPSR_MODE32(MODE32_mon, SPSR_T_ARM,
SPSR_E_LITTLE, DISABLE_ALL_EXCEPTIONS),
SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
VERSION_2, image_info_t, IMAGE_ATTRIB_PLAT_SETUP),
.image_info.image_base = BL32_BASE,
.image_info.image_max_size = BL32_LIMIT - BL32_BASE,
.next_handoff_image_id = BL33_IMAGE_ID,
},
/* Fill BL33 related information */
{
.image_id = BL33_IMAGE_ID,
SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
VERSION_2, entry_point_info_t, NON_SECURE | EXECUTABLE),
#ifdef PRELOADED_BL33_BASE
.ep_info.pc = PRELOADED_BL33_BASE,
SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
VERSION_2, image_info_t, IMAGE_ATTRIB_SKIP_LOADING),
#else
.ep_info.pc = PLAT_ARM_NS_IMAGE_OFFSET,
SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
VERSION_2, image_info_t, 0),
.image_info.image_base = PLAT_ARM_NS_IMAGE_OFFSET,
.image_info.image_max_size = ARM_DRAM1_SIZE,
#endif /* PRELOADED_BL33_BASE */
.next_handoff_image_id = INVALID_IMAGE_ID,
}
};
REGISTER_BL_IMAGE_DESCS(bl2_mem_params_descs)
/*
* Copyright (c) 2016, 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:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of ARM nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <bl_common.h>
#include <desc_image_load.h>
#include <platform.h>
#include <platform_def.h>
/*******************************************************************************
* Following descriptor provides BL image/ep information that gets used
* by BL2 to load the images and also subset of this information is
* passed to next BL image. The image loading sequence is managed by
* populating the images in required loading order. The image execution
* sequence is managed by populating the `next_handoff_image_id` with
* the next executable image id.
******************************************************************************/
static bl_mem_params_node_t bl2_mem_params_descs[] = {
#ifdef SCP_BL2_BASE
/* Fill SCP_BL2 related information if it exists */
{
.image_id = SCP_BL2_IMAGE_ID,
SET_STATIC_PARAM_HEAD(ep_info, PARAM_IMAGE_BINARY,
VERSION_2, entry_point_info_t, SECURE | NON_EXECUTABLE),
SET_STATIC_PARAM_HEAD(image_info, PARAM_IMAGE_BINARY,
VERSION_2, image_info_t, 0),
.image_info.image_base = SCP_BL2_BASE,
.image_info.image_max_size = PLAT_CSS_MAX_SCP_BL2_SIZE,
.next_handoff_image_id = INVALID_IMAGE_ID,
},
#endif /* SCP_BL2_BASE */
#ifdef EL3_PAYLOAD_BASE
/* Fill EL3 payload related information (BL31 is EL3 payload)*/
{
.image_id = BL31_IMAGE_ID,
SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
VERSION_2, entry_point_info_t,
SECURE | EXECUTABLE | EP_FIRST_EXE),
.ep_info.pc = EL3_PAYLOAD_BASE,
.ep_info.spsr = SPSR_64(MODE_EL3, MODE_SP_ELX,
DISABLE_ALL_EXCEPTIONS),
SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
VERSION_2, image_info_t,
IMAGE_ATTRIB_PLAT_SETUP | IMAGE_ATTRIB_SKIP_LOADING),
.next_handoff_image_id = INVALID_IMAGE_ID,
},
#else /* EL3_PAYLOAD_BASE */
/* Fill BL31 related information */
{
.image_id = BL31_IMAGE_ID,
SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
VERSION_2, entry_point_info_t,
SECURE | EXECUTABLE | EP_FIRST_EXE),
.ep_info.pc = BL31_BASE,
.ep_info.spsr = SPSR_64(MODE_EL3, MODE_SP_ELX,
DISABLE_ALL_EXCEPTIONS),
#if DEBUG
.ep_info.args.arg1 = ARM_BL31_PLAT_PARAM_VAL,
#endif
SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
VERSION_2, image_info_t, IMAGE_ATTRIB_PLAT_SETUP),
.image_info.image_base = BL31_BASE,
.image_info.image_max_size = BL31_LIMIT - BL31_BASE,
# ifdef BL32_BASE
.next_handoff_image_id = BL32_IMAGE_ID,
# else
.next_handoff_image_id = BL33_IMAGE_ID,
# endif
},
# ifdef BL32_BASE
/* Fill BL32 related information */
{
.image_id = BL32_IMAGE_ID,
SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
VERSION_2, entry_point_info_t, SECURE | EXECUTABLE),
.ep_info.pc = BL32_BASE,
SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
VERSION_2, image_info_t, 0),
.image_info.image_base = BL32_BASE,
.image_info.image_max_size = BL32_LIMIT - BL32_BASE,
.next_handoff_image_id = BL33_IMAGE_ID,
},
# endif /* BL32_BASE */
/* Fill BL33 related information */
{
.image_id = BL33_IMAGE_ID,
SET_STATIC_PARAM_HEAD(ep_info, PARAM_EP,
VERSION_2, entry_point_info_t, NON_SECURE | EXECUTABLE),
# ifdef PRELOADED_BL33_BASE
.ep_info.pc = PRELOADED_BL33_BASE,
SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
VERSION_2, image_info_t, IMAGE_ATTRIB_SKIP_LOADING),
# else
.ep_info.pc = PLAT_ARM_NS_IMAGE_OFFSET,
SET_STATIC_PARAM_HEAD(image_info, PARAM_EP,
VERSION_2, image_info_t, 0),
.image_info.image_base = PLAT_ARM_NS_IMAGE_OFFSET,
.image_info.image_max_size = ARM_DRAM1_SIZE,
# endif /* PRELOADED_BL33_BASE */
.next_handoff_image_id = INVALID_IMAGE_ID,
}
#endif /* EL3_PAYLOAD_BASE */
};
REGISTER_BL_IMAGE_DESCS(bl2_mem_params_descs)
...@@ -73,7 +73,6 @@ meminfo_t *bl1_plat_sec_mem_layout(void) ...@@ -73,7 +73,6 @@ meminfo_t *bl1_plat_sec_mem_layout(void)
******************************************************************************/ ******************************************************************************/
void arm_bl1_early_platform_setup(void) void arm_bl1_early_platform_setup(void)
{ {
const size_t bl1_size = BL1_RAM_LIMIT - BL1_RAM_BASE;
#if !ARM_DISABLE_TRUSTED_WDOG #if !ARM_DISABLE_TRUSTED_WDOG
/* Enable watchdog */ /* Enable watchdog */
...@@ -88,13 +87,15 @@ void arm_bl1_early_platform_setup(void) ...@@ -88,13 +87,15 @@ void arm_bl1_early_platform_setup(void)
bl1_tzram_layout.total_base = ARM_BL_RAM_BASE; bl1_tzram_layout.total_base = ARM_BL_RAM_BASE;
bl1_tzram_layout.total_size = ARM_BL_RAM_SIZE; bl1_tzram_layout.total_size = ARM_BL_RAM_SIZE;
#if !LOAD_IMAGE_V2
/* Calculate how much RAM BL1 is using and how much remains free */ /* Calculate how much RAM BL1 is using and how much remains free */
bl1_tzram_layout.free_base = ARM_BL_RAM_BASE; bl1_tzram_layout.free_base = ARM_BL_RAM_BASE;
bl1_tzram_layout.free_size = ARM_BL_RAM_SIZE; bl1_tzram_layout.free_size = ARM_BL_RAM_SIZE;
reserve_mem(&bl1_tzram_layout.free_base, reserve_mem(&bl1_tzram_layout.free_base,
&bl1_tzram_layout.free_size, &bl1_tzram_layout.free_size,
BL1_RAM_BASE, BL1_RAM_BASE,
bl1_size); BL1_RAM_LIMIT - BL1_RAM_BASE);
#endif /* LOAD_IMAGE_V2 */
} }
void bl1_early_platform_setup(void) void bl1_early_platform_setup(void)
...@@ -131,7 +132,11 @@ void arm_bl1_plat_arch_setup(void) ...@@ -131,7 +132,11 @@ void arm_bl1_plat_arch_setup(void)
BL1_COHERENT_RAM_LIMIT BL1_COHERENT_RAM_LIMIT
#endif #endif
); );
#ifdef AARCH32
enable_mmu_secure(0);
#else
enable_mmu_el3(0); enable_mmu_el3(0);
#endif /* AARCH32 */
} }
void bl1_plat_arch_setup(void) void bl1_plat_arch_setup(void)
......
...@@ -30,10 +30,13 @@ ...@@ -30,10 +30,13 @@
#include <arch_helpers.h> #include <arch_helpers.h>
#include <arm_def.h> #include <arm_def.h>
#include <assert.h>
#include <bl_common.h> #include <bl_common.h>
#include <console.h> #include <console.h>
#include <platform_def.h> #include <debug.h>
#include <desc_image_load.h>
#include <plat_arm.h> #include <plat_arm.h>
#include <platform_def.h>
#include <string.h> #include <string.h>
#if USE_COHERENT_MEM #if USE_COHERENT_MEM
...@@ -51,6 +54,17 @@ ...@@ -51,6 +54,17 @@
/* Data structure which holds the extents of the trusted SRAM for BL2 */ /* Data structure which holds the extents of the trusted SRAM for BL2 */
static meminfo_t bl2_tzram_layout __aligned(CACHE_WRITEBACK_GRANULE); static meminfo_t bl2_tzram_layout __aligned(CACHE_WRITEBACK_GRANULE);
/* Weak definitions may be overridden in specific ARM standard platform */
#pragma weak bl2_early_platform_setup
#pragma weak bl2_platform_setup
#pragma weak bl2_plat_arch_setup
#pragma weak bl2_plat_sec_mem_layout
#if LOAD_IMAGE_V2
#pragma weak bl2_plat_handle_post_image_load
#else /* LOAD_IMAGE_V2 */
/******************************************************************************* /*******************************************************************************
* This structure represents the superset of information that is passed to * This structure represents the superset of information that is passed to
...@@ -72,10 +86,6 @@ static bl2_to_bl31_params_mem_t bl31_params_mem; ...@@ -72,10 +86,6 @@ static bl2_to_bl31_params_mem_t bl31_params_mem;
/* Weak definitions may be overridden in specific ARM standard platform */ /* Weak definitions may be overridden in specific ARM standard platform */
#pragma weak bl2_early_platform_setup
#pragma weak bl2_platform_setup
#pragma weak bl2_plat_arch_setup
#pragma weak bl2_plat_sec_mem_layout
#pragma weak bl2_plat_get_bl31_params #pragma weak bl2_plat_get_bl31_params
#pragma weak bl2_plat_get_bl31_ep_info #pragma weak bl2_plat_get_bl31_ep_info
#pragma weak bl2_plat_flush_bl31_params #pragma weak bl2_plat_flush_bl31_params
...@@ -106,7 +116,7 @@ meminfo_t *bl2_plat_sec_mem_layout(void) ...@@ -106,7 +116,7 @@ meminfo_t *bl2_plat_sec_mem_layout(void)
{ {
return &bl2_tzram_layout; return &bl2_tzram_layout;
} }
#endif #endif /* ARM_BL31_IN_DRAM */
/******************************************************************************* /*******************************************************************************
* This function assigns a pointer to the memory that the platform has kept * This function assigns a pointer to the memory that the platform has kept
...@@ -180,6 +190,7 @@ struct entry_point_info *bl2_plat_get_bl31_ep_info(void) ...@@ -180,6 +190,7 @@ struct entry_point_info *bl2_plat_get_bl31_ep_info(void)
return &bl31_params_mem.bl31_ep_info; return &bl31_params_mem.bl31_ep_info;
} }
#endif /* LOAD_IMAGE_V2 */
/******************************************************************************* /*******************************************************************************
* BL1 has passed the extents of the trusted SRAM that should be visible to BL2 * BL1 has passed the extents of the trusted SRAM that should be visible to BL2
...@@ -235,7 +246,12 @@ void arm_bl2_plat_arch_setup(void) ...@@ -235,7 +246,12 @@ void arm_bl2_plat_arch_setup(void)
BL2_COHERENT_RAM_LIMIT BL2_COHERENT_RAM_LIMIT
#endif #endif
); );
#ifdef AARCH32
enable_mmu_secure(0);
#else
enable_mmu_el1(0); enable_mmu_el1(0);
#endif
} }
void bl2_plat_arch_setup(void) void bl2_plat_arch_setup(void)
...@@ -243,6 +259,46 @@ void bl2_plat_arch_setup(void) ...@@ -243,6 +259,46 @@ void bl2_plat_arch_setup(void)
arm_bl2_plat_arch_setup(); arm_bl2_plat_arch_setup();
} }
#if LOAD_IMAGE_V2
/*******************************************************************************
* This function can be used by the platforms to update/use image
* information for given `image_id`.
******************************************************************************/
int bl2_plat_handle_post_image_load(unsigned int image_id)
{
int err = 0;
bl_mem_params_node_t *bl_mem_params = get_bl_mem_params_node(image_id);
assert(bl_mem_params);
switch (image_id) {
#ifdef AARCH64
case BL32_IMAGE_ID:
bl_mem_params->ep_info.spsr = arm_get_spsr_for_bl32_entry();
break;
#endif
case BL33_IMAGE_ID:
/* BL33 expects to receive the primary CPU MPID (through r0) */
bl_mem_params->ep_info.args.arg0 = 0xffff & read_mpidr();
bl_mem_params->ep_info.spsr = arm_get_spsr_for_bl33_entry();
break;
#ifdef SCP_BL2_BASE
case SCP_BL2_IMAGE_ID:
/* The subsequent handling of SCP_BL2 is platform specific */
err = plat_arm_bl2_handle_scp_bl2(&bl_mem_params->image_info);
if (err) {
WARN("Failure in platform-specific handling of SCP_BL2 image.\n");
}
break;
#endif
}
return err;
}
#else /* LOAD_IMAGE_V2 */
/******************************************************************************* /*******************************************************************************
* Populate the extents of memory available for loading SCP_BL2 (if used), * Populate the extents of memory available for loading SCP_BL2 (if used),
* i.e. anywhere in trusted RAM as long as it doesn't overwrite BL2. * i.e. anywhere in trusted RAM as long as it doesn't overwrite BL2.
...@@ -321,3 +377,5 @@ void bl2_plat_get_bl33_meminfo(meminfo_t *bl33_meminfo) ...@@ -321,3 +377,5 @@ void bl2_plat_get_bl33_meminfo(meminfo_t *bl33_meminfo)
bl33_meminfo->free_base = ARM_NS_DRAM1_BASE; bl33_meminfo->free_base = ARM_NS_DRAM1_BASE;
bl33_meminfo->free_size = ARM_NS_DRAM1_SIZE; bl33_meminfo->free_size = ARM_NS_DRAM1_SIZE;
} }
#endif /* LOAD_IMAGE_V2 */
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <assert.h> #include <assert.h>
#include <bl_common.h> #include <bl_common.h>
#include <console.h> #include <console.h>
#include <debug.h>
#include <mmio.h> #include <mmio.h>
#include <plat_arm.h> #include <plat_arm.h>
#include <platform.h> #include <platform.h>
...@@ -98,8 +99,13 @@ entry_point_info_t *bl31_plat_get_next_image_ep_info(uint32_t type) ...@@ -98,8 +99,13 @@ entry_point_info_t *bl31_plat_get_next_image_ep_info(uint32_t type)
* while creating page tables. BL2 has flushed this information to memory, so * while creating page tables. BL2 has flushed this information to memory, so
* we are guaranteed to pick up good data. * we are guaranteed to pick up good data.
******************************************************************************/ ******************************************************************************/
#if LOAD_IMAGE_V2
void arm_bl31_early_platform_setup(void *from_bl2,
void *plat_params_from_bl2)
#else
void arm_bl31_early_platform_setup(bl31_params_t *from_bl2, void arm_bl31_early_platform_setup(bl31_params_t *from_bl2,
void *plat_params_from_bl2) void *plat_params_from_bl2)
#endif
{ {
/* Initialize the console to provide early debug support */ /* Initialize the console to provide early debug support */
console_init(PLAT_ARM_BOOT_UART_BASE, PLAT_ARM_BOOT_UART_CLK_IN_HZ, console_init(PLAT_ARM_BOOT_UART_BASE, PLAT_ARM_BOOT_UART_CLK_IN_HZ,
...@@ -135,13 +141,8 @@ void arm_bl31_early_platform_setup(bl31_params_t *from_bl2, ...@@ -135,13 +141,8 @@ void arm_bl31_early_platform_setup(bl31_params_t *from_bl2,
bl33_image_ep_info.spsr = arm_get_spsr_for_bl33_entry(); bl33_image_ep_info.spsr = arm_get_spsr_for_bl33_entry();
SET_SECURITY_STATE(bl33_image_ep_info.h.attr, NON_SECURE); SET_SECURITY_STATE(bl33_image_ep_info.h.attr, NON_SECURE);
#else #else /* RESET_TO_BL31 */
/*
* Check params passed from BL2 should not be NULL,
*/
assert(from_bl2 != NULL);
assert(from_bl2->h.type == PARAM_BL31);
assert(from_bl2->h.version >= VERSION_1);
/* /*
* In debug builds, we pass a special value in 'plat_params_from_bl2' * In debug builds, we pass a special value in 'plat_params_from_bl2'
* to verify platform parameters from BL2 to BL31. * to verify platform parameters from BL2 to BL31.
...@@ -150,6 +151,43 @@ void arm_bl31_early_platform_setup(bl31_params_t *from_bl2, ...@@ -150,6 +151,43 @@ void arm_bl31_early_platform_setup(bl31_params_t *from_bl2,
assert(((unsigned long long)plat_params_from_bl2) == assert(((unsigned long long)plat_params_from_bl2) ==
ARM_BL31_PLAT_PARAM_VAL); ARM_BL31_PLAT_PARAM_VAL);
# if LOAD_IMAGE_V2
/*
* Check params passed from BL2 should not be NULL,
*/
bl_params_t *params_from_bl2 = (bl_params_t *)from_bl2;
assert(params_from_bl2 != NULL);
assert(params_from_bl2->h.type == PARAM_BL_PARAMS);
assert(params_from_bl2->h.version >= VERSION_2);
bl_params_node_t *bl_params = params_from_bl2->head;
/*
* Copy BL33 and BL32 (if present), entry point information.
* They are stored in Secure RAM, in BL2's address space.
*/
while (bl_params) {
if (bl_params->image_id == BL32_IMAGE_ID)
bl32_image_ep_info = *bl_params->ep_info;
if (bl_params->image_id == BL33_IMAGE_ID)
bl33_image_ep_info = *bl_params->ep_info;
bl_params = bl_params->next_params_info;
}
if (bl33_image_ep_info.pc == 0)
panic();
# else /* LOAD_IMAGE_V2 */
/*
* Check params passed from BL2 should not be NULL,
*/
assert(from_bl2 != NULL);
assert(from_bl2->h.type == PARAM_BL31);
assert(from_bl2->h.version >= VERSION_1);
/* /*
* Copy BL32 (if populated by BL2) and BL33 entry point information. * Copy BL32 (if populated by BL2) and BL33 entry point information.
* They are stored in Secure RAM, in BL2's address space. * They are stored in Secure RAM, in BL2's address space.
...@@ -157,11 +195,18 @@ void arm_bl31_early_platform_setup(bl31_params_t *from_bl2, ...@@ -157,11 +195,18 @@ void arm_bl31_early_platform_setup(bl31_params_t *from_bl2,
if (from_bl2->bl32_ep_info) if (from_bl2->bl32_ep_info)
bl32_image_ep_info = *from_bl2->bl32_ep_info; bl32_image_ep_info = *from_bl2->bl32_ep_info;
bl33_image_ep_info = *from_bl2->bl33_ep_info; bl33_image_ep_info = *from_bl2->bl33_ep_info;
#endif
# endif /* LOAD_IMAGE_V2 */
#endif /* RESET_TO_BL31 */
} }
#if LOAD_IMAGE_V2
void bl31_early_platform_setup(void *from_bl2,
void *plat_params_from_bl2)
#else
void bl31_early_platform_setup(bl31_params_t *from_bl2, void bl31_early_platform_setup(bl31_params_t *from_bl2,
void *plat_params_from_bl2) void *plat_params_from_bl2)
#endif
{ {
arm_bl31_early_platform_setup(from_bl2, plat_params_from_bl2); arm_bl31_early_platform_setup(from_bl2, plat_params_from_bl2);
......
...@@ -116,7 +116,7 @@ BL1_SOURCES += drivers/arm/sp805/sp805.c \ ...@@ -116,7 +116,7 @@ BL1_SOURCES += drivers/arm/sp805/sp805.c \
drivers/io/io_storage.c \ drivers/io/io_storage.c \
plat/arm/common/arm_bl1_setup.c \ plat/arm/common/arm_bl1_setup.c \
plat/arm/common/arm_io_storage.c \ plat/arm/common/arm_io_storage.c \
plat/common/aarch64/platform_up_stack.S plat/common/${ARCH}/platform_up_stack.S
ifdef EL3_PAYLOAD_BASE ifdef EL3_PAYLOAD_BASE
# Need the arm_program_trusted_mailbox() function to release secondary CPUs from # Need the arm_program_trusted_mailbox() function to release secondary CPUs from
# their holding pen # their holding pen
...@@ -128,7 +128,12 @@ BL2_SOURCES += drivers/io/io_fip.c \ ...@@ -128,7 +128,12 @@ BL2_SOURCES += drivers/io/io_fip.c \
drivers/io/io_storage.c \ drivers/io/io_storage.c \
plat/arm/common/arm_bl2_setup.c \ plat/arm/common/arm_bl2_setup.c \
plat/arm/common/arm_io_storage.c \ plat/arm/common/arm_io_storage.c \
plat/common/aarch64/platform_up_stack.S plat/common/${ARCH}/platform_up_stack.S
ifeq (${LOAD_IMAGE_V2},1)
BL2_SOURCES += plat/arm/common/${ARCH}/arm_bl2_mem_params_desc.c\
plat/arm/common/arm_image_load.c \
common/desc_image_load.c
endif
BL2U_SOURCES += plat/arm/common/arm_bl2u_setup.c \ BL2U_SOURCES += plat/arm/common/arm_bl2u_setup.c \
plat/common/aarch64/platform_up_stack.S plat/common/aarch64/platform_up_stack.S
......
/*
* Copyright (c) 2016, 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:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of ARM nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <arm_def.h>
#include <bl_common.h>
#include <desc_image_load.h>
#include <platform.h>
#pragma weak plat_flush_next_bl_params
#pragma weak plat_get_bl_image_load_info
#pragma weak plat_get_next_bl_params
/*******************************************************************************
* This function flushes the data structures so that they are visible
* in memory for the next BL image.
******************************************************************************/
void plat_flush_next_bl_params(void)
{
flush_bl_params_desc();
}
/*******************************************************************************
* This function returns the list of loadable images.
******************************************************************************/
bl_load_info_t *plat_get_bl_image_load_info(void)
{
return get_bl_load_info_from_mem_params_desc();
}
/*******************************************************************************
* This function returns the list of executable images.
******************************************************************************/
bl_params_t *plat_get_next_bl_params(void)
{
return get_next_bl_params_from_mem_params_desc();
}
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <assert.h> #include <assert.h>
#include <console.h> #include <console.h>
#include <debug.h>
#include <mmio.h> #include <mmio.h>
#include <plat_arm.h> #include <plat_arm.h>
#include <platform.h> #include <platform.h>
...@@ -58,10 +59,6 @@ static entry_point_info_t bl33_image_ep_info; ...@@ -58,10 +59,6 @@ static entry_point_info_t bl33_image_ep_info;
#pragma weak sp_min_platform_setup #pragma weak sp_min_platform_setup
#pragma weak sp_min_plat_arch_setup #pragma weak sp_min_plat_arch_setup
#ifndef RESET_TO_SP_MIN
#error (" RESET_TO_SP_MIN flag is expected to be set.")
#endif
/******************************************************************************* /*******************************************************************************
* Return a pointer to the 'entry_point_info' structure of the next image for the * Return a pointer to the 'entry_point_info' structure of the next image for the
...@@ -86,15 +83,20 @@ entry_point_info_t *sp_min_plat_get_bl33_ep_info(void) ...@@ -86,15 +83,20 @@ entry_point_info_t *sp_min_plat_get_bl33_ep_info(void)
} }
/******************************************************************************* /*******************************************************************************
* Perform early platform setup. We expect SP_MIN is the first boot loader * Perform early platform setup.
* image and RESET_TO_SP_MIN build option to be set.
******************************************************************************/ ******************************************************************************/
void arm_sp_min_early_platform_setup(void) void arm_sp_min_early_platform_setup(void *from_bl2,
void *plat_params_from_bl2)
{ {
/* Initialize the console to provide early debug support */ /* Initialize the console to provide early debug support */
console_init(PLAT_ARM_BOOT_UART_BASE, PLAT_ARM_BOOT_UART_CLK_IN_HZ, console_init(PLAT_ARM_BOOT_UART_BASE, PLAT_ARM_BOOT_UART_CLK_IN_HZ,
ARM_CONSOLE_BAUDRATE); ARM_CONSOLE_BAUDRATE);
#if RESET_TO_SP_MIN
/* There are no parameters from BL2 if SP_MIN is a reset vector */
assert(from_bl2 == NULL);
assert(plat_params_from_bl2 == NULL);
/* Populate entry point information for BL33 */ /* Populate entry point information for BL33 */
SET_PARAM_HEAD(&bl33_image_ep_info, SET_PARAM_HEAD(&bl33_image_ep_info,
PARAM_EP, PARAM_EP,
...@@ -104,18 +106,46 @@ void arm_sp_min_early_platform_setup(void) ...@@ -104,18 +106,46 @@ void arm_sp_min_early_platform_setup(void)
* Tell SP_MIN where the non-trusted software image * Tell SP_MIN where the non-trusted software image
* is located and the entry state information * is located and the entry state information
*/ */
#ifdef PRELOADED_BL33_BASE
bl33_image_ep_info.pc = PRELOADED_BL33_BASE;
#else
bl33_image_ep_info.pc = plat_get_ns_image_entrypoint(); bl33_image_ep_info.pc = plat_get_ns_image_entrypoint();
#endif
bl33_image_ep_info.spsr = arm_get_spsr_for_bl33_entry(); bl33_image_ep_info.spsr = arm_get_spsr_for_bl33_entry();
SET_SECURITY_STATE(bl33_image_ep_info.h.attr, NON_SECURE); SET_SECURITY_STATE(bl33_image_ep_info.h.attr, NON_SECURE);
#else /* RESET_TO_SP_MIN */
/*
* Check params passed from BL2 should not be NULL,
*/
bl_params_t *params_from_bl2 = (bl_params_t *)from_bl2;
assert(params_from_bl2 != NULL);
assert(params_from_bl2->h.type == PARAM_BL_PARAMS);
assert(params_from_bl2->h.version >= VERSION_2);
bl_params_node_t *bl_params = params_from_bl2->head;
/*
* Copy BL33 entry point information.
* They are stored in Secure RAM, in BL2's address space.
*/
while (bl_params) {
if (bl_params->image_id == BL33_IMAGE_ID) {
bl33_image_ep_info = *bl_params->ep_info;
break;
}
bl_params = bl_params->next_params_info;
}
if (bl33_image_ep_info.pc == 0)
panic();
#endif /* RESET_TO_SP_MIN */
} }
void sp_min_early_platform_setup(void) void sp_min_early_platform_setup(void *from_bl2,
void *plat_params_from_bl2)
{ {
arm_sp_min_early_platform_setup(); arm_sp_min_early_platform_setup(from_bl2, plat_params_from_bl2);
/* /*
* Initialize Interconnect for this cluster during cold boot. * Initialize Interconnect for this cluster during cold boot.
...@@ -146,10 +176,10 @@ void sp_min_platform_setup(void) ...@@ -146,10 +176,10 @@ void sp_min_platform_setup(void)
/* /*
* Do initial security configuration to allow DRAM/device access * Do initial security configuration to allow DRAM/device access
* (if earlier BL has not already done so). * (if earlier BL has not already done so).
* TODO: If RESET_TO_SP_MIN is not set, the security setup needs
* to be skipped.
*/ */
#if RESET_TO_SP_MIN
plat_arm_security_setup(); plat_arm_security_setup();
#endif
/* Enable and initialize the System level generic timer */ /* Enable and initialize the System level generic timer */
mmio_write_32(ARM_SYS_CNTCTL_BASE + CNTCR_OFF, mmio_write_32(ARM_SYS_CNTCTL_BASE + CNTCR_OFF,
......
...@@ -37,13 +37,21 @@ ...@@ -37,13 +37,21 @@
#include "css_scp_bootloader.h" #include "css_scp_bootloader.h"
/* Weak definition may be overridden in specific CSS based platform */ /* Weak definition may be overridden in specific CSS based platform */
#if LOAD_IMAGE_V2
#pragma weak plat_arm_bl2_handle_scp_bl2
#else
#pragma weak bl2_plat_handle_scp_bl2 #pragma weak bl2_plat_handle_scp_bl2
#endif
/******************************************************************************* /*******************************************************************************
* Transfer SCP_BL2 from Trusted RAM using the SCP Download protocol. * Transfer SCP_BL2 from Trusted RAM using the SCP Download protocol.
* Return 0 on success, -1 otherwise. * Return 0 on success, -1 otherwise.
******************************************************************************/ ******************************************************************************/
#if LOAD_IMAGE_V2
int plat_arm_bl2_handle_scp_bl2(image_info_t *scp_bl2_image_info)
#else
int bl2_plat_handle_scp_bl2(image_info_t *scp_bl2_image_info) int bl2_plat_handle_scp_bl2(image_info_t *scp_bl2_image_info)
#endif
{ {
int ret; int ret;
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
.weak plat_my_core_pos .weak plat_my_core_pos
.weak plat_reset_handler .weak plat_reset_handler
.weak plat_disable_acp
.weak platform_mem_init .weak platform_mem_init
.weak plat_panic_handler .weak plat_panic_handler
...@@ -59,6 +60,15 @@ func plat_reset_handler ...@@ -59,6 +60,15 @@ func plat_reset_handler
bx lr bx lr
endfunc plat_reset_handler endfunc plat_reset_handler
/* -----------------------------------------------------
* Placeholder function which should be redefined by
* each platform.
* -----------------------------------------------------
*/
func plat_disable_acp
bx lr
endfunc plat_disable_acp
/* --------------------------------------------------------------------- /* ---------------------------------------------------------------------
* Placeholder function which should be redefined by * Placeholder function which should be redefined by
* each platform. * each platform.
......
/*
* Copyright (c) 2016, 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:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of ARM nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <arch.h>
#include <asm_macros.S>
#include <platform_def.h>
.globl plat_get_my_stack
.globl plat_set_my_stack
/* -----------------------------------------------------
* unsigned long plat_get_my_stack ()
*
* For cold-boot BL images, only the primary CPU needs
* a stack. This function returns the stack pointer for
* a stack allocated in normal memory.
* -----------------------------------------------------
*/
func plat_get_my_stack
get_up_stack platform_normal_stacks, PLATFORM_STACK_SIZE
bx lr
endfunc plat_get_my_stack
/* -----------------------------------------------------
* void plat_set_my_stack ()
*
* For cold-boot BL images, only the primary CPU needs
* a stack. This function sets the stack pointer to a
* stack allocated in normal memory.
* -----------------------------------------------------
*/
func plat_set_my_stack
get_up_stack platform_normal_stacks, PLATFORM_STACK_SIZE
mov sp, r0
bx lr
endfunc plat_set_my_stack
/* -----------------------------------------------------
* Per-cpu stacks in normal memory. Each cpu gets a
* stack of PLATFORM_STACK_SIZE bytes.
* -----------------------------------------------------
*/
declare_stack platform_normal_stacks, tzfw_normal_stacks, \
PLATFORM_STACK_SIZE, 1, CACHE_WRITEBACK_GRANULE
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