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
6a4932bd
Commit
6a4932bd
authored
Jan 30, 2015
by
danh-arm
Browse files
Merge pull request #251 from soby-mathew/sm/reset_handler_fix_v2
Fix the Cortex-A57 reset handler register usage v2
parents
2d017e22
683f788f
Changes
5
Hide whitespace changes
Inline
Side-by-side
docs/firmware-design.md
View file @
6a4932bd
...
@@ -1066,6 +1066,7 @@ array and returns it. Note that only the part number and implementator fields
...
@@ -1066,6 +1066,7 @@ array and returns it. Note that only the part number and implementator fields
in midr are used to find the matching `
cpu_ops
` entry. The `
reset_func()
` in
in midr are used to find the matching `
cpu_ops
` entry. The `
reset_func()
` in
the returned `
cpu_ops
` is then invoked which executes the required reset
the returned `
cpu_ops
` is then invoked which executes the required reset
handling for that CPU and also any errata workarounds enabled by the platform.
handling for that CPU and also any errata workarounds enabled by the platform.
This function must preserve the values of general purpose registers x20 to x29.
Refer to Section "Guidelines for Reset Handlers" for general guidelines
Refer to Section "Guidelines for Reset Handlers" for general guidelines
regarding placement of code in a reset handler.
regarding placement of code in a reset handler.
...
...
docs/porting-guide.md
View file @
6a4932bd
...
@@ -491,8 +491,7 @@ are just an ARM Trusted Firmware convention.
...
@@ -491,8 +491,7 @@ are just an ARM Trusted Firmware convention.
A platform may need to do additional initialization after reset. This function
A platform may need to do additional initialization after reset. This function
allows the platform to do the platform specific intializations. Platform
allows the platform to do the platform specific intializations. Platform
specific errata workarounds could also be implemented here. The api should
specific errata workarounds could also be implemented here. The api should
preserve the value in x10 register as it is used by the caller to store the
preserve the values of callee saved registers x19 to x29.
return address.
The default implementation doesn't do anything. If a platform needs to override
The default implementation doesn't do anything. If a platform needs to override
the default implementation, refer to the [Firmware Design Guide] for general
the default implementation, refer to the [Firmware Design Guide] for general
...
...
lib/cpus/aarch64/cortex_a53.S
View file @
6a4932bd
...
@@ -61,6 +61,7 @@ func cortex_a53_reset_func
...
@@ -61,6 +61,7 @@ func cortex_a53_reset_func
/
*
---------------------------------------------
/
*
---------------------------------------------
*
As
a
bare
minimum
enable
the
SMP
bit
if
it
is
*
As
a
bare
minimum
enable
the
SMP
bit
if
it
is
*
not
already
set
.
*
not
already
set
.
*
Clobbers
:
x0
*
---------------------------------------------
*
---------------------------------------------
*/
*/
mrs
x0
,
CPUECTLR_EL1
mrs
x0
,
CPUECTLR_EL1
...
...
lib/cpus/aarch64/cortex_a57.S
View file @
6a4932bd
...
@@ -87,6 +87,7 @@ func cortex_a57_disable_ext_debug
...
@@ -87,6 +87,7 @@ func cortex_a57_disable_ext_debug
*
This
applies
only
to
revision
r0p0
of
Cortex
A57
.
*
This
applies
only
to
revision
r0p0
of
Cortex
A57
.
*
Inputs
:
*
Inputs
:
*
x0
:
variant
[
4
:
7
]
and
revision
[
0
:
3
]
of
current
cpu
.
*
x0
:
variant
[
4
:
7
]
and
revision
[
0
:
3
]
of
current
cpu
.
*
Clobbers
:
x0
-
x5
*
--------------------------------------------------
*
--------------------------------------------------
*/
*/
func
errata_a57_806969_wa
func
errata_a57_806969_wa
...
@@ -119,6 +120,7 @@ skip_806969:
...
@@ -119,6 +120,7 @@ skip_806969:
*
This
applies
only
to
revision
r0p0
of
Cortex
A57
.
*
This
applies
only
to
revision
r0p0
of
Cortex
A57
.
*
Inputs
:
*
Inputs
:
*
x0
:
variant
[
4
:
7
]
and
revision
[
0
:
3
]
of
current
cpu
.
*
x0
:
variant
[
4
:
7
]
and
revision
[
0
:
3
]
of
current
cpu
.
*
Clobbers
:
x0
-
x5
*
---------------------------------------------------
*
---------------------------------------------------
*/
*/
func
errata_a57_813420_wa
func
errata_a57_813420_wa
...
@@ -147,6 +149,7 @@ skip_813420:
...
@@ -147,6 +149,7 @@ skip_813420:
/
*
-------------------------------------------------
/
*
-------------------------------------------------
*
The
CPU
Ops
reset
function
for
Cortex
-
A57
.
*
The
CPU
Ops
reset
function
for
Cortex
-
A57
.
*
Clobbers
:
x0
-
x5
,
x15
,
x19
,
x30
*
-------------------------------------------------
*
-------------------------------------------------
*/
*/
func
cortex_a57_reset_func
func
cortex_a57_reset_func
...
@@ -155,20 +158,20 @@ func cortex_a57_reset_func
...
@@ -155,20 +158,20 @@ func cortex_a57_reset_func
/
*
/
*
*
Extract
the
variant
[
20
:
23
]
and
revision
[
0
:
3
]
from
x0
*
Extract
the
variant
[
20
:
23
]
and
revision
[
0
:
3
]
from
x0
*
and
pack
it
in
x
20
[
0
:
7
]
as
variant
[
4
:
7
]
and
revision
[
0
:
3
]
.
*
and
pack
it
in
x
15
[
0
:
7
]
as
variant
[
4
:
7
]
and
revision
[
0
:
3
]
.
*
First
extract
x0
[
16
:
23
]
to
x
20
[
0
:
7
]
and
zero
fill
the
rest
.
*
First
extract
x0
[
16
:
23
]
to
x
15
[
0
:
7
]
and
zero
fill
the
rest
.
*
Then
extract
x0
[
0
:
3
]
into
x
20
[
0
:
3
]
retaining
other
bits
.
*
Then
extract
x0
[
0
:
3
]
into
x
15
[
0
:
3
]
retaining
other
bits
.
*/
*/
ubfx
x
20
,
x0
,
#(
MIDR_VAR_SHIFT
-
MIDR_REV_BITS
),
#(
MIDR_REV_BITS
+
MIDR_VAR_BITS
)
ubfx
x
15
,
x0
,
#(
MIDR_VAR_SHIFT
-
MIDR_REV_BITS
),
#(
MIDR_REV_BITS
+
MIDR_VAR_BITS
)
bfxil
x
20
,
x0
,
#
MIDR_REV_SHIFT
,
#
MIDR_REV_BITS
bfxil
x
15
,
x0
,
#
MIDR_REV_SHIFT
,
#
MIDR_REV_BITS
#if ERRATA_A57_806969
#if ERRATA_A57_806969
mov
x0
,
x
20
mov
x0
,
x
15
bl
errata_a57_806969_wa
bl
errata_a57_806969_wa
#endif
#endif
#if ERRATA_A57_813420
#if ERRATA_A57_813420
mov
x0
,
x
20
mov
x0
,
x
15
bl
errata_a57_813420_wa
bl
errata_a57_813420_wa
#endif
#endif
...
...
lib/cpus/aarch64/cpu_helpers.S
View file @
6a4932bd
...
@@ -42,11 +42,13 @@
...
@@ -42,11 +42,13 @@
*
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
*
in
the
cpu_ops
is
invoked
.
*
in
the
cpu_ops
is
invoked
.
*
Clobbers
:
x0
-
x19
,
x30
*/
*/
.
globl
reset_handler
.
globl
reset_handler
func
reset_handler
func
reset_handler
mov
x19
,
x30
mov
x19
,
x30
/
*
The
plat_reset_handler
can
clobber
x0
-
x18
,
x30
*/
bl
plat_reset_handler
bl
plat_reset_handler
/
*
Get
the
matching
cpu_ops
pointer
*/
/
*
Get
the
matching
cpu_ops
pointer
*/
...
@@ -60,6 +62,8 @@ func reset_handler
...
@@ -60,6 +62,8 @@ func reset_handler
ldr
x2
,
[
x0
,
#
CPU_RESET_FUNC
]
ldr
x2
,
[
x0
,
#
CPU_RESET_FUNC
]
mov
x30
,
x19
mov
x30
,
x19
cbz
x2
,
1
f
cbz
x2
,
1
f
/
*
The
cpu_ops
reset
handler
can
clobber
x0
-
x19
,
x30
*/
br
x2
br
x2
1
:
1
:
ret
ret
...
...
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