diff mbox

[v2,2/4] platform: Add exit platform hook

Message ID 1423026466-31386-3-git-send-email-alistair@popple.id.au
State Accepted
Headers show

Commit Message

Alistair Popple Feb. 4, 2015, 5:07 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(+)

Comments

Joel Stanley Feb. 5, 2015, 5:23 a.m. UTC | #1
On Wed, Feb 4, 2015 at 3:37 PM, Alistair Popple <alistair@popple.id.au> wrote:
> Add a platform hook that is called just prior to loading
> and running the payload.
>
> Signed-off-by: Alistair Popple <alistair@popple.id.au>

Reviewed-by: Joel Stanley <joel@jms.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;