diff mbox

[2/3] platform: Add exit platform hook

Message ID 1421122875-2963-2-git-send-email-alistair@popple.id.au
State Changes Requested
Headers show

Commit Message

Alistair Popple Jan. 13, 2015, 4:21 a.m. UTC
Add a platform hook that is called just prior to loading
and running the payload.

Signed-off-by: Alistair Popple <alistair@popple.id.au>
---
 core/init.c        | 3 +++
 include/platform.h | 5 +++++
 2 files changed, 8 insertions(+)
diff mbox

Patch

diff --git a/core/init.c b/core/init.c
index 2c7e30c..cffa638 100644
--- a/core/init.c
+++ b/core/init.c
@@ -345,6 +345,9 @@  void __noreturn load_and_boot_kernel(bool is_reboot)
 
 	op_display(OP_LOG, OP_MOD_INIT, 0x000A);
 
+	if (platform.exit)
+		platform.exit();
+
 	/* Load kernel LID */
 	if (!load_kernel()) {
 		op_display(OP_FATAL, OP_MOD_INIT, 1);
diff --git a/include/platform.h b/include/platform.h
index b1aef49..44e67ef 100644
--- a/include/platform.h
+++ b/include/platform.h
@@ -131,6 +131,11 @@  struct platform {
 	 */
 	bool		(*load_resource)(enum resource_id id,
 					 void *buf, size_t *len);
+
+	/*
+	 * Executed just prior to handing control over to the payload.
+	 */
+	void		(*exit)(void);
 };
 
 extern struct platform __platforms_start;