Pull request for efi-2022-07-rc6

UEFI:
 
 * Fix EFI_IO_BLOCK_PROTOCOL: read correct blocks on partitions
 
 Other:
 
 * Honor CONFIG_SYS_64BIT_LBA in the disk uclass
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEbcT5xx8ppvoGt20zxIHbvCwFGsQFAmLAQmUACgkQxIHbvCwF
 GsRAFxAAijD4FnPzIny42C9/Y53JbEwGBqoX3afm62LVwyDjzbQen/4RXYQeIpnM
 g8VYC0xD/6ti9eEO9e5J6NlLZv+N0rJkDRbOwtHDVtAJoxlsKRgESMK0UcdbWYSW
 2i1+oVJeEavwER0FOiwP1A272ZdAlEwA7NYGj1uEryk7Nzhux1d/c/GtwgdkVhJg
 zCwYY/BwBeiStRaRUD+UnhaNuaqvS9Gmy9X9KfbSjXCDESIEpmJksDHlZ8U8BJ+v
 QvkxEkQsc2pgxe3o6KmAxhnP4lmoZQHuDWRiULdjVPa6SxZUfPzYCxfFiH9TiPoy
 GCligk5pQbNl1McgMcJb66XdKa0CmidVK66Oh80LNCXH4p8yNRxa20ulOjLS8xfK
 tLm+n5scKOgQEq5dDqQm8bg+uTwnZXpRZ6qqHl4pNjles4vNuqsBPuaWrHEBUGFb
 DSJZO7hYZ+K7FR1x7m36D9Lh+UPm9nfatCGl8W/u1qFzsD6CYfT/dSZqQil5Sgg8
 Qav1UXFS3QQDkVxQfhCT8VkSDIbMfD8/EKOCDCWeNsstrMRzHExwVxg9sBYnJMoL
 Fzc4NS+9plvQj7lM1MTq9z3bz26/laqTsRGHHeezekdg8Bu4F15K1Dli4bqh1GtF
 kBuX4QJt9R0dkDvgyMf2IWNJeJtQVHHIlqNURkAL3ZON8vcifa8=
 =Iav8
 -----END PGP SIGNATURE-----

Merge tag 'efi-2022-07-rc6' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2022-07-rc6

UEFI:

* Fix EFI_IO_BLOCK_PROTOCOL: read correct blocks on partitions

Other:

* Honor CONFIG_SYS_64BIT_LBA in the disk uclass
This commit is contained in:
Tom Rini 2022-07-02 09:55:26 -04:00
commit 730fc474b1
3 changed files with 29 additions and 7 deletions

View file

@ -8,6 +8,7 @@
#define LOG_CATEGORY UCLASS_PARTITION
#include <common.h>
#include <blk.h>
#include <dm.h>
#include <log.h>

View file

@ -35,7 +35,6 @@ const efi_guid_t efi_system_partition_guid = PARTITION_SYSTEM_GUID;
* @dp: device path to the block device
* @part: partition
* @volume: simple file system protocol of the partition
* @offset: offset into disk for simple partition
* @dev: associated DM device
*/
struct efi_disk_obj {
@ -47,7 +46,6 @@ struct efi_disk_obj {
struct efi_device_path *dp;
unsigned int part;
struct efi_simple_file_system_protocol *volume;
lbaint_t offset;
struct udevice *dev; /* TODO: move it to efi_object */
};
@ -117,7 +115,6 @@ static efi_status_t efi_disk_rw_blocks(struct efi_block_io *this,
diskobj = container_of(this, struct efi_disk_obj, ops);
blksz = diskobj->media.block_size;
blocks = buffer_size / blksz;
lba += diskobj->offset;
EFI_PRINT("blocks=%x lba=%llx blksz=%x dir=%d\n",
blocks, lba, blksz, direction);
@ -440,13 +437,11 @@ static efi_status_t efi_disk_add_dev(
diskobj->dp = efi_dp_append_node(dp_parent, node);
efi_free_pool(node);
diskobj->offset = part_info->start;
diskobj->media.last_block = part_info->size - 1;
if (part_info->bootable & PART_EFI_SYSTEM_PARTITION)
guid = &efi_system_partition_guid;
} else {
diskobj->dp = efi_dp_from_part(desc, part);
diskobj->offset = 0;
diskobj->media.last_block = desc->lba - 1;
}
diskobj->part = part;
@ -501,12 +496,11 @@ static efi_status_t efi_disk_add_dev(
*disk = diskobj;
EFI_PRINT("BlockIO: part %u, present %d, logical %d, removable %d"
", offset " LBAF ", last_block %llu\n",
", last_block %llu\n",
diskobj->part,
diskobj->media.media_present,
diskobj->media.logical_partition,
diskobj->media.removable_media,
diskobj->offset,
diskobj->media.last_block);
/* Store first EFI system partition */

View file

@ -11,6 +11,8 @@
* ConnectController is used to setup partitions and to install the simple
* file protocol.
* A known file is read from the file system and verified.
* The same block is read via the EFI_BLOCK_IO_PROTOCOL and compared to the file
* contents.
*/
#include <efi_selftest.h>
@ -312,6 +314,7 @@ static int execute(void)
char buf[16] __aligned(ARCH_DMA_MINALIGN);
u32 part1_size;
u64 pos;
char block_io_aligned[1 << LB_BLOCK_SIZE] __aligned(1 << LB_BLOCK_SIZE);
/* Connect controller to virtual disk */
ret = boottime->connect_controller(disk_handle, NULL, NULL, 1);
@ -449,6 +452,30 @@ static int execute(void)
return EFI_ST_FAILURE;
}
/*
* Test that read_blocks() can read same file data.
*
* In the test data, the partition starts at block 1 and the file
* hello.txt with the content 'Hello world!' is located at 0x5000
* of the disk. Here we read block 0x27 (offset 0x4e00 of the
* partition) and expect the string 'Hello world!' to be at the
* start of block.
*/
ret = block_io_protocol->read_blocks(block_io_protocol,
block_io_protocol->media->media_id,
(0x5000 >> LB_BLOCK_SIZE) - 1,
block_io_protocol->media->block_size,
block_io_aligned);
if (ret != EFI_SUCCESS) {
efi_st_error("ReadBlocks failed\n");
return EFI_ST_FAILURE;
}
if (memcmp(block_io_aligned + 1, buf, 11)) {
efi_st_error("Unexpected block content\n");
return EFI_ST_FAILURE;
}
#ifdef CONFIG_FAT_WRITE
/* Write file */
ret = root->open(root, &file, u"u-boot.txt", EFI_FILE_MODE_READ |