summaryrefslogtreecommitdiff
path: root/arch/sandbox/cpu
AgeCommit message (Collapse)Author
2017-07-28sandbox: remove os_putc() and os_puts()Masahiro Yamada
They are unused since commit d8c6fb8cedbc ("sandbox: Drop special case console code for sandbox"). Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Acked-by: Simon Glass <sjg@chromium.org>
2017-07-27sandbox: use CONFIG_VAL(SYS_MALLOC_F_LEN) to distinguish malloc pool size ↵Andy Yan
before relocation SPL and normal u-boot stage use different malloc pool size configuration before relocation, so use CONFIG_VAL(SYS_MALLOC_F_LEN) to fit different boot stage. Signed-off-by: Andy Yan <andyshrk@gmail.com> Changes in v3: - use CONFIG_VAL(), which suggested by Simon Changes in v2: None arch/sandbox/cpu/start.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
2017-07-11sandbox: Stop printing platdata at the start of SPLSimon Glass
Currently we have code which prints out platform data at the start of SPL. Now that we have tests for dtoc this is probably not necessary. Drop it. Update test_ofplatdata to check for empty output since it is useful to check that sandbox_spl works as expected. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-09sandbox: Fix comparison of unsigned enum expression warningTom Rini
In os_dirent_get_typename() we are checking that type falls within the known values of the enum os_dirent_t. With clang-3.8 testing this value as being >= 0 results in a warning as it will always be true. This assumes of course that we are only given valid data. Given that we want to sanity check the input, we change this to check that it falls within the range of the first to the last entry in the given enum. Cc: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2017-06-05bootstage: Require timer_get_boot_us() to be definedSimon Glass
At present we provide a default version of this function for use by bootstage. However it uses the system timer and therefore likely requires driver model. This makes it impossible to time driver-model init. Drop the function and require boards to provide their own. Add a sandbox version also. There is a default implememtation in lib/time.c for boards which use CONFIG_SYS_TIMER_COUNTER. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-01sandbox: Add a way to reset sandbox state for testsSimon Glass
Running a new test should reset the sandbox state to avoid tests interferring with each other. Move the existing state-reset code into a function so it can be used from tests. Also update the code to reset the SPI devices and adjust the test code to call it. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-01dm: Use dm.h header when driver mode is usedSimon Glass
This header includes things that are needed to make driver build. Adjust existing users to include that always, even if other dm/ includes are present Signed-off-by: Simon Glass <sjg@chromium.org>
2017-04-05board_f: sandbox: Move sandbox_early_getopt_check() into misc_init_f()Simon Glass
We don't need a special hook for sandbox as one of the later ones will do just as well. We can print error messages about bad options after we print the banner. In fact, it seems better. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Stefan Roese <sr@denx.de>
2017-04-05board_f: sandbox: Move setup_ram_buf() to private codeSimon Glass
There is no need to have this call in the generic init sequence and no other architecture has needed it in the time it has been there. Move it into sandbox's private code. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Stefan Roese <sr@denx.de> Reviewed-by: Stefan Roese <sr@denx.de>
2016-12-09spl: sandbox: Drop spl_board_announce_boot_device()Simon Glass
This function is not used anymore. Drop it. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-12-09spl: Add a name to the SPL load-image methodsSimon Glass
It is useful to name each method so that we can print out this name when using the method. Currently this happens using a separate function. In preparation for unifying this, add a name to each method. The name is only available if we have libcommon support (i.e can use printf()). Signed-off-by: Simon Glass <sjg@chromium.org>
2016-10-11sandbox/fs: Set correct filetype for unknown filetypeStefan Brüns
The "hostfs ls" command prefixes each directory entry with either DIR, LNK or " " if it is a directory, symlink resp. regular file, or "???" for any other or unknown type. The latter only works if the type is set correctly, as the entry defaults to OS_FILET_REG and e.g. socket files show up as regular files. Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Acked-by: Simon Glass <sjg@chromium.org>
2016-10-11sandbox/fs: Use readdir instead of deprecated readdir_rStefan Brüns
Using readdir_r limits the maximum file name length and may even be unsafe, and is thus deprecated in since glibc 2.24. Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Acked-by: Simon Glass <sjg@chromium.org>
2016-10-11sandbox/fs: Use correct size path name bufferStefan Brüns
The readdir linux manpage explicitly states (quoting POSIX.1) that sizeof(d_name) is not correct for determining the required size, but to always use strlen. Grow the buffer if needed. Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Acked-by: Simon Glass <sjg@chromium.org>
2016-10-11sandbox/fs: Make linking of nodes in os_dirent_ls more obviousStefan Brüns
Previously, after reading/creating the second dirent, the second entry would be chained to the first entry and the first entry would be linked to head. Instead, immediately link the first entry to head. Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de> Acked-by: Simon Glass <sjg@chromium.org>
2016-10-06spl: Pass spl_image as a parameter to load_image() methodsSimon Glass
Rather than having a global variable, pass the spl_image as a parameter. This avoids BSS use, and makes it clearer what the function is actually doing. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2016-10-06spl: Convert spl_board_load_image() to use linker listSimon Glass
Add a linker list declaration for this method and remove the explicit switch() code. Update existing users. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2016-10-06spl: Convert boot_device into a structSimon Glass
At present some spl_xxx_load_image() functions take a parameter and some don't. Of those that do, most take an integer but one takes a string. Convert this parameter into a struct so that we can pass all functions the same thing. This will allow us to use a common function signature. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2016-07-15sandbox: Add a test device that uses of-platdataSimon Glass
Start up the test devices. These print out of-platdata contents, providing a check that the of-platdata feature is working correctly. The device-tree changes are made to sandbox.dts rather than test.dts. since the former controls the of-platdata generation. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-07-15sandbox: Add a new sandbox_spl boardSimon Glass
It is useful to be able to build SPL for sandbox. It provides additional build coverage and allows SPL features to be tested in sandbox. However it does not need worthwhile to always create an SPL build. It nearly doubles the build time and the feature is (so far) seldom used. So for now, create a separate build target for sandbox SPL. This allows experimentation with this new feature without impacting existing workflows. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-07-15sandbox: Add basic SPL implementationSimon Glass
Add an sandbox implementation for the generic SPL framework. This supports locating and running U-Boot proper. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-07-15sandbox: Don't include the main loop in SPLSimon Glass
SPL does not have a command interface so we should not include the main loop code. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-07-15sandbox: Don't use PCI in SPLSimon Glass
PCI is not supported in SPL for sandbox, so avoid using it. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-07-15sandbox: Add some missing headers in cpu.cSimon Glass
These headers are needed in case they are not transitively included. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-07-15sandbox: Correct header file order in cpu.cSimon Glass
The dm/ file should go at the end. Move it. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-07-15sandbox: Allow chaining from SPL to U-Boot properSimon Glass
SPL is expected to load and run U-Boot. This needs to work with sandbox also. Provide a function to locate the U-Boot image, and another to start it. This allows SPL to function on sandbox as it does on other archs. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-05-27Rename reset to sysresetStephen Warren
The current reset API implements a method to reset the entire system. In the near future, I'd like to introduce code that implements the device tree reset bindings; i.e. the equivalent of the Linux kernel's reset API. This controls resets to individual HW blocks or external chips with reset signals. It doesn't make sense to merge the two APIs into one since they have different semantic purposes. Resolve the naming conflict by renaming the existing reset API to sysreset instead, so the new reset API can be called just reset. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Simon Glass <sjg@chromium.org>
2016-03-22sandbox: Avoid calling commands when not availableSimon Glass
Don't try to run commands when not supported. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2016-01-15eth-raw-os.c: Add cast to bind(2) callTom Rini
With more recent gcc versions we otherwise get an error like: note: expected 'const struct sockaddr *' but argument is of type 'struct sockaddr_in *' and the common solution here is to cast, rather than re-work the code. Cc: Joe Hershberger <joe.hershberger@ni.com> Cc: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
2016-01-12sandbox: eth-raw-os.c: Ensure that our interface name is not too longTom Rini
Coverity notes that we do not ensure when we copy ifname we still have space left to ensure NULL termination. As cannot control the size of ifr_name we must make sure that our argument will not overflow the buffer. Reported-by: Coverity (CID 131094) Cc: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2015-11-20test: Record and silence console in testsSimon Glass
When running sandbox tests, silence the console to avoid unwanted output. Also, record the console in case tests want to check it. The -v option can be used to enable stdout during tests. Signed-off-by: Simon Glass <sjg@chromium.org>
2015-11-20sandbox: Add a way to skip time delaysSimon Glass
Some tests are slow due to delays which are unnecessary on sandbox. The worst offender is USB where we lose two seconds. Add a way to disable time delays. Signed-off-by: Simon Glass <sjg@chromium.org>
2015-07-21sandbox: Use the reset driver to handle resetSimon Glass
Move sandbox over to use the reset uclass for reset, instead of a direct call to do_reset(). This allows us to add tests. Signed-off-by: Simon Glass <sjg@chromium.org>
2015-07-21sandbox: Support multiple reset typesSimon Glass
Add settings for the last reset generated, and the types of resets which are permitted. This will be used for testing. Signed-off-by: Simon Glass <sjg@chromium.org>
2015-06-11sandbox: Add an implementation for cleanup_before_linux_select()Simon Glass
Support this function so we can use Chrome OS verified boot with sandbox. Signed-off-by: Simon Glass <sjg@chromium.org>
2015-06-04sandbox: Tidy up terminal restoreSimon Glass
For some reason 'u-boot -D' does not restore the terminal correctly when the 'reset' command is used. Call the terminal restore function explicitly in this case. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
2015-05-15sandbox: Add missing errno.h includes in a few filesSimon Glass
These files use error numbering, so add the include. Signed-off-by: Simon Glass <sjg@chromium.org>
2015-05-15sandbox: Correct error handling in state_read_file()Simon Glass
This function should return a useful error for U-Boot, rather than -1. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
2015-05-06sandbox: Don't try distro_bootcmd by defaultSjoerd Simons
For the distro_bootcmds to succeed on the sandbox a bit of setup is required (e.g. network configured or host image bound), so running them by default isn't that useful. Add a -b/--boot command to the sandbox binary, which triggers the distro_bootcmds to run after the other command-line commands. Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk> Acked-by: Simon Glass <sjg@chromium.org>
2015-05-06dm: sandbox: Add os_localtime() to obtain the system timeSimon Glass
Add a function to read the system time into U-Boot. Signed-off-by: Simon Glass <sjg@chromium.org>
2015-05-06sandbox: Add test function to advance timeJoe Hershberger
Add a function that maintains an offset to include in the system timer values returned from the lib/time.c APIs. This will allow timeouts to be skipped instantly in tests Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
2015-04-23fdt: sandbox: Move setup code from board_f to fdtdecSimon Glass
We want to be able to set up the device tree in SPL, so move this code to a common place. Signed-off-by: Simon Glass <sjg@chromium.org>
2015-04-19sandbox: Split bootm code out into lib/bootmSjoerd Simons
Follow the convention of other architectures and move the platform specific linux bootm code into sandbox/lib/bootm.c. Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk> Acked-by: Simon Glass <sjg@chromium.org>
2015-04-18sandbox: eth: Add support for using the 'lo' interfaceJoe Hershberger
The 'lo' interface on Linux doesn't support thinks like ARP or link-layer access like we use to talk to a normal network interface. A higher-level network API must be used to access localhost. As written, this interface is limited to not supporting ICMP since the API doesn't allow the socket to be opened for all IP traffic and be able to receive at the same time. UDP is far more useful to test with, so it was selected over ICMP. Ping won't work, but things like TFTP should work. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2015-04-18sandbox: eth: Add a bridge to a real network for sandboxJoe Hershberger
Implement a bridge between U-Boot's network stack and Linux's raw packet API allowing the sandbox to send and receive packets using the host machine's network interface. This raw Ethernet API requires elevated privileges. You can either run as root, or you can add the capability needed like so: sudo /sbin/setcap "CAP_NET_RAW+ep" /path/to/u-boot Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2015-04-17dm: sandbox: pci: Add PCI support for sandboxSimon Glass
Add the required header information, device tree nodes and I/O accessor functions to support PCI on sandbox. All devices are emulated by drivers which can be added as required for testing or development. Signed-off-by: Simon Glass <sjg@chromium.org>
2015-02-15sandbox: Return '-c command' exit value as sandbox exit codeJoe Hershberger
When a command is passed into sandbox using the '-c' argument the command is run directly. This is most helpful when running tests (such as test-dm.sh). Previously the exit code was an unused enum. Change it to be the actual return code from the command so that the script calling sandbox can know if the command succeeded (tests passed). Also remove the now completely unused "exit_state" in sandbox. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Acked-by: Simon Glass <sjg@chromium.org>
2015-01-30sandbox: Add a -D option to use a default device treeSimon Glass
It is painful to specify the full path to the device tree with the -d option. It is normally kept in the same directory as U-Boot, so provide an option to use this by default. Signed-off-by: Simon Glass <sjg@chromium.org>
2014-11-27sandbox: Fix warnings in cpu.c and os.cSimon Glass
This fixes the following two problems: cppcheck reports: [arch/sandbox/cpu/start.c:132]: (error) Uninitialized variable: err [arch/sandbox/cpu/os.c:371]: (error) Memory leak: fname Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Wolfgang Denk <wd@denx.de>
2014-11-23sandbox: Prepare API change for files greater than 2GBSuriyan Ramasami
Change the internal sandbox functions to use loff_t for file offsets. Signed-off-by: Suriyan Ramasami <suriyan.r@gmail.com> Acked-by: Simon Glass <sjg@chromium.org>