From 781adb5710694601e8ceb01256becea142c5ba6c Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 20 Apr 2013 08:42:37 +0000 Subject: sandbox: Provide a way to map from host RAM to U-Boot RAM In many cases, pointers to memory are passed around, and these pointers refer to U-Boot memory, not host memory. This in itself is not a problem. However, in a few places, we cast that pointer back to a ulong (being a U-Boot memory address). It is possible to convert many of these cases to avoid this. However there are data structures (e.g. struct bootm_headers) which use pointers. We could with a lot of effort adjust the structs and all code that uses them to use ulong instead of pointers. This seems like an unacceptable cost, since our objective with sandbox is to minimise the impact on U-Boot code while maximising the features available to sandbox. Therefore, create a map_to_sysmem() function which converts from a pointer to a U-Boot address. This can be used sparingly when needed. Signed-off-by: Simon Glass --- arch/sandbox/include/asm/io.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'arch/sandbox/include/asm') diff --git a/arch/sandbox/include/asm/io.h b/arch/sandbox/include/asm/io.h index d8c02364d9..54051a3bbb 100644 --- a/arch/sandbox/include/asm/io.h +++ b/arch/sandbox/include/asm/io.h @@ -49,3 +49,6 @@ static inline void *map_sysmem(phys_addr_t paddr, unsigned long len) static inline void unmap_sysmem(const void *vaddr) { } + +/* Map from a pointer to our RAM buffer */ +phys_addr_t map_to_sysmem(void *ptr); -- cgit From a733b06b69d2cb058c4363952bc0793b1f514305 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 26 Apr 2013 02:53:43 +0000 Subject: sandbox: Switch over to generic board Add generic board support for sandbox. and remove the old board init code. Select CONFIG_SYS_GENERIC_BOARD for sandbox now that this is supported. Signed-off-by: Simon Glass Reviewed-by: Tom Rini --- arch/sandbox/include/asm/io.h | 5 +++++ arch/sandbox/include/asm/u-boot.h | 22 ++-------------------- 2 files changed, 7 insertions(+), 20 deletions(-) (limited to 'arch/sandbox/include/asm') diff --git a/arch/sandbox/include/asm/io.h b/arch/sandbox/include/asm/io.h index 54051a3bbb..0c022f1db5 100644 --- a/arch/sandbox/include/asm/io.h +++ b/arch/sandbox/include/asm/io.h @@ -20,6 +20,9 @@ * MA 02111-1307 USA */ +#ifndef __SANDBOX_ASM_IO_H +#define __SANDBOX_ASM_IO_H + /* * Given a physical address and a length, return a virtual address * that can be used to access the memory range with the caching @@ -52,3 +55,5 @@ static inline void unmap_sysmem(const void *vaddr) /* Map from a pointer to our RAM buffer */ phys_addr_t map_to_sysmem(void *ptr); + +#endif diff --git a/arch/sandbox/include/asm/u-boot.h b/arch/sandbox/include/asm/u-boot.h index de8120a723..5bea1f2fcb 100644 --- a/arch/sandbox/include/asm/u-boot.h +++ b/arch/sandbox/include/asm/u-boot.h @@ -36,26 +36,8 @@ #ifndef _U_BOOT_H_ #define _U_BOOT_H_ 1 -typedef struct bd_info { - unsigned long bi_memstart; /* start of DRAM memory */ - phys_size_t bi_memsize; /* size of DRAM memory in bytes */ - unsigned long bi_flashstart; /* start of FLASH memory */ - unsigned long bi_flashsize; /* size of FLASH memory */ - unsigned long bi_flashoffset; /* reserved area for startup monitor */ - unsigned long bi_sramstart; /* start of SRAM memory */ - unsigned long bi_sramsize; /* size of SRAM memory */ - unsigned long bi_bootflags; /* boot / reboot flag (for LynxOS) */ - unsigned short bi_ethspeed; /* Ethernet speed in Mbps */ - unsigned long bi_intfreq; /* Internal Freq, in MHz */ - unsigned long bi_busfreq; /* Bus Freq, in MHz */ - unsigned int bi_baudrate; /* Console Baudrate */ - unsigned long bi_boot_params; /* where this board expects params */ - struct /* RAM configuration */ - { - ulong start; - ulong size; - } bi_dram[CONFIG_NR_DRAM_BANKS]; -} bd_t; +/* Use the generic board which requires a unified bd_info */ +#include /* For image.h:image_check_target_arch() */ #define IH_ARCH_DEFAULT IH_ARCH_SANDBOX -- cgit From f828bf25fe02f0d7148a9180988ab4d5681b8195 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 20 Apr 2013 08:42:41 +0000 Subject: sandbox: Add CONFIG_OF_HOSTFILE to read FDT from host file With sandbox it is tricky to add an FDT to the image at build time (or later) since we build an ELF file, not a plain binary, and the address space of the whole U-Boot is not accessible in the emulated memory map of sandbox. Sandbox can read files directly from the host, though, so add an option to read an FDT from a host file on start-up. Signed-off-by: Simon Glass --- arch/sandbox/include/asm/state.h | 1 + 1 file changed, 1 insertion(+) (limited to 'arch/sandbox/include/asm') diff --git a/arch/sandbox/include/asm/state.h b/arch/sandbox/include/asm/state.h index 2b62b46ea2..9552708a72 100644 --- a/arch/sandbox/include/asm/state.h +++ b/arch/sandbox/include/asm/state.h @@ -34,6 +34,7 @@ enum exit_type_id { /* The complete state of the test system */ struct sandbox_state { const char *cmd; /* Command to execute */ + const char *fdt_fname; /* Filename of FDT binary */ enum exit_type_id exit_type; /* How we exited U-Boot */ const char *parse_err; /* Error to report from parsing */ int argc; /* Program arguments */ -- cgit