diff options
author | Michael Brown <mcb30@ipxe.org> | 2014-07-16 02:16:24 +0100 |
---|---|---|
committer | Michael Brown <mcb30@ipxe.org> | 2014-07-16 02:29:40 +0100 |
commit | d4a7cbfb649754d9fad3d2afd25433df6c762994 (patch) | |
tree | dfb97a9528ffe990e23e20a6d1dfd5bb80a83225 /src/interface/efi/efi_debug.c | |
parent | c3b6ccf65b21e7f3abda5317b16cb3105af3f272 (diff) | |
download | ipxe-d4a7cbfb649754d9fad3d2afd25433df6c762994.tar.gz |
[efi] Print well-known GUIDs by name in debug messages
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/interface/efi/efi_debug.c')
-rw-r--r-- | src/interface/efi/efi_debug.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/interface/efi/efi_debug.c b/src/interface/efi/efi_debug.c index f1427f511..611f46cef 100644 --- a/src/interface/efi/efi_debug.c +++ b/src/interface/efi/efi_debug.c @@ -34,6 +34,10 @@ FILE_LICENCE ( GPL2_OR_LATER ); #include <ipxe/efi/efi_driver.h> #include <ipxe/efi/Protocol/DevicePath.h> #include <ipxe/efi/Protocol/DevicePathToText.h> +#include <ipxe/efi/Protocol/BlockIo.h> +#include <ipxe/efi/Protocol/DiskIo.h> +#include <ipxe/efi/Protocol/SimpleFileSystem.h> +#include <ipxe/efi/Protocol/SimpleNetwork.h> /** Device path protocol GUID */ static EFI_GUID efi_device_path_protocol_guid @@ -43,6 +47,24 @@ static EFI_GUID efi_device_path_protocol_guid static EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *efidpt; EFI_REQUEST_PROTOCOL ( EFI_DEVICE_PATH_TO_TEXT_PROTOCOL, &efidpt ); +/** A well-known GUID */ +struct efi_well_known_guid { + /** GUID */ + EFI_GUID guid; + /** Name */ + const char *name; +}; + +/** Well-known GUIDs */ +static struct efi_well_known_guid efi_well_known_guids[] = { + { EFI_BLOCK_IO_PROTOCOL_GUID, "BlockIo" }, + { EFI_DISK_IO_PROTOCOL_GUID, "DiskIo" }, + { EFI_DEVICE_PATH_PROTOCOL_GUID, "DevicePath" }, + { EFI_LOADED_IMAGE_PROTOCOL_GUID, "LoadedImage" }, + { EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID, "SimpleFileSystem" }, + { EFI_SIMPLE_NETWORK_PROTOCOL_GUID, "SimpleNetwork" }, +}; + /** * Convert GUID to a printable string * @@ -54,6 +76,16 @@ const char * efi_guid_ntoa ( EFI_GUID *guid ) { union uuid uuid; EFI_GUID guid; } u; + unsigned int i; + + /* Check for a match against well-known GUIDs */ + for ( i = 0 ; i < ( sizeof ( efi_well_known_guids ) / + sizeof ( efi_well_known_guids[0] ) ) ; i++ ) { + if ( memcmp ( guid, &efi_well_known_guids[i].guid, + sizeof ( *guid ) ) == 0 ) { + return efi_well_known_guids[i].name; + } + } /* Convert GUID to standard endianness */ memcpy ( &u.guid, guid, sizeof ( u.guid ) ); |