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_driver.c 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629
  1. /*
  2. * Copyright (C) 2011 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. #include <stddef.h>
  21. #include <stdlib.h>
  22. #include <stdio.h>
  23. #include <string.h>
  24. #include <errno.h>
  25. #include <ipxe/version.h>
  26. #include <ipxe/efi/efi.h>
  27. #include <ipxe/efi/Protocol/DriverBinding.h>
  28. #include <ipxe/efi/Protocol/ComponentName2.h>
  29. #include <ipxe/efi/Protocol/DevicePath.h>
  30. #include <ipxe/efi/efi_strings.h>
  31. #include <ipxe/efi/efi_driver.h>
  32. /** @file
  33. *
  34. * EFI driver interface
  35. *
  36. */
  37. static EFI_DRIVER_BINDING_PROTOCOL efi_driver_binding;
  38. /** EFI driver binding protocol GUID */
  39. static EFI_GUID efi_driver_binding_protocol_guid
  40. = EFI_DRIVER_BINDING_PROTOCOL_GUID;
  41. /** EFI component name protocol GUID */
  42. static EFI_GUID efi_component_name2_protocol_guid
  43. = EFI_COMPONENT_NAME2_PROTOCOL_GUID;
  44. /** EFI device path protocol GUID */
  45. static EFI_GUID efi_device_path_protocol_guid
  46. = EFI_DEVICE_PATH_PROTOCOL_GUID;
  47. /** List of controlled EFI devices */
  48. static LIST_HEAD ( efi_devices );
  49. /**
  50. * Find end of device path
  51. *
  52. * @v path Path to device
  53. * @ret path_end End of device path
  54. */
  55. EFI_DEVICE_PATH_PROTOCOL * efi_devpath_end ( EFI_DEVICE_PATH_PROTOCOL *path ) {
  56. while ( path->Type != END_DEVICE_PATH_TYPE ) {
  57. path = ( ( ( void * ) path ) +
  58. /* There's this amazing new-fangled thing known as
  59. * a UINT16, but who wants to use one of those? */
  60. ( ( path->Length[1] << 8 ) | path->Length[0] ) );
  61. }
  62. return path;
  63. }
  64. /**
  65. * Find EFI device
  66. *
  67. * @v device EFI device handle
  68. * @ret efidev EFI device, or NULL if not found
  69. */
  70. static struct efi_device * efidev_find ( EFI_HANDLE device ) {
  71. struct efi_device *efidev;
  72. /* Look for an existing EFI device */
  73. list_for_each_entry ( efidev, &efi_devices, dev.siblings ) {
  74. if ( efidev->device == device )
  75. return efidev;
  76. }
  77. return NULL;
  78. }
  79. /**
  80. * Get parent EFI device
  81. *
  82. * @v dev Generic device
  83. * @ret efidev Parent EFI device, or NULL
  84. */
  85. struct efi_device * efidev_parent ( struct device *dev ) {
  86. struct device *parent = dev->parent;
  87. struct efi_device *efidev;
  88. /* Check that parent exists and is an EFI device */
  89. if ( ! parent )
  90. return NULL;
  91. if ( parent->desc.bus_type != BUS_TYPE_EFI )
  92. return NULL;
  93. /* Get containing EFI device */
  94. efidev = container_of ( parent, struct efi_device, dev );
  95. return efidev;
  96. }
  97. /**
  98. * Add EFI device as child of EFI device
  99. *
  100. * @v efidev EFI device
  101. * @v device EFI child device handle
  102. * @ret efirc EFI status code
  103. */
  104. int efidev_child_add ( struct efi_device *efidev, EFI_HANDLE device ) {
  105. EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
  106. void *devpath;
  107. EFI_STATUS efirc;
  108. int rc;
  109. /* Re-open the device path protocol */
  110. if ( ( efirc = bs->OpenProtocol ( efidev->device,
  111. &efi_device_path_protocol_guid,
  112. &devpath,
  113. efi_image_handle, device,
  114. EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
  115. ) ) != 0 ) {
  116. rc = -EEFI ( efirc );
  117. DBGC ( efidev->device, "EFIDRV %p %s could not add child",
  118. efidev->device, efi_handle_name ( efidev->device ) );
  119. DBGC ( efidev->device, " %p %s: %s\n", device,
  120. efi_handle_name ( device ), strerror ( rc ) );
  121. DBGC_EFI_OPENERS ( efidev->device, efidev->device,
  122. &efi_device_path_protocol_guid );
  123. return rc;
  124. }
  125. DBGC2 ( efidev->device, "EFIDRV %p %s added child",
  126. efidev->device, efi_handle_name ( efidev->device ) );
  127. DBGC2 ( efidev->device, " %p %s\n", device, efi_handle_name ( device ));
  128. return 0;
  129. }
  130. /**
  131. * Remove EFI device as child of EFI device
  132. *
  133. * @v efidev EFI device
  134. * @v device EFI child device handle
  135. * @ret efirc EFI status code
  136. */
  137. void efidev_child_del ( struct efi_device *efidev, EFI_HANDLE device ) {
  138. EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
  139. bs->CloseProtocol ( efidev->device,
  140. &efi_device_path_protocol_guid,
  141. efi_image_handle, device );
  142. DBGC2 ( efidev->device, "EFIDRV %p %s removed child",
  143. efidev->device, efi_handle_name ( efidev->device ) );
  144. DBGC2 ( efidev->device, " %p %s\n",
  145. device, efi_handle_name ( device ) );
  146. }
  147. /**
  148. * Check to see if driver supports a device
  149. *
  150. * @v driver EFI driver
  151. * @v device EFI device
  152. * @v child Path to child device, if any
  153. * @ret efirc EFI status code
  154. */
  155. static EFI_STATUS EFIAPI
  156. efi_driver_supported ( EFI_DRIVER_BINDING_PROTOCOL *driver __unused,
  157. EFI_HANDLE device, EFI_DEVICE_PATH_PROTOCOL *child ) {
  158. struct efi_driver *efidrv;
  159. int rc;
  160. DBGCP ( device, "EFIDRV %p %s DRIVER_SUPPORTED",
  161. device, efi_handle_name ( device ) );
  162. if ( child )
  163. DBGCP ( device, " (child %s)", efi_devpath_text ( child ) );
  164. DBGCP ( device, "\n" );
  165. /* Do nothing if we are already driving this device */
  166. if ( efidev_find ( device ) != NULL ) {
  167. DBGCP ( device, "EFIDRV %p %s is already started\n",
  168. device, efi_handle_name ( device ) );
  169. return EFI_ALREADY_STARTED;
  170. }
  171. /* Look for a driver claiming to support this device */
  172. for_each_table_entry ( efidrv, EFI_DRIVERS ) {
  173. if ( ( rc = efidrv->supported ( device ) ) == 0 ) {
  174. DBGC ( device, "EFIDRV %p %s has driver \"%s\"\n",
  175. device, efi_handle_name ( device ),
  176. efidrv->name );
  177. return 0;
  178. }
  179. }
  180. DBGCP ( device, "EFIDRV %p %s has no driver\n",
  181. device, efi_handle_name ( device ) );
  182. return EFI_UNSUPPORTED;
  183. }
  184. /**
  185. * Attach driver to device
  186. *
  187. * @v driver EFI driver
  188. * @v device EFI device
  189. * @v child Path to child device, if any
  190. * @ret efirc EFI status code
  191. */
  192. static EFI_STATUS EFIAPI
  193. efi_driver_start ( EFI_DRIVER_BINDING_PROTOCOL *driver __unused,
  194. EFI_HANDLE device, EFI_DEVICE_PATH_PROTOCOL *child ) {
  195. EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
  196. struct efi_driver *efidrv;
  197. struct efi_device *efidev;
  198. union {
  199. EFI_DEVICE_PATH_PROTOCOL *devpath;
  200. void *interface;
  201. } devpath;
  202. EFI_STATUS efirc;
  203. int rc;
  204. DBGC ( device, "EFIDRV %p %s DRIVER_START",
  205. device, efi_handle_name ( device ) );
  206. if ( child )
  207. DBGC ( device, " (child %s)", efi_devpath_text ( child ) );
  208. DBGC ( device, "\n" );
  209. /* Do nothing if we are already driving this device */
  210. efidev = efidev_find ( device );
  211. if ( efidev ) {
  212. DBGCP ( device, "EFIDRV %p %s is already started\n",
  213. device, efi_handle_name ( device ) );
  214. efirc = EFI_ALREADY_STARTED;
  215. goto err_already_started;
  216. }
  217. /* Allocate and initialise structure */
  218. efidev = zalloc ( sizeof ( *efidev ) );
  219. if ( ! efidev ) {
  220. efirc = EFI_OUT_OF_RESOURCES;
  221. goto err_alloc;
  222. }
  223. efidev->device = device;
  224. efidev->dev.desc.bus_type = BUS_TYPE_EFI;
  225. INIT_LIST_HEAD ( &efidev->dev.children );
  226. list_add ( &efidev->dev.siblings, &efi_devices );
  227. /* Open device path protocol */
  228. if ( ( efirc = bs->OpenProtocol ( device,
  229. &efi_device_path_protocol_guid,
  230. &devpath.interface,
  231. efi_image_handle, device,
  232. EFI_OPEN_PROTOCOL_BY_DRIVER ) ) != 0){
  233. rc = -EEFI ( efirc );
  234. DBGC ( device, "EFIDRV %p %s could not open device path: %s\n",
  235. device, efi_handle_name ( device ),
  236. strerror ( rc ) );
  237. DBGC_EFI_OPENERS ( device, device,
  238. &efi_device_path_protocol_guid );
  239. goto err_no_device_path;
  240. }
  241. efidev->path = devpath.devpath;
  242. /* Try to start this device */
  243. for_each_table_entry ( efidrv, EFI_DRIVERS ) {
  244. if ( ( rc = efidrv->supported ( device ) ) != 0 ) {
  245. DBGC ( device, "EFIDEV %p %s is not supported by "
  246. "driver \"%s\": %s\n", device,
  247. efi_handle_name ( device ), efidrv->name,
  248. strerror ( rc ) );
  249. continue;
  250. }
  251. if ( ( rc = efidrv->start ( efidev ) ) == 0 ) {
  252. efidev->driver = efidrv;
  253. DBGC ( device, "EFIDRV %p %s using driver \"%s\"\n",
  254. device, efi_handle_name ( device ),
  255. efidev->driver->name );
  256. return 0;
  257. }
  258. DBGC ( device, "EFIDRV %p %s could not start driver \"%s\": "
  259. "%s\n", device, efi_handle_name ( device ),
  260. efidrv->name, strerror ( rc ) );
  261. }
  262. efirc = EFI_UNSUPPORTED;
  263. bs->CloseProtocol ( device, &efi_device_path_protocol_guid,
  264. efi_image_handle, device );
  265. err_no_device_path:
  266. list_del ( &efidev->dev.siblings );
  267. free ( efidev );
  268. err_alloc:
  269. err_already_started:
  270. return efirc;
  271. }
  272. /**
  273. * Detach driver from device
  274. *
  275. * @v driver EFI driver
  276. * @v device EFI device
  277. * @v pci PCI device
  278. * @v num_children Number of child devices
  279. * @v children List of child devices
  280. * @ret efirc EFI status code
  281. */
  282. static EFI_STATUS EFIAPI
  283. efi_driver_stop ( EFI_DRIVER_BINDING_PROTOCOL *driver __unused,
  284. EFI_HANDLE device, UINTN num_children,
  285. EFI_HANDLE *children ) {
  286. EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
  287. struct efi_driver *efidrv;
  288. struct efi_device *efidev;
  289. UINTN i;
  290. DBGC ( device, "EFIDRV %p %s DRIVER_STOP",
  291. device, efi_handle_name ( device ) );
  292. for ( i = 0 ; i < num_children ; i++ ) {
  293. DBGC ( device, "%s%p %s", ( i ? ", " : " child " ),
  294. children[i], efi_handle_name ( children[i] ) );
  295. }
  296. DBGC ( device, "\n" );
  297. /* Do nothing unless we are driving this device */
  298. efidev = efidev_find ( device );
  299. if ( ! efidev ) {
  300. DBGCP ( device, "EFIDRV %p %s is not started\n",
  301. device, efi_handle_name ( device ) );
  302. return 0;
  303. }
  304. /* Stop this device */
  305. efidrv = efidev->driver;
  306. assert ( efidrv != NULL );
  307. efidrv->stop ( efidev );
  308. bs->CloseProtocol ( efidev->device, &efi_device_path_protocol_guid,
  309. efi_image_handle, efidev->device );
  310. list_del ( &efidev->dev.siblings );
  311. free ( efidev );
  312. return 0;
  313. }
  314. /** EFI driver binding protocol */
  315. static EFI_DRIVER_BINDING_PROTOCOL efi_driver_binding = {
  316. .Supported = efi_driver_supported,
  317. .Start = efi_driver_start,
  318. .Stop = efi_driver_stop,
  319. };
  320. /**
  321. * Look up driver name
  322. *
  323. * @v wtf Component name protocol
  324. * @v language Language to use
  325. * @v driver_name Driver name to fill in
  326. * @ret efirc EFI status code
  327. */
  328. static EFI_STATUS EFIAPI
  329. efi_driver_name ( EFI_COMPONENT_NAME2_PROTOCOL *wtf __unused,
  330. CHAR8 *language __unused, CHAR16 **driver_name ) {
  331. const wchar_t *name;
  332. name = ( product_wname[0] ? product_wname : build_wname );
  333. *driver_name = ( ( wchar_t * ) name );
  334. return 0;
  335. }
  336. /**
  337. * Look up controller name
  338. *
  339. * @v wtf Component name protocol
  340. * @v device Device
  341. * @v child Child device, or NULL
  342. * @v language Language to use
  343. * @v driver_name Device name to fill in
  344. * @ret efirc EFI status code
  345. */
  346. static EFI_STATUS EFIAPI
  347. efi_driver_controller_name ( EFI_COMPONENT_NAME2_PROTOCOL *wtf __unused,
  348. EFI_HANDLE device, EFI_HANDLE child,
  349. CHAR8 *language, CHAR16 **controller_name ) {
  350. EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
  351. union {
  352. EFI_COMPONENT_NAME2_PROTOCOL *name2;
  353. void *interface;
  354. } name2;
  355. EFI_STATUS efirc;
  356. /* Delegate to the EFI_COMPONENT_NAME2_PROTOCOL instance
  357. * installed on child handle, if present.
  358. */
  359. if ( ( child != NULL ) &&
  360. ( ( efirc = bs->OpenProtocol (
  361. child, &efi_component_name2_protocol_guid,
  362. &name2.interface, NULL, NULL,
  363. EFI_OPEN_PROTOCOL_GET_PROTOCOL ) ) == 0 ) ) {
  364. return name2.name2->GetControllerName ( name2.name2, device,
  365. child, language,
  366. controller_name );
  367. }
  368. /* Otherwise, let EFI use the default Device Path Name */
  369. return EFI_UNSUPPORTED;
  370. }
  371. /** EFI component name protocol */
  372. static EFI_COMPONENT_NAME2_PROTOCOL efi_wtf = {
  373. .GetDriverName = efi_driver_name,
  374. .GetControllerName = efi_driver_controller_name,
  375. .SupportedLanguages = "en",
  376. };
  377. /**
  378. * Install EFI driver
  379. *
  380. * @ret rc Return status code
  381. */
  382. int efi_driver_install ( void ) {
  383. EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
  384. EFI_STATUS efirc;
  385. int rc;
  386. /* Calculate driver version number. We use the build
  387. * timestamp (in seconds since the Epoch) shifted right by six
  388. * bits: this gives us an approximately one-minute resolution
  389. * and a scheme which will last until the year 10680.
  390. */
  391. efi_driver_binding.Version = ( build_timestamp >> 6 );
  392. /* Install protocols on image handle */
  393. efi_driver_binding.ImageHandle = efi_image_handle;
  394. efi_driver_binding.DriverBindingHandle = efi_image_handle;
  395. if ( ( efirc = bs->InstallMultipleProtocolInterfaces (
  396. &efi_image_handle,
  397. &efi_driver_binding_protocol_guid, &efi_driver_binding,
  398. &efi_component_name2_protocol_guid, &efi_wtf,
  399. NULL ) ) != 0 ) {
  400. rc = -EEFI ( efirc );
  401. DBGC ( &efi_driver_binding, "EFIDRV could not install "
  402. "protocols: %s\n", strerror ( rc ) );
  403. return rc;
  404. }
  405. return 0;
  406. }
  407. /**
  408. * Uninstall EFI driver
  409. *
  410. */
  411. void efi_driver_uninstall ( void ) {
  412. EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
  413. /* Uninstall protocols */
  414. bs->UninstallMultipleProtocolInterfaces (
  415. efi_image_handle,
  416. &efi_driver_binding_protocol_guid, &efi_driver_binding,
  417. &efi_component_name2_protocol_guid, &efi_wtf, NULL );
  418. }
  419. /**
  420. * Try to connect EFI driver
  421. *
  422. * @v device EFI device
  423. * @ret rc Return status code
  424. */
  425. static int efi_driver_connect ( EFI_HANDLE device ) {
  426. EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
  427. EFI_HANDLE drivers[2] =
  428. { efi_driver_binding.DriverBindingHandle, NULL };
  429. EFI_STATUS efirc;
  430. int rc;
  431. /* Check if we want to drive this device */
  432. if ( ( efirc = efi_driver_supported ( &efi_driver_binding, device,
  433. NULL ) ) != 0 ) {
  434. /* Not supported; not an error */
  435. return 0;
  436. }
  437. /* Disconnect any existing drivers */
  438. DBGC2 ( device, "EFIDRV %p %s before disconnecting:\n",
  439. device, efi_handle_name ( device ) );
  440. DBGC2_EFI_PROTOCOLS ( device, device );
  441. DBGC ( device, "EFIDRV %p %s disconnecting existing drivers\n",
  442. device, efi_handle_name ( device ) );
  443. if ( ( efirc = bs->DisconnectController ( device, NULL,
  444. NULL ) ) != 0 ) {
  445. rc = -EEFI ( efirc );
  446. DBGC ( device, "EFIDRV %p %s could not disconnect existing "
  447. "drivers: %s\n", device, efi_handle_name ( device ),
  448. strerror ( rc ) );
  449. /* Ignore the error and attempt to connect our drivers */
  450. }
  451. DBGC2 ( device, "EFIDRV %p %s after disconnecting:\n",
  452. device, efi_handle_name ( device ) );
  453. DBGC2_EFI_PROTOCOLS ( device, device );
  454. /* Connect our driver */
  455. DBGC ( device, "EFIDRV %p %s connecting new drivers\n",
  456. device, efi_handle_name ( device ) );
  457. if ( ( efirc = bs->ConnectController ( device, drivers, NULL,
  458. FALSE ) ) != 0 ) {
  459. rc = -EEFI ( efirc );
  460. DBGC ( device, "EFIDRV %p %s could not connect new drivers: "
  461. "%s\n", device, efi_handle_name ( device ),
  462. strerror ( rc ) );
  463. return rc;
  464. }
  465. DBGC2 ( device, "EFIDRV %p %s after connecting:\n",
  466. device, efi_handle_name ( device ) );
  467. DBGC2_EFI_PROTOCOLS ( device, device );
  468. return 0;
  469. }
  470. /**
  471. * Try to disconnect EFI driver
  472. *
  473. * @v device EFI device
  474. * @ret rc Return status code
  475. */
  476. static int efi_driver_disconnect ( EFI_HANDLE device ) {
  477. EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
  478. /* Disconnect our driver */
  479. bs->DisconnectController ( device,
  480. efi_driver_binding.DriverBindingHandle,
  481. NULL );
  482. return 0;
  483. }
  484. /**
  485. * Reconnect original EFI driver
  486. *
  487. * @v device EFI device
  488. * @ret rc Return status code
  489. */
  490. static int efi_driver_reconnect ( EFI_HANDLE device ) {
  491. EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
  492. /* Reconnect any available driver */
  493. bs->ConnectController ( device, NULL, NULL, FALSE );
  494. return 0;
  495. }
  496. /**
  497. * Connect/disconnect EFI driver from all handles
  498. *
  499. * @v method Connect/disconnect method
  500. * @ret rc Return status code
  501. */
  502. static int efi_driver_handles ( int ( * method ) ( EFI_HANDLE handle ) ) {
  503. EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
  504. EFI_HANDLE *handles;
  505. UINTN num_handles;
  506. EFI_STATUS efirc;
  507. UINTN i;
  508. int rc;
  509. /* Enumerate all handles */
  510. if ( ( efirc = bs->LocateHandleBuffer ( AllHandles, NULL, NULL,
  511. &num_handles,
  512. &handles ) ) != 0 ) {
  513. rc = -EEFI ( efirc );
  514. DBGC ( &efi_driver_binding, "EFIDRV could not list handles: "
  515. "%s\n", strerror ( rc ) );
  516. goto err_locate;
  517. }
  518. /* Connect/disconnect driver from all handles */
  519. for ( i = 0 ; i < num_handles ; i++ ) {
  520. if ( ( rc = method ( handles[i] ) ) != 0 )
  521. goto err_method;
  522. }
  523. /* Success */
  524. rc = 0;
  525. err_method:
  526. bs->FreePool ( handles );
  527. err_locate:
  528. return rc;
  529. }
  530. /**
  531. * Connect EFI driver to all possible devices
  532. *
  533. * @ret rc Return status code
  534. */
  535. int efi_driver_connect_all ( void ) {
  536. DBGC ( &efi_driver_binding, "EFIDRV connecting our drivers\n" );
  537. return efi_driver_handles ( efi_driver_connect );
  538. }
  539. /**
  540. * Disconnect EFI driver from all possible devices
  541. *
  542. * @ret rc Return status code
  543. */
  544. void efi_driver_disconnect_all ( void ) {
  545. DBGC ( &efi_driver_binding, "EFIDRV disconnecting our drivers\n" );
  546. efi_driver_handles ( efi_driver_disconnect );
  547. }
  548. /**
  549. * Reconnect original EFI drivers to all possible devices
  550. *
  551. * @ret rc Return status code
  552. */
  553. void efi_driver_reconnect_all ( void ) {
  554. DBGC ( &efi_driver_binding, "EFIDRV reconnecting old drivers\n" );
  555. efi_driver_handles ( efi_driver_reconnect );
  556. }