iPXE
Macros | Functions
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 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_tpl (EFI_TPL tpl)
 Convert EFI TPL 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 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...
 
EFI_BOOT_SERVICESefi_wrap_bs (void)
 Build boot services table wrapper. More...
 
void efi_wrap (EFI_HANDLE handle)
 Wrap the calls made by a loaded image. 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.

◆ MAX_WRAP_MULTI

#define MAX_WRAP_MULTI   20

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

Definition at line 1050 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 49 of file efi_wrap.c.

49  {
50  static char buf[ 19 /* "0xXXXXXXXXXXXXXXXX" + NUL */ ];
51 
52  switch ( efirc ) {
53  case EFI_SUCCESS : return "0";
54  case EFI_LOAD_ERROR : return "LOAD_ERROR";
55  case EFI_INVALID_PARAMETER : return "INVALID_PARAMETER";
56  case EFI_UNSUPPORTED : return "UNSUPPORTED";
57  case EFI_BAD_BUFFER_SIZE : return "BAD_BUFFER_SIZE";
58  case EFI_BUFFER_TOO_SMALL : return "BUFFER_TOO_SMALL";
59  case EFI_NOT_READY : return "NOT_READY";
60  case EFI_DEVICE_ERROR : return "DEVICE_ERROR";
61  case EFI_WRITE_PROTECTED : return "WRITE_PROTECTED";
62  case EFI_OUT_OF_RESOURCES : return "OUT_OF_RESOURCES";
63  case EFI_VOLUME_CORRUPTED : return "VOLUME_CORRUPTED";
64  case EFI_VOLUME_FULL : return "VOLUME_FULL";
65  case EFI_NO_MEDIA : return "NO_MEDIA";
66  case EFI_MEDIA_CHANGED : return "MEDIA_CHANGED";
67  case EFI_NOT_FOUND : return "NOT_FOUND";
68  case EFI_ACCESS_DENIED : return "ACCESS_DENIED";
69  case EFI_NO_RESPONSE : return "NO_RESPONSE";
70  case EFI_NO_MAPPING : return "NO_MAPPING";
71  case EFI_TIMEOUT : return "TIMEOUT";
72  case EFI_NOT_STARTED : return "NOT_STARTED";
73  case EFI_ALREADY_STARTED : return "ALREADY_STARTED";
74  case EFI_ABORTED : return "ABORTED";
75  case EFI_ICMP_ERROR : return "ICMP_ERROR";
76  case EFI_TFTP_ERROR : return "TFTP_ERROR";
77  case EFI_PROTOCOL_ERROR : return "PROTOCOL_ERROR";
78  case EFI_INCOMPATIBLE_VERSION : return "INCOMPATIBLE_VERSION";
79  case EFI_SECURITY_VIOLATION : return "SECURITY_VIOLATION";
80  case EFI_CRC_ERROR : return "CRC_ERROR";
81  case EFI_END_OF_MEDIA : return "END_OF_MEDIA";
82  case EFI_END_OF_FILE : return "END_OF_FILE";
83  case EFI_INVALID_LANGUAGE : return "INVALID_LANGUAGE";
84  case EFI_COMPROMISED_DATA : return "COMPROMISED_DATA";
85  case EFI_WARN_UNKNOWN_GLYPH : return "WARN_UNKNOWN_GLYPH";
86  case EFI_WARN_DELETE_FAILURE : return "WARN_DELETE_FAILURE";
87  case EFI_WARN_WRITE_FAILURE : return "WARN_WRITE_FAILURE";
88  case EFI_WARN_BUFFER_TOO_SMALL : return "WARN_BUFFER_TOO_SMALL";
89  case EFI_WARN_STALE_DATA : return "WARN_STALE_DATA";
90  default:
91  snprintf ( buf, sizeof ( buf ), "%#lx",
92  ( unsigned long ) efirc );
93  return buf;
94  }
95 }
#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_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_set_timer_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 103 of file efi_wrap.c.

103  {
104 
105  return ( boolean ? "TRUE" : "FALSE" );
106 }

Referenced by efi_connect_controller_wrapper(), and efi_load_image_wrapper().

◆ efi_tpl()

static const char* efi_tpl ( EFI_TPL  tpl)
static

Convert EFI TPL to text.

Parameters
tplTask priority level
Return values
textTask priority level as text

Definition at line 114 of file efi_wrap.c.

114  {
115  static char buf[ 19 /* "0xXXXXXXXXXXXXXXXX" + NUL */ ];
116 
117  switch ( tpl ) {
118  case TPL_APPLICATION: return "Application";
119  case TPL_CALLBACK: return "Callback";
120  case TPL_NOTIFY: return "Notify";
121  case TPL_HIGH_LEVEL: return "HighLevel";
122  default:
123  snprintf ( buf, sizeof ( buf ), "%#lx",
124  ( unsigned long ) tpl );
125  return buf;
126  }
127 }
#define TPL_APPLICATION
Definition: UefiSpec.h:637
#define TPL_NOTIFY
Definition: UefiSpec.h:639
#define TPL_CALLBACK
Definition: UefiSpec.h:638
#define TPL_HIGH_LEVEL
Definition: UefiSpec.h:640
int snprintf(char *buf, size_t size, const char *fmt,...)
Write a formatted string to a buffer.
Definition: vsprintf.c:382

References snprintf(), TPL_APPLICATION, TPL_CALLBACK, TPL_HIGH_LEVEL, and TPL_NOTIFY.

Referenced by efi_create_event_ex_wrapper(), efi_create_event_wrapper(), efi_raise_tpl_wrapper(), and efi_restore_tpl_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 135 of file efi_wrap.c.

135  {
136  static char buf[ 11 /* "0xXXXXXXXX" + NUL */ ];
137 
138  switch ( type ) {
139  case AllocateAnyPages: return "AnyPages";
140  case AllocateMaxAddress: return "MaxAddress";
141  case AllocateAddress: return "Address";
142  default:
143  snprintf ( buf, sizeof ( buf ), "%#x", type );
144  return buf;
145  }
146 }
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
uint32_t type
Operating system type.
Definition: ena.h:12
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 154 of file efi_wrap.c.

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

185  {
186  static char buf[ 11 /* "0xXXXXXXXX" + NUL */ ];
187 
188  switch ( type ) {
189  case TimerCancel: return "Cancel";
190  case TimerPeriodic: return "Periodic";
191  case TimerRelative: return "Relative";
192  default:
193  snprintf ( buf, sizeof ( buf ), "%#x", type );
194  return buf;
195  }
196 }
An event is to be signaled periodically at a specified interval from the current time.
Definition: UefiSpec.h:537
An event is to be signaled once at a specified interval from the current time.
Definition: UefiSpec.h:541
An event's timer settings is to be cancelled and not trigger time is to be set/.
Definition: UefiSpec.h:533
uint32_t type
Operating system type.
Definition: ena.h:12
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_dump_image()

static void efi_dump_image ( EFI_HANDLE  handle)
static

Dump information about a loaded image.

Parameters
handleImage handle

Definition at line 203 of file efi_wrap.c.

203  {
205  union {
207  void *intf;
208  } loaded;
209  EFI_STATUS efirc;
210  int rc;
211 
212  /* Open loaded image protocol */
213  if ( ( efirc = bs->OpenProtocol ( handle,
215  &loaded.intf, efi_image_handle, NULL,
217  rc = -EEFI ( efirc );
218  DBGC ( colour, "WRAP %s could not get loaded image protocol: "
219  "%s\n", efi_handle_name ( handle ), strerror ( rc ) );
220  return;
221  }
222 
223  /* Dump image information */
224  DBGC ( colour, "WRAP %s at base %p has protocols:\n",
225  efi_handle_name ( handle ), loaded.image->ImageBase );
227  DBGC ( colour, "WRAP %s parent", efi_handle_name ( handle ) );
228  DBGC ( colour, " %s\n", efi_handle_name ( loaded.image->ParentHandle ));
229  DBGC ( colour, "WRAP %s device", efi_handle_name ( handle ) );
230  DBGC ( colour, " %s\n", efi_handle_name ( loaded.image->DeviceHandle ));
231  DBGC ( colour, "WRAP %s file", efi_handle_name ( handle ) );
232  DBGC ( colour, " %s\n", efi_devpath_text ( loaded.image->FilePath ) );
233 
234  /* Close loaded image protocol */
237 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
Definition: efi.h:171
EFI_HANDLE image
Image handle.
Definition: efi_veto.c:67
#define DBGC_EFI_PROTOCOLS(...)
Definition: efi.h:325
#define DBGC(...)
Definition: compiler.h:505
EFI_GUID efi_loaded_image_protocol_guid
Loaded image protocol GUID.
Definition: efi_guid.c:243
EFI_CLOSE_PROTOCOL CloseProtocol
Definition: UefiSpec.h:1987
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:461
#define EFI_OPEN_PROTOCOL_GET_PROTOCOL
Definition: UefiSpec.h:1344
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:808
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
EFI Boot Services Table.
Definition: UefiSpec.h:1917
EFI_HANDLE efi_image_handle
Image handle passed to entry point.
Definition: efi_init.c:34
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
EFI_SYSTEM_TABLE * efi_systab
EFI_OPEN_PROTOCOL OpenProtocol
Definition: UefiSpec.h:1986
#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

References EFI_SYSTEM_TABLE::BootServices, EFI_BOOT_SERVICES::CloseProtocol, colour, DBGC, DBGC_EFI_PROTOCOLS, EEFI, efi_devpath_text(), efi_handle_name(), efi_image_handle, efi_loaded_image_protocol_guid, EFI_OPEN_PROTOCOL_GET_PROTOCOL, efi_systab, handle, NULL, EFI_BOOT_SERVICES::OpenProtocol, rc, and strerror().

Referenced by efi_load_image_wrapper(), and efi_wrap().

◆ efi_raise_tpl_wrapper()

static EFI_TPL EFIAPI efi_raise_tpl_wrapper ( EFI_TPL  new_tpl)
static

Wrap RaiseTPL()

Definition at line 244 of file efi_wrap.c.

244  {
246  void *retaddr = __builtin_return_address ( 0 );
247  EFI_TPL old_tpl;
248 
249  DBGCP ( colour, "RaiseTPL ( %s ) ", efi_tpl ( new_tpl ) );
250  old_tpl = bs->RaiseTPL ( new_tpl );
251  DBGCP ( colour, "= %s -> %p\n", efi_tpl ( old_tpl ), retaddr );
252  return old_tpl;
253 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
EFI_RAISE_TPL RaiseTPL
Definition: UefiSpec.h:1926
EFI Boot Services Table.
Definition: UefiSpec.h:1917
UINTN EFI_TPL
Task priority level.
Definition: UefiBaseType.h:43
static const char * efi_tpl(EFI_TPL tpl)
Convert EFI TPL to text.
Definition: efi_wrap.c:114
#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_systab, efi_tpl(), 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 260 of file efi_wrap.c.

260  {
262  void *retaddr = __builtin_return_address ( 0 );
263 
264  DBGCP ( colour, "RestoreTPL ( %s ) ", efi_tpl ( old_tpl ) );
265  bs->RestoreTPL ( old_tpl );
266  DBGCP ( colour, "-> %p\n", retaddr );
267 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
EFI Boot Services Table.
Definition: UefiSpec.h:1917
static const char * efi_tpl(EFI_TPL tpl)
Convert EFI TPL to text.
Definition: efi_wrap.c:114
#define DBGCP(...)
Definition: compiler.h:539
EFI_SYSTEM_TABLE * efi_systab
EFI_RESTORE_TPL RestoreTPL
Definition: UefiSpec.h:1927
#define colour
Colour for debug messages.
Definition: efi_wrap.c:41

References EFI_SYSTEM_TABLE::BootServices, colour, DBGCP, efi_systab, efi_tpl(), 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 274 of file efi_wrap.c.

276  {
278  void *retaddr = __builtin_return_address ( 0 );
279  EFI_STATUS efirc;
280 
281  DBGC2 ( colour, "AllocatePages ( %s, %s, %#llx, %#llx ) ",
282  efi_allocate_type ( type ), efi_memory_type ( memory_type ),
283  ( ( unsigned long long ) pages ),
284  ( ( unsigned long long ) *memory ) );
285  efirc = bs->AllocatePages ( type, memory_type, pages, memory );
286  DBGC2 ( colour, "= %s ( %#llx ) -> %p\n", efi_status ( efirc ),
287  ( ( unsigned long long ) *memory ), retaddr );
288  return efirc;
289 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:49
EFI Boot Services Table.
Definition: UefiSpec.h:1917
EFI_ALLOCATE_PAGES AllocatePages
Definition: UefiSpec.h:1932
uint32_t type
Operating system type.
Definition: ena.h:12
#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:135
#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:154

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

296  {
298  void *retaddr = __builtin_return_address ( 0 );
299  EFI_STATUS efirc;
300 
301  DBGC2 ( colour, "FreePages ( %#llx, %#llx ) ",
302  ( ( unsigned long long ) memory ),
303  ( ( unsigned long long ) pages ) );
304  efirc = bs->FreePages ( memory, pages );
305  DBGC2 ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
306  return efirc;
307 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:49
EFI Boot Services Table.
Definition: UefiSpec.h:1917
#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:1933

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

317  {
319  void *retaddr = __builtin_return_address ( 0 );
321  size_t remaining;
322  EFI_STATUS efirc;
323 
324  DBGC ( colour, "GetMemoryMap ( %#llx, %p ) ",
325  ( ( unsigned long long ) *memory_map_size ), memory_map );
326  efirc = bs->GetMemoryMap ( memory_map_size, memory_map, map_key,
327  descriptor_size, descriptor_version );
328  DBGC ( colour, "= %s ( %#llx, %#llx, %#llx, v%d",
329  efi_status ( efirc ),
330  ( ( unsigned long long ) *memory_map_size ),
331  ( ( unsigned long long ) *map_key ),
332  ( ( unsigned long long ) *descriptor_size ),
333  *descriptor_version );
334  if ( DBG_EXTRA && ( efirc == 0 ) ) {
335  DBGC2 ( colour, ",\n" );
336  for ( desc = memory_map, remaining = *memory_map_size ;
337  remaining >= *descriptor_size ;
338  desc = ( ( ( void * ) desc ) + *descriptor_size ),
339  remaining -= *descriptor_size ) {
340  DBGC2 ( colour, "%#016llx+%#08llx %#016llx "
341  "%s\n", desc->PhysicalStart,
342  ( desc->NumberOfPages * EFI_PAGE_SIZE ),
343  desc->Attribute,
344  efi_memory_type ( desc->Type ) );
345  }
346  } else {
347  DBGC ( colour, " " );
348  }
349  DBGC ( colour, ") -> %p\n", retaddr );
350  return efirc;
351 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
#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:49
Definition of an EFI memory descriptor.
Definition: UefiSpec.h:145
uint64_t desc
Microcode descriptor list physical address.
Definition: ucode.h:12
#define DBGC(...)
Definition: compiler.h:505
A memory map.
Definition: io.h:499
EFI Boot Services Table.
Definition: UefiSpec.h:1917
EFI_GET_MEMORY_MAP GetMemoryMap
Definition: UefiSpec.h:1934
#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:154

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

359  {
361  void *retaddr = __builtin_return_address ( 0 );
362  EFI_STATUS efirc;
363 
364  DBGC2 ( colour, "AllocatePool ( %s, %#llx ) ",
365  efi_memory_type ( pool_type ),
366  ( ( unsigned long long ) size ) );
367  efirc = bs->AllocatePool ( pool_type, size, buffer );
368  DBGC2 ( colour, "= %s ( %p ) -> %p\n",
369  efi_status ( efirc ), *buffer, retaddr );
370  return efirc;
371 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:49
uint32_t buffer
Buffer index (or NETVSC_RNDIS_NO_BUFFER)
Definition: netvsc.h:16
EFI Boot Services Table.
Definition: UefiSpec.h:1917
#define DBGC2(...)
Definition: compiler.h:522
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
uint8_t size
Entry size (in 32-bit words)
Definition: ena.h:16
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:154
EFI_ALLOCATE_POOL AllocatePool
Definition: UefiSpec.h:1935

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

378  {
380  void *retaddr = __builtin_return_address ( 0 );
381  EFI_STATUS efirc;
382 
383  DBGC2 ( colour, "FreePool ( %p ) ", buffer );
384  efirc = bs->FreePool ( buffer );
385  DBGC2 ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
386  return efirc;
387 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:49
uint32_t buffer
Buffer index (or NETVSC_RNDIS_NO_BUFFER)
Definition: netvsc.h:16
EFI Boot Services Table.
Definition: UefiSpec.h:1917
EFI_FREE_POOL FreePool
Definition: UefiSpec.h:1936
#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 394 of file efi_wrap.c.

396  {
398  void *retaddr = __builtin_return_address ( 0 );
399  EFI_STATUS efirc;
400 
401  DBGC ( colour, "CreateEvent ( %#x, %s, %p, %p ) ",
402  type, efi_tpl ( notify_tpl ), notify_function, notify_context );
403  efirc = bs->CreateEvent ( type, notify_tpl, notify_function,
404  notify_context, event );
405  DBGC ( colour, "= %s ( %p ) -> %p\n",
406  efi_status ( efirc ), *event, retaddr );
407  return efirc;
408 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:49
#define DBGC(...)
Definition: compiler.h:505
EFI_CREATE_EVENT CreateEvent
Definition: UefiSpec.h:1941
EFI Boot Services Table.
Definition: UefiSpec.h:1917
uint32_t type
Operating system type.
Definition: ena.h:12
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
static const char * efi_tpl(EFI_TPL tpl)
Convert EFI TPL to text.
Definition: efi_wrap.c:114
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:41

References EFI_SYSTEM_TABLE::BootServices, colour, EFI_BOOT_SERVICES::CreateEvent, DBGC, efi_status(), efi_systab, efi_tpl(), 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 415 of file efi_wrap.c.

416  {
418  void *retaddr = __builtin_return_address ( 0 );
419  EFI_STATUS efirc;
420 
421  DBGC ( colour, "SetTimer ( %p, %s, %ld.%07ld00s ) ",
422  event, efi_timer_delay ( type ),
423  ( ( unsigned long ) ( trigger_time / 10000000 ) ),
424  ( ( unsigned long ) ( trigger_time % 10000000 ) ) );
425  efirc = bs->SetTimer ( event, type, trigger_time );
426  DBGC ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
427  return efirc;
428 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:49
#define DBGC(...)
Definition: compiler.h:505
EFI_SET_TIMER SetTimer
Definition: UefiSpec.h:1942
EFI Boot Services Table.
Definition: UefiSpec.h:1917
uint32_t type
Operating system type.
Definition: ena.h:12
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:185
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 435 of file efi_wrap.c.

436  {
438  void *retaddr = __builtin_return_address ( 0 );
439  unsigned int i;
440  EFI_STATUS efirc;
441 
442  DBGC ( colour, "WaitForEvent (" );
443  for ( i = 0 ; i < number_of_events ; i++ )
444  DBGC ( colour, " %p", event[i] );
445  DBGC ( colour, " ) " );
446  efirc = bs->WaitForEvent ( number_of_events, event, index );
447  DBGC ( colour, "= %s", efi_status ( efirc ) );
448  if ( efirc == 0 )
449  DBGC ( colour, " ( %p )", event[*index] );
450  DBGC ( colour, " -> %p\n", retaddr );
451  return efirc;
452 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:49
#define DBGC(...)
Definition: compiler.h:505
EFI Boot Services Table.
Definition: UefiSpec.h:1917
EFI_WAIT_FOR_EVENT WaitForEvent
Definition: UefiSpec.h:1943
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
EFI_SYSTEM_TABLE * efi_systab
uint64_t index
Index of the first segment within the content.
Definition: pccrc.h:21
#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 459 of file efi_wrap.c.

459  {
461  void *retaddr = __builtin_return_address ( 0 );
462  EFI_STATUS efirc;
463 
464  DBGC2 ( colour, "SignalEvent ( %p ) ", event );
465  efirc = bs->SignalEvent ( event );
466  DBGC2 ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
467  return efirc;
468 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:49
EFI_SIGNAL_EVENT SignalEvent
Definition: UefiSpec.h:1944
EFI Boot Services Table.
Definition: UefiSpec.h:1917
#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 475 of file efi_wrap.c.

475  {
477  void *retaddr = __builtin_return_address ( 0 );
478  EFI_STATUS efirc;
479 
480  DBGC ( colour, "CloseEvent ( %p ) ", event );
481  efirc = bs->SignalEvent ( event );
482  DBGC ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
483  return efirc;
484 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:49
#define DBGC(...)
Definition: compiler.h:505
EFI_SIGNAL_EVENT SignalEvent
Definition: UefiSpec.h:1944
EFI Boot Services Table.
Definition: UefiSpec.h:1917
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, and EFI_BOOT_SERVICES::SignalEvent.

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

490  {
492  void *retaddr = __builtin_return_address ( 0 );
493  EFI_STATUS efirc;
494 
495  DBGCP ( colour, "CheckEvent ( %p ) ", event );
496  efirc = bs->SignalEvent ( event );
497  DBGCP ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
498  return efirc;
499 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:49
EFI_SIGNAL_EVENT SignalEvent
Definition: UefiSpec.h:1944
EFI Boot Services Table.
Definition: UefiSpec.h:1917
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::SignalEvent.

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

508  {
510  void *retaddr = __builtin_return_address ( 0 );
511  EFI_STATUS efirc;
512 
513  DBGC ( colour, "InstallProtocolInterface ( %s, %s, %d, %p ) ",
517  interface );
518  DBGC ( colour, "= %s ( %s ) -> %p\n",
519  efi_status ( efirc ), efi_handle_name ( *handle ), retaddr );
520  return efirc;
521 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:49
#define DBGC(...)
Definition: compiler.h:505
An object interface.
Definition: interface.h:124
EFI_INSTALL_PROTOCOL_INTERFACE InstallProtocolInterface
Definition: UefiSpec.h:1951
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:808
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_debug.c:254
EFI Boot Services Table.
Definition: UefiSpec.h:1917
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 528 of file efi_wrap.c.

531  {
533  void *retaddr = __builtin_return_address ( 0 );
534  EFI_STATUS efirc;
535 
536  DBGC ( colour, "ReinstallProtocolInterface ( %s, %s, %p, %p ) ",
538  old_interface, new_interface );
540  old_interface, new_interface );
541  DBGC ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
542  return efirc;
543 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:49
EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface
Definition: UefiSpec.h:1952
#define DBGC(...)
Definition: compiler.h:505
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:808
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_debug.c:254
EFI Boot Services Table.
Definition: UefiSpec.h:1917
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 550 of file efi_wrap.c.

552  {
554  void *retaddr = __builtin_return_address ( 0 );
555  EFI_STATUS efirc;
556 
557  DBGC ( colour, "UninstallProtocolInterface ( %s, %s, %p ) ",
559  interface );
561  DBGC ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
562  return efirc;
563 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:49
EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface
Definition: UefiSpec.h:1953
#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:808
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_debug.c:254
EFI Boot Services Table.
Definition: UefiSpec.h:1917
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 570 of file efi_wrap.c.

571  {
573  void *retaddr = __builtin_return_address ( 0 );
574  EFI_STATUS efirc;
575 
576  DBGC ( colour, "HandleProtocol ( %s, %s ) ",
578  efirc = bs->HandleProtocol ( handle, protocol, interface );
579  DBGC ( colour, "= %s ( %p ) -> %p\n",
580  efi_status ( efirc ), *interface, retaddr );
581  return efirc;
582 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:49
#define DBGC(...)
Definition: compiler.h:505
An object interface.
Definition: interface.h:124
EFI_HANDLE_PROTOCOL HandleProtocol
Definition: UefiSpec.h:1954
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:808
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_debug.c:254
EFI Boot Services Table.
Definition: UefiSpec.h:1917
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 589 of file efi_wrap.c.

590  {
592  void *retaddr = __builtin_return_address ( 0 );
593  EFI_STATUS efirc;
594 
595  DBGC ( colour, "RegisterProtocolNotify ( %s, %p ) ",
596  efi_guid_ntoa ( protocol ), event );
597  efirc = bs->RegisterProtocolNotify ( protocol, event, registration );
598  DBGC ( colour, "= %s ( %p ) -> %p\n",
599  efi_status ( efirc ), *registration, retaddr );
600  return efirc;
601 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:49
#define DBGC(...)
Definition: compiler.h:505
EFI_REGISTER_PROTOCOL_NOTIFY RegisterProtocolNotify
Definition: UefiSpec.h:1956
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_debug.c:254
EFI Boot Services Table.
Definition: UefiSpec.h:1917
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 608 of file efi_wrap.c.

610  {
612  void *retaddr = __builtin_return_address ( 0 );
613  unsigned int i;
614  EFI_STATUS efirc;
615 
616  DBGC ( colour, "LocateHandle ( %s, %s, %p, %zd ) ",
617  efi_locate_search_type_name ( search_type ),
618  efi_guid_ntoa ( protocol ), search_key,
619  ( ( size_t ) *buffer_size ) );
620  efirc = bs->LocateHandle ( search_type, protocol, search_key,
621  buffer_size, buffer );
622  DBGC ( colour, "= %s ( %zd", efi_status ( efirc ),
623  ( ( size_t ) *buffer_size ) );
624  if ( efirc == 0 ) {
625  DBGC ( colour, ", {" );
626  for ( i = 0; i < ( *buffer_size / sizeof ( buffer[0] ) ); i++ ){
627  DBGC ( colour, "%s%s", ( i ? ", " : " " ),
628  efi_handle_name ( buffer[i] ) );
629  }
630  DBGC ( colour, " }" );
631  }
632  DBGC ( colour, " ) -> %p\n", retaddr );
633  return efirc;
634 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:49
#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:1957
const char * efi_locate_search_type_name(EFI_LOCATE_SEARCH_TYPE search_type)
Name locate search type.
Definition: efi_debug.c:287
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:808
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_debug.c:254
EFI Boot Services Table.
Definition: UefiSpec.h:1917
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 641 of file efi_wrap.c.

643  {
645  void *retaddr = __builtin_return_address ( 0 );
646  EFI_STATUS efirc;
647 
648  DBGC ( colour, "LocateDevicePath ( %s, %s ) ",
650  efirc = bs->LocateDevicePath ( protocol, device_path, device );
651  DBGC ( colour, "= %s ( %s, ",
652  efi_status ( efirc ), efi_devpath_text ( *device_path ) );
653  DBGC ( colour, "%s ) -> %p\n", efi_handle_name ( *device ), retaddr );
654  return efirc;
655 }
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:2081
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:49
#define DBGC(...)
Definition: compiler.h:505
A hardware device.
Definition: device.h:73
const char * efi_devpath_text(EFI_DEVICE_PATH_PROTOCOL *path)
Get textual representation of device path.
Definition: efi_debug.c:461
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:808
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_debug.c:254
EFI Boot Services Table.
Definition: UefiSpec.h:1917
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:1958

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

662  {
664  void *retaddr = __builtin_return_address ( 0 );
665  EFI_STATUS efirc;
666 
667  DBGC ( colour, "InstallConfigurationTable ( %s, %p ) ",
668  efi_guid_ntoa ( guid ), table );
669  efirc = bs->InstallConfigurationTable ( guid, table );
670  DBGC ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
671  return efirc;
672 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:49
#define DBGC(...)
Definition: compiler.h:505
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_debug.c:254
EFI Boot Services Table.
Definition: UefiSpec.h:1917
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:1959

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

682  {
684  void *retaddr = __builtin_return_address ( 0 );
685  EFI_STATUS efirc;
686 
687  DBGC ( colour, "LoadImage ( %s, %s, ", efi_boolean ( boot_policy ),
688  efi_handle_name ( parent_image_handle ) );
689  DBGC ( colour, "%s, %p, %#llx ) ",
690  efi_devpath_text ( device_path ), source_buffer,
691  ( ( unsigned long long ) source_size ) );
692  efirc = bs->LoadImage ( boot_policy, parent_image_handle, device_path,
693  source_buffer, source_size, image_handle );
694  DBGC ( colour, "= %s ( ", efi_status ( efirc ) );
695  if ( efirc == 0 )
696  DBGC ( colour, "%s ", efi_handle_name ( *image_handle ) );
697  DBGC ( colour, ") -> %p\n", retaddr );
698 
699  /* Dump information about loaded image */
700  if ( efirc == 0 )
701  efi_dump_image ( *image_handle );
702 
703  return efirc;
704 }
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:103
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:49
EFI_IMAGE_LOAD LoadImage
Definition: UefiSpec.h:1964
#define DBGC(...)
Definition: compiler.h:505
static void efi_dump_image(EFI_HANDLE handle)
Dump information about a loaded image.
Definition: efi_wrap.c:203
const char * efi_devpath_text(EFI_DEVICE_PATH_PROTOCOL *path)
Get textual representation of device path.
Definition: efi_debug.c:461
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:808
EFI Boot Services Table.
Definition: UefiSpec.h:1917
static unsigned int source_size
Definition: bigint.h:252
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 711 of file efi_wrap.c.

712  {
714  void *retaddr = __builtin_return_address ( 0 );
715  EFI_STATUS efirc;
716 
717  DBGC ( colour, "StartImage ( %s ) ", efi_handle_name ( image_handle ) );
718  efirc = bs->StartImage ( image_handle, exit_data_size, exit_data );
719  DBGC ( colour, "= %s", efi_status ( efirc ) );
720  if ( ( efirc != 0 ) && exit_data && *exit_data_size )
721  DBGC ( colour, " ( \"%ls\" )", *exit_data );
722  DBGC ( colour, " -> %p\n", retaddr );
723  if ( ( efirc != 0 ) && exit_data && *exit_data_size )
724  DBGC_HD ( colour, *exit_data, *exit_data_size );
725  return efirc;
726 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:49
#define DBGC(...)
Definition: compiler.h:505
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:808
EFI Boot Services Table.
Definition: UefiSpec.h:1917
#define DBGC_HD(...)
Definition: compiler.h:507
EFI_IMAGE_START StartImage
Definition: UefiSpec.h:1965
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 733 of file efi_wrap.c.

734  {
736  void *retaddr = __builtin_return_address ( 0 );
737  EFI_STATUS efirc;
738 
739  if ( ( exit_status != 0 ) && exit_data && exit_data_size )
740  DBGC_HD ( colour, exit_data, exit_data_size );
741  DBGC ( colour, "Exit ( %s, %s",
742  efi_handle_name ( image_handle ), efi_status ( exit_status ) );
743  if ( ( exit_status != 0 ) && exit_data && exit_data_size )
744  DBGC ( colour, ", \"%ls\"", exit_data );
745  DBGC ( colour, " ) " );
746  efirc = bs->Exit ( image_handle, exit_status, exit_data_size,
747  exit_data );
748  DBGC ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
749  return efirc;
750 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:49
#define DBGC(...)
Definition: compiler.h:505
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:808
EFI Boot Services Table.
Definition: UefiSpec.h:1917
#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 757 of file efi_wrap.c.

757  {
759  void *retaddr = __builtin_return_address ( 0 );
760  EFI_STATUS efirc;
761 
762  DBGC ( colour, "UnloadImage ( %s ) ",
763  efi_handle_name ( image_handle ) );
764  efirc = bs->UnloadImage ( image_handle );
765  DBGC ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
766  return efirc;
767 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:49
#define DBGC(...)
Definition: compiler.h:505
EFI_IMAGE_UNLOAD UnloadImage
Definition: UefiSpec.h:1967
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:808
EFI Boot Services Table.
Definition: UefiSpec.h:1917
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 774 of file efi_wrap.c.

774  {
776  void *retaddr = __builtin_return_address ( 0 );
777  EFI_STATUS efirc;
778 
779  DBGC ( colour, "ExitBootServices ( %s, %#llx ) -> %p\n",
780  efi_handle_name ( image_handle ),
781  ( ( unsigned long long ) map_key ), retaddr );
782  efirc = bs->ExitBootServices ( image_handle, map_key );
783  if ( efirc != 0 ) {
784  DBGC ( colour, "ExitBootServices ( ... ) = %s -> %p\n",
785  efi_status ( efirc ), retaddr );
786  }
787  return efirc;
788 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:49
EFI_EXIT_BOOT_SERVICES ExitBootServices
Definition: UefiSpec.h:1968
#define DBGC(...)
Definition: compiler.h:505
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:808
EFI Boot Services Table.
Definition: UefiSpec.h:1917
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::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 795 of file efi_wrap.c.

795  {
797  void *retaddr = __builtin_return_address ( 0 );
798  EFI_STATUS efirc;
799 
800  DBGCP ( colour, "GetNextMonotonicCount() " );
801  efirc = bs->GetNextMonotonicCount ( count );
802  DBGCP ( colour, "= %s ( %#llx ) -> %p\n",
803  efi_status ( efirc ), *count, retaddr );
804  return efirc;
805 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:49
EFI Boot Services Table.
Definition: UefiSpec.h:1917
EFI_GET_NEXT_MONOTONIC_COUNT GetNextMonotonicCount
Definition: UefiSpec.h:1973
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
uint16_t count
Number of entries.
Definition: ena.h:22
#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 812 of file efi_wrap.c.

812  {
814  void *retaddr = __builtin_return_address ( 0 );
815  EFI_STATUS efirc;
816 
817  DBGC2 ( colour, "Stall ( %ld.%06lds ) ",
818  ( ( unsigned long ) ( microseconds / 1000000 ) ),
819  ( ( unsigned long ) ( microseconds % 1000000 ) ) );
820  efirc = bs->Stall ( microseconds );
821  DBGC2 ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
822  return efirc;
823 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:49
EFI_STALL Stall
Definition: UefiSpec.h:1974
EFI Boot Services Table.
Definition: UefiSpec.h:1917
#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::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 830 of file efi_wrap.c.

831  {
833  void *retaddr = __builtin_return_address ( 0 );
834  EFI_STATUS efirc;
835 
836  DBGC ( colour, "SetWatchdogTimer ( %lds, %#llx, %#llx, %p ) ",
837  ( ( unsigned long ) timeout ), watchdog_code,
838  ( ( unsigned long long ) data_size ), watchdog_data );
839  efirc = bs->SetWatchdogTimer ( timeout, watchdog_code, data_size,
840  watchdog_data );
841  DBGC ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
842  return efirc;
843 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
EFI_SET_WATCHDOG_TIMER SetWatchdogTimer
Definition: UefiSpec.h:1975
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:49
#define DBGC(...)
Definition: compiler.h:505
EFI Boot Services Table.
Definition: UefiSpec.h:1917
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 850 of file efi_wrap.c.

853  {
855  void *retaddr = __builtin_return_address ( 0 );
856  EFI_HANDLE *tmp;
857  EFI_STATUS efirc;
858 
859  DBGC ( colour, "ConnectController ( %s, {",
860  efi_handle_name ( controller_handle ) );
861  if ( driver_image_handle ) {
862  for ( tmp = driver_image_handle ; *tmp ; tmp++ ) {
863  DBGC ( colour, "%s%s",
864  ( ( tmp == driver_image_handle ) ? " " : ", " ),
865  efi_handle_name ( *tmp ) );
866  }
867  }
868  DBGC ( colour, " }, %s, %s ) ", efi_devpath_text ( remaining_path ),
869  efi_boolean ( recursive ) );
870  efirc = bs->ConnectController ( controller_handle, driver_image_handle,
871  remaining_path, recursive );
872  DBGC ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
873  return efirc;
874 }
static const char * efi_boolean(BOOLEAN boolean)
Convert EFI boolean to text.
Definition: efi_wrap.c:103
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:49
#define DBGC(...)
Definition: compiler.h:505
unsigned long tmp
Definition: linux_pci.h:53
const char * efi_devpath_text(EFI_DEVICE_PATH_PROTOCOL *path)
Get textual representation of device path.
Definition: efi_debug.c:461
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:808
EFI Boot Services Table.
Definition: UefiSpec.h:1917
EFI_CONNECT_CONTROLLER ConnectController
Definition: UefiSpec.h:1980
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:59

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

883  {
885  void *retaddr = __builtin_return_address ( 0 );
886  EFI_STATUS efirc;
887 
888  DBGC ( colour, "DisconnectController ( %s",
889  efi_handle_name ( controller_handle ) );
890  DBGC ( colour, ", %s", efi_handle_name ( driver_image_handle ) );
891  DBGC ( colour, ", %s ) ", efi_handle_name ( child_handle ) );
892  efirc = bs->DisconnectController ( controller_handle,
893  driver_image_handle,
894  child_handle );
895  DBGC ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
896  return efirc;
897 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:49
#define DBGC(...)
Definition: compiler.h:505
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:808
EFI Boot Services Table.
Definition: UefiSpec.h:1917
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:1981

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

906  {
908  void *retaddr = __builtin_return_address ( 0 );
909  EFI_STATUS efirc;
910 
911  DBGC ( colour, "OpenProtocol ( %s, %s, ",
913  DBGC ( colour, "%s, ", efi_handle_name ( agent_handle ) );
914  DBGC ( colour, "%s, %s ) ", efi_handle_name ( controller_handle ),
915  efi_open_attributes_name ( attributes ) );
916  efirc = bs->OpenProtocol ( handle, protocol, interface, agent_handle,
917  controller_handle, attributes );
918  DBGC ( colour, "= %s ( %p ) -> %p\n",
919  efi_status ( efirc ), *interface, retaddr );
920  return efirc;
921 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:49
#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:808
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_debug.c:254
EFI Boot Services Table.
Definition: UefiSpec.h:1917
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:312
EFI_SYSTEM_TABLE * efi_systab
EFI_OPEN_PROTOCOL OpenProtocol
Definition: UefiSpec.h:1986
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 928 of file efi_wrap.c.

930  {
932  void *retaddr = __builtin_return_address ( 0 );
933  EFI_STATUS efirc;
934 
935  DBGC ( colour, "CloseProtocol ( %s, %s, ",
937  DBGC ( colour, "%s, ", efi_handle_name ( agent_handle ) );
938  DBGC ( colour, "%s ) ", efi_handle_name ( controller_handle ) );
939  efirc = bs->CloseProtocol ( handle, protocol, agent_handle,
940  controller_handle );
941  DBGC ( colour, "= %s -> %p\n",
942  efi_status ( efirc ), retaddr );
943  return efirc;
944 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:49
#define DBGC(...)
Definition: compiler.h:505
EFI_CLOSE_PROTOCOL CloseProtocol
Definition: UefiSpec.h:1987
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:808
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_debug.c:254
EFI Boot Services Table.
Definition: UefiSpec.h:1917
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 951 of file efi_wrap.c.

954  {
956  void *retaddr = __builtin_return_address ( 0 );
957  EFI_STATUS efirc;
958 
959  DBGC ( colour, "OpenProtocolInformation ( %s, %s ) ",
961  efirc = bs->OpenProtocolInformation ( handle, protocol, entry_buffer,
962  entry_count );
963  DBGC ( colour, "= %s ( %p, %#llx ) -> %p\n",
964  efi_status ( efirc ), *entry_buffer,
965  ( ( unsigned long long ) *entry_count ), retaddr );
966  return efirc;
967 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:49
#define DBGC(...)
Definition: compiler.h:505
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:808
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_debug.c:254
EFI Boot Services Table.
Definition: UefiSpec.h:1917
EFI_OPEN_PROTOCOL_INFORMATION OpenProtocolInformation
Definition: UefiSpec.h:1988
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 974 of file efi_wrap.c.

976  {
978  void *retaddr = __builtin_return_address ( 0 );
979  unsigned int i;
980  EFI_STATUS efirc;
981 
982  DBGC ( colour, "ProtocolsPerHandle ( %s ) ",
983  efi_handle_name ( handle ) );
984  efirc = bs->ProtocolsPerHandle ( handle, protocol_buffer,
985  protocol_buffer_count );
986  DBGC ( colour, "= %s", efi_status ( efirc ) );
987  if ( efirc == 0 ) {
988  DBGC ( colour, " ( {" );
989  for ( i = 0 ; i < *protocol_buffer_count ; i++ ) {
990  DBGC ( colour, "%s%s", ( i ? ", " : " " ),
991  efi_guid_ntoa ( (*protocol_buffer)[i] ) );
992  }
993  DBGC ( colour, " } )" );
994  }
995  DBGC ( colour, " -> %p\n", retaddr );
996  return efirc;
997 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:49
#define DBGC(...)
Definition: compiler.h:505
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:808
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_debug.c:254
EFI Boot Services Table.
Definition: UefiSpec.h:1917
EFI_PROTOCOLS_PER_HANDLE ProtocolsPerHandle
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
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 1004 of file efi_wrap.c.

1006  {
1008  void *retaddr = __builtin_return_address ( 0 );
1009  unsigned int i;
1010  EFI_STATUS efirc;
1011 
1012  DBGC ( colour, "LocateHandleBuffer ( %s, %s, %p ) ",
1013  efi_locate_search_type_name ( search_type ),
1014  efi_guid_ntoa ( protocol ), search_key );
1015  efirc = bs->LocateHandleBuffer ( search_type, protocol, search_key,
1016  no_handles, buffer );
1017  DBGC ( colour, "= %s", efi_status ( efirc ) );
1018  if ( efirc == 0 ) {
1019  DBGC ( colour, " ( %d, {", ( ( unsigned int ) *no_handles ) );
1020  for ( i = 0 ; i < *no_handles ; i++ ) {
1021  DBGC ( colour, "%s%s", ( i ? ", " : " " ),
1022  efi_handle_name ( (*buffer)[i] ) );
1023  }
1024  DBGC ( colour, " } )" );
1025  }
1026  DBGC ( colour, " -> %p\n", retaddr );
1027  return efirc;
1028 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:49
#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:287
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:808
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_debug.c:254
EFI Boot Services Table.
Definition: UefiSpec.h:1917
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:1994

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

1036  {
1038  void *retaddr = __builtin_return_address ( 0 );
1039  EFI_STATUS efirc;
1040 
1041  DBGC ( colour, "LocateProtocol ( %s, %p ) ",
1042  efi_guid_ntoa ( protocol ), registration );
1043  efirc = bs->LocateProtocol ( protocol, registration, interface );
1044  DBGC ( colour, "= %s ( %p ) -> %p\n",
1045  efi_status ( efirc ), *interface, retaddr );
1046  return efirc;
1047 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:49
EFI_LOCATE_PROTOCOL LocateProtocol
Definition: UefiSpec.h:1995
#define DBGC(...)
Definition: compiler.h:505
An object interface.
Definition: interface.h:124
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_debug.c:254
EFI Boot Services Table.
Definition: UefiSpec.h:1917
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 1057 of file efi_wrap.c.

1057  {
1059  void *retaddr = __builtin_return_address ( 0 );
1062  VA_LIST ap;
1063  unsigned int i;
1064  EFI_STATUS efirc;
1065 
1066  DBGC ( colour, "InstallMultipleProtocolInterfaces ( %s",
1067  efi_handle_name ( *handle ) );
1068  memset ( protocol, 0, sizeof ( protocol ) );
1069  memset ( interface, 0, sizeof ( interface ) );
1070  VA_START ( ap, handle );
1071  for ( i = 0 ; ( protocol[i] = VA_ARG ( ap, EFI_GUID * ) ) ; i++ ) {
1072  if ( i == MAX_WRAP_MULTI ) {
1073  VA_END ( ap );
1074  efirc = EFI_OUT_OF_RESOURCES;
1075  DBGC ( colour, "<FATAL: too many arguments> ) = %s "
1076  "-> %p\n", efi_status ( efirc ), retaddr );
1077  return efirc;
1078  }
1079  interface[i] = VA_ARG ( ap, VOID * );
1080  DBGC ( colour, ", %s, %p",
1081  efi_guid_ntoa ( protocol[i] ), interface[i] );
1082  }
1083  VA_END ( ap );
1084  DBGC ( colour, " ) " );
1086  protocol[0], interface[0], protocol[1], interface[1],
1087  protocol[2], interface[2], protocol[3], interface[3],
1088  protocol[4], interface[4], protocol[5], interface[5],
1089  protocol[6], interface[6], protocol[7], interface[7],
1090  protocol[8], interface[8], protocol[9], interface[9],
1091  protocol[10], interface[10], protocol[11], interface[11],
1092  protocol[12], interface[12], protocol[13], interface[13],
1093  protocol[14], interface[14], protocol[15], interface[15],
1094  protocol[16], interface[16], protocol[17], interface[17],
1095  protocol[18], interface[18], protocol[19], interface[19],
1096  NULL );
1097  DBGC ( colour, "= %s ( %s ) -> %p\n",
1098  efi_status ( efirc ), efi_handle_name ( *handle ), retaddr );
1099  return efirc;
1100 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
#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:49
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:1996
#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:808
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_debug.c:254
EFI Boot Services Table.
Definition: UefiSpec.h:1917
#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
#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:1050
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 1107 of file efi_wrap.c.

1107  {
1109  void *retaddr = __builtin_return_address ( 0 );
1112  VA_LIST ap;
1113  unsigned int i;
1114  EFI_STATUS efirc;
1115 
1116  DBGC ( colour, "UninstallMultipleProtocolInterfaces ( %s",
1117  efi_handle_name ( handle ) );
1118  memset ( protocol, 0, sizeof ( protocol ) );
1119  memset ( interface, 0, sizeof ( interface ) );
1120  VA_START ( ap, handle );
1121  for ( i = 0 ; ( protocol[i] = VA_ARG ( ap, EFI_GUID * ) ) ; i++ ) {
1122  if ( i == MAX_WRAP_MULTI ) {
1123  VA_END ( ap );
1124  efirc = EFI_OUT_OF_RESOURCES;
1125  DBGC ( colour, "<FATAL: too many arguments> ) = %s "
1126  "-> %p\n", efi_status ( efirc ), retaddr );
1127  return efirc;
1128  }
1129  interface[i] = VA_ARG ( ap, VOID * );
1130  DBGC ( colour, ", %s, %p",
1131  efi_guid_ntoa ( protocol[i] ), interface[i] );
1132  }
1133  VA_END ( ap );
1134  DBGC ( colour, " ) " );
1136  protocol[0], interface[0], protocol[1], interface[1],
1137  protocol[2], interface[2], protocol[3], interface[3],
1138  protocol[4], interface[4], protocol[5], interface[5],
1139  protocol[6], interface[6], protocol[7], interface[7],
1140  protocol[8], interface[8], protocol[9], interface[9],
1141  protocol[10], interface[10], protocol[11], interface[11],
1142  protocol[12], interface[12], protocol[13], interface[13],
1143  protocol[14], interface[14], protocol[15], interface[15],
1144  protocol[16], interface[16], protocol[17], interface[17],
1145  protocol[18], interface[18], protocol[19], interface[19],
1146  NULL );
1147  DBGC ( colour, "= %s -> %p\n",
1148  efi_status ( efirc ), retaddr );
1149  return efirc;
1150 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
#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:49
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:808
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_debug.c:254
EFI Boot Services Table.
Definition: UefiSpec.h:1917
EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces
Definition: UefiSpec.h:1997
#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
#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:1050
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 1157 of file efi_wrap.c.

1160  {
1162  void *retaddr = __builtin_return_address ( 0 );
1163  EFI_STATUS efirc;
1164 
1165  DBGC ( colour, "CreateEventEx ( %#x, %s, %p, %p, %s ) ",
1166  type, efi_tpl ( notify_tpl ), notify_function, notify_context,
1167  efi_guid_ntoa ( event_group ) );
1168  efirc = bs->CreateEventEx ( type, notify_tpl, notify_function,
1169  notify_context, event_group, event );
1170  DBGC ( colour, "= %s ( %p ) -> %p\n",
1171  efi_status ( efirc ), *event, retaddr );
1172  return efirc;
1173 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
static const char * efi_status(EFI_STATUS efirc)
Convert EFI status code to text.
Definition: efi_wrap.c:49
#define DBGC(...)
Definition: compiler.h:505
EFI_CREATE_EVENT_EX CreateEventEx
Definition: UefiSpec.h:2009
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_debug.c:254
EFI Boot Services Table.
Definition: UefiSpec.h:1917
uint32_t type
Operating system type.
Definition: ena.h:12
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:31
static const char * efi_tpl(EFI_TPL tpl)
Convert EFI TPL to text.
Definition: efi_wrap.c:114
EFI_SYSTEM_TABLE * efi_systab
#define colour
Colour for debug messages.
Definition: efi_wrap.c:41

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

Referenced by efi_wrap_bs().

◆ efi_wrap_bs()

EFI_BOOT_SERVICES* efi_wrap_bs ( void  )

Build boot services table wrapper.

Return values
bsWrapped boot services table

Definition at line 1180 of file efi_wrap.c.

1180  {
1181  static EFI_BOOT_SERVICES efi_bs_wrapper;
1183 
1184  /* Build boot services table wrapper */
1185  memcpy ( &efi_bs_wrapper, bs, sizeof ( efi_bs_wrapper ) );
1186  efi_bs_wrapper.RaiseTPL = efi_raise_tpl_wrapper;
1187  efi_bs_wrapper.RestoreTPL = efi_restore_tpl_wrapper;
1188  efi_bs_wrapper.AllocatePages = efi_allocate_pages_wrapper;
1189  efi_bs_wrapper.FreePages = efi_free_pages_wrapper;
1190  efi_bs_wrapper.GetMemoryMap = efi_get_memory_map_wrapper;
1191  efi_bs_wrapper.AllocatePool = efi_allocate_pool_wrapper;
1192  efi_bs_wrapper.FreePool = efi_free_pool_wrapper;
1193  efi_bs_wrapper.CreateEvent = efi_create_event_wrapper;
1194  efi_bs_wrapper.SetTimer = efi_set_timer_wrapper;
1195  efi_bs_wrapper.WaitForEvent = efi_wait_for_event_wrapper;
1196  efi_bs_wrapper.SignalEvent = efi_signal_event_wrapper;
1197  efi_bs_wrapper.CloseEvent = efi_close_event_wrapper;
1198  efi_bs_wrapper.CheckEvent = efi_check_event_wrapper;
1199  efi_bs_wrapper.InstallProtocolInterface
1201  efi_bs_wrapper.ReinstallProtocolInterface
1203  efi_bs_wrapper.UninstallProtocolInterface
1206  efi_bs_wrapper.RegisterProtocolNotify
1208  efi_bs_wrapper.LocateHandle = efi_locate_handle_wrapper;
1210  efi_bs_wrapper.InstallConfigurationTable
1212  efi_bs_wrapper.LoadImage = efi_load_image_wrapper;
1213  efi_bs_wrapper.StartImage = efi_start_image_wrapper;
1214  efi_bs_wrapper.Exit = efi_exit_wrapper;
1215  efi_bs_wrapper.UnloadImage = efi_unload_image_wrapper;
1217  efi_bs_wrapper.GetNextMonotonicCount
1219  efi_bs_wrapper.Stall = efi_stall_wrapper;
1221  efi_bs_wrapper.ConnectController
1223  efi_bs_wrapper.DisconnectController
1225  efi_bs_wrapper.OpenProtocol = efi_open_protocol_wrapper;
1226  efi_bs_wrapper.CloseProtocol = efi_close_protocol_wrapper;
1227  efi_bs_wrapper.OpenProtocolInformation
1229  efi_bs_wrapper.ProtocolsPerHandle
1231  efi_bs_wrapper.LocateHandleBuffer
1234  efi_bs_wrapper.InstallMultipleProtocolInterfaces
1238  efi_bs_wrapper.CreateEventEx = efi_create_event_ex_wrapper;
1239 
1240  return &efi_bs_wrapper;
1241 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
static EFI_STATUS EFIAPI efi_set_timer_wrapper(EFI_EVENT event, EFI_TIMER_DELAY type, UINT64 trigger_time)
Wrap SetTimer()
Definition: efi_wrap.c:415
static VOID EFIAPI efi_restore_tpl_wrapper(EFI_TPL old_tpl)
Wrap RestoreTPL()
Definition: efi_wrap.c:260
EFI_SET_WATCHDOG_TIMER SetWatchdogTimer
Definition: UefiSpec.h:1975
EFI_RAISE_TPL RaiseTPL
Definition: UefiSpec.h:1926
EFI_LOCATE_PROTOCOL LocateProtocol
Definition: UefiSpec.h:1995
EFI_STALL Stall
Definition: UefiSpec.h:1974
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:528
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:608
static EFI_STATUS EFIAPI efi_register_protocol_notify_wrapper(EFI_GUID *protocol, EFI_EVENT event, VOID **registration)
Wrap RegisterProtocolNotify()
Definition: efi_wrap.c:589
EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface
Definition: UefiSpec.h:1952
EFI_EXIT_BOOT_SERVICES ExitBootServices
Definition: UefiSpec.h:1968
EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface
Definition: UefiSpec.h:1953
EFI_IMAGE_LOAD LoadImage
Definition: UefiSpec.h:1964
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:928
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:974
static EFI_STATUS EFIAPI efi_handle_protocol_wrapper(EFI_HANDLE handle, EFI_GUID *protocol, VOID **interface)
Wrap HandleProtocol()
Definition: efi_wrap.c:570
EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces
Definition: UefiSpec.h:1996
static EFI_STATUS EFIAPI efi_install_configuration_table_wrapper(EFI_GUID *guid, VOID *table)
Wrap InstallConfigurationTable()
Definition: efi_wrap.c:662
EFI_CLOSE_EVENT CloseEvent
Definition: UefiSpec.h:1945
EFI_SET_TIMER SetTimer
Definition: UefiSpec.h:1942
static EFI_STATUS EFIAPI efi_signal_event_wrapper(EFI_EVENT event)
Wrap SignalEvent()
Definition: efi_wrap.c:459
EFI_LOCATE_HANDLE LocateHandle
Definition: UefiSpec.h:1957
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:394
EFI_IMAGE_UNLOAD UnloadImage
Definition: UefiSpec.h:1967
static EFI_STATUS EFIAPI efi_get_next_monotonic_count_wrapper(UINT64 *count)
Wrap GetNextMonotonicCount()
Definition: efi_wrap.c:795
EFI_CLOSE_PROTOCOL CloseProtocol
Definition: UefiSpec.h:1987
EFI_CREATE_EVENT_EX CreateEventEx
Definition: UefiSpec.h:2009
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:1157
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:314
void * memcpy(void *dest, const void *src, size_t len) __nonnull
EFI_INSTALL_PROTOCOL_INTERFACE InstallProtocolInterface
Definition: UefiSpec.h:1951
EFI_CREATE_EVENT CreateEvent
Definition: UefiSpec.h:1941
EFI_HANDLE_PROTOCOL HandleProtocol
Definition: UefiSpec.h:1954
EFI_REGISTER_PROTOCOL_NOTIFY RegisterProtocolNotify
Definition: UefiSpec.h:1956
static EFI_STATUS EFIAPI efi_free_pages_wrapper(EFI_PHYSICAL_ADDRESS memory, UINTN pages)
Wrap FreePages()
Definition: efi_wrap.c:296
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:711
EFI_SIGNAL_EVENT SignalEvent
Definition: UefiSpec.h:1944
EFI Boot Services Table.
Definition: UefiSpec.h:1917
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:830
EFI_GET_NEXT_MONOTONIC_COUNT GetNextMonotonicCount
Definition: UefiSpec.h:1973
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:506
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:951
static EFI_STATUS EFIAPI efi_wait_for_event_wrapper(UINTN number_of_events, EFI_EVENT *event, UINTN *index)
Wrap WaitForEvent()
Definition: efi_wrap.c:435
EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces
Definition: UefiSpec.h:1997
EFI_CONNECT_CONTROLLER ConnectController
Definition: UefiSpec.h:1980
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:850
static EFI_STATUS EFIAPI efi_locate_protocol_wrapper(EFI_GUID *protocol, VOID *registration, VOID **interface)
Wrap LocateProtocol()
Definition: efi_wrap.c:1035
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:274
EFI_IMAGE_START StartImage
Definition: UefiSpec.h:1965
static EFI_TPL EFIAPI efi_raise_tpl_wrapper(EFI_TPL new_tpl)
Wrap RaiseTPL()
Definition: efi_wrap.c:244
static EFI_STATUS EFIAPI efi_install_multiple_protocol_interfaces_wrapper(EFI_HANDLE *handle,...)
Wrap InstallMultipleProtocolInterfaces()
Definition: efi_wrap.c:1057
static EFI_STATUS EFIAPI efi_unload_image_wrapper(EFI_HANDLE image_handle)
Wrap UnloadImage()
Definition: efi_wrap.c:757
EFI_WAIT_FOR_EVENT WaitForEvent
Definition: UefiSpec.h:1943
EFI_FREE_POOL FreePool
Definition: UefiSpec.h:1936
EFI_OPEN_PROTOCOL_INFORMATION OpenProtocolInformation
Definition: UefiSpec.h:1988
static EFI_STATUS EFIAPI efi_uninstall_protocol_interface_wrapper(EFI_HANDLE handle, EFI_GUID *protocol, VOID *interface)
Wrap UninstallProtocolInterface()
Definition: efi_wrap.c:550
EFI_GET_MEMORY_MAP GetMemoryMap
Definition: UefiSpec.h:1934
EFI_ALLOCATE_PAGES AllocatePages
Definition: UefiSpec.h:1932
static EFI_STATUS EFIAPI efi_allocate_pool_wrapper(EFI_MEMORY_TYPE pool_type, UINTN size, VOID **buffer)
Wrap AllocatePool()
Definition: efi_wrap.c:358
EFI_PROTOCOLS_PER_HANDLE ProtocolsPerHandle
Definition: UefiSpec.h:1993
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:1004
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:904
EFI_CHECK_EVENT CheckEvent
Definition: UefiSpec.h:1946
static EFI_STATUS EFIAPI efi_close_event_wrapper(EFI_EVENT event)
Wrap CloseEvent()
Definition: efi_wrap.c:475
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:679
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:881
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:641
static EFI_STATUS EFIAPI efi_exit_boot_services_wrapper(EFI_HANDLE image_handle, UINTN map_key)
Wrap ExitBootServices()
Definition: efi_wrap.c:774
EFI_SYSTEM_TABLE * efi_systab
EFI_OPEN_PROTOCOL OpenProtocol
Definition: UefiSpec.h:1986
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:733
EFI_RESTORE_TPL RestoreTPL
Definition: UefiSpec.h:1927
static EFI_STATUS EFIAPI efi_stall_wrapper(UINTN microseconds)
Wrap Stall()
Definition: efi_wrap.c:812
static EFI_STATUS EFIAPI efi_uninstall_multiple_protocol_interfaces_wrapper(EFI_HANDLE handle,...)
Wrap UninstallMultipleProtocolInterfaces()
Definition: efi_wrap.c:1107
static EFI_STATUS EFIAPI efi_check_event_wrapper(EFI_EVENT event)
Wrap CheckEvent()
Definition: efi_wrap.c:490
EFI_FREE_PAGES FreePages
Definition: UefiSpec.h:1933
EFI_LOCATE_HANDLE_BUFFER LocateHandleBuffer
Definition: UefiSpec.h:1994
EFI_INSTALL_CONFIGURATION_TABLE InstallConfigurationTable
Definition: UefiSpec.h:1959
EFI_LOCATE_DEVICE_PATH LocateDevicePath
Definition: UefiSpec.h:1958
static EFI_STATUS EFIAPI efi_free_pool_wrapper(VOID *buffer)
Wrap FreePool()
Definition: efi_wrap.c:378
EFI_ALLOCATE_POOL AllocatePool
Definition: UefiSpec.h:1935
EFI_DISCONNECT_CONTROLLER DisconnectController
Definition: UefiSpec.h:1981

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, 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().

◆ efi_wrap()

void efi_wrap ( EFI_HANDLE  handle)

Wrap the calls made by a loaded image.

Parameters
handleImage handle

Definition at line 1248 of file efi_wrap.c.

1248  {
1249  static EFI_SYSTEM_TABLE efi_systab_copy;
1250 
1251  /* Do nothing unless debugging is enabled */
1252  if ( ! DBG_LOG )
1253  return;
1254 
1255  /* Construct modified system table */
1256  if ( efi_systab != &efi_systab_copy ) {
1257  memcpy ( &efi_systab_copy, efi_systab,
1258  sizeof ( efi_systab_copy ) );
1260  efi_systab = &efi_systab_copy;
1261  }
1262 
1263  /* Dump image information */
1264  efi_dump_image ( handle );
1265 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2081
EFI_BOOT_SERVICES * efi_wrap_bs(void)
Build boot services table wrapper.
Definition: efi_wrap.c:1180
static void efi_dump_image(EFI_HANDLE handle)
Dump information about a loaded image.
Definition: efi_wrap.c:203
void * memcpy(void *dest, const void *src, size_t len) __nonnull
EFI System Table.
Definition: UefiSpec.h:2030
EFI_SYSTEM_TABLE * efi_systab
#define DBG_LOG
Definition: compiler.h:317
uint16_t handle
Handle.
Definition: smbios.h:16

References EFI_SYSTEM_TABLE::BootServices, DBG_LOG, efi_dump_image(), efi_systab, efi_wrap_bs(), handle, and memcpy().

Referenced by efi_image_exec().