Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Arm Trusted Firmware
Commits
ebd17fa4
Unverified
Commit
ebd17fa4
authored
6 years ago
by
Antonio Niño Díaz
Committed by
GitHub
6 years ago
Browse files
Options
Download
Plain Diff
Merge pull request #1660 from antonio-nino-diaz-arm/an/misra
Several MISRA defect fixes
parents
3c1fb7a7
f8b30ca8
Changes
31
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
bl1/aarch64/bl1_context_mgmt.c
+4
-4
bl1/aarch64/bl1_context_mgmt.c
bl31/bl31_main.c
+2
-2
bl31/bl31_main.c
include/common/ep_info.h
+1
-1
include/common/ep_info.h
include/drivers/arm/tzc_common.h
+2
-2
include/drivers/arm/tzc_common.h
include/lib/aarch32/arch_helpers.h
+3
-3
include/lib/aarch32/arch_helpers.h
include/lib/aarch64/arch_helpers.h
+19
-8
include/lib/aarch64/arch_helpers.h
include/lib/bakery_lock.h
+29
-11
include/lib/bakery_lock.h
include/lib/el3_runtime/aarch32/context.h
+17
-15
include/lib/el3_runtime/aarch32/context.h
include/lib/el3_runtime/aarch64/context.h
+3
-3
include/lib/el3_runtime/aarch64/context.h
include/lib/el3_runtime/context_mgmt.h
+4
-5
include/lib/el3_runtime/context_mgmt.h
include/lib/el3_runtime/cpu_data.h
+2
-2
include/lib/el3_runtime/cpu_data.h
include/lib/spinlock.h
+3
-3
include/lib/spinlock.h
include/plat/arm/board/common/v2m_def.h
+24
-24
include/plat/arm/board/common/v2m_def.h
include/plat/arm/common/arm_def.h
+5
-5
include/plat/arm/common/arm_def.h
include/plat/arm/common/arm_dyn_cfg_helpers.h
+3
-3
include/plat/arm/common/arm_dyn_cfg_helpers.h
lib/el3_runtime/aarch32/context_mgmt.c
+6
-6
lib/el3_runtime/aarch32/context_mgmt.c
lib/el3_runtime/aarch64/context_mgmt.c
+28
-28
lib/el3_runtime/aarch64/context_mgmt.c
lib/locks/bakery/bakery_lock_coherent.c
+12
-11
lib/locks/bakery/bakery_lock_coherent.c
lib/locks/bakery/bakery_lock_normal.c
+38
-28
lib/locks/bakery/bakery_lock_normal.c
plat/arm/board/fvp/fvp_def.h
+54
-54
plat/arm/board/fvp/fvp_def.h
with
259 additions
and
218 deletions
+259
-218
bl1/aarch64/bl1_context_mgmt.c
View file @
ebd17fa4
/*
* Copyright (c) 2015-201
7
, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2015-201
8
, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
...
...
@@ -49,9 +49,9 @@ void bl1_prepare_next_image(unsigned int image_id)
* Ensure that the build flag to save AArch32 system registers in CPU
* context is not set for AArch64-only platforms.
*/
if
(
EL_IMPLEMENTED
(
1
)
==
EL_IMPL_A64ONLY
)
{
if
(
el_implemented
(
1
)
==
EL_IMPL_A64ONLY
)
{
ERROR
(
"EL1 supports AArch64-only. Please set build flag "
"CTX_INCLUDE_AARCH32_REGS = 0"
);
"CTX_INCLUDE_AARCH32_REGS = 0
\n
"
);
panic
();
}
#endif
...
...
@@ -76,7 +76,7 @@ void bl1_prepare_next_image(unsigned int image_id)
DISABLE_ALL_EXCEPTIONS
);
}
else
{
/* Use EL2 if supported; else use EL1. */
if
(
EL_IMPLEMENTED
(
2
)
)
{
if
(
el_implemented
(
2
)
!=
EL_IMPL_NONE
)
{
next_bl_ep
->
spsr
=
SPSR_64
(
MODE_EL2
,
MODE_SP_ELX
,
DISABLE_ALL_EXCEPTIONS
);
}
else
{
...
...
This diff is collapsed.
Click to expand it.
bl31/bl31_main.c
View file @
ebd17fa4
...
...
@@ -159,9 +159,9 @@ void __init bl31_prepare_next_image_entry(void)
* Ensure that the build flag to save AArch32 system registers in CPU
* context is not set for AArch64-only platforms.
*/
if
(
EL_IMPLEMENTED
(
1
)
==
EL_IMPL_A64ONLY
)
{
if
(
el_implemented
(
1
)
==
EL_IMPL_A64ONLY
)
{
ERROR
(
"EL1 supports AArch64-only. Please set build flag "
"CTX_INCLUDE_AARCH32_REGS = 0"
);
"CTX_INCLUDE_AARCH32_REGS = 0
\n
"
);
panic
();
}
#endif
...
...
This diff is collapsed.
Click to expand it.
include/common/ep_info.h
View file @
ebd17fa4
...
...
@@ -30,7 +30,7 @@
#define PARAM_EP_SECURITY_MASK U(0x1)
/* Secure or Non-secure image */
#define GET_SECURITY_STATE(x) (
x
& PARAM_EP_SECURITY_MASK)
#define GET_SECURITY_STATE(x) (
(x)
& PARAM_EP_SECURITY_MASK)
#define SET_SECURITY_STATE(x, security) \
((x) = ((x) & ~PARAM_EP_SECURITY_MASK) | (security))
...
...
This diff is collapsed.
Click to expand it.
include/drivers/arm/tzc_common.h
View file @
ebd17fa4
...
...
@@ -73,10 +73,10 @@
/* Macros for allowing Non-Secure access to a region based on NSAID */
#define TZC_REGION_ACCESS_RD(nsaid) \
((U(1) << (nsaid & TZC_REGION_ACCESS_ID_MASK)) << \
((U(1) <<
(
(nsaid
)
& TZC_REGION_ACCESS_ID_MASK)) << \
TZC_REGION_ACCESS_RD_EN_SHIFT)
#define TZC_REGION_ACCESS_WR(nsaid) \
((U(1) << (nsaid & TZC_REGION_ACCESS_ID_MASK)) << \
((U(1) <<
(
(nsaid
)
& TZC_REGION_ACCESS_ID_MASK)) << \
TZC_REGION_ACCESS_WR_EN_SHIFT)
#define TZC_REGION_ACCESS_RDWR(nsaid) \
(TZC_REGION_ACCESS_RD(nsaid) | \
...
...
This diff is collapsed.
Click to expand it.
include/lib/aarch32/arch_helpers.h
View file @
ebd17fa4
...
...
@@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef
__
ARCH_HELPERS_H
__
#define
__
ARCH_HELPERS_H
__
#ifndef ARCH_HELPERS_H
#define ARCH_HELPERS_H
#include <arch.h>
/* for additional register definitions */
#include <cdefs.h>
...
...
@@ -381,4 +381,4 @@ static inline unsigned int get_current_el(void)
#define write_icc_sgi0r_el1(_v) \
write64_icc_sgi0r_el1(_v)
#endif
/*
__
ARCH_HELPERS_H
__
*/
#endif
/* ARCH_HELPERS_H */
This diff is collapsed.
Click to expand it.
include/lib/aarch64/arch_helpers.h
View file @
ebd17fa4
...
...
@@ -4,11 +4,12 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef
__
ARCH_HELPERS_H
__
#define
__
ARCH_HELPERS_H
__
#ifndef ARCH_HELPERS_H
#define ARCH_HELPERS_H
#include <arch.h>
/* for additional register definitions */
#include <cdefs.h>
/* For __dead2 */
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
...
...
@@ -363,12 +364,22 @@ static inline unsigned int get_current_el(void)
}
/*
* Check if an EL is implemented from AA64PFR0 register fields. 'el' argument
* must be one of 1, 2 or 3.
* Check if an EL is implemented from AA64PFR0 register fields.
*/
#define EL_IMPLEMENTED(el) \
((read_id_aa64pfr0_el1() >> ID_AA64PFR0_EL##el##_SHIFT) \
& ID_AA64PFR0_ELX_MASK)
static
inline
uint64_t
el_implemented
(
unsigned
int
el
)
{
if
(
el
>
3U
)
{
return
EL_IMPL_NONE
;
}
else
{
unsigned
int
shift
=
ID_AA64PFR0_EL1_SHIFT
*
el
;
return
(
read_id_aa64pfr0_el1
()
>>
shift
)
&
ID_AA64PFR0_ELX_MASK
;
}
}
#if !ERROR_DEPRECATED
#define EL_IMPLEMENTED(_el) el_implemented(_el)
#endif
/* Previously defined accesor functions with incomplete register names */
...
...
@@ -389,4 +400,4 @@ static inline unsigned int get_current_el(void)
#define read_cpacr() read_cpacr_el1()
#define write_cpacr(_v) write_cpacr_el1(_v)
#endif
/*
__
ARCH_HELPERS_H
__
*/
#endif
/* ARCH_HELPERS_H */
This diff is collapsed.
Click to expand it.
include/lib/bakery_lock.h
View file @
ebd17fa4
...
...
@@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef
__
BAKERY_LOCK_H
__
#define
__
BAKERY_LOCK_H
__
#ifndef BAKERY_LOCK_H
#define BAKERY_LOCK_H
#include <platform_def.h>
...
...
@@ -13,21 +13,39 @@
#ifndef __ASSEMBLY__
#include <cdefs.h>
#include <stdbool.h>
#include <stdint.h>
#include <utils_def.h>
/*****************************************************************************
* Internal helper
macro
s used by the bakery lock implementation.
* Internal helpers used by the bakery lock implementation.
****************************************************************************/
/* Convert a ticket to priority */
#define PRIORITY(t, pos) (((t) << 8) | (pos))
static
inline
unsigned
int
bakery_get_priority
(
unsigned
int
t
,
unsigned
int
pos
)
{
return
(
t
<<
8
)
|
pos
;
}
#define CHOOSING_TICKET U(0x1)
#define CHOSEN_TICKET U(0x0)
static
inline
bool
bakery_is_choosing
(
unsigned
int
info
)
{
return
(
info
&
1U
)
==
CHOOSING_TICKET
;
}
static
inline
unsigned
int
bakery_ticket_number
(
unsigned
int
info
)
{
return
(
info
>>
1
)
&
0x7FFFU
;
}
#define CHOOSING_TICKET 0x1
#define CHOSEN_TICKET 0x0
static
inline
uint16_t
make_bakery_data
(
unsigned
int
choosing
,
unsigned
int
num
)
{
unsigned
int
val
=
(
choosing
&
0x1U
)
|
(
num
<<
1
);
#define bakery_is_choosing(info) (info & 0x1)
#define bakery_ticket_number(info) ((info >> 1) & 0x7FFF)
#define make_bakery_data(choosing, number) \
(((choosing & 0x1) | (number << 1)) & 0xFFFF)
return
(
uint16_t
)
val
;
}
/*****************************************************************************
* External bakery lock interface.
...
...
@@ -83,4 +101,4 @@ void bakery_lock_release(bakery_lock_t *bakery);
#endif
/* __ASSEMBLY__ */
#endif
/*
__
BAKERY_LOCK_H
__
*/
#endif
/* BAKERY_LOCK_H */
This diff is collapsed.
Click to expand it.
include/lib/el3_runtime/aarch32/context.h
View file @
ebd17fa4
/*
* Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2016
-2018
, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef __CONTEXT_H__
#define __CONTEXT_H__
#ifndef CONTEXT_H
#define CONTEXT_H
#include <utils_def.h>
/*******************************************************************************
* Constants that allow assembler code to access members of and the 'regs'
* structure at their correct offsets.
******************************************************************************/
#define CTX_REGS_OFFSET 0x0
#define CTX_GPREG_R0 0x0
#define CTX_GPREG_R1 0x4
#define CTX_GPREG_R2 0x8
#define CTX_GPREG_R3 0xC
#define CTX_LR 0x10
#define CTX_SCR 0x14
#define CTX_SPSR 0x18
#define CTX_NS_SCTLR 0x1C
#define CTX_REGS_END 0x20
#define CTX_REGS_OFFSET
U(
0x0
)
#define CTX_GPREG_R0
U(
0x0
)
#define CTX_GPREG_R1
U(
0x4
)
#define CTX_GPREG_R2
U(
0x8
)
#define CTX_GPREG_R3
U(
0xC
)
#define CTX_LR
U(
0x10
)
#define CTX_SCR
U(
0x14
)
#define CTX_SPSR
U(
0x18
)
#define CTX_NS_SCTLR
U(
0x1C
)
#define CTX_REGS_END
U(
0x20
)
#ifndef __ASSEMBLY__
...
...
@@ -31,7 +33,7 @@
* Common constants to help define the 'cpu_context' structure and its
* members below.
*/
#define WORD_SHIFT
2
#define WORD_SHIFT
U(2)
#define DEFINE_REG_STRUCT(name, num_regs) \
typedef struct name { \
uint32_t _regs[num_regs]; \
...
...
@@ -64,4 +66,4 @@ CASSERT(CTX_REGS_OFFSET == __builtin_offsetof(cpu_context_t, regs_ctx), \
#endif
/* __ASSEMBLY__ */
#endif
/*
__
CONTEXT_H
__
*/
#endif
/* CONTEXT_H */
This diff is collapsed.
Click to expand it.
include/lib/el3_runtime/aarch64/context.h
View file @
ebd17fa4
...
...
@@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef
__
CONTEXT_H
__
#define
__
CONTEXT_H
__
#ifndef CONTEXT_H
#define CONTEXT_H
#include <utils_def.h>
...
...
@@ -347,4 +347,4 @@ void fpregs_context_restore(fp_regs_t *regs);
#endif
/* __ASSEMBLY__ */
#endif
/*
__
CONTEXT_H
__
*/
#endif
/* CONTEXT_H */
This diff is collapsed.
Click to expand it.
include/lib/el3_runtime/context_mgmt.h
View file @
ebd17fa4
/*
* Copyright (c) 2013-201
7
, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2013-201
8
, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef
__CM_H__
#define
__CM_H__
#ifndef
CONTEXT_MGMT_H
#define
CONTEXT_MGMT_H
#include <arch.h>
#include <assert.h>
#include <context.h>
#include <context_mgmt.h>
#include <stdint.h>
/*******************************************************************************
...
...
@@ -80,4 +79,4 @@ void *cm_get_next_context(void);
void
cm_set_next_context
(
void
*
context
);
#endif
/* AARCH32 */
#endif
/*
__CM_H__
*/
#endif
/*
CONTEXT_MGMT_H
*/
This diff is collapsed.
Click to expand it.
include/lib/el3_runtime/cpu_data.h
View file @
ebd17fa4
...
...
@@ -144,9 +144,9 @@ void init_cpu_data_ptr(void);
void
init_cpu_ops
(
void
);
#define get_cpu_data(_m) _cpu_data()->_m
#define set_cpu_data(_m, _v) _cpu_data()->_m = _v
#define set_cpu_data(_m, _v) _cpu_data()->_m =
(
_v
)
#define get_cpu_data_by_index(_ix, _m) _cpu_data_by_index(_ix)->_m
#define set_cpu_data_by_index(_ix, _m, _v) _cpu_data_by_index(_ix)->_m = _v
#define set_cpu_data_by_index(_ix, _m, _v) _cpu_data_by_index(_ix)->_m =
(
_v
)
/* ((cpu_data_t *)0)->_m is a dummy to get the sizeof the struct member _m */
#define flush_cpu_data(_m) flush_dcache_range((uintptr_t) \
&(_cpu_data()->_m), \
...
...
This diff is collapsed.
Click to expand it.
include/lib/spinlock.h
View file @
ebd17fa4
...
...
@@ -4,8 +4,8 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef
__
SPINLOCK_H
__
#define
__
SPINLOCK_H
__
#ifndef SPINLOCK_H
#define SPINLOCK_H
#ifndef __ASSEMBLY__
...
...
@@ -26,4 +26,4 @@ void spin_unlock(spinlock_t *lock);
#endif
#endif
/*
__
SPINLOCK_H
__
*/
#endif
/* SPINLOCK_H */
This diff is collapsed.
Click to expand it.
include/plat/arm/board/common/v2m_def.h
View file @
ebd17fa4
...
...
@@ -48,9 +48,9 @@
#define V2M_SYS_LED_EL_SHIFT 0x1
#define V2M_SYS_LED_EC_SHIFT 0x3
#define V2M_SYS_LED_SS_MASK 0x1
#define V2M_SYS_LED_EL_MASK 0x3
#define V2M_SYS_LED_EC_MASK 0x1f
#define V2M_SYS_LED_SS_MASK
U(
0x1
)
#define V2M_SYS_LED_EL_MASK
U(
0x3
)
#define V2M_SYS_LED_EC_MASK
U(
0x1f
)
/* V2M sysid register bits */
#define V2M_SYS_ID_REV_SHIFT 28
...
...
@@ -59,28 +59,28 @@
#define V2M_SYS_ID_ARCH_SHIFT 8
#define V2M_SYS_ID_FPGA_SHIFT 0
#define V2M_SYS_ID_REV_MASK 0xf
#define V2M_SYS_ID_HBI_MASK 0xfff
#define V2M_SYS_ID_BLD_MASK 0xf
#define V2M_SYS_ID_ARCH_MASK 0xf
#define V2M_SYS_ID_FPGA_MASK 0xff
#define V2M_SYS_ID_REV_MASK
U(
0xf
)
#define V2M_SYS_ID_HBI_MASK
U(
0xfff
)
#define V2M_SYS_ID_BLD_MASK
U(
0xf
)
#define V2M_SYS_ID_ARCH_MASK
U(
0xf
)
#define V2M_SYS_ID_FPGA_MASK
U(
0xff
)
#define V2M_SYS_ID_BLD_LENGTH 4
/* NOR Flash */
#define V2M_FLASH0_BASE 0x08000000
#define V2M_FLASH0_SIZE 0x04000000
#define V2M_FLASH_BLOCK_SIZE 0x00040000
/* 256 KB */
#define V2M_FLASH0_BASE
UL(
0x08000000
)
#define V2M_FLASH0_SIZE
UL(
0x04000000
)
#define V2M_FLASH_BLOCK_SIZE
UL(
0x00040000
)
/* 256 KB */
#define V2M_IOFPGA_BASE 0x1c000000
#define V2M_IOFPGA_SIZE 0x03000000
#define V2M_IOFPGA_BASE
UL(
0x1c000000
)
#define V2M_IOFPGA_SIZE
UL(
0x03000000
)
/* PL011 UART related constants */
#define V2M_IOFPGA_UART0_BASE 0x1c090000
#define V2M_IOFPGA_UART1_BASE 0x1c0a0000
#define V2M_IOFPGA_UART2_BASE 0x1c0b0000
#define V2M_IOFPGA_UART3_BASE 0x1c0c0000
#define V2M_IOFPGA_UART0_BASE
UL(
0x1c090000
)
#define V2M_IOFPGA_UART1_BASE
UL(
0x1c0a0000
)
#define V2M_IOFPGA_UART2_BASE
UL(
0x1c0b0000
)
#define V2M_IOFPGA_UART3_BASE
UL(
0x1c0c0000
)
#define V2M_IOFPGA_UART0_CLK_IN_HZ 24000000
#define V2M_IOFPGA_UART1_CLK_IN_HZ 24000000
...
...
@@ -88,15 +88,15 @@
#define V2M_IOFPGA_UART3_CLK_IN_HZ 24000000
/* SP804 timer related constants */
#define V2M_SP804_TIMER0_BASE 0x1C110000
#define V2M_SP804_TIMER1_BASE 0x1C120000
#define V2M_SP804_TIMER0_BASE
UL(
0x1C110000
)
#define V2M_SP804_TIMER1_BASE
UL(
0x1C120000
)
/* SP810 controller */
#define V2M_SP810_BASE 0x1c020000
#define V2M_SP810_CTRL_TIM0_SEL
(1 <<
15)
#define V2M_SP810_CTRL_TIM1_SEL
(1 <<
17)
#define V2M_SP810_CTRL_TIM2_SEL
(1 <<
19)
#define V2M_SP810_CTRL_TIM3_SEL
(1 <<
21)
#define V2M_SP810_BASE
UL(
0x1c020000
)
#define V2M_SP810_CTRL_TIM0_SEL
BIT_32(
15)
#define V2M_SP810_CTRL_TIM1_SEL
BIT_32(
17)
#define V2M_SP810_CTRL_TIM2_SEL
BIT_32(
19)
#define V2M_SP810_CTRL_TIM3_SEL
BIT_32(
21)
/*
* The flash can be mapped either as read-only or read-write.
...
...
This diff is collapsed.
Click to expand it.
include/plat/arm/common/arm_def.h
View file @
ebd17fa4
...
...
@@ -21,7 +21,7 @@
*****************************************************************************/
/* Special value used to verify platform parameters from BL2 to BL31 */
#define ARM_BL31_PLAT_PARAM_VAL 0x0f1e2d3c4b5a6978
ULL
#define ARM_BL31_PLAT_PARAM_VAL
ULL(
0x0f1e2d3c4b5a6978
)
#define ARM_SYSTEM_COUNT 1
...
...
@@ -350,8 +350,8 @@
* To enable TB_FW_CONFIG to be loaded by BL1, define the corresponding base
* and limit. Leave enough space of BL2 meminfo.
*/
#define ARM_TB_FW_CONFIG_BASE ARM_BL_RAM_BASE + sizeof(meminfo_t)
#define ARM_TB_FW_CONFIG_LIMIT ARM_BL_RAM_BASE + PAGE_SIZE
#define ARM_TB_FW_CONFIG_BASE
(
ARM_BL_RAM_BASE + sizeof(meminfo_t)
)
#define ARM_TB_FW_CONFIG_LIMIT
(
ARM_BL_RAM_BASE + PAGE_SIZE
)
/*******************************************************************************
* BL1 specific defines.
...
...
@@ -482,7 +482,7 @@
# define TSP_SEC_MEM_SIZE PLAT_ARM_TRUSTED_DRAM_SIZE
# define BL32_BASE PLAT_ARM_TRUSTED_DRAM_BASE
# define BL32_LIMIT (PLAT_ARM_TRUSTED_DRAM_BASE \
+ (
1
<< 21))
+ (
UL(1)
<< 21))
# elif ARM_TSP_RAM_LOCATION_ID == ARM_DRAM_ID
# define TSP_SEC_MEM_BASE ARM_AP_TZC_DRAM1_BASE
# define TSP_SEC_MEM_SIZE ARM_AP_TZC_DRAM1_SIZE
...
...
@@ -511,7 +511,7 @@
#define BL2U_LIMIT BL2_LIMIT
#define NS_BL2U_BASE ARM_NS_DRAM1_BASE
#define NS_BL1U_BASE (PLAT_ARM_NVM_BASE + 0x03EB8000)
#define NS_BL1U_BASE (PLAT_ARM_NVM_BASE +
UL(
0x03EB8000)
)
/*
* ID of the secure physical generic timer interrupt used by the TSP.
...
...
This diff is collapsed.
Click to expand it.
include/plat/arm/common/arm_dyn_cfg_helpers.h
View file @
ebd17fa4
...
...
@@ -3,8 +3,8 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef
__
ARM_DYN_CFG_HELPERS_H
__
#define
__
ARM_DYN_CFG_HELPERS_H
__
#ifndef ARM_DYN_CFG_HELPERS_H
#define ARM_DYN_CFG_HELPERS_H
#include <stddef.h>
#include <stdint.h>
...
...
@@ -19,4 +19,4 @@ int arm_get_dtb_mbedtls_heap_info(void *dtb, void **heap_addr,
int
arm_set_dtb_mbedtls_heap_info
(
void
*
dtb
,
void
*
heap_addr
,
size_t
heap_size
);
#endif
/*
__
ARM_DYN_CFG_HELPERS_H
__
*/
#endif
/* ARM_DYN_CFG_HELPERS_H */
This diff is collapsed.
Click to expand it.
lib/el3_runtime/aarch32/context_mgmt.c
View file @
ebd17fa4
...
...
@@ -57,7 +57,7 @@ void cm_setup_context(cpu_context_t *ctx, const entry_point_info_t *ep)
uint32_t
scr
,
sctlr
;
regs_t
*
reg_ctx
;
assert
(
ctx
);
assert
(
ctx
!=
NULL
);
security_state
=
GET_SECURITY_STATE
(
ep
->
h
.
attr
);
...
...
@@ -97,7 +97,7 @@ void cm_setup_context(cpu_context_t *ctx, const entry_point_info_t *ep)
assert
(((
ep
->
spsr
>>
SPSR_E_SHIFT
)
&
SPSR_E_MASK
)
==
(
EP_GET_EE
(
ep
->
h
.
attr
)
>>
EP_EE_SHIFT
));
sctlr
=
EP_GET_EE
(
ep
->
h
.
attr
)
?
SCTLR_EE_BIT
:
0
;
sctlr
=
(
EP_GET_EE
(
ep
->
h
.
attr
)
!=
0U
)
?
SCTLR_EE_BIT
:
0
U
;
sctlr
|=
(
SCTLR_RESET_VAL
&
~
(
SCTLR_TE_BIT
|
SCTLR_V_BIT
));
write_ctx_reg
(
reg_ctx
,
CTX_NS_SCTLR
,
sctlr
);
}
...
...
@@ -178,11 +178,11 @@ void cm_prepare_el3_exit(uint32_t security_state)
cpu_context_t
*
ctx
=
cm_get_context
(
security_state
);
bool
el2_unused
=
false
;
assert
(
ctx
);
assert
(
ctx
!=
NULL
);
if
(
security_state
==
NON_SECURE
)
{
scr
=
read_ctx_reg
(
get_regs_ctx
(
ctx
),
CTX_SCR
);
if
(
scr
&
SCR_HCE_BIT
)
{
if
(
(
scr
&
SCR_HCE_BIT
)
!=
0U
)
{
/* Use SCTLR value to initialize HSCTLR */
hsctlr
=
read_ctx_reg
(
get_regs_ctx
(
ctx
),
CTX_NS_SCTLR
);
...
...
@@ -199,8 +199,8 @@ void cm_prepare_el3_exit(uint32_t security_state)
write_scr
(
read_scr
()
&
~
SCR_NS_BIT
);
isb
();
}
else
if
(
read_id_pfr1
()
&
(
ID_PFR1_VIRTEXT_MASK
<<
ID_PFR1_VIRTEXT_SHIFT
))
{
}
else
if
(
(
read_id_pfr1
()
&
(
ID_PFR1_VIRTEXT_MASK
<<
ID_PFR1_VIRTEXT_SHIFT
))
!=
0U
)
{
el2_unused
=
true
;
/*
...
...
This diff is collapsed.
Click to expand it.
lib/el3_runtime/aarch64/context_mgmt.c
View file @
ebd17fa4
...
...
@@ -68,7 +68,7 @@ void cm_setup_context(cpu_context_t *ctx, const entry_point_info_t *ep)
gp_regs_t
*
gp_regs
;
unsigned
long
sctlr_elx
,
actlr_elx
;
assert
(
ctx
);
assert
(
ctx
!=
NULL
);
security_state
=
GET_SECURITY_STATE
(
ep
->
h
.
attr
);
...
...
@@ -84,7 +84,7 @@ void cm_setup_context(cpu_context_t *ctx, const entry_point_info_t *ep)
* the required value depending on the state of the SPSR_EL3 and the
* Security state and entrypoint attributes of the next EL.
*/
scr_el3
=
read_scr
();
scr_el3
=
(
uint32_t
)
read_scr
();
scr_el3
&=
~
(
SCR_NS_BIT
|
SCR_RW_BIT
|
SCR_FIQ_BIT
|
SCR_IRQ_BIT
|
SCR_ST_BIT
|
SCR_HCE_BIT
);
/*
...
...
@@ -103,7 +103,7 @@ void cm_setup_context(cpu_context_t *ctx, const entry_point_info_t *ep)
* Secure timer registers to EL3, from AArch64 state only, if specified
* by the entrypoint attributes.
*/
if
(
EP_GET_ST
(
ep
->
h
.
attr
))
if
(
EP_GET_ST
(
ep
->
h
.
attr
)
!=
0U
)
scr_el3
|=
SCR_ST_BIT
;
#if !HANDLE_EA_EL3_FIRST
...
...
@@ -133,10 +133,9 @@ void cm_setup_context(cpu_context_t *ctx, const entry_point_info_t *ep)
* AArch64 and next EL is EL2, or if next execution state is AArch32 and
* next mode is Hyp.
*/
if
((
GET_RW
(
ep
->
spsr
)
==
MODE_RW_64
&&
GET_EL
(
ep
->
spsr
)
==
MODE_EL2
)
||
(
GET_RW
(
ep
->
spsr
)
!=
MODE_RW_64
&&
GET_M32
(
ep
->
spsr
)
==
MODE32_hyp
))
{
if
(((
GET_RW
(
ep
->
spsr
)
==
MODE_RW_64
)
&&
(
GET_EL
(
ep
->
spsr
)
==
MODE_EL2
))
||
((
GET_RW
(
ep
->
spsr
)
!=
MODE_RW_64
)
&&
(
GET_M32
(
ep
->
spsr
)
==
MODE32_hyp
)))
{
scr_el3
|=
SCR_HCE_BIT
;
}
...
...
@@ -151,7 +150,7 @@ void cm_setup_context(cpu_context_t *ctx, const entry_point_info_t *ep)
* SCTLR.M, SCTLR.C and SCTLR.I: These fields must be zero (as
* required by PSCI specification)
*/
sctlr_elx
=
EP_GET_EE
(
ep
->
h
.
attr
)
?
SCTLR_EE_BIT
:
0
;
sctlr_elx
=
(
EP_GET_EE
(
ep
->
h
.
attr
)
!=
0U
)
?
SCTLR_EE_BIT
:
0
U
;
if
(
GET_RW
(
ep
->
spsr
)
==
MODE_RW_64
)
sctlr_elx
|=
SCTLR_EL1_RES1
;
else
{
...
...
@@ -291,20 +290,21 @@ void cm_prepare_el3_exit(uint32_t security_state)
uint32_t
sctlr_elx
,
scr_el3
,
mdcr_el2
;
cpu_context_t
*
ctx
=
cm_get_context
(
security_state
);
bool
el2_unused
=
false
;
uint64_t
hcr_el2
=
0
;
uint64_t
hcr_el2
=
0
U
;
assert
(
ctx
);
assert
(
ctx
!=
NULL
);
if
(
security_state
==
NON_SECURE
)
{
scr_el3
=
read_ctx_reg
(
get_el3state_ctx
(
ctx
),
CTX_SCR_EL3
);
if
(
scr_el3
&
SCR_HCE_BIT
)
{
scr_el3
=
(
uint32_t
)
read_ctx_reg
(
get_el3state_ctx
(
ctx
),
CTX_SCR_EL3
);
if
((
scr_el3
&
SCR_HCE_BIT
)
!=
0U
)
{
/* Use SCTLR_EL1.EE value to initialise sctlr_el2 */
sctlr_elx
=
read_ctx_reg
(
get_sysregs_ctx
(
ctx
),
CTX_SCTLR_EL1
);
sctlr_elx
=
(
uint32_t
)
read_ctx_reg
(
get_sysregs_ctx
(
ctx
),
CTX_SCTLR_EL1
);
sctlr_elx
&=
SCTLR_EE_BIT
;
sctlr_elx
|=
SCTLR_EL2_RES1
;
write_sctlr_el2
(
sctlr_elx
);
}
else
if
(
EL_IMPLEMENTED
(
2
)
)
{
}
else
if
(
el_implemented
(
2
)
!=
EL_IMPL_NONE
)
{
el2_unused
=
true
;
/*
...
...
@@ -314,7 +314,7 @@ void cm_prepare_el3_exit(uint32_t security_state)
* Set EL2 register width appropriately: Set HCR_EL2
* field to match SCR_EL3.RW.
*/
if
(
scr_el3
&
SCR_RW_BIT
)
if
(
(
scr_el3
&
SCR_RW_BIT
)
!=
0U
)
hcr_el2
|=
HCR_RW_BIT
;
/*
...
...
@@ -470,7 +470,7 @@ void cm_el1_sysregs_context_save(uint32_t security_state)
cpu_context_t
*
ctx
;
ctx
=
cm_get_context
(
security_state
);
assert
(
ctx
);
assert
(
ctx
!=
NULL
);
el1_sysregs_context_save
(
get_sysregs_ctx
(
ctx
));
...
...
@@ -487,7 +487,7 @@ void cm_el1_sysregs_context_restore(uint32_t security_state)
cpu_context_t
*
ctx
;
ctx
=
cm_get_context
(
security_state
);
assert
(
ctx
);
assert
(
ctx
!=
NULL
);
el1_sysregs_context_restore
(
get_sysregs_ctx
(
ctx
));
...
...
@@ -509,7 +509,7 @@ void cm_set_elr_el3(uint32_t security_state, uintptr_t entrypoint)
el3_state_t
*
state
;
ctx
=
cm_get_context
(
security_state
);
assert
(
ctx
);
assert
(
ctx
!=
NULL
);
/* Populate EL3 state so that ERET jumps to the correct entry */
state
=
get_el3state_ctx
(
ctx
);
...
...
@@ -527,7 +527,7 @@ void cm_set_elr_spsr_el3(uint32_t security_state,
el3_state_t
*
state
;
ctx
=
cm_get_context
(
security_state
);
assert
(
ctx
);
assert
(
ctx
!=
NULL
);
/* Populate EL3 state so that ERET jumps to the correct entry */
state
=
get_el3state_ctx
(
ctx
);
...
...
@@ -549,21 +549,21 @@ void cm_write_scr_el3_bit(uint32_t security_state,
uint32_t
scr_el3
;
ctx
=
cm_get_context
(
security_state
);
assert
(
ctx
);
assert
(
ctx
!=
NULL
);
/* Ensure that the bit position is a valid one */
assert
((
1
<<
bit_pos
)
&
SCR_VALID_BIT_MASK
);
assert
((
(
1U
<<
bit_pos
)
&
SCR_VALID_BIT_MASK
)
!=
0U
)
;
/* Ensure that the 'value' is only a bit wide */
assert
(
value
<=
1
);
assert
(
value
<=
1
U
);
/*
* Get the SCR_EL3 value from the cpu context, clear the desired bit
* and set it to its new value.
*/
state
=
get_el3state_ctx
(
ctx
);
scr_el3
=
read_ctx_reg
(
state
,
CTX_SCR_EL3
);
scr_el3
&=
~
(
1
<<
bit_pos
);
scr_el3
=
(
uint32_t
)
read_ctx_reg
(
state
,
CTX_SCR_EL3
);
scr_el3
&=
~
(
1
U
<<
bit_pos
);
scr_el3
|=
value
<<
bit_pos
;
write_ctx_reg
(
state
,
CTX_SCR_EL3
,
scr_el3
);
}
...
...
@@ -578,11 +578,11 @@ uint32_t cm_get_scr_el3(uint32_t security_state)
el3_state_t
*
state
;
ctx
=
cm_get_context
(
security_state
);
assert
(
ctx
);
assert
(
ctx
!=
NULL
);
/* Populate EL3 state so that ERET jumps to the correct entry */
state
=
get_el3state_ctx
(
ctx
);
return
read_ctx_reg
(
state
,
CTX_SCR_EL3
);
return
(
uint32_t
)
read_ctx_reg
(
state
,
CTX_SCR_EL3
);
}
/*******************************************************************************
...
...
@@ -595,7 +595,7 @@ void cm_set_next_eret_context(uint32_t security_state)
cpu_context_t
*
ctx
;
ctx
=
cm_get_context
(
security_state
);
assert
(
ctx
);
assert
(
ctx
!=
NULL
);
cm_set_next_context
(
ctx
);
}
This diff is collapsed.
Click to expand it.
lib/locks/bakery/bakery_lock_coherent.c
View file @
ebd17fa4
...
...
@@ -35,9 +35,9 @@
*/
#define assert_bakery_entry_valid(_entry, _bakery) do { \
assert(_bakery)
;
\
assert(_entry < BAKERY_LOCK_MAX_CPUS);
\
} while (
0
)
assert(
(
_bakery)
!= NULL);
\
assert(
(
_entry
)
< BAKERY_LOCK_MAX_CPUS); \
} while (
false
)
/* Obtain a ticket for a given CPU */
static
unsigned
int
bakery_get_ticket
(
bakery_lock_t
*
bakery
,
unsigned
int
me
)
...
...
@@ -46,7 +46,7 @@ static unsigned int bakery_get_ticket(bakery_lock_t *bakery, unsigned int me)
unsigned
int
they
;
/* Prevent recursive acquisition */
assert
(
!
bakery_ticket_number
(
bakery
->
lock_data
[
me
]));
assert
(
bakery_ticket_number
(
bakery
->
lock_data
[
me
])
==
0U
);
/*
* Flag that we're busy getting our ticket. All CPUs are iterated in the
...
...
@@ -58,9 +58,9 @@ static unsigned int bakery_get_ticket(bakery_lock_t *bakery, unsigned int me)
* ticket value. That's OK as the lock is acquired based on the priority
* value, not the ticket value alone.
*/
my_ticket
=
0
;
my_ticket
=
0
U
;
bakery
->
lock_data
[
me
]
=
make_bakery_data
(
CHOOSING_TICKET
,
my_ticket
);
for
(
they
=
0
;
they
<
BAKERY_LOCK_MAX_CPUS
;
they
++
)
{
for
(
they
=
0
U
;
they
<
BAKERY_LOCK_MAX_CPUS
;
they
++
)
{
their_ticket
=
bakery_ticket_number
(
bakery
->
lock_data
[
they
]);
if
(
their_ticket
>
my_ticket
)
my_ticket
=
their_ticket
;
...
...
@@ -105,8 +105,8 @@ void bakery_lock_get(bakery_lock_t *bakery)
* Now that we got our ticket, compute our priority value, then compare
* with that of others, and proceed to acquire the lock
*/
my_prio
=
PRIORITY
(
my_ticket
,
me
);
for
(
they
=
0
;
they
<
BAKERY_LOCK_MAX_CPUS
;
they
++
)
{
my_prio
=
bakery_get_priority
(
my_ticket
,
me
);
for
(
they
=
0
U
;
they
<
BAKERY_LOCK_MAX_CPUS
;
they
++
)
{
if
(
me
==
they
)
continue
;
...
...
@@ -120,7 +120,8 @@ void bakery_lock_get(bakery_lock_t *bakery)
* (valid) ticket value. If they do, compare priorities
*/
their_ticket
=
bakery_ticket_number
(
their_bakery_data
);
if
(
their_ticket
&&
(
PRIORITY
(
their_ticket
,
they
)
<
my_prio
))
{
if
((
their_ticket
!=
0U
)
&&
(
bakery_get_priority
(
their_ticket
,
they
)
<
my_prio
))
{
/*
* They have higher priority (lower value). Wait for
* their ticket value to change (either release the lock
...
...
@@ -148,7 +149,7 @@ void bakery_lock_release(bakery_lock_t *bakery)
unsigned
int
me
=
plat_my_core_pos
();
assert_bakery_entry_valid
(
me
,
bakery
);
assert
(
bakery_ticket_number
(
bakery
->
lock_data
[
me
]));
assert
(
bakery_ticket_number
(
bakery
->
lock_data
[
me
])
!=
0U
);
/*
* Ensure that other observers see any stores in the critical section
...
...
@@ -156,7 +157,7 @@ void bakery_lock_release(bakery_lock_t *bakery)
* Then signal other waiting contenders.
*/
dmbst
();
bakery
->
lock_data
[
me
]
=
0
;
bakery
->
lock_data
[
me
]
=
0
U
;
dsb
();
sev
();
}
This diff is collapsed.
Click to expand it.
lib/locks/bakery/bakery_lock_normal.c
View file @
ebd17fa4
...
...
@@ -53,21 +53,31 @@ CASSERT((PLAT_PERCPU_BAKERY_LOCK_SIZE & (CACHE_WRITEBACK_GRANULE - 1)) == 0, \
IMPORT_SYM
(
uintptr_t
,
__PERCPU_BAKERY_LOCK_SIZE__
,
PERCPU_BAKERY_LOCK_SIZE
);
#endif
#define get_bakery_info(_cpu_ix, _lock) \
(bakery_info_t *)((uintptr_t)_lock + _cpu_ix * PERCPU_BAKERY_LOCK_SIZE)
static
inline
bakery_lock_t
*
get_bakery_info
(
unsigned
int
cpu_ix
,
bakery_lock_t
*
lock
)
{
return
(
bakery_info_t
*
)((
uintptr_t
)
lock
+
cpu_ix
*
PERCPU_BAKERY_LOCK_SIZE
);
}
#define
write_cache_op(
_
addr,
_
cached)
\
do { \
(_cached ? dccvac((uintptr_t)_addr) :\
dc
i
vac(
(uintptr_t)_
addr)
);\
dsbish();\
} while (0)
static
inline
void
write_cache_op
(
uintptr_t
addr
,
bool
cached
)
{
if
(
cached
)
dc
c
vac
(
addr
)
;
else
dcivac
(
addr
);
#define read_cache_op(_addr, _cached) if (_cached) \
dccivac((uintptr_t)_addr)
dsbish
();
}
static
inline
void
read_cache_op
(
uintptr_t
addr
,
bool
cached
)
{
if
(
cached
)
dccivac
(
addr
);
}
/* Helper function to check if the lock is acquired */
static
inline
int
is_lock_acquired
(
const
bakery_info_t
*
my_bakery_info
,
static
inline
bool
is_lock_acquired
(
const
bakery_info_t
*
my_bakery_info
,
int
is_cached
)
{
/*
...
...
@@ -78,8 +88,8 @@ static inline int is_lock_acquired(const bakery_info_t *my_bakery_info,
* operations were not propagated to all the caches in the system.
* Hence do a `read_cache_op()` prior to read.
*/
read_cache_op
(
my_bakery_info
,
is_cached
);
return
!!
(
bakery_ticket_number
(
my_bakery_info
->
lock_data
)
)
;
read_cache_op
(
(
uintptr_t
)
my_bakery_info
,
is_cached
);
return
bakery_ticket_number
(
my_bakery_info
->
lock_data
)
!=
0U
;
}
static
unsigned
int
bakery_get_ticket
(
bakery_lock_t
*
lock
,
...
...
@@ -94,7 +104,7 @@ static unsigned int bakery_get_ticket(bakery_lock_t *lock,
* it is not NULL.
*/
my_bakery_info
=
get_bakery_info
(
me
,
lock
);
assert
(
my_bakery_info
);
assert
(
my_bakery_info
!=
NULL
);
/* Prevent recursive acquisition.*/
assert
(
!
is_lock_acquired
(
my_bakery_info
,
is_cached
));
...
...
@@ -103,16 +113,16 @@ static unsigned int bakery_get_ticket(bakery_lock_t *lock,
* Tell other contenders that we are through the bakery doorway i.e.
* going to allocate a ticket for this cpu.
*/
my_ticket
=
0
;
my_ticket
=
0
U
;
my_bakery_info
->
lock_data
=
make_bakery_data
(
CHOOSING_TICKET
,
my_ticket
);
write_cache_op
(
my_bakery_info
,
is_cached
);
write_cache_op
(
(
uintptr_t
)
my_bakery_info
,
is_cached
);
/*
* Iterate through the bakery information of each contender to allocate
* the highest ticket number for this cpu.
*/
for
(
they
=
0
;
they
<
BAKERY_LOCK_MAX_CPUS
;
they
++
)
{
for
(
they
=
0
U
;
they
<
BAKERY_LOCK_MAX_CPUS
;
they
++
)
{
if
(
me
==
they
)
continue
;
...
...
@@ -121,9 +131,9 @@ static unsigned int bakery_get_ticket(bakery_lock_t *lock,
* ensure that a stale copy is not read.
*/
their_bakery_info
=
get_bakery_info
(
they
,
lock
);
assert
(
their_bakery_info
);
assert
(
their_bakery_info
!=
NULL
);
read_cache_op
(
their_bakery_info
,
is_cached
);
read_cache_op
(
(
uintptr_t
)
their_bakery_info
,
is_cached
);
/*
* Update this cpu's ticket number if a higher ticket number is
...
...
@@ -141,7 +151,7 @@ static unsigned int bakery_get_ticket(bakery_lock_t *lock,
++
my_ticket
;
my_bakery_info
->
lock_data
=
make_bakery_data
(
CHOSEN_TICKET
,
my_ticket
);
write_cache_op
(
my_bakery_info
,
is_cached
);
write_cache_op
(
(
uintptr_t
)
my_bakery_info
,
is_cached
);
return
my_ticket
;
}
...
...
@@ -167,8 +177,8 @@ void bakery_lock_get(bakery_lock_t *lock)
* Now that we got our ticket, compute our priority value, then compare
* with that of others, and proceed to acquire the lock
*/
my_prio
=
PRIORITY
(
my_ticket
,
me
);
for
(
they
=
0
;
they
<
BAKERY_LOCK_MAX_CPUS
;
they
++
)
{
my_prio
=
bakery_get_priority
(
my_ticket
,
me
);
for
(
they
=
0
U
;
they
<
BAKERY_LOCK_MAX_CPUS
;
they
++
)
{
if
(
me
==
they
)
continue
;
...
...
@@ -177,11 +187,11 @@ void bakery_lock_get(bakery_lock_t *lock)
* ensure that a stale copy is not read.
*/
their_bakery_info
=
get_bakery_info
(
they
,
lock
);
assert
(
their_bakery_info
);
assert
(
their_bakery_info
!=
NULL
);
/* Wait for the contender to get their ticket */
do
{
read_cache_op
(
their_bakery_info
,
is_cached
);
read_cache_op
(
(
uintptr_t
)
their_bakery_info
,
is_cached
);
their_bakery_data
=
their_bakery_info
->
lock_data
;
}
while
(
bakery_is_choosing
(
their_bakery_data
));
...
...
@@ -190,7 +200,7 @@ void bakery_lock_get(bakery_lock_t *lock)
* (valid) ticket value. If they do, compare priorities
*/
their_ticket
=
bakery_ticket_number
(
their_bakery_data
);
if
(
their_ticket
&&
(
PRIORITY
(
their_ticket
,
they
)
<
my_prio
))
{
if
(
their_ticket
&&
(
bakery_get_priority
(
their_ticket
,
they
)
<
my_prio
))
{
/*
* They have higher priority (lower value). Wait for
* their ticket value to change (either release the lock
...
...
@@ -199,7 +209,7 @@ void bakery_lock_get(bakery_lock_t *lock)
*/
do
{
wfe
();
read_cache_op
(
their_bakery_info
,
is_cached
);
read_cache_op
(
(
uintptr_t
)
their_bakery_info
,
is_cached
);
}
while
(
their_ticket
==
bakery_ticket_number
(
their_bakery_info
->
lock_data
));
}
...
...
@@ -231,7 +241,7 @@ void bakery_lock_release(bakery_lock_t *lock)
* Then signal other waiting contenders.
*/
dmbst
();
my_bakery_info
->
lock_data
=
0
;
write_cache_op
(
my_bakery_info
,
is_cached
);
my_bakery_info
->
lock_data
=
0
U
;
write_cache_op
(
(
uintptr_t
)
my_bakery_info
,
is_cached
);
sev
();
}
This diff is collapsed.
Click to expand it.
plat/arm/board/fvp/fvp_def.h
View file @
ebd17fa4
...
...
@@ -31,70 +31,70 @@
* FVP memory map related constants
******************************************************************************/
#define FLASH1_BASE 0x0c000000
#define FLASH1_SIZE 0x04000000
#define FLASH1_BASE
UL(
0x0c000000
)
#define FLASH1_SIZE
UL(
0x04000000
)
#define PSRAM_BASE 0x14000000
#define PSRAM_SIZE 0x04000000
#define PSRAM_BASE
UL(
0x14000000
)
#define PSRAM_SIZE
UL(
0x04000000
)
#define VRAM_BASE 0x18000000
#define VRAM_SIZE 0x02000000
#define VRAM_BASE
UL(
0x18000000
)
#define VRAM_SIZE
UL(
0x02000000
)
/* Aggregate of all devices in the first GB */
#define DEVICE0_BASE 0x20000000
#define DEVICE0_SIZE 0x0c200000
#define DEVICE0_BASE
UL(
0x20000000
)
#define DEVICE0_SIZE
UL(
0x0c200000
)
/*
* In case of FVP models with CCN, the CCN register space overlaps into
* the NSRAM area.
*/
#if FVP_INTERCONNECT_DRIVER == FVP_CCN
#define DEVICE1_BASE 0x2e000000
#define DEVICE1_SIZE 0x1A00000
#define DEVICE1_BASE
UL(
0x2e000000
)
#define DEVICE1_SIZE
UL(
0x1A00000
)
#else
#define DEVICE1_BASE 0x2f000000
#define DEVICE1_SIZE 0x200000
#define NSRAM_BASE 0x2e000000
#define NSRAM_SIZE 0x10000
#define DEVICE1_BASE
UL(
0x2f000000
)
#define DEVICE1_SIZE
UL(
0x200000
)
#define NSRAM_BASE
UL(
0x2e000000
)
#define NSRAM_SIZE
UL(
0x10000
)
#endif
/* Devices in the second GB */
#define DEVICE2_BASE 0x7fe00000
#define DEVICE2_SIZE 0x00200000
#define DEVICE2_BASE
UL(
0x7fe00000
)
#define DEVICE2_SIZE
UL(
0x00200000
)
#define PCIE_EXP_BASE 0x40000000
#define TZRNG_BASE 0x7fe60000
#define PCIE_EXP_BASE
UL(
0x40000000
)
#define TZRNG_BASE
UL(
0x7fe60000
)
/* Non-volatile counters */
#define TRUSTED_NVCTR_BASE 0x7fe70000
#define TFW_NVCTR_BASE (TRUSTED_NVCTR_BASE + 0x0000)
#define TFW_NVCTR_SIZE
4
#define NTFW_CTR_BASE (TRUSTED_NVCTR_BASE + 0x0004)
#define NTFW_CTR_SIZE
4
#define TRUSTED_NVCTR_BASE
UL(
0x7fe70000
)
#define TFW_NVCTR_BASE (TRUSTED_NVCTR_BASE +
UL(
0x0000)
)
#define TFW_NVCTR_SIZE
UL(4)
#define NTFW_CTR_BASE (TRUSTED_NVCTR_BASE +
UL(
0x0004)
)
#define NTFW_CTR_SIZE
UL(4)
/* Keys */
#define SOC_KEYS_BASE 0x7fe80000
#define TZ_PUB_KEY_HASH_BASE (SOC_KEYS_BASE + 0x0000)
#define TZ_PUB_KEY_HASH_SIZE 32
#define HU_KEY_BASE (SOC_KEYS_BASE + 0x0020)
#define HU_KEY_SIZE 16
#define END_KEY_BASE (SOC_KEYS_BASE + 0x0044)
#define END_KEY_SIZE 32
#define SOC_KEYS_BASE
UL(
0x7fe80000
)
#define TZ_PUB_KEY_HASH_BASE (SOC_KEYS_BASE +
UL(
0x0000)
)
#define TZ_PUB_KEY_HASH_SIZE
UL(
32
)
#define HU_KEY_BASE (SOC_KEYS_BASE +
UL(
0x0020)
)
#define HU_KEY_SIZE
UL(
16
)
#define END_KEY_BASE (SOC_KEYS_BASE +
UL(
0x0044)
)
#define END_KEY_SIZE
UL(
32
)
/* Constants to distinguish FVP type */
#define HBI_BASE_FVP 0x020
#define REV_BASE_FVP_V0 0x0
#define REV_BASE_FVP_REVC 0x2
#define HBI_BASE_FVP
U(
0x020
)
#define REV_BASE_FVP_V0
U(
0x0
)
#define REV_BASE_FVP_REVC
U(
0x2
)
#define HBI_FOUNDATION_FVP 0x010
#define REV_FOUNDATION_FVP_V2_0 0x0
#define REV_FOUNDATION_FVP_V2_1 0x1
#define REV_FOUNDATION_FVP_v9_1 0x2
#define REV_FOUNDATION_FVP_v9_6 0x3
#define HBI_FOUNDATION_FVP
U(
0x010
)
#define REV_FOUNDATION_FVP_V2_0
U(
0x0
)
#define REV_FOUNDATION_FVP_V2_1
U(
0x1
)
#define REV_FOUNDATION_FVP_v9_1
U(
0x2
)
#define REV_FOUNDATION_FVP_v9_6
U(
0x3
)
#define BLD_GIC_VE_MMAP 0x0
#define BLD_GIC_A53A57_MMAP 0x1
#define BLD_GIC_VE_MMAP
U(
0x0
)
#define BLD_GIC_A53A57_MMAP
U(
0x1
)
#define ARCH_MODEL 0x1
#define ARCH_MODEL
U(
0x1
)
/* FVP Power controller base address*/
#define PWRC_BASE UL(0x1c100000)
...
...
@@ -104,26 +104,26 @@
#define SP804_TIMER_CLKDIV 35
/* SP810 controller. FVP specific flags */
#define FVP_SP810_CTRL_TIM0_OV
(1 <<
16)
#define FVP_SP810_CTRL_TIM1_OV
(1 <<
18)
#define FVP_SP810_CTRL_TIM2_OV
(1 <<
20)
#define FVP_SP810_CTRL_TIM3_OV
(1 <<
22)
#define FVP_SP810_CTRL_TIM0_OV
BIT_32(
16)
#define FVP_SP810_CTRL_TIM1_OV
BIT_32(
18)
#define FVP_SP810_CTRL_TIM2_OV
BIT_32(
20)
#define FVP_SP810_CTRL_TIM3_OV
BIT_32(
22)
/*******************************************************************************
* GIC-400 & interrupt handling related constants
******************************************************************************/
/* VE compatible GIC memory map */
#define VE_GICD_BASE 0x2c001000
#define VE_GICC_BASE 0x2c002000
#define VE_GICH_BASE 0x2c004000
#define VE_GICV_BASE 0x2c006000
#define VE_GICD_BASE
UL(
0x2c001000
)
#define VE_GICC_BASE
UL(
0x2c002000
)
#define VE_GICH_BASE
UL(
0x2c004000
)
#define VE_GICV_BASE
UL(
0x2c006000
)
/* Base FVP compatible GIC memory map */
#define BASE_GICD_BASE 0x2f000000
#define BASE_GICR_BASE 0x2f100000
#define BASE_GICC_BASE 0x2c000000
#define BASE_GICH_BASE 0x2c010000
#define BASE_GICV_BASE 0x2c02f000
#define BASE_GICD_BASE
UL(
0x2f000000
)
#define BASE_GICR_BASE
UL(
0x2f100000
)
#define BASE_GICC_BASE
UL(
0x2c000000
)
#define BASE_GICH_BASE
UL(
0x2c010000
)
#define BASE_GICV_BASE
UL(
0x2c02f000
)
#define FVP_IRQ_TZ_WDOG 56
#define FVP_IRQ_SEC_SYS_TIMER 57
...
...
This diff is collapsed.
Click to expand it.
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment