summaryrefslogtreecommitdiff
path: root/lib/efi_selftest/efi_selftest_block_device.c
AgeCommit message (Collapse)AuthorFilesLines
2021-01-29efi_selftest: test EFI_BLOCK_IO_PROTOCOL.Media->LastBlockHeinrich Schuchardt1-1/+20
The field Media->LastBlock of the EFI_BLOCK_IO_PROTOCOL must be filled with the index of the last logical block (LBA) for the block device that our test driver provides. After calling ConnectController() U-Boot exposes the block IO protocol for the partition check that the value of Media->LastBlock equals the partition size minus one. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-05-19common: Drop net.h from common headerSimon Glass1-0/+1
Move this header out of the common header. Network support is used in quite a few places but it still does not warrant blanket inclusion. Note that this net.h header itself has quite a lot in it. It could be split into the driver-mode support, functions, structures, checksumming, etc. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-01-15efi_driver: fix efi_uc_stop()Heinrich Schuchardt1-2/+2
Use the correct protocol in efi_uc_stop() when detaching the driver from the controller. Change the block IO unit test for the block device driver to throw an error instead of a todo if teardown fails. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-05-07efi_selftest: remove redundant function efi_st_memcmp()Heinrich Schuchardt1-3/+3
Function memcmp() is available in efi_freestanding.c. So we do not remove a further implementation. Replace all usages of efi_st_memcmp() by memcmp(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-04-23efi_loader: consistent naming of protocol GUIDsHeinrich Schuchardt1-2/+2
We should consistently use the same name for protocol GUIDs as defined in the UEFI specification. Not adhering to this rule has led to duplicate definitions for the EFI_LOADED_IMAGE_PROTOCOL_GUID. Adjust misnamed protocol GUIDs. Adjust the text for the graphics output protocol in the output of the `efidebug dh` command. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2019-02-16efi_selftest: do not use efi_free_pool()Heinrich Schuchardt1-1/+1
In efi_selftest we are in EFI land. We should not use U-Boot library functions but boot time services for memory management. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Alexander Graf <agraf@suse.de>
2019-02-13efi_loader: use u16* for file nameHeinrich Schuchardt1-3/+3
UTF-16 strings in our code should all be u16 *. Fix an inconsistency for file names which may lead to a warning for printf("%ls", ). Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-12-23efi_selftest: block device: avoid read after freeHeinrich Schuchardt1-5/+5
Reading the position in a file after closing the same results in a read after free. Correct the sequence in the test. Reported-by: Marek Vasut <marek.vasut@gmail.com> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-10-16efi_loader: correct signature of GetPosition, SetPositionHeinrich Schuchardt1-2/+28
The UEFI spec requires that file positions are passed as u64 in GetPosition() and SetPosition(). Check if the file handle points to a directory in GetPosition(). Provide a unit test for GetPosition() and SetPosition(). Fix Coverity warning CID 184079 (CONSTANT_EXPRESSION_RESULT). Add comments. Fixes: b6dd57773719 ("efi_loader: use correct types in EFI_FILE_PROTOCOL") Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-08-20efi_selftest: correct block device unit testHeinrich Schuchardt1-1/+1
The UEFI specification mandates that the create flag is only used in conjunction with both the read and the write flag. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-07-25efi_selftest: test writing to fileHeinrich Schuchardt1-0/+70
Provide a unit test for writing to a FAT file system. Add some additional comments in block device unit test. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Alexander Graf <agraf@suse.de>
2018-05-07SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini1-2/+1
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-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-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-01-23efi_selftest: provide a test for block ioHeinrich Schuchardt1-0/+395
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>