[Skiboot] [PATCH 1/3] core/platform: Add finalise_dt() callback

Oliver O'Halloran oohall at gmail.com
Thu Jul 11 17:41:42 AEST 2019


Previously the platform.exit() callback was called before we created the
flattened device tree blob for Linux. Some platforms used this to add
various DT properties and this was broken in commit Fixes: 9fc0c1287ada
("Move FSP specific op-panel calls to platform.exit()") which moved the
exit callback to after the DTB had been created.

The logic for moving the time of the exit call makes some sense since we
want to terminate the IPMI watchdog timer as late as possible, but we
still need a way for the platform modify the DTB as late as possible.

This patch adds another platform callback (yay!) called finalise_dt()
which can be used to graft stuff into the DT.

Suggested-by: Vaidyanathan Srinivasan <svaidy at linux.ibm.com>
Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
---
 core/init.c        | 3 +++
 include/platform.h | 6 ++++++
 2 files changed, 9 insertions(+)

diff --git a/core/init.c b/core/init.c
index d0f28f26d400..271736be8325 100644
--- a/core/init.c
+++ b/core/init.c
@@ -579,6 +579,9 @@ void __noreturn load_and_boot_kernel(bool is_reboot)
 
 	add_fast_reboot_dt_entries();
 
+	if (platform.finalise_dt)
+		platform.finalise_dt(is_reboot);
+
 	/* Create the device tree blob to boot OS. */
 	fdt = create_dtb(dt_root, false);
 	if (!fdt) {
diff --git a/include/platform.h b/include/platform.h
index 0326e1a247e4..da27c03ac363 100644
--- a/include/platform.h
+++ b/include/platform.h
@@ -252,8 +252,14 @@ struct platform {
 	 */
 	int		(*resource_loaded)(enum resource_id id, uint32_t idx);
 
+	/*
+	 * Executed just prior to creating the dtb for the kernel.
+	 */
+	void		(*finalise_dt)(bool is_reboot);
+
 	/*
 	 * Executed just prior to handing control over to the payload.
+	 * Used to terminate watchdogs, etc.
 	 */
 	void		(*exit)(void);
 
-- 
2.21.0



More information about the Skiboot mailing list