]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
plat/common: move arch-agnostic fallback functions to C file
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Thu, 1 Feb 2018 09:42:24 +0000 (18:42 +0900)
committerMasahiro Yamada <yamada.masahiro@socionext.com>
Thu, 1 Feb 2018 15:18:54 +0000 (00:18 +0900)
When we add a new callback, we need to duplicate fallbacks among
plat/common/{aarch32,aarch64}/platform_helpers.S  This is tedious.

I created a new C file, then moved 3 functions:
  plat_error_handler
  bl2_plat_preload_setup
  plat_try_next_boot_source

They are called from C, so I do not see a good reason to implement
them in assembly.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Makefile
plat/common/aarch32/platform_helpers.S
plat/common/aarch64/platform_helpers.S
plat/common/platform_helpers_default.c [new file with mode: 0644]

index e32ba1933eaee029297b66508c1c5479805509c5..fab310bb0d5d58d9b9226ad939852e945785bee7 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -193,6 +193,7 @@ BL_COMMON_SOURCES   +=      common/bl_common.c                      \
                                lib/${ARCH}/cache_helpers.S             \
                                lib/${ARCH}/misc_helpers.S              \
                                plat/common/plat_log_common.c           \
+                               plat/common/platform_helpers_default.c  \
                                plat/common/${ARCH}/plat_common.c       \
                                plat/common/${ARCH}/platform_helpers.S  \
                                ${COMPILER_RT_SRCS}                     \
index 0a0e92714a4095ca8cb7e2ce78fa33c8ca13aa12..d61853942b077a643483bf8ab3737684f902b674 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2016-2018, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
        .weak   plat_disable_acp
        .weak   bl1_plat_prepare_exit
        .weak   platform_mem_init
-       .weak   plat_error_handler
        .weak   plat_panic_handler
-       .weak   bl2_plat_preload_setup
-       .weak   plat_try_next_boot_source
 
        /* -----------------------------------------------------
         * Placeholder function which should be redefined by
@@ -94,16 +91,6 @@ func bl1_plat_prepare_exit
        bx      lr
 endfunc bl1_plat_prepare_exit
 
-       /* -----------------------------------------------------
-        * void plat_error_handler(int err) __dead2;
-        * Endless loop by default.
-        * -----------------------------------------------------
-        */
-func plat_error_handler
-       wfi
-       b       plat_error_handler
-endfunc plat_error_handler
-
        /* -----------------------------------------------------
         * void plat_panic_handler(void) __dead2;
         * Endless loop by default.
@@ -112,23 +99,3 @@ endfunc plat_error_handler
 func plat_panic_handler
        b       plat_panic_handler
 endfunc plat_panic_handler
-
-
-       /* -----------------------------------------------------
-        * Placeholder function which should be redefined by
-        * each platfrom.
-        * -----------------------------------------------------
-        */
-func bl2_plat_preload_setup
-       bx      lr
-endfunc bl2_plat_preload_setup
-
-       /* -----------------------------------------------------
-        * Placeholder function which should be redefined by
-        * each platfrom.
-        * -----------------------------------------------------
-        */
-func plat_try_next_boot_source
-       mov     r0, #0
-       bx      lr
-endfunc plat_try_next_boot_source
index 852675277efae5c4c4c9ebb449ddc7a8deb8574c..033a12f8e94dccb923cac22191cf178ee07b69e9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2017, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
        .weak   plat_reset_handler
        .weak   plat_disable_acp
        .weak   bl1_plat_prepare_exit
-       .weak   plat_error_handler
        .weak   plat_panic_handler
-       .weak   bl2_plat_preload_setup
-       .weak   plat_try_next_boot_source
 
 #if !ENABLE_PLAT_COMPAT
        .globl  platform_get_core_pos
@@ -158,16 +155,6 @@ func bl1_plat_prepare_exit
        ret
 endfunc bl1_plat_prepare_exit
 
-       /* -----------------------------------------------------
-        * void plat_error_handler(int err) __dead2;
-        * Endless loop by default.
-        * -----------------------------------------------------
-        */
-func plat_error_handler
-       wfi
-       b       plat_error_handler
-endfunc plat_error_handler
-
        /* -----------------------------------------------------
         * void plat_panic_handler(void) __dead2;
         * Endless loop by default.
@@ -177,22 +164,3 @@ func plat_panic_handler
        wfi
        b       plat_panic_handler
 endfunc plat_panic_handler
-
-       /* -----------------------------------------------------
-        * Placeholder function which should be redefined by
-        * each platfrom.
-        * -----------------------------------------------------
-        */
-func bl2_plat_preload_setup
-       ret
-endfunc bl2_plat_preload_setup
-
-       /* -----------------------------------------------------
-        * Placeholder function which should be redefined by
-        * each platfrom.
-        * -----------------------------------------------------
-        */
-func plat_try_next_boot_source
-       mov     x0, #0
-       ret
-endfunc plat_try_next_boot_source
diff --git a/plat/common/platform_helpers_default.c b/plat/common/platform_helpers_default.c
new file mode 100644 (file)
index 0000000..75c5199
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2013-2018, ARM Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <arch_helpers.h>
+#include <platform.h>
+
+/*
+ * Placeholder functions which can be redefined by each platfrom.
+ */
+
+#pragma weak plat_error_handler
+#pragma weak bl2_plat_preload_setup
+#pragma weak plat_try_next_boot_source
+
+void __dead2 plat_error_handler(int err)
+{
+       while (1)
+               wfi();
+}
+
+void bl2_plat_preload_setup(void)
+{
+}
+
+int plat_try_next_boot_source(void)
+{
+       return 0;
+}