aboutsummaryrefslogtreecommitdiff
path: root/src/interface
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2020-09-18 22:49:02 +0100
committerMichael Brown <mcb30@ipxe.org>2020-09-18 23:16:46 +0100
commite08ad61bf78b5b9c8448ce0eac58001d617327b5 (patch)
tree9c0647493c56939f79d115b581de8b327c6e9d1c /src/interface
parent4bd064de239dab2426b31c9789a1f4d78087dc63 (diff)
downloadipxe-e08ad61bf78b5b9c8448ce0eac58001d617327b5.zip
ipxe-e08ad61bf78b5b9c8448ce0eac58001d617327b5.tar.gz
ipxe-e08ad61bf78b5b9c8448ce0eac58001d617327b5.tar.bz2
[efi] Add debug wrappers for all boot services functions of interest
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/interface')
-rw-r--r--src/interface/efi/efi_debug.c2
-rw-r--r--src/interface/efi/efi_wrap.c602
2 files changed, 603 insertions, 1 deletions
diff --git a/src/interface/efi/efi_debug.c b/src/interface/efi/efi_debug.c
index de9b1af..f7be947 100644
--- a/src/interface/efi/efi_debug.c
+++ b/src/interface/efi/efi_debug.c
@@ -189,7 +189,7 @@ static struct efi_well_known_guid efi_well_known_guids[] = {
* @v guid GUID
* @ret string Printable string
*/
-const __attribute__ (( pure )) char * efi_guid_ntoa ( EFI_GUID *guid ) {
+const __attribute__ (( pure )) char * efi_guid_ntoa ( CONST EFI_GUID *guid ) {
union {
union uuid uuid;
EFI_GUID guid;
diff --git a/src/interface/efi/efi_wrap.c b/src/interface/efi/efi_wrap.c
index c0c40ee..ce830fe 100644
--- a/src/interface/efi/efi_wrap.c
+++ b/src/interface/efi/efi_wrap.c
@@ -112,6 +112,340 @@ static const char * efi_boolean ( BOOLEAN boolean ) {
}
/**
+ * Convert EFI TPL to text
+ *
+ * @v tpl Task priority level
+ * @ret text Task priority level as text
+ */
+static const char * efi_tpl ( EFI_TPL tpl ) {
+ static char buf[ 19 /* "0xXXXXXXXXXXXXXXXX" + NUL */ ];
+
+ switch ( tpl ) {
+ case TPL_APPLICATION: return "Application";
+ case TPL_CALLBACK: return "Callback";
+ case TPL_NOTIFY: return "Notify";
+ case TPL_HIGH_LEVEL: return "HighLevel";
+ default:
+ snprintf ( buf, sizeof ( buf ), "%#lx",
+ ( unsigned long ) tpl );
+ return buf;
+ }
+}
+
+/**
+ * Convert EFI allocation type to text
+ *
+ * @v type Allocation type
+ * @ret text Allocation type as text
+ */
+static const char * efi_allocate_type ( EFI_ALLOCATE_TYPE type ) {
+ static char buf[ 11 /* "0xXXXXXXXX" + NUL */ ];
+
+ switch ( type ) {
+ case AllocateAnyPages: return "AnyPages";
+ case AllocateMaxAddress: return "MaxAddress";
+ case AllocateAddress: return "Address";
+ default:
+ snprintf ( buf, sizeof ( buf ), "%#x", type );
+ return buf;
+ }
+}
+
+/**
+ * Convert EFI memory type to text
+ *
+ * @v type Memory type
+ * @ret text Memory type as text
+ */
+static const char * efi_memory_type ( EFI_MEMORY_TYPE type ) {
+ static char buf[ 11 /* "0xXXXXXXXX" + NUL */ ];
+
+ switch ( type ) {
+ case EfiReservedMemoryType: return "Reserved";
+ case EfiLoaderCode: return "LoaderCode";
+ case EfiLoaderData: return "LoaderData";
+ case EfiBootServicesCode: return "BootCode";
+ case EfiBootServicesData: return "BootData";
+ case EfiRuntimeServicesCode: return "RuntimeCode";
+ case EfiRuntimeServicesData: return "RuntimeData";
+ case EfiConventionalMemory: return "Conventional";
+ case EfiUnusableMemory: return "Unusable";
+ case EfiACPIReclaimMemory: return "ACPIReclaim";
+ case EfiACPIMemoryNVS: return "ACPINVS";
+ case EfiMemoryMappedIO: return "MMIO";
+ case EfiMemoryMappedIOPortSpace:return "PIO";
+ case EfiPalCode: return "PalCode";
+ case EfiPersistentMemory: return "Persistent";
+ default:
+ snprintf ( buf, sizeof ( buf ), "%#x", type );
+ return buf;
+ }
+}
+
+/**
+ * Convert EFI timer delay type to text
+ *
+ * @v type Timer delay type
+ * @ret text Timer delay type as text
+ */
+static const char * efi_timer_delay ( EFI_TIMER_DELAY type ) {
+ static char buf[ 11 /* "0xXXXXXXXX" + NUL */ ];
+
+ switch ( type ) {
+ case TimerCancel: return "Cancel";
+ case TimerPeriodic: return "Periodic";
+ case TimerRelative: return "Relative";
+ default:
+ snprintf ( buf, sizeof ( buf ), "%#x", type );
+ return buf;
+ }
+}
+
+/**
+ * Wrap RaiseTPL()
+ *
+ */
+static EFI_TPL EFIAPI
+efi_raise_tpl_wrapper ( EFI_TPL new_tpl ) {
+ EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
+ void *retaddr = __builtin_return_address ( 0 );
+ EFI_TPL old_tpl;
+
+ DBGCP ( colour, "RaiseTPL ( %s ) ", efi_tpl ( new_tpl ) );
+ old_tpl = bs->RaiseTPL ( new_tpl );
+ DBGCP ( colour, "= %s -> %p\n", efi_tpl ( old_tpl ), retaddr );
+ return old_tpl;
+}
+
+/**
+ * Wrap RestoreTPL()
+ *
+ */
+static VOID EFIAPI
+efi_restore_tpl_wrapper ( EFI_TPL old_tpl ) {
+ EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
+ void *retaddr = __builtin_return_address ( 0 );
+
+ DBGCP ( colour, "RestoreTPL ( %s ) ", efi_tpl ( old_tpl ) );
+ bs->RestoreTPL ( old_tpl );
+ DBGCP ( colour, "-> %p\n", retaddr );
+}
+
+/**
+ * Wrap AllocatePages()
+ *
+ */
+static EFI_STATUS EFIAPI
+efi_allocate_pages_wrapper ( EFI_ALLOCATE_TYPE type,
+ EFI_MEMORY_TYPE memory_type, UINTN pages,
+ EFI_PHYSICAL_ADDRESS *memory ) {
+ EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
+ void *retaddr = __builtin_return_address ( 0 );
+ EFI_STATUS efirc;
+
+ DBGC2 ( colour, "AllocatePages ( %s, %s, %#llx, %#llx ) ",
+ efi_allocate_type ( type ), efi_memory_type ( memory_type ),
+ ( ( unsigned long long ) pages ),
+ ( ( unsigned long long ) *memory ) );
+ efirc = bs->AllocatePages ( type, memory_type, pages, memory );
+ DBGC2 ( colour, "= %s ( %#llx ) -> %p\n", efi_status ( efirc ),
+ ( ( unsigned long long ) *memory ), retaddr );
+ return efirc;
+}
+
+/**
+ * Wrap FreePages()
+ *
+ */
+static EFI_STATUS EFIAPI
+efi_free_pages_wrapper ( EFI_PHYSICAL_ADDRESS memory, UINTN pages ) {
+ EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
+ void *retaddr = __builtin_return_address ( 0 );
+ EFI_STATUS efirc;
+
+ DBGC2 ( colour, "FreePages ( %#llx, %#llx ) ",
+ ( ( unsigned long long ) memory ),
+ ( ( unsigned long long ) pages ) );
+ efirc = bs->FreePages ( memory, pages );
+ DBGC2 ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
+ return efirc;
+}
+
+/**
+ * Wrap GetMemoryMap()
+ *
+ */
+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 ) {
+ EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
+ void *retaddr = __builtin_return_address ( 0 );
+ EFI_STATUS efirc;
+
+ DBGC ( colour, "GetMemoryMap ( %#llx, %p ) ",
+ ( ( unsigned long long ) *memory_map_size ), memory_map );
+ efirc = bs->GetMemoryMap ( memory_map_size, memory_map, map_key,
+ descriptor_size, descriptor_version );
+ DBGC ( colour, "= %s ( %#llx, %#llx, %#llx, v%d ) -> %p\n",
+ efi_status ( efirc ),
+ ( ( unsigned long long ) *memory_map_size ),
+ ( ( unsigned long long ) *map_key ),
+ ( ( unsigned long long ) *descriptor_size ),
+ *descriptor_version, retaddr );
+ return efirc;
+}
+
+/**
+ * Wrap AllocatePool()
+ *
+ */
+static EFI_STATUS EFIAPI
+efi_allocate_pool_wrapper ( EFI_MEMORY_TYPE pool_type, UINTN size,
+ VOID **buffer ) {
+ EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
+ void *retaddr = __builtin_return_address ( 0 );
+ EFI_STATUS efirc;
+
+ DBGC2 ( colour, "AllocatePool ( %s, %#llx ) ",
+ efi_memory_type ( pool_type ),
+ ( ( unsigned long long ) size ) );
+ efirc = bs->AllocatePool ( pool_type, size, buffer );
+ DBGC2 ( colour, "= %s ( %p ) -> %p\n",
+ efi_status ( efirc ), *buffer, retaddr );
+ return efirc;
+}
+
+/**
+ * Wrap FreePool()
+ *
+ */
+static EFI_STATUS EFIAPI
+efi_free_pool_wrapper ( VOID *buffer ) {
+ EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
+ void *retaddr = __builtin_return_address ( 0 );
+ EFI_STATUS efirc;
+
+ DBGC2 ( colour, "FreePool ( %p ) ", buffer );
+ efirc = bs->FreePool ( buffer );
+ DBGC2 ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
+ return efirc;
+}
+
+/**
+ * Wrap CreateEvent()
+ *
+ */
+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 ) {
+ EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
+ void *retaddr = __builtin_return_address ( 0 );
+ EFI_STATUS efirc;
+
+ DBGC ( colour, "CreateEvent ( %#x, %s, %p, %p ) ",
+ type, efi_tpl ( notify_tpl ), notify_function, notify_context );
+ efirc = bs->CreateEvent ( type, notify_tpl, notify_function,
+ notify_context, event );
+ DBGC ( colour, "= %s ( %p ) -> %p\n",
+ efi_status ( efirc ), *event, retaddr );
+ return efirc;
+}
+
+/**
+ * Wrap SetTimer()
+ *
+ */
+static EFI_STATUS EFIAPI
+efi_set_timer_wrapper ( EFI_EVENT event, EFI_TIMER_DELAY type,
+ UINT64 trigger_time ) {
+ EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
+ void *retaddr = __builtin_return_address ( 0 );
+ EFI_STATUS efirc;
+
+ DBGC ( colour, "SetTimer ( %p, %s, %ld.%07ld00s ) ",
+ event, efi_timer_delay ( type ),
+ ( ( unsigned long ) ( trigger_time / 10000000 ) ),
+ ( ( unsigned long ) ( trigger_time % 10000000 ) ) );
+ efirc = bs->SetTimer ( event, type, trigger_time );
+ DBGC ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
+ return efirc;
+}
+
+/**
+ * Wrap WaitForEvent()
+ *
+ */
+static EFI_STATUS EFIAPI
+efi_wait_for_event_wrapper ( UINTN number_of_events, EFI_EVENT *event,
+ UINTN *index ) {
+ EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
+ void *retaddr = __builtin_return_address ( 0 );
+ unsigned int i;
+ EFI_STATUS efirc;
+
+ DBGC ( colour, "WaitForEvent (" );
+ for ( i = 0 ; i < number_of_events ; i++ )
+ DBGC ( colour, " %p", event[i] );
+ DBGC ( colour, " ) " );
+ efirc = bs->WaitForEvent ( number_of_events, event, index );
+ DBGC ( colour, "= %s", efi_status ( efirc ) );
+ if ( efirc == 0 )
+ DBGC ( colour, " ( %p )", event[*index] );
+ DBGC ( colour, " -> %p\n", retaddr );
+ return efirc;
+}
+
+/**
+ * Wrap SignalEvent()
+ *
+ */
+static EFI_STATUS EFIAPI
+efi_signal_event_wrapper ( EFI_EVENT event ) {
+ EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
+ void *retaddr = __builtin_return_address ( 0 );
+ EFI_STATUS efirc;
+
+ DBGC2 ( colour, "SignalEvent ( %p ) ", event );
+ efirc = bs->SignalEvent ( event );
+ DBGC2 ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
+ return efirc;
+}
+
+/**
+ * Wrap CloseEvent()
+ *
+ */
+static EFI_STATUS EFIAPI
+efi_close_event_wrapper ( EFI_EVENT event ) {
+ EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
+ void *retaddr = __builtin_return_address ( 0 );
+ EFI_STATUS efirc;
+
+ DBGC ( colour, "CloseEvent ( %p ) ", event );
+ efirc = bs->SignalEvent ( event );
+ DBGC ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
+ return efirc;
+}
+/**
+ * Wrap CheckEvent()
+ *
+ */
+static EFI_STATUS EFIAPI
+efi_check_event_wrapper ( EFI_EVENT event ) {
+ EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
+ void *retaddr = __builtin_return_address ( 0 );
+ EFI_STATUS efirc;
+
+ DBGCP ( colour, "CheckEvent ( %p ) ", event );
+ efirc = bs->SignalEvent ( event );
+ DBGCP ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
+ return efirc;
+}
+
+/**
* Wrap InstallProtocolInterface()
*
*/
@@ -195,6 +529,25 @@ efi_handle_protocol_wrapper ( EFI_HANDLE handle, EFI_GUID *protocol,
}
/**
+ * Wrap RegisterProtocolNotify()
+ *
+ */
+static EFI_STATUS EFIAPI
+efi_register_protocol_notify_wrapper ( EFI_GUID *protocol, EFI_EVENT event,
+ VOID **registration ) {
+ EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
+ void *retaddr = __builtin_return_address ( 0 );
+ EFI_STATUS efirc;
+
+ DBGC ( colour, "RegisterProtocolNotify ( %s, %p ) ",
+ efi_guid_ntoa ( protocol ), event );
+ efirc = bs->RegisterProtocolNotify ( protocol, event, registration );
+ DBGC ( colour, "= %s ( %p ) -> %p\n",
+ efi_status ( efirc ), *registration, retaddr );
+ return efirc;
+}
+
+/**
* Wrap LocateHandle()
*
*/
@@ -249,6 +602,23 @@ efi_locate_device_path_wrapper ( EFI_GUID *protocol,
}
/**
+ * Wrap InstallConfigurationTable()
+ *
+ */
+static EFI_STATUS EFIAPI
+efi_install_configuration_table_wrapper ( EFI_GUID *guid, VOID *table ) {
+ EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
+ void *retaddr = __builtin_return_address ( 0 );
+ EFI_STATUS efirc;
+
+ DBGC ( colour, "InstallConfigurationTable ( %s, %p ) ",
+ efi_guid_ntoa ( guid ), table );
+ efirc = bs->InstallConfigurationTable ( guid, table );
+ DBGC ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
+ return efirc;
+}
+
+/**
* Wrap LoadImage()
*
*/
@@ -362,6 +732,61 @@ efi_exit_boot_services_wrapper ( EFI_HANDLE image_handle, UINTN map_key ) {
}
/**
+ * Wrap GetNextMonotonicCount()
+ *
+ */
+static EFI_STATUS EFIAPI
+efi_get_next_monotonic_count_wrapper ( UINT64 *count ) {
+ EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
+ void *retaddr = __builtin_return_address ( 0 );
+ EFI_STATUS efirc;
+
+ DBGCP ( colour, "GetNextMonotonicCount() " );
+ efirc = bs->GetNextMonotonicCount ( count );
+ DBGCP ( colour, "= %s ( %#llx ) -> %p\n",
+ efi_status ( efirc ), *count, retaddr );
+ return efirc;
+}
+
+/**
+ * Wrap Stall()
+ *
+ */
+static EFI_STATUS EFIAPI
+efi_stall_wrapper ( UINTN microseconds ) {
+ EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
+ void *retaddr = __builtin_return_address ( 0 );
+ EFI_STATUS efirc;
+
+ DBGC2 ( colour, "Stall ( %ld.%06lds ) ",
+ ( ( unsigned long ) ( microseconds / 1000000 ) ),
+ ( ( unsigned long ) ( microseconds % 1000000 ) ) );
+ efirc = bs->Stall ( microseconds );
+ DBGC2 ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
+ return efirc;
+}
+
+/**
+ * Wrap SetWatchdogTimer()
+ *
+ */
+static EFI_STATUS EFIAPI
+efi_set_watchdog_timer_wrapper ( UINTN timeout, UINT64 watchdog_code,
+ UINTN data_size, CHAR16 *watchdog_data ) {
+ EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
+ void *retaddr = __builtin_return_address ( 0 );
+ EFI_STATUS efirc;
+
+ DBGC ( colour, "SetWatchdogTimer ( %lds, %#llx, %#llx, %p ) ",
+ ( ( unsigned long ) timeout ), watchdog_code,
+ ( ( unsigned long long ) data_size ), watchdog_data );
+ efirc = bs->SetWatchdogTimer ( timeout, watchdog_code, data_size,
+ watchdog_data );
+ DBGC ( colour, "= %s -> %p\n", efi_status ( efirc ), retaddr );
+ return efirc;
+}
+
+/**
* Wrap ConnectController()
*
*/
@@ -463,6 +888,29 @@ efi_close_protocol_wrapper ( EFI_HANDLE handle, EFI_GUID *protocol,
}
/**
+ * Wrap OpenProtocolInformation()
+ *
+ */
+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 ) {
+ EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
+ void *retaddr = __builtin_return_address ( 0 );
+ EFI_STATUS efirc;
+
+ DBGC ( colour, "OpenProtocolInformation ( %s, %s ) ",
+ efi_handle_name ( handle ), efi_guid_ntoa ( protocol ) );
+ efirc = bs->OpenProtocolInformation ( handle, protocol, entry_buffer,
+ entry_count );
+ DBGC ( colour, "= %s ( %p, %#llx ) -> %p\n",
+ efi_status ( efirc ), *entry_buffer,
+ ( ( unsigned long long ) *entry_count ), retaddr );
+ return efirc;
+}
+
+/**
* Wrap ProtocolsPerHandle()
*
*/
@@ -542,6 +990,132 @@ efi_locate_protocol_wrapper ( EFI_GUID *protocol, VOID *registration,
return efirc;
}
+/** Maximum number of interfaces for wrapped ...MultipleProtocolInterfaces() */
+#define MAX_WRAP_MULTI 20
+
+/**
+ * Wrap InstallMultipleProtocolInterfaces()
+ *
+ */
+static EFI_STATUS EFIAPI
+efi_install_multiple_protocol_interfaces_wrapper ( EFI_HANDLE *handle, ... ) {
+ EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
+ void *retaddr = __builtin_return_address ( 0 );
+ EFI_GUID *protocol[ MAX_WRAP_MULTI + 1 ];
+ VOID *interface[MAX_WRAP_MULTI];
+ VA_LIST ap;
+ unsigned int i;
+ EFI_STATUS efirc;
+
+ DBGC ( colour, "InstallMultipleProtocolInterfaces ( %s",
+ efi_handle_name ( *handle ) );
+ memset ( protocol, 0, sizeof ( protocol ) );
+ memset ( interface, 0, sizeof ( interface ) );
+ VA_START ( ap, handle );
+ for ( i = 0 ; ( protocol[i] = VA_ARG ( ap, EFI_GUID * ) ) ; i++ ) {
+ if ( i == MAX_WRAP_MULTI ) {
+ VA_END ( ap );
+ efirc = EFI_OUT_OF_RESOURCES;
+ DBGC ( colour, "<FATAL: too many arguments> ) = %s "
+ "-> %p\n", efi_status ( efirc ), retaddr );
+ return efirc;
+ }
+ interface[i] = VA_ARG ( ap, VOID * );
+ DBGC ( colour, ", %s, %p",
+ efi_guid_ntoa ( protocol[i] ), interface[i] );
+ }
+ VA_END ( ap );
+ DBGC ( colour, " ) " );
+ efirc = bs->InstallMultipleProtocolInterfaces ( handle,
+ protocol[0], interface[0], protocol[1], interface[1],
+ protocol[2], interface[2], protocol[3], interface[3],
+ protocol[4], interface[4], protocol[5], interface[5],
+ protocol[6], interface[6], protocol[7], interface[7],
+ protocol[8], interface[8], protocol[9], interface[9],
+ protocol[10], interface[10], protocol[11], interface[11],
+ protocol[12], interface[12], protocol[13], interface[13],
+ protocol[14], interface[14], protocol[15], interface[15],
+ protocol[16], interface[16], protocol[17], interface[17],
+ protocol[18], interface[18], protocol[19], interface[19],
+ NULL );
+ DBGC ( colour, "= %s ( %s ) -> %p\n",
+ efi_status ( efirc ), efi_handle_name ( *handle ), retaddr );
+ return efirc;
+}
+
+/**
+ * Wrap UninstallMultipleProtocolInterfaces()
+ *
+ */
+static EFI_STATUS EFIAPI
+efi_uninstall_multiple_protocol_interfaces_wrapper ( EFI_HANDLE handle, ... ) {
+ EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
+ void *retaddr = __builtin_return_address ( 0 );
+ EFI_GUID *protocol[ MAX_WRAP_MULTI + 1 ];
+ VOID *interface[MAX_WRAP_MULTI];
+ VA_LIST ap;
+ unsigned int i;
+ EFI_STATUS efirc;
+
+ DBGC ( colour, "UninstallMultipleProtocolInterfaces ( %s",
+ efi_handle_name ( handle ) );
+ memset ( protocol, 0, sizeof ( protocol ) );
+ memset ( interface, 0, sizeof ( interface ) );
+ VA_START ( ap, handle );
+ for ( i = 0 ; ( protocol[i] = VA_ARG ( ap, EFI_GUID * ) ) ; i++ ) {
+ if ( i == MAX_WRAP_MULTI ) {
+ VA_END ( ap );
+ efirc = EFI_OUT_OF_RESOURCES;
+ DBGC ( colour, "<FATAL: too many arguments> ) = %s "
+ "-> %p\n", efi_status ( efirc ), retaddr );
+ return efirc;
+ }
+ interface[i] = VA_ARG ( ap, VOID * );
+ DBGC ( colour, ", %s, %p",
+ efi_guid_ntoa ( protocol[i] ), interface[i] );
+ }
+ VA_END ( ap );
+ DBGC ( colour, " ) " );
+ efirc = bs->UninstallMultipleProtocolInterfaces ( handle,
+ protocol[0], interface[0], protocol[1], interface[1],
+ protocol[2], interface[2], protocol[3], interface[3],
+ protocol[4], interface[4], protocol[5], interface[5],
+ protocol[6], interface[6], protocol[7], interface[7],
+ protocol[8], interface[8], protocol[9], interface[9],
+ protocol[10], interface[10], protocol[11], interface[11],
+ protocol[12], interface[12], protocol[13], interface[13],
+ protocol[14], interface[14], protocol[15], interface[15],
+ protocol[16], interface[16], protocol[17], interface[17],
+ protocol[18], interface[18], protocol[19], interface[19],
+ NULL );
+ DBGC ( colour, "= %s -> %p\n",
+ efi_status ( efirc ), retaddr );
+ return efirc;
+}
+
+/**
+ * Wrap CreateEventEx()
+ *
+ */
+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 ) {
+ EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
+ void *retaddr = __builtin_return_address ( 0 );
+ EFI_STATUS efirc;
+
+ DBGC ( colour, "CreateEventEx ( %#x, %s, %p, %p, %s ) ",
+ type, efi_tpl ( notify_tpl ), notify_function, notify_context,
+ efi_guid_ntoa ( event_group ) );
+ efirc = bs->CreateEventEx ( type, notify_tpl, notify_function,
+ notify_context, event_group, event );
+ DBGC ( colour, "= %s ( %p ) -> %p\n",
+ efi_status ( efirc ), *event, retaddr );
+ return efirc;
+}
+
/**
* Wrap the calls made by a loaded image
*
@@ -565,6 +1139,19 @@ efi_locate_protocol_wrapper ( EFI_GUID *protocol, VOID *registration,
sizeof ( efi_systab_wrapper ) );
memcpy ( &efi_bs_wrapper, bs, sizeof ( efi_bs_wrapper ) );
efi_systab_wrapper.BootServices = &efi_bs_wrapper;
+ efi_bs_wrapper.RaiseTPL = efi_raise_tpl_wrapper;
+ efi_bs_wrapper.RestoreTPL = efi_restore_tpl_wrapper;
+ efi_bs_wrapper.AllocatePages = efi_allocate_pages_wrapper;
+ efi_bs_wrapper.FreePages = efi_free_pages_wrapper;
+ efi_bs_wrapper.GetMemoryMap = efi_get_memory_map_wrapper;
+ efi_bs_wrapper.AllocatePool = efi_allocate_pool_wrapper;
+ efi_bs_wrapper.FreePool = efi_free_pool_wrapper;
+ efi_bs_wrapper.CreateEvent = efi_create_event_wrapper;
+ efi_bs_wrapper.SetTimer = efi_set_timer_wrapper;
+ efi_bs_wrapper.WaitForEvent = efi_wait_for_event_wrapper;
+ efi_bs_wrapper.SignalEvent = efi_signal_event_wrapper;
+ efi_bs_wrapper.CloseEvent = efi_close_event_wrapper;
+ efi_bs_wrapper.CheckEvent = efi_check_event_wrapper;
efi_bs_wrapper.InstallProtocolInterface
= efi_install_protocol_interface_wrapper;
efi_bs_wrapper.ReinstallProtocolInterface
@@ -572,24 +1159,39 @@ efi_locate_protocol_wrapper ( EFI_GUID *protocol, VOID *registration,
efi_bs_wrapper.UninstallProtocolInterface
= efi_uninstall_protocol_interface_wrapper;
efi_bs_wrapper.HandleProtocol = efi_handle_protocol_wrapper;
+ efi_bs_wrapper.RegisterProtocolNotify
+ = efi_register_protocol_notify_wrapper;
efi_bs_wrapper.LocateHandle = efi_locate_handle_wrapper;
efi_bs_wrapper.LocateDevicePath = efi_locate_device_path_wrapper;
+ efi_bs_wrapper.InstallConfigurationTable
+ = efi_install_configuration_table_wrapper;
efi_bs_wrapper.LoadImage = efi_load_image_wrapper;
efi_bs_wrapper.StartImage = efi_start_image_wrapper;
efi_bs_wrapper.Exit = efi_exit_wrapper;
efi_bs_wrapper.UnloadImage = efi_unload_image_wrapper;
efi_bs_wrapper.ExitBootServices = efi_exit_boot_services_wrapper;
+ efi_bs_wrapper.GetNextMonotonicCount
+ = efi_get_next_monotonic_count_wrapper;
+ efi_bs_wrapper.Stall = efi_stall_wrapper;
+ efi_bs_wrapper.SetWatchdogTimer = efi_set_watchdog_timer_wrapper;
efi_bs_wrapper.ConnectController
= efi_connect_controller_wrapper;
efi_bs_wrapper.DisconnectController
= efi_disconnect_controller_wrapper;
efi_bs_wrapper.OpenProtocol = efi_open_protocol_wrapper;
efi_bs_wrapper.CloseProtocol = efi_close_protocol_wrapper;
+ efi_bs_wrapper.OpenProtocolInformation
+ = efi_open_protocol_information_wrapper;
efi_bs_wrapper.ProtocolsPerHandle
= efi_protocols_per_handle_wrapper;
efi_bs_wrapper.LocateHandleBuffer
= efi_locate_handle_buffer_wrapper;
efi_bs_wrapper.LocateProtocol = efi_locate_protocol_wrapper;
+ efi_bs_wrapper.InstallMultipleProtocolInterfaces
+ = efi_install_multiple_protocol_interfaces_wrapper;
+ efi_bs_wrapper.UninstallMultipleProtocolInterfaces
+ = efi_uninstall_multiple_protocol_interfaces_wrapper;
+ efi_bs_wrapper.CreateEventEx = efi_create_event_ex_wrapper;
/* Open loaded image protocol */
if ( ( efirc = bs->OpenProtocol ( handle,