aboutsummaryrefslogtreecommitdiff
path: root/arch/sandbox/include/asm
Commit message (Collapse)AuthorAgeFilesLines
* clk: Remove rfreeSean Anderson2024-01-291-8/+0
| | | | | | | | Nothing uses this function. Remove it. Since clk_free no longer does anything, just stub it out. Signed-off-by: Sean Anderson <seanga2@gmail.com> Link: https://lore.kernel.org/r/20231216193843.2463779-2-seanga2@gmail.com
* acpi: Write pointers to tables instead of addressesSimon Glass2024-01-071-0/+16
| | | | | | | | | | | | | | | | | | | | | | | Sandbox uses an API to map between addresses and pointers. This allows it to have (emulated) memory at zero and avoid arch-specific addressing details. It also allows memory-mapped peripherals to work. As an example, on many machines sandbox maps address 100 to pointer value 10000000. However this is not correct for ACPI, if sandbox starts another program (e.g EFI app) and passes it the tables. That app has no knowledge of sandbox's address mapping. So to make this work we want to store 10000000 as the value in the table. Add two new 'nomap' functions which clearly make this exeption to how sandbox works. This should allow EFI apps to access ACPI tables with sandbox, e.g. for testing purposes. Signed-off-by: Simon Glass <sjg@chromium.org> Suggested-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* sandbox: Add <linux/types.h> to asm/global_data.h and asm/io.hTom Rini2023-12-211-0/+2
| | | | | | | We need <linux/types.h> in these files as we reference Linux types. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com>
* sandbox: Audit config.h and common.h usageTom Rini2023-12-212-1/+2
| | | | | | | | Remove and replace common.h and config.h in sandbox when it's not needed and add some explicit includes where needed. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com>
* Merge tag 'v2024.01-rc5' into nextTom Rini2023-12-181-0/+1
|\ | | | | | | Prepare v2024.01-rc5
| * test: dm: clk_ccf: test ccf_clk_opsYang Xiwen2023-12-151-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Assign ccf_clk_ops to .ops of clk_ccf driver so that it can act as an clk provider. Also add "#clock-cells=<1>" to its device tree node. Add "i2c_root" to clk_test in the device tree and driver for testing. Get "i2c_root" clock in CCF unit tests and add tests for it. Signed-off-by: Yang Xiwen <forbidden405@outlook.com> Reviewed-by: Sean Anderson <seanga2@gmail.com> Link: https://lore.kernel.org/r/20231111-enable_count-v3-2-08a821892fa9@outlook.com
* | Merge patch series "Import "string" I/O functions from Linux"Tom Rini2023-11-281-14/+14
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | To quote the author: This series imports generic versions of ioread_rep/iowrite_rep and reads/writes from Linux. Some cleanup is done to make sure that all platforms have proper defines for implemented functions and there are no redefinitions.
| * | sandbox: move asm-generic include to the end of fileIgor Prusov2023-11-281-14/+14
| |/ | | | | | | | | | | | | | | | | Generic version of io.h should be included at the end of architecture-specific ones to make sure that arch implementations are used and to avoid redefinitions. Signed-off-by: Igor Prusov <ivprusov@salutedevices.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* | Merge patch series "nand: Add sandbox tests"Tom Rini2023-11-161-0/+1
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To quote the author: This series tests raw nand flash in sandbox and fixes various bugs discovered in the process. I've tried to do things in a contemporary manner, avoiding the (numerous) variations present on only a few boards. The test is pretty minimal. Future work could test the rest of the nand API as well as the MTD API. Bloat (for v1) at [1] (for boards with SPL_NAND_SUPPORT enabled). Almost everything grows by a few bytes due to nand_page_size. A few boards grow more, mostly those using nand_spl_loaders.c. CI at [2]. [1] https://gist.github.com/Forty-Bot/9694f3401893c9e706ccc374922de6c2 [2] https://source.denx.de/u-boot/custodians/u-boot-clk/-/pipelines/18443
| * | test: spl: Add a test for NANDSean Anderson2023-11-161-0/+1
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | Add a SPL test for the NAND load method. We use some different functions to do the writing from the main test since things like nand_write_skip_bad aren't available in SPL. We disable BBT scanning, since scan_bbt is only populated when not in SPL. We use nand_spl_loaders.c as it seems to be common to at least a few boards already. However, we do not use nand_spl_simple.c because it would require us to implement cmd_ctrl. The various nand load functions are adapted from omap_gpmc. However, they have been modified for simplicity/correctness. Signed-off-by: Sean Anderson <seanga2@gmail.com>
* | sandbox: Drop <common.h>Tom Rini2023-11-074-7/+0
| | | | | | | | | | | | None of these headers need <common.h> to be included, drop it. Signed-off-by: Tom Rini <trini@konsulko.com>
* | sandbox: Add <asm/barrier.h>Tom Rini2023-11-071-0/+3
|/ | | | | | | | Add a mostly empty asm/barrier.h file for sandbox where we define nop() to be an empty function. Reviewed-by: Sean Anderson <seanga2@gmail.com> Signed-off-by: Tom Rini <trini@konsulko.com>
* sandbox: add SCMI power domain protocol support for testingAKASHI Takahiro2023-10-241-0/+21
| | | | | | | | | SCMI power domain management protocol is supported on sandbox for test purpose. Add fake agent interfaces and associated power domain devices. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* test: spl: Add a test for the SPI load methodSean Anderson2023-10-171-0/+1
| | | | | | | | | | Add test for the SPI load method. This one is pretty straightforward. We can't enable FIT_EXTERNAL with LOAD_FIT_FULL because spl_spi_load_image doesn't know the total image size and has to guess from fdt_totalsize. This doesn't include external data, so loading it will fail. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* test: spl: Add a test for the NOR load methodSean Anderson2023-10-171-0/+1
| | | | | | | | | | | | | | | | Add a test for the NOR load method. Since NOR is memory-mapped we can substitute a buffer instead. The only major complication is testing LZMA decompression. It's too complex to implement LZMA compression in a test, and we have no in-tree compressor, so we just include some pre-compressed data. This data was generated through something like generate_data(plain, plain_size, "lzma") cat plain.dat | lzma | hexdump -C and was cleaned up further in my editor. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* test: spl: Add a test for the NET load methodSean Anderson2023-10-171-0/+1
| | | | | | | | | | | | | | | | | Add a test for loading U-Boot over TFTP. As with other sandbox net routines, we need to initialize our packets manually since things like net_set_ether and net_set_udp_header always use "our" addresses. We use BOOTP instead of DHCP, since DHCP has a tag/length-based format which is harder to parse. Our TFTP implementation doesn't define as many constants as I'd like, so I create some here. Note that the TFTP block size is one-based, but offsets are zero-based. In order to avoid address errors, we need to set up/define some additional address information settings. dram_init_banksize would be a good candidate for settig up bi_dram, but it gets called too late in board_init_r. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* test: dm: simplify SCMI unit test on sandboxAKASHI Takahiro2023-10-131-2/+4
| | | | | | | | | | | Adding SCMI base protocol makes it inconvenient to hold the agent instance (udevice) locally since the agent device will be re-created per each test. Just remove it and simplify the test flows. The test scenario is not changed at all. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
* firmware: scmi: support dummy channels for sandbox agentAKASHI Takahiro2023-10-131-0/+13
| | | | | | | | | In sandbox scmi agent, channels are not used at all. But in this patch, dummy channels are supported in order to test protocol-specific channels. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
* Record the position of the SMBIOS tablesSimon Glass2023-09-221-0/+1
| | | | | | | | Remember where these end up so that we can pass this information on to the EFI layer. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* arm_ffa: introduce sandbox FF-A supportAbdellatif El Khlifi2023-08-082-0/+193
| | | | | | | | | | | | | | | | | | | Emulate Secure World's FF-A ABIs and allow testing U-Boot FF-A support Features of the sandbox FF-A support: - Introduce an FF-A emulator - Introduce an FF-A device driver for FF-A comms with emulated Secure World - Provides test methods allowing to read the status of the inspected ABIs The sandbox FF-A emulator supports only 64-bit direct messaging. Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com> Reviewed-by: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com> Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org> Cc: Jens Wiklander <jens.wiklander@linaro.org> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
* Revert "Merge branch '2023-07-24-introduce-FF-A-suppport'"Tom Rini2023-07-242-193/+0
| | | | | | | | | This reverts commit d927d1a80843e1c3e2a3f0b8f6150790bef83da1, reversing changes made to c07ad9520c6190070513016fdb495d4703a4a853. These changes do not pass CI currently. Signed-off-by: Tom Rini <trini@konsulko.com>
* arm_ffa: introduce sandbox FF-A supportAbdellatif El Khlifi2023-07-242-0/+193
| | | | | | | | | | | | | | | | | | | Emulate Secure World's FF-A ABIs and allow testing U-Boot FF-A support Features of the sandbox FF-A support: - Introduce an FF-A emulator - Introduce an FF-A device driver for FF-A comms with emulated Secure World - Provides test methods allowing to read the status of the inspected ABIs The sandbox FF-A emulator supports only 64-bit direct messaging. Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com> Reviewed-by: Simon Glass <sjg@chromium.org> Cc: Tom Rini <trini@konsulko.com> Cc: Ilias Apalodimas <ilias.apalodimas@linaro.org> Cc: Jens Wiklander <jens.wiklander@linaro.org> Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
* sandbox: fix a compilation errorSergei Antonov2023-07-202-25/+23
| | | | | | | | | | | | | | | | | | | | | With sandbox and sandbox64 configurations: In file included from .../u-boot/include/test/test.h:156, from .../u-boot/include/test/lib.h:9, from .../u-boot/test/lib/test_crc8.c:8: .../u-boot/arch/sandbox/include/asm/test.h: In function ‘sandbox_sdl_set_bpp’: .../u-boot/arch/sandbox/include/asm/test.h:323:17: error: ‘ENOSYS’ undeclared (first use in this function) 323 | return -ENOSYS; | ^~~~~~ Per Tom Rini's suggestion: move that function prototype over to arch/sandbox/include/asm/sdl.h and make test/dm/video.c include <asm/sdl.h> Cc: Simon Glass <sjg@chromium.org> Suggested-by: Tom Rini <trini@konsulko.com> Signed-off-by: Sergei Antonov <saproj@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* x86: Record the start and end of the tablesSimon Glass2023-07-171-0/+4
| | | | | | | | | | | | | | | | The ACPI tables are special in that they are passed to EFI as a separate piece, independent of other tables. Also they can be spread over two areas of memory, e.g. with QEMU we end up with tables kept in high memory as well. Add new global_data fields to hold this information and update the bdinfo command to show the table areas. Move the rom_table_end variable into the loop that uses it. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* axi: fix definition of axi_sandbox_get_emul()Heinrich Schuchardt2023-06-011-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Compiling with gcc 13 results in an error: drivers/axi/axi-emul-uclass.c:16:5: warning: conflicting types for ‘axi_sandbox_get_emul’ due to enum/integer mismatch; have ‘int(struct udevice *, ulong, enum axi_size_t, struct udevice **)’ {aka ‘int(struct udevice *, long unsigned int, enum axi_size_t, struct udevice **)’} [-Wenum-int-mismatch] 16 | int axi_sandbox_get_emul(struct udevice *bus, ulong address, | ^~~~~~~~~~~~~~~~~~~~ In file included from drivers/axi/axi-emul-uclass.c:14: ./arch/sandbox/include/asm/axi.h:48:5: note: previous declaration of ‘axi_sandbox_get_emul’ with type ‘int(struct udevice *, ulong, uint, struct udevice **)’ {aka ‘int(struct udevice *, long unsigned int, unsigned int, struct udevice **)’} 48 | int axi_sandbox_get_emul(struct udevice *bus, ulong address, uint length, | ^~~~~~~~~~~~~~~~~~~~ Adjust the header definition to match the implementation. Define the size parameter as constant. Fixes: 9a8bcabd8ada ("axi: Add AXI sandbox driver and simple emulator") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* sandbox: correct posix_types.h defineHeinrich Schuchardt2023-04-281-3/+4
| | | | | | | | | | arch/arm/include/asm/posix_types.h and arch/sandbox/include/asm/posix_types.h should use different defines. Add SPDX header. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* sandbox: mark sandbox_exit() as no return.Heinrich Schuchardt2023-04-281-1/+1
| | | | | | | Fix a -Wimplicit-fallthrough warning in sandbox_sysreset_request(). Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* sandbox64: fix: return unsigned long in readq()Abdellatif El Khlifi2023-04-271-1/+1
| | | | | | | | | make readq return unsigned long readq should return 64-bit data Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* sandbox: video: Fix building without SDLSimon Glass2023-04-071-0/+8
| | | | | | | | | | | This is currently broken. If SDL is not installed, SANDBOX_SDL becomes false and build errors are generated, e.g.: test/dm/video.c:424: undefined reference to `sandbox_sdl_set_bpp' Fix it by making the function return an error in this case. Signed-off-by: Simon Glass <sjg@chromium.org>
* Merge tag 'v2023.04-rc4' into nextTom Rini2023-03-141-5/+1
|\ | | | | | | | | | | Prepare v2023.04-rc4 Signed-off-by: Tom Rini <trini@konsulko.com>
| * sandbox: Correctly define BITS_PER_LONGMichal Suchanek2023-03-011-5/+1
| | | | | | | | | | | | | | SANDBOX_BITS_PER_LONG is the number of bits in long on the sandbox platform. Signed-off-by: Michal Suchanek <msuchanek@suse.de>
* | sandbox: Tidy up RTC optionsSimon Glass2023-03-021-1/+1
|/ | | | | | | | At present we enable the sandbox RTC driver for all builds. Add a separate Kconfig option to control this, so that it can be disabled in TPL, where it is not needed. Signed-off-by: Simon Glass <sjg@chromium.org>
* sandbox: Allow SPI flash bootdevs to be disabled for testsSimon Glass2023-01-232-0/+15
| | | | | | | | Most tests don't want these and they can create a lot of noise. Add a way to disable them. Use that in tests, with a flag provided to enable them for tests that need this feature. Signed-off-by: Simon Glass <sjg@chromium.org>
* sandbox: Allow ethernet to be disabled at runtimeSimon Glass2023-01-232-0/+17
| | | | | | | For bootstd tests it is seldom useful to have ethernet enabled. Add a way to disable it, so that ethernet operations like tftpboot do nothing. Signed-off-by: Simon Glass <sjg@chromium.org>
* sandbox: Finish migration to KconfigTom Rini2022-12-221-10/+0
| | | | | | | | | | Stop using CONFIG_SANDBOX_ARCH and use CONFIG_SANDBOX instead. For the SPI related defines, set them directly in Kconfig. This now empties arch/sandbox/include/asm/config.h. Cc: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* test: test sandbox sound driver more rigorouslyHeinrich Schuchardt2022-12-051-0/+10
| | | | | | | | | | | | | | Consider unexpected values for frequency: * negative frequency * zero frequency * frequency exceeding sampling frequency As in these cases the sum of the samples is zero also check the count of the samples. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* vbe: Support reading the next SPL phase via VBESimon Glass2022-10-311-0/+1
| | | | | | | Add an SPL loader to obtain the next-phase binary from a FIT provided by the VBE driver. Signed-off-by: Simon Glass <sjg@chromium.org>
* sandbox: Add a way to specify the sandbox executableSimon Glass2022-10-311-1/+2
| | | | | | | | At present the sandbox executable is assumed to be arg[0] but this only works for a single jump (e.g. from SPL to U-Boot). Add a new arg to solve this issue, along with a detailed comment. Signed-off-by: Simon Glass <sjg@chromium.org>
* sandbox: Generalise SPL bootingSimon Glass2022-10-311-0/+3
| | | | | | | | | | | | At present sandbox only supports jumping to a file, to get to the next U-Boot phase. We want to support other methods, so update the code to use an enum for the method. Also use the Use board_boot_order() to set the order, so we can add more options. Also add the MMC methods into the BOOT_DEVICE enum so that booting from MMC can be supported. Signed-off-by: Simon Glass <sjg@chromium.org>
* sandbox: Support setting up the other FDT for testingSimon Glass2022-09-291-0/+19
| | | | | | | | | | | | | Provide a way to copy over the 'other' FDT when running tests. This loads it and allocates memory for the copy, if not done already, then does the copy. Avoid using U-Boot's malloc() pool for these copies, at least for now, since they are part of the test system. Tidy up the cpu.c header files while here. Signed-off-by: Simon Glass <sjg@chromium.org>
* sandbox: Support loading the other FDTSimon Glass2022-09-291-0/+16
| | | | | | | | | We need an 'other' FDT which is different from the control FDT, so we can check that the ofnode tests correctly handle them both. Add this to the build along with a way to read it into the sandbox state. Signed-off-by: Simon Glass <sjg@chromium.org>
* sandbox: Add a function to load a relative file pathSimon Glass2022-09-291-0/+14
| | | | | | | | | | | | At present this implementation is specific to loading the test FDT. We plan to load others, so create a generic function to handle this. The path is now limited to 256 characters, to simplify the code. When there is an empty argv[0] (which should not happen), the function now just uses the path as is, with no prefix. Signed-off-by: Simon Glass <sjg@chromium.org>
* test: Support testing malloc() failuresSimon Glass2022-09-291-0/+1
| | | | | | | | | | | | It is helpful to test that out-of-memory checks work correctly in code that calls malloc(). Add a simple way to force failure after a given number of malloc() calls. Fix a header guard to avoid a build error on sandbox_vpl. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Sean Anderson <seanga2@gmail.com>
* bootstd: Allow EFI bootmgr to support an invalid bootflowSimon Glass2022-08-121-0/+11
| | | | | | | | | For most testing we don't want this bootmeth to actually do anything. For the one test where we do, add a test hook to obtain the correct behaviour. This will allow us to bind the device always, rather than just doing it for this test. Signed-off-by: Simon Glass <sjg@chromium.org>
* Merge branch 'next'Tom Rini2022-07-115-5/+46
|\
| * sandbox: Add libfuzzer integrationAndrew Scull2022-06-231-0/+25
| | | | | | | | | | | | | | | | | | Add an implementation of LLVMFuzzerTestOneInput() that starts the sandbox on a secondary thread and exposes a function to synchronize the generation of fuzzing inputs with their consumption by the sandbox. Signed-off-by: Andrew Scull <ascull@google.com> Reviewed-by: Simon Glass <sjg@chromium.org>
| * sandbox: Decouple program entry from sandbox initAndrew Scull2022-06-231-0/+18
| | | | | | | | | | | | | | | | Move the program's entry point to os.c, in preparation for a separate fuzzing entry point to be added. Signed-off-by: Andrew Scull <ascull@google.com> Reviewed-by: Simon Glass <sjg@chromium.org>
| * sandbox: Rename getopt sectionsAndrew Scull2022-06-232-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Rename the sections used for defining sandbox command line options so that they don't start with a '.'. ELF says that sections starting with a '.' are reserved for system use, but the sandbox runs as a normal user process so should be using user sections instead. Clang's ASAN adds redzones to non-user sections and the extra padding meant that the list of options was being corrupted. Naming the sections as user sections avoids this issue as clang handles them as we intended. Signed-off-by: Andrew Scull <ascull@google.com>
| * spl: Remove CONFIG_SPL_BOARD_LOAD_IMAGETom Rini2022-06-061-2/+0
| | | | | | | | | | | | | | This symbol has been unused in code for some time now, remove the final references. Signed-off-by: Tom Rini <trini@konsulko.com>
* | sandbox: sdl: Add stub sandbox_sdl_remove_display()Andrew Scull2022-06-251-0/+5
|/ | | | | | | | | | | Building the sandbox with NO_SDL=1 resulted in an undefined reference to 'sandbox_sdl_remove_display'. Resolve this by adding a stub implementation to match the stubs of the other similar functions. Signed-off-by: Andrew Scull <ascull@google.com> Cc: Simon Glass <sjg@chromium.org> Cc: Anatolij Gustschin <agust@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org>