sandbox: Remove OF_HOSTFILE
OF_HOSTFILE is used on sandbox configs only. Although it's pretty
unique and not causing any confusions, we are better of having simpler
config options for the DTB.
So let's replace that with the existing OF_BOARD. U-Boot would then
have only three config options for the DTB origin.
- OF_SEPARATE, build separately from U-Boot
- OF_BOARD, board specific way of providing the DTB
- OF_EMBED embedded in the u-boot binary(should not be used in production
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
diff --git a/board/AndesTech/ax25-ae350/ax25-ae350.c b/board/AndesTech/ax25-ae350/ax25-ae350.c
index b28894e..5fb32fd 100644
--- a/board/AndesTech/ax25-ae350/ax25-ae350.c
+++ b/board/AndesTech/ax25-ae350/ax25-ae350.c
@@ -54,13 +54,15 @@
return 0;
}
-void *board_fdt_blob_setup(void)
+void *board_fdt_blob_setup(int *err)
{
+ *err = 0;
#if CONFIG_IS_ENABLED(OF_BOARD)
return (void *)(ulong)gd->arch.firmware_fdt_addr;
#elif CONFIG_IS_ENABLED(OF_SEPARATE)
return (void *)CONFIG_SYS_FDT_BASE;
#else
+ *err = -EINVAL;
return NULL;
#endif
}
diff --git a/board/Marvell/octeontx/board-fdt.c b/board/Marvell/octeontx/board-fdt.c
index 1db2a4a..e989c37 100644
--- a/board/Marvell/octeontx/board-fdt.c
+++ b/board/Marvell/octeontx/board-fdt.c
@@ -301,7 +301,8 @@
*
* @return FDT base address received from ATF in x1 register
*/
-void *board_fdt_blob_setup(void)
+void *board_fdt_blob_setup(int *err)
{
+ *err = 0;
return (void *)fdt_base_addr;
}
diff --git a/board/Marvell/octeontx2/board-fdt.c b/board/Marvell/octeontx2/board-fdt.c
index a4771af..e2cfe01 100644
--- a/board/Marvell/octeontx2/board-fdt.c
+++ b/board/Marvell/octeontx2/board-fdt.c
@@ -215,7 +215,8 @@
*
* @return FDT base address received from ATF in x1 register
*/
-void *board_fdt_blob_setup(void)
+void *board_fdt_blob_setup(int *err)
{
+ *err = 0;
return (void *)fdt_base_addr;
}
diff --git a/board/Marvell/octeontx2/board.c b/board/Marvell/octeontx2/board.c
index 4e8cb83..63aa2d6 100644
--- a/board/Marvell/octeontx2/board.c
+++ b/board/Marvell/octeontx2/board.c
@@ -226,12 +226,13 @@
uboot_entry_t entry;
ulong addr;
void *fdt;
+ int err;
if (argc < 2)
return CMD_RET_USAGE;
addr = hextoul(argv[1], NULL);
- fdt = board_fdt_blob_setup();
+ fdt = board_fdt_blob_setup(&err);
entry = (uboot_entry_t)addr;
flush_cache((ulong)addr, 1 << 20); /* 1MiB should be enough */
dcache_disable();
diff --git a/board/armltd/vexpress64/vexpress64.c b/board/armltd/vexpress64/vexpress64.c
index 2e42602..d2f307c 100644
--- a/board/armltd/vexpress64/vexpress64.c
+++ b/board/armltd/vexpress64/vexpress64.c
@@ -131,12 +131,15 @@
return ~0;
}
-void *board_fdt_blob_setup(void)
+void *board_fdt_blob_setup(int *err)
{
phys_addr_t fdt_rom_addr = find_dtb_in_nor_flash(CONFIG_JUNO_DTB_PART);
- if (fdt_rom_addr == ~0UL)
+ *err = 0;
+ if (fdt_rom_addr == ~0UL) {
+ *err = -ENXIO;
return NULL;
+ }
return (void *)fdt_rom_addr;
}
diff --git a/board/broadcom/bcmstb/bcmstb.c b/board/broadcom/bcmstb/bcmstb.c
index 723ebda..07aeb09 100644
--- a/board/broadcom/bcmstb/bcmstb.c
+++ b/board/broadcom/bcmstb/bcmstb.c
@@ -131,8 +131,9 @@
return 0;
}
-void *board_fdt_blob_setup(void)
+void *board_fdt_blob_setup(int *err)
{
+ *err = 0;
/* Stored the DTB address there during our init */
return (void *)prior_stage_fdt_address;
}
diff --git a/board/emulation/qemu-arm/qemu-arm.c b/board/emulation/qemu-arm/qemu-arm.c
index aa68bef..16d5a97 100644
--- a/board/emulation/qemu-arm/qemu-arm.c
+++ b/board/emulation/qemu-arm/qemu-arm.c
@@ -94,8 +94,9 @@
return 0;
}
-void *board_fdt_blob_setup(void)
+void *board_fdt_blob_setup(int *err)
{
+ *err = 0;
/* QEMU loads a generated DTB for us at the start of RAM. */
return (void *)CONFIG_SYS_SDRAM_BASE;
}
diff --git a/board/emulation/qemu-ppce500/qemu-ppce500.c b/board/emulation/qemu-ppce500/qemu-ppce500.c
index 924cc02..7d8ba34 100644
--- a/board/emulation/qemu-ppce500/qemu-ppce500.c
+++ b/board/emulation/qemu-ppce500/qemu-ppce500.c
@@ -333,8 +333,9 @@
*
* @return virtual address of FDT received from QEMU in r3 register
*/
-void *board_fdt_blob_setup(void)
+void *board_fdt_blob_setup(int *err)
{
+ *err = 0;
return get_fdt_virt();
}
diff --git a/board/emulation/qemu-riscv/qemu-riscv.c b/board/emulation/qemu-riscv/qemu-riscv.c
index 2a26e26..b0d9dd5 100644
--- a/board/emulation/qemu-riscv/qemu-riscv.c
+++ b/board/emulation/qemu-riscv/qemu-riscv.c
@@ -72,8 +72,9 @@
}
#endif
-void *board_fdt_blob_setup(void)
+void *board_fdt_blob_setup(int *err)
{
+ *err = 0;
/* Stored the DTB address there during our init */
return (void *)(ulong)gd->arch.firmware_fdt_addr;
}
diff --git a/board/highbank/highbank.c b/board/highbank/highbank.c
index ffb6fd9..b5fa510 100644
--- a/board/highbank/highbank.c
+++ b/board/highbank/highbank.c
@@ -111,8 +111,9 @@
}
#endif
-void *board_fdt_blob_setup(void)
+void *board_fdt_blob_setup(int *err)
{
+ *err = 0;
/*
* The ECME management processor loads the DTB from NOR flash
* into DRAM (at 4KB), where it gets patched to contain the
diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c
index 0c7d58d..55afaa5 100644
--- a/board/raspberrypi/rpi/rpi.c
+++ b/board/raspberrypi/rpi/rpi.c
@@ -488,10 +488,14 @@
/*
* If the firmware passed a device tree use it for U-Boot.
*/
-void *board_fdt_blob_setup(void)
+void *board_fdt_blob_setup(int *err)
{
- if (fdt_magic(fw_dtb_pointer) != FDT_MAGIC)
+ *err = 0;
+ if (fdt_magic(fw_dtb_pointer) != FDT_MAGIC) {
+ *err = -ENXIO;
return NULL;
+ }
+
return (void *)fw_dtb_pointer;
}
diff --git a/board/sifive/unleashed/unleashed.c b/board/sifive/unleashed/unleashed.c
index e7d2332..3c3e0e1 100644
--- a/board/sifive/unleashed/unleashed.c
+++ b/board/sifive/unleashed/unleashed.c
@@ -114,8 +114,9 @@
#endif
-void *board_fdt_blob_setup(void)
+void *board_fdt_blob_setup(int *err)
{
+ *err = 0;
if (IS_ENABLED(CONFIG_OF_SEPARATE)) {
if (gd->arch.firmware_fdt_addr)
return (ulong *)(uintptr_t)gd->arch.firmware_fdt_addr;
diff --git a/board/sifive/unmatched/unmatched.c b/board/sifive/unmatched/unmatched.c
index 93c452c..4895909 100644
--- a/board/sifive/unmatched/unmatched.c
+++ b/board/sifive/unmatched/unmatched.c
@@ -11,8 +11,9 @@
#include <dm.h>
#include <asm/sections.h>
-void *board_fdt_blob_setup(void)
+void *board_fdt_blob_setup(int *err)
{
+ *err = 0;
if (IS_ENABLED(CONFIG_OF_SEPARATE)) {
if (gd->arch.firmware_fdt_addr)
return (ulong *)(uintptr_t)gd->arch.firmware_fdt_addr;
diff --git a/board/socrates/socrates.c b/board/socrates/socrates.c
index 3ba2fbb..a81cb7b 100644
--- a/board/socrates/socrates.c
+++ b/board/socrates/socrates.c
@@ -220,13 +220,15 @@
#endif /* CONFIG_OF_BOARD_SETUP */
#if defined(CONFIG_OF_SEPARATE)
-void *board_fdt_blob_setup(void)
+void *board_fdt_blob_setup(int *err)
{
void *fw_dtb;
+ *err = 0;
fw_dtb = (void *)(CONFIG_SYS_TEXT_BASE - CONFIG_ENV_SECT_SIZE);
if (fdt_magic(fw_dtb) != FDT_MAGIC) {
printf("DTB is not passed via %x\n", (u32)fw_dtb);
+ *err = -ENXIO;
return NULL;
}
diff --git a/board/xen/xenguest_arm64/xenguest_arm64.c b/board/xen/xenguest_arm64/xenguest_arm64.c
index da0ddee..6e10bba 100644
--- a/board/xen/xenguest_arm64/xenguest_arm64.c
+++ b/board/xen/xenguest_arm64/xenguest_arm64.c
@@ -39,10 +39,13 @@
* x0 is the physical address of the device tree blob (dtb) in system RAM.
* This is stored in rom_pointer during low level init.
*/
-void *board_fdt_blob_setup(void)
+void *board_fdt_blob_setup(int *err)
{
- if (fdt_magic(rom_pointer[0]) != FDT_MAGIC)
+ *err = 0;
+ if (fdt_magic(rom_pointer[0]) != FDT_MAGIC) {
+ *err = -ENXIO;
return NULL;
+ }
return (void *)rom_pointer[0];
}
diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c
index 9006bd3..78a5d0e 100644
--- a/board/xilinx/common/board.c
+++ b/board/xilinx/common/board.c
@@ -320,10 +320,11 @@
}
#if defined(CONFIG_OF_BOARD) || defined(CONFIG_OF_SEPARATE)
-void *board_fdt_blob_setup(void)
+void *board_fdt_blob_setup(int *err)
{
void *fdt_blob;
+ *err = 0;
if (!IS_ENABLED(CONFIG_SPL_BUILD) &&
!IS_ENABLED(CONFIG_VERSAL_NO_DDR) &&
!IS_ENABLED(CONFIG_ZYNQMP_NO_DDR)) {