iPXE
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)
 FILE_SECBOOT (PERMITTED)
int efi_service_add (EFI_HANDLE service, EFI_GUID *binding, EFI_HANDLE *handle)
 Add service to child handle.
int efi_service_del (EFI_HANDLE service, EFI_GUID *binding, EFI_HANDLE handle)
 Remove service from child handle.

Detailed Description

EFI service binding.

Definition in file efi_service.h.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )

◆ FILE_SECBOOT()

FILE_SECBOOT ( PERMITTED )

References EFI_HANDLE, and handle.

◆ efi_service_add()

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

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 47 of file efi_service.c.

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

References _EFI_SERVICE_BINDING_PROTOCOL::CreateChild, DBGC, EEFI, efi_guid_ntoa(), EFI_HANDLE, 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 )
extern

Remove service from child handle.

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

Definition at line 84 of file efi_service.c.

85 {
87 EFI_STATUS efirc;
88 int rc;
89
90 DBGC ( service, "EFISVC %s removing %s child ",
91 efi_handle_name ( service ), efi_guid_ntoa ( binding ) );
92 DBGC ( service, "%s\n", efi_handle_name ( handle ) );
93
94 /* Open service binding protocol */
95 if ( ( rc = efi_open ( service, binding, &sb ) ) != 0 ) {
96 DBGC ( service, "EFISVC %s cannot open %s binding: %s\n",
97 efi_handle_name ( service ), efi_guid_ntoa ( binding ),
98 strerror ( rc ) );
99 return rc;
100 }
101
102 /* Destroy child handle */
103 if ( ( efirc = sb->DestroyChild ( sb, handle ) ) != 0 ) {
104 rc = -EEFI ( efirc );
105 DBGC ( service, "EFISVC %s could not destroy %s child ",
106 efi_handle_name ( service ), efi_guid_ntoa ( binding ) );
107 DBGC ( service, "%s: %s\n",
109 return rc;
110 }
111
112 return 0;
113}
EFI_SERVICE_BINDING_DESTROY_CHILD DestroyChild

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

Referenced by mnpnet_start(), and mnpnet_stop().