mirror of https://github.com/ipxe/ipxe.git
[efi] Print raw device path when we have no DevicePathToTextProtocol
Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/20/merge
parent
102008f648
commit
c77859931d
|
@ -30,6 +30,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <ipxe/uuid.h>
|
#include <ipxe/uuid.h>
|
||||||
|
#include <ipxe/base16.h>
|
||||||
#include <ipxe/efi/efi.h>
|
#include <ipxe/efi/efi.h>
|
||||||
#include <ipxe/efi/efi_driver.h>
|
#include <ipxe/efi/efi_driver.h>
|
||||||
#include <ipxe/efi/Protocol/BlockIo.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 ) {
|
const char * efi_devpath_text ( EFI_DEVICE_PATH_PROTOCOL *path ) {
|
||||||
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
|
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
|
||||||
static char text[256];
|
static char text[256];
|
||||||
|
void *start;
|
||||||
|
void *end;
|
||||||
|
size_t max_len;
|
||||||
|
size_t len;
|
||||||
CHAR16 *wtext;
|
CHAR16 *wtext;
|
||||||
|
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
if ( ! efidpt ) {
|
|
||||||
DBG ( "[No DevicePathToText]" );
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if ( ! path ) {
|
if ( ! path ) {
|
||||||
DBG ( "[NULL DevicePath]" );
|
DBG ( "[NULL DevicePath]" );
|
||||||
return NULL;
|
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 */
|
/* Convert path to a textual representation */
|
||||||
wtext = efidpt->ConvertDevicePathToText ( path, TRUE, FALSE );
|
wtext = efidpt->ConvertDevicePathToText ( path, TRUE, FALSE );
|
||||||
if ( ! wtext )
|
if ( ! wtext )
|
||||||
|
|
Loading…
Reference in New Issue