iPXE
Macros | Functions | Variables
efi_wrap.c File Reference

EFI image wrapping. More...

#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <ipxe/efi/efi.h>
#include <ipxe/efi/Protocol/LoadedImage.h>
#include <ipxe/efi/efi_wrap.h>

Go to the source code of this file.

Macros

#define colour   &efi_systab
 Colour for debug messages. More...
 
#define EFI_WRAP_DUMP_MAX   128
 Maximum size for hex dumps. More...
 
#define EFI_WRAP_PRESCROLL   16
 Number of lines to prescroll when needed. More...
 
#define MAX_WRAP_MULTI   20
 Maximum number of interfaces for wrapped ...MultipleProtocolInterfaces() More...
 

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 
 FILE_SECBOOT (PERMITTED)
 
static const char * efi_status (EFI_STATUS efirc)
 Convert EFI status code to text. More...
 
static const char * efi_boolean (BOOLEAN boolean)
 Convert EFI boolean to text. More...
 
static const char * efi_allocate_type (EFI_ALLOCATE_TYPE type)
 Convert EFI allocation type to text. More...
 
static const char * efi_memory_type (EFI_MEMORY_TYPE type)
 Convert EFI memory type to text. More...
 
static const char * efi_timer_delay (EFI_TIMER_DELAY type)
 Convert EFI timer delay type to text. More...
 
static const char * efi_time (EFI_TIME *time)
 Convert EFI time to text. More...
 
static const char * efi_reset_type (EFI_RESET_TYPE type)
 Convert EFI reset type to text. More...
 
static int efi_prescroll (unsigned int lines)
 Pre-scroll display to create space for output lines. More...
 
static void efi_dump_image (EFI_HANDLE handle)
 Dump information about a loaded image. More...
 
static EFI_TPL EFIAPI efi_raise_tpl_wrapper (EFI_TPL new_tpl)
 Wrap RaiseTPL() More...
 
static VOID EFIAPI efi_restore_tpl_wrapper (EFI_TPL old_tpl)
 Wrap RestoreTPL() More...
 
static EFI_STATUS EFIAPI efi_allocate_pages_wrapper (EFI_ALLOCATE_TYPE type, EFI_MEMORY_TYPE memory_type, UINTN pages, EFI_PHYSICAL_ADDRESS *memory)
 Wrap AllocatePages() More...
 
static EFI_STATUS EFIAPI efi_free_pages_wrapper (EFI_PHYSICAL_ADDRESS memory, UINTN pages)
 Wrap FreePages() More...
 
static EFI_STATUS EFIAPI efi_get_memory_map_wrapper (UINTN *memory_map_size, EFI_MEMORY_DESCRIPTOR *memory_map, UINTN *map_key, UINTN *descriptor_size, UINT32 *descriptor_version)
 Wrap GetMemoryMap() More...
 
static EFI_STATUS EFIAPI efi_allocate_pool_wrapper (EFI_MEMORY_TYPE pool_type, UINTN size, VOID **buffer)
 Wrap AllocatePool() More...
 
static EFI_STATUS EFIAPI efi_free_pool_wrapper (VOID *buffer)
 Wrap FreePool() More...
 
static EFI_STATUS EFIAPI efi_create_event_wrapper (UINT32 type, EFI_TPL notify_tpl, EFI_EVENT_NOTIFY notify_function, VOID *notify_context, EFI_EVENT *event)
 Wrap CreateEvent() More...
 
static EFI_STATUS EFIAPI efi_set_timer_wrapper (EFI_EVENT event, EFI_TIMER_DELAY type, UINT64 trigger_time)
 Wrap SetTimer() More...
 
static EFI_STATUS EFIAPI efi_wait_for_event_wrapper (UINTN number_of_events, EFI_EVENT *event, UINTN *index)
 Wrap WaitForEvent() More...
 
static EFI_STATUS EFIAPI efi_signal_event_wrapper (EFI_EVENT event)
 Wrap SignalEvent() More...
 
static EFI_STATUS EFIAPI efi_close_event_wrapper (EFI_EVENT event)
 Wrap CloseEvent() More...
 
static EFI_STATUS EFIAPI efi_check_event_wrapper (EFI_EVENT event)
 Wrap CheckEvent() More...
 
static EFI_STATUS EFIAPI efi_install_protocol_interface_wrapper (EFI_HANDLE *handle, EFI_GUID *protocol, EFI_INTERFACE_TYPE interface_type, VOID *interface)
 Wrap InstallProtocolInterface() More...
 
static EFI_STATUS EFIAPI efi_reinstall_protocol_interface_wrapper (EFI_HANDLE handle, EFI_GUID *protocol, VOID *old_interface, VOID *new_interface)
 Wrap ReinstallProtocolInterface() More...
 
static EFI_STATUS EFIAPI efi_uninstall_protocol_interface_wrapper (EFI_HANDLE handle, EFI_GUID *protocol, VOID *interface)
 Wrap UninstallProtocolInterface() More...
 
static EFI_STATUS EFIAPI efi_handle_protocol_wrapper (EFI_HANDLE handle, EFI_GUID *protocol, VOID **interface)
 Wrap HandleProtocol() More...
 
static EFI_STATUS EFIAPI efi_register_protocol_notify_wrapper (EFI_GUID *protocol, EFI_EVENT event, VOID **registration)
 Wrap RegisterProtocolNotify() More...
 
static EFI_STATUS EFIAPI efi_locate_handle_wrapper (EFI_LOCATE_SEARCH_TYPE search_type, EFI_GUID *protocol, VOID *search_key, UINTN *buffer_size, EFI_HANDLE *buffer)
 Wrap LocateHandle() More...
 
static EFI_STATUS EFIAPI efi_locate_device_path_wrapper (EFI_GUID *protocol, EFI_DEVICE_PATH_PROTOCOL **device_path, EFI_HANDLE *device)
 Wrap LocateDevicePath() More...
 
static EFI_STATUS EFIAPI efi_install_configuration_table_wrapper (EFI_GUID *guid, VOID *table)
 Wrap InstallConfigurationTable() More...
 
static EFI_STATUS EFIAPI efi_load_image_wrapper (BOOLEAN boot_policy, EFI_HANDLE parent_image_handle, EFI_DEVICE_PATH_PROTOCOL *device_path, VOID *source_buffer, UINTN source_size, EFI_HANDLE *image_handle)
 Wrap LoadImage() More...
 
static EFI_STATUS EFIAPI efi_start_image_wrapper (EFI_HANDLE image_handle, UINTN *exit_data_size, CHAR16 **exit_data)
 Wrap StartImage() More...
 
static EFI_STATUS EFIAPI efi_exit_wrapper (EFI_HANDLE image_handle, EFI_STATUS exit_status, UINTN exit_data_size, CHAR16 *exit_data)
 Wrap Exit() More...
 
static EFI_STATUS EFIAPI efi_unload_image_wrapper (EFI_HANDLE image_handle)
 Wrap UnloadImage() More...
 
static EFI_STATUS EFIAPI efi_exit_boot_services_wrapper (EFI_HANDLE image_handle, UINTN map_key)
 Wrap ExitBootServices() More...
 
static EFI_STATUS EFIAPI efi_get_next_monotonic_count_wrapper (UINT64 *count)
 Wrap GetNextMonotonicCount() More...
 
static EFI_STATUS EFIAPI efi_stall_wrapper (UINTN microseconds)
 Wrap Stall() More...
 
static EFI_STATUS EFIAPI efi_set_watchdog_timer_wrapper (UINTN timeout, UINT64 watchdog_code, UINTN data_size, CHAR16 *watchdog_data)
 Wrap SetWatchdogTimer() More...
 
static EFI_STATUS EFIAPI efi_connect_controller_wrapper (EFI_HANDLE controller_handle, EFI_HANDLE *driver_image_handle, EFI_DEVICE_PATH_PROTOCOL *remaining_path, BOOLEAN recursive)
 Wrap ConnectController() More...
 
static EFI_STATUS EFIAPI efi_disconnect_controller_wrapper (EFI_HANDLE controller_handle, EFI_HANDLE driver_image_handle, EFI_HANDLE child_handle)
 Wrap DisconnectController() More...
 
static EFI_STATUS EFIAPI efi_open_protocol_wrapper (EFI_HANDLE handle, EFI_GUID *protocol, VOID **interface, EFI_HANDLE agent_handle, EFI_HANDLE controller_handle, UINT32 attributes)
 Wrap OpenProtocol() More...
 
static EFI_STATUS EFIAPI efi_close_protocol_wrapper (EFI_HANDLE handle, EFI_GUID *protocol, EFI_HANDLE agent_handle, EFI_HANDLE controller_handle)
 Wrap CloseProtocol() More...
 
static EFI_STATUS EFIAPI efi_open_protocol_information_wrapper (EFI_HANDLE handle, EFI_GUID *protocol, EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **entry_buffer, UINTN *entry_count)
 Wrap OpenProtocolInformation() More...
 
static EFI_STATUS EFIAPI efi_protocols_per_handle_wrapper (EFI_HANDLE handle, EFI_GUID ***protocol_buffer, UINTN *protocol_buffer_count)
 Wrap ProtocolsPerHandle() More...
 
static EFI_STATUS EFIAPI efi_locate_handle_buffer_wrapper (EFI_LOCATE_SEARCH_TYPE search_type, EFI_GUID *protocol, VOID *search_key, UINTN *no_handles, EFI_HANDLE **buffer)
 Wrap LocateHandleBuffer() More...
 
static EFI_STATUS EFIAPI efi_locate_protocol_wrapper (EFI_GUID *protocol, VOID *registration, VOID **interface)
 Wrap LocateProtocol() More...
 
static EFI_STATUS EFIAPI efi_install_multiple_protocol_interfaces_wrapper (EFI_HANDLE *handle,...)
 Wrap InstallMultipleProtocolInterfaces() More...
 
static EFI_STATUS EFIAPI efi_uninstall_multiple_protocol_interfaces_wrapper (EFI_HANDLE handle,...)
 Wrap UninstallMultipleProtocolInterfaces() More...
 
static EFI_STATUS EFIAPI efi_create_event_ex_wrapper (UINT32 type, EFI_TPL notify_tpl, EFI_EVENT_NOTIFY notify_function, CONST VOID *notify_context, CONST EFI_GUID *event_group, EFI_EVENT *event)
 Wrap CreateEventEx() More...
 
static EFI_STATUS EFIAPI efi_get_time_wrapper (EFI_TIME *time, EFI_TIME_CAPABILITIES *cap)
 Wrap GetTime() More...
 
static EFI_STATUS EFIAPI efi_set_time_wrapper (EFI_TIME *time)
 Wrap SetTime() More...
 
static EFI_STATUS EFIAPI efi_get_wakeup_time_wrapper (BOOLEAN *enabled, BOOLEAN *pending, EFI_TIME *time)
 Wrap GetWakeupTime() More...
 
static EFI_STATUS EFIAPI efi_set_wakeup_time_wrapper (BOOLEAN enable, EFI_TIME *time)
 Wrap SetWakeupTime() More...
 
static EFI_STATUS EFIAPI efi_get_variable_wrapper (CHAR16 *name, EFI_GUID *guid, UINT32 *attrs, UINTN *len, VOID *data)
 Wrap GetVariable() More...
 
static EFI_STATUS EFIAPI efi_get_next_variable_name_wrapper (UINTN *len, CHAR16 *name, EFI_GUID *guid)
 Wrap GetNextVariableName() More...
 
static EFI_STATUS EFIAPI efi_set_variable_wrapper (CHAR16 *name, EFI_GUID *guid, UINT32 attrs, UINTN len, VOID *data)
 Wrap SetVariable() More...
 
static VOID EFIAPI efi_reset_system_wrapper (EFI_RESET_TYPE type, EFI_STATUS status, UINTN len, VOID *data)
 Wrap ResetSystem() More...
 
void efi_wrap_bs (EFI_BOOT_SERVICES *wrapper)
 Wrap a boot services table. More...
 
void efi_wrap_rs (EFI_RUNTIME_SERVICES *wrapper)
 Wrap a runtime services table. More...
 
void efi_wrap_systab (int global)
 Wrap the public EFI system table. More...
 
void efi_unwrap (void)
 Remove boot services table wrapper. More...
 
void efi_wrap_image (EFI_HANDLE handle)
 Wrap calls made by a newly loaded image. More...
 

Variables

static EFI_SYSTEM_TABLEefi_systab_pub
 Public EFI system table pointer. More...
 
static EFI_SYSTEM_TABLE efi_systab_priv
 Private EFI system table used while wrapping is active. More...
 
static EFI_BOOT_SERVICESefi_bs_orig
 Original EFI boot services table pointer. More...
 
static EFI_BOOT_SERVICES efi_bs_copy
 Backup of original EFI boot services table. More...
 
static EFI_RUNTIME_SERVICESefi_rs_orig
 Original EFI runtime services table pointer. More...
 
static EFI_RUNTIME_SERVICES efi_rs_copy
 Backup of original EFI runtime services table. More...
 

Detailed Description

EFI image wrapping.

Definition in file efi_wrap.c.

Macro Definition Documentation

◆ colour

#define colour   &efi_systab

Colour for debug messages.

Definition at line 42 of file efi_wrap.c.

◆ EFI_WRAP_DUMP_MAX

#define EFI_WRAP_DUMP_MAX   128

Maximum size for hex dumps.

Definition at line 45 of file efi_wrap.c.

◆ EFI_WRAP_PRESCROLL

#define EFI_WRAP_PRESCROLL   16

Number of lines to prescroll when needed.

Definition at line 48 of file efi_wrap.c.

◆ MAX_WRAP_MULTI

#define MAX_WRAP_MULTI   20

Maximum number of interfaces for wrapped ...MultipleProtocolInterfaces()

Definition at line 1120 of file efi_wrap.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ FILE_SECBOOT()

FILE_SECBOOT ( PERMITTED  )

◆ efi_status()

static const char* efi_status ( EFI_STATUS  efirc)
static

Convert EFI status code to text.

Parameters
efircEFI status code
Return values
textEFI status code text

Definition at line 74 of file efi_wrap.c.

74  {
75  static char buf[ 19 /* "0xXXXXXXXXXXXXXXXX" + NUL */ ];
76 
77  switch ( efirc ) {
78  case EFI_SUCCESS : return "0";
79  case EFI_LOAD_ERROR : return "LOAD_ERROR";
80  case EFI_INVALID_PARAMETER : return "INVALID_PARAMETER";
81  case EFI_UNSUPPORTED : return "UNSUPPORTED";
82  case EFI_BAD_BUFFER_SIZE : return "BAD_BUFFER_SIZE";
83  case EFI_BUFFER_TOO_SMALL : return "BUFFER_TOO_SMALL";
84  case EFI_NOT_READY : return "NOT_READY";
85  case EFI_DEVICE_ERROR : return "DEVICE_ERROR";
86  case EFI_WRITE_PROTECTED : return "WRITE_PROTECTED";
87  case EFI_OUT_OF_RESOURCES : return "OUT_OF_RESOURCES";
88  case EFI_VOLUME_CORRUPTED : return "VOLUME_CORRUPTED";
89  case EFI_VOLUME_FULL : return "VOLUME_FULL";
90  case EFI_NO_MEDIA : return "NO_MEDIA";
91  case EFI_MEDIA_CHANGED : return "MEDIA_CHANGED";
92  case EFI_NOT_FOUND : return "NOT_FOUND";
93  case EFI_ACCESS_DENIED : return "ACCESS_DENIED";
94  case EFI_NO_RESPONSE : return "NO_RESPONSE";
95  case EFI_NO_MAPPING : return "NO_MAPPING";
96  case EFI_TIMEOUT : return "TIMEOUT";
97  case EFI_NOT_STARTED : return "NOT_STARTED";
98  case EFI_ALREADY_STARTED : return "ALREADY_STARTED";
99  case EFI_ABORTED : return "ABORTED";
100  case EFI_ICMP_ERROR : return "ICMP_ERROR";
101  case EFI_TFTP_ERROR : return "TFTP_ERROR";
102  case EFI_PROTOCOL_ERROR : return "PROTOCOL_ERROR";
103  case EFI_INCOMPATIBLE_VERSION : return "INCOMPATIBLE_VERSION";
104  case EFI_SECURITY_VIOLATION : return "SECURITY_VIOLATION";
105  case EFI_CRC_ERROR : return "CRC_ERROR";
106  case EFI_END_OF_MEDIA : return "END_OF_MEDIA";
107  case EFI_END_OF_FILE : return "END_OF_FILE";
108  case EFI_INVALID_LANGUAGE : return "INVALID_LANGUAGE";
109  case EFI_COMPROMISED_DATA : return "COMPROMISED_DATA";
110  case EFI_WARN_UNKNOWN_GLYPH : return "WARN_UNKNOWN_GLYPH";
111  case EFI_WARN_DELETE_FAILURE : return "WARN_DELETE_FAILURE";
112  case EFI_WARN_WRITE_FAILURE : return "WARN_WRITE_FAILURE";
113  case EFI_WARN_BUFFER_TOO_SMALL : return "WARN_BUFFER_TOO_SMALL";
114  case EFI_WARN_STALE_DATA : return "WARN_STALE_DATA";
115  default:
116  snprintf ( buf, sizeof ( buf ), "%#lx",
117  ( unsigned long ) efirc );
118  return buf;
119  }
120 }
#define EFI_UNSUPPORTED
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:118
#define EFI_VOLUME_CORRUPTED
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:125
#define EFI_WARN_BUFFER_TOO_SMALL
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:153
#define EFI_ICMP_ERROR
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:137
#define EFI_NO_RESPONSE
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:131
#define EFI_ALREADY_STARTED
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:135
#define EFI_CRC_ERROR
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:142
#define EFI_BAD_BUFFER_SIZE
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:119
#define EFI_PROTOCOL_ERROR
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:139
#define EFI_BUFFER_TOO_SMALL
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:120
#define EFI_NO_MEDIA
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:127
#define EFI_OUT_OF_RESOURCES
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:124
#define EFI_DEVICE_ERROR
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:122
#define EFI_LOAD_ERROR
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:116
#define EFI_VOLUME_FULL
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:126
#define EFI_ACCESS_DENIED
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:130
#define EFI_COMPROMISED_DATA
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:146
#define EFI_NOT_STARTED
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:134
#define EFI_WRITE_PROTECTED
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:123
#define EFI_NOT_READY
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:121
#define EFI_INVALID_PARAMETER
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:117
#define EFI_END_OF_FILE
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:144
#define EFI_INVALID_LANGUAGE
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:145
#define EFI_WARN_STALE_DATA
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:154
#define EFI_WARN_DELETE_FAILURE
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:151
#define EFI_SECURITY_VIOLATION
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:141
#define EFI_MEDIA_CHANGED
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:128
#define EFI_NOT_FOUND
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:129
#define EFI_INCOMPATIBLE_VERSION
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:140
#define EFI_SUCCESS
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:115
#define EFI_WARN_UNKNOWN_GLYPH
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:150
#define EFI_NO_MAPPING
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:132
int snprintf(char *buf, size_t size, const char *fmt,...)
Write a formatted string to a buffer.
Definition: vsprintf.c:383
#define EFI_WARN_WRITE_FAILURE
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:152
#define EFI_END_OF_MEDIA
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:143
#define EFI_ABORTED
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:136
#define EFI_TFTP_ERROR
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:138
#define EFI_TIMEOUT
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:133

References EFI_ABORTED, EFI_ACCESS_DENIED, EFI_ALREADY_STARTED, EFI_BAD_BUFFER_SIZE, EFI_BUFFER_TOO_SMALL, EFI_COMPROMISED_DATA, EFI_CRC_ERROR, EFI_DEVICE_ERROR, EFI_END_OF_FILE, EFI_END_OF_MEDIA, EFI_ICMP_ERROR, EFI_INCOMPATIBLE_VERSION, EFI_INVALID_LANGUAGE, EFI_INVALID_PARAMETER, EFI_LOAD_ERROR, EFI_MEDIA_CHANGED, EFI_NO_MAPPING, EFI_NO_MEDIA, EFI_NO_RESPONSE, EFI_NOT_FOUND, EFI_NOT_READY, EFI_NOT_STARTED, EFI_OUT_OF_RESOURCES, EFI_PROTOCOL_ERROR, EFI_SECURITY_VIOLATION, EFI_SUCCESS, EFI_TFTP_ERROR, EFI_TIMEOUT, EFI_UNSUPPORTED, EFI_VOLUME_CORRUPTED, EFI_VOLUME_FULL, EFI_WARN_BUFFER_TOO_SMALL, EFI_WARN_DELETE_FAILURE, EFI_WARN_STALE_DATA, EFI_WARN_UNKNOWN_GLYPH, EFI_WARN_WRITE_FAILURE, EFI_WRITE_PROTECTED, and snprintf().

Referenced by efi_allocate_pages_wrapper(), efi_allocate_pool_wrapper(), efi_check_event_wrapper(), efi_close_event_wrapper(), efi_close_protocol_wrapper(), efi_connect_controller_wrapper(), efi_create_event_ex_wrapper(), efi_create_event_wrapper(), efi_disconnect_controller_wrapper(), efi_exit_boot_services_wrapper(), efi_exit_wrapper(), efi_free_pages_wrapper(), efi_free_pool_wrapper(), efi_get_memory_map_wrapper(), efi_get_next_monotonic_count_wrapper(), efi_get_next_variable_name_wrapper(), efi_get_time_wrapper(), efi_get_variable_wrapper(), efi_get_wakeup_time_wrapper(), efi_handle_protocol_wrapper(), efi_install_configuration_table_wrapper(), efi_install_multiple_protocol_interfaces_wrapper(), efi_install_protocol_interface_wrapper(), efi_load_image_wrapper(), efi_locate_device_path_wrapper(), efi_locate_handle_buffer_wrapper(), efi_locate_handle_wrapper(), efi_locate_protocol_wrapper(), efi_open_protocol_information_wrapper(), efi_open_protocol_wrapper(), efi_protocols_per_handle_wrapper(), efi_register_protocol_notify_wrapper(), efi_reinstall_protocol_interface_wrapper(), efi_reset_system_wrapper(), efi_set_time_wrapper(), efi_set_timer_wrapper(), efi_set_variable_wrapper(), efi_set_wakeup_time_wrapper(), efi_set_watchdog_timer_wrapper(), efi_signal_event_wrapper(), efi_stall_wrapper(), efi_start_image_wrapper(), efi_uninstall_multiple_protocol_interfaces_wrapper(), efi_uninstall_protocol_interface_wrapper(), efi_unload_image_wrapper(), and efi_wait_for_event_wrapper().

◆ efi_boolean()

static const char* efi_boolean ( BOOLEAN  boolean)
static

Convert EFI boolean to text.

Parameters
booleanBoolean value
Return values
textBoolean value text

Definition at line 128 of file efi_wrap.c.

128  {
129 
130  return ( boolean ? "TRUE" : "FALSE" );
131 }

Referenced by efi_connect_controller_wrapper(), efi_get_wakeup_time_wrapper(), efi_load_image_wrapper(), and efi_set_wakeup_time_wrapper().

◆ efi_allocate_type()

static const char* efi_allocate_type ( EFI_ALLOCATE_TYPE  type)
static

Convert EFI allocation type to text.

Parameters
typeAllocation type
Return values
textAllocation type as text

Definition at line 139 of file efi_wrap.c.

139  {
140  static char buf[ 11 /* "0xXXXXXXXX" + NUL */ ];
141 
142  switch ( type ) {
143  case AllocateAnyPages: return "AnyPages";
144  case AllocateMaxAddress: return "MaxAddress";
145  case AllocateAddress: return "Address";
146  default:
147  snprintf ( buf, sizeof ( buf ), "%#x", type );
148  return buf;
149  }
150 }
uint32_t type
Operating system type.
Definition: ena.h:12
Allocate pages at a specified address.
Definition: UefiSpec.h:45
Allocate any available range of pages whose uppermost address is less than or equal to a specified ma...
Definition: UefiSpec.h:41
Allocate any available range of pages that satisfies the request.
Definition: UefiSpec.h:36
int snprintf(char *buf, size_t size, const char *fmt,...)
Write a formatted string to a buffer.
Definition: vsprintf.c:383

References AllocateAddress, AllocateAnyPages, AllocateMaxAddress, snprintf(), and type.

Referenced by efi_allocate_pages_wrapper().

◆ efi_memory_type()

static const char* efi_memory_type ( EFI_MEMORY_TYPE  type)
static

Convert EFI memory type to text.

Parameters
typeMemory type
Return values
textMemory type as text

Definition at line 158 of file efi_wrap.c.

158  {
159  static char buf[ 11 /* "0xXXXXXXXX" + NUL */ ];
160 
161  switch ( type ) {
162  case EfiReservedMemoryType: return "Reserved";
163  case EfiLoaderCode: return "LoaderCode";
164  case EfiLoaderData: return "LoaderData";
165  case EfiBootServicesCode: return "BootCode";
166  case EfiBootServicesData: return "BootData";
167  case EfiRuntimeServicesCode: return "RuntimeCode";
168  case EfiRuntimeServicesData: return "RuntimeData";
169  case EfiConventionalMemory: return "Conventional";
170  case EfiUnusableMemory: return "Unusable";
171  case EfiACPIReclaimMemory: return "ACPIReclaim";
172  case EfiACPIMemoryNVS: return "ACPINVS";
173  case EfiMemoryMappedIO: return "MMIO";
174  case EfiMemoryMappedIOPortSpace:return "PIO";
175  case EfiPalCode: return "PalCode";
176  case EfiPersistentMemory: return "Persistent";
177  default:
178  snprintf ( buf, sizeof ( buf ), "%#x", type );
179  return buf;
180  }
181 }
uint32_t type
Operating system type.
Definition: ena.h:12
A memory region that operates as EfiConventionalMemory, however it happens to also support byte-addre...
The code portions of a loaded application.
Address space reserved by the firmware for code that is part of the processor.
Used by system firmware to request that a memory-mapped IO region be mapped by the OS to a virtual ad...
Memory that holds the ACPI tables.
The code portions of a loaded Boot Services Driver.
Free (unallocated) memory.
System memory-mapped IO region that is used to translate memory cycles to IO cycles by the processor.
The data portions of a loaded Runtime Services Driver and the default data allocation type used by a ...
The code portions of a loaded Runtime Services Driver.
int snprintf(char *buf, size_t size, const char *fmt,...)
Write a formatted string to a buffer.
Definition: vsprintf.c:383
Address space reserved for use by the firmware.
The data portions of a loaded Boot Serves Driver, and the default data allocation type used by a Boot...
The data portions of a loaded application and the default data allocation type used by an application...
Memory in which errors have been detected.

References EfiACPIMemoryNVS, EfiACPIReclaimMemory, EfiBootServicesCode, EfiBootServicesData, EfiConventionalMemory, EfiLoaderCode, EfiLoaderData, EfiMemoryMappedIO, EfiMemoryMappedIOPortSpace, EfiPalCode, EfiPersistentMemory, EfiReservedMemoryType, EfiRuntimeServicesCode, EfiRuntimeServicesData, EfiUnusableMemory, snprintf(), and type.

Referenced by efi_allocate_pages_wrapper(), efi_allocate_pool_wrapper(), and efi_get_memory_map_wrapper().

◆ efi_timer_delay()

static const char* efi_timer_delay ( EFI_TIMER_DELAY  type)
static

Convert EFI timer delay type to text.

Parameters
typeTimer delay type
Return values
textTimer delay type as text

Definition at line 189 of file efi_wrap.c.

189  {
190  static char buf[ 11 /* "0xXXXXXXXX" + NUL */ ];
191 
192  switch ( type ) {
193  case TimerCancel: return "Cancel";
194  case TimerPeriodic: return "Periodic";
195  case TimerRelative: return "Relative";
196  default:
197  snprintf ( buf, sizeof ( buf ), "%#x", type );
198  return buf;
199  }
200 }
An event is to be signaled periodically at a specified interval from the current time.
Definition: UefiSpec.h:548
An event is to be signaled once at a specified interval from the current time.
Definition: UefiSpec.h:552
uint32_t type
Operating system type.
Definition: ena.h:12
An event's timer settings is to be cancelled and not trigger time is to be set/.
Definition: UefiSpec.h:544
int snprintf(char *buf, size_t size, const char *fmt,...)
Write a formatted string to a buffer.
Definition: vsprintf.c:383

References snprintf(), TimerCancel, TimerPeriodic, TimerRelative, and type.

Referenced by efi_set_timer_wrapper().

◆ efi_time()

static const char* efi_time ( EFI_TIME time)
static

Convert EFI time to text.

Parameters
timeTime, or NULL
Return values
textTime as text

Definition at line 208 of file efi_wrap.c.

208  {
209  static char buf[ 20 /* "xxxx-xx-xx xx:xx:xx" + NUL */ ];
210 
211  if ( ! time )
212  return "<NULL>";
213  snprintf ( buf, sizeof ( buf ), "%04d-%02d-%02d %02d:%02d:%02d",
214  time->Year, time->Month, time->Day, time->Hour,
215  time->Minute, time->Second );
216  return buf;
217 }
UINT8 Day
Definition: UefiBaseType.h:74
UINT8 Minute
Definition: UefiBaseType.h:76
UINT8 Second
Definition: UefiBaseType.h:77
UINT8 Hour
Definition: UefiBaseType.h:75
UINT16 Year
Definition: UefiBaseType.h:72
UINT8 Month
Definition: UefiBaseType.h:73
int snprintf(char *buf, size_t size, const char *fmt,...)
Write a formatted string to a buffer.
Definition: vsprintf.c:383

References EFI_TIME::Day, EFI_TIME::Hour, EFI_TIME::Minute, EFI_TIME::Month, EFI_TIME::Second, snprintf(), and EFI_TIME::Year.

Referenced by efi_get_time_wrapper(), efi_get_wakeup_time_wrapper(), efi_set_time_wrapper(), and efi_set_wakeup_time_wrapper().

◆ efi_reset_type()

static const char* efi_reset_type ( EFI_RESET_TYPE  type)
static

Convert EFI reset type to text.

Parameters
typeReset type
Return values
textReset type as text

Definition at line 225 of file efi_wrap.c.

225  {
226  static char buf[ 11 /* "0xXXXXXXXX" + NUL */ ];
227 
228  switch ( type ) {
229  case EfiResetCold: return "Cold";
230  case EfiResetWarm: return "Warm";
231  case EfiResetShutdown: return "Shutdown";
232  case EfiResetPlatformSpecific: return "PlatformSpecific";
233  default:
234  snprintf ( buf, sizeof ( buf ), "%#x", type );
235  return buf;
236  }
237 }
uint32_t type
Operating system type.
Definition: ena.h:12
Used to induce a system-wide reset.
Used to induce a system-wide reset.
Used to induce a system-wide initialization.
Used to induce an entry into a power state equivalent to the ACPI G2/S5 or G3 state.
int snprintf(char *buf, size_t size, const char *fmt,...)
Write a formatted string to a buffer.
Definition: vsprintf.c:383

References EfiResetCold, EfiResetPlatformSpecific, EfiResetShutdown, EfiResetWarm, snprintf(), and type.

Referenced by efi_reset_system_wrapper().

◆ efi_prescroll()

static int efi_prescroll ( unsigned int  lines)
static

Pre-scroll display to create space for output lines.

Parameters
linesNumber of lines required
Return values
efircEFI status code

Definition at line 245 of file efi_wrap.c.

245  {
247  UINTN columns;
248  UINTN rows;
249  UINTN space;
250  EFI_STATUS efirc;
251 
252  /* Get number of rows and columns */
253  if ( ( efirc = conout->QueryMode ( conout, conout->Mode->Mode,
254  &columns, &rows ) ) != 0 )
255  return efirc;
256 
257  /* Calculate available space */
258  space = ( rows - conout->Mode->CursorRow - 1 );
259 
260  /* Scroll to create space */
261  while ( space++ < lines )
262  conout->OutputString ( conout, L"\n" );
263 
264  /* Move cursor to start of space */
265  conout->SetCursorPosition ( conout, 0,
266  ( conout->Mode->CursorRow - lines ) );
267 
268  return 0;
269 }
EFI_TEXT_SET_CURSOR_POSITION SetCursorPosition
The SIMPLE_TEXT_OUTPUT protocol is used to control text-based output devices.
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL * ConOut
A pointer to the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL interface that is associated with ConsoleOutHandle.
Definition: UefiSpec.h:2080
INT32 Mode
The text mode of the output device(s).
EFI_SIMPLE_TEXT_OUTPUT_MODE * Mode
Pointer to SIMPLE_TEXT_OUTPUT_MODE data.
UINT64 UINTN
Unsigned value of native width.
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
EFI_SYSTEM_TABLE * efi_systab
INT32 CursorRow
The cursor's row.

References EFI_SYSTEM_TABLE::ConOut, EFI_SIMPLE_TEXT_OUTPUT_MODE::CursorRow, efi_systab, EFI_SIMPLE_TEXT_OUTPUT_MODE::Mode, _EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL::Mode, _EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL::OutputString, _EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL::QueryMode, and _EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL::SetCursorPosition.

Referenced by efi_exit_boot_services_wrapper().

◆ efi_dump_image()

static void efi_dump_image ( EFI_HANDLE  handle)
static

Dump information about a loaded image.

Parameters
handleImage handle

Definition at line 276 of file efi_wrap.c.

276  {
278  int rc;
279 
280  /* Open loaded image protocol */
282  &loaded ) ) != 0 ) {
283  DBGC ( colour, "WRAP %s could not get loaded image protocol: "
284  "%s\n", efi_handle_name ( handle ), strerror ( rc ) );
285  return;
286  }
287 
288  /* Dump image information */
289  DBGC ( colour, "WRAP %s at base %p has protocols:\n",
292  DBGC ( colour, "WRAP %s parent", efi_handle_name ( handle ) );
293  DBGC ( colour, " %s\n", efi_handle_name ( loaded->ParentHandle ) );
294  DBGC ( colour, "WRAP %s device", efi_handle_name ( handle ) );
295  DBGC ( colour, " %s\n", efi_handle_name ( loaded->DeviceHandle ) );
296  DBGC ( colour, "WRAP %s file", efi_handle_name ( handle ) );
297  DBGC ( colour, " %s\n", efi_devpath_text ( loaded->FilePath ) );
298 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define DBGC_EFI_PROTOCOLS(...)
Definition: efi.h:349
#define DBGC(...)
Definition: compiler.h:505
EFI_GUID efi_loaded_image_protocol_guid
Loaded image protocol GUID.
Definition: efi_guid.c:273
EFI_DEVICE_PATH_PROTOCOL * FilePath
A pointer to the file path portion specific to DeviceHandle that the EFI Image was loaded from.
Definition: LoadedImage.h:57
VOID * ImageBase
The base address at which the image was loaded.
Definition: LoadedImage.h:70
Can be used on any image handle to obtain information about the loaded image.
Definition: LoadedImage.h:46
const char * efi_devpath_text(EFI_DEVICE_PATH_PROTOCOL *path)
Get textual representation of device path.
Definition: efi_debug.c:247
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:79
#define efi_open(handle, protocol, interface)
Open protocol for ephemeral use.
Definition: efi.h:444
EFI_LOADED_IMAGE_PROTOCOL * loaded
Loaded image protocol.
Definition: efi_veto.c:69
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42
uint16_t handle
Handle.
Definition: smbios.h:17
EFI_HANDLE ParentHandle
Parent image's image handle.
Definition: LoadedImage.h:49
EFI_HANDLE DeviceHandle
The device handle that the EFI Image was loaded from.
Definition: LoadedImage.h:56

References colour, DBGC, DBGC_EFI_PROTOCOLS, EFI_LOADED_IMAGE_PROTOCOL::DeviceHandle, efi_devpath_text(), efi_handle_name(), efi_loaded_image_protocol_guid, efi_open, EFI_LOADED_IMAGE_PROTOCOL::FilePath, handle, EFI_LOADED_IMAGE_PROTOCOL::ImageBase, EFI_LOADED_IMAGE_PROTOCOL::ParentHandle, rc, and strerror().

Referenced by efi_load_image_wrapper(), and efi_wrap_image().

◆ efi_raise_tpl_wrapper()

static EFI_TPL EFIAPI efi_raise_tpl_wrapper ( EFI_TPL  new_tpl)
static

Wrap RaiseTPL()

Definition at line 305 of file efi_wrap.c.

305  {
307  void *retaddr = __builtin_return_address ( 0 );
308  EFI_TPL old_tpl;
309 
310  DBGCP ( colour, "RaiseTPL ( %s ) ", efi_tpl_name ( new_tpl ) );
311  old_tpl = bs->RaiseTPL ( new_tpl );
312  DBGCP ( colour, "= %s -> %p\n", efi_tpl_name ( old_tpl ), retaddr );
313  return old_tpl;
314 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
EFI_RAISE_TPL RaiseTPL
Definition: UefiSpec.h:1940
EFI Boot Services Table.
Definition: UefiSpec.h:1931
UINTN EFI_TPL
Task priority level.
Definition: UefiBaseType.h:44
#define DBGCP(...)
Definition: compiler.h:539
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42
const char * efi_tpl_name(EFI_TPL tpl)
Name EFI TPL.
Definition: efi_debug.c:55

References EFI_SYSTEM_TABLE::BootServices, colour, DBGCP, efi_systab, efi_tpl_name(), and EFI_BOOT_SERVICES::RaiseTPL.

Referenced by efi_wrap_bs().

◆ efi_restore_tpl_wrapper()

static VOID EFIAPI efi_restore_tpl_wrapper ( EFI_TPL  old_tpl)
static

Wrap RestoreTPL()

Definition at line 321 of file efi_wrap.c.

321  {
323  void *retaddr = __builtin_return_address ( 0 );
324 
325  DBGCP ( colour, "RestoreTPL ( %s ) ", efi_tpl_name ( old_tpl ) );
326  bs->RestoreTPL ( old_tpl );
327  DBGCP ( colour, "-> %p\n", retaddr );
328 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
EFI Boot Services Table.
Definition: UefiSpec.h:1931
#define DBGCP(...)
Definition: compiler.h:539
EFI_SYSTEM_TABLE * efi_systab
EFI_RESTORE_TPL RestoreTPL
Definition: UefiSpec.h:1941
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42
const char * efi_tpl_name(EFI_TPL tpl)
Name EFI TPL.
Definition: efi_debug.c:55

References EFI_SYSTEM_TABLE::BootServices, colour, DBGCP, efi_systab, efi_tpl_name(), and EFI_BOOT_SERVICES::RestoreTPL.

Referenced by efi_wrap_bs().

◆ efi_allocate_pages_wrapper()

static EFI_STATUS EFIAPI efi_allocate_pages_wrapper ( EFI_ALLOCATE_TYPE  type,
EFI_MEMORY_TYPE  memory_type,
UINTN  pages,
EFI_PHYSICAL_ADDRESS memory 
)
static

Wrap AllocatePages()

Definition at line 335 of file efi_wrap.c.

337  {
339  void *retaddr = __builtin_return_address ( 0 );
340  EFI_STATUS efirc;
341 
342  DBGC2 ( colour, "AllocatePages ( %s, %s, %#llx, %#llx ) ",
343  efi_allocate_type ( type ), efi_memory_type ( memory_type ),
344  ( ( unsigned long long ) pages ),
345  ( ( unsigned long long ) *memory ) );
346  efirc = bs->AllocatePages ( type, memory_type, pages, memory );
347  DBGC2 ( colour, "= %s ( %#llx ) -> %p\n", efi_status ( efirc ),
348  ( ( unsigned long long ) *memory ), retaddr );
349  return efirc;
350 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
uint32_t type
Operating system type.
Definition: ena.h:12
EFI Boot Services Table.
Definition: UefiSpec.h:1931
EFI_ALLOCATE_PAGES AllocatePages
Definition: UefiSpec.h:1946
#define DBGC2(...)
Definition: compiler.h:522
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
EFI_SYSTEM_TABLE * efi_systab
static const char * efi_allocate_type(EFI_ALLOCATE_TYPE type)
Convert EFI allocation type to text.
Definition: efi_wrap.c:139
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42
static const char * efi_memory_type(EFI_MEMORY_TYPE type)
Convert EFI memory type to text.
Definition: efi_wrap.c:158

References EFI_BOOT_SERVICES::AllocatePages, EFI_SYSTEM_TABLE::BootServices, colour, DBGC2, efi_allocate_type(), efi_memory_type(), efi_status(), efi_systab, and type.

Referenced by efi_wrap_bs().

◆ efi_free_pages_wrapper()

static EFI_STATUS EFIAPI efi_free_pages_wrapper ( EFI_PHYSICAL_ADDRESS  memory,
UINTN  pages 
)
static

Wrap FreePages()

Definition at line 357 of file efi_wrap.c.

357  {
359  void *retaddr = __builtin_return_address ( 0 );
360  EFI_STATUS efirc;
361 
362  DBGC2 ( colour, "FreePages ( %#llx, %#llx ) ",
363  ( ( unsigned long long ) memory ),
364  ( ( unsigned long long ) pages ) );
365  efirc = bs->FreePages ( memory, pages );
366  DBGC2 ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
367  return efirc;
368 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
EFI Boot Services Table.
Definition: UefiSpec.h:1931
#define DBGC2(...)
Definition: compiler.h:522
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42
EFI_FREE_PAGES FreePages
Definition: UefiSpec.h:1947

References EFI_SYSTEM_TABLE::BootServices, colour, DBGC2, efi_status(), efi_systab, and EFI_BOOT_SERVICES::FreePages.

Referenced by efi_wrap_bs().

◆ efi_get_memory_map_wrapper()

static EFI_STATUS EFIAPI efi_get_memory_map_wrapper ( UINTN memory_map_size,
EFI_MEMORY_DESCRIPTOR memory_map,
UINTN map_key,
UINTN descriptor_size,
UINT32 descriptor_version 
)
static

Wrap GetMemoryMap()

Definition at line 375 of file efi_wrap.c.

378  {
380  void *retaddr = __builtin_return_address ( 0 );
382  size_t remaining;
383  EFI_STATUS efirc;
384 
385  DBGC ( colour, "GetMemoryMap ( %#llx, %p ) ",
386  ( ( unsigned long long ) *memory_map_size ), memory_map );
387  efirc = bs->GetMemoryMap ( memory_map_size, memory_map, map_key,
388  descriptor_size, descriptor_version );
389  DBGC ( colour, "= %s ( %#llx, %#llx, %#llx, v%d",
390  efi_status ( efirc ),
391  ( ( unsigned long long ) *memory_map_size ),
392  ( ( unsigned long long ) *map_key ),
393  ( ( unsigned long long ) *descriptor_size ),
394  *descriptor_version );
395  if ( DBG_EXTRA && ( efirc == 0 ) ) {
396  DBGC2 ( colour, ",\n" );
397  for ( desc = memory_map, remaining = *memory_map_size ;
398  remaining >= *descriptor_size ;
399  desc = ( ( ( void * ) desc ) + *descriptor_size ),
400  remaining -= *descriptor_size ) {
401  DBGC2 ( colour, "%#016llx+%#08llx %#016llx "
402  "%s\n", desc->PhysicalStart,
403  ( desc->NumberOfPages * EFI_PAGE_SIZE ),
404  desc->Attribute,
405  efi_memory_type ( desc->Type ) );
406  }
407  } else {
408  DBGC ( colour, " " );
409  }
410  DBGC ( colour, ") -> %p\n", retaddr );
411  return efirc;
412 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
#define EFI_PAGE_SIZE
Definition: UefiBaseType.h:188
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
Definition of an EFI memory descriptor.
Definition: UefiSpec.h:156
#define DBGC(...)
Definition: compiler.h:505
struct ena_llq_option desc
Descriptor counts.
Definition: ena.h:20
EFI Boot Services Table.
Definition: UefiSpec.h:1931
EFI_GET_MEMORY_MAP GetMemoryMap
Definition: UefiSpec.h:1948
#define DBGC2(...)
Definition: compiler.h:522
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
EFI_SYSTEM_TABLE * efi_systab
#define DBG_EXTRA
Definition: compiler.h:319
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42
static const char * efi_memory_type(EFI_MEMORY_TYPE type)
Convert EFI memory type to text.
Definition: efi_wrap.c:158

References EFI_SYSTEM_TABLE::BootServices, colour, DBG_EXTRA, DBGC, DBGC2, desc, efi_memory_type(), EFI_PAGE_SIZE, efi_status(), efi_systab, and EFI_BOOT_SERVICES::GetMemoryMap.

Referenced by efi_wrap_bs().

◆ efi_allocate_pool_wrapper()

static EFI_STATUS EFIAPI efi_allocate_pool_wrapper ( EFI_MEMORY_TYPE  pool_type,
UINTN  size,
VOID **  buffer 
)
static

Wrap AllocatePool()

Definition at line 419 of file efi_wrap.c.

420  {
422  void *retaddr = __builtin_return_address ( 0 );
423  EFI_STATUS efirc;
424 
425  DBGC2 ( colour, "AllocatePool ( %s, %#llx ) ",
426  efi_memory_type ( pool_type ),
427  ( ( unsigned long long ) size ) );
428  efirc = bs->AllocatePool ( pool_type, size, buffer );
429  DBGC2 ( colour, "= %s ( %p ) -> %p\n",
430  efi_status ( efirc ), *buffer, retaddr );
431  return efirc;
432 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
uint16_t size
Buffer size.
Definition: dwmac.h:14
uint32_t buffer
Buffer index (or NETVSC_RNDIS_NO_BUFFER)
Definition: netvsc.h:16
EFI Boot Services Table.
Definition: UefiSpec.h:1931
#define DBGC2(...)
Definition: compiler.h:522
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42
static const char * efi_memory_type(EFI_MEMORY_TYPE type)
Convert EFI memory type to text.
Definition: efi_wrap.c:158
EFI_ALLOCATE_POOL AllocatePool
Definition: UefiSpec.h:1949

References EFI_BOOT_SERVICES::AllocatePool, EFI_SYSTEM_TABLE::BootServices, buffer, colour, DBGC2, efi_memory_type(), efi_status(), efi_systab, and size.

Referenced by efi_wrap_bs().

◆ efi_free_pool_wrapper()

static EFI_STATUS EFIAPI efi_free_pool_wrapper ( VOID buffer)
static

Wrap FreePool()

Definition at line 439 of file efi_wrap.c.

439  {
441  void *retaddr = __builtin_return_address ( 0 );
442  EFI_STATUS efirc;
443 
444  DBGC2 ( colour, "FreePool ( %p ) ", buffer );
445  efirc = bs->FreePool ( buffer );
446  DBGC2 ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
447  return efirc;
448 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
uint32_t buffer
Buffer index (or NETVSC_RNDIS_NO_BUFFER)
Definition: netvsc.h:16
EFI Boot Services Table.
Definition: UefiSpec.h:1931
EFI_FREE_POOL FreePool
Definition: UefiSpec.h:1950
#define DBGC2(...)
Definition: compiler.h:522
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42

References EFI_SYSTEM_TABLE::BootServices, buffer, colour, DBGC2, efi_status(), efi_systab, and EFI_BOOT_SERVICES::FreePool.

Referenced by efi_wrap_bs().

◆ efi_create_event_wrapper()

static EFI_STATUS EFIAPI efi_create_event_wrapper ( UINT32  type,
EFI_TPL  notify_tpl,
EFI_EVENT_NOTIFY  notify_function,
VOID notify_context,
EFI_EVENT event 
)
static

Wrap CreateEvent()

Definition at line 455 of file efi_wrap.c.

457  {
459  void *retaddr = __builtin_return_address ( 0 );
460  EFI_STATUS efirc;
461 
462  DBGC ( colour, "CreateEvent ( %#x, %s, %p, %p ) ", type,
463  efi_tpl_name ( notify_tpl ), notify_function, notify_context );
464  efirc = bs->CreateEvent ( type, notify_tpl, notify_function,
465  notify_context, event );
466  DBGC ( colour, "= %s ( %p ) -> %p\n",
467  efi_status ( efirc ), *event, retaddr );
468  return efirc;
469 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
uint32_t type
Operating system type.
Definition: ena.h:12
#define DBGC(...)
Definition: compiler.h:505
EFI_CREATE_EVENT CreateEvent
Definition: UefiSpec.h:1955
EFI Boot Services Table.
Definition: UefiSpec.h:1931
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42
const char * efi_tpl_name(EFI_TPL tpl)
Name EFI TPL.
Definition: efi_debug.c:55

References EFI_SYSTEM_TABLE::BootServices, colour, EFI_BOOT_SERVICES::CreateEvent, DBGC, efi_status(), efi_systab, efi_tpl_name(), and type.

Referenced by efi_wrap_bs().

◆ efi_set_timer_wrapper()

static EFI_STATUS EFIAPI efi_set_timer_wrapper ( EFI_EVENT  event,
EFI_TIMER_DELAY  type,
UINT64  trigger_time 
)
static

Wrap SetTimer()

Definition at line 476 of file efi_wrap.c.

477  {
479  void *retaddr = __builtin_return_address ( 0 );
480  EFI_STATUS efirc;
481 
482  DBGC ( colour, "SetTimer ( %p, %s, %ld.%07ld00s ) ",
483  event, efi_timer_delay ( type ),
484  ( ( unsigned long ) ( trigger_time / 10000000 ) ),
485  ( ( unsigned long ) ( trigger_time % 10000000 ) ) );
486  efirc = bs->SetTimer ( event, type, trigger_time );
487  DBGC ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
488  return efirc;
489 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
uint32_t type
Operating system type.
Definition: ena.h:12
#define DBGC(...)
Definition: compiler.h:505
EFI_SET_TIMER SetTimer
Definition: UefiSpec.h:1956
EFI Boot Services Table.
Definition: UefiSpec.h:1931
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
static const char * efi_timer_delay(EFI_TIMER_DELAY type)
Convert EFI timer delay type to text.
Definition: efi_wrap.c:189
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42

References EFI_SYSTEM_TABLE::BootServices, colour, DBGC, efi_status(), efi_systab, efi_timer_delay(), EFI_BOOT_SERVICES::SetTimer, and type.

Referenced by efi_wrap_bs().

◆ efi_wait_for_event_wrapper()

static EFI_STATUS EFIAPI efi_wait_for_event_wrapper ( UINTN  number_of_events,
EFI_EVENT event,
UINTN index 
)
static

Wrap WaitForEvent()

Definition at line 496 of file efi_wrap.c.

497  {
499  void *retaddr = __builtin_return_address ( 0 );
500  unsigned int i;
501  EFI_STATUS efirc;
502 
503  DBGC ( colour, "WaitForEvent (" );
504  for ( i = 0 ; i < number_of_events ; i++ )
505  DBGC ( colour, " %p", event[i] );
506  DBGC ( colour, " ) " );
507  efirc = bs->WaitForEvent ( number_of_events, event, index );
508  DBGC ( colour, "= %s", efi_status ( efirc ) );
509  if ( efirc == 0 )
510  DBGC ( colour, " ( %p )", event[*index] );
511  DBGC ( colour, " -> %p\n", retaddr );
512  return efirc;
513 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
#define DBGC(...)
Definition: compiler.h:505
long index
Definition: bigint.h:65
EFI Boot Services Table.
Definition: UefiSpec.h:1931
EFI_WAIT_FOR_EVENT WaitForEvent
Definition: UefiSpec.h:1957
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42

References EFI_SYSTEM_TABLE::BootServices, colour, DBGC, efi_status(), efi_systab, index, and EFI_BOOT_SERVICES::WaitForEvent.

Referenced by efi_wrap_bs().

◆ efi_signal_event_wrapper()

static EFI_STATUS EFIAPI efi_signal_event_wrapper ( EFI_EVENT  event)
static

Wrap SignalEvent()

Definition at line 520 of file efi_wrap.c.

520  {
522  void *retaddr = __builtin_return_address ( 0 );
523  EFI_STATUS efirc;
524 
525  DBGC2 ( colour, "SignalEvent ( %p ) ", event );
526  efirc = bs->SignalEvent ( event );
527  DBGC2 ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
528  return efirc;
529 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
EFI_SIGNAL_EVENT SignalEvent
Definition: UefiSpec.h:1958
EFI Boot Services Table.
Definition: UefiSpec.h:1931
#define DBGC2(...)
Definition: compiler.h:522
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42

References EFI_SYSTEM_TABLE::BootServices, colour, DBGC2, efi_status(), efi_systab, and EFI_BOOT_SERVICES::SignalEvent.

Referenced by efi_wrap_bs().

◆ efi_close_event_wrapper()

static EFI_STATUS EFIAPI efi_close_event_wrapper ( EFI_EVENT  event)
static

Wrap CloseEvent()

Definition at line 536 of file efi_wrap.c.

536  {
538  void *retaddr = __builtin_return_address ( 0 );
539  EFI_STATUS efirc;
540 
541  DBGC ( colour, "CloseEvent ( %p ) ", event );
542  efirc = bs->CloseEvent ( event );
543  DBGC ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
544  return efirc;
545 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
#define DBGC(...)
Definition: compiler.h:505
EFI_CLOSE_EVENT CloseEvent
Definition: UefiSpec.h:1959
EFI Boot Services Table.
Definition: UefiSpec.h:1931
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42

References EFI_SYSTEM_TABLE::BootServices, EFI_BOOT_SERVICES::CloseEvent, colour, DBGC, efi_status(), and efi_systab.

Referenced by efi_wrap_bs().

◆ efi_check_event_wrapper()

static EFI_STATUS EFIAPI efi_check_event_wrapper ( EFI_EVENT  event)
static

Wrap CheckEvent()

Definition at line 551 of file efi_wrap.c.

551  {
553  void *retaddr = __builtin_return_address ( 0 );
554  EFI_STATUS efirc;
555 
556  DBGCP ( colour, "CheckEvent ( %p ) ", event );
557  efirc = bs->CheckEvent ( event );
558  DBGCP ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
559  return efirc;
560 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
EFI Boot Services Table.
Definition: UefiSpec.h:1931
EFI_CHECK_EVENT CheckEvent
Definition: UefiSpec.h:1960
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
#define DBGCP(...)
Definition: compiler.h:539
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42

References EFI_SYSTEM_TABLE::BootServices, EFI_BOOT_SERVICES::CheckEvent, colour, DBGCP, efi_status(), and efi_systab.

Referenced by efi_wrap_bs().

◆ efi_install_protocol_interface_wrapper()

static EFI_STATUS EFIAPI efi_install_protocol_interface_wrapper ( EFI_HANDLE handle,
EFI_GUID protocol,
EFI_INTERFACE_TYPE  interface_type,
VOID interface 
)
static

Wrap InstallProtocolInterface()

Definition at line 567 of file efi_wrap.c.

569  {
571  void *retaddr = __builtin_return_address ( 0 );
572  EFI_STATUS efirc;
573 
574  DBGC ( colour, "InstallProtocolInterface ( %s, %s, %d, %p ) ",
578  interface );
579  DBGC ( colour, "= %s ( %s ) -> %p\n",
580  efi_status ( efirc ), efi_handle_name ( *handle ), retaddr );
581  return efirc;
582 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
#define DBGC(...)
Definition: compiler.h:505
An object interface.
Definition: interface.h:125
EFI_INSTALL_PROTOCOL_INTERFACE InstallProtocolInterface
Definition: UefiSpec.h:1965
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:652
EFI Boot Services Table.
Definition: UefiSpec.h:1931
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_guid.c:726
struct edd_interface_type interface_type
Interface type.
Definition: edd.h:21
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
EFI_SYSTEM_TABLE * efi_systab
uint16_t protocol
Protocol ID.
Definition: stp.h:19
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42
uint16_t handle
Handle.
Definition: smbios.h:17

References EFI_SYSTEM_TABLE::BootServices, colour, DBGC, efi_guid_ntoa(), efi_handle_name(), efi_status(), efi_systab, handle, EFI_BOOT_SERVICES::InstallProtocolInterface, interface_type, and protocol.

Referenced by efi_wrap_bs().

◆ efi_reinstall_protocol_interface_wrapper()

static EFI_STATUS EFIAPI efi_reinstall_protocol_interface_wrapper ( EFI_HANDLE  handle,
EFI_GUID protocol,
VOID old_interface,
VOID new_interface 
)
static

Wrap ReinstallProtocolInterface()

Definition at line 589 of file efi_wrap.c.

592  {
594  void *retaddr = __builtin_return_address ( 0 );
595  EFI_STATUS efirc;
596 
597  DBGC ( colour, "ReinstallProtocolInterface ( %s, %s, %p, %p ) ",
599  old_interface, new_interface );
601  old_interface, new_interface );
602  DBGC ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
603  return efirc;
604 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface
Definition: UefiSpec.h:1966
#define DBGC(...)
Definition: compiler.h:505
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:652
EFI Boot Services Table.
Definition: UefiSpec.h:1931
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_guid.c:726
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
EFI_SYSTEM_TABLE * efi_systab
uint16_t protocol
Protocol ID.
Definition: stp.h:19
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42
uint16_t handle
Handle.
Definition: smbios.h:17

References EFI_SYSTEM_TABLE::BootServices, colour, DBGC, efi_guid_ntoa(), efi_handle_name(), efi_status(), efi_systab, handle, protocol, and EFI_BOOT_SERVICES::ReinstallProtocolInterface.

Referenced by efi_wrap_bs().

◆ efi_uninstall_protocol_interface_wrapper()

static EFI_STATUS EFIAPI efi_uninstall_protocol_interface_wrapper ( EFI_HANDLE  handle,
EFI_GUID protocol,
VOID interface 
)
static

Wrap UninstallProtocolInterface()

Definition at line 611 of file efi_wrap.c.

613  {
615  void *retaddr = __builtin_return_address ( 0 );
616  EFI_STATUS efirc;
617 
618  DBGC ( colour, "UninstallProtocolInterface ( %s, %s, %p ) ",
620  interface );
622  DBGC ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
623  return efirc;
624 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface
Definition: UefiSpec.h:1967
#define DBGC(...)
Definition: compiler.h:505
An object interface.
Definition: interface.h:125
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:652
EFI Boot Services Table.
Definition: UefiSpec.h:1931
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_guid.c:726
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
EFI_SYSTEM_TABLE * efi_systab
uint16_t protocol
Protocol ID.
Definition: stp.h:19
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42
uint16_t handle
Handle.
Definition: smbios.h:17

References EFI_SYSTEM_TABLE::BootServices, colour, DBGC, efi_guid_ntoa(), efi_handle_name(), efi_status(), efi_systab, handle, protocol, and EFI_BOOT_SERVICES::UninstallProtocolInterface.

Referenced by efi_wrap_bs().

◆ efi_handle_protocol_wrapper()

static EFI_STATUS EFIAPI efi_handle_protocol_wrapper ( EFI_HANDLE  handle,
EFI_GUID protocol,
VOID **  interface 
)
static

Wrap HandleProtocol()

Definition at line 631 of file efi_wrap.c.

632  {
634  void *retaddr = __builtin_return_address ( 0 );
635  EFI_STATUS efirc;
636 
637  DBGC ( colour, "HandleProtocol ( %s, %s ) ",
639  efirc = bs->HandleProtocol ( handle, protocol, interface );
640  DBGC ( colour, "= %s ( %p ) -> %p\n",
641  efi_status ( efirc ), *interface, retaddr );
642  return efirc;
643 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
#define DBGC(...)
Definition: compiler.h:505
An object interface.
Definition: interface.h:125
EFI_HANDLE_PROTOCOL HandleProtocol
Definition: UefiSpec.h:1968
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:652
EFI Boot Services Table.
Definition: UefiSpec.h:1931
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_guid.c:726
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
EFI_SYSTEM_TABLE * efi_systab
uint16_t protocol
Protocol ID.
Definition: stp.h:19
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42
uint16_t handle
Handle.
Definition: smbios.h:17

References EFI_SYSTEM_TABLE::BootServices, colour, DBGC, efi_guid_ntoa(), efi_handle_name(), efi_status(), efi_systab, handle, EFI_BOOT_SERVICES::HandleProtocol, and protocol.

Referenced by efi_wrap_bs().

◆ efi_register_protocol_notify_wrapper()

static EFI_STATUS EFIAPI efi_register_protocol_notify_wrapper ( EFI_GUID protocol,
EFI_EVENT  event,
VOID **  registration 
)
static

Wrap RegisterProtocolNotify()

Definition at line 650 of file efi_wrap.c.

651  {
653  void *retaddr = __builtin_return_address ( 0 );
654  EFI_STATUS efirc;
655 
656  DBGC ( colour, "RegisterProtocolNotify ( %s, %p ) ",
657  efi_guid_ntoa ( protocol ), event );
658  efirc = bs->RegisterProtocolNotify ( protocol, event, registration );
659  DBGC ( colour, "= %s ( %p ) -> %p\n",
660  efi_status ( efirc ), *registration, retaddr );
661  return efirc;
662 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
#define DBGC(...)
Definition: compiler.h:505
EFI_REGISTER_PROTOCOL_NOTIFY RegisterProtocolNotify
Definition: UefiSpec.h:1970
EFI Boot Services Table.
Definition: UefiSpec.h:1931
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_guid.c:726
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
EFI_SYSTEM_TABLE * efi_systab
uint16_t protocol
Protocol ID.
Definition: stp.h:19
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42

References EFI_SYSTEM_TABLE::BootServices, colour, DBGC, efi_guid_ntoa(), efi_status(), efi_systab, protocol, and EFI_BOOT_SERVICES::RegisterProtocolNotify.

Referenced by efi_wrap_bs().

◆ efi_locate_handle_wrapper()

static EFI_STATUS EFIAPI efi_locate_handle_wrapper ( EFI_LOCATE_SEARCH_TYPE  search_type,
EFI_GUID protocol,
VOID search_key,
UINTN buffer_size,
EFI_HANDLE buffer 
)
static

Wrap LocateHandle()

Definition at line 669 of file efi_wrap.c.

671  {
673  void *retaddr = __builtin_return_address ( 0 );
674  unsigned int i;
675  EFI_STATUS efirc;
676 
677  DBGC ( colour, "LocateHandle ( %s, %s, %p, %zd ) ",
678  efi_locate_search_type_name ( search_type ),
679  efi_guid_ntoa ( protocol ), search_key,
680  ( ( size_t ) *buffer_size ) );
681  efirc = bs->LocateHandle ( search_type, protocol, search_key,
682  buffer_size, buffer );
683  DBGC ( colour, "= %s ( %zd", efi_status ( efirc ),
684  ( ( size_t ) *buffer_size ) );
685  if ( efirc == 0 ) {
686  DBGC ( colour, ", {" );
687  for ( i = 0; i < ( *buffer_size / sizeof ( buffer[0] ) ); i++ ){
688  DBGC ( colour, "%s%s", ( i ? ", " : " " ),
689  efi_handle_name ( buffer[i] ) );
690  }
691  DBGC ( colour, " }" );
692  }
693  DBGC ( colour, " ) -> %p\n", retaddr );
694  return efirc;
695 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
#define DBGC(...)
Definition: compiler.h:505
uint32_t buffer
Buffer index (or NETVSC_RNDIS_NO_BUFFER)
Definition: netvsc.h:16
EFI_LOCATE_HANDLE LocateHandle
Definition: UefiSpec.h:1971
const char * efi_locate_search_type_name(EFI_LOCATE_SEARCH_TYPE search_type)
Name locate search type.
Definition: efi_debug.c:77
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:652
EFI Boot Services Table.
Definition: UefiSpec.h:1931
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_guid.c:726
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
EFI_SYSTEM_TABLE * efi_systab
uint16_t protocol
Protocol ID.
Definition: stp.h:19
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42
UINT16_t buffer_size
UDP payload buffer size.
Definition: pxe_api.h:62

References EFI_SYSTEM_TABLE::BootServices, buffer, buffer_size, colour, DBGC, efi_guid_ntoa(), efi_handle_name(), efi_locate_search_type_name(), efi_status(), efi_systab, EFI_BOOT_SERVICES::LocateHandle, and protocol.

Referenced by efi_wrap_bs().

◆ efi_locate_device_path_wrapper()

static EFI_STATUS EFIAPI efi_locate_device_path_wrapper ( EFI_GUID protocol,
EFI_DEVICE_PATH_PROTOCOL **  device_path,
EFI_HANDLE device 
)
static

Wrap LocateDevicePath()

Definition at line 702 of file efi_wrap.c.

704  {
706  void *retaddr = __builtin_return_address ( 0 );
707  EFI_STATUS efirc;
708 
709  DBGC ( colour, "LocateDevicePath ( %s, %s ) ",
711  efirc = bs->LocateDevicePath ( protocol, device_path, device );
712  DBGC ( colour, "= %s ( %s, ",
713  efi_status ( efirc ), efi_devpath_text ( *device_path ) );
714  DBGC ( colour, "%s ) -> %p\n", efi_handle_name ( *device ), retaddr );
715  return efirc;
716 }
union edd_device_path device_path
Device path.
Definition: edd.h:25
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
#define DBGC(...)
Definition: compiler.h:505
A hardware device.
Definition: device.h:77
const char * efi_devpath_text(EFI_DEVICE_PATH_PROTOCOL *path)
Get textual representation of device path.
Definition: efi_debug.c:247
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:652
EFI Boot Services Table.
Definition: UefiSpec.h:1931
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_guid.c:726
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
EFI_SYSTEM_TABLE * efi_systab
uint16_t protocol
Protocol ID.
Definition: stp.h:19
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42
EFI_LOCATE_DEVICE_PATH LocateDevicePath
Definition: UefiSpec.h:1972

References EFI_SYSTEM_TABLE::BootServices, colour, DBGC, device_path, efi_devpath_text(), efi_guid_ntoa(), efi_handle_name(), efi_status(), efi_systab, EFI_BOOT_SERVICES::LocateDevicePath, and protocol.

Referenced by efi_wrap_bs().

◆ efi_install_configuration_table_wrapper()

static EFI_STATUS EFIAPI efi_install_configuration_table_wrapper ( EFI_GUID guid,
VOID table 
)
static

Wrap InstallConfigurationTable()

Definition at line 723 of file efi_wrap.c.

723  {
725  void *retaddr = __builtin_return_address ( 0 );
726  EFI_STATUS efirc;
727 
728  DBGC ( colour, "InstallConfigurationTable ( %s, %p ) ",
729  efi_guid_ntoa ( guid ), table );
730  efirc = bs->InstallConfigurationTable ( guid, table );
731  DBGC ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
732  return efirc;
733 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
#define DBGC(...)
Definition: compiler.h:505
EFI Boot Services Table.
Definition: UefiSpec.h:1931
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_guid.c:726
uint64_t guid
GUID.
Definition: edd.h:31
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42
EFI_INSTALL_CONFIGURATION_TABLE InstallConfigurationTable
Definition: UefiSpec.h:1973

References EFI_SYSTEM_TABLE::BootServices, colour, DBGC, efi_guid_ntoa(), efi_status(), efi_systab, guid, and EFI_BOOT_SERVICES::InstallConfigurationTable.

Referenced by efi_wrap_bs().

◆ efi_load_image_wrapper()

static EFI_STATUS EFIAPI efi_load_image_wrapper ( BOOLEAN  boot_policy,
EFI_HANDLE  parent_image_handle,
EFI_DEVICE_PATH_PROTOCOL device_path,
VOID source_buffer,
UINTN  source_size,
EFI_HANDLE image_handle 
)
static

Wrap LoadImage()

Definition at line 740 of file efi_wrap.c.

743  {
745  void *retaddr = __builtin_return_address ( 0 );
746  EFI_STATUS efirc;
747 
748  DBGC ( colour, "LoadImage ( %s, %s, ", efi_boolean ( boot_policy ),
749  efi_handle_name ( parent_image_handle ) );
750  DBGC ( colour, "%s, %p, %#llx ) ",
751  efi_devpath_text ( device_path ), source_buffer,
752  ( ( unsigned long long ) source_size ) );
753  efirc = bs->LoadImage ( boot_policy, parent_image_handle, device_path,
754  source_buffer, source_size, image_handle );
755  DBGC ( colour, "= %s ( ", efi_status ( efirc ) );
756  if ( efirc == 0 )
757  DBGC ( colour, "%s ", efi_handle_name ( *image_handle ) );
758  DBGC ( colour, ") -> %p\n", retaddr );
759 
760  /* Dump information about loaded image */
761  if ( efirc == 0 )
762  efi_dump_image ( *image_handle );
763 
764  return efirc;
765 }
union edd_device_path device_path
Device path.
Definition: edd.h:25
static const char * efi_boolean(BOOLEAN boolean)
Convert EFI boolean to text.
Definition: efi_wrap.c:128
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
EFI_IMAGE_LOAD LoadImage
Definition: UefiSpec.h:1978
#define DBGC(...)
Definition: compiler.h:505
static void efi_dump_image(EFI_HANDLE handle)
Dump information about a loaded image.
Definition: efi_wrap.c:276
const char * efi_devpath_text(EFI_DEVICE_PATH_PROTOCOL *path)
Get textual representation of device path.
Definition: efi_debug.c:247
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:652
EFI Boot Services Table.
Definition: UefiSpec.h:1931
static unsigned int source_size
Definition: bigint.h:251
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42

References EFI_SYSTEM_TABLE::BootServices, colour, DBGC, device_path, efi_boolean(), efi_devpath_text(), efi_dump_image(), efi_handle_name(), efi_status(), efi_systab, EFI_BOOT_SERVICES::LoadImage, and source_size.

Referenced by efi_wrap_bs().

◆ efi_start_image_wrapper()

static EFI_STATUS EFIAPI efi_start_image_wrapper ( EFI_HANDLE  image_handle,
UINTN exit_data_size,
CHAR16 **  exit_data 
)
static

Wrap StartImage()

Definition at line 772 of file efi_wrap.c.

773  {
775  void *retaddr = __builtin_return_address ( 0 );
776  EFI_STATUS efirc;
777 
778  DBGC ( colour, "StartImage ( %s ) ", efi_handle_name ( image_handle ) );
779  efirc = bs->StartImage ( image_handle, exit_data_size, exit_data );
780  DBGC ( colour, "= %s", efi_status ( efirc ) );
781  if ( ( efirc != 0 ) && exit_data && *exit_data_size )
782  DBGC ( colour, " ( \"%ls\" )", *exit_data );
783  DBGC ( colour, " -> %p\n", retaddr );
784  if ( ( efirc != 0 ) && exit_data && *exit_data_size )
785  DBGC_HD ( colour, *exit_data, *exit_data_size );
786  return efirc;
787 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
#define DBGC(...)
Definition: compiler.h:505
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:652
EFI Boot Services Table.
Definition: UefiSpec.h:1931
#define DBGC_HD(...)
Definition: compiler.h:507
EFI_IMAGE_START StartImage
Definition: UefiSpec.h:1979
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42

References EFI_SYSTEM_TABLE::BootServices, colour, DBGC, DBGC_HD, efi_handle_name(), efi_status(), efi_systab, and EFI_BOOT_SERVICES::StartImage.

Referenced by efi_wrap_bs().

◆ efi_exit_wrapper()

static EFI_STATUS EFIAPI efi_exit_wrapper ( EFI_HANDLE  image_handle,
EFI_STATUS  exit_status,
UINTN  exit_data_size,
CHAR16 exit_data 
)
static

Wrap Exit()

Definition at line 794 of file efi_wrap.c.

795  {
797  void *retaddr = __builtin_return_address ( 0 );
798  EFI_STATUS efirc;
799 
800  if ( ( exit_status != 0 ) && exit_data && exit_data_size )
801  DBGC_HD ( colour, exit_data, exit_data_size );
802  DBGC ( colour, "Exit ( %s, %s",
803  efi_handle_name ( image_handle ), efi_status ( exit_status ) );
804  if ( ( exit_status != 0 ) && exit_data && exit_data_size )
805  DBGC ( colour, ", \"%ls\"", exit_data );
806  DBGC ( colour, " ) " );
807  efirc = bs->Exit ( image_handle, exit_status, exit_data_size,
808  exit_data );
809  DBGC ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
810  return efirc;
811 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
#define DBGC(...)
Definition: compiler.h:505
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:652
EFI Boot Services Table.
Definition: UefiSpec.h:1931
#define DBGC_HD(...)
Definition: compiler.h:507
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42

References EFI_SYSTEM_TABLE::BootServices, colour, DBGC, DBGC_HD, efi_handle_name(), efi_status(), efi_systab, and EFI_BOOT_SERVICES::Exit.

Referenced by efi_wrap_bs().

◆ efi_unload_image_wrapper()

static EFI_STATUS EFIAPI efi_unload_image_wrapper ( EFI_HANDLE  image_handle)
static

Wrap UnloadImage()

Definition at line 818 of file efi_wrap.c.

818  {
820  void *retaddr = __builtin_return_address ( 0 );
821  EFI_STATUS efirc;
822 
823  DBGC ( colour, "UnloadImage ( %s ) ",
824  efi_handle_name ( image_handle ) );
825  efirc = bs->UnloadImage ( image_handle );
826  DBGC ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
827  return efirc;
828 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
#define DBGC(...)
Definition: compiler.h:505
EFI_IMAGE_UNLOAD UnloadImage
Definition: UefiSpec.h:1981
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:652
EFI Boot Services Table.
Definition: UefiSpec.h:1931
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42

References EFI_SYSTEM_TABLE::BootServices, colour, DBGC, efi_handle_name(), efi_status(), efi_systab, and EFI_BOOT_SERVICES::UnloadImage.

Referenced by efi_wrap_bs().

◆ efi_exit_boot_services_wrapper()

static EFI_STATUS EFIAPI efi_exit_boot_services_wrapper ( EFI_HANDLE  image_handle,
UINTN  map_key 
)
static

Wrap ExitBootServices()

Definition at line 835 of file efi_wrap.c.

835  {
837  void *retaddr = __builtin_return_address ( 0 );
838  EFI_STATUS efirc;
839 
840  DBGC ( colour, "ExitBootServices ( %s, %#llx ) -> %p\n",
841  efi_handle_name ( image_handle ),
842  ( ( unsigned long long ) map_key ), retaddr );
843  efirc = bs->ExitBootServices ( image_handle, map_key );
844  if ( efirc != 0 ) {
845  DBGC ( colour, "ExitBootServices ( ... ) = %s -> %p\n",
846  efi_status ( efirc ), retaddr );
847  /* On some systems, scrolling the output will cause
848  * the system memory map to change (and so cause
849  * ExitBootServices() to fail).
850  *
851  * After the first failed attempt, prescroll the
852  * screen to maximise the chance of the subsequent
853  * attempt succeeding.
854  */
856  }
857  return efirc;
858 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
EFI_EXIT_BOOT_SERVICES ExitBootServices
Definition: UefiSpec.h:1982
#define DBGC(...)
Definition: compiler.h:505
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:652
EFI Boot Services Table.
Definition: UefiSpec.h:1931
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
EFI_SYSTEM_TABLE * efi_systab
static int efi_prescroll(unsigned int lines)
Pre-scroll display to create space for output lines.
Definition: efi_wrap.c:245
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42
#define EFI_WRAP_PRESCROLL
Number of lines to prescroll when needed.
Definition: efi_wrap.c:48

References EFI_SYSTEM_TABLE::BootServices, colour, DBGC, efi_handle_name(), efi_prescroll(), efi_status(), efi_systab, EFI_WRAP_PRESCROLL, and EFI_BOOT_SERVICES::ExitBootServices.

Referenced by efi_wrap_bs().

◆ efi_get_next_monotonic_count_wrapper()

static EFI_STATUS EFIAPI efi_get_next_monotonic_count_wrapper ( UINT64 count)
static

Wrap GetNextMonotonicCount()

Definition at line 865 of file efi_wrap.c.

865  {
867  void *retaddr = __builtin_return_address ( 0 );
868  EFI_STATUS efirc;
869 
870  DBGCP ( colour, "GetNextMonotonicCount() " );
871  efirc = bs->GetNextMonotonicCount ( count );
872  DBGCP ( colour, "= %s ( %#llx ) -> %p\n",
873  efi_status ( efirc ), *count, retaddr );
874  return efirc;
875 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
static unsigned int count
Number of entries.
Definition: dwmac.h:225
EFI Boot Services Table.
Definition: UefiSpec.h:1931
EFI_GET_NEXT_MONOTONIC_COUNT GetNextMonotonicCount
Definition: UefiSpec.h:1987
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
#define DBGCP(...)
Definition: compiler.h:539
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42

References EFI_SYSTEM_TABLE::BootServices, colour, count, DBGCP, efi_status(), efi_systab, and EFI_BOOT_SERVICES::GetNextMonotonicCount.

Referenced by efi_wrap_bs().

◆ efi_stall_wrapper()

static EFI_STATUS EFIAPI efi_stall_wrapper ( UINTN  microseconds)
static

Wrap Stall()

Definition at line 882 of file efi_wrap.c.

882  {
884  void *retaddr = __builtin_return_address ( 0 );
885  EFI_STATUS efirc;
886 
887  DBGCP ( colour, "Stall ( %ld.%06lds ) ",
888  ( ( unsigned long ) ( microseconds / 1000000 ) ),
889  ( ( unsigned long ) ( microseconds % 1000000 ) ) );
890  efirc = bs->Stall ( microseconds );
891  DBGCP ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
892  return efirc;
893 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
EFI_STALL Stall
Definition: UefiSpec.h:1988
EFI Boot Services Table.
Definition: UefiSpec.h:1931
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
#define DBGCP(...)
Definition: compiler.h:539
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42

References EFI_SYSTEM_TABLE::BootServices, colour, DBGCP, efi_status(), efi_systab, and EFI_BOOT_SERVICES::Stall.

Referenced by efi_wrap_bs().

◆ efi_set_watchdog_timer_wrapper()

static EFI_STATUS EFIAPI efi_set_watchdog_timer_wrapper ( UINTN  timeout,
UINT64  watchdog_code,
UINTN  data_size,
CHAR16 watchdog_data 
)
static

Wrap SetWatchdogTimer()

Definition at line 900 of file efi_wrap.c.

901  {
903  void *retaddr = __builtin_return_address ( 0 );
904  EFI_STATUS efirc;
905 
906  DBGC ( colour, "SetWatchdogTimer ( %lds, %#llx, %#llx, %p ) ",
907  ( ( unsigned long ) timeout ), watchdog_code,
908  ( ( unsigned long long ) data_size ), watchdog_data );
909  efirc = bs->SetWatchdogTimer ( timeout, watchdog_code, data_size,
910  watchdog_data );
911  DBGC ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
912  return efirc;
913 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
EFI_SET_WATCHDOG_TIMER SetWatchdogTimer
Definition: UefiSpec.h:1989
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
#define DBGC(...)
Definition: compiler.h:505
EFI Boot Services Table.
Definition: UefiSpec.h:1931
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
void timeout(int)
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42

References EFI_SYSTEM_TABLE::BootServices, colour, DBGC, efi_status(), efi_systab, EFI_BOOT_SERVICES::SetWatchdogTimer, and timeout().

Referenced by efi_wrap_bs().

◆ efi_connect_controller_wrapper()

static EFI_STATUS EFIAPI efi_connect_controller_wrapper ( EFI_HANDLE  controller_handle,
EFI_HANDLE driver_image_handle,
EFI_DEVICE_PATH_PROTOCOL remaining_path,
BOOLEAN  recursive 
)
static

Wrap ConnectController()

Definition at line 920 of file efi_wrap.c.

923  {
925  void *retaddr = __builtin_return_address ( 0 );
926  EFI_HANDLE *tmp;
927  EFI_STATUS efirc;
928 
929  DBGC ( colour, "ConnectController ( %s, {",
930  efi_handle_name ( controller_handle ) );
931  if ( driver_image_handle ) {
932  for ( tmp = driver_image_handle ; *tmp ; tmp++ ) {
933  DBGC ( colour, "%s%s",
934  ( ( tmp == driver_image_handle ) ? " " : ", " ),
935  efi_handle_name ( *tmp ) );
936  }
937  }
938  DBGC ( colour, " }, %s, %s ) ", efi_devpath_text ( remaining_path ),
939  efi_boolean ( recursive ) );
940  efirc = bs->ConnectController ( controller_handle, driver_image_handle,
941  remaining_path, recursive );
942  DBGC ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
943  return efirc;
944 }
static const char * efi_boolean(BOOLEAN boolean)
Convert EFI boolean to text.
Definition: efi_wrap.c:128
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
#define DBGC(...)
Definition: compiler.h:505
unsigned long tmp
Definition: linux_pci.h:65
const char * efi_devpath_text(EFI_DEVICE_PATH_PROTOCOL *path)
Get textual representation of device path.
Definition: efi_debug.c:247
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:652
EFI Boot Services Table.
Definition: UefiSpec.h:1931
EFI_CONNECT_CONTROLLER ConnectController
Definition: UefiSpec.h:1994
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42
Definition: efi.h:62

References EFI_SYSTEM_TABLE::BootServices, colour, EFI_BOOT_SERVICES::ConnectController, DBGC, efi_boolean(), efi_devpath_text(), efi_handle_name(), efi_status(), efi_systab, and tmp.

Referenced by efi_wrap_bs().

◆ efi_disconnect_controller_wrapper()

static EFI_STATUS EFIAPI efi_disconnect_controller_wrapper ( EFI_HANDLE  controller_handle,
EFI_HANDLE  driver_image_handle,
EFI_HANDLE  child_handle 
)
static

Wrap DisconnectController()

Definition at line 951 of file efi_wrap.c.

953  {
955  void *retaddr = __builtin_return_address ( 0 );
956  EFI_STATUS efirc;
957 
958  DBGC ( colour, "DisconnectController ( %s",
959  efi_handle_name ( controller_handle ) );
960  DBGC ( colour, ", %s", efi_handle_name ( driver_image_handle ) );
961  DBGC ( colour, ", %s ) ", efi_handle_name ( child_handle ) );
962  efirc = bs->DisconnectController ( controller_handle,
963  driver_image_handle,
964  child_handle );
965  DBGC ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
966  return efirc;
967 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
#define DBGC(...)
Definition: compiler.h:505
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:652
EFI Boot Services Table.
Definition: UefiSpec.h:1931
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42
EFI_DISCONNECT_CONTROLLER DisconnectController
Definition: UefiSpec.h:1995

References EFI_SYSTEM_TABLE::BootServices, colour, DBGC, EFI_BOOT_SERVICES::DisconnectController, efi_handle_name(), efi_status(), and efi_systab.

Referenced by efi_wrap_bs().

◆ efi_open_protocol_wrapper()

static EFI_STATUS EFIAPI efi_open_protocol_wrapper ( EFI_HANDLE  handle,
EFI_GUID protocol,
VOID **  interface,
EFI_HANDLE  agent_handle,
EFI_HANDLE  controller_handle,
UINT32  attributes 
)
static

Wrap OpenProtocol()

Definition at line 974 of file efi_wrap.c.

976  {
978  void *retaddr = __builtin_return_address ( 0 );
979  EFI_STATUS efirc;
980 
981  DBGC ( colour, "OpenProtocol ( %s, %s, ",
983  DBGC ( colour, "%s, ", efi_handle_name ( agent_handle ) );
984  DBGC ( colour, "%s, %s ) ", efi_handle_name ( controller_handle ),
985  efi_open_attributes_name ( attributes ) );
986  efirc = bs->OpenProtocol ( handle, protocol, interface, agent_handle,
987  controller_handle, attributes );
988  DBGC ( colour, "= %s ( %p ) -> %p\n",
989  efi_status ( efirc ), *interface, retaddr );
990  return efirc;
991 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
#define DBGC(...)
Definition: compiler.h:505
An object interface.
Definition: interface.h:125
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:652
EFI Boot Services Table.
Definition: UefiSpec.h:1931
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_guid.c:726
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
const char * efi_open_attributes_name(unsigned int attributes)
Name protocol open attributes.
Definition: efi_debug.c:102
EFI_SYSTEM_TABLE * efi_systab
EFI_OPEN_PROTOCOL OpenProtocol
Definition: UefiSpec.h:2000
uint16_t protocol
Protocol ID.
Definition: stp.h:19
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42
uint16_t handle
Handle.
Definition: smbios.h:17

References EFI_SYSTEM_TABLE::BootServices, colour, DBGC, efi_guid_ntoa(), efi_handle_name(), efi_open_attributes_name(), efi_status(), efi_systab, handle, EFI_BOOT_SERVICES::OpenProtocol, and protocol.

Referenced by efi_wrap_bs().

◆ efi_close_protocol_wrapper()

static EFI_STATUS EFIAPI efi_close_protocol_wrapper ( EFI_HANDLE  handle,
EFI_GUID protocol,
EFI_HANDLE  agent_handle,
EFI_HANDLE  controller_handle 
)
static

Wrap CloseProtocol()

Definition at line 998 of file efi_wrap.c.

1000  {
1002  void *retaddr = __builtin_return_address ( 0 );
1003  EFI_STATUS efirc;
1004 
1005  DBGC ( colour, "CloseProtocol ( %s, %s, ",
1007  DBGC ( colour, "%s, ", efi_handle_name ( agent_handle ) );
1008  DBGC ( colour, "%s ) ", efi_handle_name ( controller_handle ) );
1009  efirc = bs->CloseProtocol ( handle, protocol, agent_handle,
1010  controller_handle );
1011  DBGC ( colour, "= %s -> %p\n",
1012  efi_status ( efirc ), retaddr );
1013  return efirc;
1014 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
#define DBGC(...)
Definition: compiler.h:505
EFI_CLOSE_PROTOCOL CloseProtocol
Definition: UefiSpec.h:2001
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:652
EFI Boot Services Table.
Definition: UefiSpec.h:1931
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_guid.c:726
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
EFI_SYSTEM_TABLE * efi_systab
uint16_t protocol
Protocol ID.
Definition: stp.h:19
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42
uint16_t handle
Handle.
Definition: smbios.h:17

References EFI_SYSTEM_TABLE::BootServices, EFI_BOOT_SERVICES::CloseProtocol, colour, DBGC, efi_guid_ntoa(), efi_handle_name(), efi_status(), efi_systab, handle, and protocol.

Referenced by efi_wrap_bs().

◆ efi_open_protocol_information_wrapper()

static EFI_STATUS EFIAPI efi_open_protocol_information_wrapper ( EFI_HANDLE  handle,
EFI_GUID protocol,
EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **  entry_buffer,
UINTN entry_count 
)
static

Wrap OpenProtocolInformation()

Definition at line 1021 of file efi_wrap.c.

1024  {
1026  void *retaddr = __builtin_return_address ( 0 );
1027  EFI_STATUS efirc;
1028 
1029  DBGC ( colour, "OpenProtocolInformation ( %s, %s ) ",
1031  efirc = bs->OpenProtocolInformation ( handle, protocol, entry_buffer,
1032  entry_count );
1033  DBGC ( colour, "= %s ( %p, %#llx ) -> %p\n",
1034  efi_status ( efirc ), *entry_buffer,
1035  ( ( unsigned long long ) *entry_count ), retaddr );
1036  return efirc;
1037 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
#define DBGC(...)
Definition: compiler.h:505
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:652
EFI Boot Services Table.
Definition: UefiSpec.h:1931
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_guid.c:726
EFI_OPEN_PROTOCOL_INFORMATION OpenProtocolInformation
Definition: UefiSpec.h:2002
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
EFI_SYSTEM_TABLE * efi_systab
uint16_t protocol
Protocol ID.
Definition: stp.h:19
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42
uint16_t handle
Handle.
Definition: smbios.h:17

References EFI_SYSTEM_TABLE::BootServices, colour, DBGC, efi_guid_ntoa(), efi_handle_name(), efi_status(), efi_systab, handle, EFI_BOOT_SERVICES::OpenProtocolInformation, and protocol.

Referenced by efi_wrap_bs().

◆ efi_protocols_per_handle_wrapper()

static EFI_STATUS EFIAPI efi_protocols_per_handle_wrapper ( EFI_HANDLE  handle,
EFI_GUID ***  protocol_buffer,
UINTN protocol_buffer_count 
)
static

Wrap ProtocolsPerHandle()

Definition at line 1044 of file efi_wrap.c.

1046  {
1048  void *retaddr = __builtin_return_address ( 0 );
1049  unsigned int i;
1050  EFI_STATUS efirc;
1051 
1052  DBGC ( colour, "ProtocolsPerHandle ( %s ) ",
1053  efi_handle_name ( handle ) );
1054  efirc = bs->ProtocolsPerHandle ( handle, protocol_buffer,
1055  protocol_buffer_count );
1056  DBGC ( colour, "= %s", efi_status ( efirc ) );
1057  if ( efirc == 0 ) {
1058  DBGC ( colour, " ( {" );
1059  for ( i = 0 ; i < *protocol_buffer_count ; i++ ) {
1060  DBGC ( colour, "%s%s", ( i ? ", " : " " ),
1061  efi_guid_ntoa ( (*protocol_buffer)[i] ) );
1062  }
1063  DBGC ( colour, " } )" );
1064  }
1065  DBGC ( colour, " -> %p\n", retaddr );
1066  return efirc;
1067 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
#define DBGC(...)
Definition: compiler.h:505
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:652
EFI Boot Services Table.
Definition: UefiSpec.h:1931
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_guid.c:726
EFI_PROTOCOLS_PER_HANDLE ProtocolsPerHandle
Definition: UefiSpec.h:2007
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42
uint16_t handle
Handle.
Definition: smbios.h:17

References EFI_SYSTEM_TABLE::BootServices, colour, DBGC, efi_guid_ntoa(), efi_handle_name(), efi_status(), efi_systab, handle, and EFI_BOOT_SERVICES::ProtocolsPerHandle.

Referenced by efi_wrap_bs().

◆ efi_locate_handle_buffer_wrapper()

static EFI_STATUS EFIAPI efi_locate_handle_buffer_wrapper ( EFI_LOCATE_SEARCH_TYPE  search_type,
EFI_GUID protocol,
VOID search_key,
UINTN no_handles,
EFI_HANDLE **  buffer 
)
static

Wrap LocateHandleBuffer()

Definition at line 1074 of file efi_wrap.c.

1076  {
1078  void *retaddr = __builtin_return_address ( 0 );
1079  unsigned int i;
1080  EFI_STATUS efirc;
1081 
1082  DBGC ( colour, "LocateHandleBuffer ( %s, %s, %p ) ",
1083  efi_locate_search_type_name ( search_type ),
1084  efi_guid_ntoa ( protocol ), search_key );
1085  efirc = bs->LocateHandleBuffer ( search_type, protocol, search_key,
1086  no_handles, buffer );
1087  DBGC ( colour, "= %s", efi_status ( efirc ) );
1088  if ( efirc == 0 ) {
1089  DBGC ( colour, " ( %d, {", ( ( unsigned int ) *no_handles ) );
1090  for ( i = 0 ; i < *no_handles ; i++ ) {
1091  DBGC ( colour, "%s%s", ( i ? ", " : " " ),
1092  efi_handle_name ( (*buffer)[i] ) );
1093  }
1094  DBGC ( colour, " } )" );
1095  }
1096  DBGC ( colour, " -> %p\n", retaddr );
1097  return efirc;
1098 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
#define DBGC(...)
Definition: compiler.h:505
uint32_t buffer
Buffer index (or NETVSC_RNDIS_NO_BUFFER)
Definition: netvsc.h:16
const char * efi_locate_search_type_name(EFI_LOCATE_SEARCH_TYPE search_type)
Name locate search type.
Definition: efi_debug.c:77
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:652
EFI Boot Services Table.
Definition: UefiSpec.h:1931
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_guid.c:726
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
EFI_SYSTEM_TABLE * efi_systab
uint16_t protocol
Protocol ID.
Definition: stp.h:19
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42
EFI_LOCATE_HANDLE_BUFFER LocateHandleBuffer
Definition: UefiSpec.h:2008

References EFI_SYSTEM_TABLE::BootServices, buffer, colour, DBGC, efi_guid_ntoa(), efi_handle_name(), efi_locate_search_type_name(), efi_status(), efi_systab, EFI_BOOT_SERVICES::LocateHandleBuffer, and protocol.

Referenced by efi_wrap_bs().

◆ efi_locate_protocol_wrapper()

static EFI_STATUS EFIAPI efi_locate_protocol_wrapper ( EFI_GUID protocol,
VOID registration,
VOID **  interface 
)
static

Wrap LocateProtocol()

Definition at line 1105 of file efi_wrap.c.

1106  {
1108  void *retaddr = __builtin_return_address ( 0 );
1109  EFI_STATUS efirc;
1110 
1111  DBGC ( colour, "LocateProtocol ( %s, %p ) ",
1112  efi_guid_ntoa ( protocol ), registration );
1113  efirc = bs->LocateProtocol ( protocol, registration, interface );
1114  DBGC ( colour, "= %s ( %p ) -> %p\n",
1115  efi_status ( efirc ), *interface, retaddr );
1116  return efirc;
1117 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
EFI_LOCATE_PROTOCOL LocateProtocol
Definition: UefiSpec.h:2009
#define DBGC(...)
Definition: compiler.h:505
An object interface.
Definition: interface.h:125
EFI Boot Services Table.
Definition: UefiSpec.h:1931
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_guid.c:726
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
EFI_SYSTEM_TABLE * efi_systab
uint16_t protocol
Protocol ID.
Definition: stp.h:19
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42

References EFI_SYSTEM_TABLE::BootServices, colour, DBGC, efi_guid_ntoa(), efi_status(), efi_systab, EFI_BOOT_SERVICES::LocateProtocol, and protocol.

Referenced by efi_wrap_bs().

◆ efi_install_multiple_protocol_interfaces_wrapper()

static EFI_STATUS EFIAPI efi_install_multiple_protocol_interfaces_wrapper ( EFI_HANDLE handle,
  ... 
)
static

Wrap InstallMultipleProtocolInterfaces()

Definition at line 1127 of file efi_wrap.c.

1127  {
1129  void *retaddr = __builtin_return_address ( 0 );
1132  VA_LIST ap;
1133  unsigned int i;
1134  EFI_STATUS efirc;
1135 
1136  DBGC ( colour, "InstallMultipleProtocolInterfaces ( %s",
1137  efi_handle_name ( *handle ) );
1138  memset ( protocol, 0, sizeof ( protocol ) );
1139  memset ( interface, 0, sizeof ( interface ) );
1140  VA_START ( ap, handle );
1141  for ( i = 0 ; ( protocol[i] = VA_ARG ( ap, EFI_GUID * ) ) ; i++ ) {
1142  if ( i == MAX_WRAP_MULTI ) {
1143  VA_END ( ap );
1144  efirc = EFI_OUT_OF_RESOURCES;
1145  DBGC ( colour, "<FATAL: too many arguments> ) = %s "
1146  "-> %p\n", efi_status ( efirc ), retaddr );
1147  return efirc;
1148  }
1149  interface[i] = VA_ARG ( ap, VOID * );
1150  DBGC ( colour, ", %s, %p",
1151  efi_guid_ntoa ( protocol[i] ), interface[i] );
1152  }
1153  VA_END ( ap );
1154  DBGC ( colour, " ) " );
1156  protocol[0], interface[0], protocol[1], interface[1],
1157  protocol[2], interface[2], protocol[3], interface[3],
1158  protocol[4], interface[4], protocol[5], interface[5],
1159  protocol[6], interface[6], protocol[7], interface[7],
1160  protocol[8], interface[8], protocol[9], interface[9],
1161  protocol[10], interface[10], protocol[11], interface[11],
1162  protocol[12], interface[12], protocol[13], interface[13],
1163  protocol[14], interface[14], protocol[15], interface[15],
1164  protocol[16], interface[16], protocol[17], interface[17],
1165  protocol[18], interface[18], protocol[19], interface[19],
1166  NULL );
1167  DBGC ( colour, "= %s ( %s ) -> %p\n",
1168  efi_status ( efirc ), efi_handle_name ( *handle ), retaddr );
1169  return efirc;
1170 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
#define VA_END(Marker)
Terminates the use of a variable argument list.
Definition: Base.h:694
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
128 bit buffer containing a unique identifier value.
Definition: Base.h:216
#define DBGC(...)
Definition: compiler.h:505
EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces
Definition: UefiSpec.h:2010
#define EFI_OUT_OF_RESOURCES
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:124
An object interface.
Definition: interface.h:125
#define VA_ARG(Marker, TYPE)
Returns an argument of a specified type from a variable argument list and updates the pointer to the ...
Definition: Base.h:682
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:652
EFI Boot Services Table.
Definition: UefiSpec.h:1931
#define VA_START(Marker, Parameter)
Retrieves a pointer to the beginning of a variable argument list, based on the name of the parameter ...
Definition: Base.h:664
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_guid.c:726
#define VOID
Undeclared type.
Definition: Base.h:272
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
EFI_SYSTEM_TABLE * efi_systab
uint16_t protocol
Protocol ID.
Definition: stp.h:19
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42
uint16_t handle
Handle.
Definition: smbios.h:17
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322
#define MAX_WRAP_MULTI
Maximum number of interfaces for wrapped ...MultipleProtocolInterfaces()
Definition: efi_wrap.c:1120
CHAR8 * VA_LIST
Variable used to traverse the list of arguments.
Definition: Base.h:646
void * memset(void *dest, int character, size_t len) __nonnull

References EFI_SYSTEM_TABLE::BootServices, colour, DBGC, efi_guid_ntoa(), efi_handle_name(), EFI_OUT_OF_RESOURCES, efi_status(), efi_systab, handle, EFI_BOOT_SERVICES::InstallMultipleProtocolInterfaces, MAX_WRAP_MULTI, memset(), NULL, protocol, VA_ARG, VA_END, VA_START, and VOID.

Referenced by efi_wrap_bs().

◆ efi_uninstall_multiple_protocol_interfaces_wrapper()

static EFI_STATUS EFIAPI efi_uninstall_multiple_protocol_interfaces_wrapper ( EFI_HANDLE  handle,
  ... 
)
static

Wrap UninstallMultipleProtocolInterfaces()

Definition at line 1177 of file efi_wrap.c.

1177  {
1179  void *retaddr = __builtin_return_address ( 0 );
1182  VA_LIST ap;
1183  unsigned int i;
1184  EFI_STATUS efirc;
1185 
1186  DBGC ( colour, "UninstallMultipleProtocolInterfaces ( %s",
1187  efi_handle_name ( handle ) );
1188  memset ( protocol, 0, sizeof ( protocol ) );
1189  memset ( interface, 0, sizeof ( interface ) );
1190  VA_START ( ap, handle );
1191  for ( i = 0 ; ( protocol[i] = VA_ARG ( ap, EFI_GUID * ) ) ; i++ ) {
1192  if ( i == MAX_WRAP_MULTI ) {
1193  VA_END ( ap );
1194  efirc = EFI_OUT_OF_RESOURCES;
1195  DBGC ( colour, "<FATAL: too many arguments> ) = %s "
1196  "-> %p\n", efi_status ( efirc ), retaddr );
1197  return efirc;
1198  }
1199  interface[i] = VA_ARG ( ap, VOID * );
1200  DBGC ( colour, ", %s, %p",
1201  efi_guid_ntoa ( protocol[i] ), interface[i] );
1202  }
1203  VA_END ( ap );
1204  DBGC ( colour, " ) " );
1206  protocol[0], interface[0], protocol[1], interface[1],
1207  protocol[2], interface[2], protocol[3], interface[3],
1208  protocol[4], interface[4], protocol[5], interface[5],
1209  protocol[6], interface[6], protocol[7], interface[7],
1210  protocol[8], interface[8], protocol[9], interface[9],
1211  protocol[10], interface[10], protocol[11], interface[11],
1212  protocol[12], interface[12], protocol[13], interface[13],
1213  protocol[14], interface[14], protocol[15], interface[15],
1214  protocol[16], interface[16], protocol[17], interface[17],
1215  protocol[18], interface[18], protocol[19], interface[19],
1216  NULL );
1217  DBGC ( colour, "= %s -> %p\n",
1218  efi_status ( efirc ), retaddr );
1219  return efirc;
1220 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
#define VA_END(Marker)
Terminates the use of a variable argument list.
Definition: Base.h:694
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
128 bit buffer containing a unique identifier value.
Definition: Base.h:216
#define DBGC(...)
Definition: compiler.h:505
#define EFI_OUT_OF_RESOURCES
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:124
An object interface.
Definition: interface.h:125
#define VA_ARG(Marker, TYPE)
Returns an argument of a specified type from a variable argument list and updates the pointer to the ...
Definition: Base.h:682
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:652
EFI Boot Services Table.
Definition: UefiSpec.h:1931
EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces
Definition: UefiSpec.h:2011
#define VA_START(Marker, Parameter)
Retrieves a pointer to the beginning of a variable argument list, based on the name of the parameter ...
Definition: Base.h:664
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_guid.c:726
#define VOID
Undeclared type.
Definition: Base.h:272
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
EFI_SYSTEM_TABLE * efi_systab
uint16_t protocol
Protocol ID.
Definition: stp.h:19
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42
uint16_t handle
Handle.
Definition: smbios.h:17
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322
#define MAX_WRAP_MULTI
Maximum number of interfaces for wrapped ...MultipleProtocolInterfaces()
Definition: efi_wrap.c:1120
CHAR8 * VA_LIST
Variable used to traverse the list of arguments.
Definition: Base.h:646
void * memset(void *dest, int character, size_t len) __nonnull

References EFI_SYSTEM_TABLE::BootServices, colour, DBGC, efi_guid_ntoa(), efi_handle_name(), EFI_OUT_OF_RESOURCES, efi_status(), efi_systab, handle, MAX_WRAP_MULTI, memset(), NULL, protocol, EFI_BOOT_SERVICES::UninstallMultipleProtocolInterfaces, VA_ARG, VA_END, VA_START, and VOID.

Referenced by efi_wrap_bs().

◆ efi_create_event_ex_wrapper()

static EFI_STATUS EFIAPI efi_create_event_ex_wrapper ( UINT32  type,
EFI_TPL  notify_tpl,
EFI_EVENT_NOTIFY  notify_function,
CONST VOID notify_context,
CONST EFI_GUID event_group,
EFI_EVENT event 
)
static

Wrap CreateEventEx()

Definition at line 1227 of file efi_wrap.c.

1230  {
1232  void *retaddr = __builtin_return_address ( 0 );
1233  EFI_STATUS efirc;
1234 
1235  DBGC ( colour, "CreateEventEx ( %#x, %s, %p, %p, %s ) ",
1236  type, efi_tpl_name ( notify_tpl ), notify_function,
1237  notify_context, efi_guid_ntoa ( event_group ) );
1238  efirc = bs->CreateEventEx ( type, notify_tpl, notify_function,
1239  notify_context, event_group, event );
1240  DBGC ( colour, "= %s ( %p ) -> %p\n",
1241  efi_status ( efirc ), *event, retaddr );
1242  return efirc;
1243 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
uint32_t type
Operating system type.
Definition: ena.h:12
#define DBGC(...)
Definition: compiler.h:505
EFI_CREATE_EVENT_EX CreateEventEx
Definition: UefiSpec.h:2023
EFI Boot Services Table.
Definition: UefiSpec.h:1931
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_guid.c:726
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42
const char * efi_tpl_name(EFI_TPL tpl)
Name EFI TPL.
Definition: efi_debug.c:55

References EFI_SYSTEM_TABLE::BootServices, colour, EFI_BOOT_SERVICES::CreateEventEx, DBGC, efi_guid_ntoa(), efi_status(), efi_systab, efi_tpl_name(), and type.

Referenced by efi_wrap_bs().

◆ efi_get_time_wrapper()

static EFI_STATUS EFIAPI efi_get_time_wrapper ( EFI_TIME time,
EFI_TIME_CAPABILITIES cap 
)
static

Wrap GetTime()

Definition at line 1250 of file efi_wrap.c.

1250  {
1252  void *retaddr = __builtin_return_address ( 0 );
1253  EFI_STATUS efirc;
1254 
1255  DBGCP ( colour, "GetTime() " );
1256  efirc = rs->GetTime ( time, cap );
1257  DBGCP ( colour, "= %s ( %s ) -> %p\n",
1258  efi_status ( efirc ), efi_time ( time ), retaddr );
1259  return efirc;
1260 }
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
EFI Runtime Services Table.
Definition: UefiSpec.h:1880
EFI_GET_TIME GetTime
Definition: UefiSpec.h:1889
static const char * efi_time(EFI_TIME *time)
Convert EFI time to text.
Definition: efi_wrap.c:208
EFI_RUNTIME_SERVICES * RuntimeServices
A pointer to the EFI Runtime Services Table.
Definition: UefiSpec.h:2095
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
#define DBGCP(...)
Definition: compiler.h:539
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42

References colour, DBGCP, efi_status(), efi_systab, efi_time(), EFI_RUNTIME_SERVICES::GetTime, and EFI_SYSTEM_TABLE::RuntimeServices.

Referenced by efi_wrap_rs().

◆ efi_set_time_wrapper()

static EFI_STATUS EFIAPI efi_set_time_wrapper ( EFI_TIME time)
static

Wrap SetTime()

Definition at line 1267 of file efi_wrap.c.

1267  {
1269  void *retaddr = __builtin_return_address ( 0 );
1270  EFI_STATUS efirc;
1271 
1272  DBGC ( colour, "SetTime ( %s ) ", efi_time ( time ) );
1273  efirc = rs->SetTime ( time );
1274  DBGC ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
1275  return efirc;
1276 }
EFI_SET_TIME SetTime
Definition: UefiSpec.h:1890
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
#define DBGC(...)
Definition: compiler.h:505
EFI Runtime Services Table.
Definition: UefiSpec.h:1880
static const char * efi_time(EFI_TIME *time)
Convert EFI time to text.
Definition: efi_wrap.c:208
EFI_RUNTIME_SERVICES * RuntimeServices
A pointer to the EFI Runtime Services Table.
Definition: UefiSpec.h:2095
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42

References colour, DBGC, efi_status(), efi_systab, efi_time(), EFI_SYSTEM_TABLE::RuntimeServices, and EFI_RUNTIME_SERVICES::SetTime.

Referenced by efi_wrap_rs().

◆ efi_get_wakeup_time_wrapper()

static EFI_STATUS EFIAPI efi_get_wakeup_time_wrapper ( BOOLEAN enabled,
BOOLEAN pending,
EFI_TIME time 
)
static

Wrap GetWakeupTime()

Definition at line 1283 of file efi_wrap.c.

1284  {
1286  void *retaddr = __builtin_return_address ( 0 );
1287  EFI_STATUS efirc;
1288 
1289  DBGC ( colour, "GetWakeupTime() " );
1290  efirc = rs->GetWakeupTime ( enabled, pending, time );
1291  DBGC ( colour, "= %s ( %s, %s, %s ) -> %p\n", efi_status ( efirc ),
1293  efi_time ( time ), retaddr );
1294  return efirc;
1295 }
static const char * efi_boolean(BOOLEAN boolean)
Convert EFI boolean to text.
Definition: efi_wrap.c:128
EFI_GET_WAKEUP_TIME GetWakeupTime
Definition: UefiSpec.h:1891
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
#define DBGC(...)
Definition: compiler.h:505
uint16_t enabled
Single-entry bitmask of the enabled option value.
Definition: ena.h:14
uint32_t pending
Pending events.
Definition: hyperv.h:12
EFI Runtime Services Table.
Definition: UefiSpec.h:1880
static const char * efi_time(EFI_TIME *time)
Convert EFI time to text.
Definition: efi_wrap.c:208
EFI_RUNTIME_SERVICES * RuntimeServices
A pointer to the EFI Runtime Services Table.
Definition: UefiSpec.h:2095
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42

References colour, DBGC, efi_boolean(), efi_status(), efi_systab, efi_time(), enabled, EFI_RUNTIME_SERVICES::GetWakeupTime, pending, and EFI_SYSTEM_TABLE::RuntimeServices.

Referenced by efi_wrap_rs().

◆ efi_set_wakeup_time_wrapper()

static EFI_STATUS EFIAPI efi_set_wakeup_time_wrapper ( BOOLEAN  enable,
EFI_TIME time 
)
static

Wrap SetWakeupTime()

Definition at line 1302 of file efi_wrap.c.

1302  {
1304  void *retaddr = __builtin_return_address ( 0 );
1305  EFI_STATUS efirc;
1306 
1307  DBGC ( colour, "SetWakeupTime ( %s, %s ) ",
1308  efi_boolean ( enable ), efi_time ( time ) );
1309  efirc = rs->SetWakeupTime ( enable, time );
1310  DBGC ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
1311  return efirc;
1312 }
static const char * efi_boolean(BOOLEAN boolean)
Convert EFI boolean to text.
Definition: efi_wrap.c:128
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
#define DBGC(...)
Definition: compiler.h:505
EFI Runtime Services Table.
Definition: UefiSpec.h:1880
static const char * efi_time(EFI_TIME *time)
Convert EFI time to text.
Definition: efi_wrap.c:208
EFI_SET_WAKEUP_TIME SetWakeupTime
Definition: UefiSpec.h:1892
EFI_RUNTIME_SERVICES * RuntimeServices
A pointer to the EFI Runtime Services Table.
Definition: UefiSpec.h:2095
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42

References colour, DBGC, efi_boolean(), efi_status(), efi_systab, efi_time(), EFI_SYSTEM_TABLE::RuntimeServices, and EFI_RUNTIME_SERVICES::SetWakeupTime.

Referenced by efi_wrap_rs().

◆ efi_get_variable_wrapper()

static EFI_STATUS EFIAPI efi_get_variable_wrapper ( CHAR16 name,
EFI_GUID guid,
UINT32 attrs,
UINTN len,
VOID data 
)
static

Wrap GetVariable()

Definition at line 1319 of file efi_wrap.c.

1320  {
1322  void *retaddr = __builtin_return_address ( 0 );
1323  size_t dumplen;
1324  EFI_STATUS efirc;
1325 
1326  DBGC ( colour, "GetVariable ( %s:%ls, %#llx ) ",
1327  efi_guid_ntoa ( guid ), name, ( ( unsigned long long ) *len ) );
1328  efirc = rs->GetVariable ( name, guid, attrs, len, data );
1329  DBGC ( colour, "= %s ( %#llx",
1330  efi_status ( efirc ), ( ( unsigned long long ) *len ) );
1331  if ( DBG_EXTRA && ( efirc == 0 ) ) {
1332  dumplen = *len;
1333  if ( dumplen > EFI_WRAP_DUMP_MAX )
1334  dumplen = EFI_WRAP_DUMP_MAX;
1335  DBGC2 ( colour, ",\n" );
1336  DBGC2_HD ( colour, data, dumplen );
1337  if ( dumplen != *len )
1338  DBGC2 ( colour, "... " );
1339  } else {
1340  DBGC ( colour, " " );
1341  }
1342  DBGC ( colour, ") -> %p\n", retaddr );
1343  return efirc;
1344 }
const char * name
Definition: ath9k_hw.c:1986
#define EFI_WRAP_DUMP_MAX
Maximum size for hex dumps.
Definition: efi_wrap.c:45
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
#define DBGC(...)
Definition: compiler.h:505
ring len
Length.
Definition: dwmac.h:231
EFI_GET_VARIABLE GetVariable
Definition: UefiSpec.h:1903
EFI Runtime Services Table.
Definition: UefiSpec.h:1880
#define DBGC2_HD(...)
Definition: compiler.h:524
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_guid.c:726
uint64_t guid
GUID.
Definition: edd.h:31
EFI_RUNTIME_SERVICES * RuntimeServices
A pointer to the EFI Runtime Services Table.
Definition: UefiSpec.h:2095
#define DBGC2(...)
Definition: compiler.h:522
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
uint8_t data[48]
Additional event data.
Definition: ena.h:22
EFI_SYSTEM_TABLE * efi_systab
#define DBG_EXTRA
Definition: compiler.h:319
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42

References colour, data, DBG_EXTRA, DBGC, DBGC2, DBGC2_HD, efi_guid_ntoa(), efi_status(), efi_systab, EFI_WRAP_DUMP_MAX, EFI_RUNTIME_SERVICES::GetVariable, guid, len, name, and EFI_SYSTEM_TABLE::RuntimeServices.

Referenced by efi_wrap_rs().

◆ efi_get_next_variable_name_wrapper()

static EFI_STATUS EFIAPI efi_get_next_variable_name_wrapper ( UINTN len,
CHAR16 name,
EFI_GUID guid 
)
static

Wrap GetNextVariableName()

Definition at line 1351 of file efi_wrap.c.

1352  {
1354  void *retaddr = __builtin_return_address ( 0 );
1355  EFI_STATUS efirc;
1356 
1357  DBGC ( colour, "GetNextVariableName ( %#llx, %s:%ls ) ",
1358  ( ( unsigned long long ) *len ), efi_guid_ntoa ( guid ), name );
1359  efirc = rs->GetNextVariableName ( len, name, guid );
1360  DBGC ( colour, "= %s ( %#llx, %s:%ls ) -> %p\n", efi_status ( efirc ),
1361  ( ( unsigned long long ) *len ), efi_guid_ntoa ( guid ), name,
1362  retaddr );
1363  return efirc;
1364 }
const char * name
Definition: ath9k_hw.c:1986
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
#define DBGC(...)
Definition: compiler.h:505
ring len
Length.
Definition: dwmac.h:231
EFI Runtime Services Table.
Definition: UefiSpec.h:1880
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_guid.c:726
uint64_t guid
GUID.
Definition: edd.h:31
EFI_RUNTIME_SERVICES * RuntimeServices
A pointer to the EFI Runtime Services Table.
Definition: UefiSpec.h:2095
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
EFI_GET_NEXT_VARIABLE_NAME GetNextVariableName
Definition: UefiSpec.h:1904
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42

References colour, DBGC, efi_guid_ntoa(), efi_status(), efi_systab, EFI_RUNTIME_SERVICES::GetNextVariableName, guid, len, name, and EFI_SYSTEM_TABLE::RuntimeServices.

Referenced by efi_wrap_rs().

◆ efi_set_variable_wrapper()

static EFI_STATUS EFIAPI efi_set_variable_wrapper ( CHAR16 name,
EFI_GUID guid,
UINT32  attrs,
UINTN  len,
VOID data 
)
static

Wrap SetVariable()

Definition at line 1371 of file efi_wrap.c.

1372  {
1374  void *retaddr = __builtin_return_address ( 0 );
1375  EFI_STATUS efirc;
1376 
1377  DBGC ( colour, "SetVariable ( %s:%ls, %#02x",
1378  efi_guid_ntoa ( guid ), name, attrs );
1379  if ( len ) {
1380  DBGC ( colour, ",\n" );
1381  DBGC_HD ( colour, data, len );
1382  DBGC ( colour, ") " );
1383  } else {
1384  DBGC ( colour, ", %#llx, %p ) ",
1385  ( ( unsigned long long ) len ), data );
1386  }
1387  efirc = rs->SetVariable ( name, guid, attrs, len, data );
1388  DBGC ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
1389  return efirc;
1390 }
const char * name
Definition: ath9k_hw.c:1986
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
#define DBGC(...)
Definition: compiler.h:505
ring len
Length.
Definition: dwmac.h:231
EFI_SET_VARIABLE SetVariable
Definition: UefiSpec.h:1905
EFI Runtime Services Table.
Definition: UefiSpec.h:1880
#define DBGC_HD(...)
Definition: compiler.h:507
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_guid.c:726
uint64_t guid
GUID.
Definition: edd.h:31
EFI_RUNTIME_SERVICES * RuntimeServices
A pointer to the EFI Runtime Services Table.
Definition: UefiSpec.h:2095
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
uint8_t data[48]
Additional event data.
Definition: ena.h:22
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42

References colour, data, DBGC, DBGC_HD, efi_guid_ntoa(), efi_status(), efi_systab, guid, len, name, EFI_SYSTEM_TABLE::RuntimeServices, and EFI_RUNTIME_SERVICES::SetVariable.

Referenced by efi_wrap_rs().

◆ efi_reset_system_wrapper()

static VOID EFIAPI efi_reset_system_wrapper ( EFI_RESET_TYPE  type,
EFI_STATUS  status,
UINTN  len,
VOID data 
)
static

Wrap ResetSystem()

Definition at line 1397 of file efi_wrap.c.

1398  {
1400  void *retaddr = __builtin_return_address ( 0 );
1401 
1402  DBGC ( colour, "ResetSystem ( %s, %s, %#llx, %p ) -> %p\n",
1404  ( ( unsigned long long ) len ), data, retaddr );
1405  rs->ResetSystem ( type, status, len, data );
1406 }
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:74
uint32_t type
Operating system type.
Definition: ena.h:12
#define DBGC(...)
Definition: compiler.h:505
ring len
Length.
Definition: dwmac.h:231
EFI Runtime Services Table.
Definition: UefiSpec.h:1880
EFI_RESET_SYSTEM ResetSystem
Definition: UefiSpec.h:1911
uint8_t status
Status.
Definition: ena.h:16
EFI_RUNTIME_SERVICES * RuntimeServices
A pointer to the EFI Runtime Services Table.
Definition: UefiSpec.h:2095
uint8_t data[48]
Additional event data.
Definition: ena.h:22
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42
static const char * efi_reset_type(EFI_RESET_TYPE type)
Convert EFI reset type to text.
Definition: efi_wrap.c:225

References colour, data, DBGC, efi_reset_type(), efi_status(), efi_systab, len, EFI_RUNTIME_SERVICES::ResetSystem, EFI_SYSTEM_TABLE::RuntimeServices, status, and type.

Referenced by efi_wrap_rs().

◆ efi_wrap_bs()

void efi_wrap_bs ( EFI_BOOT_SERVICES wrapper)

Wrap a boot services table.

Parameters
wrapperBoot services table to wrap

Definition at line 1413 of file efi_wrap.c.

1413  {
1415 
1416  /* Do nothing unless debugging is enabled */
1417  if ( ! DBG_LOG )
1418  return;
1419 
1420  /* Build boot services table wrapper */
1421  memcpy ( wrapper, bs, sizeof ( *wrapper ) );
1422  wrapper->RaiseTPL = efi_raise_tpl_wrapper;
1425  wrapper->FreePages = efi_free_pages_wrapper;
1428  wrapper->FreePool = efi_free_pool_wrapper;
1430  wrapper->SetTimer = efi_set_timer_wrapper;
1435  wrapper->InstallProtocolInterface
1445  wrapper->InstallConfigurationTable
1447  wrapper->LoadImage = efi_load_image_wrapper;
1449  wrapper->Exit = efi_exit_wrapper;
1453  wrapper->Stall = efi_stall_wrapper;
1459  wrapper->OpenProtocolInformation
1469 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
static EFI_STATUS EFIAPI efi_set_timer_wrapper(EFI_EVENT event, EFI_TIMER_DELAY type, UINT64 trigger_time)
Wrap SetTimer()
Definition: efi_wrap.c:476
static VOID EFIAPI efi_restore_tpl_wrapper(EFI_TPL old_tpl)
Wrap RestoreTPL()
Definition: efi_wrap.c:321
EFI_SET_WATCHDOG_TIMER SetWatchdogTimer
Definition: UefiSpec.h:1989
EFI_RAISE_TPL RaiseTPL
Definition: UefiSpec.h:1940
EFI_LOCATE_PROTOCOL LocateProtocol
Definition: UefiSpec.h:2009
EFI_STALL Stall
Definition: UefiSpec.h:1988
static EFI_STATUS EFIAPI efi_reinstall_protocol_interface_wrapper(EFI_HANDLE handle, EFI_GUID *protocol, VOID *old_interface, VOID *new_interface)
Wrap ReinstallProtocolInterface()
Definition: efi_wrap.c:589
static EFI_STATUS EFIAPI efi_locate_handle_wrapper(EFI_LOCATE_SEARCH_TYPE search_type, EFI_GUID *protocol, VOID *search_key, UINTN *buffer_size, EFI_HANDLE *buffer)
Wrap LocateHandle()
Definition: efi_wrap.c:669
static EFI_STATUS EFIAPI efi_register_protocol_notify_wrapper(EFI_GUID *protocol, EFI_EVENT event, VOID **registration)
Wrap RegisterProtocolNotify()
Definition: efi_wrap.c:650
EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface
Definition: UefiSpec.h:1966
EFI_EXIT_BOOT_SERVICES ExitBootServices
Definition: UefiSpec.h:1982
EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface
Definition: UefiSpec.h:1967
EFI_IMAGE_LOAD LoadImage
Definition: UefiSpec.h:1978
static EFI_STATUS EFIAPI efi_close_protocol_wrapper(EFI_HANDLE handle, EFI_GUID *protocol, EFI_HANDLE agent_handle, EFI_HANDLE controller_handle)
Wrap CloseProtocol()
Definition: efi_wrap.c:998
static EFI_STATUS EFIAPI efi_protocols_per_handle_wrapper(EFI_HANDLE handle, EFI_GUID ***protocol_buffer, UINTN *protocol_buffer_count)
Wrap ProtocolsPerHandle()
Definition: efi_wrap.c:1044
static EFI_STATUS EFIAPI efi_handle_protocol_wrapper(EFI_HANDLE handle, EFI_GUID *protocol, VOID **interface)
Wrap HandleProtocol()
Definition: efi_wrap.c:631
EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces
Definition: UefiSpec.h:2010
static EFI_STATUS EFIAPI efi_install_configuration_table_wrapper(EFI_GUID *guid, VOID *table)
Wrap InstallConfigurationTable()
Definition: efi_wrap.c:723
EFI_CLOSE_EVENT CloseEvent
Definition: UefiSpec.h:1959
EFI_SET_TIMER SetTimer
Definition: UefiSpec.h:1956
static EFI_STATUS EFIAPI efi_signal_event_wrapper(EFI_EVENT event)
Wrap SignalEvent()
Definition: efi_wrap.c:520
EFI_LOCATE_HANDLE LocateHandle
Definition: UefiSpec.h:1971
static EFI_STATUS EFIAPI efi_create_event_wrapper(UINT32 type, EFI_TPL notify_tpl, EFI_EVENT_NOTIFY notify_function, VOID *notify_context, EFI_EVENT *event)
Wrap CreateEvent()
Definition: efi_wrap.c:455
EFI_IMAGE_UNLOAD UnloadImage
Definition: UefiSpec.h:1981
static EFI_STATUS EFIAPI efi_get_next_monotonic_count_wrapper(UINT64 *count)
Wrap GetNextMonotonicCount()
Definition: efi_wrap.c:865
EFI_CLOSE_PROTOCOL CloseProtocol
Definition: UefiSpec.h:2001
EFI_CREATE_EVENT_EX CreateEventEx
Definition: UefiSpec.h:2023
static EFI_STATUS EFIAPI efi_create_event_ex_wrapper(UINT32 type, EFI_TPL notify_tpl, EFI_EVENT_NOTIFY notify_function, CONST VOID *notify_context, CONST EFI_GUID *event_group, EFI_EVENT *event)
Wrap CreateEventEx()
Definition: efi_wrap.c:1227
static EFI_STATUS EFIAPI efi_get_memory_map_wrapper(UINTN *memory_map_size, EFI_MEMORY_DESCRIPTOR *memory_map, UINTN *map_key, UINTN *descriptor_size, UINT32 *descriptor_version)
Wrap GetMemoryMap()
Definition: efi_wrap.c:375
void * memcpy(void *dest, const void *src, size_t len) __nonnull
EFI_INSTALL_PROTOCOL_INTERFACE InstallProtocolInterface
Definition: UefiSpec.h:1965
EFI_CREATE_EVENT CreateEvent
Definition: UefiSpec.h:1955
EFI_HANDLE_PROTOCOL HandleProtocol
Definition: UefiSpec.h:1968
EFI_REGISTER_PROTOCOL_NOTIFY RegisterProtocolNotify
Definition: UefiSpec.h:1970
static EFI_STATUS EFIAPI efi_free_pages_wrapper(EFI_PHYSICAL_ADDRESS memory, UINTN pages)
Wrap FreePages()
Definition: efi_wrap.c:357
static EFI_STATUS EFIAPI efi_start_image_wrapper(EFI_HANDLE image_handle, UINTN *exit_data_size, CHAR16 **exit_data)
Wrap StartImage()
Definition: efi_wrap.c:772
EFI_SIGNAL_EVENT SignalEvent
Definition: UefiSpec.h:1958
EFI Boot Services Table.
Definition: UefiSpec.h:1931
static EFI_STATUS EFIAPI efi_set_watchdog_timer_wrapper(UINTN timeout, UINT64 watchdog_code, UINTN data_size, CHAR16 *watchdog_data)
Wrap SetWatchdogTimer()
Definition: efi_wrap.c:900
EFI_GET_NEXT_MONOTONIC_COUNT GetNextMonotonicCount
Definition: UefiSpec.h:1987
static EFI_STATUS EFIAPI efi_install_protocol_interface_wrapper(EFI_HANDLE *handle, EFI_GUID *protocol, EFI_INTERFACE_TYPE interface_type, VOID *interface)
Wrap InstallProtocolInterface()
Definition: efi_wrap.c:567
static EFI_STATUS EFIAPI efi_open_protocol_information_wrapper(EFI_HANDLE handle, EFI_GUID *protocol, EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **entry_buffer, UINTN *entry_count)
Wrap OpenProtocolInformation()
Definition: efi_wrap.c:1021
static EFI_STATUS EFIAPI efi_wait_for_event_wrapper(UINTN number_of_events, EFI_EVENT *event, UINTN *index)
Wrap WaitForEvent()
Definition: efi_wrap.c:496
EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces
Definition: UefiSpec.h:2011
EFI_CONNECT_CONTROLLER ConnectController
Definition: UefiSpec.h:1994
static EFI_STATUS EFIAPI efi_connect_controller_wrapper(EFI_HANDLE controller_handle, EFI_HANDLE *driver_image_handle, EFI_DEVICE_PATH_PROTOCOL *remaining_path, BOOLEAN recursive)
Wrap ConnectController()
Definition: efi_wrap.c:920
static EFI_STATUS EFIAPI efi_locate_protocol_wrapper(EFI_GUID *protocol, VOID *registration, VOID **interface)
Wrap LocateProtocol()
Definition: efi_wrap.c:1105
static EFI_STATUS EFIAPI efi_allocate_pages_wrapper(EFI_ALLOCATE_TYPE type, EFI_MEMORY_TYPE memory_type, UINTN pages, EFI_PHYSICAL_ADDRESS *memory)
Wrap AllocatePages()
Definition: efi_wrap.c:335
EFI_IMAGE_START StartImage
Definition: UefiSpec.h:1979
static EFI_TPL EFIAPI efi_raise_tpl_wrapper(EFI_TPL new_tpl)
Wrap RaiseTPL()
Definition: efi_wrap.c:305
static EFI_STATUS EFIAPI efi_install_multiple_protocol_interfaces_wrapper(EFI_HANDLE *handle,...)
Wrap InstallMultipleProtocolInterfaces()
Definition: efi_wrap.c:1127
static EFI_STATUS EFIAPI efi_unload_image_wrapper(EFI_HANDLE image_handle)
Wrap UnloadImage()
Definition: efi_wrap.c:818
EFI_WAIT_FOR_EVENT WaitForEvent
Definition: UefiSpec.h:1957
EFI_FREE_POOL FreePool
Definition: UefiSpec.h:1950
EFI_OPEN_PROTOCOL_INFORMATION OpenProtocolInformation
Definition: UefiSpec.h:2002
static EFI_STATUS EFIAPI efi_uninstall_protocol_interface_wrapper(EFI_HANDLE handle, EFI_GUID *protocol, VOID *interface)
Wrap UninstallProtocolInterface()
Definition: efi_wrap.c:611
EFI_GET_MEMORY_MAP GetMemoryMap
Definition: UefiSpec.h:1948
EFI_ALLOCATE_PAGES AllocatePages
Definition: UefiSpec.h:1946
static EFI_STATUS EFIAPI efi_allocate_pool_wrapper(EFI_MEMORY_TYPE pool_type, UINTN size, VOID **buffer)
Wrap AllocatePool()
Definition: efi_wrap.c:419
EFI_PROTOCOLS_PER_HANDLE ProtocolsPerHandle
Definition: UefiSpec.h:2007
static EFI_STATUS EFIAPI efi_locate_handle_buffer_wrapper(EFI_LOCATE_SEARCH_TYPE search_type, EFI_GUID *protocol, VOID *search_key, UINTN *no_handles, EFI_HANDLE **buffer)
Wrap LocateHandleBuffer()
Definition: efi_wrap.c:1074
static EFI_STATUS EFIAPI efi_open_protocol_wrapper(EFI_HANDLE handle, EFI_GUID *protocol, VOID **interface, EFI_HANDLE agent_handle, EFI_HANDLE controller_handle, UINT32 attributes)
Wrap OpenProtocol()
Definition: efi_wrap.c:974
EFI_CHECK_EVENT CheckEvent
Definition: UefiSpec.h:1960
static EFI_STATUS EFIAPI efi_close_event_wrapper(EFI_EVENT event)
Wrap CloseEvent()
Definition: efi_wrap.c:536
static EFI_STATUS EFIAPI efi_load_image_wrapper(BOOLEAN boot_policy, EFI_HANDLE parent_image_handle, EFI_DEVICE_PATH_PROTOCOL *device_path, VOID *source_buffer, UINTN source_size, EFI_HANDLE *image_handle)
Wrap LoadImage()
Definition: efi_wrap.c:740
static EFI_STATUS EFIAPI efi_disconnect_controller_wrapper(EFI_HANDLE controller_handle, EFI_HANDLE driver_image_handle, EFI_HANDLE child_handle)
Wrap DisconnectController()
Definition: efi_wrap.c:951
static EFI_STATUS EFIAPI efi_locate_device_path_wrapper(EFI_GUID *protocol, EFI_DEVICE_PATH_PROTOCOL **device_path, EFI_HANDLE *device)
Wrap LocateDevicePath()
Definition: efi_wrap.c:702
static EFI_STATUS EFIAPI efi_exit_boot_services_wrapper(EFI_HANDLE image_handle, UINTN map_key)
Wrap ExitBootServices()
Definition: efi_wrap.c:835
EFI_SYSTEM_TABLE * efi_systab
EFI_OPEN_PROTOCOL OpenProtocol
Definition: UefiSpec.h:2000
static EFI_STATUS EFIAPI efi_exit_wrapper(EFI_HANDLE image_handle, EFI_STATUS exit_status, UINTN exit_data_size, CHAR16 *exit_data)
Wrap Exit()
Definition: efi_wrap.c:794
EFI_RESTORE_TPL RestoreTPL
Definition: UefiSpec.h:1941
static EFI_STATUS EFIAPI efi_stall_wrapper(UINTN microseconds)
Wrap Stall()
Definition: efi_wrap.c:882
static EFI_STATUS EFIAPI efi_uninstall_multiple_protocol_interfaces_wrapper(EFI_HANDLE handle,...)
Wrap UninstallMultipleProtocolInterfaces()
Definition: efi_wrap.c:1177
static EFI_STATUS EFIAPI efi_check_event_wrapper(EFI_EVENT event)
Wrap CheckEvent()
Definition: efi_wrap.c:551
EFI_FREE_PAGES FreePages
Definition: UefiSpec.h:1947
#define DBG_LOG
Definition: compiler.h:317
EFI_LOCATE_HANDLE_BUFFER LocateHandleBuffer
Definition: UefiSpec.h:2008
EFI_INSTALL_CONFIGURATION_TABLE InstallConfigurationTable
Definition: UefiSpec.h:1973
EFI_LOCATE_DEVICE_PATH LocateDevicePath
Definition: UefiSpec.h:1972
static EFI_STATUS EFIAPI efi_free_pool_wrapper(VOID *buffer)
Wrap FreePool()
Definition: efi_wrap.c:439
EFI_ALLOCATE_POOL AllocatePool
Definition: UefiSpec.h:1949
EFI_DISCONNECT_CONTROLLER DisconnectController
Definition: UefiSpec.h:1995

References EFI_BOOT_SERVICES::AllocatePages, EFI_BOOT_SERVICES::AllocatePool, EFI_SYSTEM_TABLE::BootServices, EFI_BOOT_SERVICES::CheckEvent, EFI_BOOT_SERVICES::CloseEvent, EFI_BOOT_SERVICES::CloseProtocol, EFI_BOOT_SERVICES::ConnectController, EFI_BOOT_SERVICES::CreateEvent, EFI_BOOT_SERVICES::CreateEventEx, DBG_LOG, EFI_BOOT_SERVICES::DisconnectController, efi_allocate_pages_wrapper(), efi_allocate_pool_wrapper(), efi_check_event_wrapper(), efi_close_event_wrapper(), efi_close_protocol_wrapper(), efi_connect_controller_wrapper(), efi_create_event_ex_wrapper(), efi_create_event_wrapper(), efi_disconnect_controller_wrapper(), efi_exit_boot_services_wrapper(), efi_exit_wrapper(), efi_free_pages_wrapper(), efi_free_pool_wrapper(), efi_get_memory_map_wrapper(), efi_get_next_monotonic_count_wrapper(), efi_handle_protocol_wrapper(), efi_install_configuration_table_wrapper(), efi_install_multiple_protocol_interfaces_wrapper(), efi_install_protocol_interface_wrapper(), efi_load_image_wrapper(), efi_locate_device_path_wrapper(), efi_locate_handle_buffer_wrapper(), efi_locate_handle_wrapper(), efi_locate_protocol_wrapper(), efi_open_protocol_information_wrapper(), efi_open_protocol_wrapper(), efi_protocols_per_handle_wrapper(), efi_raise_tpl_wrapper(), efi_register_protocol_notify_wrapper(), efi_reinstall_protocol_interface_wrapper(), efi_restore_tpl_wrapper(), efi_set_timer_wrapper(), efi_set_watchdog_timer_wrapper(), efi_signal_event_wrapper(), efi_stall_wrapper(), efi_start_image_wrapper(), efi_systab, efi_uninstall_multiple_protocol_interfaces_wrapper(), efi_uninstall_protocol_interface_wrapper(), efi_unload_image_wrapper(), efi_wait_for_event_wrapper(), EFI_BOOT_SERVICES::Exit, EFI_BOOT_SERVICES::ExitBootServices, EFI_BOOT_SERVICES::FreePages, EFI_BOOT_SERVICES::FreePool, EFI_BOOT_SERVICES::GetMemoryMap, EFI_BOOT_SERVICES::GetNextMonotonicCount, EFI_BOOT_SERVICES::HandleProtocol, EFI_BOOT_SERVICES::InstallConfigurationTable, EFI_BOOT_SERVICES::InstallMultipleProtocolInterfaces, EFI_BOOT_SERVICES::InstallProtocolInterface, EFI_BOOT_SERVICES::LoadImage, EFI_BOOT_SERVICES::LocateDevicePath, EFI_BOOT_SERVICES::LocateHandle, EFI_BOOT_SERVICES::LocateHandleBuffer, EFI_BOOT_SERVICES::LocateProtocol, memcpy(), EFI_BOOT_SERVICES::OpenProtocol, EFI_BOOT_SERVICES::OpenProtocolInformation, EFI_BOOT_SERVICES::ProtocolsPerHandle, EFI_BOOT_SERVICES::RaiseTPL, EFI_BOOT_SERVICES::RegisterProtocolNotify, EFI_BOOT_SERVICES::ReinstallProtocolInterface, EFI_BOOT_SERVICES::RestoreTPL, EFI_BOOT_SERVICES::SetTimer, EFI_BOOT_SERVICES::SetWatchdogTimer, EFI_BOOT_SERVICES::SignalEvent, EFI_BOOT_SERVICES::Stall, EFI_BOOT_SERVICES::StartImage, EFI_BOOT_SERVICES::UninstallMultipleProtocolInterfaces, EFI_BOOT_SERVICES::UninstallProtocolInterface, EFI_BOOT_SERVICES::UnloadImage, and EFI_BOOT_SERVICES::WaitForEvent.

Referenced by efi_wrap_systab().

◆ efi_wrap_rs()

void efi_wrap_rs ( EFI_RUNTIME_SERVICES wrapper)

Wrap a runtime services table.

Parameters
wrapperRuntime services table to wrap

Definition at line 1476 of file efi_wrap.c.

1476  {
1478 
1479  /* Do nothing unless debugging is enabled */
1480  if ( ! DBG_LOG )
1481  return;
1482 
1483  /* Build boot services table wrapper */
1484  memcpy ( wrapper, rs, sizeof ( *wrapper ) );
1485  wrapper->GetTime = efi_get_time_wrapper;
1486  wrapper->SetTime = efi_set_time_wrapper;
1493 }
static EFI_STATUS EFIAPI efi_set_wakeup_time_wrapper(BOOLEAN enable, EFI_TIME *time)
Wrap SetWakeupTime()
Definition: efi_wrap.c:1302
EFI_SET_TIME SetTime
Definition: UefiSpec.h:1890
EFI_GET_WAKEUP_TIME GetWakeupTime
Definition: UefiSpec.h:1891
static EFI_STATUS EFIAPI efi_set_time_wrapper(EFI_TIME *time)
Wrap SetTime()
Definition: efi_wrap.c:1267
static EFI_STATUS EFIAPI efi_get_wakeup_time_wrapper(BOOLEAN *enabled, BOOLEAN *pending, EFI_TIME *time)
Wrap GetWakeupTime()
Definition: efi_wrap.c:1283
static EFI_STATUS EFIAPI efi_get_time_wrapper(EFI_TIME *time, EFI_TIME_CAPABILITIES *cap)
Wrap GetTime()
Definition: efi_wrap.c:1250
void * memcpy(void *dest, const void *src, size_t len) __nonnull
static EFI_STATUS EFIAPI efi_set_variable_wrapper(CHAR16 *name, EFI_GUID *guid, UINT32 attrs, UINTN len, VOID *data)
Wrap SetVariable()
Definition: efi_wrap.c:1371
EFI_SET_VARIABLE SetVariable
Definition: UefiSpec.h:1905
EFI_GET_VARIABLE GetVariable
Definition: UefiSpec.h:1903
EFI Runtime Services Table.
Definition: UefiSpec.h:1880
EFI_RESET_SYSTEM ResetSystem
Definition: UefiSpec.h:1911
EFI_GET_TIME GetTime
Definition: UefiSpec.h:1889
EFI_SET_WAKEUP_TIME SetWakeupTime
Definition: UefiSpec.h:1892
EFI_RUNTIME_SERVICES * RuntimeServices
A pointer to the EFI Runtime Services Table.
Definition: UefiSpec.h:2095
EFI_GET_NEXT_VARIABLE_NAME GetNextVariableName
Definition: UefiSpec.h:1904
static VOID EFIAPI efi_reset_system_wrapper(EFI_RESET_TYPE type, EFI_STATUS status, UINTN len, VOID *data)
Wrap ResetSystem()
Definition: efi_wrap.c:1397
static EFI_STATUS EFIAPI efi_get_variable_wrapper(CHAR16 *name, EFI_GUID *guid, UINT32 *attrs, UINTN *len, VOID *data)
Wrap GetVariable()
Definition: efi_wrap.c:1319
EFI_SYSTEM_TABLE * efi_systab
#define DBG_LOG
Definition: compiler.h:317
static EFI_STATUS EFIAPI efi_get_next_variable_name_wrapper(UINTN *len, CHAR16 *name, EFI_GUID *guid)
Wrap GetNextVariableName()
Definition: efi_wrap.c:1351

References DBG_LOG, efi_get_next_variable_name_wrapper(), efi_get_time_wrapper(), efi_get_variable_wrapper(), efi_get_wakeup_time_wrapper(), efi_reset_system_wrapper(), efi_set_time_wrapper(), efi_set_variable_wrapper(), efi_set_wakeup_time_wrapper(), efi_systab, EFI_RUNTIME_SERVICES::GetNextVariableName, EFI_RUNTIME_SERVICES::GetTime, EFI_RUNTIME_SERVICES::GetVariable, EFI_RUNTIME_SERVICES::GetWakeupTime, memcpy(), EFI_RUNTIME_SERVICES::ResetSystem, EFI_SYSTEM_TABLE::RuntimeServices, EFI_RUNTIME_SERVICES::SetTime, EFI_RUNTIME_SERVICES::SetVariable, and EFI_RUNTIME_SERVICES::SetWakeupTime.

Referenced by efi_wrap_systab().

◆ efi_wrap_systab()

void efi_wrap_systab ( int  global)

Wrap the public EFI system table.

Parameters
globalPatch global boot services table in-place

Definition at line 1500 of file efi_wrap.c.

1500  {
1501  static EFI_BOOT_SERVICES local_bs;
1502  static EFI_RUNTIME_SERVICES local_rs;
1503  EFI_BOOT_SERVICES *bs;
1505 
1506  /* Do nothing unless debugging is enabled */
1507  if ( ! DBG_LOG )
1508  return;
1509 
1510  /* Preserve original system and boot services tables */
1511  if ( ! efi_systab_pub ) {
1515  memcpy ( &efi_bs_copy, efi_bs_orig, sizeof ( efi_bs_copy ) );
1516  memcpy ( &efi_rs_copy, efi_rs_orig, sizeof ( efi_rs_copy ) );
1517  }
1518 
1519  /* Construct and use private system table */
1520  if ( efi_systab != &efi_systab_priv ) {
1522  sizeof ( efi_systab_priv ) );
1526  }
1527 
1528  /* Wrap global or local boot services table as applicable */
1529  bs = ( global ? efi_bs_orig : &local_bs );
1530  rs = ( global ? efi_rs_orig : &local_rs );
1531  efi_wrap_bs ( bs );
1532  efi_wrap_rs ( rs );
1535  DBGC ( colour, "WRAP installed %s wrappers\n",
1536  ( global ? "global" : "local" ) );
1537 }
void efi_wrap_bs(EFI_BOOT_SERVICES *wrapper)
Wrap a boot services table.
Definition: efi_wrap.c:1413
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
static EFI_BOOT_SERVICES efi_bs_copy
Backup of original EFI boot services table.
Definition: efi_wrap.c:60
#define DBGC(...)
Definition: compiler.h:505
void * memcpy(void *dest, const void *src, size_t len) __nonnull
static EFI_RUNTIME_SERVICES efi_rs_copy
Backup of original EFI runtime services table.
Definition: efi_wrap.c:66
void efi_wrap_rs(EFI_RUNTIME_SERVICES *wrapper)
Wrap a runtime services table.
Definition: efi_wrap.c:1476
static EFI_SYSTEM_TABLE efi_systab_priv
Private EFI system table used while wrapping is active.
Definition: efi_wrap.c:54
EFI Runtime Services Table.
Definition: UefiSpec.h:1880
EFI Boot Services Table.
Definition: UefiSpec.h:1931
static EFI_BOOT_SERVICES * efi_bs_orig
Original EFI boot services table pointer.
Definition: efi_wrap.c:57
EFI_RUNTIME_SERVICES * RuntimeServices
A pointer to the EFI Runtime Services Table.
Definition: UefiSpec.h:2095
static EFI_RUNTIME_SERVICES * efi_rs_orig
Original EFI runtime services table pointer.
Definition: efi_wrap.c:63
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42
#define DBG_LOG
Definition: compiler.h:317
static EFI_SYSTEM_TABLE * efi_systab_pub
Public EFI system table pointer.
Definition: efi_wrap.c:51

References EFI_SYSTEM_TABLE::BootServices, colour, DBG_LOG, DBGC, efi_bs_copy, efi_bs_orig, efi_rs_copy, efi_rs_orig, efi_systab, efi_systab_priv, efi_systab_pub, efi_wrap_bs(), efi_wrap_rs(), memcpy(), and EFI_SYSTEM_TABLE::RuntimeServices.

Referenced by efi_wrap_image().

◆ efi_unwrap()

void efi_unwrap ( void  )

Remove boot services table wrapper.

Definition at line 1543 of file efi_wrap.c.

1543  {
1544 
1545  /* Do nothing unless debugging is enabled */
1546  if ( ! DBG_LOG )
1547  return;
1548 
1549  /* Do nothing if wrapping was never enabled */
1550  if ( ! efi_systab_pub )
1551  return;
1552 
1553  /* Restore original system and boot services tables */
1554  memcpy ( efi_bs_orig, &efi_bs_copy, sizeof ( *efi_bs_orig ) );
1556 
1557  /* Switch back to using public system table */
1559  DBGC ( colour, "WRAP uninstalled wrappers\n" );
1560 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
static EFI_BOOT_SERVICES efi_bs_copy
Backup of original EFI boot services table.
Definition: efi_wrap.c:60
#define DBGC(...)
Definition: compiler.h:505
void * memcpy(void *dest, const void *src, size_t len) __nonnull
static EFI_BOOT_SERVICES * efi_bs_orig
Original EFI boot services table pointer.
Definition: efi_wrap.c:57
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:42
#define DBG_LOG
Definition: compiler.h:317
static EFI_SYSTEM_TABLE * efi_systab_pub
Public EFI system table pointer.
Definition: efi_wrap.c:51

References EFI_SYSTEM_TABLE::BootServices, colour, DBG_LOG, DBGC, efi_bs_copy, efi_bs_orig, efi_systab, efi_systab_pub, and memcpy().

Referenced by efi_block_exec(), and efi_image_exec().

◆ efi_wrap_image()

void efi_wrap_image ( EFI_HANDLE  handle)

Wrap calls made by a newly loaded image.

Parameters
handleImage handle

Definition at line 1567 of file efi_wrap.c.

1567  {
1568 
1569  /* Do nothing unless debugging is enabled */
1570  if ( ! DBG_LOG )
1571  return;
1572 
1573  /* Dump image information */
1574  efi_dump_image ( handle );
1575 
1576  /* Patch public system table */
1577  efi_wrap_systab ( 0 );
1578 }
static void efi_dump_image(EFI_HANDLE handle)
Dump information about a loaded image.
Definition: efi_wrap.c:276
void efi_wrap_systab(int global)
Wrap the public EFI system table.
Definition: efi_wrap.c:1500
#define DBG_LOG
Definition: compiler.h:317
uint16_t handle
Handle.
Definition: smbios.h:17

References DBG_LOG, efi_dump_image(), efi_wrap_systab(), and handle.

Referenced by efi_block_exec(), and efi_image_exec().

Variable Documentation

◆ efi_systab_pub

EFI_SYSTEM_TABLE* efi_systab_pub
static

Public EFI system table pointer.

Definition at line 51 of file efi_wrap.c.

Referenced by efi_unwrap(), and efi_wrap_systab().

◆ efi_systab_priv

EFI_SYSTEM_TABLE efi_systab_priv
static

Private EFI system table used while wrapping is active.

Definition at line 54 of file efi_wrap.c.

Referenced by efi_wrap_systab().

◆ efi_bs_orig

EFI_BOOT_SERVICES* efi_bs_orig
static

Original EFI boot services table pointer.

Definition at line 57 of file efi_wrap.c.

Referenced by efi_unwrap(), and efi_wrap_systab().

◆ efi_bs_copy

EFI_BOOT_SERVICES efi_bs_copy
static

Backup of original EFI boot services table.

Definition at line 60 of file efi_wrap.c.

Referenced by efi_unwrap(), and efi_wrap_systab().

◆ efi_rs_orig

EFI_RUNTIME_SERVICES* efi_rs_orig
static

Original EFI runtime services table pointer.

Definition at line 63 of file efi_wrap.c.

Referenced by efi_wrap_systab().

◆ efi_rs_copy

EFI_RUNTIME_SERVICES efi_rs_copy
static

Backup of original EFI runtime services table.

Definition at line 66 of file efi_wrap.c.

Referenced by efi_wrap_systab().