summaryrefslogtreecommitdiffstats
path: root/src/interface
diff options
context:
space:
mode:
authorMichael Brown2014-05-19 21:24:04 +0200
committerMichael Brown2014-05-20 01:31:51 +0200
commit21c43e44cbee8e582abdc9cded06ab012873f176 (patch)
tree82e7101589f7643a819bd78131c29f6805152d61 /src/interface
parent[efi] Allow for optional protocols (diff)
downloadipxe-21c43e44cbee8e582abdc9cded06ab012873f176.tar.gz
ipxe-21c43e44cbee8e582abdc9cded06ab012873f176.tar.xz
ipxe-21c43e44cbee8e582abdc9cded06ab012873f176.zip
[efi] Make EFI_DEVICE_PATH_TO_TEXT_PROTOCOL optional
Some UEFI systems (observed with a Mac Pro) do not provide EFI_DEVICE_PATH_TO_TEXT_PROTOCOL. Since we use this protocol only for debug messages, make it optional and fall back to printing the raw device path bytes. Reported-by: Matt Woodward <pxematt@woodwardcc.com> Tested-by: Matt Woodward <pxematt@woodwardcc.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/interface')
-rw-r--r--src/interface/efi/efi_debug.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/interface/efi/efi_debug.c b/src/interface/efi/efi_debug.c
index 4ed66607..6d834bc8 100644
--- a/src/interface/efi/efi_debug.c
+++ b/src/interface/efi/efi_debug.c
@@ -37,7 +37,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
/** Device path to text protocol */
static EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *efidpt;
-EFI_REQUIRE_PROTOCOL ( EFI_DEVICE_PATH_TO_TEXT_PROTOCOL, &efidpt );
+EFI_REQUEST_PROTOCOL ( EFI_DEVICE_PATH_TO_TEXT_PROTOCOL, &efidpt );
/**
* Convert GUID to a printable string
@@ -99,19 +99,25 @@ void dbg_efi_devpath ( EFI_DEVICE_PATH_PROTOCOL *path ) {
size_t len;
/* Convert path to a textual representation */
+ if ( ! efidpt )
+ goto err_no_efidpt;
text = efidpt->ConvertDevicePathToText ( path, TRUE, FALSE );
- if ( ! text ) {
- printf ( "<cannot convert>:\n" );
- end = efi_devpath_end ( path );
- len = ( ( ( void * ) end ) - ( ( void * ) path ) +
- sizeof ( *end ) );
- dbg_hex_dump_da ( 0, path, len );
- return;
- }
+ if ( ! text )
+ goto err_convert;
/* Print path */
printf ( "%ls", text );
/* Free path */
bs->FreePool ( text );
+
+ return;
+
+ err_convert:
+ err_no_efidpt:
+ printf ( "<cannot convert>:\n" );
+ end = efi_devpath_end ( path );
+ len = ( ( ( void * ) end ) - ( ( void * ) path ) +
+ sizeof ( *end ) );
+ dbg_hex_dump_da ( 0, path, len );
}