iPXE
Data Structures | Macros | Functions | Variables
efi.h File Reference

EFI API. More...

#include <ipxe/efi/Uefi/UefiBaseType.h>
#include <ipxe/efi/Uefi.h>
#include <ipxe/efi/PiDxe.h>
#include <ipxe/efi/Protocol/LoadedImage.h>
#include <ipxe/tables.h>
#include <ipxe/uuid.h>

Go to the source code of this file.

Data Structures

struct  EFI_HANDLE
 
struct  efi_protocol
 An EFI protocol used by iPXE. More...
 
struct  efi_config_table
 An EFI configuration table used by iPXE. More...
 

Macros

#define EFI_HANDLE   STUPID_EFI_HANDLE
 
#define EFI_PROTOCOLS   __table ( struct efi_protocol, "efi_protocols" )
 EFI protocol table. More...
 
#define __efi_protocol   __table_entry ( EFI_PROTOCOLS, 01 )
 Declare an EFI protocol used by iPXE. More...
 
#define EFI_REQUIRE_PROTOCOL(_protocol, _ptr)
 Declare an EFI protocol to be required by iPXE. More...
 
#define EFI_REQUEST_PROTOCOL(_protocol, _ptr)
 Declare an EFI protocol to be requested by iPXE. More...
 
#define EFI_CONFIG_TABLES   __table ( struct efi_config_table, "efi_config_tables" )
 EFI configuration table table. More...
 
#define __efi_config_table   __table_entry ( EFI_CONFIG_TABLES, 01 )
 Declare an EFI configuration table used by iPXE. More...
 
#define EFI_USE_TABLE(_table, _ptr, _required)
 Declare an EFI configuration table to be used by iPXE. More...
 
#define EFIRC(rc)   ERRNO_TO_PLATFORM ( -(rc) )
 Convert an iPXE status code to an EFI status code. More...
 
#define EEFI(efirc)   EPLATFORM ( EINFO_EPLATFORM, efirc )
 Convert an EFI status code to an iPXE status code. More...
 
#define DBG_EFI_OPENERS_IF(level, handle, protocol)
 
#define DBG_EFI_PROTOCOLS_IF(level, handle)
 
#define DBGC_EFI_OPENERS_IF(level, id, ...)
 
#define DBGC_EFI_PROTOCOLS_IF(level, id, ...)
 
#define DBGC_EFI_OPENERS(...)   DBGC_EFI_OPENERS_IF ( LOG, ##__VA_ARGS__ )
 
#define DBGC_EFI_PROTOCOLS(...)   DBGC_EFI_PROTOCOLS_IF ( LOG, ##__VA_ARGS__ )
 
#define DBGC2_EFI_OPENERS(...)   DBGC_EFI_OPENERS_IF ( EXTRA, ##__VA_ARGS__ )
 
#define DBGC2_EFI_PROTOCOLS(...)   DBGC_EFI_PROTOCOLS_IF ( EXTRA, ##__VA_ARGS__ )
 
#define DBGCP_EFI_OPENERS(...)   DBGC_EFI_OPENERS_IF ( PROFILE, ##__VA_ARGS__ )
 
#define DBGCP_EFI_PROTOCOLS(...)   DBGC_EFI_PROTOCOLS_IF ( PROFILE, ##__VA_ARGS__ )
 

Functions

 FILE_LICENCE (GPL2_OR_LATER)
 
const char * efi_guid_ntoa (EFI_GUID *guid)
 Convert GUID to a printable string. More...
 
const char * efi_locate_search_type_name (EFI_LOCATE_SEARCH_TYPE search_type)
 Name locate search type. More...
 
const char * efi_open_attributes_name (unsigned int attributes)
 Name protocol open attributes. More...
 
const char * efi_devpath_text (EFI_DEVICE_PATH_PROTOCOL *path)
 Get textual representation of device path. More...
 
const char * efi_handle_name (EFI_HANDLE handle)
 Get name of an EFI handle. More...
 
void dbg_efi_openers (EFI_HANDLE handle, EFI_GUID *protocol)
 Print list of openers of a given protocol on a given handle. More...
 
void dbg_efi_protocols (EFI_HANDLE handle)
 Print list of protocol handlers attached to a handle. More...
 
EFI_STATUS efi_init (EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *systab)
 Initialise EFI environment. More...
 

Variables

EFI_GUID efi_absolute_pointer_protocol_guid
 Absolute pointer protocol GUID. More...
 
EFI_GUID efi_acpi_table_protocol_guid
 ACPI table protocol GUID. More...
 
EFI_GUID efi_apple_net_boot_protocol_guid
 Apple NetBoot protocol GUID. More...
 
EFI_GUID efi_arp_protocol_guid
 ARP protocol GUID. More...
 
EFI_GUID efi_arp_service_binding_protocol_guid
 ARP service binding protocol GUID. More...
 
EFI_GUID efi_block_io_protocol_guid
 Block I/O protocol GUID. More...
 
EFI_GUID efi_block_io2_protocol_guid
 Block I/O version 2 protocol GUID. More...
 
EFI_GUID efi_bus_specific_driver_override_protocol_guid
 Bus specific driver override protocol GUID. More...
 
EFI_GUID efi_component_name_protocol_guid
 Component name protocol GUID. More...
 
EFI_GUID efi_component_name2_protocol_guid
 Component name 2 protocol GUID. More...
 
EFI_GUID efi_console_control_protocol_guid
 Console control protocol GUID. More...
 
EFI_GUID efi_device_path_protocol_guid
 Device path protocol GUID. More...
 
EFI_GUID efi_dhcp4_protocol_guid
 DHCPv4 protocol GUID. More...
 
EFI_GUID efi_dhcp4_service_binding_protocol_guid
 DHCPv4 service binding protocol GUID. More...
 
EFI_GUID efi_disk_io_protocol_guid
 Disk I/O protocol GUID. More...
 
EFI_GUID efi_driver_binding_protocol_guid
 Driver binding protocol GUID. More...
 
EFI_GUID efi_graphics_output_protocol_guid
 Graphics output protocol GUID. More...
 
EFI_GUID efi_hii_config_access_protocol_guid
 HII configuration access protocol GUID. More...
 
EFI_GUID efi_hii_font_protocol_guid
 HII font protocol GUID. More...
 
EFI_GUID efi_ip4_protocol_guid
 IPv4 protocol GUID. More...
 
EFI_GUID efi_ip4_config_protocol_guid
 IPv4 configuration protocol GUID. More...
 
EFI_GUID efi_ip4_service_binding_protocol_guid
 IPv4 service binding protocol GUID. More...
 
EFI_GUID efi_load_file_protocol_guid
 Load file protocol GUID. More...
 
EFI_GUID efi_load_file2_protocol_guid
 Load file 2 protocol GUID. More...
 
EFI_GUID efi_loaded_image_protocol_guid
 Loaded image protocol GUID. More...
 
EFI_GUID efi_loaded_image_device_path_protocol_guid
 Loaded image device path protocol GUID. More...
 
EFI_GUID efi_managed_network_protocol_guid
 Managed network protocol GUID. More...
 
EFI_GUID efi_managed_network_service_binding_protocol_guid
 Managed network service binding protocol GUID. More...
 
EFI_GUID efi_mtftp4_protocol_guid
 MTFTPv4 protocol GUID. More...
 
EFI_GUID efi_mtftp4_service_binding_protocol_guid
 MTFTPv4 service binding protocol GUID. More...
 
EFI_GUID efi_nii_protocol_guid
 Network interface identifier protocol GUID (old version) More...
 
EFI_GUID efi_nii31_protocol_guid
 Network interface identifier protocol GUID (new version) More...
 
EFI_GUID efi_pci_io_protocol_guid
 PCI I/O protocol GUID. More...
 
EFI_GUID efi_pci_root_bridge_io_protocol_guid
 PCI root bridge I/O protocol GUID. More...
 
EFI_GUID efi_pxe_base_code_protocol_guid
 PXE base code protocol GUID. More...
 
EFI_GUID efi_serial_io_protocol_guid
 Serial I/O protocol GUID. More...
 
EFI_GUID efi_simple_file_system_protocol_guid
 Simple file system protocol GUID. More...
 
EFI_GUID efi_simple_network_protocol_guid
 Simple network protocol GUID. More...
 
EFI_GUID efi_simple_pointer_protocol_guid
 Simple pointer protocol GUID. More...
 
EFI_GUID efi_simple_text_input_protocol_guid
 Simple text input protocol GUID. More...
 
EFI_GUID efi_simple_text_input_ex_protocol_guid
 Simple text input extension protocol GUID. More...
 
EFI_GUID efi_simple_text_output_protocol_guid
 Simple text output protocol GUID. More...
 
EFI_GUID efi_tcg_protocol_guid
 TCG protocol GUID. More...
 
EFI_GUID efi_tcp4_protocol_guid
 TCPv4 protocol GUID. More...
 
EFI_GUID efi_tcp4_service_binding_protocol_guid
 TCPv4 service binding protocol GUID. More...
 
EFI_GUID efi_tree_protocol_guid
 TrEE protocol GUID. More...
 
EFI_GUID efi_udp4_protocol_guid
 UDPv4 protocol GUID. More...
 
EFI_GUID efi_udp4_service_binding_protocol_guid
 UDPv4 service binding protocol GUID. More...
 
EFI_GUID efi_uga_draw_protocol_guid
 UGA draw protocol GUID. More...
 
EFI_GUID efi_unicode_collation_protocol_guid
 Unicode collation protocol GUID. More...
 
EFI_GUID efi_usb_hc_protocol_guid
 USB host controller protocol GUID. More...
 
EFI_GUID efi_usb2_hc_protocol_guid
 USB2 host controller protocol GUID. More...
 
EFI_GUID efi_usb_io_protocol_guid
 USB I/O protocol GUID. More...
 
EFI_GUID efi_vlan_config_protocol_guid
 VLAN configuration protocol GUID. More...
 
EFI_GUID efi_file_info_id
 File information GUID. More...
 
EFI_GUID efi_file_system_info_id
 File system information GUID. More...
 
EFI_HANDLE efi_image_handle
 Image handle passed to entry point. More...
 
EFI_LOADED_IMAGE_PROTOCOLefi_loaded_image
 Loaded image protocol for this image. More...
 
EFI_DEVICE_PATH_PROTOCOLefi_loaded_image_path
 
EFI_SYSTEM_TABLEefi_systab
 
int efi_shutdown_in_progress
 EFI shutdown is in progress. More...
 

Detailed Description

EFI API.

The intention is to include near-verbatim copies of the EFI headers required by iPXE. This is achieved using the import.pl script in this directory. Run the import script to update the local copies of the headers:

./import.pl /path/to/edk2/edk2

where /path/to/edk2/edk2 is the path to your local checkout of the EFI Development Kit.

Note that import.pl will modify any #include lines in each imported header to reflect its new location within the iPXE tree. It will also tidy up the file by removing carriage return characters and trailing whitespace.

Definition in file efi.h.

Macro Definition Documentation

◆ EFI_HANDLE

#define EFI_HANDLE   STUPID_EFI_HANDLE

Definition at line 52 of file efi.h.

◆ EFI_PROTOCOLS

#define EFI_PROTOCOLS   __table ( struct efi_protocol, "efi_protocols" )

EFI protocol table.

Definition at line 80 of file efi.h.

◆ __efi_protocol

#define __efi_protocol   __table_entry ( EFI_PROTOCOLS, 01 )

Declare an EFI protocol used by iPXE.

Definition at line 83 of file efi.h.

◆ EFI_REQUIRE_PROTOCOL

#define EFI_REQUIRE_PROTOCOL (   _protocol,
  _ptr 
)
Value:
struct efi_protocol __ ## _protocol __efi_protocol = { \
.guid = _protocol ## _GUID, \
.protocol = ( ( void ** ) ( void * ) \
( ( (_ptr) == ( ( _protocol ** ) (_ptr) ) ) ? \
(_ptr) : (_ptr) ) ), \
.required = 1, \
}
An EFI protocol used by iPXE.
Definition: efi.h:70
int required
Protocol is required.
Definition: efi.h:76
#define __efi_protocol
Declare an EFI protocol used by iPXE.
Definition: efi.h:83

Declare an EFI protocol to be required by iPXE.

Parameters
_protocolEFI protocol name
_ptrPointer to protocol instance

Definition at line 90 of file efi.h.

◆ EFI_REQUEST_PROTOCOL

#define EFI_REQUEST_PROTOCOL (   _protocol,
  _ptr 
)
Value:
struct efi_protocol __ ## _protocol __efi_protocol = { \
.guid = _protocol ## _GUID, \
.protocol = ( ( void ** ) ( void * ) \
( ( (_ptr) == ( ( _protocol ** ) (_ptr) ) ) ? \
(_ptr) : (_ptr) ) ), \
.required = 0, \
}
An EFI protocol used by iPXE.
Definition: efi.h:70
int required
Protocol is required.
Definition: efi.h:76
#define __efi_protocol
Declare an EFI protocol used by iPXE.
Definition: efi.h:83

Declare an EFI protocol to be requested by iPXE.

Parameters
_protocolEFI protocol name
_ptrPointer to protocol instance

Definition at line 104 of file efi.h.

◆ EFI_CONFIG_TABLES

#define EFI_CONFIG_TABLES   __table ( struct efi_config_table, "efi_config_tables" )

EFI configuration table table.

Definition at line 124 of file efi.h.

◆ __efi_config_table

#define __efi_config_table   __table_entry ( EFI_CONFIG_TABLES, 01 )

Declare an EFI configuration table used by iPXE.

Definition at line 128 of file efi.h.

◆ EFI_USE_TABLE

#define EFI_USE_TABLE (   _table,
  _ptr,
  _required 
)
Value:
struct efi_config_table __ ## _table __efi_config_table = { \
.guid = _table ## _GUID, \
.table = ( ( void ** ) ( void * ) (_ptr) ), \
.required = (_required), \
}
An EFI configuration table used by iPXE.
Definition: efi.h:114
#define __efi_config_table
Declare an EFI configuration table used by iPXE.
Definition: efi.h:128

Declare an EFI configuration table to be used by iPXE.

Parameters
_tableEFI configuration table name
_ptrPointer to configuration table
_requiredTable is required for operation

Definition at line 136 of file efi.h.

◆ EFIRC

#define EFIRC (   rc)    ERRNO_TO_PLATFORM ( -(rc) )

Convert an iPXE status code to an EFI status code.

Parameters
rciPXE status code
Return values
efircEFI status code

Definition at line 149 of file efi.h.

◆ EEFI

#define EEFI (   efirc)    EPLATFORM ( EINFO_EPLATFORM, efirc )

Convert an EFI status code to an iPXE status code.

Parameters
efircEFI status code
Return values
rciPXE status code (before negation)

Definition at line 157 of file efi.h.

◆ DBG_EFI_OPENERS_IF

#define DBG_EFI_OPENERS_IF (   level,
  handle,
  protocol 
)
Value:
do { \
if ( DBG_ ## level ) { \
dbg_efi_openers ( handle, protocol ); \
} \
} while ( 0 )
uint16_t protocol
Protocol ID.
Definition: stp.h:18
uint16_t handle
Handle.
Definition: smbios.h:16

Definition at line 236 of file efi.h.

◆ DBG_EFI_PROTOCOLS_IF

#define DBG_EFI_PROTOCOLS_IF (   level,
  handle 
)
Value:
do { \
if ( DBG_ ## level ) { \
dbg_efi_protocols ( handle ); \
} \
} while ( 0 )
uint16_t handle
Handle.
Definition: smbios.h:16

Definition at line 242 of file efi.h.

◆ DBGC_EFI_OPENERS_IF

#define DBGC_EFI_OPENERS_IF (   level,
  id,
  ... 
)
Value:
do { \
DBG_AC_IF ( level, id ); \
DBG_EFI_OPENERS_IF ( level, __VA_ARGS__ ); \
DBG_DC_IF ( level ); \
} while ( 0 )

Definition at line 248 of file efi.h.

◆ DBGC_EFI_PROTOCOLS_IF

#define DBGC_EFI_PROTOCOLS_IF (   level,
  id,
  ... 
)
Value:
do { \
DBG_AC_IF ( level, id ); \
DBG_EFI_PROTOCOLS_IF ( level, __VA_ARGS__ ); \
DBG_DC_IF ( level ); \
} while ( 0 )

Definition at line 254 of file efi.h.

◆ DBGC_EFI_OPENERS

#define DBGC_EFI_OPENERS (   ...)    DBGC_EFI_OPENERS_IF ( LOG, ##__VA_ARGS__ )

Definition at line 260 of file efi.h.

◆ DBGC_EFI_PROTOCOLS

#define DBGC_EFI_PROTOCOLS (   ...)    DBGC_EFI_PROTOCOLS_IF ( LOG, ##__VA_ARGS__ )

Definition at line 262 of file efi.h.

◆ DBGC2_EFI_OPENERS

#define DBGC2_EFI_OPENERS (   ...)    DBGC_EFI_OPENERS_IF ( EXTRA, ##__VA_ARGS__ )

Definition at line 265 of file efi.h.

◆ DBGC2_EFI_PROTOCOLS

#define DBGC2_EFI_PROTOCOLS (   ...)    DBGC_EFI_PROTOCOLS_IF ( EXTRA, ##__VA_ARGS__ )

Definition at line 267 of file efi.h.

◆ DBGCP_EFI_OPENERS

#define DBGCP_EFI_OPENERS (   ...)    DBGC_EFI_OPENERS_IF ( PROFILE, ##__VA_ARGS__ )

Definition at line 270 of file efi.h.

◆ DBGCP_EFI_PROTOCOLS

#define DBGCP_EFI_PROTOCOLS (   ...)    DBGC_EFI_PROTOCOLS_IF ( PROFILE, ##__VA_ARGS__ )

Definition at line 272 of file efi.h.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER  )

◆ efi_guid_ntoa()

const char* efi_guid_ntoa ( EFI_GUID guid)

Convert GUID to a printable string.

Parameters
guidGUID
Return values
stringPrintable string

Definition at line 192 of file efi_debug.c.

192  {
193  union {
194  union uuid uuid;
195  EFI_GUID guid;
196  } u;
197  unsigned int i;
198 
199  /* Sanity check */
200  if ( ! guid )
201  return NULL;
202 
203  /* Check for a match against well-known GUIDs */
204  for ( i = 0 ; i < ( sizeof ( efi_well_known_guids ) /
205  sizeof ( efi_well_known_guids[0] ) ) ; i++ ) {
207  sizeof ( *guid ) ) == 0 ) {
208  return efi_well_known_guids[i].name;
209  }
210  }
211 
212  /* Convert GUID to standard endianness */
213  memcpy ( &u.guid, guid, sizeof ( u.guid ) );
214  uuid_mangle ( &u.uuid );
215  return uuid_ntoa ( &u.uuid );
216 }
const char * name
Name.
Definition: efi_debug.c:67
128 bit buffer containing a unique identifier value.
Definition: Base.h:263
A universally unique ID.
Definition: uuid.h:15
static struct efi_well_known_guid efi_well_known_guids[]
Well-known GUIDs.
Definition: efi_debug.c:71
static void uuid_mangle(union uuid *uuid)
Change UUID endianness.
Definition: uuid.h:43
void * memcpy(void *dest, const void *src, size_t len) __nonnull
const char * uuid_ntoa(const union uuid *uuid)
Convert UUID to printable string.
Definition: uuid.c:43
uint64_t guid
GUID.
Definition: edd.h:30
EFI_GUID guid
GUID.
Definition: efi.h:116
union @16 u
int memcmp(const void *first, const void *second, size_t len)
Compare memory regions.
Definition: string.c:98
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

References efi_well_known_guids, guid, efi_well_known_guid::guid, memcmp(), memcpy(), efi_well_known_guid::name, NULL, u, uuid_mangle(), and uuid_ntoa().

Referenced by chained_locate(), chained_supported(), dbg_efi_openers(), dbg_efi_protocols(), efi_close_protocol_wrapper(), efi_file_get_info(), efi_file_set_info(), efi_handle_name(), efi_handle_protocol_wrapper(), efi_init(), efi_install_protocol_interface_wrapper(), efi_locate_device(), efi_locate_device_path_wrapper(), efi_locate_handle_buffer_wrapper(), efi_locate_handle_wrapper(), efi_locate_protocol_wrapper(), efi_open_protocol_wrapper(), efi_protocols_per_handle_wrapper(), efi_reinstall_protocol_interface_wrapper(), and efi_uninstall_protocol_interface_wrapper().

◆ efi_locate_search_type_name()

const char* efi_locate_search_type_name ( EFI_LOCATE_SEARCH_TYPE  search_type)

Name locate search type.

Parameters
search_typeLocate search type
Return values
nameLocate search type name

Definition at line 225 of file efi_debug.c.

225  {
226  static char buf[16];
227 
228  switch ( search_type ) {
229  case AllHandles : return "AllHandles";
230  case ByRegisterNotify: return "ByRegisterNotify";
231  case ByProtocol: return "ByProtocol";
232  default:
233  snprintf ( buf, sizeof ( buf ), "UNKNOWN<%d>", search_type );
234  return buf;
235  }
236 }
Retrieve all the handles in the handle database.
Definition: UefiSpec.h:1439
Retrieve the next handle fron a RegisterProtocolNotify() event.
Definition: UefiSpec.h:1443
int snprintf(char *buf, size_t size, const char *fmt,...)
Write a formatted string to a buffer.
Definition: vsprintf.c:382
Retrieve the set of handles from the handle database that support a specified protocol.
Definition: UefiSpec.h:1448

References AllHandles, ByProtocol, ByRegisterNotify, and snprintf().

Referenced by efi_locate_handle_buffer_wrapper(), and efi_locate_handle_wrapper().

◆ efi_open_attributes_name()

const char* efi_open_attributes_name ( unsigned int  attributes)

Name protocol open attributes.

Parameters
attributesProtocol open attributes
Return values
nameProtocol open attributes name

Returns a (static) string with characters for each set bit corresponding to BY_(H)ANDLE_PROTOCOL, (G)ET_PROTOCOL, (T)EST_PROTOCOL, BY_(C)HILD_CONTROLLER, BY_(D)RIVER, and E(X)CLUSIVE.

Definition at line 250 of file efi_debug.c.

250  {
251  static char attribute_chars[] = "HGTCDX";
252  static char name[ sizeof ( attribute_chars ) ];
253  char *tmp = name;
254  unsigned int i;
255 
256  for ( i = 0 ; i < ( sizeof ( attribute_chars ) - 1 ) ; i++ ) {
257  if ( attributes & ( 1 << i ) )
258  *(tmp++) = attribute_chars[i];
259  }
260  *tmp = '\0';
261 
262  return name;
263 }
const char * name
Definition: ath9k_hw.c:1984
uint8_t * tmp
Definition: entropy.h:156

References name, and tmp.

Referenced by dbg_efi_openers(), and efi_open_protocol_wrapper().

◆ efi_devpath_text()

const char* efi_devpath_text ( EFI_DEVICE_PATH_PROTOCOL path)

Get textual representation of device path.

Parameters
pathDevice path
Return values
textTextual representation of device path, or NULL

Definition at line 366 of file efi_debug.c.

366  {
368  static char text[256];
369  size_t len;
370  CHAR16 *wtext;
371 
372  /* Sanity checks */
373  if ( ! path ) {
374  DBG ( "[NULL DevicePath]" );
375  return NULL;
376  }
377 
378  /* If we have no DevicePathToText protocol then use a raw hex string */
379  if ( ! efidpt ) {
380  DBG ( "[No DevicePathToText]" );
381  len = efi_devpath_len ( path );
382  base16_encode ( path, len, text, sizeof ( text ) );
383  return text;
384  }
385 
386  /* Convert path to a textual representation */
387  wtext = efidpt->ConvertDevicePathToText ( path, TRUE, FALSE );
388  if ( ! wtext )
389  return NULL;
390 
391  /* Store path in buffer */
392  snprintf ( text, sizeof ( text ), "%ls", wtext );
393 
394  /* Free path */
395  bs->FreePool ( wtext );
396 
397  return text;
398 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2000
size_t efi_devpath_len(EFI_DEVICE_PATH_PROTOCOL *path)
Find length of device path (excluding terminator)
Definition: efi_utils.c:59
unsigned short CHAR16
Definition: ProcessorBind.h:59
static EFI_DEVICE_PATH_TO_TEXT_PROTOCOL * efidpt
Device path to text protocol.
Definition: efi_debug.c:47
EFI Boot Services Table.
Definition: UefiSpec.h:1836
EFI_FREE_POOL FreePool
Definition: UefiSpec.h:1855
#define TRUE
Definition: tlan.h:46
uint32_t len
Length.
Definition: ena.h:14
#define FALSE
Definition: tlan.h:45
int snprintf(char *buf, size_t size, const char *fmt,...)
Write a formatted string to a buffer.
Definition: vsprintf.c:382
EFI_SYSTEM_TABLE * efi_systab
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
EFI_DEVICE_PATH_TO_TEXT_PATH ConvertDevicePathToText
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

References EFI_SYSTEM_TABLE::BootServices, EFI_DEVICE_PATH_TO_TEXT_PROTOCOL::ConvertDevicePathToText, DBG, efi_devpath_len(), efi_systab, efidpt, FALSE, EFI_BOOT_SERVICES::FreePool, len, NULL, snprintf(), and TRUE.

Referenced by efi_block_boot_image(), efi_block_hook(), efi_connect_controller_wrapper(), efi_driver_start(), efi_driver_supported(), efi_load_image_wrapper(), efi_loaded_image_filepath_name(), efi_locate_device_path_wrapper(), efi_wrap(), usbio_open(), and usbio_path().

◆ efi_handle_name()

const char* efi_handle_name ( EFI_HANDLE  handle)

Get name of an EFI handle.

Parameters
handleEFI handle
Return values
textName of handle, or NULL

Definition at line 713 of file efi_debug.c.

713  {
715  struct efi_handle_name_type *type;
716  static char buf[256];
717  size_t used = 0;
718  EFI_GUID **protocols;
719  UINTN count;
720  unsigned int i;
721  void *interface;
722  const char *name;
723  EFI_STATUS efirc;
724 
725  /* Fail immediately for NULL handles */
726  if ( ! handle )
727  return NULL;
728 
729  /* Try each name type in turn */
730  for ( i = 0 ; i < ( sizeof ( efi_handle_name_types ) /
731  sizeof ( efi_handle_name_types[0] ) ) ; i++ ) {
733  DBG2 ( "<%d", i );
734 
735  /* Try to open the applicable protocol */
736  efirc = bs->OpenProtocol ( handle, type->protocol, &interface,
739  if ( efirc != 0 ) {
740  DBG2 ( ">" );
741  continue;
742  }
743 
744  /* Try to get name from this protocol */
745  DBG2 ( "-" );
746  name = type->name ( interface );
747  DBG2 ( "%c", ( name ? ( name[0] ? 'Y' : 'E' ) : 'N' ) );
748 
749  /* Close protocol */
750  bs->CloseProtocol ( handle, type->protocol,
752  DBG2 ( ">" );
753 
754  /* Use this name, if possible */
755  if ( name && name[0] )
756  return name;
757  }
758 
759  /* If no name is found, then use the raw handle value and a
760  * list of installed protocols.
761  */
762  used = ssnprintf ( buf, sizeof ( buf ), "UNKNOWN<%p", handle );
763  if ( ( efirc = bs->ProtocolsPerHandle ( handle, &protocols,
764  &count ) ) == 0 ) {
765  for ( i = 0 ; i < count ; i++ ) {
766  used += ssnprintf ( ( buf + used ),
767  ( sizeof ( buf ) - used ), ",%s",
768  efi_guid_ntoa ( protocols[i] ) );
769  }
770  bs->FreePool ( protocols );
771  }
772  used += ssnprintf ( ( buf + used ), ( sizeof ( buf ) - used ), ">" );
773  return buf;
774 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2000
const char * name
Definition: ath9k_hw.c:1984
128 bit buffer containing a unique identifier value.
Definition: Base.h:263
uint8_t type
Type.
Definition: ena.h:16
EFI_CLOSE_PROTOCOL CloseProtocol
Definition: UefiSpec.h:1906
int ssnprintf(char *buf, ssize_t ssize, const char *fmt,...)
Version of vsnprintf() that accepts a signed buffer size.
Definition: vsprintf.c:420
An object interface.
Definition: interface.h:109
#define EFI_OPEN_PROTOCOL_GET_PROTOCOL
Definition: UefiSpec.h:1271
static struct efi_handle_name_type efi_handle_name_types[]
EFI handle name types.
Definition: efi_debug.c:677
EFI Boot Services Table.
Definition: UefiSpec.h:1836
EFI_HANDLE efi_image_handle
Image handle passed to entry point.
Definition: efi_init.c:30
UINT64 UINTN
Unsigned value of native width.
Definition: ProcessorBind.h:71
EFI_FREE_POOL FreePool
Definition: UefiSpec.h:1855
const char * efi_guid_ntoa(EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_debug.c:192
EFI_PROTOCOLS_PER_HANDLE ProtocolsPerHandle
Definition: UefiSpec.h:1912
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:35
uint16_t count
Number of entries.
Definition: ena.h:22
An EFI handle name type.
Definition: efi_debug.c:652
EFI_SYSTEM_TABLE * efi_systab
EFI_OPEN_PROTOCOL OpenProtocol
Definition: UefiSpec.h:1905
uint16_t handle
Handle.
Definition: smbios.h:16
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362
#define DBG2(...)
Definition: compiler.h:515

References EFI_SYSTEM_TABLE::BootServices, EFI_BOOT_SERVICES::CloseProtocol, count, DBG2, efi_guid_ntoa(), efi_handle_name_types, efi_image_handle, EFI_OPEN_PROTOCOL_GET_PROTOCOL, efi_systab, EFI_BOOT_SERVICES::FreePool, handle, name, NULL, EFI_BOOT_SERVICES::OpenProtocol, EFI_BOOT_SERVICES::ProtocolsPerHandle, ssnprintf(), and type.

Referenced by chained_locate(), chained_supported(), dbg_efi_openers(), dbg_efi_protocols(), efi_blacklist(), efi_bofm_start(), efi_bofm_supported(), efi_child_add(), efi_child_del(), efi_close_protocol_wrapper(), efi_connect_controller_wrapper(), efi_device_info(), efi_disconnect_controller_wrapper(), efi_driver_connect(), efi_driver_start(), efi_driver_stop(), efi_driver_supported(), efi_exit_boot_services_wrapper(), efi_exit_wrapper(), efi_handle_protocol_wrapper(), efi_install_protocol_interface_wrapper(), efi_load_image_wrapper(), efi_local_check_volume_name(), efi_local_open_root(), efi_local_open_volume(), efi_locate_device(), efi_locate_device_path_wrapper(), efi_locate_handle_buffer_wrapper(), efi_locate_handle_wrapper(), efi_open_protocol_wrapper(), efi_pci_info(), efi_protocols_per_handle_wrapper(), efi_pxe_install(), efi_pxe_uninstall(), efi_reinstall_protocol_interface_wrapper(), efi_snp_probe(), efi_start_image_wrapper(), efi_uninstall_protocol_interface_wrapper(), efi_unload_blacklist(), efi_unload_image_wrapper(), efi_usb_install(), efi_wrap(), efipci_open(), efipci_root(), efipci_start(), nii_start(), nii_supported(), snp_supported(), snpnet_start(), snpnet_stop(), usbio_bulk_in_poll(), usbio_bulk_out_poll(), usbio_config(), usbio_control_poll(), usbio_endpoint_open(), usbio_interface(), usbio_interfaces(), usbio_interrupt_callback(), usbio_interrupt_open(), usbio_open(), usbio_path(), usbio_start(), and usbio_supported().

◆ dbg_efi_openers()

void dbg_efi_openers ( EFI_HANDLE  handle,
EFI_GUID protocol 
)

Print list of openers of a given protocol on a given handle.

Parameters
handleEFI handle
protocolProtocol GUID

Definition at line 271 of file efi_debug.c.

271  {
275  UINTN count;
276  unsigned int i;
277  EFI_STATUS efirc;
278  int rc;
279 
280  /* Sanity check */
281  if ( ( ! handle ) || ( ! protocol ) ) {
282  printf ( "HANDLE %s could not retrieve openers for %s\n",
284  efi_guid_ntoa ( protocol ) );
285  return;
286  }
287 
288  /* Retrieve list of openers */
289  if ( ( efirc = bs->OpenProtocolInformation ( handle, protocol, &openers,
290  &count ) ) != 0 ) {
291  rc = -EEFI ( efirc );
292  printf ( "HANDLE %s could not retrieve openers for %s: %s\n",
294  efi_guid_ntoa ( protocol ), strerror ( rc ) );
295  return;
296  }
297 
298  /* Dump list of openers */
299  for ( i = 0 ; i < count ; i++ ) {
300  opener = &openers[i];
301  printf ( "HANDLE %s %s opened %dx (%s)",
303  efi_guid_ntoa ( protocol ), opener->OpenCount,
304  efi_open_attributes_name ( opener->Attributes ) );
305  printf ( " by %s", efi_handle_name ( opener->AgentHandle ) );
306  if ( opener->ControllerHandle == handle ) {
307  printf ( "\n" );
308  } else {
309  printf ( " for %s\n",
310  efi_handle_name ( opener->ControllerHandle ) );
311  }
312  }
313 
314  /* Free list */
315  bs->FreePool ( openers );
316 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2000
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
EFI Oprn Protocol Information Entry.
Definition: UefiSpec.h:1349
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
Definition: efi.h:157
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition: vsprintf.c:464
EFI_HANDLE ControllerHandle
Definition: UefiSpec.h:1351
EFI_HANDLE AgentHandle
Definition: UefiSpec.h:1350
UINT32 OpenCount
Definition: UefiSpec.h:1353
UINT32 Attributes
Definition: UefiSpec.h:1352
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:713
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
EFI Boot Services Table.
Definition: UefiSpec.h:1836
UINT64 UINTN
Unsigned value of native width.
Definition: ProcessorBind.h:71
EFI_FREE_POOL FreePool
Definition: UefiSpec.h:1855
EFI_OPEN_PROTOCOL_INFORMATION OpenProtocolInformation
Definition: UefiSpec.h:1907
const char * efi_guid_ntoa(EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_debug.c:192
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:35
uint16_t count
Number of entries.
Definition: ena.h:22
const char * efi_open_attributes_name(unsigned int attributes)
Name protocol open attributes.
Definition: efi_debug.c:250
EFI_SYSTEM_TABLE * efi_systab
uint16_t protocol
Protocol ID.
Definition: stp.h:18
uint16_t handle
Handle.
Definition: smbios.h:16

References EFI_OPEN_PROTOCOL_INFORMATION_ENTRY::AgentHandle, EFI_OPEN_PROTOCOL_INFORMATION_ENTRY::Attributes, EFI_SYSTEM_TABLE::BootServices, EFI_OPEN_PROTOCOL_INFORMATION_ENTRY::ControllerHandle, count, EEFI, efi_guid_ntoa(), efi_handle_name(), efi_open_attributes_name(), efi_systab, EFI_BOOT_SERVICES::FreePool, handle, EFI_OPEN_PROTOCOL_INFORMATION_ENTRY::OpenCount, EFI_BOOT_SERVICES::OpenProtocolInformation, printf(), protocol, rc, and strerror().

Referenced by dbg_efi_protocols().

◆ dbg_efi_protocols()

void dbg_efi_protocols ( EFI_HANDLE  handle)

Print list of protocol handlers attached to a handle.

Parameters
handleEFI handle

Definition at line 323 of file efi_debug.c.

323  {
325  EFI_GUID **protocols;
327  UINTN count;
328  unsigned int i;
329  EFI_STATUS efirc;
330  int rc;
331 
332  /* Sanity check */
333  if ( ! handle ) {
334  printf ( "HANDLE %p could not retrieve protocols\n", handle );
335  return;
336  }
337 
338  /* Retrieve list of protocols */
339  if ( ( efirc = bs->ProtocolsPerHandle ( handle, &protocols,
340  &count ) ) != 0 ) {
341  rc = -EEFI ( efirc );
342  printf ( "HANDLE %s could not retrieve protocols: %s\n",
343  efi_handle_name ( handle ), strerror ( rc ) );
344  return;
345  }
346 
347  /* Dump list of protocols */
348  for ( i = 0 ; i < count ; i++ ) {
349  protocol = protocols[i];
350  printf ( "HANDLE %s %s supported\n", efi_handle_name ( handle ),
351  efi_guid_ntoa ( protocol ) );
353  }
354 
355  /* Free list */
356  bs->FreePool ( protocols );
357 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2000
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:157
int printf(const char *fmt,...)
Write a formatted string to the console.
Definition: vsprintf.c:464
void dbg_efi_openers(EFI_HANDLE handle, EFI_GUID *protocol)
Print list of openers of a given protocol on a given handle.
Definition: efi_debug.c:271
128 bit buffer containing a unique identifier value.
Definition: Base.h:263
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:713
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
EFI Boot Services Table.
Definition: UefiSpec.h:1836
UINT64 UINTN
Unsigned value of native width.
Definition: ProcessorBind.h:71
EFI_FREE_POOL FreePool
Definition: UefiSpec.h:1855
const char * efi_guid_ntoa(EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_debug.c:192
EFI_PROTOCOLS_PER_HANDLE ProtocolsPerHandle
Definition: UefiSpec.h:1912
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:35
uint16_t count
Number of entries.
Definition: ena.h:22
EFI_SYSTEM_TABLE * efi_systab
uint16_t protocol
Protocol ID.
Definition: stp.h:18
uint16_t handle
Handle.
Definition: smbios.h:16

References EFI_SYSTEM_TABLE::BootServices, count, dbg_efi_openers(), EEFI, efi_guid_ntoa(), efi_handle_name(), efi_systab, EFI_BOOT_SERVICES::FreePool, handle, printf(), protocol, EFI_BOOT_SERVICES::ProtocolsPerHandle, rc, and strerror().

◆ efi_init()

EFI_STATUS efi_init ( EFI_HANDLE  image_handle,
EFI_SYSTEM_TABLE systab 
)

Initialise EFI environment.

Parameters
image_handleImage handle
systabSystem table
Return values
efircEFI return status code

Definition at line 97 of file efi_init.c.

98  {
100  struct efi_protocol *prot;
101  struct efi_config_table *tab;
102  void *loaded_image;
103  EFI_STATUS efirc;
104  int rc;
105 
106  /* Store image handle and system table pointer for future use */
107  efi_image_handle = image_handle;
108  efi_systab = systab;
109 
110  /* Sanity checks */
111  if ( ! systab ) {
112  efirc = EFI_NOT_AVAILABLE_YET;
113  goto err_sanity;
114  }
115  if ( ! systab->ConOut ) {
116  efirc = EFI_NOT_AVAILABLE_YET;
117  goto err_sanity;
118  }
119  if ( ! systab->BootServices ) {
120  DBGC ( systab, "EFI provided no BootServices entry point\n" );
121  efirc = EFI_NOT_AVAILABLE_YET;
122  goto err_sanity;
123  }
124  if ( ! systab->RuntimeServices ) {
125  DBGC ( systab, "EFI provided no RuntimeServices entry "
126  "point\n" );
127  efirc = EFI_NOT_AVAILABLE_YET;
128  goto err_sanity;
129  }
130  DBGC ( systab, "EFI handle %p systab %p\n", image_handle, systab );
131  bs = systab->BootServices;
132 
133  /* Look up used protocols */
135  if ( ( efirc = bs->LocateProtocol ( &prot->guid, NULL,
136  prot->protocol ) ) == 0 ) {
137  DBGC ( systab, "EFI protocol %s is at %p\n",
138  efi_guid_ntoa ( &prot->guid ),
139  *(prot->protocol) );
140  } else {
141  DBGC ( systab, "EFI does not provide protocol %s\n",
142  efi_guid_ntoa ( &prot->guid ) );
143  /* Fail if protocol is required */
144  if ( prot->required )
145  goto err_missing_protocol;
146  }
147  }
148 
149  /* Look up used configuration tables */
151  if ( ( *(tab->table) = efi_find_table ( &tab->guid ) ) ) {
152  DBGC ( systab, "EFI configuration table %s is at %p\n",
153  efi_guid_ntoa ( &tab->guid ), *(tab->table) );
154  } else {
155  DBGC ( systab, "EFI does not provide configuration "
156  "table %s\n", efi_guid_ntoa ( &tab->guid ) );
157  if ( tab->required ) {
158  efirc = EFI_NOT_AVAILABLE_YET;
159  goto err_missing_table;
160  }
161  }
162  }
163 
164  /* Get loaded image protocol */
165  if ( ( efirc = bs->OpenProtocol ( image_handle,
167  &loaded_image, image_handle, NULL,
168  EFI_OPEN_PROTOCOL_GET_PROTOCOL ) ) != 0 ) {
169  rc = -EEFI ( efirc );
170  DBGC ( systab, "EFI could not get loaded image protocol: %s",
171  strerror ( rc ) );
172  goto err_no_loaded_image;
173  }
174  efi_loaded_image = loaded_image;
175  DBGC ( systab, "EFI image base address %p\n",
177 
178  /* EFI is perfectly capable of gracefully shutting down any
179  * loaded devices if it decides to fall back to a legacy boot.
180  * For no particularly comprehensible reason, it doesn't
181  * bother doing so when ExitBootServices() is called.
182  */
183  if ( ( efirc = bs->CreateEvent ( EVT_SIGNAL_EXIT_BOOT_SERVICES,
185  NULL, &efi_shutdown_event ) ) != 0 ) {
186  rc = -EEFI ( efirc );
187  DBGC ( systab, "EFI could not create ExitBootServices event: "
188  "%s\n", strerror ( rc ) );
189  goto err_create_event;
190  }
191 
192  /* Install driver binding protocol */
193  if ( ( rc = efi_driver_install() ) != 0 ) {
194  DBGC ( systab, "EFI could not install driver: %s\n",
195  strerror ( rc ) );
196  efirc = EFIRC ( rc );
197  goto err_driver_install;
198  }
199 
200  /* Install image unload method */
202 
203  return 0;
204 
206  err_driver_install:
208  err_create_event:
209  err_no_loaded_image:
210  err_missing_table:
211  err_missing_protocol:
212  err_sanity:
213  return efirc;
214 }
void efi_driver_uninstall(void)
Uninstall EFI driver.
Definition: efi_driver.c:405
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2000
void ** protocol
Variable containing pointer to protocol structure.
Definition: efi.h:74
EFI_LOADED_IMAGE_PROTOCOL * efi_loaded_image
Loaded image protocol for this image.
Definition: efi_init.c:33
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:157
EFI_LOCATE_PROTOCOL LocateProtocol
Definition: UefiSpec.h:1914
EFI_GUID guid
GUID.
Definition: efi.h:72
#define DBGC(...)
Definition: compiler.h:505
EFI_GUID efi_loaded_image_protocol_guid
Loaded image protocol GUID.
Definition: efi_guid.c:184
EFI_CLOSE_EVENT CloseEvent
Definition: UefiSpec.h:1864
VOID * ImageBase
The base address at which the image was loaded.
Definition: LoadedImage.h:75
#define EFI_PROTOCOLS
EFI protocol table.
Definition: efi.h:80
#define EVT_SIGNAL_EXIT_BOOT_SERVICES
Definition: UefiSpec.h:396
#define EFI_CONFIG_TABLES
EFI configuration table table.
Definition: efi.h:124
An EFI configuration table used by iPXE.
Definition: efi.h:114
#define EFI_NOT_AVAILABLE_YET
If this value is returned by an API, it means the capability is not yet installed/available/ready to ...
Definition: PiMultiPhase.h:55
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL * ConOut
A pointer to the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL interface that is associated with ConsoleOutHandle.
Definition: UefiSpec.h:1982
static EFI_EVENT efi_shutdown_event
Event used to signal shutdown.
Definition: efi_init.c:48
static EFIAPI void efi_shutdown_hook(EFI_EVENT event __unused, void *context __unused)
Shut down in preparation for booting an OS.
Definition: efi_init.c:60
EFI_CREATE_EVENT CreateEvent
Definition: UefiSpec.h:1860
static void * efi_find_table(EFI_GUID *guid)
Look up EFI configuration table.
Definition: efi_init.c:78
#define EFI_OPEN_PROTOCOL_GET_PROTOCOL
Definition: UefiSpec.h:1271
An EFI protocol used by iPXE.
Definition: efi.h:70
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
EFI Boot Services Table.
Definition: UefiSpec.h:1836
EFI_HANDLE efi_image_handle
Image handle passed to entry point.
Definition: efi_init.c:30
EFI_IMAGE_UNLOAD Unload
Definition: LoadedImage.h:79
#define for_each_table_entry(pointer, table)
Iterate through all entries within a linker table.
Definition: tables.h:358
#define TPL_CALLBACK
Definition: UefiSpec.h:591
void ** table
Variable containing pointer to configuration table.
Definition: efi.h:118
int required
Protocol is required.
Definition: efi.h:76
const char * efi_guid_ntoa(EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_debug.c:192
EFI_RUNTIME_SERVICES * RuntimeServices
A pointer to the EFI Runtime Services Table.
Definition: UefiSpec.h:1996
EFI_GUID guid
GUID.
Definition: efi.h:116
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:35
EFI_SYSTEM_TABLE * efi_systab
EFI_OPEN_PROTOCOL OpenProtocol
Definition: UefiSpec.h:1905
int required
Table is required for operation.
Definition: efi.h:120
static EFI_STATUS EFIAPI efi_unload(EFI_HANDLE image_handle)
Shut down EFI environment.
Definition: efi_init.c:221
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362
int efi_driver_install(void)
Install EFI driver.
Definition: efi_driver.c:372
#define EFIRC(rc)
Convert an iPXE status code to an EFI status code.
Definition: efi.h:149

References EFI_SYSTEM_TABLE::BootServices, EFI_BOOT_SERVICES::CloseEvent, EFI_SYSTEM_TABLE::ConOut, EFI_BOOT_SERVICES::CreateEvent, DBGC, EEFI, EFI_CONFIG_TABLES, efi_driver_install(), efi_driver_uninstall(), efi_find_table(), efi_guid_ntoa(), efi_image_handle, efi_loaded_image, efi_loaded_image_protocol_guid, EFI_NOT_AVAILABLE_YET, EFI_OPEN_PROTOCOL_GET_PROTOCOL, EFI_PROTOCOLS, efi_shutdown_event, efi_shutdown_hook(), efi_systab, efi_unload(), EFIRC, EVT_SIGNAL_EXIT_BOOT_SERVICES, for_each_table_entry, efi_protocol::guid, efi_config_table::guid, EFI_LOADED_IMAGE_PROTOCOL::ImageBase, EFI_BOOT_SERVICES::LocateProtocol, NULL, EFI_BOOT_SERVICES::OpenProtocol, efi_protocol::protocol, rc, efi_protocol::required, efi_config_table::required, EFI_SYSTEM_TABLE::RuntimeServices, strerror(), efi_config_table::table, TPL_CALLBACK, and EFI_LOADED_IMAGE_PROTOCOL::Unload.

Referenced by _efi_start(), and _efidrv_start().

Variable Documentation

◆ efi_absolute_pointer_protocol_guid

EFI_GUID efi_absolute_pointer_protocol_guid

Absolute pointer protocol GUID.

Definition at line 88 of file efi_guid.c.

◆ efi_acpi_table_protocol_guid

EFI_GUID efi_acpi_table_protocol_guid

ACPI table protocol GUID.

Definition at line 92 of file efi_guid.c.

◆ efi_apple_net_boot_protocol_guid

EFI_GUID efi_apple_net_boot_protocol_guid

Apple NetBoot protocol GUID.

Definition at line 96 of file efi_guid.c.

Referenced by efi_pxe_install(), and efi_pxe_uninstall().

◆ efi_arp_protocol_guid

EFI_GUID efi_arp_protocol_guid

ARP protocol GUID.

Definition at line 100 of file efi_guid.c.

◆ efi_arp_service_binding_protocol_guid

EFI_GUID efi_arp_service_binding_protocol_guid

ARP service binding protocol GUID.

Definition at line 104 of file efi_guid.c.

◆ efi_block_io_protocol_guid

EFI_GUID efi_block_io_protocol_guid

Block I/O protocol GUID.

Definition at line 108 of file efi_guid.c.

Referenced by efi_block_hook(), efi_block_unhook(), efi_file_install(), and efi_file_uninstall().

◆ efi_block_io2_protocol_guid

EFI_GUID efi_block_io2_protocol_guid

Block I/O version 2 protocol GUID.

Definition at line 112 of file efi_guid.c.

◆ efi_bus_specific_driver_override_protocol_guid

EFI_GUID efi_bus_specific_driver_override_protocol_guid

Bus specific driver override protocol GUID.

Definition at line 116 of file efi_guid.c.

◆ efi_component_name_protocol_guid

EFI_GUID efi_component_name_protocol_guid

Component name protocol GUID.

Definition at line 120 of file efi_guid.c.

Referenced by efi_blacklist().

◆ efi_component_name2_protocol_guid

EFI_GUID efi_component_name2_protocol_guid

Component name 2 protocol GUID.

Definition at line 124 of file efi_guid.c.

Referenced by efi_driver_controller_name(), efi_driver_install(), efi_driver_uninstall(), efi_snp_probe(), and efi_snp_remove().

◆ efi_console_control_protocol_guid

EFI_GUID efi_console_control_protocol_guid

Console control protocol GUID.

Definition at line 128 of file efi_guid.c.

◆ efi_device_path_protocol_guid

EFI_GUID efi_device_path_protocol_guid

◆ efi_dhcp4_protocol_guid

EFI_GUID efi_dhcp4_protocol_guid

DHCPv4 protocol GUID.

Definition at line 136 of file efi_guid.c.

◆ efi_dhcp4_service_binding_protocol_guid

EFI_GUID efi_dhcp4_service_binding_protocol_guid

DHCPv4 service binding protocol GUID.

Definition at line 140 of file efi_guid.c.

◆ efi_disk_io_protocol_guid

EFI_GUID efi_disk_io_protocol_guid

Disk I/O protocol GUID.

Definition at line 144 of file efi_guid.c.

Referenced by efi_file_install(), and efi_file_uninstall().

◆ efi_driver_binding_protocol_guid

EFI_GUID efi_driver_binding_protocol_guid

Driver binding protocol GUID.

Definition at line 148 of file efi_guid.c.

Referenced by efi_blacklist(), efi_driver_install(), efi_driver_uninstall(), and efi_unload_blacklist().

◆ efi_graphics_output_protocol_guid

EFI_GUID efi_graphics_output_protocol_guid

Graphics output protocol GUID.

Definition at line 152 of file efi_guid.c.

Referenced by efifb_init().

◆ efi_hii_config_access_protocol_guid

EFI_GUID efi_hii_config_access_protocol_guid

HII configuration access protocol GUID.

Definition at line 156 of file efi_guid.c.

Referenced by efi_snp_hii_install(), and efi_snp_hii_uninstall().

◆ efi_hii_font_protocol_guid

EFI_GUID efi_hii_font_protocol_guid

HII font protocol GUID.

Definition at line 160 of file efi_guid.c.

Referenced by efifb_init().

◆ efi_ip4_protocol_guid

EFI_GUID efi_ip4_protocol_guid

IPv4 protocol GUID.

Definition at line 164 of file efi_guid.c.

◆ efi_ip4_config_protocol_guid

EFI_GUID efi_ip4_config_protocol_guid

IPv4 configuration protocol GUID.

Definition at line 168 of file efi_guid.c.

◆ efi_ip4_service_binding_protocol_guid

EFI_GUID efi_ip4_service_binding_protocol_guid

IPv4 service binding protocol GUID.

Definition at line 172 of file efi_guid.c.

◆ efi_load_file_protocol_guid

EFI_GUID efi_load_file_protocol_guid

Load file protocol GUID.

Definition at line 176 of file efi_guid.c.

Referenced by efi_snp_probe(), and efi_snp_remove().

◆ efi_load_file2_protocol_guid

EFI_GUID efi_load_file2_protocol_guid

Load file 2 protocol GUID.

Definition at line 180 of file efi_guid.c.

◆ efi_loaded_image_protocol_guid

EFI_GUID efi_loaded_image_protocol_guid

Loaded image protocol GUID.

Definition at line 184 of file efi_guid.c.

Referenced by efi_blacklist(), efi_image_exec(), efi_init(), and efi_wrap().

◆ efi_loaded_image_device_path_protocol_guid

EFI_GUID efi_loaded_image_device_path_protocol_guid

Loaded image device path protocol GUID.

Definition at line 188 of file efi_guid.c.

◆ efi_managed_network_protocol_guid

EFI_GUID efi_managed_network_protocol_guid

Managed network protocol GUID.

Definition at line 192 of file efi_guid.c.

◆ efi_managed_network_service_binding_protocol_guid

EFI_GUID efi_managed_network_service_binding_protocol_guid

Managed network service binding protocol GUID.

Definition at line 196 of file efi_guid.c.

◆ efi_mtftp4_protocol_guid

EFI_GUID efi_mtftp4_protocol_guid

MTFTPv4 protocol GUID.

Definition at line 200 of file efi_guid.c.

◆ efi_mtftp4_service_binding_protocol_guid

EFI_GUID efi_mtftp4_service_binding_protocol_guid

MTFTPv4 service binding protocol GUID.

Definition at line 204 of file efi_guid.c.

◆ efi_nii_protocol_guid

EFI_GUID efi_nii_protocol_guid

Network interface identifier protocol GUID (old version)

Definition at line 208 of file efi_guid.c.

Referenced by efi_snp_probe(), and efi_snp_remove().

◆ efi_nii31_protocol_guid

EFI_GUID efi_nii31_protocol_guid

Network interface identifier protocol GUID (new version)

Definition at line 212 of file efi_guid.c.

Referenced by efi_snp_probe(), efi_snp_remove(), nii_start(), nii_stop(), and nii_supported().

◆ efi_pci_io_protocol_guid

EFI_GUID efi_pci_io_protocol_guid

PCI I/O protocol GUID.

Definition at line 216 of file efi_guid.c.

Referenced by efi_pci_info(), efipci_close(), efipci_open(), efipci_start(), nii_pci_close(), and nii_pci_open().

◆ efi_pci_root_bridge_io_protocol_guid

EFI_GUID efi_pci_root_bridge_io_protocol_guid

PCI root bridge I/O protocol GUID.

Definition at line 220 of file efi_guid.c.

Referenced by efipci_read(), efipci_root(), and efipci_write().

◆ efi_pxe_base_code_protocol_guid

EFI_GUID efi_pxe_base_code_protocol_guid

PXE base code protocol GUID.

Definition at line 224 of file efi_guid.c.

Referenced by efi_pxe_install(), and efi_pxe_uninstall().

◆ efi_serial_io_protocol_guid

EFI_GUID efi_serial_io_protocol_guid

Serial I/O protocol GUID.

Definition at line 228 of file efi_guid.c.

◆ efi_simple_file_system_protocol_guid

EFI_GUID efi_simple_file_system_protocol_guid

Simple file system protocol GUID.

Definition at line 232 of file efi_guid.c.

Referenced by efi_block_boot(), efi_file_install(), efi_file_uninstall(), efi_local_open_root(), and efi_local_open_volume().

◆ efi_simple_network_protocol_guid

EFI_GUID efi_simple_network_protocol_guid

Simple network protocol GUID.

Definition at line 236 of file efi_guid.c.

Referenced by efi_set_autoboot(), efi_snp_probe(), efi_snp_remove(), snp_supported(), snpnet_start(), and snpnet_stop().

◆ efi_simple_pointer_protocol_guid

EFI_GUID efi_simple_pointer_protocol_guid

Simple pointer protocol GUID.

Definition at line 240 of file efi_guid.c.

◆ efi_simple_text_input_protocol_guid

EFI_GUID efi_simple_text_input_protocol_guid

Simple text input protocol GUID.

Definition at line 244 of file efi_guid.c.

◆ efi_simple_text_input_ex_protocol_guid

EFI_GUID efi_simple_text_input_ex_protocol_guid

Simple text input extension protocol GUID.

Definition at line 248 of file efi_guid.c.

◆ efi_simple_text_output_protocol_guid

EFI_GUID efi_simple_text_output_protocol_guid

Simple text output protocol GUID.

Definition at line 252 of file efi_guid.c.

◆ efi_tcg_protocol_guid

EFI_GUID efi_tcg_protocol_guid

TCG protocol GUID.

Definition at line 256 of file efi_guid.c.

◆ efi_tcp4_protocol_guid

EFI_GUID efi_tcp4_protocol_guid

TCPv4 protocol GUID.

Definition at line 260 of file efi_guid.c.

◆ efi_tcp4_service_binding_protocol_guid

EFI_GUID efi_tcp4_service_binding_protocol_guid

TCPv4 service binding protocol GUID.

Definition at line 264 of file efi_guid.c.

◆ efi_tree_protocol_guid

EFI_GUID efi_tree_protocol_guid

TrEE protocol GUID.

Definition at line 268 of file efi_guid.c.

◆ efi_udp4_protocol_guid

EFI_GUID efi_udp4_protocol_guid

UDPv4 protocol GUID.

Definition at line 272 of file efi_guid.c.

◆ efi_udp4_service_binding_protocol_guid

EFI_GUID efi_udp4_service_binding_protocol_guid

UDPv4 service binding protocol GUID.

Definition at line 276 of file efi_guid.c.

◆ efi_uga_draw_protocol_guid

EFI_GUID efi_uga_draw_protocol_guid

UGA draw protocol GUID.

Definition at line 280 of file efi_guid.c.

◆ efi_unicode_collation_protocol_guid

EFI_GUID efi_unicode_collation_protocol_guid

Unicode collation protocol GUID.

Definition at line 284 of file efi_guid.c.

◆ efi_usb_hc_protocol_guid

EFI_GUID efi_usb_hc_protocol_guid

USB host controller protocol GUID.

Definition at line 288 of file efi_guid.c.

◆ efi_usb2_hc_protocol_guid

EFI_GUID efi_usb2_hc_protocol_guid

USB2 host controller protocol GUID.

Definition at line 292 of file efi_guid.c.

◆ efi_usb_io_protocol_guid

EFI_GUID efi_usb_io_protocol_guid

USB I/O protocol GUID.

Definition at line 296 of file efi_guid.c.

Referenced by efi_usb_install(), efi_usb_uninstall(), usbio_close(), usbio_open(), usbio_start(), usbio_stop(), and usbio_supported().

◆ efi_vlan_config_protocol_guid

EFI_GUID efi_vlan_config_protocol_guid

VLAN configuration protocol GUID.

Definition at line 300 of file efi_guid.c.

◆ efi_file_info_id

EFI_GUID efi_file_info_id

File information GUID.

Definition at line 303 of file efi_guid.c.

Referenced by efi_file_get_info(), and efi_local_len().

◆ efi_file_system_info_id

EFI_GUID efi_file_system_info_id

File system information GUID.

Definition at line 306 of file efi_guid.c.

Referenced by efi_file_get_info(), and efi_local_check_volume_name().

◆ efi_image_handle

EFI_HANDLE efi_image_handle

◆ efi_loaded_image

EFI_LOADED_IMAGE_PROTOCOL* efi_loaded_image

Loaded image protocol for this image.

Definition at line 33 of file efi_init.c.

Referenced by _efi_start(), chained_locate(), efi_init(), efi_local_open_path(), efi_local_open_volume(), and efi_set_autoboot().

◆ efi_loaded_image_path

EFI_DEVICE_PATH_PROTOCOL* efi_loaded_image_path

◆ efi_systab

EFI_SYSTEM_TABLE* efi_systab

Referenced by chained_locate(), chained_supported(), dbg_efi_openers(), dbg_efi_protocols(), efi_blacklist(), efi_block_boot(), efi_block_boot_image(), efi_block_connect(), efi_block_hook(), efi_block_unhook(), efi_bofm_start(), efi_bofm_supported(), efi_child_add(), efi_child_del(), efi_close_protocol_wrapper(), efi_conin_name(), efi_connect_controller_wrapper(), efi_conout_name(), efi_currticks(), efi_devpath_text(), efi_disconnect_controller_wrapper(), efi_download_install(), efi_download_uninstall(), efi_driver_connect(), efi_driver_controller_name(), efi_driver_disconnect(), efi_driver_handles(), efi_driver_install(), efi_driver_reconnect(), efi_driver_start(), efi_driver_stop(), efi_driver_uninstall(), efi_entropy_disable(), efi_entropy_enable(), efi_entropy_tick(), efi_exit_boot_services_wrapper(), efi_exit_wrapper(), efi_file_install(), efi_file_uninstall(), efi_find_table(), efi_get_time(), efi_getchar(), efi_handle_cup(), efi_handle_dectcem_reset(), efi_handle_dectcem_set(), efi_handle_ed(), efi_handle_name(), efi_handle_protocol_wrapper(), efi_handle_sgr(), efi_image_exec(), efi_image_probe(), efi_init(), efi_install_protocol_interface_wrapper(), efi_iskey(), efi_load_image_wrapper(), efi_local_open_root(), efi_local_open_volume(), efi_locate_device(), efi_locate_device_path_wrapper(), efi_locate_handle_buffer_wrapper(), efi_locate_handle_wrapper(), efi_locate_protocol_wrapper(), efi_open_protocol_wrapper(), efi_poweroff(), efi_protocols_per_handle_wrapper(), efi_putchar(), efi_pxe_install(), efi_pxe_uninstall(), efi_reboot(), efi_reinstall_protocol_interface_wrapper(), efi_set_autoboot(), efi_snp_add_claim(), efi_snp_get_status(), efi_snp_hii_append(), efi_snp_hii_install(), efi_snp_hii_uninstall(), efi_snp_initialize(), efi_snp_poll(), efi_snp_probe(), efi_snp_receive(), efi_snp_remove(), efi_snp_reset(), efi_snp_shutdown(), efi_snp_transmit(), efi_snp_wait_for_packet(), efi_start_image_wrapper(), efi_tick_shutdown(), efi_tick_startup(), efi_udelay(), efi_uninstall_protocol_interface_wrapper(), efi_unload(), efi_unload_blacklist(), efi_unload_image_wrapper(), efi_urealloc(), efi_usb_async_interrupt_transfer(), efi_usb_async_start(), efi_usb_async_stop(), efi_usb_bulk_transfer(), efi_usb_close(), efi_usb_control_transfer(), efi_usb_get_string_descriptor(), efi_usb_install(), efi_usb_open(), efi_usb_probe(), efi_usb_sync_interrupt_transfer(), efi_usb_uninstall(), efi_watchdog_expired(), efi_wrap(), efifb_glyphs(), efifb_init(), efifb_select_mode(), efipci_close(), efipci_open(), efipci_read(), efipci_root(), efipci_write(), nii_block(), nii_issue_cpb_db(), nii_pci_close(), nii_pci_open(), nii_start(), nii_stop(), nii_supported(), snp_supported(), snpnet_start(), snpnet_stop(), usbio_close(), usbio_open(), usbio_path(), usbio_start(), usbio_stop(), and usbio_supported().

◆ efi_shutdown_in_progress

int efi_shutdown_in_progress

EFI shutdown is in progress.

Definition at line 45 of file efi_init.c.

Referenced by efi_currticks(), efi_shutdown_hook(), usbio_endpoint_enqueue(), and usbio_endpoint_poll().