summaryrefslogtreecommitdiffstats
path: root/src/interface
diff options
context:
space:
mode:
authorMichael Brown2015-08-27 16:37:46 +0200
committerMichael Brown2015-08-27 16:40:44 +0200
commite08d7ccc95cf85563053f6cf1e6d4b979e32b7f1 (patch)
tree110bee5c99be10beea32d84a0add1097d5071dca /src/interface
parent[efi] Remove raw EFI_HANDLE values from debug messages (diff)
downloadipxe-e08d7ccc95cf85563053f6cf1e6d4b979e32b7f1.tar.gz
ipxe-e08d7ccc95cf85563053f6cf1e6d4b979e32b7f1.tar.xz
ipxe-e08d7ccc95cf85563053f6cf1e6d4b979e32b7f1.zip
[efi] Include installed protocol list in unknown handle names
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/interface')
-rw-r--r--src/interface/efi/efi_debug.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/interface/efi/efi_debug.c b/src/interface/efi/efi_debug.c
index b48a2c6f..ed881813 100644
--- a/src/interface/efi/efi_debug.c
+++ b/src/interface/efi/efi_debug.c
@@ -35,6 +35,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
#include <errno.h>
#include <ipxe/uuid.h>
#include <ipxe/base16.h>
+#include <ipxe/vsprintf.h>
#include <ipxe/efi/efi.h>
#include <ipxe/efi/efi_utils.h>
#include <ipxe/efi/Protocol/ComponentName.h>
@@ -632,7 +633,10 @@ static struct efi_handle_name_type efi_handle_name_types[] = {
const __attribute__ (( pure )) char * efi_handle_name ( EFI_HANDLE handle ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
struct efi_handle_name_type *type;
- static char buf[32];
+ static char buf[256];
+ size_t used = 0;
+ EFI_GUID **protocols;
+ UINTN count;
unsigned int i;
void *interface;
const char *name;
@@ -672,7 +676,19 @@ const __attribute__ (( pure )) char * efi_handle_name ( EFI_HANDLE handle ) {
return name;
}
- /* Use raw handle value if no name found */
- snprintf ( buf, sizeof ( buf ), "UNKNOWN<%p>", handle );
+ /* If no name is found, then use the raw handle value and a
+ * list of installed protocols.
+ */
+ used = ssnprintf ( buf, sizeof ( buf ), "UNKNOWN<%p", handle );
+ if ( ( efirc = bs->ProtocolsPerHandle ( handle, &protocols,
+ &count ) ) == 0 ) {
+ for ( i = 0 ; i < count ; i++ ) {
+ used += ssnprintf ( ( buf + used ),
+ ( sizeof ( buf ) - used ), ",%s",
+ efi_guid_ntoa ( protocols[i] ) );
+ }
+ bs->FreePool ( protocols );
+ }
+ used += ssnprintf ( ( buf + used ), ( sizeof ( buf ) - used ), ">" );
return buf;
}