[Skiboot] [PATCH 2/4] platform: Add platform hook for terminate call

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Thu Aug 20 17:03:32 AEST 2015


Current abort() call works fine on FSP based system. We need different
mechanism on BMC based machine. Hence introduce platform hook for
terminate call.

Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
---
 core/utils.c                | 4 +++-
 include/platform.h          | 2 ++
 platforms/ibm-fsp/apollo.c  | 1 +
 platforms/ibm-fsp/firenze.c | 1 +
 4 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/core/utils.c b/core/utils.c
index df9a815..5d86ed0 100644
--- a/core/utils.c
+++ b/core/utils.c
@@ -17,6 +17,7 @@
 #include <skiboot.h>
 #include <lock.h>
 #include <fsp.h>
+#include <platform.h>
 #include <processor.h>
 #include <cpu.h>
 #include <stack.h>
@@ -40,7 +41,8 @@ void __noreturn _abort(const char *msg)
 	prlog(PR_EMERG, "Aborting!\n");
 	backtrace();
 
-	ibm_fsp_terminate(msg);
+	if (platform.terminate)
+		platform.terminate(msg);
 
 	for (;;) ;
 }
diff --git a/include/platform.h b/include/platform.h
index 80aa8ba..87bf39f 100644
--- a/include/platform.h
+++ b/include/platform.h
@@ -158,6 +158,8 @@ struct platform {
 	 */
 	int64_t		(*sensor_read)(uint32_t sensor_hndl, int token,
 				       uint32_t *sensor_data);
+
+	void __attribute__((noreturn)) (*terminate)(const char *msg);
 };
 
 extern struct platform __platforms_start;
diff --git a/platforms/ibm-fsp/apollo.c b/platforms/ibm-fsp/apollo.c
index be7e6cc..e9616d5 100644
--- a/platforms/ibm-fsp/apollo.c
+++ b/platforms/ibm-fsp/apollo.c
@@ -63,4 +63,5 @@ DECLARE_PLATFORM(apollo) = {
 	.start_preload_resource	= fsp_start_preload_resource,
 	.resource_loaded	= fsp_resource_loaded,
 	.sensor_read		= ibm_fsp_sensor_read,
+	.terminate		= ibm_fsp_terminate,
 };
diff --git a/platforms/ibm-fsp/firenze.c b/platforms/ibm-fsp/firenze.c
index 507841d..2da098f 100644
--- a/platforms/ibm-fsp/firenze.c
+++ b/platforms/ibm-fsp/firenze.c
@@ -556,4 +556,5 @@ DECLARE_PLATFORM(firenze) = {
 	.start_preload_resource	= fsp_start_preload_resource,
 	.resource_loaded	= fsp_resource_loaded,
 	.sensor_read		= ibm_fsp_sensor_read,
+	.terminate		= ibm_fsp_terminate,
 } ;
-- 
2.1.0



More information about the Skiboot mailing list