summaryrefslogtreecommitdiffstats
path: root/arch/sandbox
Commit message (Collapse)AuthorAgeFilesLines
...
| * sandbox: sdl: Move to use SDL2Simon Glass2020-02-052-125/+156
| | | | | | | | | | | | | | | | | | | | Sandbox currently uses SDL1.2. SDL2 has been around for quite a while and is widely supported. It has a number of useful features. It seems appropriate to move sandbox over. Update the code to use SDL2 instead of SDL1.2. Signed-off-by: Simon Glass <sjg@chromium.org>
| * sandbox: sdl: Support waiting for audio to completeSimon Glass2020-02-051-2/+13
| | | | | | | | | | | | | | | | | | At present when audio stops, any in-progress output is cut off. Fix this by waiting for output to finish. Also use booleans for the boolean variables. Signed-off-by: Simon Glass <sjg@chromium.org>
| * sandbox: sdl: Improve error handlingSimon Glass2020-02-051-5/+9
| | | | | | | | | | | | | | A few errors are not checked. Fix these and use my preferred spelling for init. Signed-off-by: Simon Glass <sjg@chromium.org>
| * sandbox: Add comments to the sdl structSimon Glass2020-02-051-1/+16
| | | | | | | | | | | | Add comments for each struct member. Drop frequency since it is not used. Signed-off-by: Simon Glass <sjg@chromium.org>
| * sound: Add a new stop_play() methodSimon Glass2020-02-051-0/+7
| | | | | | | | | | | | | | | | | | | | | | At present there is no positive indication that U-Boot has finished sending sound data. This means that it is not possible to power down an audio codec, for example. Add a new method that is called once all sound data has been sent. Add a new method for this, called when the sound_play() call is done. Signed-off-by: Simon Glass <sjg@chromium.org>
| * sandbox: Add a new header for the system malloc()Simon Glass2020-02-053-11/+38
| | | | | | | | | | | | | | | | Some files use U-Boot headers but still need to access the system malloc(). Allow this by creating a new asm/malloc.h which can be used so long as U-Boot's malloc.h has not been included. Signed-off-by: Simon Glass <sjg@chromium.org>
| * sandbox: Ensure that long-options array is terminatedSimon Glass2020-02-051-1/+2
| | | | | | | | | | | | | | The last member of this array is supposed to be all zeroes according to the getopt_long() man page. Fix the function to do this. Signed-off-by: Simon Glass <sjg@chromium.org>
| * sandbox: Drop os_realloc()Simon Glass2020-02-051-23/+0
| | | | | | | | | | | | Due to recent changes this function is no-longer used. Drop it. Signed-off-by: Simon Glass <sjg@chromium.org>
| * sandbox: Drop use of special os_malloc() where possibleSimon Glass2020-02-052-15/+15
| | | | | | | | | | | | | | | | | | | | | | Some sandbox files are not built with U-Boot headers, so with the renamed malloc functions there is now no need to use the special os_... allocation functions to access the system routines. Instead we can just call them directly. Update the affected files accordingly. Signed-off-by: Simon Glass <sjg@chromium.org>
| * sandbox: Rename 'free' variableSimon Glass2020-02-051-3/+3
| | | | | | | | | | | | | | This name conflicts with our desire to #define free() to something else on sandbox. Rename it. Signed-off-by: Simon Glass <sjg@chromium.org>
| * sandbox: Sort the help optionsSimon Glass2020-02-051-1/+45
| | | | | | | | | | | | | | | | At present options are presented in essentially random order. It is easier to browse them if they are sorted into alphabetical order. Adjust the help function to handle this. Signed-off-by: Simon Glass <sjg@chromium.org>
| * cli: Make the sandbox board_run_command the defaultSean Anderson2020-02-051-7/+0
| | | | | | | | | | | | | | | | If CONFIG_CMDLINE=n, common/cli.c calls board_run_command. This fails to link on most architectures. However, the sandbox architecture has an implementation which we can use. Signed-off-by: Sean Anderson <seanga2@gmail.com>
| * dm: core: Add ofnode_get_chosen_prop()Simon Glass2020-02-051-0/+1
| | | | | | | | | | | | | | Add a function to read a property from the chosen node, providing access to its length. Update ofnode_get_chosen_string() to make use of it. Signed-off-by: Simon Glass <sjg@chromium.org>
| * dm: core: Rename ofnode_get_chosen_prop()Simon Glass2020-02-051-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | This function is actually intended to read a string rather than a property. All of its current callers use it that way. Also there is no way to return the length of the property from this function. Rename it to better indicate its purpose, using ofnode_read as the prefix since this matches most other functions. Also add some tests which are missing for these functions. Signed-off-by: Simon Glass <sjg@chromium.org>
* | dm: irq: Add support for requesting interruptsSimon Glass2020-02-071-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At present driver model supports the IRQ uclass but there is no way to request a particular interrupt for a driver. Add a mechanism, similar to clock and reset, to read the interrupts required by a device from the device tree and to request those interrupts. U-Boot itself does not have interrupt-driven handlers, so just provide a means to read and clear an interrupt. This can be useful to handle peripherals which must use an interrupt to determine when data is available, for example. Bring over the basic binding file as well, from Linux v5.4. Note that the older binding is not supported in U-Boot; the newer 'special form' must be used. Add a simple test of the new functionality. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* | dm: irq: Add support for interrupt controller typesSimon Glass2020-02-071-0/+4
|/ | | | | | | | | | | | | | | | | | | There can be different types of interrupt controllers in a system and some drivers may need to distinguish between these. In general this can be handled using the device tree by adding the interrupt information to device nodes. However on x86 devices we have interrupt controllers which are not tied to any particular device and not really used in U-Boot. These still need to be inited, so a convenient method is to give each controller a type and allow a particular controller type to be probed. Add support for this in sandbox along with a test. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> [bmeng: remove the new bland line at EOF of test/dm/irq.c] Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
* common: Move hang() to the same header as panic()Simon Glass2020-01-171-0/+1
| | | | | | | | | | At present panic() is in the vsprintf.h header file. That does not seem like an obvious choice for hang(), even though it relates to panic(). So let's put hang() in its own header. Signed-off-by: Simon Glass <sjg@chromium.org> [trini: Migrate a few more files] Signed-off-by: Tom Rini <trini@konsulko.com>
* Merge tag 'dm-pull-8jan20' of git://git.denx.de/u-boot-dmTom Rini2020-01-091-0/+4
|\ | | | | | | dm: Increased separation of ofdata_to_platdata() and probe methods
| * dm: test: Add a test driver for devresSimon Glass2020-01-071-0/+4
| | | | | | | | | | | | | | Add a driver which does devres allocations so that we can write tests for devres. Signed-off-by: Simon Glass <sjg@chromium.org>
* | sandbox: rng: Add a random number generator(rng) driverSughosh Ganu2020-01-071-0/+4
|/ | | | | | | | | Add a sandbox driver for random number generation. Mostly aimed at providing a unit test for rng uclass. Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org> Reviewed-by: Patrice Chotard <patrice.chotard@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* Merge branch 'next' of https://gitlab.denx.de/u-boot/custodians/u-boot-x86 ↵Tom Rini2019-12-184-0/+48
|\ | | | | | | | | | | | | | | | | | | | | into next - Various x86 common codes updated for TPL/SPL - I2C designware driver updated for PCI - ICH SPI driver updated to support Apollo Lake - Add Intel FSP2 base support - Intel Apollo Lake platform specific drivers support - Add a new board Google Chromebook Coral
| * sandbox: Add a test for IRQSimon Glass2019-12-151-0/+4
| | | | | | | | | | | | | | Add a simple sandbox test for this uclass. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
| * sandbox: Add PCI driver and test for p2sbSimon Glass2019-12-152-0/+14
| | | | | | | | | | | | | | | | Add a sandbox driver and PCI-device emulator for p2sb. Also add a test which uses a simple 'adder' driver to test the p2sb functionality. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
| * sandbox: Disable mmio by default in testsSimon Glass2019-12-151-0/+1
| | | | | | | | | | | | | | | | When reseting sandbox for tests, disable mmio support since that is the default state. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
| * x86: sandbox: Add a PMC emulator and testSimon Glass2019-12-153-0/+29
| | | | | | | | | | | | | | Add a simple PMC for sandbox to permit tests to run. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* | dm: i2c: EEPROM simulator add tests for addr offset maskRobert Beckett2019-12-171-0/+3
| | | | | | | | | | | | | | | | Add support for setting the chip address offset mask to EEPROM sumulator and add tests to test it. Signed-off-by: Robert Beckett <bob.beckett@collabora.com> Reviewed-by: Heiko Schocher <hs@denx.de>
* | dm: i2c: EEPROM simulator allow tests visibility of addr and offsetRobert Beckett2019-12-171-0/+4
|/ | | | | | | | | | | Improve i2c EEPROM simulator testing by providing access functions to check the previous chip addr and offset. Given that we can now directly test the offsets, also simplified the offset mapping and allow for wrapping acceses. Signed-off-by: Robert Beckett <bob.beckett@collabora.com> Reviewed-by: Heiko Schocher <hs@denx.de>
* sandbox: add missing compatible property in device treeHeinrich Schuchardt2019-12-102-0/+2
| | | | | | | | | In the device tree UEFI unit test the compatible property of the device is read. Provide the missing property. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* common: Move command functions out of common.hSimon Glass2019-12-021-0/+1
| | | | | | | Move these functions into the command.h header file which is a better fit. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
* common: Move interrupt functions into a new headerSimon Glass2019-12-021-0/+1
| | | | | | | | | | | | These functions do not use driver model but are fairly widely used in U-Boot. But it is not clear that they will use driver model anytime soon, so we don't want to label them as 'legacy'. Move them to a new irq_func.h header file. Avoid the name 'irq.h' since it is widely used in U-Boot already. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
* common: Move ARM cache operations out of common.hSimon Glass2019-12-021-0/+1
| | | | | | | | | These functions are CPU-related and do not use driver model. Move them to cpu_func.h Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com> Reviewed-by: Tom Rini <trini@konsulko.com>
* Merge tag 'dm-pull-14nov19' of git://git.denx.de/u-boot-dmTom Rini2019-11-171-2/+2
|\ | | | | | | | | | | Add OP-TEE test swuit Fix patman cc_file output Minor sandbox/pinctrl changes
| * sandbox: use correct type reading /proc/self/mapsHeinrich Schuchardt2019-11-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Compiling arch/sandbox/cpu/os.c results in an error ../arch/sandbox/cpu/os.c: In function ‘os_find_text_base’: ../arch/sandbox/cpu/os.c:823:12: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] 823 | base = (void *)addr; | ^ cc1: all warnings being treated as errors The size of void* differs from that of unsigned long long on 32bit systems. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
* | Merge tag 'efi-2020-01-rc3' of ↵Tom Rini2019-11-143-0/+92
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | https://gitlab.denx.de/u-boot/custodians/u-boot-efi Pull request for UEFI sub-system for efi-2020-01-rc3 The following changes for the UEFI subsystem are provided: * allow building UEFI binaries on the sandbox * enable access to file systems without partition tables * correctly check the return value of efi_dp_from_file()
| * efi_loader: support building UEFI binaries on sandboxHeinrich Schuchardt2019-11-123-0/+92
|/ | | | | | | | | | On the sandbox the UEFI binaries must match the host architectures. Adjust the Makefiles. Provide the PE/COFF header and relocation files. Allow building helloworld.efi on the sandbox. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* Merge tag 'dm-pull-29oct19' of git://git.denx.de/u-boot-dmTom Rini2019-11-013-8/+17
|\ | | | | | | | | | | - Fix for patman with email addresses containing commas - Bootstage improvements for TPL, SPL - Various sandbox and dm improvements and fixes
| * sandbox: test: Add a prototype for sandbox_set_enable_memio()Simon Glass2019-10-271-0/+11
| | | | | | | | | | | | | | This function needs a prototype so that tests can use it. Add one. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
| * sandbox: Drop 'const' from sandbox_write()Simon Glass2019-10-272-8/+6
| | | | | | | | | | | | | | | | This function writes to its address so the address should not be declared as const. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* | test: clk: test clock self assignmentJean-Jacques Hiblot2019-10-221-0/+2
| | | | | | | | | | | | | | Make sure that the clock self-assignment works by having a clock of clk-sbox be configured automatically when clk-sbox is probed. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
* | test: clk: Update tests to also check the managed APIJean-Jacques Hiblot2019-10-222-2/+37
|/ | | | | | | | Add a few more clocks the clk_sandbox clock provider and get them using the managed API. Make sure they are released when the device is removed. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com>
* sandbox: fix build error due to missing struct udevice definitionAKASHI Takahiro2019-10-151-0/+2
| | | | | | | Without this patch, compiling may potentially fail. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* sandbox: fix cpu property in test.dts for pytestAKASHI Takahiro2019-10-151-11/+13
| | | | | | | | | | | | | | | | | | | | | When I tried to run some new efi tests with pytest, efi_smbios_register() triggered a segmentation fault. Here is the location where it happened: efi_init_obj_list() efi_smbios_register() write_smbios_table() smbios_write_type4() smbios_write_type4_dm() where dev_get_parent_platdata() should return a pointer to struct cpu_platdata, but it is actually NULL because any cpu device on sandbox is attached to "root_driver." With this patch, this issue will be fixed by moving all the definitions of cpus under "cpus" node so that they have a "cpu_bus" parent. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* dm: Add a dsi host uclassYannick Fertré2019-10-132-1/+9
| | | | | | | | | Display Serial Interface (DSI) host can usefully be modelled as their own uclass. DSI defines a serial bus and a communication protocol between the host and the device (panel, bridge). Signed-off-by: Yannick Fertré <yannick.fertre@st.com>
* sandbox: pci: Create a new sandbox_pci_read_bar() functionSimon Glass2019-10-081-0/+15
| | | | | | | | | | | The code in swapcase can be used by other sandbox drivers. Move it into a common place to allow this. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com> [bmeng: remove inclusion of <asm/test.h> in pci_sandbox.c] Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
* dm: pci: Add a function to read a PCI BARSimon Glass2019-10-081-2/+5
| | | | | | | | | | | | | | | At present PCI address transaction is not supported so drivers must manually read the correct BAR after reading the device tree info. The ns16550 has a suitable implementation, so move this code into the core DM support. Note that there is no live-tree equivalent at present. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com> [bmeng: correct the unclear comments in test.dts] Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
* pci: sandbox: Move the emulators into their own nodeSimon Glass2019-10-082-16/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sandbox pci works using emulation drivers which are currently children of the pci device: pci-controller { pci@1f,0 { compatible = "pci-generic"; reg = <0xf800 0 0 0 0>; emul@1f,0 { compatible = "sandbox,swap-case"; }; }; }; In this case the emulation device is attached to pci device on address f800 (device 1f, function 0) and provides the swap-case functionality. However this is not ideal, since every device on a PCI bus has a child device. This is only really the case for sandbox, but we want to avoid special-case code for sandbox. Worse, child devices cannot be probed before their parents. This forces us to use 'find' rather than 'get' to obtain the emulator device. In fact the emulator devices are never probed. There is code in sandbox_pci_emul_post_probe() which tries to track when emulators are active, but at present this does not work. A better approach seems to be to add a separate node elsewhere in the device tree, an 'emulation parent'. This could be given a bogus address (such as -1) to hide the emulators away from the 'pci' command, but it seems better to keep it at the root node to avoid such hacks. Then we can use a phandle to point from the device to the correct emulator, and only on sandbox. The code to find an emulator does not interfere with normal pci operation. Add a new UCLASS_PCI_EMUL_PARENT uclass which allows finding an emulator given a bus, and finding a bus given an emulator. Update the existing device trees and the code for finding an emulator. This brings PCI emulators more into line with I2C. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com> [bmeng: fix 3 typos in the commit message; encode bus number in the labels of swap_case_emul nodes; mention commit 4345998ae9df in sandbox_pci_get_emul()] Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
* sandbox: Allow use of real I/O with readl(), etc.Simon Glass2019-10-083-9/+72
| | | | | | | | | | | | | | At present these functions are stubbed out. For more comprehensive testing with PCI devices it is useful to be able to fully emulate I/O access. Add simple implementations for these. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com> [bmeng: change to use 'const void *' in sandbox_write(); cast 'addr' in read/write macros in arch/sandbox/include/asm/io.h; remove the unnecessary cast in readq/writeq in nvme.h] Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
* sandbox: pci: Increase the memory spaceSimon Glass2019-10-081-1/+1
| | | | | | | | Increase the memory space so we can support the p2sb bus which needs multiples of 1MB. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
* sandbox: Add a -T flag to use the test device treeSimon Glass2019-10-081-0/+25
| | | | | | | | | | | | | | | | | U-Boot already supports using -D to indicate that it should use the normal device tree. It is sometimes useful to run with the test device tree, e.g. when running a test. Add a -T option for this along with some documentation. It can be used like this: /tmp/b/sandbox/u-boot -T -c "ut dm pci_busdev" (this will use /tmp/b/sandbox/arch/sandbox/dts/test.dtb as the DT) Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com>
* sandbox: Add support for clrsetio_32() and friendsSimon Glass2019-10-082-12/+42
| | | | | | | | These functions are available on x86 but not sandbox. They are useful shortcuts and clarify the code, so add them to sandbox. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>