aboutsummaryrefslogtreecommitdiffstats
path: root/src/interface
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2020-11-30 16:34:32 +0000
committerMichael Brown <mcb30@ipxe.org>2020-11-30 16:36:08 +0000
commitbe49380f55da3d4b4de85e880a089553ce5f3b78 (patch)
tree46dbab7eb71c7a72ab0da15fa746f3297909293d /src/interface
parent13a6d172964667646b1b3ad382470aca141c2d42 (diff)
downloadipxe-be49380f55da3d4b4de85e880a089553ce5f3b78.tar.gz
[efi] Split out dbg_efi_opener() as a standalone function
Allow external code to dump the information for an opened protocol information entry via DBG_EFI_OPENER() et al. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/interface')
-rw-r--r--src/interface/efi/efi_debug.c39
1 files changed, 24 insertions, 15 deletions
diff --git a/src/interface/efi/efi_debug.c b/src/interface/efi/efi_debug.c
index 7cff14614..6515b92c8 100644
--- a/src/interface/efi/efi_debug.c
+++ b/src/interface/efi/efi_debug.c
@@ -263,6 +263,28 @@ efi_open_attributes_name ( unsigned int attributes ) {
}
/**
+ * 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
*
* @v handle EFI handle
@@ -271,7 +293,6 @@ efi_open_attributes_name ( unsigned int attributes ) {
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;
@@ -296,20 +317,8 @@ void dbg_efi_openers ( EFI_HANDLE handle, EFI_GUID *protocol ) {
}
/* 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 );