mirror of https://github.com/ipxe/ipxe.git
[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>pull/10/merge
parent
95cff6a4d8
commit
21c43e44cb
|
@ -37,7 +37,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
||||||
|
|
||||||
/** Device path to text protocol */
|
/** Device path to text protocol */
|
||||||
static EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *efidpt;
|
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
|
* Convert GUID to a printable string
|
||||||
|
@ -99,19 +99,25 @@ void dbg_efi_devpath ( EFI_DEVICE_PATH_PROTOCOL *path ) {
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
/* Convert path to a textual representation */
|
/* Convert path to a textual representation */
|
||||||
|
if ( ! efidpt )
|
||||||
|
goto err_no_efidpt;
|
||||||
text = efidpt->ConvertDevicePathToText ( path, TRUE, FALSE );
|
text = efidpt->ConvertDevicePathToText ( path, TRUE, FALSE );
|
||||||
if ( ! text ) {
|
if ( ! text )
|
||||||
printf ( "<cannot convert>:\n" );
|
goto err_convert;
|
||||||
end = efi_devpath_end ( path );
|
|
||||||
len = ( ( ( void * ) end ) - ( ( void * ) path ) +
|
|
||||||
sizeof ( *end ) );
|
|
||||||
dbg_hex_dump_da ( 0, path, len );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Print path */
|
/* Print path */
|
||||||
printf ( "%ls", text );
|
printf ( "%ls", text );
|
||||||
|
|
||||||
/* Free path */
|
/* Free path */
|
||||||
bs->FreePool ( text );
|
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 );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue