aboutsummaryrefslogtreecommitdiff
path: root/lib/efi_selftest
AgeCommit message (Collapse)AuthorFilesLines
2018-06-03SPDX: Fixup tags from latest EFI PRTom Rini1-2/+1
Signed-off-by: Tom Rini <trini@konsulko.com>
2018-06-03efi_selftest: check for buffer overflow in efi_get_variableIvan Gorinov1-1/+17
Allocate a buffer on the stack instead of an array of uninitialized pointers; check if GetVariable writes past the end of the buffer. Signed-off-by: Ivan Gorinov <ivan.gorinov@intel.com> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-06-03efi_selftest: imply FAT, FAT_WRITEHeinrich Schuchardt1-0/+2
efi_selftest_block_device accesses a FAT file system. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-06-03efi_selftest: test unaligned memory accessHeinrich Schuchardt2-0/+71
According to the UEFI spec unaligned memory access should be enabled on CPUs supporting it. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-06-03efi_selftest: test ReinstallProtocolInterfaceHeinrich Schuchardt1-3/+32
Add a test for ReinstallProtocolInterface to the controller selftest. As ReinstallProtocolInterface has to connect controllers to the new interface is does not fit to the manage protocols selftest. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-06-03efi_selftest: correct efi_selftest_manageprotocolsHeinrich Schuchardt1-1/+1
Pass the correct interface when uninstalling a protocol. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-06-03efi_selftest: unit test for variable servicesHeinrich Schuchardt2-0/+181
Provide a unit test for variable services. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-06-03efi_selftest: updating the cursor positionHeinrich Schuchardt1-0/+78
The test case for text output is updated to check correct updating of the cursor position. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-05-10SPDX: Convert a few files that were missed beforeTom Rini2-6/+3
As part of the main conversion a few files were missed. These files had additional whitespace after the '*' and before the SPDX tag and my previous regex was too strict. This time I did a grep for all SPDX tags and then filtered out anything that matched the correct styles. Fixes: 83d290c56fab ("SPDX: Convert all of our single license tags to Linux Kernel style") Reported-by: Heinrich Schuchardt <xypron.debian@gmx.de> Signed-off-by: Tom Rini <trini@konsulko.com>
2018-05-07SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini23-46/+23
When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
2018-04-23efi_selftest: test EFI_DEVICE_PATH_UTILITIES_PROTOCOLHeinrich Schuchardt2-0/+287
Provide unit tests for the EFI_DEVICE_PATH_UTILITIES_PROTOCOL. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-23efi_selftest: fix typo in efi_selftest_devicepath.cHeinrich Schuchardt1-1/+1
%s/provice/provide/ Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-23efi_selftest: do not execute test if setup failedHeinrich Schuchardt1-7/+7
Executing a test after failed setup may lead to unexpected behavior like an illegal memory access. So after a setup failure we should skip to teardown. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-05efi_selftest: test getinfo(EFI_FILE_SYSTEM_INFO)Heinrich Schuchardt1-0/+22
Check that the getinfo() service of the file protocol correctly returns the partion label. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-05efi_selftest: partition label for test imageHeinrich Schuchardt1-36/+22
efi_selftest_disk_image.h contains a disk image. We use it to test the EFI_FILE_PROTOCOL. The patch sets the partition label to 'U-BOOT TEST'. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_loader: use correct types in EFI_FILE_PROTOCOLHeinrich Schuchardt1-1/+1
In the EFI_FILE_PROTOCOL buffer sizes and positions are passed as UINTN and not as u64. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_loader: correctly support parameter delta in BltHeinrich Schuchardt1-2/+2
In the Blt service of the EFI_GRAPHICS_OUTPUT_PROTOCOL the parameter delta is measured in bytes and not in pixels. The coding only supports delta being a multiple of four. The UEFI specification does not explicitly require this but as pixels have a size of four bytes we should be able to assume four byte alignment. The corresponding unit test is corrected, too. It can be launched with setenv efi_selftest block image transfer bootefi selftest Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_selftest: unit test for event groupsHeinrich Schuchardt2-0/+141
Supply a unit test for event groups. Create multiple events in an event group. Signal each event once and check that all events are notified once in each round. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_selftest: fix device tree unit testHeinrich Schuchardt1-1/+1
Include libfdt.h was moved by commit b08c8c487083 ("libfdt: move headers to <linux/libfdt.h> and <linux/libfdt_env.h>") Fixes: e236200c7fa6 ("efi_selftest: check installation of the device tree") Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_selftest: unit test for EFI_SIMPLE_TEXT_INPUT_PROTOCOLHeinrich Schuchardt2-0/+183
Provide a unit test for the EFI_SIMPLE_TEXT_INPUT_PROTOCOL. The unicode character and the scan code are printed for text input. To run the test: setenv efi_selftest text input bootefi selftest Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_selftest: test gop bitbltHeinrich Schuchardt2-0/+312
The test checks all block image transfer operations of the graphical output protocol. An animated submarine is shown. To run the test: setenv efi_selftest bock image transfer bootefi selftest Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-04-04efi_selftest: check installation of the device treeHeinrich Schuchardt2-0/+189
The unit test checks if a device tree is installed. It requires that the 'compatible' property of the root node exists. If available it prints the 'serial-number' property. The serial-number property is derived from the environment variable 'serial#'. This can be used to check if the image_setup_libfdt() function is executed. A Python test is supplied. It sets a value for serial# and checks that the selftest shows this as serial-number. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-02-10efi_selftest: use correct compiler flags for miniappsHeinrich Schuchardt1-2/+4
For EFI binaries we need special CFLAGS. They were specified for an object file that since has been replaced. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_selftest: reduce noise in test output for device treesHeinrich Schuchardt1-10/+13
Some messages are only useful if an error occurs. Fix a use after free. Add a missing free. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_selftest: provide a test for block ioHeinrich Schuchardt3-0/+467
This test checks the driver for block IO devices. A disk image is created in memory. A handle is created for the new block IO device. The block I/O protocol is installed on the handle. ConnectController is used to setup partitions and to install the simple file protocol. A known file is read from the file system and verified. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_selftest: add missing LF in test outputHeinrich Schuchardt2-2/+2
The output of the minicapps lacks a line feed. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_selftest: test start imageHeinrich Schuchardt6-0/+405
This pair of tests checks the StartImage boot service. Each test loads an EFI application into memory and starts it. One returns by calling the Exit boot service. The other returns directly. The tests are not built on x86_64 because the relocation code for the efi binary cannot be created. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_selftest: test for (Dis)ConnectControllerHeinrich Schuchardt2-0/+386
This unit test checks the following protocol services: ConnectController, DisconnectController, InstallProtocol, UninstallProtocol, OpenProtocol, CloseProtcol, OpenProtocolInformation Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_selftest: remove todo in device path testHeinrich Schuchardt1-15/+25
The installation of UninstallProtocol is functional now. So we do not expect errors when calling it. Call UninstallProtocol with correct level of indirection for parameter handle. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_selftest: remove todo in manage protocolsHeinrich Schuchardt1-11/+11
The installation of UninstallProtocols is functional now. So we do not expect errors when calling it. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_selftest: do not try to close device path protocolHeinrich Schuchardt1-4/+4
CloseProtocol cannot be called without agent handle. There is no need to close the device path protocol if it has been opened without agent handle. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_selftest: colored test outputHeinrich Schuchardt2-15/+23
Add color coding to output: test section blue success green errors red todo yellow summary white others light gray Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> [agraf: Fold in move of set_attribute before the print] Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_selftest: do not cut off u16 strings when printingHeinrich Schuchardt1-4/+8
Device paths can be very long. Due to a limited output buffer the output for device paths is cut off. We can avoid this by directly calling the boottime service with the the device path string. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> [agraf: Remove coloring code change] Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_selftest: avoid superfluous messages for task priority levelsHeinrich Schuchardt1-6/+9
In the task priority levels test debug output is written even if no failure is detected. Remove this distracting output. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-01-22efi_selftest: avoid superfluous messages for event servicesHeinrich Schuchardt1-3/+5
In the event services test debug output is written even if no failure is detected. Remove this distracting output. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-12-01efi_selftest: add missing line feedHeinrich Schuchardt1-1/+1
Add a missing line feed for an error message. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-12-01efi_selftest: compile without special compiler flagsHeinrich Schuchardt1-25/+0
As the selftest is not compiled as an EFI binary we do not need special compiler flags. This avoids the checkarmreloc error on vexpress_ca15_tc2. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-12-01efi_selftest: test EFI_DEVICE_PATH_TO_TEXT_PROTOCOLHeinrich Schuchardt2-0/+393
Provide a test for the EFI_DEVICE_PATH_TO_TEXT_PROTOCOL protocol. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-12-01efi_selftest: test for graphics output protocolHeinrich Schuchardt2-0/+98
Supply a test for the graphics output protocol. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-12-01efi_loader: consistently use efi_uintn_t in boot servicesHeinrich Schuchardt5-8/+8
Consistenly use efi_uintn_t wherever the UEFI spec uses UINTN in boot services interfaces. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-12-01efi_loader: replace UINTN by efi_uintn_tHeinrich Schuchardt1-1/+1
UINTN is used in the UEFI specification for unsigned integers matching the bitness of the CPU. Types in U-Boot should be lower case. The patch replaces it by efi_uintn_t. Suggested-by: Simon Glass <sjg@chromium.org> Suggested-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-12-01efi_selftest: test protocol managementHeinrich Schuchardt2-0/+357
This unit test checks the following protocol services: InstallProtocolInterface, UninstallProtocolInterface, InstallMultipleProtocolsInterfaces, UninstallMultipleProtocolsInterfaces, HandleProtocol, ProtocolsPerHandle, LocateHandle, LocateHandleBuffer. As UninstallProtocolInterface and UninstallMultipleProtocolsInterfaces are not completely implemented a TODO message will shown for their failure. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-12-01efi_selftest: provide test for EFI_SIMPLE_TEXT_OUTPUT_PROTOCOLHeinrich Schuchardt2-0/+56
The following services are tested: OutputString, TestString, SetAttribute. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-12-01efi_selftest: test reboot by watchdogHeinrich Schuchardt1-11/+57
A test is added that verifies that the watchdog timer actually causes a reboot upon timeout. The test is only executed on request using setenv efi_selftest watchdog reboot bootefi selftest Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-12-01efi_selftest: allow to select a single test for executionHeinrich Schuchardt3-8/+99
Environment variable efi_selftest is passed as load options to the selftest application. It is used to select a single test to be executed. The load options are an UTF8 string. Yet I decided to keep the name propertiy of the tests as char[] to reduce code size. Special value 'list' displays a list of all available tests. Tests get an on_request property. If this property is set the tests are only executed if explicitly requested. The invocation of efi_selftest is changed to reflect that bootefi selftest with efi_selftest = 'list' will call the Exit bootservice. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-12-01efi_selftest: deduplicate codeHeinrich Schuchardt1-29/+42
Move duplicate code to the new function efi_st_do_tests. Suggested-by: Alexander Graf <agraf@suse.de> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-12-01efi_selftest: efi_st_memcmp should return 0Heinrich Schuchardt1-1/+1
If the compared memory areas match the return value should be 0. We should not use the unrelated constant EFI_ST_SUCCESS. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-12-01efi_selftest: reformat codeHeinrich Schuchardt1-2/+2
Remove superfluous spaces. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-12-01efi_selftest: provide test for watchdog timerHeinrich Schuchardt2-1/+189
The test verifies that resetting the watchdog timer ensures that it is not called during the timeout period. Testing that the watchdog timer actually executes a reset would require a test outside the efi_selftest framework. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2017-10-13efi_selftest: correctly check return valuesHeinrich Schuchardt2-2/+2
When cancelling the timer we should check the return value provided by the set_timer service. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>