diff options
Diffstat (limited to 'arch/sandbox')
-rw-r--r-- | arch/sandbox/cpu/cpu.c | 4 | ||||
-rw-r--r-- | arch/sandbox/cpu/os.c | 8 | ||||
-rw-r--r-- | arch/sandbox/cpu/state.c | 5 | ||||
-rw-r--r-- | arch/sandbox/dts/sandbox64.dts | 13 | ||||
-rw-r--r-- | arch/sandbox/dts/test.dts | 18 | ||||
-rw-r--r-- | arch/sandbox/include/asm/io.h | 2 | ||||
-rw-r--r-- | arch/sandbox/include/asm/posix_types.h | 7 | ||||
-rw-r--r-- | arch/sandbox/include/asm/u-boot-sandbox.h | 2 |
8 files changed, 50 insertions, 9 deletions
diff --git a/arch/sandbox/cpu/cpu.c b/arch/sandbox/cpu/cpu.c index 636d3545b95..51496338ad6 100644 --- a/arch/sandbox/cpu/cpu.c +++ b/arch/sandbox/cpu/cpu.c @@ -31,7 +31,7 @@ static struct udevice *map_dev; unsigned long map_len; #endif -void sandbox_exit(void) +void __noreturn sandbox_exit(void) { /* Do this here while it still has an effect */ os_fd_restore(); @@ -230,7 +230,7 @@ phys_addr_t map_to_sysmem(const void *ptr) return mentry->tag; } -unsigned int sandbox_read(const void *addr, enum sandboxio_size_t size) +unsigned long sandbox_read(const void *addr, enum sandboxio_size_t size) { struct sandbox_state *state = state_get_current(); diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index 5e66304e2b9..9e93a0fa571 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -166,7 +166,7 @@ int os_write_file(const char *fname, const void *buf, int size) return 0; } -int os_filesize(int fd) +off_t os_filesize(int fd) { off_t size; @@ -218,7 +218,7 @@ err: int os_map_file(const char *pathname, int os_flags, void **bufp, int *sizep) { void *ptr; - int size; + off_t size; int ifd; ifd = os_open(pathname, os_flags); @@ -231,6 +231,10 @@ int os_map_file(const char *pathname, int os_flags, void **bufp, int *sizep) printf("Cannot get file size of '%s'\n", pathname); return -EIO; } + if ((unsigned long long)size > (unsigned long long)SIZE_MAX) { + printf("File '%s' too large to map\n", pathname); + return -EIO; + } ptr = mmap(0, size, PROT_READ | PROT_WRITE, MAP_SHARED, ifd, 0); if (ptr == MAP_FAILED) { diff --git a/arch/sandbox/cpu/state.c b/arch/sandbox/cpu/state.c index 69da378ab59..d67834988fd 100644 --- a/arch/sandbox/cpu/state.c +++ b/arch/sandbox/cpu/state.c @@ -10,6 +10,7 @@ #include <fdtdec.h> #include <log.h> #include <os.h> +#include <trace.h> #include <asm/malloc.h> #include <asm/state.h> #include <asm/test.h> @@ -525,6 +526,10 @@ int state_uninit(void) if (state->jumped_fname) os_unlink(state->jumped_fname); + /* Disable tracing before unmapping RAM */ + if (IS_ENABLED(CONFIG_TRACE)) + trace_set_enabled(0); + os_free(state->state_fdt); os_free(state->ram_buf); memset(state, '\0', sizeof(*state)); diff --git a/arch/sandbox/dts/sandbox64.dts b/arch/sandbox/dts/sandbox64.dts index f21fc181f37..195365580a7 100644 --- a/arch/sandbox/dts/sandbox64.dts +++ b/arch/sandbox/dts/sandbox64.dts @@ -89,6 +89,19 @@ cs-gpios = <0>, <&gpio_a 0>; }; + nvmxip-qspi1@08000000 { + compatible = "nvmxip,qspi"; + reg = /bits/ 64 <0x08000000 0x00200000>; + lba_shift = <9>; + lba = <4096>; + }; + + nvmxip-qspi2@08200000 { + compatible = "nvmxip,qspi"; + reg = /bits/ 64 <0x08200000 0x00100000>; + lba_shift = <9>; + lba = <2048>; + }; }; #include "sandbox.dtsi" diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts index 7c1ee71cb7c..453e53db71a 100644 --- a/arch/sandbox/dts/test.dts +++ b/arch/sandbox/dts/test.dts @@ -1802,6 +1802,24 @@ compatible = "u-boot,fwu-mdata-gpt"; fwu-mdata-store = <&mmc0>; }; + + nvmxip-qspi1@08000000 { + compatible = "nvmxip,qspi"; + reg = <0x08000000 0x00200000>; + lba_shift = <9>; + lba = <4096>; + }; + + nvmxip-qspi2@08200000 { + compatible = "nvmxip,qspi"; + reg = <0x08200000 0x00100000>; + lba_shift = <9>; + lba = <2048>; + }; + + extcon { + compatible = "sandbox,extcon"; + }; }; #include "sandbox_pmic.dtsi" diff --git a/arch/sandbox/include/asm/io.h b/arch/sandbox/include/asm/io.h index ad6c29a4e26..31ab7289b4b 100644 --- a/arch/sandbox/include/asm/io.h +++ b/arch/sandbox/include/asm/io.h @@ -45,7 +45,7 @@ static inline void unmap_sysmem(const void *vaddr) /* Map from a pointer to our RAM buffer */ phys_addr_t map_to_sysmem(const void *ptr); -unsigned int sandbox_read(const void *addr, enum sandboxio_size_t size); +unsigned long sandbox_read(const void *addr, enum sandboxio_size_t size); void sandbox_write(void *addr, unsigned int val, enum sandboxio_size_t size); #define readb(addr) sandbox_read((const void *)addr, SB_SIZE_8) diff --git a/arch/sandbox/include/asm/posix_types.h b/arch/sandbox/include/asm/posix_types.h index ec18ed7e3c2..e1442c455bd 100644 --- a/arch/sandbox/include/asm/posix_types.h +++ b/arch/sandbox/include/asm/posix_types.h @@ -1,5 +1,6 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* - * linux/include/asm-arm/posix_types.h + * Based on linux/include/asm-arm/posix_types.h * * Copyright (C) 1996-1998 Russell King. * @@ -10,8 +11,8 @@ * Changelog: * 27-06-1996 RMK Created */ -#ifndef __ARCH_ARM_POSIX_TYPES_H -#define __ARCH_ARM_POSIX_TYPES_H +#ifndef __ARCH_SANDBOX_POSIX_TYPES_H +#define __ARCH_SANDBOX_POSIX_TYPES_H /* * This file is generally used by user-level software, so you need to diff --git a/arch/sandbox/include/asm/u-boot-sandbox.h b/arch/sandbox/include/asm/u-boot-sandbox.h index 9eb19323ecf..e7027747b37 100644 --- a/arch/sandbox/include/asm/u-boot-sandbox.h +++ b/arch/sandbox/include/asm/u-boot-sandbox.h @@ -87,6 +87,6 @@ void sandbox_set_enable_pci_map(int enable); void sandbox_reset(void); /* Exit sandbox (quit U-Boot) */ -void sandbox_exit(void); +void __noreturn sandbox_exit(void); #endif /* _U_BOOT_SANDBOX_H_ */ |