Abstract out efi_devpath_to_handle to search for a handle that matches
the desired devpath.
This commit is contained in:
parent
f28eb4856d
commit
b9e19b077e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=347195
@ -95,6 +95,7 @@ UINTN efi_devpath_length(EFI_DEVICE_PATH *);
|
|||||||
EFI_DEVICE_PATH *efi_name_to_devpath(const char *path);
|
EFI_DEVICE_PATH *efi_name_to_devpath(const char *path);
|
||||||
EFI_DEVICE_PATH *efi_name_to_devpath16(CHAR16 *path);
|
EFI_DEVICE_PATH *efi_name_to_devpath16(CHAR16 *path);
|
||||||
void efi_devpath_free(EFI_DEVICE_PATH *dp);
|
void efi_devpath_free(EFI_DEVICE_PATH *dp);
|
||||||
|
EFI_HANDLE efi_devpath_to_handle(EFI_DEVICE_PATH *path, EFI_HANDLE *handles, unsigned nhandles);
|
||||||
|
|
||||||
int efi_status_to_errno(EFI_STATUS);
|
int efi_status_to_errno(EFI_STATUS);
|
||||||
EFI_STATUS errno_to_efi_status(int errno);
|
EFI_STATUS errno_to_efi_status(int errno);
|
||||||
|
@ -269,3 +269,25 @@ efi_devpath_length(EFI_DEVICE_PATH *path)
|
|||||||
path = NextDevicePathNode(path);
|
path = NextDevicePathNode(path);
|
||||||
return ((UINTN)path - (UINTN)start) + DevicePathNodeLength(path);
|
return ((UINTN)path - (UINTN)start) + DevicePathNodeLength(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EFI_HANDLE
|
||||||
|
efi_devpath_to_handle(EFI_DEVICE_PATH *path, EFI_HANDLE *handles, unsigned nhandles)
|
||||||
|
{
|
||||||
|
unsigned i;
|
||||||
|
EFI_DEVICE_PATH *media, *devpath;
|
||||||
|
EFI_HANDLE h;
|
||||||
|
|
||||||
|
media = efi_devpath_to_media_path(path);
|
||||||
|
if (media == NULL)
|
||||||
|
return (NULL);
|
||||||
|
for (i = 0; i < nhandles; i++) {
|
||||||
|
h = handles[i];
|
||||||
|
devpath = efi_lookup_devpath(h);
|
||||||
|
if (devpath == NULL)
|
||||||
|
continue;
|
||||||
|
if (!efi_devpath_match_node(media, efi_devpath_to_media_path(devpath)))
|
||||||
|
continue;
|
||||||
|
return (h);
|
||||||
|
}
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
@ -140,23 +140,12 @@ efiblk_get_pdinfo(struct devdesc *dev)
|
|||||||
pdinfo_t *
|
pdinfo_t *
|
||||||
efiblk_get_pdinfo_by_device_path(EFI_DEVICE_PATH *path)
|
efiblk_get_pdinfo_by_device_path(EFI_DEVICE_PATH *path)
|
||||||
{
|
{
|
||||||
unsigned i;
|
|
||||||
EFI_DEVICE_PATH *media, *devpath;
|
|
||||||
EFI_HANDLE h;
|
EFI_HANDLE h;
|
||||||
|
|
||||||
media = efi_devpath_to_media_path(path);
|
h = efi_devpath_to_handle(path, efipart_handles, efipart_nhandles);
|
||||||
if (media == NULL)
|
if (h == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
for (i = 0; i < efipart_nhandles; i++) {
|
return (efiblk_get_pdinfo_by_handle(h));
|
||||||
h = efipart_handles[i];
|
|
||||||
devpath = efi_lookup_devpath(h);
|
|
||||||
if (devpath == NULL)
|
|
||||||
continue;
|
|
||||||
if (!efi_devpath_match_node(media, efi_devpath_to_media_path(devpath)))
|
|
||||||
continue;
|
|
||||||
return (efiblk_get_pdinfo_by_handle(h));
|
|
||||||
}
|
|
||||||
return (NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
Loading…
Reference in New Issue
Block a user