aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Nino Diaz <antonio.ninodiaz@arm.com>2018-10-15 09:03:43 +0100
committerAntonio Nino Diaz <antonio.ninodiaz@arm.com>2018-10-15 09:03:43 +0100
commit1cf45c96b2e87a60cbed25245c2319b2a391da1e (patch)
treef465e3b9880c99749c5e21beed70a0129e93d40c
parent2bfcf9ef94656ad4ceb5b58b9f0be7aae4f1b589 (diff)
downloadtf-a-tests-1cf45c96b2e87a60cbed25245c2319b2a391da1e.tar.gz
Move platform_helpers.S to each platform's folder
In practice, all the functions in this file are platform-specific. It is better to force all platforms to implement than having some sort of weak function placeholder. Porting guide updated. Change-Id: I5beeeb10bec6fe5178b24503d6da8ca66074a8c6 Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
-rw-r--r--docs/porting-guide.rst52
-rw-r--r--fwu/ns_bl1u/ns_bl1u.mk1
-rw-r--r--fwu/ns_bl2u/ns_bl2u.mk1
-rw-r--r--include/plat/common/platform.h12
-rw-r--r--plat/arm/board/fvp/aarch32/plat_helpers.S43
-rw-r--r--plat/arm/board/fvp/aarch64/plat_helpers.S43
-rw-r--r--plat/arm/board/fvp/platform.mk2
-rw-r--r--plat/arm/board/juno/aarch32/plat_helpers.S44
-rw-r--r--plat/arm/board/juno/aarch64/plat_helpers.S44
-rw-r--r--plat/common/aarch32/platform_helpers.S67
-rw-r--r--plat/common/aarch64/platform_helpers.S67
-rw-r--r--spm/cactus/cactus.mk1
-rw-r--r--tftf/framework/framework.mk1
13 files changed, 225 insertions, 153 deletions
diff --git a/docs/porting-guide.rst b/docs/porting-guide.rst
index 59d9dbad5..9c0812fb8 100644
--- a/docs/porting-guide.rst
+++ b/docs/porting-guide.rst
@@ -298,6 +298,47 @@ Function : plat_arm_gic_init() [mandatory]
This function initializes the ARM Generic Interrupt Controller (GIC).
+Function : platform_get_core_pos() [mandatory]
+``````````````````````````````````````````````
+
+::
+
+ Argument : u_register_t
+ Return : unsigned int
+
+This function returns a linear core ID from a MPID.
+
+Function : plat_crash_console_init() [mandatory]
+````````````````````````````````````````````````
+
+::
+
+ Argument : void
+ Return : int
+
+This function initializes a platform-specific console for crash reporting.
+
+Function : plat_crash_console_putc() [mandatory]
+````````````````````````````````````````````````
+
+::
+
+ Argument : int
+ Return : int
+
+This function prints a character on the platform-specific crash console.
+
+Function : plat_crash_console_flush() [mandatory]
+`````````````````````````````````````````````````
+
+::
+
+ Argument : void
+ Return : int
+
+This function waits until all the characters of the platform-specific crash
+console have been actually printed.
+
Optional modifications
----------------------
@@ -350,17 +391,6 @@ The default implementation uses the ARM watchdog peripheral (`SP805`_) to
generate a watchdog timeout interrupt. This interrupt remains deliberately
unserviced, which eventually asserts the reset signal.
-Function : tftf_platform_setup()
-````````````````````````````````
-
-::
-
- Argument : void
- Return : void
-
-Setup code for platform hardware. The default implementation initializes the IO
-and GIC.
-
Storage abstraction layer
-------------------------
diff --git a/fwu/ns_bl1u/ns_bl1u.mk b/fwu/ns_bl1u/ns_bl1u.mk
index 430ff5e19..0d7efcce0 100644
--- a/fwu/ns_bl1u/ns_bl1u.mk
+++ b/fwu/ns_bl1u/ns_bl1u.mk
@@ -47,7 +47,6 @@ NS_BL1U_SOURCES += drivers/io/io_fip.c \
lib/utils/uuid.c \
${XLAT_TABLES_LIB_SRCS} \
plat/arm/common/arm_fwu_io_storage.c \
- plat/common/${ARCH}/platform_helpers.S \
plat/common/${ARCH}/platform_up_stack.S \
plat/common/image_loader.c \
plat/common/plat_common.c
diff --git a/fwu/ns_bl2u/ns_bl2u.mk b/fwu/ns_bl2u/ns_bl2u.mk
index e4c93a1d4..0605c3c2d 100644
--- a/fwu/ns_bl2u/ns_bl2u.mk
+++ b/fwu/ns_bl2u/ns_bl2u.mk
@@ -45,7 +45,6 @@ NS_BL2U_SOURCES += fwu/ns_bl2u/${ARCH}/ns_bl2u_entrypoint.S \
lib/utils/uuid.c \
${XLAT_TABLES_LIB_SRCS} \
plat/arm/common/arm_fwu_io_storage.c \
- plat/common/${ARCH}/platform_helpers.S \
plat/common/${ARCH}/platform_up_stack.S \
plat/common/fwu_nvm_accessors.c \
plat/common/plat_common.c \
diff --git a/include/plat/common/platform.h b/include/plat/common/platform.h
index d3a486c0a..3f452ad58 100644
--- a/include/plat/common/platform.h
+++ b/include/plat/common/platform.h
@@ -56,6 +56,14 @@ void tftf_platform_end(void);
void tftf_platform_watchdog_set(void);
void tftf_platform_watchdog_reset(void);
+/* Helper that returns a linear core ID from a MPID */
+unsigned int platform_get_core_pos(u_register_t mpid);
+
+/* Crash console functions */
+int plat_crash_console_init(void);
+int plat_crash_console_putc(int c);
+int plat_crash_console_flush(void);
+
/* Gets a handle for the initialised IO entity */
void plat_get_nvm_handle(uintptr_t *handle);
@@ -153,11 +161,7 @@ typedef struct mem_region mem_region_t;
* Optional functions. A default, weak implementation of those functions is
* provided, it may be overridden by platform code.
******************************************************************************/
-unsigned int platform_get_core_pos(unsigned long mpid);
unsigned long platform_get_stack(unsigned long mpidr);
-int plat_crash_console_init(void);
-int plat_crash_console_putc(int c);
-int plat_crash_console_flush(void);
/*
* plat_get_prot_regions: It returns a pointer to a
* set of regions used to test mem_protect_check.
diff --git a/plat/arm/board/fvp/aarch32/plat_helpers.S b/plat/arm/board/fvp/aarch32/plat_helpers.S
index 2dcc6e9e4..1d923ad68 100644
--- a/plat/arm/board/fvp/aarch32/plat_helpers.S
+++ b/plat/arm/board/fvp/aarch32/plat_helpers.S
@@ -6,9 +6,13 @@
#include <arch.h>
#include <asm_macros.S>
+#include <pl011.h>
#include "../fvp_def.h"
.globl platform_get_core_pos
+ .globl plat_crash_console_init
+ .globl plat_crash_console_putc
+ .globl plat_crash_console_flush
/*----------------------------------------------------------------------
* unsigned int platform_get_core_pos(unsigned long mpid)
@@ -47,3 +51,42 @@ func platform_get_core_pos
bx lr
endfunc platform_get_core_pos
+
+ /* ---------------------------------------------
+ * int plat_crash_console_init(void)
+ * Function to initialize the crash console
+ * without a C Runtime to print crash report.
+ * Clobber list : x0 - x4
+ * ---------------------------------------------
+ */
+func plat_crash_console_init
+ ldr r0, =PLAT_ARM_UART_BASE
+ ldr r1, =PLAT_ARM_UART_CLK_IN_HZ
+ ldr r2, =PL011_BAUDRATE
+ b console_core_init
+endfunc plat_crash_console_init
+
+ /* ---------------------------------------------
+ * int plat_crash_console_putc(int c)
+ * Function to print a character on the crash
+ * console without a C Runtime.
+ * Clobber list : x1, x2
+ * ---------------------------------------------
+ */
+func plat_crash_console_putc
+ ldr r1, =PLAT_ARM_UART_BASE
+ b console_core_putc
+endfunc plat_crash_console_putc
+
+ /* ---------------------------------------------
+ * int plat_crash_console_flush()
+ * Function to force a write of all buffered
+ * data that hasn't been output.
+ * Out : return -1 on error else return 0.
+ * Clobber list : r0 - r1
+ * ---------------------------------------------
+ */
+func plat_crash_console_flush
+ ldr r1, =PLAT_ARM_UART_BASE
+ b console_core_flush
+endfunc plat_crash_console_flush
diff --git a/plat/arm/board/fvp/aarch64/plat_helpers.S b/plat/arm/board/fvp/aarch64/plat_helpers.S
index bc9f60d39..4bd9f3d67 100644
--- a/plat/arm/board/fvp/aarch64/plat_helpers.S
+++ b/plat/arm/board/fvp/aarch64/plat_helpers.S
@@ -6,9 +6,13 @@
#include <arch.h>
#include <asm_macros.S>
+#include <pl011.h>
#include "../fvp_def.h"
.globl platform_get_core_pos
+ .globl plat_crash_console_init
+ .globl plat_crash_console_putc
+ .globl plat_crash_console_flush
/*----------------------------------------------------------------------
* unsigned int platform_get_core_pos(unsigned long mpid)
@@ -46,3 +50,42 @@ func platform_get_core_pos
madd x0, x1, x3, x0
ret
endfunc platform_get_core_pos
+
+ /* ---------------------------------------------
+ * int plat_crash_console_init(void)
+ * Function to initialize the crash console
+ * without a C Runtime to print crash report.
+ * Clobber list : x0 - x4
+ * ---------------------------------------------
+ */
+func plat_crash_console_init
+ mov_imm x0, PLAT_ARM_UART_BASE
+ mov_imm x1, PLAT_ARM_UART_CLK_IN_HZ
+ mov_imm x2, PL011_BAUDRATE
+ b console_core_init
+endfunc plat_crash_console_init
+
+ /* ---------------------------------------------
+ * int plat_crash_console_putc(int c)
+ * Function to print a character on the crash
+ * console without a C Runtime.
+ * Clobber list : x1, x2
+ * ---------------------------------------------
+ */
+func plat_crash_console_putc
+ mov_imm x1, PLAT_ARM_UART_BASE
+ b console_core_putc
+endfunc plat_crash_console_putc
+
+ /* ---------------------------------------------
+ * int plat_crash_console_flush()
+ * Function to force a write of all buffered
+ * data that hasn't been output.
+ * Out : return -1 on error else return 0.
+ * Clobber list : r0 - r1
+ * ---------------------------------------------
+ */
+func plat_crash_console_flush
+ mov_imm x1, PLAT_ARM_UART_BASE
+ b console_core_flush
+endfunc plat_crash_console_flush
diff --git a/plat/arm/board/fvp/platform.mk b/plat/arm/board/fvp/platform.mk
index 281a5f30c..2326bded4 100644
--- a/plat/arm/board/fvp/platform.mk
+++ b/plat/arm/board/fvp/platform.mk
@@ -20,6 +20,8 @@ PLAT_SOURCES := drivers/arm/gic/arm_gic_v2v3.c \
plat/arm/board/fvp/fvp_mem_prot.c \
plat/arm/board/fvp/plat_setup.c
+CACTUS_SOURCES += plat/arm/board/fvp/${ARCH}/plat_helpers.S
+
# Firmware update is implemented on FVP.
FIRMWARE_UPDATE := 1
diff --git a/plat/arm/board/juno/aarch32/plat_helpers.S b/plat/arm/board/juno/aarch32/plat_helpers.S
index 6f252c00c..99fedb485 100644
--- a/plat/arm/board/juno/aarch32/plat_helpers.S
+++ b/plat/arm/board/juno/aarch32/plat_helpers.S
@@ -6,8 +6,13 @@
#include <arch.h>
#include <asm_macros.S>
+#include <pl011.h>
+#include "../juno_def.h"
.globl platform_get_core_pos
+ .globl plat_crash_console_init
+ .globl plat_crash_console_putc
+ .globl plat_crash_console_flush
/*
* Return 0 to 3 for the Cortex-A53 cores and 4 to 5 for the Cortex-A57
@@ -21,3 +26,42 @@ func platform_get_core_pos
add r0, r1, r0, LSR #6
bx lr
endfunc platform_get_core_pos
+
+ /* ---------------------------------------------
+ * int plat_crash_console_init(void)
+ * Function to initialize the crash console
+ * without a C Runtime to print crash report.
+ * Clobber list : x0 - x4
+ * ---------------------------------------------
+ */
+func plat_crash_console_init
+ ldr r0, =PLAT_ARM_UART_BASE
+ ldr r1, =PLAT_ARM_UART_CLK_IN_HZ
+ ldr r2, =PL011_BAUDRATE
+ b console_core_init
+endfunc plat_crash_console_init
+
+ /* ---------------------------------------------
+ * int plat_crash_console_putc(int c)
+ * Function to print a character on the crash
+ * console without a C Runtime.
+ * Clobber list : x1, x2
+ * ---------------------------------------------
+ */
+func plat_crash_console_putc
+ ldr r1, =PLAT_ARM_UART_BASE
+ b console_core_putc
+endfunc plat_crash_console_putc
+
+ /* ---------------------------------------------
+ * int plat_crash_console_flush()
+ * Function to force a write of all buffered
+ * data that hasn't been output.
+ * Out : return -1 on error else return 0.
+ * Clobber list : r0 - r1
+ * ---------------------------------------------
+ */
+func plat_crash_console_flush
+ ldr r1, =PLAT_ARM_UART_BASE
+ b console_core_flush
+endfunc plat_crash_console_flush
diff --git a/plat/arm/board/juno/aarch64/plat_helpers.S b/plat/arm/board/juno/aarch64/plat_helpers.S
index c51a4d98e..1efee4fbd 100644
--- a/plat/arm/board/juno/aarch64/plat_helpers.S
+++ b/plat/arm/board/juno/aarch64/plat_helpers.S
@@ -6,8 +6,13 @@
#include <arch.h>
#include <asm_macros.S>
+#include <pl011.h>
+#include "../juno_def.h"
.globl platform_get_core_pos
+ .globl plat_crash_console_init
+ .globl plat_crash_console_putc
+ .globl plat_crash_console_flush
/*
* Return 0 to 3 for the Cortex-A53 cores and 4 to 5 for the Cortex-A57
@@ -21,3 +26,42 @@ func platform_get_core_pos
add x0, x1, x0, LSR #6
ret
endfunc platform_get_core_pos
+
+ /* ---------------------------------------------
+ * int plat_crash_console_init(void)
+ * Function to initialize the crash console
+ * without a C Runtime to print crash report.
+ * Clobber list : x0 - x4
+ * ---------------------------------------------
+ */
+func plat_crash_console_init
+ mov_imm x0, PLAT_ARM_UART_BASE
+ mov_imm x1, PLAT_ARM_UART_CLK_IN_HZ
+ mov_imm x2, PL011_BAUDRATE
+ b console_core_init
+endfunc plat_crash_console_init
+
+ /* ---------------------------------------------
+ * int plat_crash_console_putc(int c)
+ * Function to print a character on the crash
+ * console without a C Runtime.
+ * Clobber list : x1, x2
+ * ---------------------------------------------
+ */
+func plat_crash_console_putc
+ mov_imm x1, PLAT_ARM_UART_BASE
+ b console_core_putc
+endfunc plat_crash_console_putc
+
+ /* ---------------------------------------------
+ * int plat_crash_console_flush()
+ * Function to force a write of all buffered
+ * data that hasn't been output.
+ * Out : return -1 on error else return 0.
+ * Clobber list : r0 - r1
+ * ---------------------------------------------
+ */
+func plat_crash_console_flush
+ mov_imm x1, PLAT_ARM_UART_BASE
+ b console_core_flush
+endfunc plat_crash_console_flush
diff --git a/plat/common/aarch32/platform_helpers.S b/plat/common/aarch32/platform_helpers.S
deleted file mode 100644
index 1a5741868..000000000
--- a/plat/common/aarch32/platform_helpers.S
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#include <arch.h>
-#include <asm_macros.S>
-#include <pl011.h>
-#include <platform_def.h>
-
- .weak platform_get_core_pos
- .weak plat_crash_console_init
- .weak plat_crash_console_putc
- .weak plat_crash_console_flush
-
- /* -----------------------------------------------------
- * int platform_get_core_pos(u_register_t mpidr);
- * With this function: CorePos = (ClusterId * 4) +
- * CoreId
- * -----------------------------------------------------
- */
-func platform_get_core_pos
- and r1, r0, #MPIDR_CPU_MASK
- and r0, r0, #MPIDR_CLUSTER_MASK
- add r0, r1, r0, LSR #6
- bx lr
-endfunc platform_get_core_pos
-
- /* ---------------------------------------------
- * int plat_crash_console_init(void)
- * Function to initialize the crash console
- * without a C Runtime to print crash report.
- * Clobber list : x0 - x4
- * ---------------------------------------------
- */
-func plat_crash_console_init
- ldr r0, =PLAT_ARM_UART_BASE
- ldr r1, =PLAT_ARM_UART_CLK_IN_HZ
- ldr r2, =PL011_BAUDRATE
- b console_core_init
-endfunc plat_crash_console_init
-
- /* ---------------------------------------------
- * int plat_crash_console_putc(int c)
- * Function to print a character on the crash
- * console without a C Runtime.
- * Clobber list : x1, x2
- * ---------------------------------------------
- */
-func plat_crash_console_putc
- ldr r1, =PLAT_ARM_UART_BASE
- b console_core_putc
-endfunc plat_crash_console_putc
-
- /* ---------------------------------------------
- * int plat_crash_console_flush()
- * Function to force a write of all buffered
- * data that hasn't been output.
- * Out : return -1 on error else return 0.
- * Clobber list : r0 - r1
- * ---------------------------------------------
- */
-func plat_crash_console_flush
- ldr r1, =PLAT_ARM_UART_BASE
- b console_core_flush
-endfunc plat_crash_console_flush
diff --git a/plat/common/aarch64/platform_helpers.S b/plat/common/aarch64/platform_helpers.S
deleted file mode 100644
index 216163872..000000000
--- a/plat/common/aarch64/platform_helpers.S
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2018, Arm Limited. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#include <arch.h>
-#include <asm_macros.S>
-#include <pl011.h>
-#include <platform_def.h>
-
- .weak platform_get_core_pos
- .weak plat_crash_console_init
- .weak plat_crash_console_putc
- .weak plat_crash_console_flush
-
- /* -----------------------------------------------------
- * int platform_get_core_pos(int mpidr);
- * With this function: CorePos = (ClusterId * 4) +
- * CoreId
- * -----------------------------------------------------
- */
-func platform_get_core_pos
- and x1, x0, #MPIDR_CPU_MASK
- and x0, x0, #MPIDR_CLUSTER_MASK
- add x0, x1, x0, LSR #6
- ret
-endfunc platform_get_core_pos
-
- /* ---------------------------------------------
- * int plat_crash_console_init(void)
- * Function to initialize the crash console
- * without a C Runtime to print crash report.
- * Clobber list : x0 - x4
- * ---------------------------------------------
- */
-func plat_crash_console_init
- mov_imm x0, PLAT_ARM_UART_BASE
- mov_imm x1, PLAT_ARM_UART_CLK_IN_HZ
- mov_imm x2, PL011_BAUDRATE
- b console_core_init
-endfunc plat_crash_console_init
-
- /* ---------------------------------------------
- * int plat_crash_console_putc(int c)
- * Function to print a character on the crash
- * console without a C Runtime.
- * Clobber list : x1, x2
- * ---------------------------------------------
- */
-func plat_crash_console_putc
- mov_imm x1, PLAT_ARM_UART_BASE
- b console_core_putc
-endfunc plat_crash_console_putc
-
- /* ---------------------------------------------
- * int plat_crash_console_flush()
- * Function to force a write of all buffered
- * data that hasn't been output.
- * Out : return -1 on error else return 0.
- * Clobber list : r0 - r1
- * ---------------------------------------------
- */
-func plat_crash_console_flush
- mov_imm x1, PLAT_ARM_UART_BASE
- b console_core_flush
-endfunc plat_crash_console_flush
diff --git a/spm/cactus/cactus.mk b/spm/cactus/cactus.mk
index f7794db7d..6f912e729 100644
--- a/spm/cactus/cactus.mk
+++ b/spm/cactus/cactus.mk
@@ -53,7 +53,6 @@ CACTUS_SOURCES += \
CACTUS_SOURCES += drivers/arm/pl011/${ARCH}/pl011_console.S \
lib/${ARCH}/cache_helpers.S \
lib/${ARCH}/misc_helpers.S \
- plat/common/${ARCH}/platform_helpers.S \
${STDLIB_SOURCES}
CACTUS_LINKERFILE := spm/cactus/cactus.ld.S
diff --git a/tftf/framework/framework.mk b/tftf/framework/framework.mk
index f6e1d7b61..7d0070416 100644
--- a/tftf/framework/framework.mk
+++ b/tftf/framework/framework.mk
@@ -80,7 +80,6 @@ FRAMEWORK_SOURCES += \
lib/utils/mp_printf.c \
lib/utils/uuid.c \
${XLAT_TABLES_LIB_SRCS} \
- plat/common/${ARCH}/platform_helpers.S \
plat/common/${ARCH}/platform_mp_stack.S \
plat/common/plat_common.c \
plat/common/plat_state_id.c \