summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)AuthorFilesLines
2020-09-30firmware: add SCMI agent uclassEtienne Carriere2-0/+39
This change introduces SCMI agent uclass to interact with a firmware using the SCMI protocols [1]. SCMI agent uclass currently supports a single method to request processing of the SCMI message by an identified server. A SCMI message is made of a byte payload associated to a protocol ID and a message ID, all defined by the SCMI specification [1]. On return from process_msg() method, the caller gets the service response. SCMI agent uclass defines a post bind generic sequence for all devices. The sequence binds all the SCMI protocols listed in the FDT for that SCMI agent device. Currently none, but later change will introduce protocols. This change implements a simple sandbox device for the SCMI agent uclass. The sandbox nicely answers SCMI_NOT_SUPPORTED to SCMI messages. To prepare for further test support, the sandbox exposes a architecture function for test application to read the sandbox emulated devices state. Currently supports 2 SCMI agents, identified by an ID in the FDT device name. The simplistic DM test does nothing yet. SCMI agent uclass is designed for platforms that embed a SCMI server in a firmware hosted somewhere, for example in a companion co-processor or in the secure world of the executing processor. SCMI protocols allow an SCMI agent to discover and access external resources as clock, reset controllers and more. SCMI agent and server communicate following the SCMI specification [1]. This SCMI agent implementation complies with the DT bindings defined in the Linux kernel source tree regarding SCMI agent description since v5.8. Links: [1] https://developer.arm.com/architectures/system-architectures/software-standards/scmi Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Cc: Simon Glass <sjg@chromium.org> Cc: Peng Fan <peng.fan@nxp.com> Cc: Sudeep Holla <sudeep.holla@arm.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-09-30test: dm: Add tests for regmap managed API and regmap fieldsJean-Jacques Hiblot1-0/+198
The tests rely on a dummy driver to allocate and initialize the regmaps and the regmap fields using the managed API. The first test checks if the regmap config fields like width, reg_offset_shift, range specifiers, etc work. The second test checks if regmap fields behave properly (mask and shift are ok) by peeking into the regmap. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Signed-off-by: Pratyush Yadav <p.yadav@ti.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-09-30test/py: allow multi-digit index in in_tree()Pratyush Yadav1-1/+1
When more nodes are added for a uclass the index might go into two or more digits. This means that there are less spaces printed because they are used up by the extra digits. Update the regular expression to allow variable-length spacing between the class name and and index. This was discovered when adding a simple_bus node in test.dts made test_bind_unbind_with_uclass() fail because the index went up to 10. Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
2020-09-30test: gpio: Add tests for the managed APIJean-Jacques Hiblot3-4/+106
Add a test to verify that GPIOs can be acquired/released using the managed API. Also check that the GPIOs are released when the consumer device is removed. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
2020-09-30test: reset: Add tests for the managed APIJean-Jacques Hiblot1-0/+60
The tests are basically the same as for the regular API. Except that the reset are initialized using the managed API, and no freed manually. Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Pratyush Yadav <p.yadav@ti.com>
2020-09-30timer: Add a test for timer_timebase_fallbackSean Anderson1-1/+26
To test this function, sandbox CPU must set cpu_platdata.timebase_freq on bind. It also needs to expose a method to set the current cpu. I also make some most members of cpu_sandbox_ops static. On the timer side, the device tree property sandbox,timebase-frequency-fallback controls whether sandbox_timer_probe falls back to time_timebase_fallback or to SANDBOX_TIMER_RATE. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-09-25acpi: Add more support for generating processor tablesSimon Glass1-0/+294
This adds tables relating to P-States and C-States. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-09-25acpi: Add support for generating processor tablesSimon Glass1-0/+107
ACPI has a number of CPU-related tables. Add utility functions to write out the basic packages. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-09-25dm: acpi: Use correct GPIO polarity type in acpi_dp_add_gpio()Simon Glass1-2/+2
This function currently accepts the IRQ-polarity type. Fix it to use the GPIO type instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-09-25acpi: Support generating a multi-function _DSM for devicesSimon Glass1-0/+125
Add a function to generate ACPI code for a _DSM method for a device. This includes functions for starting and ending each part of the _DSM. Signed-off-by: Simon Glass <sjg@chromium.org> [bmeng: fix the "new blank line at EOF" git warning] Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
2020-09-25acpi: Add support for conditions and return valuesSimon Glass1-0/+91
Add functions to support generating ACPI code for condition checks and return values. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-09-25acpi: Add support for writing a _PRWSimon Glass1-0/+30
A 'Power Resource for Wake' list the resources a device depends on for wake. Add a function to generate this. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-09-22test: fdtdec: Add test for new no-map fdtdec_add_reserved_memory() parameterPatrice Chotard1-1/+4
Add a test to verify that the no-map property is added in reserved-memory node when fdtdec_add_reserved_memory() no-map parameter is set to true. Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-09-22fdtdec: optionally add property no-map to created reserved memory nodeEtienne Carriere1-3/+3
Add boolean input argument @no_map to helper function fdtdec_add_reserved_memory() to add or not "no-map" property for an added reserved memory node. Property no-map is used by the Linux kernel to not not map memory in its static memory mapping. It is needed for example for the| consistency of system non-cached memory and to prevent speculative accesses to some firewalled memory. No functional change. A later change will update to OPTEE library to add no-map property to OP-TEE reserved memory nodes. Signed-off-by: Etienne Carriere <etienne.carriere@st.com> Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-09-21cmd: acpi: Print revisions in hex formatAndy Shevchenko1-5/+5
The revisions are usually dates in hex-decimal format representing YYYYmmdd. Print them in hex to see this clearly. Before: ... FACP 000e5420 0000f4 (v06 U-BOOT U-BOOTBL 538970376 INTL 0) DSDT 000e4780 000ba0 (v02 U-BOOT U-BOOTBL 65536 INTL 538968870) ... After: ... FACP 000e5420 0000f4 (v06 U-BOOT U-BOOTBL 20200908 INTL 0) DSDT 000e4780 000ba0 (v02 U-BOOT U-BOOTBL 10000 INTL 20200326) ... Fixes: 0b885bcfd9b0 ("acpi: Add an acpi command") Cc: Wolfgang Wallner <wolfgang.wallner@br-automation.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2020-09-12test: do no assume hush parser in validate_empty()Heinrich Schuchardt1-1/+1
The environment variable test uses function validate_empty() to check that a variable is not defined. If the hush parser is not enabled, we cannot refer to a variable by $var_name but only by ${var_name}. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Acked-by: Stephen Warren <swarren@nvidia.com>
2020-08-27test: undefined reference to 'sscanf'Heinrich Schuchardt1-1/+1
Compiling with CONFIG_UNIT_TEST=y leads to: aarch64-linux-gnu-ld.bfd: test/lib/sscanf.c:50: undefined reference to `sscanf' Add missing build dependency. Fixes:e87dfb0526be ("lib: sscanf: add sscanf implementation") Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-08-25Merge https://gitlab.denx.de/u-boot/custodians/u-boot-marvellTom Rini1-0/+22
- Add basic Marvell/Cavium OcteonTX/TX2 support (Suneel) - Infrastructure changes to PCI uclass to support these SoC's (Suneel) - Add PCI, MMC & watchdog driver drivers for OcteonTX/TX2 (Suneel) - Increase CONFIG_SYS_MALLOC_F_LEN for qemu-x86 (Stefan)
2020-08-25Merge branch '2020-08-24-misc-improvements'Tom Rini3-47/+102
- Squashfs compression support - Coverity fixes - XEN guest updates - Finish previous MediaTek updates - Arm Total Compute platform support
2020-08-25pci: pci-uclass: Add multi entry support for memory regionsSuneel Garapati1-0/+22
Enable PCI memory regions in ranges property to be of multiple entry. This helps to add support for SoC's like OcteonTX/TX2 where every peripheral is on PCI bus. Signed-off-by: Suneel Garapati <sgarapati@marvell.com> Cc: Simon Glass <sjg@chromium.org> Cc: Bin Meng <bmeng.cn@gmail.com>
2020-08-25Merge tag 'efi-2020-10-rc3-3' of ↵Tom Rini6-74/+125
https://gitlab.denx.de/u-boot/custodians/u-boot-efi Pull request for UEFI sub-system for efi-2020-10-rc3 (3) The following bug fixes are contained in this pull-request: * ResetSystem() should no hang if not implemented. * Device paths in Bootxxxx variables should be verified. * Use ':' as separator for command setenv -e -i instead of ','. * Correct comments for functions. * Update UEFI documentation.
2020-08-24test/py: Add tests for LZO and ZSTDJoao Marcos Costa3-47/+102
Improve SquashFS tests architecture. Add 'Compression' class. LZO algorithm may crash if the file is fragmented, so the fragments are disabled when testing LZO. Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>
2020-08-24efi_loader: use ':' as separator for setenv -iHeinrich Schuchardt4-74/+74
setenv -e -i <address>,<filesize> can be used to set a UEFI variable from memory. For separating an address and a size we use ':' in most commands. Let's do the same for setenv -e -i. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-08-24test: unit test for efi_dp_check_length()Heinrich Schuchardt2-0/+51
Provide a unit test for function efi_dp_check_length(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-08-24Merge tag 'u-boot-clk-24Aug2020' of ↵Tom Rini1-0/+39
https://gitlab.denx.de/u-boot/custodians/u-boot-clk - Add CCF clocks definitions for iMX6Q enet (ETH) - Several fixes for CCF framework - the most notable is the one, which adds get_rate helper to clk-mux.c - Improvements for clk command - better visibility and alignment.
2020-08-24clk: ccf: mux: change the get_rate helperDario Binacchi1-0/+24
The previous version of the get_rate helper does not work if the mux clock parent is changed after the probe. This error has not been detected because this condition has not been tested. The error occurs because the set_parent helper does not change the parent of the clock device but only the clock selection register. Since changing the parent of a probed device can be tricky, the new version of the get_rate helper provides the rate of the selected clock and not that of the parent. Signed-off-by: Dario Binacchi <dariobin@libero.it>
2020-08-24clk: set flags in the ccf registration routinesDario Binacchi1-0/+7
The top-level framework flags are passed as parameter to the common clock framework (ccf) registration routines without being used. Checks of the flags setting added by the patch have been added in the ccf test. Signed-off-by: Dario Binacchi <dariobin@libero.it>
2020-08-24dm: test: clk: add the test for the ccf gated clockDario Binacchi1-0/+8
Unlike the other clock types, in the case of the gated clock, a new driver has been developed which does not use the registering routine provided by the common clock framework. The addition of the ecspi0 clock to sandbox therefore allows testing the ccf gate clock. Signed-off-by: Dario Binacchi <dariobin@libero.it> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-08-22test: dm: Add test case for devfdt_get_addr_ptrOvidiu Panait1-0/+18
Add flat tree test case to cover devfdt_get_addr_ptr function. Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-08-22test/py: Update test_bindPatrice Chotard1-6/+9
As bind-test is now binded at sandbox startup and no more by test_bind.py, bind-test nodes are not located at the end of "dm tree" output, but can be located everywhere in the tree, so bind-test output could either be: simple_bus 0 [ ] generic_simple_bus |-- bind-test phy 0 [ ] phy_sandbox | |-- bind-test-child1 simple_bus 1 [ ] generic_simple_bus | `-- bind-test-child2 or: simple_bus 5 [ ] generic_simple_bus `-- bind-test phy 2 [ ] phy_sandbox |-- bind-test-child1 simple_bus 6 [ ] generic_simple_bus `-- bind-test-child2 in_tree() function need to be updated to take care of that change. Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-08-22sandbox: dts: Add compatible string for bind-test nodePatrice Chotard2-4/+1
Usage of lists_bind_fdt() in bind command imposes to add a compatible string for bind-test node. Others impacts are: - bind-test node is binded at sandbox start, so no need to bind it in test_bind_unbind_with_node() test. - As explained just above, after sandbox start, now a phy exist. In test/dm/phy.c, it was verified that a third phy didn't exist, now we must verified that a fourth phy doesn't exist. Signed-off-by: Patrice Chotard <patrice.chotard@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-08-20i2c: eeprom: Use reg property instead of offset and sizeMichal Simek1-0/+8
Remove adhoc dt binding for fixed-partition definition for i2c eeprom. fixed-partition are using reg property instead of offset/size pair. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-08-15Merge tag 'efi-2020-10-rc3-2' of ↵Tom Rini5-24/+326
https://gitlab.denx.de/u-boot/custodians/u-boot-efi Pull request for UEFI sub-system for efi-2020-10-rc3 (2) This series includes bug fixes for: * UEFI secure boot - images with multiple signatures * UEFI secure boot - support for intermediate certificates * corrections for UEFI unit tests * missing loadaddr on MAIX board
2020-08-14lib: sscanf: add sscanf implementationAndrii Anisov2-0/+175
Port sscanf implementation from mini-os and introduce new Kconfig option to enable it: CONFIG_SSCANF. Disable by default. Signed-off-by: Andrii Anisov <andrii_anisov@epam.com> Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com> Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
2020-08-14test/py: efi_secboot: modify 'multiple signatures' test caseAKASHI Takahiro2-12/+19
The test case 5 in test_signed (multiple signatures) must be modified and aligned with the change introduced in the previous commit ("efi_loader: signature: correct a behavior against multiple signatures"). Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2020-08-13test/py: efi_secboot: add test for intermediate certificatesAKASHI Takahiro4-0/+305
In this test case, an image may have a signature with additional intermediate certificates. A chain of trust will be followed and all the certificates in the middle of chain must be verified before loading. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2020-08-13test/py: efi_secboot: small rework for adding a new testAKASHI Takahiro2-13/+3
It won't be very useful to customize HELLO_PATH and EFI_SECBOOT_IMAGE_NAME under the current code base. So just remove them. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
2020-08-10test/py: fix SquashFS testsJoao Marcos Costa3-14/+16
Use "cons.config.build_dir" instead of writing to the source directory (read-only). This will fix the test failures in Azure. Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>
2020-08-08test/py: serial# cannot be overwritten on some devicesHeinrich Schuchardt1-2/+5
On some devices the environment variable serial# cannot be overwritten. Set the variable only if it is not set. For our unit test it is sufficient to test if any value for serial-number is set. Fixes: 8a5cdf601f8d ("test: efi_selftest: Do not force serial# setting") Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-08-08test: py: test_shell_run() with CONFIG_HUSH_PARSER=nHeinrich Schuchardt1-3/+3
The hush parser not enabled for some boards, e.g. sipeed_maix_bitm_defconfig. With CONFIG_HUSH_PARSER=n a double quotation mark is not interpreted as the beginning of a string. Use a single quotation mark instead. Furthermore without the hush parser variables have to be referenced as ${varname}. Add the missing braces. Reported-by: Sean Anderson <seanga2@gmail.com> Fixes: 8b86c609b860 ("test/py: add test of basic shell functionality") Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-08-08tests: support mkfs.ext4 without metadata_csumStephen Warren2-3/+8
Modify various test/py filesystem creation routines to support systems that don't implement the metadata_csum ext4 feature. Signed-off-by: Stephen Warren <swarren@nvidia.com>
2020-08-08test/py: Add tests for the SquashFS commandsJoao Marcos Costa3-0/+101
Add Python scripts to test 'ls' and 'load' commands. The scripts generate a SquashFS image and clean the directory after the assertions, or if an exception is raised. Signed-off-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>
2020-08-08cmd: Update the memory-search commandSimon Glass4-30/+103
Add various fixes and improvements to this command that were missed in the original version. Unfortunately I forgot to send v2. - Fix Kconfig name - Use a separate variable for the remaining search length - Correct a minor bug - Move into a separate test suite - Add -q flag to the 'quiet' test to test operation when console is enabled - Enable the feature for sandbox Signed-off-by: Simon Glass <sjg@chromium.org>
2020-08-08test: Add a flag for tests that need console recordingSimon Glass1-0/+10
Allow tests that need console recording to be marked, so they can be skipped if it is not available. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-08-08dm: Rename DM test flags to make them more genericSimon Glass74-290/+290
The test flags used by driver model are currently not available to other tests. Rather than creating two sets of flags, make these flags generic by changing the DM_ prefix to UT_ and moving them to the test.h header. This will allow adding other test flags without confusion. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-08-08test: Add a way to check part of a console line or skip itSimon Glass1-0/+22
Some lines of the output are not worth testing, or not worth testing in their entirety. For example, when checking a hex dump we know that the hex-dump routine can display ASCII so we only need to check the hex bytes, not the ASCII dump. Add a new test macros which can check only part of a console line. Sometimes it is useful to skip a line altogether, so add a macro for that also. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-08-05test/py: Add test support for three stage bootYan Liu1-0/+10
Current pytest only support upto 2 stage boot; Some boards like TI K3 am6/J7 boards use 3 stage boot. This patch adds u_boot_spl2 to be able to handle the 3-stage boot case. User needs to set "env__spl2_skipped" in u_boot_boardenv config file to use this support. By default it is set to TRUE. Signed-off-by: Yan Liu <yan-liu@ti.com> Signed-off-by: Yan Liu <yan-liu@ti.com>
2020-08-04dm: core: Drop header files from dm/test.hSimon Glass61-17/+81
These header file should not be included in other header files. Remove them and add to each individual file. Add test/test.h to test/ui.h since that is a reasonable place. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-07-31test: sandbox: add test for erase commandPatrick Delaunay1-0/+16
Add test for the erase command tested on ENV in EXT4. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-07-31test: environment in ext4Patrick Delaunay1-1/+96
Add basic test to persistent environment in ext4: save and load in host ext4 file 'uboot.env'. On first execution an empty EXT4 file system is created in persistent data dir: env.ext4.img. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>