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
478fc4f2
Commit
478fc4f2
authored
Sep 28, 2020
by
André Przywara
Committed by
TrustedFirmware Code Review
Sep 28, 2020
Browse files
Merge "arm_fpga: Add support for unknown MPIDs" into integration
parents
e89b8131
1994e562
Changes
6
Hide whitespace changes
Inline
Side-by-side
bl31/bl31.mk
View file @
478fc4f2
...
...
@@ -7,6 +7,12 @@
################################################################################
# Include Makefile for the SPM-MM implementation
################################################################################
ifeq
(${SUPPORT_UNKNOWN_MPID},1)
ifeq
(${DEBUG},0)
$(warning WARNING
:
SUPPORT_UNKNOWN_MPID enabled)
endif
endif
ifeq
(${SPM_MM},1)
ifeq
(${EL3_EXCEPTION_HANDLING},0)
$(error
EL3_EXCEPTION_HANDLING
must
be
1
for
SPM-MM
support)
...
...
bl31/bl31_main.c
View file @
478fc4f2
/*
* Copyright (c) 2013-20
19
, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2013-20
20
, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
...
...
@@ -41,6 +41,15 @@ static int32_t (*bl32_init)(void);
******************************************************************************/
static
uint32_t
next_image_type
=
NON_SECURE
;
#ifdef SUPPORT_UNKNOWN_MPID
/*
* Flag to know whether an unsupported MPID has been detected. To avoid having it
* landing on the .bss section, it is initialized to a non-zero value, this way
* we avoid potential WAW hazards during system bring up.
* */
volatile
uint32_t
unsupported_mpid_flag
=
1
;
#endif
/*
* Implement the ARM Standard Service function to get arguments for a
* particular service.
...
...
@@ -98,6 +107,12 @@ void bl31_main(void)
NOTICE
(
"BL31: %s
\n
"
,
version_string
);
NOTICE
(
"BL31: %s
\n
"
,
build_message
);
#ifdef SUPPORT_UNKNOWN_MPID
if
(
unsupported_mpid_flag
==
0
)
{
NOTICE
(
"Unsupported MPID detected!
\n
"
);
}
#endif
/* Perform platform setup in BL31 */
bl31_platform_setup
();
...
...
include/lib/cpus/aarch64/generic.h
0 → 100644
View file @
478fc4f2
/*
* Copyright (c) 2020, Arm Limited. All rights reserverd.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef AARCH64_GENERIC_H
#define AARCH64_GENERIC_H
#include <lib/utils_def.h>
/*
* 0x0 value on the MIDR implementer value is reserved for software use,
* so use an MIDR value of 0 for a default CPU library.
*/
#define AARCH64_GENERIC_MIDR U(0)
#endif
/* AARCH64_GENERIC_H */
lib/cpus/aarch64/cpu_helpers.S
View file @
478fc4f2
/*
*
Copyright
(
c
)
2014
-
20
19
,
A
RM
Limited
and
Contributors
.
All
rights
reserved
.
*
Copyright
(
c
)
2014
-
20
20
,
A
rm
Limited
and
Contributors
.
All
rights
reserved
.
*
*
SPDX
-
License
-
Identifier
:
BSD
-
3
-
Clause
*/
...
...
@@ -140,6 +140,13 @@ endfunc do_cpu_reg_dump
*
midr
of
the
core
.
It
reads
the
MIDR_EL1
and
finds
the
matching
*
entry
in
cpu_ops
entries
.
Only
the
implementation
and
part
number
*
are
used
to
match
the
entries
.
*
*
If
cpu_ops
for
the
MIDR_EL1
cannot
be
found
and
*
SUPPORT_UNKNOWN_MPID
is
enabled
,
it
will
try
to
look
for
a
*
default
cpu_ops
with
an
MIDR
value
of
0
.
*
(
Implementation
number
0x0
should
be
reseverd
for
software
use
*
and
therefore
no
clashes
should
happen
with
that
default
value
)
.
*
*
Return
:
*
x0
-
The
matching
cpu_ops
pointer
on
Success
*
x0
-
0
on
failure
.
...
...
@@ -147,23 +154,26 @@ endfunc do_cpu_reg_dump
*/
.
globl
get_cpu_ops_ptr
func
get_cpu_ops_ptr
/
*
Get
the
cpu_ops
start
and
end
locations
*/
adr
x4
,
(
__CPU_OPS_START__
+
CPU_MIDR
)
adr
x5
,
(
__CPU_OPS_END__
+
CPU_MIDR
)
/
*
Initialize
the
return
parameter
*/
mov
x0
,
#
0
/
*
Read
the
MIDR_EL1
*/
mrs
x2
,
midr_el1
mov_imm
x3
,
CPU_IMPL_PN_MASK
/
*
Retain
only
the
implementation
and
part
number
using
mask
*/
and
w2
,
w2
,
w3
/
*
Get
the
cpu_ops
end
location
*/
adr
x5
,
(
__CPU_OPS_END__
+
CPU_MIDR
)
/
*
Initialize
the
return
parameter
*/
mov
x0
,
#
0
1
:
/
*
Get
the
cpu_ops
start
location
*/
adr
x4
,
(
__CPU_OPS_START__
+
CPU_MIDR
)
2
:
/
*
Check
if
we
have
reached
end
of
list
*/
cmp
x4
,
x5
b.eq
error_exit
b.eq
search_def_ptr
/
*
load
the
midr
from
the
cpu_ops
*/
ldr
x1
,
[
x4
],
#
CPU_OPS_SIZE
...
...
@@ -171,7 +181,7 @@ func get_cpu_ops_ptr
/
*
Check
if
midr
matches
to
midr
of
this
core
*/
cmp
w1
,
w2
b.ne
1
b
b.ne
2
b
/
*
Subtract
the
increment
and
offset
to
get
the
cpu
-
ops
pointer
*/
sub
x0
,
x4
,
#(
CPU_OPS_SIZE
+
CPU_MIDR
)
...
...
@@ -179,7 +189,27 @@ func get_cpu_ops_ptr
cmp
x0
,
#
0
ASM_ASSERT
(
ne
)
#endif
#ifdef SUPPORT_UNKNOWN_MPID
cbnz
x2
,
exit_mpid_found
/
*
Mark
the
unsupported
MPID
flag
*/
adrp
x1
,
unsupported_mpid_flag
add
x1
,
x1
,
:
lo12
:
unsupported_mpid_flag
str
w2
,
[
x1
]
exit_mpid_found
:
#endif
ret
/
*
*
Search
again
for
a
default
pointer
(
MIDR
=
0x0
)
*
or
return
error
if
already
searched
.
*/
search_def_ptr
:
#ifdef SUPPORT_UNKNOWN_MPID
cbz
x2
,
error_exit
mov
x2
,
#
0
b
1
b
error_exit
:
#endif
ret
endfunc
get_cpu_ops_ptr
...
...
lib/cpus/aarch64/generic.S
0 → 100644
View file @
478fc4f2
/*
*
Copyright
(
c
)
2020
,
Arm
Limited
.
All
rights
reserved
.
*
*
SPDX
-
License
-
Identifier
:
BSD
-
3
-
Clause
*/
#include <arch.h>
#include <asm_macros.S>
#include <common/bl_common.h>
#include <generic.h>
#include <cpu_macros.S>
#include <plat_macros.S>
/
*
---------------------------------------------
*
Disable
L1
data
cache
and
unified
L2
cache
*
---------------------------------------------
*/
func
generic_disable_dcache
mrs
x1
,
sctlr_el3
bic
x1
,
x1
,
#
SCTLR_C_BIT
msr
sctlr_el3
,
x1
isb
ret
endfunc
generic_disable_dcache
func
generic_core_pwr_dwn
mov
x18
,
x30
/
*
---------------------------------------------
*
Turn
off
caches
.
*
---------------------------------------------
*/
bl
generic_disable_dcache
/
*
---------------------------------------------
*
Flush
L1
caches
.
*
---------------------------------------------
*/
mov
x0
,
#
DCCISW
bl
dcsw_op_level1
ret
x18
endfunc
generic_core_pwr_dwn
func
generic_cluster_pwr_dwn
mov
x18
,
x30
/
*
---------------------------------------------
*
Turn
off
caches
.
*
---------------------------------------------
*/
bl
generic_disable_dcache
/
*
---------------------------------------------
*
Flush
L1
caches
.
*
---------------------------------------------
*/
mov
x0
,
#
DCCISW
bl
dcsw_op_level1
/
*
---------------------------------------------
*
Disable
the
optional
ACP
.
*
---------------------------------------------
*/
bl
plat_disable_acp
/
*
---------------------------------------------
*
Flush
L2
caches
.
*
---------------------------------------------
*/
mov
x0
,
#
DCCISW
bl
dcsw_op_level2
ret
x18
endfunc
generic_cluster_pwr_dwn
/*
---------------------------------------------
*
Unimplemented
functions
.
*
---------------------------------------------
*/
.
equ
generic_errata_report
,
0
.
equ
generic_cpu_reg_dump
,
0
.
equ
generic_reset_func
,
0
declare_cpu_ops
generic
,
AARCH64_GENERIC_MIDR
,
\
generic_reset_func
,
\
generic_core_pwr_dwn
,
\
generic_cluster_pwr_dwn
plat/arm/board/arm_fpga/platform.mk
View file @
478fc4f2
#
# Copyright (c) 2020, A
RM
Limited
and Contributors
. All rights reserved.
# Copyright (c) 2020, A
rm
Limited. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
...
...
@@ -40,6 +40,8 @@ HW_ASSISTED_COHERENCY := 1
PL011_GENERIC_UART
:=
1
SUPPORT_UNKNOWN_MPID
?=
1
FPGA_CPU_LIBS
:=
lib/cpus/
${ARCH}
/aem_generic.S
# select a different set of CPU files, depending on whether we compile for
...
...
@@ -71,6 +73,12 @@ else
lib/cpus/aarch64/cortex_a75.S
endif
ifeq
(${SUPPORT_UNKNOWN_MPID}, 1)
# Add support for unknown/invalid MPIDs (aarch64 only)
$(eval
$(call
add_define,SUPPORT_UNKNOWN_MPID))
FPGA_CPU_LIBS
+=
lib/cpus/aarch64/generic.S
endif
# Allow detection of GIC-600
GICV3_SUPPORT_GIC600
:=
1
...
...
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