mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-27 16:01:27 +00:00
efi_loader: remove efi_disk_is_system_part()
The block IO protocol may be installed on any handle. We should make
no assumption about the structure the handle points to.
efi_disk_is_system_part() makes an illegal widening cast from a handle
to a struct efi_disk_obj. Remove the function.
Fixes: Fixes: 41fd506842
("efi_loader: disk: add efi_disk_is_system_part()")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
This commit is contained in:
parent
90dcd9b2d3
commit
b78631d54f
3 changed files with 9 additions and 33 deletions
|
@ -541,8 +541,6 @@ efi_status_t tcg2_measure_pe_image(void *efi, u64 efi_size,
|
||||||
int efi_disk_create_partitions(efi_handle_t parent, struct blk_desc *desc,
|
int efi_disk_create_partitions(efi_handle_t parent, struct blk_desc *desc,
|
||||||
const char *if_typename, int diskid,
|
const char *if_typename, int diskid,
|
||||||
const char *pdevname);
|
const char *pdevname);
|
||||||
/* Check if it is EFI system partition */
|
|
||||||
bool efi_disk_is_system_part(efi_handle_t handle);
|
|
||||||
/* Called by bootefi to make GOP (graphical) interface available */
|
/* Called by bootefi to make GOP (graphical) interface available */
|
||||||
efi_status_t efi_gop_register(void);
|
efi_status_t efi_gop_register(void);
|
||||||
/* Called by bootefi to make the network interface available */
|
/* Called by bootefi to make the network interface available */
|
||||||
|
|
|
@ -669,22 +669,29 @@ static efi_status_t get_dp_device(u16 *boot_var,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* device_is_present_and_system_part - check if a device exists
|
* device_is_present_and_system_part - check if a device exists
|
||||||
* @dp Device path
|
|
||||||
*
|
*
|
||||||
* Check if a device pointed to by the device path, @dp, exists and is
|
* Check if a device pointed to by the device path, @dp, exists and is
|
||||||
* located in UEFI system partition.
|
* located in UEFI system partition.
|
||||||
*
|
*
|
||||||
|
* @dp device path
|
||||||
* Return: true - yes, false - no
|
* Return: true - yes, false - no
|
||||||
*/
|
*/
|
||||||
static bool device_is_present_and_system_part(struct efi_device_path *dp)
|
static bool device_is_present_and_system_part(struct efi_device_path *dp)
|
||||||
{
|
{
|
||||||
efi_handle_t handle;
|
efi_handle_t handle;
|
||||||
|
struct efi_device_path *rem;
|
||||||
|
|
||||||
|
/* Check device exists */
|
||||||
handle = efi_dp_find_obj(dp, NULL, NULL);
|
handle = efi_dp_find_obj(dp, NULL, NULL);
|
||||||
if (!handle)
|
if (!handle)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return efi_disk_is_system_part(handle);
|
/* Check device is on system partition */
|
||||||
|
handle = efi_dp_find_obj(dp, &efi_system_partition_guid, &rem);
|
||||||
|
if (!handle)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -587,32 +587,3 @@ efi_status_t efi_disk_register(void)
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* efi_disk_is_system_part() - check if handle refers to an EFI system partition
|
|
||||||
*
|
|
||||||
* @handle: handle of partition
|
|
||||||
*
|
|
||||||
* Return: true if handle refers to an EFI system partition
|
|
||||||
*/
|
|
||||||
bool efi_disk_is_system_part(efi_handle_t handle)
|
|
||||||
{
|
|
||||||
struct efi_handler *handler;
|
|
||||||
struct efi_disk_obj *diskobj;
|
|
||||||
struct disk_partition info;
|
|
||||||
efi_status_t ret;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
/* check if this is a block device */
|
|
||||||
ret = efi_search_protocol(handle, &efi_block_io_guid, &handler);
|
|
||||||
if (ret != EFI_SUCCESS)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
diskobj = container_of(handle, struct efi_disk_obj, header);
|
|
||||||
|
|
||||||
r = part_get_info(diskobj->desc, diskobj->part, &info);
|
|
||||||
if (r)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return !!(info.bootable & PART_EFI_SYSTEM_PARTITION);
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue