aboutsummaryrefslogtreecommitdiff
path: root/arch/sandbox
AgeCommit message (Collapse)AuthorFilesLines
2022-07-11Merge branch 'next'Tom Rini16-50/+215
2022-06-28sandbox: raise SANDBOX_RAM_SIZE_MB default to 256Heinrich Schuchardt1-2/+2
The UEFI Self Certification Test (SCT) cannot run on 128 MiB. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-06-28sandbox: show error if the device-tree cannot be loadedHeinrich Schuchardt1-4/+4
U-Boot's printf() used before setting up U-Boot's serial driver does not create any output. Use os_printf() for error messages related to loading the device-tree. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-06-28sandbox: add function os_printf()Heinrich Schuchardt1-0/+13
Before setting up the devices U-Boot's printf() function cannot be used for console output. Provide function os_printf() to print to stderr. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-06-25sandbox: sdl: Add stub sandbox_sdl_remove_display()Andrew Scull1-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>
2022-06-23sandbox: Implement fuzzing engine driverAndrew Scull1-0/+4
Add a fuzzing engine driver for the sandbox to take inputs from libfuzzer and expose them to the fuzz tests. Signed-off-by: Andrew Scull <ascull@google.com>
2022-06-23sandbox: Add libfuzzer integrationAndrew Scull3-0/+98
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>
2022-06-23sandbox: Decouple program entry from sandbox initAndrew Scull3-1/+25
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>
2022-06-23sandbox: Add support for Address SanitizerAndrew Scull1-2/+12
Add CONFIG_ASAN to build with the Address Sanitizer. This only works with the sandbox so the config is likewise dependent. The resulting executable will have ASAN instrumentation, including the leak detector that can be disabled with the ASAN_OPTIONS environment variable: ASAN_OPTIONS=detect_leaks=0 ./u-boot Since u-boot uses its own dlmalloc, dynamic allocations aren't automatically instrumented, but stack variables and globals are. Instrumentation could be added to dlmalloc to poison and unpoison memory as it is allocated and deallocated, and to introduce redzones between allocations. Alternatively, the sandbox may be able to play games with the system allocator and somehow still keep the required memory abstraction. No effort to address dynamic allocation is made by this patch. The config is not yet enabled for any targets by default. Signed-off-by: Andrew Scull <ascull@google.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-06-23linker_lists: Rename sections to remove . prefixAndrew Scull3-6/+6
Rename the sections used to implement linker lists so they begin with '__u_boot_list' rather than '.u_boot_list'. The double underscore at the start is still distinct from the single underscore used by the symbol names. Having a '.' in the section names conflicts with clang's ASAN instrumentation which tries to add redzones between the linker list elements, causing expected accesses to fail. However, clang doesn't try to add redzones to user sections, which are names with all alphanumeric and underscore characters. Signed-off-by: Andrew Scull <ascull@google.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-06-23sandbox: Rename getopt sectionsAndrew Scull4-9/+9
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>
2022-06-23sandbox: Rename EFI runtime sectionsAndrew Scull2-16/+14
Rename the sections used for placing the EFI runtime 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>
2022-06-08test: Load mac address using misc deviceWIP/2022-06-08-add-support-for-nvmem-apiSean Anderson1-1/+8
This loads a mac address using a misc device using the nvmem interface. Signed-off-by: Sean Anderson <sean.anderson@seco.com>
2022-06-08test: Load mac address using RTCSean Anderson1-1/+8
This uses the nvmem API to load a mac address from an RTC. Signed-off-by: Sean Anderson <sean.anderson@seco.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-06-08test: Load mac address with i2c eepromSean Anderson1-1/+8
This uses an i2c eeprom to load a mac address using the nvmem interface. Enable I2C_EEPROM for sandbox SPL since it is the only sandbox config which doesn't enable it eeprom. Signed-off-by: Sean Anderson <sean.anderson@seco.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-06-08sandbox: Move some mac addresses to device treeSean Anderson1-0/+4
This prevents some conflicts when running sandbox with -D, since the "rom" mac address will be random and won't match the environment. We still need to keep addresses for eth1 and eth6 in the environment, because dm_test_eth_rotate expects to be able to disable them by removing their envaddr variables. This can likely be fixed in a future series by adding a function to cause sandbox eth_opts callback for a particular mac to fail immediately. Signed-off-by: Sean Anderson <sean.anderson@seco.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-06-08sandbox: net: Remove fake-host-hwaddrSean Anderson3-8/+0
Instead of reading a pseudo-rom mac address from the device tree, just use whatever we get from write_hwaddr. This has the effect of using the mac address from the environment (or from the device tree, if it is specified). Signed-off-by: Sean Anderson <sean.anderson@seco.com> Reviewed-by: Simon Glass <sjg@chromium.org> Acked-by: Ramon Fried <rfried.dev@gmail.com>
2022-06-08sandbox: net: Add aliases for ethernet devicesSean Anderson1-0/+3
Commit f3dd213e15 ("net: introduce helpers to get PHY ofnode from MAC") changed the ethernet sequence assignment from uclass 36: ethernet 0 * eth@10002000 @ 05813460, seq 0 1 * eth@10003000 @ 05813550, seq 5 2 * sbe5 @ 05813640, seq 3 3 * eth@10004000 @ 05813730, seq 6 4 * dsa-test-eth @ 05813820, seq 4 5 * lan0 @ 05813a30, seq 2 6 * lan1 @ 05813b50, seq 7 to uclass 36: ethernet 0 * eth@10002000 @ 03813630, seq 0 1 * eth@10003000 @ 03813720, seq 5 2 * sbe5 @ 03813810, seq 3 3 * eth@10004000 @ 03813900, seq 6 4 phy-test-eth @ 038139f0, seq 7 5 * dsa-test-eth @ 03813ae0, seq 4 6 * lan0 @ 03813cf0, seq 2 7 * lan1 @ 03813e10, seq 8 This caused the mac address assignment to switch around. Avoid this in the future by assigning aliases for all ethernet devices. This reverts the sequence to what it was before the aformentioned commit (with phy-test-eth as seq 8). There is no ethernet1 for whatever reason. Signed-off-by: Sean Anderson <sean.anderson@seco.com>
2022-06-06spl: Remove CONFIG_SPL_BOARD_LOAD_IMAGETom Rini1-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>
2022-05-05sandbox: Avoid binman error when run without device treeSimon Glass1-1/+26
With sandbox, U-Boot can be run without a device tree (i.e. no -d or -T parameter). In this case an empty device tree is created for convenience. With a recent change this causes an error due to the missing '/binman' node. Add this node to avoid the problem, as well as a test that U-Boot can be run without a device tree. Fixes: 059df5624b ("arch: Kconfig: imply BINMAN for SANDBOX") Fixes: https://source.denx.de/u-boot/u-boot/-/issues/11 Signed-off-by: Simon Glass <sjg@chromium.org>
2022-05-03test: pci: Test PCI address conversion functionsAndrew Scull1-1/+1
Add tests for the functions dm_pci_bus_to_phys() and dm_pci_phys_to_bus() which convert between PCI bus addresses and physical addresses based on the ranges declared for the PCI controller. The ranges of bus#1 are used for the tests, adding a translation to one of the ranges to cover more cases. Signed-off-by: Andrew Scull <ascull@google.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2022-05-02sandbox: Add a build for VPLSimon Glass3-7/+23
Add an initial VPL build for sandbox. This includes the flow: TPL (with of-platdata) -> VPL -> SPL -> U-Boot To run it: ./tpl/u-boot-tpl -D The -D is needed to get the default device tree, which includes the serial console info. Add a Makefile check for OF_HOSTFILE which is the option that enables devicetree control on sandbox. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25bootstd: Add tests for bootstd including all uclassesSimon Glass1-0/+18
Add a set of combined tests for the bootdev, bootflow and bootmeth commands, along with associated functionality. Expand the sandbox console-recording limit so that these can work. These tests rely on a filesystem script which is not yet added to the Python tests. It is included here as a shell script. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-25bootstd: sandbox: Add a hostfs bootdevSimon Glass2-0/+9
It is helpful to be able to try out bootstd on sandbox, using host files. This is easier than using a block device, which must have a filesystem, partition table, etc. Add a new driver which provides this feature. For now it is not used in tests, but it is likely to be useful. Add notes in the devicetree also, but don't disturb the tests. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-18sandbox: Align linker lists to a 32-byte boundarySimon Glass2-2/+2
Use this larger boundary to ensure that linker lists at least start on the maximum possible alignment boundary. See also the CONFIG_LINKER_LIST_ALIGN setting, but that is host-arch-specific, so it seems better to use the largest value for every host architecture. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-18sandbox: Allow link flags to be givenSimon Glass1-2/+2
At present the link flags are not used for sandbox. Update the command line to use them. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-18sandbox: Correct loss of early output in SPLSimon Glass1-1/+1
At present fputc() is used before the console is available, then write() is used. These are not compatible. Since fputc() buffers internally it is better to use the write(), so that a partial line is immediately displayed. This has a slight effect on performance, but we are already using write() for the vast majority of the output with no obvious impacts. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-04-15Merge branch 'next' of https://source.denx.de/u-boot/custodians/u-boot-netTom Rini1-0/+14
- DM9000 DM support - tftp server bug fix - mdio ofnode support functions - Various phy fixes and improvements. [trini: Fixup merge conflicts in drivers/net/phy/ethernet_id.c drivers/net/phy/phy.c include/phy.h]
2022-04-14Remove duplication of table_compute_checksum functionTom Rini1-0/+0
It seems like there was some merge error when first cleaning up and sharing this function. We have both an inline version of the function in include/tables_csum.h and a non-inline version in lib/tables_csum.c. Rework things so that we only have the non-inline version (due to number of calls, we should not inline this). Fixes: 1befb38b8682 ("x86: Move table csum into separate file") Fixes: 2b445e4d3194 ("x86: Move table csum into separate header") Cc: Alexander Graf <agraf@csgraf.de> Signed-off-by: Tom Rini <trini@konsulko.com>
2022-04-14test: serial: Add test for putc/putsSean Anderson1-0/+22
This adds a test to ensure that puts is equivalent to putc called in a loop. We don't verify the contents of the message to avoid having to record console output a second time (though that could be added in the future). The globals are initialized to non-zero values to avoid a warning; in particular, the character count is off-by-one (but we always make relative measurements). Signed-off-by: Sean Anderson <sean.anderson@seco.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-04-10net: introduce helpers to get PHY interface mode from a device/ofnodeMarek Behún1-0/+1
Add helpers ofnode_read_phy_mode() and dev_read_phy_mode() to parse the "phy-mode" / "phy-connection-type" property. Add corresponding UT test. Use them treewide. This allows us to inline the phy_get_interface_by_name() into ofnode_read_phy_mode(), since the former is not used anymore. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Tested-by: Patrice Chotard <patrice.chotard@foss.st.com>
2022-04-10net: introduce helpers to get PHY ofnode from MACMarek Behún1-0/+13
Add helpers ofnode_get_phy_node() and dev_get_phy_node() and use it in net/mdio-uclass.c function dm_eth_connect_phy_handle(). Also add corresponding UT test. This is useful because other part's of U-Boot may want to get PHY ofnode without connecting a PHY. Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-03-31arch: Kconfig: imply BINMAN for SANDBOXPhilippe Reynes2-0/+6
To be able to use the tool binman on sandbox, the config SANDBOX should imply BINMAN. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
2022-03-25sandbox: video: Replace PCI_CLASS_* macros by one from pci_ids.hPali Rohár1-2/+3
Replace old macros PCI_CLASS_CODE_COMM and PCI_CLASS_SUB_CODE_COMM_SERIAL by new macros defined in pci_ids.h. Old macros would be deleted in followup commit. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de>
2022-03-18sandbox: Add the handoff header for splSimon Glass1-0/+1
This defines a function declared in handoff.h so add the header. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-03-18sandbox: Show a message when writing out the ram bufferSimon Glass1-1/+2
If state is not being written, but RAM is, we should still show a message, so it is clear that this is happening. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-03-10event: Convert misc_init_f() to use eventsSimon Glass1-1/+3
This hook can be implmented using events, for the three boards that actually use it. Add the event type and event handlers. Drop CONFIG_MISC_INIT_F since we can just use CONFIG_EVENT to control this. Since sandbox always enables CONFIG_EVENT, we can drop the defconfig lines there too. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-03-10sandbox: start: Sort the header filesSimon Glass1-2/+2
These header files don't follow the correct order. Fix this. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-03-02firmware: scmi: fix sandbox and related tests for clock discoveryEtienne Carriere2-2/+1
Updates sandbox SCMI clock driver and tests since enabling CCF will mandate clock discovery that is all exposed SCMI clocks shall be discovered at initialization. For this reason, sandbox SCMI clock driver must emulate all clocks exposed by SCMI server, not only those effectively consumed by some other U-Boot devices. Therefore the sandbox SCMI test driver exposes 3 clocks (IDs 0, 1 and 2) and sandbox SCMI clock consumer driver gets 2 of them. Cc: Simon Glass <sjg@chromium.org> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
2022-03-02sandbox: scmi: test against a single scmi agentEtienne Carriere2-32/+17
As per DT bindings since Linux kernel v5.14, the device tree can define only 1 SCMI agent node that is named scmi [1]. As a consequence, change implementation of the SCMI driver test through sandbox architecture to reflect that. This change updates sandbox test DT and sandbox SCMI driver accordingly since all these are impacted. Cc: Simon Glass <sjg@chromium.org> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
2022-02-11acpi: Move acpi_write_tables() to a generic headerSimon Glass1-1/+1
This function is used by both x86 and sandbox. Put it in a common header file. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-09sandbox: fix build failure with musl and SDLHeinrich Schuchardt2-3/+15
sdl.c is compiled against the SDL library. Trying to redefine wchar_t with -fshort-wchar is not necessary and leads to build failures when compiling against musl. Cc: Milan P. Stanić <mps@arvanta.net> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-02-09dts: automatically build necessary .dtb filesRasmus Villemoes1-0/+2
When building for a custom board, it is quite common to maintain a private branch which include some defconfig and .dts files. But to hook up those .dts files requires modifying a file "belonging" to upstream U-Boot, the arch/*/dts/Makefile. Forward-porting that branch to a newer upstream then often results in a conflict which, while it is trivial to resolve by hand, makes it harder to have a CI do "try to build our board against latest upstream". The .config usually includes information on precisely what .dtb(s) are needed, so to avoid having to modify the Makefile, simply add the files in (SPL_)OF_LIST to dtb-y. A technicality is that (SPL_)OF_LIST is not always defined, so rework the Kconfig symbols so that (SPL_)OF_LIST is always defined (when (SPL_)OF_CONTROL), but only prompted for in the cases which used to be their "depends on". nios2 and microblaze already have something like this in their dts/Makefile, and the rationale in commit 41f59f68539 is similar to the above. So this simply generalizes existing practice. Followup patches could remove the logic in those two makefiles, just as there's potential for moving some common boilerplate from all the arch/*/dts/Makefile files to the new scripts/Makefile.dts. Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-01-25sandbox: eth-raw: fix building with musl libraryHeinrich Schuchardt1-0/+2
The definition of struct udphdr in include netinet/udp.h in the musl library differs from the definition in the glibc library. To use the same definition with musl the symbol _GNU_SOURCE has to be defined. Reported-by: Milan P. Stanić <mps@arvanta.net> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Tested-by: Milan P. Stanić <mps@arvanta.net>
2022-01-25sandbox: Allow building with GENERATE_ACPI_TABLESimon Glass2-0/+2
At present this option is missing a header file, a function prototype and the qfw driver needs a header included. Fix these problems so we can enable this option on sandbox. This will increase the build coverage. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25x86: Move the acpi table to generic global_dataSimon Glass1-1/+0
Allow this to be used on any arch. Also convert to using macros so that we can check the CONFIG option in C code. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-19doc: replace @return by Return:Heinrich Schuchardt9-45/+45
Sphinx expects Return: and not @return to indicate a return value. find . -name '*.c' -exec \ sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \; find . -name '*.h' -exec \ sed -i 's/^\(\s\)\*\(\s*\)@return\(\s\)/\1*\2Return:\3/' {} \; Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-01-13sandbox: compatibility of os_get_filesize()Heinrich Schuchardt1-2/+8
U-Boot define loff_t as long long. But the header /usr/include/linux/types.h may not define it. This has lead to a build error on Alpine Linux. So let's use long long instead of loff_t for the size parameter of function os_get_filesize(). Reported-by: Milan P. Stanić <mps@arvanta.net> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Tested-by: Milan P. Stanić <mps@arvanta.net> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-12-28Merge tag 'video-next-20211228' of ↵WIP/28Dec2021-nextTom Rini3-11/+112
https://source.denx.de/u-boot/custodians/u-boot-video into next - various fixes to the sandbox display support - support for showing a logo without splash screen config - support for BMP drawing to depths other than 16bpp - tests for the different types of supported BMP images - support showing a logo when running coreboot via qemu
2021-12-27Convert CONFIG_ARCH_MAP_SYSMEM to KconfigTom Rini1-3/+0
This converts the following to Kconfig: CONFIG_ARCH_MAP_SYSMEM Signed-off-by: Tom Rini <trini@konsulko.com>