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
e1c42740
Commit
e1c42740
authored
Oct 17, 2016
by
danh-arm
Committed by
GitHub
Oct 17, 2016
Browse files
Merge pull request #735 from soby-mathew/sm/aarch32_sctlr
Unify SCTLR initialization for AArch32 normal world
parents
1281a42f
b7b0787d
Changes
4
Hide whitespace changes
Inline
Side-by-side
include/lib/aarch32/arch.h
View file @
e1c42740
...
@@ -108,7 +108,7 @@
...
@@ -108,7 +108,7 @@
/* SCTLR definitions */
/* SCTLR definitions */
#define SCTLR_RES1 ((1 << 23) | (1 << 22) | (1 << 11) | (1 << 4) | \
#define SCTLR_RES1 ((1 << 23) | (1 << 22) | (1 << 11) | (1 << 4) | \
(1 << 3)
| SCTLR_CP15BEN_BIT | SCTLR_NTWI_BIT | SCTLR_NTWE_BIT
)
(1 << 3))
#define SCTLR_M_BIT (1 << 0)
#define SCTLR_M_BIT (1 << 0)
#define SCTLR_A_BIT (1 << 1)
#define SCTLR_A_BIT (1 << 1)
#define SCTLR_C_BIT (1 << 2)
#define SCTLR_C_BIT (1 << 2)
...
@@ -128,7 +128,7 @@
...
@@ -128,7 +128,7 @@
/* HSCTLR definitions */
/* HSCTLR definitions */
#define HSCTLR_RES1 ((1 << 29) | (1 << 28) | (1 << 23) | (1 << 22) \
#define HSCTLR_RES1 ((1 << 29) | (1 << 28) | (1 << 23) | (1 << 22) \
| (1 << 18) | (1 << 16) | (1 << 11) | (1 << 4) \
| (1 << 18) | (1 << 16) | (1 << 11) | (1 << 4) \
| (1 << 3)
| HSCTLR_CP15BEN_BIT
)
| (1 << 3))
#define HSCTLR_M_BIT (1 << 0)
#define HSCTLR_M_BIT (1 << 0)
#define HSCTLR_A_BIT (1 << 1)
#define HSCTLR_A_BIT (1 << 1)
#define HSCTLR_C_BIT (1 << 2)
#define HSCTLR_C_BIT (1 << 2)
...
...
include/lib/aarch64/arch.h
View file @
e1c42740
...
@@ -155,7 +155,10 @@
...
@@ -155,7 +155,10 @@
#define SCTLR_A_BIT (1 << 1)
#define SCTLR_A_BIT (1 << 1)
#define SCTLR_C_BIT (1 << 2)
#define SCTLR_C_BIT (1 << 2)
#define SCTLR_SA_BIT (1 << 3)
#define SCTLR_SA_BIT (1 << 3)
#define SCTLR_CP15BEN_BIT (1 << 5)
#define SCTLR_I_BIT (1 << 12)
#define SCTLR_I_BIT (1 << 12)
#define SCTLR_NTWI_BIT (1 << 16)
#define SCTLR_NTWE_BIT (1 << 18)
#define SCTLR_WXN_BIT (1 << 19)
#define SCTLR_WXN_BIT (1 << 19)
#define SCTLR_EE_BIT (1 << 25)
#define SCTLR_EE_BIT (1 << 25)
...
...
lib/el3_runtime/aarch32/context_mgmt.c
View file @
e1c42740
...
@@ -116,7 +116,12 @@ static void cm_init_context_common(cpu_context_t *ctx, const entry_point_info_t
...
@@ -116,7 +116,12 @@ static void cm_init_context_common(cpu_context_t *ctx, const entry_point_info_t
*/
*/
if
(
security_state
!=
SECURE
)
{
if
(
security_state
!=
SECURE
)
{
sctlr
=
EP_GET_EE
(
ep
->
h
.
attr
)
?
SCTLR_EE_BIT
:
0
;
sctlr
=
EP_GET_EE
(
ep
->
h
.
attr
)
?
SCTLR_EE_BIT
:
0
;
sctlr
|=
SCTLR_RES1
;
/*
* In addition to SCTLR_RES1, set the CP15_BEN, nTWI & nTWE
* bits that architecturally reset to 1.
*/
sctlr
|=
SCTLR_RES1
|
SCTLR_CP15BEN_BIT
|
SCTLR_NTWI_BIT
|
SCTLR_NTWE_BIT
;
write_ctx_reg
(
reg_ctx
,
CTX_NS_SCTLR
,
sctlr
);
write_ctx_reg
(
reg_ctx
,
CTX_NS_SCTLR
,
sctlr
);
}
}
...
...
lib/el3_runtime/aarch64/context_mgmt.c
View file @
e1c42740
...
@@ -143,8 +143,19 @@ static void cm_init_context_common(cpu_context_t *ctx, const entry_point_info_t
...
@@ -143,8 +143,19 @@ static void cm_init_context_common(cpu_context_t *ctx, const entry_point_info_t
sctlr_elx
=
EP_GET_EE
(
ep
->
h
.
attr
)
?
SCTLR_EE_BIT
:
0
;
sctlr_elx
=
EP_GET_EE
(
ep
->
h
.
attr
)
?
SCTLR_EE_BIT
:
0
;
if
(
GET_RW
(
ep
->
spsr
)
==
MODE_RW_64
)
if
(
GET_RW
(
ep
->
spsr
)
==
MODE_RW_64
)
sctlr_elx
|=
SCTLR_EL1_RES1
;
sctlr_elx
|=
SCTLR_EL1_RES1
;
else
else
{
sctlr_elx
|=
SCTLR_AARCH32_EL1_RES1
;
sctlr_elx
|=
SCTLR_AARCH32_EL1_RES1
;
/*
* If lower non-secure EL is AArch32, enable the CP15BEN, nTWI
* & nTWI bits. This aligns with SCTLR initialization on
* systems with an AArch32 EL3, where these bits
* architecturally reset to 1.
*/
if
(
security_state
!=
SECURE
)
sctlr_elx
|=
SCTLR_CP15BEN_BIT
|
SCTLR_NTWI_BIT
|
SCTLR_NTWE_BIT
;
}
write_ctx_reg
(
get_sysregs_ctx
(
ctx
),
CTX_SCTLR_EL1
,
sctlr_elx
);
write_ctx_reg
(
get_sysregs_ctx
(
ctx
),
CTX_SCTLR_EL1
,
sctlr_elx
);
if
((
GET_RW
(
ep
->
spsr
)
==
MODE_RW_64
if
((
GET_RW
(
ep
->
spsr
)
==
MODE_RW_64
...
...
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