소스 검색

[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>
tags/v1.20.1
Michael Brown 10 년 전
부모
커밋
21c43e44cb
1개의 변경된 파일15개의 추가작업 그리고 9개의 파일을 삭제
  1. 15
    9
      src/interface/efi/efi_debug.c

+ 15
- 9
src/interface/efi/efi_debug.c 파일 보기

@@ -37,7 +37,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
37 37
 
38 38
 /** Device path to text protocol */
39 39
 static EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *efidpt;
40
-EFI_REQUIRE_PROTOCOL ( EFI_DEVICE_PATH_TO_TEXT_PROTOCOL, &efidpt );
40
+EFI_REQUEST_PROTOCOL ( EFI_DEVICE_PATH_TO_TEXT_PROTOCOL, &efidpt );
41 41
 
42 42
 /**
43 43
  * Convert GUID to a printable string
@@ -99,19 +99,25 @@ void dbg_efi_devpath ( EFI_DEVICE_PATH_PROTOCOL *path ) {
99 99
 	size_t len;
100 100
 
101 101
 	/* Convert path to a textual representation */
102
+	if ( ! efidpt )
103
+		goto err_no_efidpt;
102 104
 	text = efidpt->ConvertDevicePathToText ( path, TRUE, FALSE );
103
-	if ( ! text ) {
104
-		printf ( "<cannot convert>:\n" );
105
-		end = efi_devpath_end ( path );
106
-		len = ( ( ( void * ) end ) - ( ( void * ) path ) +
107
-			sizeof ( *end ) );
108
-		dbg_hex_dump_da ( 0, path, len );
109
-		return;
110
-	}
105
+	if ( ! text )
106
+		goto err_convert;
111 107
 
112 108
 	/* Print path */
113 109
 	printf ( "%ls", text );
114 110
 
115 111
 	/* Free path */
116 112
 	bs->FreePool ( text );
113
+
114
+	return;
115
+
116
+ err_convert:
117
+ err_no_efidpt:
118
+	printf ( "<cannot convert>:\n" );
119
+	end = efi_devpath_end ( path );
120
+	len = ( ( ( void * ) end ) - ( ( void * ) path ) +
121
+		sizeof ( *end ) );
122
+	dbg_hex_dump_da ( 0, path, len );
117 123
 }

Loading…
취소
저장