Browse Source

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

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 10 years ago
parent
commit
d4a7cbfb64
1 changed files with 32 additions and 0 deletions
  1. 32
    0
      src/interface/efi/efi_debug.c

+ 32
- 0
src/interface/efi/efi_debug.c View File

34
 #include <ipxe/efi/efi_driver.h>
34
 #include <ipxe/efi/efi_driver.h>
35
 #include <ipxe/efi/Protocol/DevicePath.h>
35
 #include <ipxe/efi/Protocol/DevicePath.h>
36
 #include <ipxe/efi/Protocol/DevicePathToText.h>
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
 /** Device path protocol GUID */
42
 /** Device path protocol GUID */
39
 static EFI_GUID efi_device_path_protocol_guid
43
 static EFI_GUID efi_device_path_protocol_guid
43
 static EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *efidpt;
47
 static EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *efidpt;
44
 EFI_REQUEST_PROTOCOL ( EFI_DEVICE_PATH_TO_TEXT_PROTOCOL, &efidpt );
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
  * Convert GUID to a printable string
69
  * Convert GUID to a printable string
48
  *
70
  *
54
 		union uuid uuid;
76
 		union uuid uuid;
55
 		EFI_GUID guid;
77
 		EFI_GUID guid;
56
 	} u;
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
 	/* Convert GUID to standard endianness */
90
 	/* Convert GUID to standard endianness */
59
 	memcpy ( &u.guid, guid, sizeof ( u.guid ) );
91
 	memcpy ( &u.guid, guid, sizeof ( u.guid ) );

Loading…
Cancel
Save