u-boot/lib/efi_selftest
Paul Barbieri 7a85f32413 EFI: Fix ReadBlocks API reading incorrect sector for UCLASS_PARTITION devices
The requsted partition disk sector incorrectly has the parition start
sector added in twice for UCLASS_PARTITION devices. The efi_disk_rw_blocks()
routine adds the diskobj->offset to the requested lba. When the device
is a UCLASS_PARTITION, the dev_read() or dev_write() routine is called
which adds part-gpt_part_info.start. This causes I/O to the wrong sector.

Takahiro Akashi suggested removing the offset field from the efi_disk_obj
structure since disk-uclass.c handles the partition start biasing. Device
types other than UCLASS_PARTITION set the diskobj->offset field to zero
which makes the field unnecessary. This change removes the offset field
from the structure and removes all references from the code which is
isolated to the lib/efi_loader/efi_disk.c module.

This change also adds a test for the EFI ReadBlocks() API in the EFI
selftest code. There is already a test for reading a FAT file. The new
test uses ReadBlocks() to read the same "disk" block and compare it to
the data read from the file system API.

Signed-Off-by: Paul Barbieri <plb365@gmail.com>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: AKASHI Takahiro <takahiro.akashi@linaro.org>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-07-02 14:19:12 +02:00
..
.gitignore efi_selftest: Update .gitignore 2020-01-07 18:08:20 +01:00
efi_freestanding.c efi_loader: fix build error for freestanding.o 2019-03-14 21:03:14 +01:00
efi_miniapp_tcg2_arm.h efi_selftest: add selftest for EFI_TCG2_PROTOCOL and Measured Boot 2021-11-07 18:36:55 +01:00
efi_miniapp_tcg2_arm64.h efi_selftest: add selftest for EFI_TCG2_PROTOCOL and Measured Boot 2021-11-07 18:36:55 +01:00
efi_miniapp_tcg2_ia32.h efi_selftest: add selftest for EFI_TCG2_PROTOCOL and Measured Boot 2021-11-07 18:36:55 +01:00
efi_miniapp_tcg2_riscv32.h efi_selftest: add selftest for EFI_TCG2_PROTOCOL and Measured Boot 2021-11-07 18:36:55 +01:00
efi_miniapp_tcg2_riscv64.h efi_selftest: add selftest for EFI_TCG2_PROTOCOL and Measured Boot 2021-11-07 18:36:55 +01:00
efi_miniapp_tcg2_x86_64.h efi_selftest: add selftest for EFI_TCG2_PROTOCOL and Measured Boot 2021-11-07 18:36:55 +01:00
efi_selftest.c efi: Use 16-bit unicode strings 2022-02-03 12:16:01 -05:00
efi_selftest_bitblt.c efi_loader: correct function comment style 2022-01-29 10:23:40 +01:00
efi_selftest_block_device.c EFI: Fix ReadBlocks API reading incorrect sector for UCLASS_PARTITION devices 2022-07-02 14:19:12 +02:00
efi_selftest_config_table.c efi_loader: correct function comment style 2022-01-29 10:23:40 +01:00
efi_selftest_console.c efi_loader: correct function comment style 2022-01-29 10:23:40 +01:00
efi_selftest_controllers.c doc: replace @return by Return: 2022-01-19 18:11:34 +01:00
efi_selftest_crc32.c efi_loader: correct function comment style 2022-01-29 10:23:40 +01:00
efi_selftest_devicepath.c efi: Use 16-bit unicode strings 2022-02-03 12:16:01 -05:00
efi_selftest_devicepath_util.c efi_loader: correct function comment style 2022-01-29 10:23:40 +01:00
efi_selftest_disk_image.h SPDX: Convert a few files that were missed before 2018-05-10 20:38:35 -04:00
efi_selftest_esrt.c efi_loader: correct function comment style 2022-01-29 10:23:40 +01:00
efi_selftest_event_groups.c efi_loader: correct function comment style 2022-01-29 10:23:40 +01:00
efi_selftest_events.c efi_loader: correct function comment style 2022-01-29 10:23:40 +01:00
efi_selftest_exception.c efi: Use 16-bit unicode strings 2022-02-03 12:16:01 -05:00
efi_selftest_exitbootservices.c efi_loader: correct function comment style 2022-01-29 10:23:40 +01:00
efi_selftest_fdt.c efi_selftest: merge FDT and RISC-V tests 2022-02-05 20:20:01 +01:00
efi_selftest_gop.c efi_loader: correct function comment style 2022-01-29 10:23:40 +01:00
efi_selftest_hii.c efi: Use 16-bit unicode strings 2022-02-03 12:16:01 -05:00
efi_selftest_hii_data.c efi_selftest: add HII database protocols test 2019-02-13 09:40:06 +01:00
efi_selftest_load_file.c efi: Use 16-bit unicode strings 2022-02-03 12:16:01 -05:00
efi_selftest_loaded_image.c efi_selftest: remove redundant function efi_st_memcmp() 2019-05-07 21:10:04 +02:00
efi_selftest_loadimage.c efi: Use 16-bit unicode strings 2022-02-03 12:16:01 -05:00
efi_selftest_manageprotocols.c efi_selftest: remove redundant function efi_st_memcmp() 2019-05-07 21:10:04 +02:00
efi_selftest_mem.c efi_selftest: test CalculateCrc32, CopyMem, SetMem 2020-03-22 11:06:23 +01:00
efi_selftest_memory.c efi_loader: put device tree into EfiACPIReclaimMemory 2020-05-07 18:23:16 +02:00
efi_selftest_miniapp_exception.c efi: Use 16-bit unicode strings 2022-02-03 12:16:01 -05:00
efi_selftest_miniapp_exit.c efi: Use 16-bit unicode strings 2022-02-03 12:16:01 -05:00
efi_selftest_miniapp_return.c efi: Use 16-bit unicode strings 2022-02-03 12:16:01 -05:00
efi_selftest_open_protocol.c efi_selftest: unit test for OpenProtocolInformation() 2019-06-01 22:40:24 +02:00
efi_selftest_register_notify.c efi_loader: correct notification of protocol installation 2019-05-31 23:27:11 +02:00
efi_selftest_reset.c efi: Use 16-bit unicode strings 2022-02-03 12:16:01 -05:00
efi_selftest_rng.c efi_loader: correct function comment style 2022-01-29 10:23:40 +01:00
efi_selftest_rtc.c efi_loader: correct function comment style 2022-01-29 10:23:40 +01:00
efi_selftest_set_virtual_address_map.c efi_loader: correct function comment style 2022-01-29 10:23:40 +01:00
efi_selftest_snp.c efi_loader: correct function comment style 2022-01-29 10:23:40 +01:00
efi_selftest_startimage_exit.c efi_loader: correct function comment style 2022-01-29 10:23:40 +01:00
efi_selftest_startimage_return.c efi_loader: correct function comment style 2022-01-29 10:23:40 +01:00
efi_selftest_tcg2.c efi_selftest: error handling in efi_selftest_tcg2 2022-05-03 21:39:22 +02:00
efi_selftest_textinput.c efi_loader: correct function comment style 2022-01-29 10:23:40 +01:00
efi_selftest_textinputex.c efi_loader: correct function comment style 2022-01-29 10:23:40 +01:00
efi_selftest_textoutput.c efi: Use 16-bit unicode strings 2022-02-03 12:16:01 -05:00
efi_selftest_tpl.c efi_loader: correct function comment style 2022-01-29 10:23:40 +01:00
efi_selftest_unaligned.c efi_selftest: clean up unaligned unit test 2022-05-03 21:39:22 +02:00
efi_selftest_unicode_collation.c efi: Use 16-bit unicode strings 2022-02-03 12:16:01 -05:00
efi_selftest_util.c efi: Use 16-bit unicode strings 2022-02-03 12:16:01 -05:00
efi_selftest_variables.c efi: Use 16-bit unicode strings 2022-02-03 12:16:01 -05:00
efi_selftest_variables_runtime.c efi: Use 16-bit unicode strings 2022-02-03 12:16:01 -05:00
efi_selftest_watchdog.c efi_loader: correct function comment style 2022-01-29 10:23:40 +01:00
Kconfig efi_selftest: block device test requires CONFIG_DOS_PARTITION 2020-08-01 11:58:39 +02:00
Makefile efi_selftest: buildefi_selftest_unaligned.c 2022-05-03 21:39:22 +02:00