extern const __attribute__ (( pure )) char *
efi_handle_name ( EFI_HANDLE handle );
+extern void dbg_efi_opener ( EFI_HANDLE handle, EFI_GUID *protocol,
+ EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *opener );
extern void dbg_efi_openers ( EFI_HANDLE handle, EFI_GUID *protocol );
extern void dbg_efi_protocols ( EFI_HANDLE handle );
+#define DBG_EFI_OPENER_IF( level, handle, protocol, \
+ opener ) do { \
+ if ( DBG_ ## level ) { \
+ dbg_efi_opener ( handle, protocol, \
+ opener ); \
+ } \
+ } while ( 0 )
+
#define DBG_EFI_OPENERS_IF( level, handle, protocol ) do { \
if ( DBG_ ## level ) { \
dbg_efi_openers ( handle, protocol ); \
} \
} while ( 0 )
+#define DBGC_EFI_OPENER_IF( level, id, ... ) do { \
+ DBG_AC_IF ( level, id ); \
+ DBG_EFI_OPENER_IF ( level, __VA_ARGS__ ); \
+ DBG_DC_IF ( level ); \
+ } while ( 0 )
+
#define DBGC_EFI_OPENERS_IF( level, id, ... ) do { \
DBG_AC_IF ( level, id ); \
DBG_EFI_OPENERS_IF ( level, __VA_ARGS__ ); \
DBG_DC_IF ( level ); \
} while ( 0 )
+#define DBGC_EFI_OPENER( ... ) \
+ DBGC_EFI_OPENER_IF ( LOG, ##__VA_ARGS__ )
#define DBGC_EFI_OPENERS( ... ) \
DBGC_EFI_OPENERS_IF ( LOG, ##__VA_ARGS__ )
#define DBGC_EFI_PROTOCOLS( ... ) \
DBGC_EFI_PROTOCOLS_IF ( LOG, ##__VA_ARGS__ )
+#define DBGC2_EFI_OPENER( ... ) \
+ DBGC_EFI_OPENER_IF ( EXTRA, ##__VA_ARGS__ )
#define DBGC2_EFI_OPENERS( ... ) \
DBGC_EFI_OPENERS_IF ( EXTRA, ##__VA_ARGS__ )
#define DBGC2_EFI_PROTOCOLS( ... ) \
DBGC_EFI_PROTOCOLS_IF ( EXTRA, ##__VA_ARGS__ )
+#define DBGCP_EFI_OPENER( ... ) \
+ DBGC_EFI_OPENER_IF ( PROFILE, ##__VA_ARGS__ )
#define DBGCP_EFI_OPENERS( ... ) \
DBGC_EFI_OPENERS_IF ( PROFILE, ##__VA_ARGS__ )
#define DBGCP_EFI_PROTOCOLS( ... ) \
return name;
}
+/**
+ * Print opened protocol information
+ *
+ * @v handle EFI handle
+ * @V protocol Protocol GUID
+ * @v opener Opened protocol information
+ */
+void dbg_efi_opener ( EFI_HANDLE handle, EFI_GUID *protocol,
+ EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *opener ) {
+
+ printf ( "HANDLE %s %s opened %dx (%s)", efi_handle_name ( handle ),
+ efi_guid_ntoa ( protocol ), opener->OpenCount,
+ efi_open_attributes_name ( opener->Attributes ) );
+ printf ( " by %s", efi_handle_name ( opener->AgentHandle ) );
+ if ( opener->ControllerHandle == handle ) {
+ printf ( "\n" );
+ } else {
+ printf ( " for %s\n",
+ efi_handle_name ( opener->ControllerHandle ) );
+ }
+}
+
/**
* Print list of openers of a given protocol on a given handle
*
void dbg_efi_openers ( EFI_HANDLE handle, EFI_GUID *protocol ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *openers;
- EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *opener;
UINTN count;
unsigned int i;
EFI_STATUS efirc;
}
/* Dump list of openers */
- for ( i = 0 ; i < count ; i++ ) {
- opener = &openers[i];
- printf ( "HANDLE %s %s opened %dx (%s)",
- efi_handle_name ( handle ),
- efi_guid_ntoa ( protocol ), opener->OpenCount,
- efi_open_attributes_name ( opener->Attributes ) );
- printf ( " by %s", efi_handle_name ( opener->AgentHandle ) );
- if ( opener->ControllerHandle == handle ) {
- printf ( "\n" );
- } else {
- printf ( " for %s\n",
- efi_handle_name ( opener->ControllerHandle ) );
- }
- }
+ for ( i = 0 ; i < count ; i++ )
+ dbg_efi_opener ( handle, protocol, &openers[i] );
/* Free list */
bs->FreePool ( openers );