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
937108a0
Commit
937108a0
authored
Aug 18, 2016
by
danh-arm
Committed by
GitHub
Aug 18, 2016
Browse files
Merge pull request #678 from soby-mathew/sm/PSCI_AArch32
Introduce AArch32 support for PSCI library
parents
974603b5
9d29c227
Changes
92
Hide whitespace changes
Inline
Side-by-side
plat/arm/common/sp_min/arm_sp_min_setup.c
0 → 100644
View file @
937108a0
/*
* Copyright (c) 2016, 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:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of ARM nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <assert.h>
#include <console.h>
#include <mmio.h>
#include <plat_arm.h>
#include <platform.h>
#include <platform_def.h>
#include <platform_sp_min.h>
#define BL32_END (uintptr_t)(&__BL32_END__)
#if USE_COHERENT_MEM
/*
* The next 2 constants identify the extents of the coherent memory region.
* These addresses are used by the MMU setup code and therefore they must be
* page-aligned. It is the responsibility of the linker script to ensure that
* __COHERENT_RAM_START__ and __COHERENT_RAM_END__ linker symbols refer to
* page-aligned addresses.
*/
#define BL32_COHERENT_RAM_BASE (uintptr_t)(&__COHERENT_RAM_START__)
#define BL32_COHERENT_RAM_LIMIT (uintptr_t)(&__COHERENT_RAM_END__)
#endif
static
entry_point_info_t
bl33_image_ep_info
;
/* Weak definitions may be overridden in specific ARM standard platform */
#pragma weak sp_min_early_platform_setup
#pragma weak sp_min_platform_setup
#pragma weak sp_min_plat_arch_setup
#ifndef RESET_TO_SP_MIN
#error (" RESET_TO_SP_MIN flag is expected to be set.")
#endif
/*******************************************************************************
* Return a pointer to the 'entry_point_info' structure of the next image for the
* security state specified. BL33 corresponds to the non-secure image type
* while BL32 corresponds to the secure image type. A NULL pointer is returned
* if the image does not exist.
******************************************************************************/
entry_point_info_t
*
sp_min_plat_get_bl33_ep_info
(
void
)
{
entry_point_info_t
*
next_image_info
;
next_image_info
=
&
bl33_image_ep_info
;
/*
* None of the images on the ARM development platforms can have 0x0
* as the entrypoint
*/
if
(
next_image_info
->
pc
)
return
next_image_info
;
else
return
NULL
;
}
/*******************************************************************************
* Perform early platform setup. We expect SP_MIN is the first boot loader
* image and RESET_TO_SP_MIN build option to be set.
******************************************************************************/
void
arm_sp_min_early_platform_setup
(
void
)
{
/* Initialize the console to provide early debug support */
console_init
(
PLAT_ARM_BOOT_UART_BASE
,
PLAT_ARM_BOOT_UART_CLK_IN_HZ
,
ARM_CONSOLE_BAUDRATE
);
/* Populate entry point information for BL33 */
SET_PARAM_HEAD
(
&
bl33_image_ep_info
,
PARAM_EP
,
VERSION_1
,
0
);
/*
* Tell SP_MIN where the non-trusted software image
* is located and the entry state information
*/
#ifdef PRELOADED_BL33_BASE
bl33_image_ep_info
.
pc
=
PRELOADED_BL33_BASE
;
#else
bl33_image_ep_info
.
pc
=
plat_get_ns_image_entrypoint
();
#endif
bl33_image_ep_info
.
spsr
=
arm_get_spsr_for_bl33_entry
();
SET_SECURITY_STATE
(
bl33_image_ep_info
.
h
.
attr
,
NON_SECURE
);
}
void
sp_min_early_platform_setup
(
void
)
{
arm_sp_min_early_platform_setup
();
/*
* Initialize Interconnect for this cluster during cold boot.
* No need for locks as no other CPU is active.
*/
plat_arm_interconnect_init
();
/*
* Enable Interconnect coherency for the primary CPU's cluster.
* Earlier bootloader stages might already do this (e.g. Trusted
* Firmware's BL1 does it) but we can't assume so. There is no harm in
* executing this code twice anyway.
* Platform specific PSCI code will enable coherency for other
* clusters.
*/
plat_arm_interconnect_enter_coherency
();
}
/*******************************************************************************
* Perform platform specific setup for SP_MIN
******************************************************************************/
void
sp_min_platform_setup
(
void
)
{
/* Initialize the GIC driver, cpu and distributor interfaces */
plat_arm_gic_driver_init
();
plat_arm_gic_init
();
/*
* Do initial security configuration to allow DRAM/device access
* (if earlier BL has not already done so).
* TODO: If RESET_TO_SP_MIN is not set, the security setup needs
* to be skipped.
*/
plat_arm_security_setup
();
/* Enable and initialize the System level generic timer */
mmio_write_32
(
ARM_SYS_CNTCTL_BASE
+
CNTCR_OFF
,
CNTCR_FCREQ
(
0
)
|
CNTCR_EN
);
/* Allow access to the System counter timer module */
arm_configure_sys_timer
();
/* Initialize power controller before setting up topology */
plat_arm_pwrc_setup
();
}
/*******************************************************************************
* Perform the very early platform specific architectural setup here. At the
* moment this only initializes the MMU
******************************************************************************/
void
sp_min_plat_arch_setup
(
void
)
{
arm_setup_page_tables
(
BL32_BASE
,
(
BL32_END
-
BL32_BASE
),
BL_CODE_BASE
,
BL_CODE_LIMIT
,
BL_RO_DATA_BASE
,
BL_RO_DATA_LIMIT
#if USE_COHERENT_MEM
,
BL32_COHERENT_RAM_BASE
,
BL32_COHERENT_RAM_LIMIT
#endif
);
enable_mmu_secure
(
0
);
}
plat/common/aarch32/plat_common.c
0 → 100644
View file @
937108a0
/*
* Copyright (c) 2016, 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:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of ARM nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <platform.h>
#include <xlat_tables.h>
/*
* The following platform setup functions are weakly defined. They
* provide typical implementations that may be re-used by multiple
* platforms but may also be overridden by a platform if required.
*/
#pragma weak bl32_plat_enable_mmu
void
bl32_plat_enable_mmu
(
uint32_t
flags
)
{
enable_mmu_secure
(
flags
);
}
plat/common/aarch32/platform_helpers.S
0 → 100644
View file @
937108a0
/*
*
Copyright
(
c
)
2016
,
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
:
*
*
Redistributions
of
source
code
must
retain
the
above
copyright
notice
,
this
*
list
of
conditions
and
the
following
disclaimer
.
*
*
Redistributions
in
binary
form
must
reproduce
the
above
copyright
notice
,
*
this
list
of
conditions
and
the
following
disclaimer
in
the
documentation
*
and
/
or
other
materials
provided
with
the
distribution
.
*
*
Neither
the
name
of
ARM
nor
the
names
of
its
contributors
may
be
used
*
to
endorse
or
promote
products
derived
from
this
software
without
specific
*
prior
written
permission
.
*
*
THIS
SOFTWARE
IS
PROVIDED
BY
THE
COPYRIGHT
HOLDERS
AND
CONTRIBUTORS
"AS IS"
*
AND
ANY
EXPRESS
OR
IMPLIED
WARRANTIES
,
INCLUDING
,
BUT
NOT
LIMITED
TO
,
THE
*
IMPLIED
WARRANTIES
OF
MERCHANTABILITY
AND
FITNESS
FOR
A
PARTICULAR
PURPOSE
*
ARE
DISCLAIMED
.
IN
NO
EVENT
SHALL
THE
COPYRIGHT
HOLDER
OR
CONTRIBUTORS
BE
*
LIABLE
FOR
ANY
DIRECT
,
INDIRECT
,
INCIDENTAL
,
SPECIAL
,
EXEMPLARY
,
OR
*
CONSEQUENTIAL
DAMAGES
(
INCLUDING
,
BUT
NOT
LIMITED
TO
,
PROCUREMENT
OF
*
SUBSTITUTE
GOODS
OR
SERVICES
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
*
INTERRUPTION
)
HOWEVER
CAUSED
AND
ON
ANY
THEORY
OF
LIABILITY
,
WHETHER
IN
*
CONTRACT
,
STRICT
LIABILITY
,
OR
TORT
(
INCLUDING
NEGLIGENCE
OR
OTHERWISE
)
*
ARISING
IN
ANY
WAY
OUT
OF
THE
USE
OF
THIS
SOFTWARE
,
EVEN
IF
ADVISED
OF
THE
*
POSSIBILITY
OF
SUCH
DAMAGE
.
*/
#include <arch.h>
#include <asm_macros.S>
.
weak
plat_my_core_pos
.
weak
plat_reset_handler
.
weak
platform_mem_init
.
weak
plat_panic_handler
/
*
-----------------------------------------------------
*
int
plat_my_core_pos
(
void
)
;
*
With
this
function
:
CorePos
=
(
ClusterId
*
4
)
+
*
CoreId
*
-----------------------------------------------------
*/
func
plat_my_core_pos
ldcopr
r0
,
MPIDR
and
r1
,
r0
,
#
MPIDR_CPU_MASK
and
r0
,
r0
,
#
MPIDR_CLUSTER_MASK
add
r0
,
r1
,
r0
,
LSR
#
6
bx
lr
endfunc
plat_my_core_pos
/
*
-----------------------------------------------------
*
Placeholder
function
which
should
be
redefined
by
*
each
platform
.
*
-----------------------------------------------------
*/
func
plat_reset_handler
bx
lr
endfunc
plat_reset_handler
/
*
---------------------------------------------------------------------
*
Placeholder
function
which
should
be
redefined
by
*
each
platform
.
*
---------------------------------------------------------------------
*/
func
platform_mem_init
bx
lr
endfunc
platform_mem_init
/
*
-----------------------------------------------------
*
void
plat_panic_handler
(
void
)
__dead2
;
*
Endless
loop
by
default
.
*
-----------------------------------------------------
*/
func
plat_panic_handler
b
plat_panic_handler
endfunc
plat_panic_handler
plat/common/aarch32/platform_mp_stack.S
0 → 100644
View file @
937108a0
/*
*
Copyright
(
c
)
2016
,
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
:
*
*
Redistributions
of
source
code
must
retain
the
above
copyright
notice
,
this
*
list
of
conditions
and
the
following
disclaimer
.
*
*
Redistributions
in
binary
form
must
reproduce
the
above
copyright
notice
,
*
this
list
of
conditions
and
the
following
disclaimer
in
the
documentation
*
and
/
or
other
materials
provided
with
the
distribution
.
*
*
Neither
the
name
of
ARM
nor
the
names
of
its
contributors
may
be
used
*
to
endorse
or
promote
products
derived
from
this
software
without
specific
*
prior
written
permission
.
*
*
THIS
SOFTWARE
IS
PROVIDED
BY
THE
COPYRIGHT
HOLDERS
AND
CONTRIBUTORS
"AS IS"
*
AND
ANY
EXPRESS
OR
IMPLIED
WARRANTIES
,
INCLUDING
,
BUT
NOT
LIMITED
TO
,
THE
*
IMPLIED
WARRANTIES
OF
MERCHANTABILITY
AND
FITNESS
FOR
A
PARTICULAR
PURPOSE
*
ARE
DISCLAIMED
.
IN
NO
EVENT
SHALL
THE
COPYRIGHT
HOLDER
OR
CONTRIBUTORS
BE
*
LIABLE
FOR
ANY
DIRECT
,
INDIRECT
,
INCIDENTAL
,
SPECIAL
,
EXEMPLARY
,
OR
*
CONSEQUENTIAL
DAMAGES
(
INCLUDING
,
BUT
NOT
LIMITED
TO
,
PROCUREMENT
OF
*
SUBSTITUTE
GOODS
OR
SERVICES
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
*
INTERRUPTION
)
HOWEVER
CAUSED
AND
ON
ANY
THEORY
OF
LIABILITY
,
WHETHER
IN
*
CONTRACT
,
STRICT
LIABILITY
,
OR
TORT
(
INCLUDING
NEGLIGENCE
OR
OTHERWISE
)
*
ARISING
IN
ANY
WAY
OUT
OF
THE
USE
OF
THIS
SOFTWARE
,
EVEN
IF
ADVISED
OF
THE
*
POSSIBILITY
OF
SUCH
DAMAGE
.
*/
#include <arch.h>
#include <asm_macros.S>
#include <platform_def.h>
.
globl
plat_get_my_stack
.
globl
plat_set_my_stack
/
*
-----------------------------------------------------
*
uintptr_t
plat_get_my_stack
(
u_register_t
mpidr
)
*
*
For
a
given
CPU
,
this
function
returns
the
stack
*
pointer
for
a
stack
allocated
in
device
memory
.
*
-----------------------------------------------------
*/
func
plat_get_my_stack
mov
r3
,
lr
get_my_mp_stack
platform_normal_stacks
,
PLATFORM_STACK_SIZE
bx
r3
endfunc
plat_get_my_stack
/
*
-----------------------------------------------------
*
void
plat_set_my_stack
()
*
*
For
the
current
CPU
,
this
function
sets
the
stack
*
pointer
to
a
stack
allocated
in
normal
memory
.
*
-----------------------------------------------------
*/
func
plat_set_my_stack
mov
r3
,
lr
get_my_mp_stack
platform_normal_stacks
,
PLATFORM_STACK_SIZE
mov
sp
,
r0
bx
r3
endfunc
plat_set_my_stack
/
*
-----------------------------------------------------
*
Per
-
cpu
stacks
in
normal
memory
.
Each
cpu
gets
a
*
stack
of
PLATFORM_STACK_SIZE
bytes
.
*
-----------------------------------------------------
*/
declare_stack
platform_normal_stacks
,
tzfw_normal_stacks
,
\
PLATFORM_STACK_SIZE
,
PLATFORM_CORE_COUNT
plat/common/plat_gicv3.c
View file @
937108a0
/*
* Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
* Copyright (c) 2015
-2016
, 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:
...
...
@@ -186,6 +186,11 @@ uint32_t plat_interrupt_type_to_line(uint32_t type,
#pragma weak plat_ic_acknowledge_interrupt
#pragma weak plat_ic_end_of_interrupt
/* In AArch32, the secure group1 interrupts are targeted to Secure PL1 */
#ifdef AARCH32
#define IS_IN_EL1() IS_IN_SECURE()
#endif
/*
* This function returns the highest priority pending interrupt at
* the Interrupt controller
...
...
plat/compat/plat_compat.mk
View file @
937108a0
...
...
@@ -33,6 +33,9 @@ ifeq (${PSCI_EXTENDED_STATE_ID}, 1)
PSCI_EXTENDED_STATE_ID
is
not
set
")
endif
ifneq (${ARCH}, aarch64)
$(error "
PSCI
Compatibility
mode
is
only
supported
for
AArch64
platforms")
endif
PLAT_BL_COMMON_SOURCES
+=
plat/compat/aarch64/plat_helpers_compat.S
...
...
plat/mediatek/mt8173/platform.mk
View file @
937108a0
...
...
@@ -50,7 +50,7 @@ BL31_SOURCES += drivers/arm/cci/cci.c \
drivers/arm/gic/arm_gic.c
\
drivers/arm/gic/gic_v2.c
\
drivers/arm/gic/gic_v3.c
\
drivers/console/console.S
\
drivers/console/
aarch64/
console.S
\
drivers/delay_timer/delay_timer.c
\
drivers/delay_timer/generic_delay_timer.c
\
lib/cpus/aarch64/aem_generic.S
\
...
...
plat/nvidia/tegra/common/tegra_common.mk
View file @
937108a0
...
...
@@ -48,9 +48,9 @@ COMMON_DIR := plat/nvidia/tegra/common
BL31_SOURCES
+=
drivers/arm/gic/gic_v2.c
\
drivers/arm/gic/gic_v3.c
\
drivers/console/console.S
\
drivers/console/
aarch64/
console.S
\
drivers/delay_timer/delay_timer.c
\
drivers/ti/uart/16550_console.S
\
drivers/ti/uart/
aarch64/
16550_console.S
\
plat/common/aarch64/platform_mp_stack.S
\
plat/common/plat_psci_common.c
\
${COMMON_DIR}
/aarch64/tegra_helpers.S
\
...
...
plat/qemu/platform.mk
View file @
937108a0
...
...
@@ -37,7 +37,7 @@ PLAT_INCLUDES := -Iinclude/plat/arm/common/ \
PLAT_BL_COMMON_SOURCES
:=
plat/qemu/qemu_common.c
\
drivers/arm/pl011/pl011_console.S
\
drivers/arm/pl011/
aarch64/
pl011_console.S
\
lib/xlat_tables/xlat_tables_common.c
\
lib/xlat_tables/aarch64/xlat_tables.c
...
...
plat/rockchip/rk3368/platform.mk
View file @
937108a0
...
...
@@ -55,8 +55,8 @@ PLAT_BL_COMMON_SOURCES := lib/xlat_tables/xlat_tables_common.c \
BL31_SOURCES
+=
${RK_GIC_SOURCES}
\
drivers/arm/cci/cci.c
\
drivers/console/console.S
\
drivers/ti/uart/16550_console.S
\
drivers/console/
aarch64/
console.S
\
drivers/ti/uart/
aarch64/
16550_console.S
\
drivers/delay_timer/delay_timer.c
\
drivers/delay_timer/generic_delay_timer.c
\
lib/cpus/aarch64/cortex_a53.S
\
...
...
plat/rockchip/rk3399/platform.mk
View file @
937108a0
...
...
@@ -55,8 +55,8 @@ PLAT_BL_COMMON_SOURCES := lib/xlat_tables/xlat_tables_common.c \
BL31_SOURCES
+=
${RK_GIC_SOURCES}
\
drivers/arm/cci/cci.c
\
drivers/console/console.S
\
drivers/ti/uart/16550_console.S
\
drivers/console/
aarch64/
console.S
\
drivers/ti/uart/
aarch64/
16550_console.S
\
drivers/delay_timer/delay_timer.c
\
drivers/delay_timer/generic_delay_timer.c
\
drivers/gpio/gpio.c
\
...
...
plat/xilinx/zynqmp/platform.mk
View file @
937108a0
...
...
@@ -67,8 +67,8 @@ PLAT_BL_COMMON_SOURCES := lib/xlat_tables/xlat_tables_common.c \
drivers/arm/gic/common/gic_common.c
\
drivers/arm/gic/v2/gicv2_main.c
\
drivers/arm/gic/v2/gicv2_helpers.c
\
drivers/cadence/uart/cdns_console.S
\
drivers/console/console.S
\
drivers/cadence/uart/
aarch64/
cdns_console.S
\
drivers/console/
aarch64/
console.S
\
plat/arm/common/aarch64/arm_helpers.S
\
plat/arm/common/arm_cci.c
\
plat/arm/common/arm_common.c
\
...
...
Prev
1
2
3
4
5
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