From 24fb838f965cc1250831cd021d6a18b0d371b853 Mon Sep 17 00:00:00 2001 From: Soby Mathew <soby.mathew@arm.com> Date: Thu, 14 Aug 2014 12:22:32 +0100 Subject: [PATCH] Add platform API for reset handling This patch adds an optional platform API (plat_reset_handler) which allows the platform to perform any actions immediately after a cold or warm reset e.g. implement errata workarounds. The function is called with MMU and caches turned off. This API is weakly defined and does nothing by default but can be overriden by a platform with a strong definition. Change-Id: Ib0acdccbd24bc756528a8bd647df21e8d59707ff --- docs/porting-guide.md | 14 ++++++++++++++ lib/cpus/aarch64/cpu_helpers.S | 3 +++ plat/common/aarch64/platform_helpers.S | 9 +++++++++ 3 files changed, 26 insertions(+) diff --git a/docs/porting-guide.md b/docs/porting-guide.md index 62ea6a0c17..262de73e7b 100644 --- a/docs/porting-guide.md +++ b/docs/porting-guide.md @@ -460,6 +460,20 @@ that these constants are not related to any architectural exception code; they are just an ARM Trusted Firmware convention. +### Function : plat_reset_handler() + + Argument : void + Return : void + +A platform may need to do additional initialization after reset. This function +allows the platform to do the platform specific intializations. Platform +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 +return address. + +The default implementation doesn't do anything. + + 3. Modifications specific to a Boot Loader stage ------------------------------------------------- diff --git a/lib/cpus/aarch64/cpu_helpers.S b/lib/cpus/aarch64/cpu_helpers.S index d25d1a30ea..6db04ed92d 100644 --- a/lib/cpus/aarch64/cpu_helpers.S +++ b/lib/cpus/aarch64/cpu_helpers.S @@ -47,6 +47,8 @@ func reset_handler mov x10, x30 + bl plat_reset_handler + /* Get the matching cpu_ops pointer */ bl get_cpu_ops_ptr #if ASM_ASSERTION @@ -60,6 +62,7 @@ func reset_handler blr x2 1: ret x10 + #endif /* IMAGE_BL1 || (IMAGE_BL31 && RESET_TO_BL31) */ /* diff --git a/plat/common/aarch64/platform_helpers.S b/plat/common/aarch64/platform_helpers.S index 6dc4ec681f..1229ead34a 100644 --- a/plat/common/aarch64/platform_helpers.S +++ b/plat/common/aarch64/platform_helpers.S @@ -38,6 +38,7 @@ .weak plat_report_exception .weak plat_crash_console_init .weak plat_crash_console_putc + .weak plat_reset_handler /* ----------------------------------------------------- * int platform_get_core_pos(int mpidr); @@ -84,3 +85,11 @@ func plat_crash_console_init */ func plat_crash_console_putc ret + + /* ----------------------------------------------------- + * Placeholder function which should be redefined by + * each platform. This function should preserve x10. + * ----------------------------------------------------- + */ +func plat_reset_handler + ret -- GitLab