Commit 63c0941726e44f31c42de744a57f528fee2df88f

Authored by Masahiro Yamada
Committed by Simon Glass
1 parent f7f191ee41

libfdt: replace ARCH_FIXUP_FDT with ARCH_FIXUP_FDT_MEMORY

Commit e2f88dfd2d96 ("libfdt: Introduce new ARCH_FIXUP_FDT option")
allows us to skip memory setup of DTB, but a problem for ARM is that
spin_table_update_dt() and psci_update_dt() are skipped as well if
CONFIG_ARCH_FIXUP_FDT is disabled.

This commit allows us to skip only fdt_fixup_memory_banks() instead
of the whole of arch_fixup_fdt().  It will be useful when we want to
use a memory node from a kernel DTB as is, but need some fixups for
Spin-Table/PSCI.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Alexey Brodkin <abrodkin@synopsys.com>
Acked-by: Simon Glass <sjg@chromium.org>
Fixed build error for x86:
Signed-off-by: Simon Glass <sjg@chromium.org>

Showing 12 changed files with 37 additions and 11 deletions Side-by-side Diff

... ... @@ -298,9 +298,8 @@
298 298 help
299 299 TODO: Move CONFIG_SYS_CLK_FREQ for all the architecture
300 300  
301   -config ARCH_FIXUP_FDT
302   - bool "Enable arch_fixup_fdt() call"
303   - depends on ARM || MIPS
  301 +config ARCH_FIXUP_FDT_MEMORY
  302 + bool "Enable arch_fixup_memory_banks() call"
304 303 default y
305 304 help
306 305 Enable FDT memory map syncup before OS boot. This feature can be
arch/arc/lib/bootm.c
... ... @@ -37,6 +37,11 @@
37 37 lmb_reserve(lmb, sp, (CONFIG_SYS_SDRAM_BASE + gd->ram_size - sp));
38 38 }
39 39  
  40 +int arch_fixup_fdt(void *blob)
  41 +{
  42 + return 0;
  43 +}
  44 +
40 45 static int cleanup_before_linux(void)
41 46 {
42 47 disable_interrupts();
arch/arm/lib/bootm-fdt.c
... ... @@ -25,7 +25,6 @@
25 25  
26 26 DECLARE_GLOBAL_DATA_PTR;
27 27  
28   -#ifdef CONFIG_ARCH_FIXUP_FDT
29 28 int arch_fixup_fdt(void *blob)
30 29 {
31 30 bd_t *bd = gd->bd;
... ... @@ -61,5 +60,4 @@
61 60  
62 61 return 0;
63 62 }
64   -#endif
arch/arm/lib/bootm.c
... ... @@ -414,10 +414,8 @@
414 414 if (images->ft_addr) {
415 415 off = fdt_path_offset(images->ft_addr, "/memory");
416 416 if (off < 0) {
417   -#ifdef CONFIG_ARCH_FIXUP_FDT
418 417 if (arch_fixup_fdt(images->ft_addr))
419 418 puts("## WARNING: fixup memory failed!\n");
420   -#endif
421 419 }
422 420 }
423 421 #endif
arch/microblaze/lib/bootm.c
... ... @@ -17,6 +17,11 @@
17 17  
18 18 DECLARE_GLOBAL_DATA_PTR;
19 19  
  20 +int arch_fixup_fdt(void *blob)
  21 +{
  22 + return 0;
  23 +}
  24 +
20 25 int do_bootm_linux(int flag, int argc, char * const argv[],
21 26 bootm_headers_t *images)
22 27 {
arch/mips/lib/bootm.c
... ... @@ -253,7 +253,6 @@
253 253 #endif
254 254 }
255 255  
256   -#ifdef CONFIG_ARCH_FIXUP_FDT
257 256 int arch_fixup_fdt(void *blob)
258 257 {
259 258 #if CONFIG_IS_ENABLED(MIPS_BOOT_FDT) && CONFIG_IS_ENABLED(OF_LIBFDT)
... ... @@ -265,7 +264,6 @@
265 264 return 0;
266 265 #endif
267 266 }
268   -#endif
269 267  
270 268 static int boot_setup_fdt(bootm_headers_t *images)
271 269 {
arch/powerpc/lib/bootm.c
... ... @@ -38,6 +38,11 @@
38 38 #define CONFIG_SYS_LINUX_LOWMEM_MAX_SIZE (768*1024*1024)
39 39 #endif
40 40  
  41 +int arch_fixup_fdt(void *blob)
  42 +{
  43 + return 0;
  44 +}
  45 +
41 46 static void boot_jump_linux(bootm_headers_t *images)
42 47 {
43 48 void (*kernel)(bd_t *, ulong r4, ulong r5, ulong r6,
arch/sandbox/lib/bootm.c
... ... @@ -50,6 +50,11 @@
50 50 return ret;
51 51 }
52 52  
  53 +int arch_fixup_fdt(void *blob)
  54 +{
  55 + return 0;
  56 +}
  57 +
53 58 int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
54 59 {
55 60 if (flag & (BOOTM_STATE_OS_GO | BOOTM_STATE_OS_FAKE_GO)) {
arch/x86/lib/bootm.c
... ... @@ -26,6 +26,11 @@
26 26  
27 27 #define COMMAND_LINE_OFFSET 0x9000
28 28  
  29 +int arch_fixup_fdt(void *blob)
  30 +{
  31 + return 0;
  32 +}
  33 +
29 34 __weak void board_quiesce_devices(void)
30 35 {
31 36 }
common/fdt_support.c
... ... @@ -381,6 +381,7 @@
381 381 do_fixup_by_compat(fdt, compat, prop, &tmp, 4, create);
382 382 }
383 383  
  384 +#ifdef CONFIG_ARCH_FIXUP_FDT_MEMORY
384 385 /*
385 386 * fdt_pack_reg - pack address and size array into the "reg"-suitable stream
386 387 */
... ... @@ -459,6 +460,7 @@
459 460 }
460 461 return 0;
461 462 }
  463 +#endif
462 464  
463 465 int fdt_fixup_memory(void *blob, u64 start, u64 size)
464 466 {
... ... @@ -474,12 +474,10 @@
474 474 printf("ERROR: /chosen node create failed\n");
475 475 goto err;
476 476 }
477   -#ifdef CONFIG_ARCH_FIXUP_FDT
478 477 if (arch_fixup_fdt(blob) < 0) {
479 478 printf("ERROR: arch-specific fdt fixup failed\n");
480 479 goto err;
481 480 }
482   -#endif
483 481 if (IMAGE_OF_BOARD_SETUP) {
484 482 fdt_ret = ft_board_setup(blob, gd->bd);
485 483 if (fdt_ret) {
include/fdt_support.h
... ... @@ -93,7 +93,15 @@
93 93 * property will be left untouched.
94 94 * @return 0 if ok, or -1 or -FDT_ERR_... on error
95 95 */
  96 +#ifdef CONFIG_ARCH_FIXUP_FDT_MEMORY
96 97 int fdt_fixup_memory_banks(void *blob, u64 start[], u64 size[], int banks);
  98 +#else
  99 +static inline int fdt_fixup_memory_banks(void *blob, u64 start[], u64 size[],
  100 + int banks)
  101 +{
  102 + return 0;
  103 +}
  104 +#endif
97 105  
98 106 void fdt_fixup_ethernet(void *fdt);
99 107 int fdt_find_and_setprop(void *fdt, const char *node, const char *prop,