aboutsummaryrefslogtreecommitdiffstats
path: root/src/interface
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2014-08-01 10:51:15 +0100
committerMichael Brown <mcb30@ipxe.org>2014-08-01 10:51:38 +0100
commitc77859931d44c9d8688fef790aff94ca7ed4d612 (patch)
tree4083aa2344c8dd4f48d816ee4828c3c6d85ab6d3 /src/interface
parent102008f648c6bf81a680a9dcb2d33fe9c15bfc16 (diff)
downloadipxe-c77859931d44c9d8688fef790aff94ca7ed4d612.tar.gz
[efi] Print raw device path when we have no DevicePathToTextProtocol
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/interface')
-rw-r--r--src/interface/efi/efi_debug.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/interface/efi/efi_debug.c b/src/interface/efi/efi_debug.c
index da8efb1e..ea0a71de 100644
--- a/src/interface/efi/efi_debug.c
+++ b/src/interface/efi/efi_debug.c
@@ -30,6 +30,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <string.h>
#include <errno.h>
#include <ipxe/uuid.h>
+#include <ipxe/base16.h>
#include <ipxe/efi/efi.h>
#include <ipxe/efi/efi_driver.h>
#include <ipxe/efi/Protocol/BlockIo.h>
@@ -316,18 +317,31 @@ void dbg_efi_protocols ( EFI_HANDLE handle ) {
const char * efi_devpath_text ( EFI_DEVICE_PATH_PROTOCOL *path ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
static char text[256];
+ void *start;
+ void *end;
+ size_t max_len;
+ size_t len;
CHAR16 *wtext;
/* Sanity checks */
- if ( ! efidpt ) {
- DBG ( "[No DevicePathToText]" );
- return NULL;
- }
if ( ! path ) {
DBG ( "[NULL DevicePath]" );
return NULL;
}
+ /* If we have no DevicePathToText protocol then use a raw hex string */
+ if ( ! efidpt ) {
+ DBG ( "[No DevicePathToText]" );
+ start = path;
+ end = efi_devpath_end ( path );
+ len = ( end - start );
+ max_len = ( ( sizeof ( text ) - 1 /* NUL */ ) / 2 /* "xx" */ );
+ if ( len > max_len )
+ len = max_len;
+ base16_encode ( start, len, text );
+ return text;
+ }
+
/* Convert path to a textual representation */
wtext = efidpt->ConvertDevicePathToText ( path, TRUE, FALSE );
if ( ! wtext )