aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-09-26 08:14:21 -0600
committerTom Rini <trini@konsulko.com>2023-09-29 07:53:26 -0400
commit84076be85662a5c65fe8e8093d31345415115ed4 (patch)
treee229a9e54132d8d3ac2d8f2493c6702171087bf0
parent0231655ab72037fe9141f233e505b335e2f95990 (diff)
downloadu-boot-84076be85662a5c65fe8e8093d31345415115ed4.zip
u-boot-84076be85662a5c65fe8e8093d31345415115ed4.tar.gz
u-boot-84076be85662a5c65fe8e8093d31345415115ed4.tar.bz2
spl: Avoid #ifdef with CONFIG_SPL_PAYLOAD_ARGS_ADDR
Move the condition to the header file to improve readability. Signed-off-by: Simon Glass <sjg@chromium.org>
-rw-r--r--common/spl/spl.c10
-rw-r--r--include/system-constants.h7
2 files changed, 11 insertions, 6 deletions
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 9870e9a..703f45c 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -810,9 +810,8 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
}
memset(&spl_image, '\0', sizeof(spl_image));
-#ifdef CONFIG_SPL_PAYLOAD_ARGS_ADDR
- spl_image.arg = (void *)CONFIG_SPL_PAYLOAD_ARGS_ADDR;
-#endif
+ if (IS_ENABLED(CONFIG_SPL_OS_BOOT))
+ spl_image.arg = (void *)SPL_PAYLOAD_ARGS_ADDR;
spl_image.boot_device = BOOT_DEVICE_NONE;
board_boot_order(spl_boot_list);
@@ -869,9 +868,8 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
#if CONFIG_IS_ENABLED(OS_BOOT)
case IH_OS_LINUX:
debug("Jumping to Linux\n");
-#if defined(CONFIG_SPL_PAYLOAD_ARGS_ADDR)
- spl_fixup_fdt((void *)CONFIG_SPL_PAYLOAD_ARGS_ADDR);
-#endif
+ if (IS_ENABLED(CONFIG_SPL_OS_BOOT))
+ spl_fixup_fdt((void *)SPL_PAYLOAD_ARGS_ADDR);
spl_board_prepare_for_linux();
jump_to_image_linux(&spl_image);
#endif
diff --git a/include/system-constants.h b/include/system-constants.h
index dca6a86..5937156 100644
--- a/include/system-constants.h
+++ b/include/system-constants.h
@@ -34,4 +34,11 @@
#define SPL_SYS_MALLOC_SIZE \
IF_ENABLED_INT(CONFIG_SPL_SYS_MALLOC, CONFIG_SPL_SYS_MALLOC_SIZE)
+/* deal with an optional value */
+#ifdef CONFIG_SPL_OS_BOOT
+#define SPL_PAYLOAD_ARGS_ADDR CONFIG_SPL_PAYLOAD_ARGS_ADDR
+#else
+#define SPL_PAYLOAD_ARGS_ADDR 0
+#endif
+
#endif