Skip to contentSkip to conversation

fdt: Implement weak arch_fixup_fdt()

PATCH New Alexey Brodkin 3 participants 3 messages Jan 24, 2018 – Jan 25, 2018

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fdt: Implement weak arch_fixup_fdt()

Only ARM and in some configs MIPS really implement arch_fixup_fdt(). Others just use the same boilerplate which is not good by itself, but what's worse if we try to build with disabled CONFIG_CMD_BOOTM and enabled CONFIG_OF_LIBFDT we'll hit an unknown symbol which was apparently implemented in arch/xxx/lib/bootm.c.

Now with weak arch_fixup_fdt() right in image-fdt.c where it is used we get both items highlighted above fixed.

Cc Daniel Schwierzeck <[email protected]>
Cc Simon Glass <[email protected]>
Cc York Sun <[email protected]>
Cc Stefan Roese <[email protected]>
---
 arch/arc/lib/bootm.c        | 5 -----
 arch/microblaze/lib/bootm.c | 5 -----
 arch/mips/lib/bootm.c       | 6 ++----
 arch/nds32/lib/bootm.c      | 6 ------
 arch/powerpc/lib/bootm.c    | 5 -----
 arch/sandbox/lib/bootm.c    | 5 -----
 arch/x86/lib/bootm.c        | 5 -----
 common/image-fdt.c          | 5 +++++
 8 files changed, 7 insertions(+), 35 deletions(-)
arch/arc/lib/bootm.c +0 -5
index 9eef7070cf43..4d4acff239d4 100644
@@ -37,11 +37,6 @@ void arch_lmb_reserve(struct lmb *lmb)
 	lmb_reserve(lmb, sp, (CONFIG_SYS_SDRAM_BASE + gd->ram_size - sp));
 }
 
-int arch_fixup_fdt(void *blob)
-{
-	return 0;
-}
-
 static int cleanup_before_linux(void)
 {
 	disable_interrupts();
arch/microblaze/lib/bootm.c +0 -5
index 0a286e82c2be..f33ef087577d 100644
@@ -17,11 +17,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-int arch_fixup_fdt(void *blob)
-{
-	return 0;
-}
-
 int do_bootm_linux(int flag, int argc, char * const argv[],
 		   bootm_headers_t *images)
 {
arch/mips/lib/bootm.c +2 -4
index 5a9a2811ffb5..9dc47407684b 100644
@@ -253,17 +253,15 @@ static int boot_reloc_fdt(bootm_headers_t *images)
 #endif
 }
 
+#if CONFIG_IS_ENABLED(MIPS_BOOT_FDT) && CONFIG_IS_ENABLED(OF_LIBFDT)
 int arch_fixup_fdt(void *blob)
 {
-#if CONFIG_IS_ENABLED(MIPS_BOOT_FDT) && CONFIG_IS_ENABLED(OF_LIBFDT)
 	u64 mem_start = virt_to_phys((void *)gd->bd->bi_memstart);
 	u64 mem_size = gd->ram_size;
 
 	return fdt_fixup_memory_banks(blob, &mem_start, &mem_size, 1);
-#else
-	return 0;
-#endif
 }
+#endif
 
 static int boot_setup_fdt(bootm_headers_t *images)
 {
arch/nds32/lib/bootm.c +0 -6
index 42b15dfcbfc0..0d7f57851739 100644
@@ -15,12 +15,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-int arch_fixup_fdt(void *blob)
-{
-	return 0;
-}
-
-
 #if defined(CONFIG_SETUP_MEMORY_TAGS) || \
 	defined(CONFIG_CMDLINE_TAG) || \
 	defined(CONFIG_INITRD_TAG) || \
arch/powerpc/lib/bootm.c +0 -5
index b9ae24dc98b6..6ef644d85ba3 100644
@@ -40,11 +40,6 @@ static void set_clocks_in_mhz (bd_t *kbd);
 #define CONFIG_SYS_LINUX_LOWMEM_MAX_SIZE	(768*1024*1024)
 #endif
 
-int arch_fixup_fdt(void *blob)
-{
-	return 0;
-}
-
 static void boot_jump_linux(bootm_headers_t *images)
 {
 	void	(*kernel)(bd_t *, ulong r4, ulong r5, ulong r6,
arch/sandbox/lib/bootm.c +0 -5
index 4cdd18fe14b2..0c9a7979d231 100644
@@ -50,11 +50,6 @@ int bootz_setup(ulong image, ulong *start, ulong *end)
 	return ret;
 }
 
-int arch_fixup_fdt(void *blob)
-{
-	return 0;
-}
-
 int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
 {
 	if (flag & (BOOTM_STATE_OS_GO | BOOTM_STATE_OS_FAKE_GO)) {
arch/x86/lib/bootm.c +0 -5
index e548cdbed592..8e76ba35aea5 100644
@@ -28,11 +28,6 @@ DECLARE_GLOBAL_DATA_PTR;
 
 #define COMMAND_LINE_OFFSET 0x9000
 
-int arch_fixup_fdt(void *blob)
-{
-	return 0;
-}
-
 __weak void board_quiesce_devices(void)
 {
 }
common/image-fdt.c +5 -0
index 1e946467e3c7..24e4c7c6c814 100644
@@ -454,6 +454,11 @@ __weak int ft_verify_fdt(void *fdt)
 	return 1;
 }
 
+__weak int arch_fixup_fdt(void *blob)
+{
+	return 0;
+}
+
 int image_setup_libfdt(bootm_headers_t *images, void *blob,
 		       int of_size, struct lmb *lmb)
 {
Signature · 1 line
2.14.3
#1 lore raw

PATCH 1/1 fdt: Implement weak arch_fixup_fdt()

Quoted 6 lines · Alexey Brodkin

Only ARM and in some configs MIPS really implement arch_fixup_fdt(). Others just use the same boilerplate which is not good by itself, but what's worse if we try to build with disabled CONFIG_CMD_BOOTM and enabled CONFIG_OF_LIBFDT we'll hit an unknown symbol which was apparently implemented in arch/xxx/lib/bootm.c.

Quoted 8 lines

Now with weak arch_fixup_fdt() right in image-fdt.c where it is used we get both items highlighted above fixed.

Cc Daniel Schwierzeck <[email protected]>
Cc Simon Glass <[email protected]>
Cc York Sun <[email protected]>
Cc Stefan Roese <[email protected]>
Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180124/0d6a50a5/attachment.sig>
#2 lore raw

PATCH 1/1 fdt: Implement weak arch_fixup_fdt()

In reply to Alexey Brodkin
Quoted 14 lines · Alexey Brodkin

Only ARM and in some configs MIPS really implement arch_fixup_fdt(). Others just use the same boilerplate which is not good by itself, but what's worse if we try to build with disabled CONFIG_CMD_BOOTM and enabled CONFIG_OF_LIBFDT we'll hit an unknown symbol which was apparently implemented in arch/xxx/lib/bootm.c.

Now with weak arch_fixup_fdt() right in image-fdt.c where it is used we get both items highlighted above fixed.

Cc Daniel Schwierzeck <[email protected]>
Cc Simon Glass <[email protected]>
Cc York Sun <[email protected]>
Cc Stefan Roese <[email protected]>
Quoted 11 lines
---
 arch/arc/lib/bootm.c        | 5 -----
 arch/microblaze/lib/bootm.c | 5 -----
 arch/mips/lib/bootm.c       | 6 ++----
 arch/nds32/lib/bootm.c      | 6 ------
 arch/powerpc/lib/bootm.c    | 5 -----
 arch/sandbox/lib/bootm.c    | 5 -----
 arch/x86/lib/bootm.c        | 5 -----
 common/image-fdt.c          | 5 +++++
 8 files changed, 7 insertions(+), 35 deletions(-)
Signature · 9 lines
- Daniel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180125/4ffac924/attachment.sig>