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)
 
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 41 of file efi_wrap.c.

◆ EFI_WRAP_DUMP_MAX

#define EFI_WRAP_DUMP_MAX   128

Maximum size for hex dumps.

Definition at line 44 of file efi_wrap.c.

◆ EFI_WRAP_PRESCROLL

#define EFI_WRAP_PRESCROLL   16

Number of lines to prescroll when needed.

Definition at line 47 of file efi_wrap.c.

◆ MAX_WRAP_MULTI

#define MAX_WRAP_MULTI   20

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

Definition at line 1119 of file efi_wrap.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )

◆ 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 73 of file efi_wrap.c.

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

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 127 of file efi_wrap.c.

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

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 138 of file efi_wrap.c.

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

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 157 of file efi_wrap.c.

157  {
158  static char buf[ 11 /* "0xXXXXXXXX" + NUL */ ];
159 
160  switch ( type ) {
161  case EfiReservedMemoryType: return "Reserved";
162  case EfiLoaderCode: return "LoaderCode";
163  case EfiLoaderData: return "LoaderData";
164  case EfiBootServicesCode: return "BootCode";
165  case EfiBootServicesData: return "BootData";
166  case EfiRuntimeServicesCode: return "RuntimeCode";
167  case EfiRuntimeServicesData: return "RuntimeData";
168  case EfiConventionalMemory: return "Conventional";
169  case EfiUnusableMemory: return "Unusable";
170  case EfiACPIReclaimMemory: return "ACPIReclaim";
171  case EfiACPIMemoryNVS: return "ACPINVS";
172  case EfiMemoryMappedIO: return "MMIO";
173  case EfiMemoryMappedIOPortSpace:return "PIO";
174  case EfiPalCode: return "PalCode";
175  case EfiPersistentMemory: return "Persistent";
176  default:
177  snprintf ( buf, sizeof ( buf ), "%#x", type );
178  return buf;
179  }
180 }
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:382
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 188 of file efi_wrap.c.

188  {
189  static char buf[ 11 /* "0xXXXXXXXX" + NUL */ ];
190 
191  switch ( type ) {
192  case TimerCancel: return "Cancel";
193  case TimerPeriodic: return "Periodic";
194  case TimerRelative: return "Relative";
195  default:
196  snprintf ( buf, sizeof ( buf ), "%#x", type );
197  return buf;
198  }
199 }
An event is to be signaled periodically at a specified interval from the current time.
Definition: UefiSpec.h:547
An event is to be signaled once at a specified interval from the current time.
Definition: UefiSpec.h:551
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:543
int snprintf(char *buf, size_t size, const char *fmt,...)
Write a formatted string to a buffer.
Definition: vsprintf.c:382

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 207 of file efi_wrap.c.

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

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 224 of file efi_wrap.c.

224  {
225  static char buf[ 11 /* "0xXXXXXXXX" + NUL */ ];
226 
227  switch ( type ) {
228  case EfiResetCold: return "Cold";
229  case EfiResetWarm: return "Warm";
230  case EfiResetShutdown: return "Shutdown";
231  case EfiResetPlatformSpecific: return "PlatformSpecific";
232  default:
233  snprintf ( buf, sizeof ( buf ), "%#x", type );
234  return buf;
235  }
236 }
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:382

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 244 of file efi_wrap.c.

244  {
246  UINTN columns;
247  UINTN rows;
248  UINTN space;
249  EFI_STATUS efirc;
250 
251  /* Get number of rows and columns */
252  if ( ( efirc = conout->QueryMode ( conout, conout->Mode->Mode,
253  &columns, &rows ) ) != 0 )
254  return efirc;
255 
256  /* Calculate available space */
257  space = ( rows - conout->Mode->CursorRow - 1 );
258 
259  /* Scroll to create space */
260  while ( space++ < lines )
261  conout->OutputString ( conout, L"\n" );
262 
263  /* Move cursor to start of space */
264  conout->SetCursorPosition ( conout, 0,
265  ( conout->Mode->CursorRow - lines ) );
266 
267  return 0;
268 }
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:2079
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:31
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 275 of file efi_wrap.c.

275  {
277  int rc;
278 
279  /* Open loaded image protocol */
281  &loaded ) ) != 0 ) {
282  DBGC ( colour, "WRAP %s could not get loaded image protocol: "
283  "%s\n", efi_handle_name ( handle ), strerror ( rc ) );
284  return;
285  }
286 
287  /* Dump image information */
288  DBGC ( colour, "WRAP %s at base %p has protocols:\n",
291  DBGC ( colour, "WRAP %s parent", efi_handle_name ( handle ) );
292  DBGC ( colour, " %s\n", efi_handle_name ( loaded->ParentHandle ) );
293  DBGC ( colour, "WRAP %s device", efi_handle_name ( handle ) );
294  DBGC ( colour, " %s\n", efi_handle_name ( loaded->DeviceHandle ) );
295  DBGC ( colour, "WRAP %s file", efi_handle_name ( handle ) );
296  DBGC ( colour, " %s\n", efi_devpath_text ( loaded->FilePath ) );
297 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define DBGC_EFI_PROTOCOLS(...)
Definition: efi.h:348
#define DBGC(...)
Definition: compiler.h:505
EFI_GUID efi_loaded_image_protocol_guid
Loaded image protocol GUID.
Definition: efi_guid.c:272
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:56
VOID * ImageBase
The base address at which the image was loaded.
Definition: LoadedImage.h:69
Can be used on any image handle to obtain information about the loaded image.
Definition: LoadedImage.h:45
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:78
#define efi_open(handle, protocol, interface)
Open protocol for ephemeral use.
Definition: efi.h:443
EFI_LOADED_IMAGE_PROTOCOL * loaded
Loaded image protocol.
Definition: efi_veto.c:68
#define colour
Colour for debug messages.
Definition: efi_wrap.c:41
uint16_t handle
Handle.
Definition: smbios.h:16
EFI_HANDLE ParentHandle
Parent image's image handle.
Definition: LoadedImage.h:48
EFI_HANDLE DeviceHandle
The device handle that the EFI Image was loaded from.
Definition: LoadedImage.h:55

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 304 of file efi_wrap.c.

304  {
306  void *retaddr = __builtin_return_address ( 0 );
307  EFI_TPL old_tpl;
308 
309  DBGCP ( colour, "RaiseTPL ( %s ) ", efi_tpl_name ( new_tpl ) );
310  old_tpl = bs->RaiseTPL ( new_tpl );
311  DBGCP ( colour, "= %s -> %p\n", efi_tpl_name ( old_tpl ), retaddr );
312  return old_tpl;
313 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2098
EFI_RAISE_TPL RaiseTPL
Definition: UefiSpec.h:1939
EFI Boot Services Table.
Definition: UefiSpec.h:1930
UINTN EFI_TPL
Task priority level.
Definition: UefiBaseType.h:43
#define DBGCP(...)
Definition: compiler.h:539
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:41
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 320 of file efi_wrap.c.

320  {
322  void *retaddr = __builtin_return_address ( 0 );
323 
324  DBGCP ( colour, "RestoreTPL ( %s ) ", efi_tpl_name ( old_tpl ) );
325  bs->RestoreTPL ( old_tpl );
326  DBGCP ( colour, "-> %p\n", retaddr );
327 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2098
EFI Boot Services Table.
Definition: UefiSpec.h:1930
#define DBGCP(...)
Definition: compiler.h:539
EFI_SYSTEM_TABLE * efi_systab
EFI_RESTORE_TPL RestoreTPL
Definition: UefiSpec.h:1940
#define colour
Colour for debug messages.
Definition: efi_wrap.c:41
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 334 of file efi_wrap.c.

336  {
338  void *retaddr = __builtin_return_address ( 0 );
339  EFI_STATUS efirc;
340 
341  DBGC2 ( colour, "AllocatePages ( %s, %s, %#llx, %#llx ) ",
342  efi_allocate_type ( type ), efi_memory_type ( memory_type ),
343  ( ( unsigned long long ) pages ),
344  ( ( unsigned long long ) *memory ) );
345  efirc = bs->AllocatePages ( type, memory_type, pages, memory );
346  DBGC2 ( colour, "= %s ( %#llx ) -> %p\n", efi_status ( efirc ),
347  ( ( unsigned long long ) *memory ), retaddr );
348  return efirc;
349 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2098
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:73
uint32_t type
Operating system type.
Definition: ena.h:12
EFI Boot Services Table.
Definition: UefiSpec.h:1930
EFI_ALLOCATE_PAGES AllocatePages
Definition: UefiSpec.h:1945
#define DBGC2(...)
Definition: compiler.h:522
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
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:138
#define colour
Colour for debug messages.
Definition: efi_wrap.c:41
static const char * efi_memory_type(EFI_MEMORY_TYPE type)
Convert EFI memory type to text.
Definition: efi_wrap.c:157

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 356 of file efi_wrap.c.

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

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 374 of file efi_wrap.c.

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

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 418 of file efi_wrap.c.

419  {
421  void *retaddr = __builtin_return_address ( 0 );
422  EFI_STATUS efirc;
423 
424  DBGC2 ( colour, "AllocatePool ( %s, %#llx ) ",
425  efi_memory_type ( pool_type ),
426  ( ( unsigned long long ) size ) );
427  efirc = bs->AllocatePool ( pool_type, size, buffer );
428  DBGC2 ( colour, "= %s ( %p ) -> %p\n",
429  efi_status ( efirc ), *buffer, retaddr );
430  return efirc;
431 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2098
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:73
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:1930
#define DBGC2(...)
Definition: compiler.h:522
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:41
static const char * efi_memory_type(EFI_MEMORY_TYPE type)
Convert EFI memory type to text.
Definition: efi_wrap.c:157
EFI_ALLOCATE_POOL AllocatePool
Definition: UefiSpec.h:1948

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 438 of file efi_wrap.c.

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

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 454 of file efi_wrap.c.

456  {
458  void *retaddr = __builtin_return_address ( 0 );
459  EFI_STATUS efirc;
460 
461  DBGC ( colour, "CreateEvent ( %#x, %s, %p, %p ) ", type,
462  efi_tpl_name ( notify_tpl ), notify_function, notify_context );
463  efirc = bs->CreateEvent ( type, notify_tpl, notify_function,
464  notify_context, event );
465  DBGC ( colour, "= %s ( %p ) -> %p\n",
466  efi_status ( efirc ), *event, retaddr );
467  return efirc;
468 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2098
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:73
uint32_t type
Operating system type.
Definition: ena.h:12
#define DBGC(...)
Definition: compiler.h:505
EFI_CREATE_EVENT CreateEvent
Definition: UefiSpec.h:1954
EFI Boot Services Table.
Definition: UefiSpec.h:1930
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:41
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 475 of file efi_wrap.c.

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

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 495 of file efi_wrap.c.

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

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 519 of file efi_wrap.c.

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

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 535 of file efi_wrap.c.

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

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 550 of file efi_wrap.c.

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

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 566 of file efi_wrap.c.

568  {
570  void *retaddr = __builtin_return_address ( 0 );
571  EFI_STATUS efirc;
572 
573  DBGC ( colour, "InstallProtocolInterface ( %s, %s, %d, %p ) ",
577  interface );
578  DBGC ( colour, "= %s ( %s ) -> %p\n",
579  efi_status ( efirc ), efi_handle_name ( *handle ), retaddr );
580  return efirc;
581 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2098
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:73
#define DBGC(...)
Definition: compiler.h:505
An object interface.
Definition: interface.h:124
EFI_INSTALL_PROTOCOL_INTERFACE InstallProtocolInterface
Definition: UefiSpec.h:1964
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:1930
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_guid.c:725
struct edd_interface_type interface_type
Interface type.
Definition: edd.h:20
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
EFI_SYSTEM_TABLE * efi_systab
uint16_t protocol
Protocol ID.
Definition: stp.h:18
#define colour
Colour for debug messages.
Definition: efi_wrap.c:41
uint16_t handle
Handle.
Definition: smbios.h:16

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 588 of file efi_wrap.c.

591  {
593  void *retaddr = __builtin_return_address ( 0 );
594  EFI_STATUS efirc;
595 
596  DBGC ( colour, "ReinstallProtocolInterface ( %s, %s, %p, %p ) ",
598  old_interface, new_interface );
600  old_interface, new_interface );
601  DBGC ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
602  return efirc;
603 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2098
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:73
EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface
Definition: UefiSpec.h:1965
#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:1930
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_guid.c:725
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
EFI_SYSTEM_TABLE * efi_systab
uint16_t protocol
Protocol ID.
Definition: stp.h:18
#define colour
Colour for debug messages.
Definition: efi_wrap.c:41
uint16_t handle
Handle.
Definition: smbios.h:16

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 610 of file efi_wrap.c.

612  {
614  void *retaddr = __builtin_return_address ( 0 );
615  EFI_STATUS efirc;
616 
617  DBGC ( colour, "UninstallProtocolInterface ( %s, %s, %p ) ",
619  interface );
621  DBGC ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
622  return efirc;
623 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2098
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:73
EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface
Definition: UefiSpec.h:1966
#define DBGC(...)
Definition: compiler.h:505
An object interface.
Definition: interface.h:124
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:1930
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_guid.c:725
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
EFI_SYSTEM_TABLE * efi_systab
uint16_t protocol
Protocol ID.
Definition: stp.h:18
#define colour
Colour for debug messages.
Definition: efi_wrap.c:41
uint16_t handle
Handle.
Definition: smbios.h:16

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 630 of file efi_wrap.c.

631  {
633  void *retaddr = __builtin_return_address ( 0 );
634  EFI_STATUS efirc;
635 
636  DBGC ( colour, "HandleProtocol ( %s, %s ) ",
638  efirc = bs->HandleProtocol ( handle, protocol, interface );
639  DBGC ( colour, "= %s ( %p ) -> %p\n",
640  efi_status ( efirc ), *interface, retaddr );
641  return efirc;
642 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2098
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:73
#define DBGC(...)
Definition: compiler.h:505
An object interface.
Definition: interface.h:124
EFI_HANDLE_PROTOCOL HandleProtocol
Definition: UefiSpec.h:1967
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:1930
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_guid.c:725
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
EFI_SYSTEM_TABLE * efi_systab
uint16_t protocol
Protocol ID.
Definition: stp.h:18
#define colour
Colour for debug messages.
Definition: efi_wrap.c:41
uint16_t handle
Handle.
Definition: smbios.h:16

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 649 of file efi_wrap.c.

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

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 668 of file efi_wrap.c.

670  {
672  void *retaddr = __builtin_return_address ( 0 );
673  unsigned int i;
674  EFI_STATUS efirc;
675 
676  DBGC ( colour, "LocateHandle ( %s, %s, %p, %zd ) ",
677  efi_locate_search_type_name ( search_type ),
678  efi_guid_ntoa ( protocol ), search_key,
679  ( ( size_t ) *buffer_size ) );
680  efirc = bs->LocateHandle ( search_type, protocol, search_key,
681  buffer_size, buffer );
682  DBGC ( colour, "= %s ( %zd", efi_status ( efirc ),
683  ( ( size_t ) *buffer_size ) );
684  if ( efirc == 0 ) {
685  DBGC ( colour, ", {" );
686  for ( i = 0; i < ( *buffer_size / sizeof ( buffer[0] ) ); i++ ){
687  DBGC ( colour, "%s%s", ( i ? ", " : " " ),
688  efi_handle_name ( buffer[i] ) );
689  }
690  DBGC ( colour, " }" );
691  }
692  DBGC ( colour, " ) -> %p\n", retaddr );
693  return efirc;
694 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2098
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:73
#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:1970
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:1930
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_guid.c:725
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
EFI_SYSTEM_TABLE * efi_systab
uint16_t protocol
Protocol ID.
Definition: stp.h:18
#define colour
Colour for debug messages.
Definition: efi_wrap.c:41
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 701 of file efi_wrap.c.

703  {
705  void *retaddr = __builtin_return_address ( 0 );
706  EFI_STATUS efirc;
707 
708  DBGC ( colour, "LocateDevicePath ( %s, %s ) ",
710  efirc = bs->LocateDevicePath ( protocol, device_path, device );
711  DBGC ( colour, "= %s ( %s, ",
712  efi_status ( efirc ), efi_devpath_text ( *device_path ) );
713  DBGC ( colour, "%s ) -> %p\n", efi_handle_name ( *device ), retaddr );
714  return efirc;
715 }
union edd_device_path device_path
Device path.
Definition: edd.h:24
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2098
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:73
#define DBGC(...)
Definition: compiler.h:505
A hardware device.
Definition: device.h:76
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:1930
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_guid.c:725
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
EFI_SYSTEM_TABLE * efi_systab
uint16_t protocol
Protocol ID.
Definition: stp.h:18
#define colour
Colour for debug messages.
Definition: efi_wrap.c:41
EFI_LOCATE_DEVICE_PATH LocateDevicePath
Definition: UefiSpec.h:1971

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 722 of file efi_wrap.c.

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

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 739 of file efi_wrap.c.

742  {
744  void *retaddr = __builtin_return_address ( 0 );
745  EFI_STATUS efirc;
746 
747  DBGC ( colour, "LoadImage ( %s, %s, ", efi_boolean ( boot_policy ),
748  efi_handle_name ( parent_image_handle ) );
749  DBGC ( colour, "%s, %p, %#llx ) ",
750  efi_devpath_text ( device_path ), source_buffer,
751  ( ( unsigned long long ) source_size ) );
752  efirc = bs->LoadImage ( boot_policy, parent_image_handle, device_path,
753  source_buffer, source_size, image_handle );
754  DBGC ( colour, "= %s ( ", efi_status ( efirc ) );
755  if ( efirc == 0 )
756  DBGC ( colour, "%s ", efi_handle_name ( *image_handle ) );
757  DBGC ( colour, ") -> %p\n", retaddr );
758 
759  /* Dump information about loaded image */
760  if ( efirc == 0 )
761  efi_dump_image ( *image_handle );
762 
763  return efirc;
764 }
union edd_device_path device_path
Device path.
Definition: edd.h:24
static const char * efi_boolean(BOOLEAN boolean)
Convert EFI boolean to text.
Definition: efi_wrap.c:127
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2098
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:73
EFI_IMAGE_LOAD LoadImage
Definition: UefiSpec.h:1977
#define DBGC(...)
Definition: compiler.h:505
static void efi_dump_image(EFI_HANDLE handle)
Dump information about a loaded image.
Definition: efi_wrap.c:275
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:1930
static unsigned int source_size
Definition: bigint.h:248
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:41

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 771 of file efi_wrap.c.

772  {
774  void *retaddr = __builtin_return_address ( 0 );
775  EFI_STATUS efirc;
776 
777  DBGC ( colour, "StartImage ( %s ) ", efi_handle_name ( image_handle ) );
778  efirc = bs->StartImage ( image_handle, exit_data_size, exit_data );
779  DBGC ( colour, "= %s", efi_status ( efirc ) );
780  if ( ( efirc != 0 ) && exit_data && *exit_data_size )
781  DBGC ( colour, " ( \"%ls\" )", *exit_data );
782  DBGC ( colour, " -> %p\n", retaddr );
783  if ( ( efirc != 0 ) && exit_data && *exit_data_size )
784  DBGC_HD ( colour, *exit_data, *exit_data_size );
785  return efirc;
786 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2098
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:73
#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:1930
#define DBGC_HD(...)
Definition: compiler.h:507
EFI_IMAGE_START StartImage
Definition: UefiSpec.h:1978
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:41

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 793 of file efi_wrap.c.

794  {
796  void *retaddr = __builtin_return_address ( 0 );
797  EFI_STATUS efirc;
798 
799  if ( ( exit_status != 0 ) && exit_data && exit_data_size )
800  DBGC_HD ( colour, exit_data, exit_data_size );
801  DBGC ( colour, "Exit ( %s, %s",
802  efi_handle_name ( image_handle ), efi_status ( exit_status ) );
803  if ( ( exit_status != 0 ) && exit_data && exit_data_size )
804  DBGC ( colour, ", \"%ls\"", exit_data );
805  DBGC ( colour, " ) " );
806  efirc = bs->Exit ( image_handle, exit_status, exit_data_size,
807  exit_data );
808  DBGC ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
809  return efirc;
810 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2098
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:73
#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:1930
#define DBGC_HD(...)
Definition: compiler.h:507
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:41

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 817 of file efi_wrap.c.

817  {
819  void *retaddr = __builtin_return_address ( 0 );
820  EFI_STATUS efirc;
821 
822  DBGC ( colour, "UnloadImage ( %s ) ",
823  efi_handle_name ( image_handle ) );
824  efirc = bs->UnloadImage ( image_handle );
825  DBGC ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
826  return efirc;
827 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2098
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:73
#define DBGC(...)
Definition: compiler.h:505
EFI_IMAGE_UNLOAD UnloadImage
Definition: UefiSpec.h:1980
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:1930
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:41

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 834 of file efi_wrap.c.

834  {
836  void *retaddr = __builtin_return_address ( 0 );
837  EFI_STATUS efirc;
838 
839  DBGC ( colour, "ExitBootServices ( %s, %#llx ) -> %p\n",
840  efi_handle_name ( image_handle ),
841  ( ( unsigned long long ) map_key ), retaddr );
842  efirc = bs->ExitBootServices ( image_handle, map_key );
843  if ( efirc != 0 ) {
844  DBGC ( colour, "ExitBootServices ( ... ) = %s -> %p\n",
845  efi_status ( efirc ), retaddr );
846  /* On some systems, scrolling the output will cause
847  * the system memory map to change (and so cause
848  * ExitBootServices() to fail).
849  *
850  * After the first failed attempt, prescroll the
851  * screen to maximise the chance of the subsequent
852  * attempt succeeding.
853  */
855  }
856  return efirc;
857 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2098
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:73
EFI_EXIT_BOOT_SERVICES ExitBootServices
Definition: UefiSpec.h:1981
#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:1930
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
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:244
#define colour
Colour for debug messages.
Definition: efi_wrap.c:41
#define EFI_WRAP_PRESCROLL
Number of lines to prescroll when needed.
Definition: efi_wrap.c:47

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 864 of file efi_wrap.c.

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

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 881 of file efi_wrap.c.

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

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 899 of file efi_wrap.c.

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

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 919 of file efi_wrap.c.

922  {
924  void *retaddr = __builtin_return_address ( 0 );
925  EFI_HANDLE *tmp;
926  EFI_STATUS efirc;
927 
928  DBGC ( colour, "ConnectController ( %s, {",
929  efi_handle_name ( controller_handle ) );
930  if ( driver_image_handle ) {
931  for ( tmp = driver_image_handle ; *tmp ; tmp++ ) {
932  DBGC ( colour, "%s%s",
933  ( ( tmp == driver_image_handle ) ? " " : ", " ),
934  efi_handle_name ( *tmp ) );
935  }
936  }
937  DBGC ( colour, " }, %s, %s ) ", efi_devpath_text ( remaining_path ),
938  efi_boolean ( recursive ) );
939  efirc = bs->ConnectController ( controller_handle, driver_image_handle,
940  remaining_path, recursive );
941  DBGC ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
942  return efirc;
943 }
static const char * efi_boolean(BOOLEAN boolean)
Convert EFI boolean to text.
Definition: efi_wrap.c:127
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2098
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:73
#define DBGC(...)
Definition: compiler.h:505
unsigned long tmp
Definition: linux_pci.h:64
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:1930
EFI_CONNECT_CONTROLLER ConnectController
Definition: UefiSpec.h:1993
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:41
Definition: efi.h:61

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 950 of file efi_wrap.c.

952  {
954  void *retaddr = __builtin_return_address ( 0 );
955  EFI_STATUS efirc;
956 
957  DBGC ( colour, "DisconnectController ( %s",
958  efi_handle_name ( controller_handle ) );
959  DBGC ( colour, ", %s", efi_handle_name ( driver_image_handle ) );
960  DBGC ( colour, ", %s ) ", efi_handle_name ( child_handle ) );
961  efirc = bs->DisconnectController ( controller_handle,
962  driver_image_handle,
963  child_handle );
964  DBGC ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
965  return efirc;
966 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2098
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:73
#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:1930
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:41
EFI_DISCONNECT_CONTROLLER DisconnectController
Definition: UefiSpec.h:1994

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 973 of file efi_wrap.c.

975  {
977  void *retaddr = __builtin_return_address ( 0 );
978  EFI_STATUS efirc;
979 
980  DBGC ( colour, "OpenProtocol ( %s, %s, ",
982  DBGC ( colour, "%s, ", efi_handle_name ( agent_handle ) );
983  DBGC ( colour, "%s, %s ) ", efi_handle_name ( controller_handle ),
984  efi_open_attributes_name ( attributes ) );
985  efirc = bs->OpenProtocol ( handle, protocol, interface, agent_handle,
986  controller_handle, attributes );
987  DBGC ( colour, "= %s ( %p ) -> %p\n",
988  efi_status ( efirc ), *interface, retaddr );
989  return efirc;
990 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2098
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:73
#define DBGC(...)
Definition: compiler.h:505
An object interface.
Definition: interface.h:124
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:1930
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_guid.c:725
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
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:1999
uint16_t protocol
Protocol ID.
Definition: stp.h:18
#define colour
Colour for debug messages.
Definition: efi_wrap.c:41
uint16_t handle
Handle.
Definition: smbios.h:16

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 997 of file efi_wrap.c.

999  {
1001  void *retaddr = __builtin_return_address ( 0 );
1002  EFI_STATUS efirc;
1003 
1004  DBGC ( colour, "CloseProtocol ( %s, %s, ",
1006  DBGC ( colour, "%s, ", efi_handle_name ( agent_handle ) );
1007  DBGC ( colour, "%s ) ", efi_handle_name ( controller_handle ) );
1008  efirc = bs->CloseProtocol ( handle, protocol, agent_handle,
1009  controller_handle );
1010  DBGC ( colour, "= %s -> %p\n",
1011  efi_status ( efirc ), retaddr );
1012  return efirc;
1013 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2098
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:73
#define DBGC(...)
Definition: compiler.h:505
EFI_CLOSE_PROTOCOL CloseProtocol
Definition: UefiSpec.h:2000
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:1930
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_guid.c:725
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
EFI_SYSTEM_TABLE * efi_systab
uint16_t protocol
Protocol ID.
Definition: stp.h:18
#define colour
Colour for debug messages.
Definition: efi_wrap.c:41
uint16_t handle
Handle.
Definition: smbios.h:16

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 1020 of file efi_wrap.c.

1023  {
1025  void *retaddr = __builtin_return_address ( 0 );
1026  EFI_STATUS efirc;
1027 
1028  DBGC ( colour, "OpenProtocolInformation ( %s, %s ) ",
1030  efirc = bs->OpenProtocolInformation ( handle, protocol, entry_buffer,
1031  entry_count );
1032  DBGC ( colour, "= %s ( %p, %#llx ) -> %p\n",
1033  efi_status ( efirc ), *entry_buffer,
1034  ( ( unsigned long long ) *entry_count ), retaddr );
1035  return efirc;
1036 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2098
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:73
#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:1930
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_guid.c:725
EFI_OPEN_PROTOCOL_INFORMATION OpenProtocolInformation
Definition: UefiSpec.h:2001
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
EFI_SYSTEM_TABLE * efi_systab
uint16_t protocol
Protocol ID.
Definition: stp.h:18
#define colour
Colour for debug messages.
Definition: efi_wrap.c:41
uint16_t handle
Handle.
Definition: smbios.h:16

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 1043 of file efi_wrap.c.

1045  {
1047  void *retaddr = __builtin_return_address ( 0 );
1048  unsigned int i;
1049  EFI_STATUS efirc;
1050 
1051  DBGC ( colour, "ProtocolsPerHandle ( %s ) ",
1052  efi_handle_name ( handle ) );
1053  efirc = bs->ProtocolsPerHandle ( handle, protocol_buffer,
1054  protocol_buffer_count );
1055  DBGC ( colour, "= %s", efi_status ( efirc ) );
1056  if ( efirc == 0 ) {
1057  DBGC ( colour, " ( {" );
1058  for ( i = 0 ; i < *protocol_buffer_count ; i++ ) {
1059  DBGC ( colour, "%s%s", ( i ? ", " : " " ),
1060  efi_guid_ntoa ( (*protocol_buffer)[i] ) );
1061  }
1062  DBGC ( colour, " } )" );
1063  }
1064  DBGC ( colour, " -> %p\n", retaddr );
1065  return efirc;
1066 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2098
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:73
#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:1930
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_guid.c:725
EFI_PROTOCOLS_PER_HANDLE ProtocolsPerHandle
Definition: UefiSpec.h:2006
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:41
uint16_t handle
Handle.
Definition: smbios.h:16

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 1073 of file efi_wrap.c.

1075  {
1077  void *retaddr = __builtin_return_address ( 0 );
1078  unsigned int i;
1079  EFI_STATUS efirc;
1080 
1081  DBGC ( colour, "LocateHandleBuffer ( %s, %s, %p ) ",
1082  efi_locate_search_type_name ( search_type ),
1083  efi_guid_ntoa ( protocol ), search_key );
1084  efirc = bs->LocateHandleBuffer ( search_type, protocol, search_key,
1085  no_handles, buffer );
1086  DBGC ( colour, "= %s", efi_status ( efirc ) );
1087  if ( efirc == 0 ) {
1088  DBGC ( colour, " ( %d, {", ( ( unsigned int ) *no_handles ) );
1089  for ( i = 0 ; i < *no_handles ; i++ ) {
1090  DBGC ( colour, "%s%s", ( i ? ", " : " " ),
1091  efi_handle_name ( (*buffer)[i] ) );
1092  }
1093  DBGC ( colour, " } )" );
1094  }
1095  DBGC ( colour, " -> %p\n", retaddr );
1096  return efirc;
1097 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2098
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:73
#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:1930
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_guid.c:725
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
EFI_SYSTEM_TABLE * efi_systab
uint16_t protocol
Protocol ID.
Definition: stp.h:18
#define colour
Colour for debug messages.
Definition: efi_wrap.c:41
EFI_LOCATE_HANDLE_BUFFER LocateHandleBuffer
Definition: UefiSpec.h:2007

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 1104 of file efi_wrap.c.

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

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 1126 of file efi_wrap.c.

1126  {
1128  void *retaddr = __builtin_return_address ( 0 );
1131  VA_LIST ap;
1132  unsigned int i;
1133  EFI_STATUS efirc;
1134 
1135  DBGC ( colour, "InstallMultipleProtocolInterfaces ( %s",
1136  efi_handle_name ( *handle ) );
1137  memset ( protocol, 0, sizeof ( protocol ) );
1138  memset ( interface, 0, sizeof ( interface ) );
1139  VA_START ( ap, handle );
1140  for ( i = 0 ; ( protocol[i] = VA_ARG ( ap, EFI_GUID * ) ) ; i++ ) {
1141  if ( i == MAX_WRAP_MULTI ) {
1142  VA_END ( ap );
1143  efirc = EFI_OUT_OF_RESOURCES;
1144  DBGC ( colour, "<FATAL: too many arguments> ) = %s "
1145  "-> %p\n", efi_status ( efirc ), retaddr );
1146  return efirc;
1147  }
1148  interface[i] = VA_ARG ( ap, VOID * );
1149  DBGC ( colour, ", %s, %p",
1150  efi_guid_ntoa ( protocol[i] ), interface[i] );
1151  }
1152  VA_END ( ap );
1153  DBGC ( colour, " ) " );
1155  protocol[0], interface[0], protocol[1], interface[1],
1156  protocol[2], interface[2], protocol[3], interface[3],
1157  protocol[4], interface[4], protocol[5], interface[5],
1158  protocol[6], interface[6], protocol[7], interface[7],
1159  protocol[8], interface[8], protocol[9], interface[9],
1160  protocol[10], interface[10], protocol[11], interface[11],
1161  protocol[12], interface[12], protocol[13], interface[13],
1162  protocol[14], interface[14], protocol[15], interface[15],
1163  protocol[16], interface[16], protocol[17], interface[17],
1164  protocol[18], interface[18], protocol[19], interface[19],
1165  NULL );
1166  DBGC ( colour, "= %s ( %s ) -> %p\n",
1167  efi_status ( efirc ), efi_handle_name ( *handle ), retaddr );
1168  return efirc;
1169 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2098
#define VA_END(Marker)
Terminates the use of a variable argument list.
Definition: Base.h:693
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:73
128 bit buffer containing a unique identifier value.
Definition: Base.h:215
#define DBGC(...)
Definition: compiler.h:505
EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces
Definition: UefiSpec.h:2009
#define EFI_OUT_OF_RESOURCES
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:123
An object interface.
Definition: interface.h:124
#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:681
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:1930
#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:663
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_guid.c:725
#define VOID
Undeclared type.
Definition: Base.h:271
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
EFI_SYSTEM_TABLE * efi_systab
uint16_t protocol
Protocol ID.
Definition: stp.h:18
#define colour
Colour for debug messages.
Definition: efi_wrap.c:41
uint16_t handle
Handle.
Definition: smbios.h:16
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321
#define MAX_WRAP_MULTI
Maximum number of interfaces for wrapped ...MultipleProtocolInterfaces()
Definition: efi_wrap.c:1119
CHAR8 * VA_LIST
Variable used to traverse the list of arguments.
Definition: Base.h:645
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 1176 of file efi_wrap.c.

1176  {
1178  void *retaddr = __builtin_return_address ( 0 );
1181  VA_LIST ap;
1182  unsigned int i;
1183  EFI_STATUS efirc;
1184 
1185  DBGC ( colour, "UninstallMultipleProtocolInterfaces ( %s",
1186  efi_handle_name ( handle ) );
1187  memset ( protocol, 0, sizeof ( protocol ) );
1188  memset ( interface, 0, sizeof ( interface ) );
1189  VA_START ( ap, handle );
1190  for ( i = 0 ; ( protocol[i] = VA_ARG ( ap, EFI_GUID * ) ) ; i++ ) {
1191  if ( i == MAX_WRAP_MULTI ) {
1192  VA_END ( ap );
1193  efirc = EFI_OUT_OF_RESOURCES;
1194  DBGC ( colour, "<FATAL: too many arguments> ) = %s "
1195  "-> %p\n", efi_status ( efirc ), retaddr );
1196  return efirc;
1197  }
1198  interface[i] = VA_ARG ( ap, VOID * );
1199  DBGC ( colour, ", %s, %p",
1200  efi_guid_ntoa ( protocol[i] ), interface[i] );
1201  }
1202  VA_END ( ap );
1203  DBGC ( colour, " ) " );
1205  protocol[0], interface[0], protocol[1], interface[1],
1206  protocol[2], interface[2], protocol[3], interface[3],
1207  protocol[4], interface[4], protocol[5], interface[5],
1208  protocol[6], interface[6], protocol[7], interface[7],
1209  protocol[8], interface[8], protocol[9], interface[9],
1210  protocol[10], interface[10], protocol[11], interface[11],
1211  protocol[12], interface[12], protocol[13], interface[13],
1212  protocol[14], interface[14], protocol[15], interface[15],
1213  protocol[16], interface[16], protocol[17], interface[17],
1214  protocol[18], interface[18], protocol[19], interface[19],
1215  NULL );
1216  DBGC ( colour, "= %s -> %p\n",
1217  efi_status ( efirc ), retaddr );
1218  return efirc;
1219 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2098
#define VA_END(Marker)
Terminates the use of a variable argument list.
Definition: Base.h:693
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:73
128 bit buffer containing a unique identifier value.
Definition: Base.h:215
#define DBGC(...)
Definition: compiler.h:505
#define EFI_OUT_OF_RESOURCES
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:123
An object interface.
Definition: interface.h:124
#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:681
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:1930
EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces
Definition: UefiSpec.h:2010
#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:663
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_guid.c:725
#define VOID
Undeclared type.
Definition: Base.h:271
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
EFI_SYSTEM_TABLE * efi_systab
uint16_t protocol
Protocol ID.
Definition: stp.h:18
#define colour
Colour for debug messages.
Definition: efi_wrap.c:41
uint16_t handle
Handle.
Definition: smbios.h:16
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321
#define MAX_WRAP_MULTI
Maximum number of interfaces for wrapped ...MultipleProtocolInterfaces()
Definition: efi_wrap.c:1119
CHAR8 * VA_LIST
Variable used to traverse the list of arguments.
Definition: Base.h:645
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 1226 of file efi_wrap.c.

1229  {
1231  void *retaddr = __builtin_return_address ( 0 );
1232  EFI_STATUS efirc;
1233 
1234  DBGC ( colour, "CreateEventEx ( %#x, %s, %p, %p, %s ) ",
1235  type, efi_tpl_name ( notify_tpl ), notify_function,
1236  notify_context, efi_guid_ntoa ( event_group ) );
1237  efirc = bs->CreateEventEx ( type, notify_tpl, notify_function,
1238  notify_context, event_group, event );
1239  DBGC ( colour, "= %s ( %p ) -> %p\n",
1240  efi_status ( efirc ), *event, retaddr );
1241  return efirc;
1242 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2098
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:73
uint32_t type
Operating system type.
Definition: ena.h:12
#define DBGC(...)
Definition: compiler.h:505
EFI_CREATE_EVENT_EX CreateEventEx
Definition: UefiSpec.h:2022
EFI Boot Services Table.
Definition: UefiSpec.h:1930
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_guid.c:725
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:41
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 1249 of file efi_wrap.c.

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

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 1266 of file efi_wrap.c.

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

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 1282 of file efi_wrap.c.

1283  {
1285  void *retaddr = __builtin_return_address ( 0 );
1286  EFI_STATUS efirc;
1287 
1288  DBGC ( colour, "GetWakeupTime() " );
1289  efirc = rs->GetWakeupTime ( enabled, pending, time );
1290  DBGC ( colour, "= %s ( %s, %s, %s ) -> %p\n", efi_status ( efirc ),
1292  efi_time ( time ), retaddr );
1293  return efirc;
1294 }
static const char * efi_boolean(BOOLEAN boolean)
Convert EFI boolean to text.
Definition: efi_wrap.c:127
EFI_GET_WAKEUP_TIME GetWakeupTime
Definition: UefiSpec.h:1890
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:73
#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:1879
static const char * efi_time(EFI_TIME *time)
Convert EFI time to text.
Definition: efi_wrap.c:207
EFI_RUNTIME_SERVICES * RuntimeServices
A pointer to the EFI Runtime Services Table.
Definition: UefiSpec.h:2094
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:41

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 1301 of file efi_wrap.c.

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

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 1318 of file efi_wrap.c.

1319  {
1321  void *retaddr = __builtin_return_address ( 0 );
1322  size_t dumplen;
1323  EFI_STATUS efirc;
1324 
1325  DBGC ( colour, "GetVariable ( %s:%ls, %#llx ) ",
1326  efi_guid_ntoa ( guid ), name, ( ( unsigned long long ) *len ) );
1327  efirc = rs->GetVariable ( name, guid, attrs, len, data );
1328  DBGC ( colour, "= %s ( %#llx",
1329  efi_status ( efirc ), ( ( unsigned long long ) *len ) );
1330  if ( DBG_EXTRA && ( efirc == 0 ) ) {
1331  dumplen = *len;
1332  if ( dumplen > EFI_WRAP_DUMP_MAX )
1333  dumplen = EFI_WRAP_DUMP_MAX;
1334  DBGC2 ( colour, ",\n" );
1335  DBGC2_HD ( colour, data, dumplen );
1336  if ( dumplen != *len )
1337  DBGC2 ( colour, "... " );
1338  } else {
1339  DBGC ( colour, " " );
1340  }
1341  DBGC ( colour, ") -> %p\n", retaddr );
1342  return efirc;
1343 }
const char * name
Definition: ath9k_hw.c:1984
#define EFI_WRAP_DUMP_MAX
Maximum size for hex dumps.
Definition: efi_wrap.c:44
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:73
#define DBGC(...)
Definition: compiler.h:505
ring len
Length.
Definition: dwmac.h:231
EFI_GET_VARIABLE GetVariable
Definition: UefiSpec.h:1902
EFI Runtime Services Table.
Definition: UefiSpec.h:1879
#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:725
uint64_t guid
GUID.
Definition: edd.h:30
EFI_RUNTIME_SERVICES * RuntimeServices
A pointer to the EFI Runtime Services Table.
Definition: UefiSpec.h:2094
#define DBGC2(...)
Definition: compiler.h:522
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
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:41

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 1350 of file efi_wrap.c.

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

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 1370 of file efi_wrap.c.

1371  {
1373  void *retaddr = __builtin_return_address ( 0 );
1374  EFI_STATUS efirc;
1375 
1376  DBGC ( colour, "SetVariable ( %s:%ls, %#02x",
1377  efi_guid_ntoa ( guid ), name, attrs );
1378  if ( len ) {
1379  DBGC ( colour, ",\n" );
1380  DBGC_HD ( colour, data, len );
1381  DBGC ( colour, ") " );
1382  } else {
1383  DBGC ( colour, ", %#llx, %p ) ",
1384  ( ( unsigned long long ) len ), data );
1385  }
1386  efirc = rs->SetVariable ( name, guid, attrs, len, data );
1387  DBGC ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
1388  return efirc;
1389 }
const char * name
Definition: ath9k_hw.c:1984
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:73
#define DBGC(...)
Definition: compiler.h:505
ring len
Length.
Definition: dwmac.h:231
EFI_SET_VARIABLE SetVariable
Definition: UefiSpec.h:1904
EFI Runtime Services Table.
Definition: UefiSpec.h:1879
#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:725
uint64_t guid
GUID.
Definition: edd.h:30
EFI_RUNTIME_SERVICES * RuntimeServices
A pointer to the EFI Runtime Services Table.
Definition: UefiSpec.h:2094
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
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:41

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 1396 of file efi_wrap.c.

1397  {
1399  void *retaddr = __builtin_return_address ( 0 );
1400 
1401  DBGC ( colour, "ResetSystem ( %s, %s, %#llx, %p ) -> %p\n",
1403  ( ( unsigned long long ) len ), data, retaddr );
1404  rs->ResetSystem ( type, status, len, data );
1405 }
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:73
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:1879
EFI_RESET_SYSTEM ResetSystem
Definition: UefiSpec.h:1910
uint8_t status
Status.
Definition: ena.h:16
EFI_RUNTIME_SERVICES * RuntimeServices
A pointer to the EFI Runtime Services Table.
Definition: UefiSpec.h:2094
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:41
static const char * efi_reset_type(EFI_RESET_TYPE type)
Convert EFI reset type to text.
Definition: efi_wrap.c:224

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 1412 of file efi_wrap.c.

1412  {
1414 
1415  /* Do nothing unless debugging is enabled */
1416  if ( ! DBG_LOG )
1417  return;
1418 
1419  /* Build boot services table wrapper */
1420  memcpy ( wrapper, bs, sizeof ( *wrapper ) );
1421  wrapper->RaiseTPL = efi_raise_tpl_wrapper;
1424  wrapper->FreePages = efi_free_pages_wrapper;
1427  wrapper->FreePool = efi_free_pool_wrapper;
1429  wrapper->SetTimer = efi_set_timer_wrapper;
1434  wrapper->InstallProtocolInterface
1444  wrapper->InstallConfigurationTable
1446  wrapper->LoadImage = efi_load_image_wrapper;
1448  wrapper->Exit = efi_exit_wrapper;
1452  wrapper->Stall = efi_stall_wrapper;
1458  wrapper->OpenProtocolInformation
1468 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2098
static EFI_STATUS EFIAPI efi_set_timer_wrapper(EFI_EVENT event, EFI_TIMER_DELAY type, UINT64 trigger_time)
Wrap SetTimer()
Definition: efi_wrap.c:475
static VOID EFIAPI efi_restore_tpl_wrapper(EFI_TPL old_tpl)
Wrap RestoreTPL()
Definition: efi_wrap.c:320
EFI_SET_WATCHDOG_TIMER SetWatchdogTimer
Definition: UefiSpec.h:1988
EFI_RAISE_TPL RaiseTPL
Definition: UefiSpec.h:1939
EFI_LOCATE_PROTOCOL LocateProtocol
Definition: UefiSpec.h:2008
EFI_STALL Stall
Definition: UefiSpec.h:1987
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:588
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:668
static EFI_STATUS EFIAPI efi_register_protocol_notify_wrapper(EFI_GUID *protocol, EFI_EVENT event, VOID **registration)
Wrap RegisterProtocolNotify()
Definition: efi_wrap.c:649
EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface
Definition: UefiSpec.h:1965
EFI_EXIT_BOOT_SERVICES ExitBootServices
Definition: UefiSpec.h:1981
EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface
Definition: UefiSpec.h:1966
EFI_IMAGE_LOAD LoadImage
Definition: UefiSpec.h:1977
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:997
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:1043
static EFI_STATUS EFIAPI efi_handle_protocol_wrapper(EFI_HANDLE handle, EFI_GUID *protocol, VOID **interface)
Wrap HandleProtocol()
Definition: efi_wrap.c:630
EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces
Definition: UefiSpec.h:2009
static EFI_STATUS EFIAPI efi_install_configuration_table_wrapper(EFI_GUID *guid, VOID *table)
Wrap InstallConfigurationTable()
Definition: efi_wrap.c:722
EFI_CLOSE_EVENT CloseEvent
Definition: UefiSpec.h:1958
EFI_SET_TIMER SetTimer
Definition: UefiSpec.h:1955
static EFI_STATUS EFIAPI efi_signal_event_wrapper(EFI_EVENT event)
Wrap SignalEvent()
Definition: efi_wrap.c:519
EFI_LOCATE_HANDLE LocateHandle
Definition: UefiSpec.h:1970
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:454
EFI_IMAGE_UNLOAD UnloadImage
Definition: UefiSpec.h:1980
static EFI_STATUS EFIAPI efi_get_next_monotonic_count_wrapper(UINT64 *count)
Wrap GetNextMonotonicCount()
Definition: efi_wrap.c:864
EFI_CLOSE_PROTOCOL CloseProtocol
Definition: UefiSpec.h:2000
EFI_CREATE_EVENT_EX CreateEventEx
Definition: UefiSpec.h:2022
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:1226
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:374
void * memcpy(void *dest, const void *src, size_t len) __nonnull
EFI_INSTALL_PROTOCOL_INTERFACE InstallProtocolInterface
Definition: UefiSpec.h:1964
EFI_CREATE_EVENT CreateEvent
Definition: UefiSpec.h:1954
EFI_HANDLE_PROTOCOL HandleProtocol
Definition: UefiSpec.h:1967
EFI_REGISTER_PROTOCOL_NOTIFY RegisterProtocolNotify
Definition: UefiSpec.h:1969
static EFI_STATUS EFIAPI efi_free_pages_wrapper(EFI_PHYSICAL_ADDRESS memory, UINTN pages)
Wrap FreePages()
Definition: efi_wrap.c:356
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:771
EFI_SIGNAL_EVENT SignalEvent
Definition: UefiSpec.h:1957
EFI Boot Services Table.
Definition: UefiSpec.h:1930
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:899
EFI_GET_NEXT_MONOTONIC_COUNT GetNextMonotonicCount
Definition: UefiSpec.h:1986
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:566
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:1020
static EFI_STATUS EFIAPI efi_wait_for_event_wrapper(UINTN number_of_events, EFI_EVENT *event, UINTN *index)
Wrap WaitForEvent()
Definition: efi_wrap.c:495
EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces
Definition: UefiSpec.h:2010
EFI_CONNECT_CONTROLLER ConnectController
Definition: UefiSpec.h:1993
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:919
static EFI_STATUS EFIAPI efi_locate_protocol_wrapper(EFI_GUID *protocol, VOID *registration, VOID **interface)
Wrap LocateProtocol()
Definition: efi_wrap.c:1104
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:334
EFI_IMAGE_START StartImage
Definition: UefiSpec.h:1978
static EFI_TPL EFIAPI efi_raise_tpl_wrapper(EFI_TPL new_tpl)
Wrap RaiseTPL()
Definition: efi_wrap.c:304
static EFI_STATUS EFIAPI efi_install_multiple_protocol_interfaces_wrapper(EFI_HANDLE *handle,...)
Wrap InstallMultipleProtocolInterfaces()
Definition: efi_wrap.c:1126
static EFI_STATUS EFIAPI efi_unload_image_wrapper(EFI_HANDLE image_handle)
Wrap UnloadImage()
Definition: efi_wrap.c:817
EFI_WAIT_FOR_EVENT WaitForEvent
Definition: UefiSpec.h:1956
EFI_FREE_POOL FreePool
Definition: UefiSpec.h:1949
EFI_OPEN_PROTOCOL_INFORMATION OpenProtocolInformation
Definition: UefiSpec.h:2001
static EFI_STATUS EFIAPI efi_uninstall_protocol_interface_wrapper(EFI_HANDLE handle, EFI_GUID *protocol, VOID *interface)
Wrap UninstallProtocolInterface()
Definition: efi_wrap.c:610
EFI_GET_MEMORY_MAP GetMemoryMap
Definition: UefiSpec.h:1947
EFI_ALLOCATE_PAGES AllocatePages
Definition: UefiSpec.h:1945
static EFI_STATUS EFIAPI efi_allocate_pool_wrapper(EFI_MEMORY_TYPE pool_type, UINTN size, VOID **buffer)
Wrap AllocatePool()
Definition: efi_wrap.c:418
EFI_PROTOCOLS_PER_HANDLE ProtocolsPerHandle
Definition: UefiSpec.h:2006
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:1073
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:973
EFI_CHECK_EVENT CheckEvent
Definition: UefiSpec.h:1959
static EFI_STATUS EFIAPI efi_close_event_wrapper(EFI_EVENT event)
Wrap CloseEvent()
Definition: efi_wrap.c:535
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:739
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:950
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:701
static EFI_STATUS EFIAPI efi_exit_boot_services_wrapper(EFI_HANDLE image_handle, UINTN map_key)
Wrap ExitBootServices()
Definition: efi_wrap.c:834
EFI_SYSTEM_TABLE * efi_systab
EFI_OPEN_PROTOCOL OpenProtocol
Definition: UefiSpec.h:1999
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:793
EFI_RESTORE_TPL RestoreTPL
Definition: UefiSpec.h:1940
static EFI_STATUS EFIAPI efi_stall_wrapper(UINTN microseconds)
Wrap Stall()
Definition: efi_wrap.c:881
static EFI_STATUS EFIAPI efi_uninstall_multiple_protocol_interfaces_wrapper(EFI_HANDLE handle,...)
Wrap UninstallMultipleProtocolInterfaces()
Definition: efi_wrap.c:1176
static EFI_STATUS EFIAPI efi_check_event_wrapper(EFI_EVENT event)
Wrap CheckEvent()
Definition: efi_wrap.c:550
EFI_FREE_PAGES FreePages
Definition: UefiSpec.h:1946
#define DBG_LOG
Definition: compiler.h:317
EFI_LOCATE_HANDLE_BUFFER LocateHandleBuffer
Definition: UefiSpec.h:2007
EFI_INSTALL_CONFIGURATION_TABLE InstallConfigurationTable
Definition: UefiSpec.h:1972
EFI_LOCATE_DEVICE_PATH LocateDevicePath
Definition: UefiSpec.h:1971
static EFI_STATUS EFIAPI efi_free_pool_wrapper(VOID *buffer)
Wrap FreePool()
Definition: efi_wrap.c:438
EFI_ALLOCATE_POOL AllocatePool
Definition: UefiSpec.h:1948
EFI_DISCONNECT_CONTROLLER DisconnectController
Definition: UefiSpec.h:1994

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 1475 of file efi_wrap.c.

1475  {
1477 
1478  /* Do nothing unless debugging is enabled */
1479  if ( ! DBG_LOG )
1480  return;
1481 
1482  /* Build boot services table wrapper */
1483  memcpy ( wrapper, rs, sizeof ( *wrapper ) );
1484  wrapper->GetTime = efi_get_time_wrapper;
1485  wrapper->SetTime = efi_set_time_wrapper;
1492 }
static EFI_STATUS EFIAPI efi_set_wakeup_time_wrapper(BOOLEAN enable, EFI_TIME *time)
Wrap SetWakeupTime()
Definition: efi_wrap.c:1301
EFI_SET_TIME SetTime
Definition: UefiSpec.h:1889
EFI_GET_WAKEUP_TIME GetWakeupTime
Definition: UefiSpec.h:1890
static EFI_STATUS EFIAPI efi_set_time_wrapper(EFI_TIME *time)
Wrap SetTime()
Definition: efi_wrap.c:1266
static EFI_STATUS EFIAPI efi_get_wakeup_time_wrapper(BOOLEAN *enabled, BOOLEAN *pending, EFI_TIME *time)
Wrap GetWakeupTime()
Definition: efi_wrap.c:1282
static EFI_STATUS EFIAPI efi_get_time_wrapper(EFI_TIME *time, EFI_TIME_CAPABILITIES *cap)
Wrap GetTime()
Definition: efi_wrap.c:1249
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:1370
EFI_SET_VARIABLE SetVariable
Definition: UefiSpec.h:1904
EFI_GET_VARIABLE GetVariable
Definition: UefiSpec.h:1902
EFI Runtime Services Table.
Definition: UefiSpec.h:1879
EFI_RESET_SYSTEM ResetSystem
Definition: UefiSpec.h:1910
EFI_GET_TIME GetTime
Definition: UefiSpec.h:1888
EFI_SET_WAKEUP_TIME SetWakeupTime
Definition: UefiSpec.h:1891
EFI_RUNTIME_SERVICES * RuntimeServices
A pointer to the EFI Runtime Services Table.
Definition: UefiSpec.h:2094
EFI_GET_NEXT_VARIABLE_NAME GetNextVariableName
Definition: UefiSpec.h:1903
static VOID EFIAPI efi_reset_system_wrapper(EFI_RESET_TYPE type, EFI_STATUS status, UINTN len, VOID *data)
Wrap ResetSystem()
Definition: efi_wrap.c:1396
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:1318
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:1350

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 1499 of file efi_wrap.c.

1499  {
1500  static EFI_BOOT_SERVICES local_bs;
1501  static EFI_RUNTIME_SERVICES local_rs;
1502  EFI_BOOT_SERVICES *bs;
1504 
1505  /* Do nothing unless debugging is enabled */
1506  if ( ! DBG_LOG )
1507  return;
1508 
1509  /* Preserve original system and boot services tables */
1510  if ( ! efi_systab_pub ) {
1514  memcpy ( &efi_bs_copy, efi_bs_orig, sizeof ( efi_bs_copy ) );
1515  memcpy ( &efi_rs_copy, efi_rs_orig, sizeof ( efi_rs_copy ) );
1516  }
1517 
1518  /* Construct and use private system table */
1519  if ( efi_systab != &efi_systab_priv ) {
1521  sizeof ( efi_systab_priv ) );
1525  }
1526 
1527  /* Wrap global or local boot services table as applicable */
1528  bs = ( global ? efi_bs_orig : &local_bs );
1529  rs = ( global ? efi_rs_orig : &local_rs );
1530  efi_wrap_bs ( bs );
1531  efi_wrap_rs ( rs );
1534  DBGC ( colour, "WRAP installed %s wrappers\n",
1535  ( global ? "global" : "local" ) );
1536 }
void efi_wrap_bs(EFI_BOOT_SERVICES *wrapper)
Wrap a boot services table.
Definition: efi_wrap.c:1412
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2098
static EFI_BOOT_SERVICES efi_bs_copy
Backup of original EFI boot services table.
Definition: efi_wrap.c:59
#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:65
void efi_wrap_rs(EFI_RUNTIME_SERVICES *wrapper)
Wrap a runtime services table.
Definition: efi_wrap.c:1475
static EFI_SYSTEM_TABLE efi_systab_priv
Private EFI system table used while wrapping is active.
Definition: efi_wrap.c:53
EFI Runtime Services Table.
Definition: UefiSpec.h:1879
EFI Boot Services Table.
Definition: UefiSpec.h:1930
static EFI_BOOT_SERVICES * efi_bs_orig
Original EFI boot services table pointer.
Definition: efi_wrap.c:56
EFI_RUNTIME_SERVICES * RuntimeServices
A pointer to the EFI Runtime Services Table.
Definition: UefiSpec.h:2094
static EFI_RUNTIME_SERVICES * efi_rs_orig
Original EFI runtime services table pointer.
Definition: efi_wrap.c:62
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:41
#define DBG_LOG
Definition: compiler.h:317
static EFI_SYSTEM_TABLE * efi_systab_pub
Public EFI system table pointer.
Definition: efi_wrap.c:50

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 1542 of file efi_wrap.c.

1542  {
1543 
1544  /* Do nothing unless debugging is enabled */
1545  if ( ! DBG_LOG )
1546  return;
1547 
1548  /* Do nothing if wrapping was never enabled */
1549  if ( ! efi_systab_pub )
1550  return;
1551 
1552  /* Restore original system and boot services tables */
1553  memcpy ( efi_bs_orig, &efi_bs_copy, sizeof ( *efi_bs_orig ) );
1555 
1556  /* Switch back to using public system table */
1558  DBGC ( colour, "WRAP uninstalled wrappers\n" );
1559 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2098
static EFI_BOOT_SERVICES efi_bs_copy
Backup of original EFI boot services table.
Definition: efi_wrap.c:59
#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:56
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:41
#define DBG_LOG
Definition: compiler.h:317
static EFI_SYSTEM_TABLE * efi_systab_pub
Public EFI system table pointer.
Definition: efi_wrap.c:50

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 1566 of file efi_wrap.c.

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

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 50 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 53 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 56 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 59 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 62 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 65 of file efi_wrap.c.

Referenced by efi_wrap_systab().