iPXE
Functions
efi_service.h File Reference

EFI service binding. More...

#include <ipxe/efi/efi.h>

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 
int efi_service_add (EFI_HANDLE service, EFI_GUID *binding, EFI_HANDLE *handle)
 Add service to child handle. More...
 
int efi_service_del (EFI_HANDLE service, EFI_GUID *binding, EFI_HANDLE handle)
 Remove service from child handle. More...
 

Detailed Description

EFI service binding.

Definition in file efi_service.h.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ efi_service_add()

int efi_service_add ( EFI_HANDLE  service,
EFI_GUID binding,
EFI_HANDLE handle 
)

Add service to child handle.

Parameters
serviceService binding handle
bindingService binding protocol GUID
handleHandle on which to install child
Return values
rcReturn status code

Definition at line 46 of file efi_service.c.

47  {
49  EFI_STATUS efirc;
50  int rc;
51 
52  /* Open service binding protocol */
53  if ( ( rc = efi_open ( service, binding, &sb ) ) != 0 ) {
54  DBGC ( service, "EFISVC %s cannot open %s binding: %s\n",
55  efi_handle_name ( service ), efi_guid_ntoa ( binding ),
56  strerror ( rc ) );
57  return rc;
58  }
59 
60  /* Create child handle */
61  if ( ( efirc = sb->CreateChild ( sb, handle ) ) != 0 ) {
62  rc = -EEFI ( efirc );
63  DBGC ( service, "EFISVC %s could not create %s child: %s\n",
64  efi_handle_name ( service ), efi_guid_ntoa ( binding ),
65  strerror ( rc ) );
66  return rc;
67  }
68 
69  DBGC ( service, "EFISVC %s created %s child ",
70  efi_handle_name ( service ), efi_guid_ntoa ( binding ) );
71  DBGC ( service, "%s\n", efi_handle_name ( *handle ) );
72  return 0;
73 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
Definition: efi.h:174
#define DBGC(...)
Definition: compiler.h:505
EFI_SERVICE_BINDING_CREATE_CHILD CreateChild
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:652
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
#define efi_open(handle, protocol, interface)
Open protocol for ephemeral use.
Definition: efi.h:443
The EFI_SERVICE_BINDING_PROTOCOL provides member functions to create and destroy child handles.
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_guid.c:725
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
uint16_t handle
Handle.
Definition: smbios.h:16

References _EFI_SERVICE_BINDING_PROTOCOL::CreateChild, DBGC, EEFI, efi_guid_ntoa(), efi_handle_name(), efi_open, handle, rc, and strerror().

Referenced by mnpnet_start().

◆ efi_service_del()

int efi_service_del ( EFI_HANDLE  service,
EFI_GUID binding,
EFI_HANDLE  handle 
)

Remove service from child handle.

Parameters
serviceService binding handle
bindingService binding protocol GUID
handleChild handle
Return values
rcReturn status code

Definition at line 83 of file efi_service.c.

84  {
86  EFI_STATUS efirc;
87  int rc;
88 
89  DBGC ( service, "EFISVC %s removing %s child ",
90  efi_handle_name ( service ), efi_guid_ntoa ( binding ) );
91  DBGC ( service, "%s\n", efi_handle_name ( handle ) );
92 
93  /* Open service binding protocol */
94  if ( ( rc = efi_open ( service, binding, &sb ) ) != 0 ) {
95  DBGC ( service, "EFISVC %s cannot open %s binding: %s\n",
96  efi_handle_name ( service ), efi_guid_ntoa ( binding ),
97  strerror ( rc ) );
98  return rc;
99  }
100 
101  /* Destroy child handle */
102  if ( ( efirc = sb->DestroyChild ( sb, handle ) ) != 0 ) {
103  rc = -EEFI ( efirc );
104  DBGC ( service, "EFISVC %s could not destroy %s child ",
105  efi_handle_name ( service ), efi_guid_ntoa ( binding ) );
106  DBGC ( service, "%s: %s\n",
107  efi_handle_name ( handle ), strerror ( rc ) );
108  return rc;
109  }
110 
111  return 0;
112 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
Definition: efi.h:174
#define DBGC(...)
Definition: compiler.h:505
EFI_SERVICE_BINDING_DESTROY_CHILD DestroyChild
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:652
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
#define efi_open(handle, protocol, interface)
Open protocol for ephemeral use.
Definition: efi.h:443
The EFI_SERVICE_BINDING_PROTOCOL provides member functions to create and destroy child handles.
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_guid.c:725
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
uint16_t handle
Handle.
Definition: smbios.h:16

References DBGC, _EFI_SERVICE_BINDING_PROTOCOL::DestroyChild, EEFI, efi_guid_ntoa(), efi_handle_name(), efi_open, handle, rc, and strerror().

Referenced by mnpnet_start(), and mnpnet_stop().