You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

efi_debug.c 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586
  1. /*
  2. * Copyright (C) 2013 Michael Brown <mbrown@fensystems.co.uk>.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License as
  6. * published by the Free Software Foundation; either version 2 of the
  7. * License, or any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful, but
  10. * WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  17. * 02110-1301, USA.
  18. */
  19. FILE_LICENCE ( GPL2_OR_LATER );
  20. /**
  21. * @file
  22. *
  23. * EFI debugging utilities
  24. *
  25. */
  26. #include <stdio.h>
  27. #include <string.h>
  28. #include <errno.h>
  29. #include <ipxe/uuid.h>
  30. #include <ipxe/efi/efi.h>
  31. #include <ipxe/efi/efi_driver.h>
  32. #include <ipxe/efi/Protocol/BlockIo.h>
  33. #include <ipxe/efi/Protocol/BusSpecificDriverOverride.h>
  34. #include <ipxe/efi/Protocol/ComponentName.h>
  35. #include <ipxe/efi/Protocol/ComponentName2.h>
  36. #include <ipxe/efi/Protocol/DevicePath.h>
  37. #include <ipxe/efi/Protocol/DevicePathToText.h>
  38. #include <ipxe/efi/Protocol/DiskIo.h>
  39. #include <ipxe/efi/Protocol/DriverBinding.h>
  40. #include <ipxe/efi/Protocol/LoadFile.h>
  41. #include <ipxe/efi/Protocol/LoadFile2.h>
  42. #include <ipxe/efi/Protocol/LoadedImage.h>
  43. #include <ipxe/efi/Protocol/PciIo.h>
  44. #include <ipxe/efi/Protocol/PciRootBridgeIo.h>
  45. #include <ipxe/efi/Protocol/SimpleFileSystem.h>
  46. #include <ipxe/efi/Protocol/SimpleNetwork.h>
  47. #include <ipxe/efi/IndustryStandard/PeImage.h>
  48. /** Block I/O protocol GUID */
  49. static EFI_GUID efi_block_io_protocol_guid
  50. = EFI_BLOCK_IO_PROTOCOL_GUID;
  51. /** Bus specific driver override protocol GUID */
  52. static EFI_GUID efi_bus_specific_driver_override_protocol_guid
  53. = EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL_GUID;
  54. /** Component name protocol GUID */
  55. static EFI_GUID efi_component_name_protocol_guid
  56. = EFI_COMPONENT_NAME_PROTOCOL_GUID;
  57. /** Component name 2 protocol GUID */
  58. static EFI_GUID efi_component_name2_protocol_guid
  59. = EFI_COMPONENT_NAME2_PROTOCOL_GUID;
  60. /** Device path protocol GUID */
  61. static EFI_GUID efi_device_path_protocol_guid
  62. = EFI_DEVICE_PATH_PROTOCOL_GUID;
  63. /** Disk I/O protocol GUID */
  64. static EFI_GUID efi_disk_io_protocol_guid
  65. = EFI_DISK_IO_PROTOCOL_GUID;
  66. /** Driver binding protocol GUID */
  67. static EFI_GUID efi_driver_binding_protocol_guid
  68. = EFI_DRIVER_BINDING_PROTOCOL_GUID;
  69. /** Load file protocol GUID */
  70. static EFI_GUID efi_load_file_protocol_guid
  71. = EFI_LOAD_FILE_PROTOCOL_GUID;
  72. /** Load file 2 protocol GUID */
  73. static EFI_GUID efi_load_file2_protocol_guid
  74. = EFI_LOAD_FILE2_PROTOCOL_GUID;
  75. /** Loaded image protocol GUID */
  76. static EFI_GUID efi_loaded_image_protocol_guid
  77. = EFI_LOADED_IMAGE_PROTOCOL_GUID;
  78. /** Loaded image device path protocol GUID */
  79. static EFI_GUID efi_loaded_image_device_path_protocol_guid
  80. = EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL_GUID;
  81. /** PCI I/O protocol GUID */
  82. static EFI_GUID efi_pci_io_protocol_guid
  83. = EFI_PCI_IO_PROTOCOL_GUID;
  84. /** PCI root bridge I/O protocol GUID */
  85. static EFI_GUID efi_pci_root_bridge_io_protocol_guid
  86. = EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GUID;
  87. /** Simple file system protocol GUID */
  88. static EFI_GUID efi_simple_file_system_protocol_guid
  89. = EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID;
  90. /** Simple network protocol guid */
  91. static EFI_GUID efi_simple_network_protocol_guid
  92. = EFI_SIMPLE_NETWORK_PROTOCOL_GUID;
  93. /** Device path to text protocol */
  94. static EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *efidpt;
  95. EFI_REQUEST_PROTOCOL ( EFI_DEVICE_PATH_TO_TEXT_PROTOCOL, &efidpt );
  96. /** A well-known GUID */
  97. struct efi_well_known_guid {
  98. /** GUID */
  99. EFI_GUID *guid;
  100. /** Name */
  101. const char *name;
  102. };
  103. /** Well-known GUIDs */
  104. static struct efi_well_known_guid efi_well_known_guids[] = {
  105. { &efi_block_io_protocol_guid,
  106. "BlockIo" },
  107. { &efi_bus_specific_driver_override_protocol_guid,
  108. "BusSpecificDriverOverride" },
  109. { &efi_component_name2_protocol_guid,
  110. "ComponentName2" },
  111. { &efi_component_name_protocol_guid,
  112. "ComponentName" },
  113. { &efi_device_path_protocol_guid,
  114. "DevicePath" },
  115. { &efi_driver_binding_protocol_guid,
  116. "DriverBinding" },
  117. { &efi_disk_io_protocol_guid,
  118. "DiskIo" },
  119. { &efi_load_file_protocol_guid,
  120. "LoadFile" },
  121. { &efi_load_file2_protocol_guid,
  122. "LoadFile2" },
  123. { &efi_loaded_image_protocol_guid,
  124. "LoadedImage" },
  125. { &efi_loaded_image_device_path_protocol_guid,
  126. "LoadedImageDevicePath"},
  127. { &efi_pci_io_protocol_guid,
  128. "PciIo" },
  129. { &efi_pci_root_bridge_io_protocol_guid,
  130. "PciRootBridgeIo" },
  131. { &efi_simple_file_system_protocol_guid,
  132. "SimpleFileSystem" },
  133. { &efi_simple_network_protocol_guid,
  134. "SimpleNetwork" },
  135. };
  136. /**
  137. * Convert GUID to a printable string
  138. *
  139. * @v guid GUID
  140. * @ret string Printable string
  141. */
  142. const char * efi_guid_ntoa ( EFI_GUID *guid ) {
  143. union {
  144. union uuid uuid;
  145. EFI_GUID guid;
  146. } u;
  147. unsigned int i;
  148. /* Check for a match against well-known GUIDs */
  149. for ( i = 0 ; i < ( sizeof ( efi_well_known_guids ) /
  150. sizeof ( efi_well_known_guids[0] ) ) ; i++ ) {
  151. if ( memcmp ( guid, efi_well_known_guids[i].guid,
  152. sizeof ( *guid ) ) == 0 ) {
  153. return efi_well_known_guids[i].name;
  154. }
  155. }
  156. /* Convert GUID to standard endianness */
  157. memcpy ( &u.guid, guid, sizeof ( u.guid ) );
  158. uuid_mangle ( &u.uuid );
  159. return uuid_ntoa ( &u.uuid );
  160. }
  161. /**
  162. * Name protocol open attributes
  163. *
  164. * @v attributes Protocol open attributes
  165. * @ret name Protocol open attributes name
  166. *
  167. * Returns a (static) string with characters for each set bit
  168. * corresponding to BY_(H)ANDLE_PROTOCOL, (G)ET_PROTOCOL,
  169. * (T)EST_PROTOCOL, BY_(C)HILD_CONTROLLER, BY_(D)RIVER, and
  170. * E(X)CLUSIVE.
  171. */
  172. static const char * efi_open_attributes_name ( unsigned int attributes ) {
  173. static char attribute_chars[] = "HGTCDX";
  174. static char name[ sizeof ( attribute_chars ) ];
  175. char *tmp = name;
  176. unsigned int i;
  177. for ( i = 0 ; i < ( sizeof ( attribute_chars ) - 1 ) ; i++ ) {
  178. if ( attributes & ( 1 << i ) )
  179. *(tmp++) = attribute_chars[i];
  180. }
  181. *tmp = '\0';
  182. return name;
  183. }
  184. /**
  185. * Print list of openers of a given protocol on a given handle
  186. *
  187. * @v handle EFI handle
  188. * @v protocol Protocol GUID
  189. */
  190. void dbg_efi_openers ( EFI_HANDLE handle, EFI_GUID *protocol ) {
  191. EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
  192. EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *openers;
  193. EFI_OPEN_PROTOCOL_INFORMATION_ENTRY *opener;
  194. UINTN count;
  195. unsigned int i;
  196. EFI_STATUS efirc;
  197. int rc;
  198. /* Retrieve list of openers */
  199. if ( ( efirc = bs->OpenProtocolInformation ( handle, protocol, &openers,
  200. &count ) ) != 0 ) {
  201. rc = -EEFI ( efirc );
  202. printf ( "EFI could not retrieve openers for %s on %p: %s\n",
  203. efi_guid_ntoa ( protocol ), handle, strerror ( rc ) );
  204. return;
  205. }
  206. /* Dump list of openers */
  207. for ( i = 0 ; i < count ; i++ ) {
  208. opener = &openers[i];
  209. printf ( "HANDLE %p %s %s opened %dx (%s)",
  210. handle, efi_handle_name ( handle ),
  211. efi_guid_ntoa ( protocol ), opener->OpenCount,
  212. efi_open_attributes_name ( opener->Attributes ) );
  213. printf ( " by %p %s", opener->AgentHandle,
  214. efi_handle_name ( opener->AgentHandle ) );
  215. if ( opener->ControllerHandle == handle ) {
  216. printf ( "\n" );
  217. } else {
  218. printf ( " for %p %s\n", opener->ControllerHandle,
  219. efi_handle_name ( opener->ControllerHandle ) );
  220. }
  221. }
  222. /* Free list */
  223. bs->FreePool ( openers );
  224. }
  225. /**
  226. * Print list of protocol handlers attached to a handle
  227. *
  228. * @v handle EFI handle
  229. */
  230. void dbg_efi_protocols ( EFI_HANDLE handle ) {
  231. EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
  232. EFI_GUID **protocols;
  233. EFI_GUID *protocol;
  234. UINTN count;
  235. unsigned int i;
  236. EFI_STATUS efirc;
  237. int rc;
  238. /* Retrieve list of protocols */
  239. if ( ( efirc = bs->ProtocolsPerHandle ( handle, &protocols,
  240. &count ) ) != 0 ) {
  241. rc = -EEFI ( efirc );
  242. printf ( "EFI could not retrieve protocols for %p: %s\n",
  243. handle, strerror ( rc ) );
  244. return;
  245. }
  246. /* Dump list of protocols */
  247. for ( i = 0 ; i < count ; i++ ) {
  248. protocol = protocols[i];
  249. printf ( "HANDLE %p %s %s supported\n",
  250. handle, efi_handle_name ( handle ),
  251. efi_guid_ntoa ( protocol ) );
  252. dbg_efi_openers ( handle, protocol );
  253. }
  254. /* Free list */
  255. bs->FreePool ( protocols );
  256. }
  257. /**
  258. * Get textual representation of device path
  259. *
  260. * @v path Device path
  261. * @ret text Textual representation of device path, or NULL
  262. */
  263. const char * efi_devpath_text ( EFI_DEVICE_PATH_PROTOCOL *path ) {
  264. EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
  265. static char text[256];
  266. CHAR16 *wtext;
  267. /* Convert path to a textual representation */
  268. if ( ! efidpt )
  269. return NULL;
  270. wtext = efidpt->ConvertDevicePathToText ( path, TRUE, FALSE );
  271. if ( ! wtext )
  272. return NULL;
  273. /* Store path in buffer */
  274. snprintf ( text, sizeof ( text ), "%ls", wtext );
  275. /* Free path */
  276. bs->FreePool ( wtext );
  277. return text;
  278. }
  279. /**
  280. * Get driver name
  281. *
  282. * @v wtf Component name protocol
  283. * @ret name Driver name, or NULL
  284. */
  285. static const char * efi_driver_name ( EFI_COMPONENT_NAME2_PROTOCOL *wtf ) {
  286. static char name[64];
  287. CHAR16 *driver_name;
  288. EFI_STATUS efirc;
  289. /* Try "en" first; if that fails then try the first language */
  290. if ( ( ( efirc = wtf->GetDriverName ( wtf, "en",
  291. &driver_name ) ) != 0 ) &&
  292. ( ( efirc = wtf->GetDriverName ( wtf, wtf->SupportedLanguages,
  293. &driver_name ) ) != 0 ) ) {
  294. return NULL;
  295. }
  296. /* Convert name from CHAR16 to char */
  297. snprintf ( name, sizeof ( name ), "%ls", driver_name );
  298. return name;
  299. }
  300. /**
  301. * Get PE/COFF debug filename
  302. *
  303. * @v loaded Loaded image
  304. * @ret name PE/COFF debug filename, or NULL
  305. */
  306. static const char *
  307. efi_pecoff_debug_name ( EFI_LOADED_IMAGE_PROTOCOL *loaded ) {
  308. static char buf[32];
  309. EFI_IMAGE_DOS_HEADER *dos = loaded->ImageBase;
  310. EFI_IMAGE_OPTIONAL_HEADER_UNION *pe;
  311. EFI_IMAGE_OPTIONAL_HEADER32 *opt32;
  312. EFI_IMAGE_OPTIONAL_HEADER64 *opt64;
  313. EFI_IMAGE_DATA_DIRECTORY *datadir;
  314. EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *debug;
  315. EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY *codeview;
  316. size_t max_len;
  317. char *name;
  318. char *tmp;
  319. /* Parse DOS header */
  320. if ( ! dos ) {
  321. DBGC ( loaded, "Missing DOS header\n" );
  322. return NULL;
  323. }
  324. if ( dos->e_magic != EFI_IMAGE_DOS_SIGNATURE ) {
  325. DBGC ( loaded, "Bad DOS signature\n" );
  326. return NULL;
  327. }
  328. pe = ( loaded->ImageBase + dos->e_lfanew );
  329. /* Parse PE header */
  330. if ( pe->Pe32.Signature != EFI_IMAGE_NT_SIGNATURE ) {
  331. DBGC ( loaded, "Bad PE signature\n" );
  332. return NULL;
  333. }
  334. opt32 = &pe->Pe32.OptionalHeader;
  335. opt64 = &pe->Pe32Plus.OptionalHeader;
  336. if ( opt32->Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC ) {
  337. datadir = opt32->DataDirectory;
  338. } else if ( opt64->Magic == EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC ) {
  339. datadir = opt64->DataDirectory;
  340. } else {
  341. DBGC ( loaded, "Bad optional header signature\n" );
  342. return NULL;
  343. }
  344. /* Parse data directory entry */
  345. if ( ! datadir[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress ) {
  346. DBGC ( loaded, "Empty debug directory entry\n" );
  347. return NULL;
  348. }
  349. debug = ( loaded->ImageBase +
  350. datadir[EFI_IMAGE_DIRECTORY_ENTRY_DEBUG].VirtualAddress );
  351. /* Parse debug directory entry */
  352. if ( debug->Type != EFI_IMAGE_DEBUG_TYPE_CODEVIEW ) {
  353. DBGC ( loaded, "Not a CodeView debug directory entry\n" );
  354. return NULL;
  355. }
  356. codeview = ( loaded->ImageBase + debug->RVA );
  357. /* Parse CodeView entry */
  358. if ( codeview->Signature != CODEVIEW_SIGNATURE_NB10 ) {
  359. DBGC ( loaded, "Bad CodeView signature\n" );
  360. return NULL;
  361. }
  362. name = ( ( ( void * ) codeview ) + sizeof ( *codeview ) );
  363. /* Sanity check - avoid scanning endlessly through memory */
  364. max_len = EFI_PAGE_SIZE; /* Reasonably sane */
  365. if ( strnlen ( name, max_len ) == max_len ) {
  366. DBGC ( loaded, "Excessively long or invalid CodeView name\n" );
  367. return NULL;
  368. }
  369. /* Skip any directory components. We cannot modify this data
  370. * or create a temporary buffer, so do not use basename().
  371. */
  372. while ( ( ( tmp = strchr ( name, '/' ) ) != NULL ) ||
  373. ( ( tmp = strchr ( name, '\\' ) ) != NULL ) ) {
  374. name = ( tmp + 1 );
  375. }
  376. /* Copy base name to buffer */
  377. snprintf ( buf, sizeof ( buf ), "%s", name );
  378. /* Strip file suffix, if present */
  379. if ( ( tmp = strrchr ( name, '.' ) ) != NULL )
  380. *tmp = '\0';
  381. return name;
  382. }
  383. /**
  384. * Get initial loaded image name
  385. *
  386. * @v loaded Loaded image
  387. * @ret name Initial loaded image name, or NULL
  388. */
  389. static const char *
  390. efi_first_loaded_image_name ( EFI_LOADED_IMAGE_PROTOCOL *loaded ) {
  391. return ( ( loaded->ParentHandle == NULL ) ? "DxeCore(?)" : NULL );
  392. }
  393. /**
  394. * Get loaded image name from file path
  395. *
  396. * @v loaded Loaded image
  397. * @ret name Loaded image name, or NULL
  398. */
  399. static const char *
  400. efi_loaded_image_filepath_name ( EFI_LOADED_IMAGE_PROTOCOL *loaded ) {
  401. return efi_devpath_text ( loaded->FilePath );
  402. }
  403. /** An EFI handle name type */
  404. struct efi_handle_name_type {
  405. /** Protocol */
  406. EFI_GUID *protocol;
  407. /**
  408. * Get name
  409. *
  410. * @v interface Protocol interface
  411. * @ret name Name of handle, or NULL on failure
  412. */
  413. const char * ( * name ) ( void *interface );
  414. };
  415. /**
  416. * Define an EFI handle name type
  417. *
  418. * @v protocol Protocol interface
  419. * @v name Method to get name
  420. * @ret type EFI handle name type
  421. */
  422. #define EFI_HANDLE_NAME_TYPE( protocol, name ) { \
  423. (protocol), \
  424. ( const char * ( * ) ( void * ) ) (name), \
  425. }
  426. /** EFI handle name types */
  427. static struct efi_handle_name_type efi_handle_name_types[] = {
  428. /* Device path */
  429. EFI_HANDLE_NAME_TYPE ( &efi_device_path_protocol_guid,
  430. efi_devpath_text ),
  431. /* Driver name (for driver image handles) */
  432. EFI_HANDLE_NAME_TYPE ( &efi_component_name2_protocol_guid,
  433. efi_driver_name ),
  434. /* PE/COFF debug filename (for image handles) */
  435. EFI_HANDLE_NAME_TYPE ( &efi_loaded_image_protocol_guid,
  436. efi_pecoff_debug_name ),
  437. /* Loaded image device path (for image handles) */
  438. EFI_HANDLE_NAME_TYPE ( &efi_loaded_image_device_path_protocol_guid,
  439. efi_devpath_text ),
  440. /* First loaded image name (for the DxeCore image) */
  441. EFI_HANDLE_NAME_TYPE ( &efi_loaded_image_protocol_guid,
  442. efi_first_loaded_image_name ),
  443. /* Handle's loaded image file path (for image handles) */
  444. EFI_HANDLE_NAME_TYPE ( &efi_loaded_image_protocol_guid,
  445. efi_loaded_image_filepath_name ),
  446. };
  447. /**
  448. * Get name of an EFI handle
  449. *
  450. * @v handle EFI handle
  451. * @ret text Name of handle, or NULL
  452. */
  453. const char * efi_handle_name ( EFI_HANDLE handle ) {
  454. EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
  455. struct efi_handle_name_type *type;
  456. unsigned int i;
  457. void *interface;
  458. const char *name;
  459. EFI_STATUS efirc;
  460. /* Fail immediately for NULL handles */
  461. if ( ! handle )
  462. return NULL;
  463. /* Try each name type in turn */
  464. for ( i = 0 ; i < ( sizeof ( efi_handle_name_types ) /
  465. sizeof ( efi_handle_name_types[0] ) ) ; i++ ) {
  466. type = &efi_handle_name_types[i];
  467. /* Try to open the applicable protocol */
  468. efirc = bs->OpenProtocol ( handle, type->protocol, &interface,
  469. efi_image_handle, handle,
  470. EFI_OPEN_PROTOCOL_GET_PROTOCOL );
  471. if ( efirc != 0 )
  472. continue;
  473. /* Try to get name from this protocol */
  474. name = type->name ( interface );
  475. /* Close protocol */
  476. bs->CloseProtocol ( handle, type->protocol,
  477. efi_image_handle, handle );
  478. /* Use this name, if possible */
  479. if ( name && name[0] )
  480. return name;
  481. }
  482. return "UNKNOWN";
  483. }
  484. /**
  485. * Get textual representation of device path for a handle
  486. *
  487. * @v handle EFI handle
  488. * @ret text Textual representation of device path, or NULL
  489. */
  490. const char * efi_handle_devpath_text ( EFI_HANDLE handle ) {
  491. EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
  492. union {
  493. EFI_DEVICE_PATH_PROTOCOL *path;
  494. void *interface;
  495. } path;
  496. const char *text;
  497. EFI_STATUS efirc;
  498. /* Obtain device path, if any */
  499. if ( ( efirc = bs->OpenProtocol ( handle,
  500. &efi_device_path_protocol_guid,
  501. &path.interface, efi_image_handle,
  502. handle,
  503. EFI_OPEN_PROTOCOL_GET_PROTOCOL ))!=0){
  504. return NULL;
  505. }
  506. /* Format device path */
  507. text = efi_devpath_text ( path.path );
  508. /* Close device path */
  509. bs->CloseProtocol ( handle, &efi_device_path_protocol_guid,
  510. efi_image_handle, handle );
  511. return text;
  512. }