[PATCH 1/4] handoff_data: add handoff_data_add_dt()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Factor out a handoff_data_add_dt() from the existing ARM code in case a
board wants to set the fdt directly in board code rather than passing it
in the boarddata pointer.

Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
 arch/arm/cpu/uncompress.c  | 18 ++----------------
 include/pbl/handoff-data.h |  2 ++
 pbl/handoff-data.c         | 15 +++++++++++++++
 3 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/arch/arm/cpu/uncompress.c b/arch/arm/cpu/uncompress.c
index 8f916359b3..ac1462b7b1 100644
--- a/arch/arm/cpu/uncompress.c
+++ b/arch/arm/cpu/uncompress.c
@@ -31,21 +31,6 @@ unsigned long free_mem_end_ptr;
 extern unsigned char input_data[];
 extern unsigned char input_data_end[];
 
-static void add_handoff_data(void *boarddata)
-{
-	if (!boarddata)
-		return;
-	if (blob_is_fdt(boarddata)) {
-		handoff_data_add(HANDOFF_DATA_INTERNAL_DT, boarddata,
-				 get_unaligned_be32(boarddata + 4));
-	} else if (blob_is_compressed_fdt(boarddata)) {
-		struct barebox_boarddata_compressed_dtb *bd = boarddata;
-
-		handoff_data_add(HANDOFF_DATA_INTERNAL_DT_Z, boarddata,
-				 bd->datalen + sizeof(*bd));
-	}
-}
-
 void __noreturn barebox_pbl_start(unsigned long membase, unsigned long memsize,
 				  void *boarddata)
 {
@@ -82,7 +67,8 @@ void __noreturn barebox_pbl_start(unsigned long membase, unsigned long memsize,
 		mmu_early_enable(membase, memsize);
 
 	/* Add handoff data now, so arm_mem_barebox_image takes it into account */
-	add_handoff_data(boarddata);
+	if (boarddata)
+		handoff_data_add_dt(boarddata);
 
 	barebox_base = arm_mem_barebox_image(membase, endmem,
 					     uncompressed_len, NULL);
diff --git a/include/pbl/handoff-data.h b/include/pbl/handoff-data.h
index d475bdd694..eac3b9bf3e 100644
--- a/include/pbl/handoff-data.h
+++ b/include/pbl/handoff-data.h
@@ -51,4 +51,6 @@ static inline size_t handoff_data_size(void)
 	return __handoff_data_size(NULL);
 }
 
+void handoff_data_add_dt(void *fdt);
+
 #endif /* __PBL_HANDOFF_DATA_H */
diff --git a/pbl/handoff-data.c b/pbl/handoff-data.c
index 7453c9c82c..17b0512132 100644
--- a/pbl/handoff-data.c
+++ b/pbl/handoff-data.c
@@ -4,6 +4,8 @@
 #include <init.h>
 #include <linux/list.h>
 #include <memory.h>
+#include <fdt.h>
+#include <compressed-dtb.h>
 
 static struct handoff_data *handoff_data = (void *)-1;
 
@@ -160,6 +162,19 @@ int handoff_data_show(void)
 	return 0;
 }
 
+void handoff_data_add_dt(void *fdt)
+{
+	if (blob_is_fdt(fdt)) {
+		handoff_data_add(HANDOFF_DATA_INTERNAL_DT, fdt,
+				 get_unaligned_be32(fdt + 4));
+	} else if (blob_is_compressed_fdt(fdt)) {
+		struct barebox_boarddata_compressed_dtb *bd = fdt;
+
+		handoff_data_add(HANDOFF_DATA_INTERNAL_DT_Z, fdt,
+				 bd->datalen + sizeof(*bd));
+	}
+}
+
 static const char *handoff_data_entry_name(struct handoff_data_entry *hde)
 {
 	static char name[sizeof("handoff 12345678")];

-- 
2.39.5





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux