Explorar el Código

[efi] Print well-known GUIDs by name in debug messages

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown hace 10 años
padre
commit
d4a7cbfb64
Se han modificado 1 ficheros con 32 adiciones y 0 borrados
  1. 32
    0
      src/interface/efi/efi_debug.c

+ 32
- 0
src/interface/efi/efi_debug.c Ver fichero

@@ -34,6 +34,10 @@ FILE_LICENCE ( GPL2_OR_LATER );
34 34
 #include <ipxe/efi/efi_driver.h>
35 35
 #include <ipxe/efi/Protocol/DevicePath.h>
36 36
 #include <ipxe/efi/Protocol/DevicePathToText.h>
37
+#include <ipxe/efi/Protocol/BlockIo.h>
38
+#include <ipxe/efi/Protocol/DiskIo.h>
39
+#include <ipxe/efi/Protocol/SimpleFileSystem.h>
40
+#include <ipxe/efi/Protocol/SimpleNetwork.h>
37 41
 
38 42
 /** Device path protocol GUID */
39 43
 static EFI_GUID efi_device_path_protocol_guid
@@ -43,6 +47,24 @@ static EFI_GUID efi_device_path_protocol_guid
43 47
 static EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *efidpt;
44 48
 EFI_REQUEST_PROTOCOL ( EFI_DEVICE_PATH_TO_TEXT_PROTOCOL, &efidpt );
45 49
 
50
+/** A well-known GUID */
51
+struct efi_well_known_guid {
52
+	/** GUID */
53
+	EFI_GUID guid;
54
+	/** Name */
55
+	const char *name;
56
+};
57
+
58
+/** Well-known GUIDs */
59
+static struct efi_well_known_guid efi_well_known_guids[] = {
60
+	{ EFI_BLOCK_IO_PROTOCOL_GUID,		"BlockIo" },
61
+	{ EFI_DISK_IO_PROTOCOL_GUID,		"DiskIo" },
62
+	{ EFI_DEVICE_PATH_PROTOCOL_GUID,	"DevicePath" },
63
+	{ EFI_LOADED_IMAGE_PROTOCOL_GUID,	"LoadedImage" },
64
+	{ EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID,	"SimpleFileSystem" },
65
+	{ EFI_SIMPLE_NETWORK_PROTOCOL_GUID,	"SimpleNetwork" },
66
+};
67
+
46 68
 /**
47 69
  * Convert GUID to a printable string
48 70
  *
@@ -54,6 +76,16 @@ const char * efi_guid_ntoa ( EFI_GUID *guid ) {
54 76
 		union uuid uuid;
55 77
 		EFI_GUID guid;
56 78
 	} u;
79
+	unsigned int i;
80
+
81
+	/* Check for a match against well-known GUIDs */
82
+	for ( i = 0 ; i < ( sizeof ( efi_well_known_guids ) /
83
+			    sizeof ( efi_well_known_guids[0] ) ) ; i++ ) {
84
+		if ( memcmp ( guid, &efi_well_known_guids[i].guid,
85
+			      sizeof ( *guid ) ) == 0 ) {
86
+			return efi_well_known_guids[i].name;
87
+		}
88
+	}
57 89
 
58 90
 	/* Convert GUID to standard endianness */
59 91
 	memcpy ( &u.guid, guid, sizeof ( u.guid ) );

Loading…
Cancelar
Guardar