Parcourir la source

[efi] Include installed protocol list in unknown handle names

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown il y a 8 ans
Parent
révision
e08d7ccc95
1 fichiers modifiés avec 19 ajouts et 3 suppressions
  1. 19
    3
      src/interface/efi/efi_debug.c

+ 19
- 3
src/interface/efi/efi_debug.c Voir le fichier

@@ -35,6 +35,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
35 35
 #include <errno.h>
36 36
 #include <ipxe/uuid.h>
37 37
 #include <ipxe/base16.h>
38
+#include <ipxe/vsprintf.h>
38 39
 #include <ipxe/efi/efi.h>
39 40
 #include <ipxe/efi/efi_utils.h>
40 41
 #include <ipxe/efi/Protocol/ComponentName.h>
@@ -632,7 +633,10 @@ static struct efi_handle_name_type efi_handle_name_types[] = {
632 633
 const __attribute__ (( pure )) char * efi_handle_name ( EFI_HANDLE handle ) {
633 634
 	EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
634 635
 	struct efi_handle_name_type *type;
635
-	static char buf[32];
636
+	static char buf[256];
637
+	size_t used = 0;
638
+	EFI_GUID **protocols;
639
+	UINTN count;
636 640
 	unsigned int i;
637 641
 	void *interface;
638 642
 	const char *name;
@@ -672,7 +676,19 @@ const __attribute__ (( pure )) char * efi_handle_name ( EFI_HANDLE handle ) {
672 676
 			return name;
673 677
 	}
674 678
 
675
-	/* Use raw handle value if no name found */
676
-	snprintf ( buf, sizeof ( buf ), "UNKNOWN<%p>", handle );
679
+	/* If no name is found, then use the raw handle value and a
680
+	 * list of installed protocols.
681
+	 */
682
+	used = ssnprintf ( buf, sizeof ( buf ), "UNKNOWN<%p", handle );
683
+	if ( ( efirc = bs->ProtocolsPerHandle ( handle, &protocols,
684
+						&count ) ) == 0 ) {
685
+		for ( i = 0 ; i < count ; i++ ) {
686
+			used += ssnprintf ( ( buf + used ),
687
+					    ( sizeof ( buf ) - used ), ",%s",
688
+					    efi_guid_ntoa ( protocols[i] ) );
689
+		}
690
+		bs->FreePool ( protocols );
691
+	}
692
+	used += ssnprintf ( ( buf + used ), ( sizeof ( buf ) - used ), ">" );
677 693
 	return buf;
678 694
 }

Chargement…
Annuler
Enregistrer