|
@@ -30,6 +30,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
30
|
30
|
#include <string.h>
|
31
|
31
|
#include <errno.h>
|
32
|
32
|
#include <ipxe/uuid.h>
|
|
33
|
+#include <ipxe/base16.h>
|
33
|
34
|
#include <ipxe/efi/efi.h>
|
34
|
35
|
#include <ipxe/efi/efi_driver.h>
|
35
|
36
|
#include <ipxe/efi/Protocol/BlockIo.h>
|
|
@@ -316,18 +317,31 @@ void dbg_efi_protocols ( EFI_HANDLE handle ) {
|
316
|
317
|
const char * efi_devpath_text ( EFI_DEVICE_PATH_PROTOCOL *path ) {
|
317
|
318
|
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
|
318
|
319
|
static char text[256];
|
|
320
|
+ void *start;
|
|
321
|
+ void *end;
|
|
322
|
+ size_t max_len;
|
|
323
|
+ size_t len;
|
319
|
324
|
CHAR16 *wtext;
|
320
|
325
|
|
321
|
326
|
/* Sanity checks */
|
322
|
|
- if ( ! efidpt ) {
|
323
|
|
- DBG ( "[No DevicePathToText]" );
|
324
|
|
- return NULL;
|
325
|
|
- }
|
326
|
327
|
if ( ! path ) {
|
327
|
328
|
DBG ( "[NULL DevicePath]" );
|
328
|
329
|
return NULL;
|
329
|
330
|
}
|
330
|
331
|
|
|
332
|
+ /* If we have no DevicePathToText protocol then use a raw hex string */
|
|
333
|
+ if ( ! efidpt ) {
|
|
334
|
+ DBG ( "[No DevicePathToText]" );
|
|
335
|
+ start = path;
|
|
336
|
+ end = efi_devpath_end ( path );
|
|
337
|
+ len = ( end - start );
|
|
338
|
+ max_len = ( ( sizeof ( text ) - 1 /* NUL */ ) / 2 /* "xx" */ );
|
|
339
|
+ if ( len > max_len )
|
|
340
|
+ len = max_len;
|
|
341
|
+ base16_encode ( start, len, text );
|
|
342
|
+ return text;
|
|
343
|
+ }
|
|
344
|
+
|
331
|
345
|
/* Convert path to a textual representation */
|
332
|
346
|
wtext = efidpt->ConvertDevicePathToText ( path, TRUE, FALSE );
|
333
|
347
|
if ( ! wtext )
|