summaryrefslogtreecommitdiffstats
path: root/src/interface
diff options
context:
space:
mode:
authorMichael Brown2025-03-23 18:49:39 +0100
committerMichael Brown2025-03-24 14:19:26 +0100
commit4561a03766de0d68870680e8bc40b9865d99f1e1 (patch)
treeb53b02cae9da973b21c3e2bf80f2ecece519b2a8 /src/interface
parent[efi] Create safe wrappers for OpenProtocol() and CloseProtocol() (diff)
downloadipxe-4561a03766de0d68870680e8bc40b9865d99f1e1.tar.gz
ipxe-4561a03766de0d68870680e8bc40b9865d99f1e1.tar.xz
ipxe-4561a03766de0d68870680e8bc40b9865d99f1e1.zip
[efi] Use efi_open_by_child() for all by-child protocol opens
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/interface')
-rw-r--r--src/interface/efi/efi_utils.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/src/interface/efi/efi_utils.c b/src/interface/efi/efi_utils.c
index 6ceba20e6..928d8e53a 100644
--- a/src/interface/efi/efi_utils.c
+++ b/src/interface/efi/efi_utils.c
@@ -120,19 +120,12 @@ int efi_locate_device ( EFI_HANDLE device, EFI_GUID *protocol,
* @ret rc Return status code
*/
int efi_child_add ( EFI_HANDLE parent, EFI_HANDLE child ) {
- EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
void *devpath;
- EFI_STATUS efirc;
int rc;
/* Re-open the device path protocol */
- if ( ( efirc = bs->OpenProtocol ( parent,
- &efi_device_path_protocol_guid,
- &devpath,
- efi_image_handle, child,
- EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
- ) ) != 0 ) {
- rc = -EEFI ( efirc );
+ if ( ( rc = efi_open_by_child ( parent, &efi_device_path_protocol_guid,
+ child, &devpath ) ) != 0 ) {
DBGC ( parent, "EFIDEV %s could not add child",
efi_handle_name ( parent ) );
DBGC ( parent, " %s: %s\n",
@@ -154,10 +147,8 @@ int efi_child_add ( EFI_HANDLE parent, EFI_HANDLE child ) {
* @v child EFI child device handle
*/
void efi_child_del ( EFI_HANDLE parent, EFI_HANDLE child ) {
- EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
- bs->CloseProtocol ( parent, &efi_device_path_protocol_guid,
- efi_image_handle, child );
+ efi_close_by_child ( parent, &efi_device_path_protocol_guid, child );
DBGC2 ( parent, "EFIDEV %s removed child", efi_handle_name ( parent ) );
DBGC2 ( parent, " %s\n", efi_handle_name ( child ) );
}