diff options
author | Soby Mathew <soby.mathew@arm.com> | 2017-02-13 12:46:28 +0000 |
---|---|---|
committer | Soby Mathew <soby.mathew@arm.com> | 2017-03-27 15:53:44 +0100 |
commit | 5dffb46c9c0ba2d3ae455b50fb78f418bd1f1258 (patch) | |
tree | 909f70e318c8a978d1609e6d82a50462a1b1f543 /include/common/bl_common.h | |
parent | 891685a51146c50234bd5ce49d29cb0fd9f290c8 (diff) | |
download | platform_external_arm-trusted-firmware-5dffb46c9c0ba2d3ae455b50fb78f418bd1f1258.tar.gz platform_external_arm-trusted-firmware-5dffb46c9c0ba2d3ae455b50fb78f418bd1f1258.tar.bz2 platform_external_arm-trusted-firmware-5dffb46c9c0ba2d3ae455b50fb78f418bd1f1258.zip |
Re-factor header files for easier PSCI library integration
This patch re-factors the following headers to make it easier to
integrate the PSCI library with an AArch32 Secure Payload :
* bl_common.h : The entry point information and the param
header data structures are factored out into separate
headers ep_info.h and param_headers.h
* psci.h : The PSCI library interfaces are factored out
into the new header psci_lib.h
* context_mgmt.h : The header file is modified to not include
arch.h when compiled for AArch32 mode.
No functional changes are introduced by this patch.
Change-Id: I5e21a843c0af2ba8e47dee4e577cf95929be8cd4
Signed-off-by: Soby Mathew <soby.mathew@arm.com>
Diffstat (limited to 'include/common/bl_common.h')
-rw-r--r-- | include/common/bl_common.h | 145 |
1 files changed, 4 insertions, 141 deletions
diff --git a/include/common/bl_common.h b/include/common/bl_common.h index 66c20fc53..38be62835 100644 --- a/include/common/bl_common.h +++ b/include/common/bl_common.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2016, ARM Limited and Contributors. All rights reserved. + * Copyright (c) 2013-2017, 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: @@ -31,9 +31,8 @@ #ifndef __BL_COMMON_H__ #define __BL_COMMON_H__ -#define SECURE 0x0 -#define NON_SECURE 0x1 -#define sec_state_is_valid(s) (((s) == SECURE) || ((s) == NON_SECURE)) +#include <ep_info.h> +#include <param_header.h> #define UP 1 #define DOWN 0 @@ -45,25 +44,6 @@ #define TOP 0x1 #define BOTTOM !TOP -/******************************************************************************* - * Constants that allow assembler code to access members of and the - * 'entry_point_info' structure at their correct offsets. - ******************************************************************************/ -#define ENTRY_POINT_INFO_PC_OFFSET 0x08 -#ifdef AARCH32 -#define ENTRY_POINT_INFO_ARGS_OFFSET 0x10 -#else -#define ENTRY_POINT_INFO_ARGS_OFFSET 0x18 -#endif - -/* The following are used to set/get image attributes. */ -#define PARAM_EP_SECURITY_MASK (0x1) - -#define GET_SECURITY_STATE(x) (x & PARAM_EP_SECURITY_MASK) -#define SET_SECURITY_STATE(x, security) \ - ((x) = ((x) & ~PARAM_EP_SECURITY_MASK) | (security)) - - /* * The following are used for image state attributes. * Image can only be in one of the following state. @@ -75,59 +55,11 @@ #define IMAGE_STATE_EXECUTED 4 #define IMAGE_STATE_INTERRUPTED 5 -#define EP_EE_MASK 0x2 -#define EP_EE_LITTLE 0x0 -#define EP_EE_BIG 0x2 -#define EP_GET_EE(x) (x & EP_EE_MASK) -#define EP_SET_EE(x, ee) ((x) = ((x) & ~EP_EE_MASK) | (ee)) - -#define EP_ST_MASK 0x4 -#define EP_ST_DISABLE 0x0 -#define EP_ST_ENABLE 0x4 -#define EP_GET_ST(x) (x & EP_ST_MASK) -#define EP_SET_ST(x, ee) ((x) = ((x) & ~EP_ST_MASK) | (ee)) - -#define EP_EXE_MASK 0x8 -#define NON_EXECUTABLE 0x0 -#define EXECUTABLE 0x8 -#define EP_GET_EXE(x) (x & EP_EXE_MASK) -#define EP_SET_EXE(x, ee) ((x) = ((x) & ~EP_EXE_MASK) | (ee)) - -#define EP_FIRST_EXE_MASK 0x10 -#define EP_FIRST_EXE 0x10 -#define EP_GET_FIRST_EXE(x) ((x) & EP_FIRST_EXE_MASK) -#define EP_SET_FIRST_EXE(x, ee) ((x) = ((x) & ~EP_FIRST_EXE_MASK) | (ee)) - -#define PARAM_EP 0x01 -#define PARAM_IMAGE_BINARY 0x02 -#define PARAM_BL31 0x03 -#define PARAM_BL_LOAD_INFO 0x04 -#define PARAM_BL_PARAMS 0x05 -#define PARAM_PSCI_LIB_ARGS 0x06 - #define IMAGE_ATTRIB_SKIP_LOADING 0x02 #define IMAGE_ATTRIB_PLAT_SETUP 0x04 -#define VERSION_1 0x01 -#define VERSION_2 0x02 - #define INVALID_IMAGE_ID (0xFFFFFFFF) -#define SET_PARAM_HEAD(_p, _type, _ver, _attr) do { \ - (_p)->h.type = (uint8_t)(_type); \ - (_p)->h.version = (uint8_t)(_ver); \ - (_p)->h.size = (uint16_t)sizeof(*_p); \ - (_p)->h.attr = (uint32_t)(_attr) ; \ - } while (0) - -/* Following is used for populating structure members statically. */ -#define SET_STATIC_PARAM_HEAD(_p, _type, _ver, _p_type, _attr) \ - ._p.h.type = (uint8_t)(_type), \ - ._p.h.version = (uint8_t)(_ver), \ - ._p.h.size = (uint16_t)sizeof(_p_type), \ - ._p.h.attr = (uint32_t)(_attr) - - /******************************************************************************* * Constants to indicate type of exception to the common exception handler. ******************************************************************************/ @@ -149,10 +81,9 @@ #define SERROR_AARCH32 0xf #ifndef __ASSEMBLY__ -#include <cdefs.h> /* For __dead2 */ #include <cassert.h> -#include <stdint.h> #include <stddef.h> +#include <stdint.h> #include <types.h> #include <utils.h> /* To retain compatibility */ @@ -185,7 +116,6 @@ extern uintptr_t __COHERENT_RAM_START__; extern uintptr_t __COHERENT_RAM_END__; #endif - /******************************************************************************* * Structure used for telling the next BL how much of a particular type of * memory is available for its use and how much is already used. @@ -199,55 +129,6 @@ typedef struct meminfo { #endif } meminfo_t; -typedef struct aapcs64_params { - u_register_t arg0; - u_register_t arg1; - u_register_t arg2; - u_register_t arg3; - u_register_t arg4; - u_register_t arg5; - u_register_t arg6; - u_register_t arg7; -} aapcs64_params_t; - -typedef struct aapcs32_params { - u_register_t arg0; - u_register_t arg1; - u_register_t arg2; - u_register_t arg3; -} aapcs32_params_t; - -/*************************************************************************** - * This structure provides version information and the size of the - * structure, attributes for the structure it represents - ***************************************************************************/ -typedef struct param_header { - uint8_t type; /* type of the structure */ - uint8_t version; /* version of this structure */ - uint16_t size; /* size of this structure in bytes */ - uint32_t attr; /* attributes: unused bits SBZ */ -} param_header_t; - -/***************************************************************************** - * This structure represents the superset of information needed while - * switching exception levels. The only two mechanisms to do so are - * ERET & SMC. Security state is indicated using bit zero of header - * attribute - * NOTE: BL1 expects entrypoint followed by spsr at an offset from the start - * of this structure defined by the macro `ENTRY_POINT_INFO_PC_OFFSET` while - * processing SMC to jump to BL31. - *****************************************************************************/ -typedef struct entry_point_info { - param_header_t h; - uintptr_t pc; - uint32_t spsr; -#ifdef AARCH32 - aapcs32_params_t args; -#else - aapcs64_params_t args; -#endif -} entry_point_info_t; - /***************************************************************************** * Image info binary provides information from the image loader that * can be used by the firmware to manage available trusted RAM. @@ -338,24 +219,6 @@ typedef struct bl31_params { #endif /* LOAD_IMAGE_V2 */ -/* - * Compile time assertions related to the 'entry_point_info' structure to - * ensure that the assembler and the compiler view of the offsets of - * the structure members is the same. - */ -CASSERT(ENTRY_POINT_INFO_PC_OFFSET == - __builtin_offsetof(entry_point_info_t, pc), \ - assert_BL31_pc_offset_mismatch); - -CASSERT(ENTRY_POINT_INFO_ARGS_OFFSET == \ - __builtin_offsetof(entry_point_info_t, args), \ - assert_BL31_args_offset_mismatch); - -CASSERT(sizeof(uintptr_t) == - __builtin_offsetof(entry_point_info_t, spsr) - \ - __builtin_offsetof(entry_point_info_t, pc), \ - assert_entrypoint_and_spsr_should_be_adjacent); - /******************************************************************************* * Function & variable prototypes ******************************************************************************/ |