diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-stm32mp/boot_params.c | 3 | ||||
-rw-r--r-- | arch/sandbox/cpu/cpu.c | 27 | ||||
-rw-r--r-- | arch/sandbox/include/asm/u-boot-sandbox.h | 8 |
3 files changed, 19 insertions, 19 deletions
diff --git a/arch/arm/mach-stm32mp/boot_params.c b/arch/arm/mach-stm32mp/boot_params.c index 84647e70398..e91ef1b2fc7 100644 --- a/arch/arm/mach-stm32mp/boot_params.c +++ b/arch/arm/mach-stm32mp/boot_params.c @@ -33,10 +33,11 @@ void save_boot_params(unsigned long r0, unsigned long r1, unsigned long r2, * Use the saved FDT address provided by TF-A at boot time (NT_FW_CONFIG = * Non Trusted Firmware configuration file) when the pointer is valid */ -void *board_fdt_blob_setup(void) +void *board_fdt_blob_setup(int *err) { log_debug("%s: nt_fw_dtb=%lx\n", __func__, nt_fw_dtb); + *err = 0; /* use external device tree only if address is valid */ if (nt_fw_dtb >= STM32_DDR_BASE) { if (fdt_magic(nt_fw_dtb) == FDT_MAGIC) diff --git a/arch/sandbox/cpu/cpu.c b/arch/sandbox/cpu/cpu.c index 48636ab6391..9887d09272a 100644 --- a/arch/sandbox/cpu/cpu.c +++ b/arch/sandbox/cpu/cpu.c @@ -291,44 +291,51 @@ void invalidate_dcache_range(unsigned long start, unsigned long stop) { } -int sandbox_read_fdt_from_file(void) +void *board_fdt_blob_setup(int *ret) { struct sandbox_state *state = state_get_current(); const char *fname = state->fdt_fname; - void *blob; + void *blob = NULL; loff_t size; int err; int fd; blob = map_sysmem(CONFIG_SYS_FDT_LOAD_ADDR, 0); + *ret = 0; if (!state->fdt_fname) { err = fdt_create_empty_tree(blob, 256); if (!err) goto done; printf("Unable to create empty FDT: %s\n", fdt_strerror(err)); - return -EINVAL; + *ret = -EINVAL; + goto fail; } err = os_get_filesize(fname, &size); if (err < 0) { - printf("Failed to file FDT file '%s'\n", fname); - return err; + printf("Failed to find FDT file '%s'\n", fname); + *ret = err; + goto fail; } fd = os_open(fname, OS_O_RDONLY); if (fd < 0) { printf("Failed to open FDT file '%s'\n", fname); - return -EACCES; + *ret = -EACCES; + goto fail; } + if (os_read(fd, blob, size) != size) { os_close(fd); - return -EIO; + printf("Failed to read FDT file '%s'\n", fname); + *ret = -EIO; + goto fail; } os_close(fd); done: - gd->fdt_blob = blob; - - return 0; + return blob; +fail: + return NULL; } ulong timer_get_boot_us(void) diff --git a/arch/sandbox/include/asm/u-boot-sandbox.h b/arch/sandbox/include/asm/u-boot-sandbox.h index 73b1897191d..56dc13c3eb1 100644 --- a/arch/sandbox/include/asm/u-boot-sandbox.h +++ b/arch/sandbox/include/asm/u-boot-sandbox.h @@ -77,14 +77,6 @@ int pci_unmap_physmem(const void *addr, unsigned long len, void sandbox_set_enable_pci_map(int enable); /** - * sandbox_read_fdt_from_file() - Read a device tree from a file - * - * Read a device tree file from a host file and set it up for use as the - * control FDT. - */ -int sandbox_read_fdt_from_file(void); - -/** * sandbox_reset() - reset sandbox * * This functions implements the cold reboot of the sandbox. It relaunches the |