iPXE
efi_driver.c
Go to the documentation of this file.
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 
20 FILE_LICENCE ( GPL2_OR_LATER );
21 
22 #include <stddef.h>
23 #include <stdlib.h>
24 #include <stdio.h>
25 #include <string.h>
26 #include <errno.h>
27 #include <ipxe/version.h>
28 #include <ipxe/efi/efi.h>
32 #include <ipxe/efi/efi_strings.h>
33 #include <ipxe/efi/efi_utils.h>
34 #include <ipxe/efi/efi_driver.h>
35 
36 /** @file
37  *
38  * EFI driver interface
39  *
40  */
41 
43 
44 /** List of controlled EFI devices */
45 static LIST_HEAD ( efi_devices );
46 
47 /** We are currently disconnecting drivers */
49 
50 /**
51  * Find EFI device
52  *
53  * @v device EFI device handle
54  * @ret efidev EFI device, or NULL if not found
55  */
56 static struct efi_device * efidev_find ( EFI_HANDLE device ) {
57  struct efi_device *efidev;
58 
59  /* Look for an existing EFI device */
60  list_for_each_entry ( efidev, &efi_devices, dev.siblings ) {
61  if ( efidev->device == device )
62  return efidev;
63  }
64 
65  return NULL;
66 }
67 
68 /**
69  * Get parent EFI device
70  *
71  * @v dev Generic device
72  * @ret efidev Parent EFI device, or NULL
73  */
74 struct efi_device * efidev_parent ( struct device *dev ) {
75  struct device *parent;
76  struct efi_device *efidev;
77 
78  /* Walk upwards until we find a registered EFI device */
79  while ( ( parent = dev->parent ) ) {
80  list_for_each_entry ( efidev, &efi_devices, dev.siblings ) {
81  if ( parent == &efidev->dev )
82  return efidev;
83  }
84  dev = parent;
85  }
86 
87  return NULL;
88 }
89 
90 /**
91  * Check to see if driver supports a device
92  *
93  * @v driver EFI driver
94  * @v device EFI device
95  * @v child Path to child device, if any
96  * @ret efirc EFI status code
97  */
98 static EFI_STATUS EFIAPI
101  struct efi_driver *efidrv;
102  int rc;
103 
104  DBGCP ( device, "EFIDRV %s DRIVER_SUPPORTED",
105  efi_handle_name ( device ) );
106  if ( child )
107  DBGCP ( device, " (child %s)", efi_devpath_text ( child ) );
108  DBGCP ( device, "\n" );
109 
110  /* Do nothing if we are already driving this device */
111  if ( efidev_find ( device ) != NULL ) {
112  DBGCP ( device, "EFIDRV %s is already started\n",
113  efi_handle_name ( device ) );
114  return EFI_ALREADY_STARTED;
115  }
116 
117  /* Look for a driver claiming to support this device */
118  for_each_table_entry ( efidrv, EFI_DRIVERS ) {
119  if ( ( rc = efidrv->supported ( device ) ) == 0 ) {
120  DBGC ( device, "EFIDRV %s has driver \"%s\"\n",
121  efi_handle_name ( device ), efidrv->name );
122  return 0;
123  }
124  }
125  DBGCP ( device, "EFIDRV %s has no driver\n",
126  efi_handle_name ( device ) );
127 
128  return EFI_UNSUPPORTED;
129 }
130 
131 /**
132  * Attach driver to device
133  *
134  * @v driver EFI driver
135  * @v device EFI device
136  * @v child Path to child device, if any
137  * @ret efirc EFI status code
138  */
139 static EFI_STATUS EFIAPI
143  struct efi_driver *efidrv;
144  struct efi_device *efidev;
145  union {
147  void *interface;
148  } path;
149  EFI_DEVICE_PATH_PROTOCOL *path_end;
150  size_t path_len;
151  EFI_TPL saved_tpl;
152  EFI_STATUS efirc;
153  int rc;
154 
155  DBGC ( device, "EFIDRV %s DRIVER_START", efi_handle_name ( device ) );
156  if ( child )
157  DBGC ( device, " (child %s)", efi_devpath_text ( child ) );
158  DBGC ( device, "\n" );
159 
160  /* Do nothing if we are already driving this device */
161  efidev = efidev_find ( device );
162  if ( efidev ) {
163  DBGCP ( device, "EFIDRV %s is already started\n",
164  efi_handle_name ( device ) );
165  efirc = EFI_ALREADY_STARTED;
166  goto err_already_started;
167  }
168 
169  /* Raise TPL */
170  saved_tpl = bs->RaiseTPL ( TPL_CALLBACK );
171 
172  /* Do nothing if we are currently disconnecting drivers */
173  if ( efi_driver_disconnecting ) {
174  DBGC ( device, "EFIDRV %s refusing to start during "
175  "disconnection\n", efi_handle_name ( device ) );
176  efirc = EFI_NOT_READY;
177  goto err_disconnecting;
178  }
179 
180  /* Open device path */
181  if ( ( efirc = bs->OpenProtocol ( device,
183  &path.interface, efi_image_handle,
184  device,
186  rc = -EEFI ( efirc );
187  DBGC ( device, "EFIDRV %s could not open device path: %s\n",
188  efi_handle_name ( device ), strerror ( rc ) );
189  goto err_open_path;
190  }
191  path_len = ( efi_devpath_len ( path.path ) + sizeof ( *path_end ) );
192 
193  /* Allocate and initialise structure */
194  efidev = zalloc ( sizeof ( *efidev ) + path_len );
195  if ( ! efidev ) {
196  efirc = EFI_OUT_OF_RESOURCES;
197  goto err_alloc;
198  }
199  efidev->device = device;
200  efidev->dev.desc.bus_type = BUS_TYPE_EFI;
201  efidev->path = ( ( ( void * ) efidev ) + sizeof ( *efidev ) );
202  memcpy ( efidev->path, path.path, path_len );
203  INIT_LIST_HEAD ( &efidev->dev.children );
204  list_add ( &efidev->dev.siblings, &efi_devices );
205 
206  /* Close device path */
209  path.path = NULL;
210 
211  /* Try to start this device */
212  for_each_table_entry ( efidrv, EFI_DRIVERS ) {
213  if ( ( rc = efidrv->supported ( device ) ) != 0 ) {
214  DBGC ( device, "EFIDRV %s is not supported by driver "
215  "\"%s\": %s\n", efi_handle_name ( device ),
216  efidrv->name,
217  strerror ( rc ) );
218  continue;
219  }
220  if ( ( rc = efidrv->start ( efidev ) ) == 0 ) {
221  efidev->driver = efidrv;
222  DBGC ( device, "EFIDRV %s using driver \"%s\"\n",
224  efidev->driver->name );
225  bs->RestoreTPL ( saved_tpl );
226  return 0;
227  }
228  DBGC ( device, "EFIDRV %s could not start driver \"%s\": %s\n",
229  efi_handle_name ( device ), efidrv->name,
230  strerror ( rc ) );
231  }
232  efirc = EFI_UNSUPPORTED;
233 
234  list_del ( &efidev->dev.siblings );
235  free ( efidev );
236  err_alloc:
237  if ( path.path ) {
240  }
241  err_open_path:
242  err_disconnecting:
243  bs->RestoreTPL ( saved_tpl );
244  err_already_started:
245  return efirc;
246 }
247 
248 /**
249  * Detach driver from device
250  *
251  * @v driver EFI driver
252  * @v device EFI device
253  * @v pci PCI device
254  * @v num_children Number of child devices
255  * @v children List of child devices
256  * @ret efirc EFI status code
257  */
258 static EFI_STATUS EFIAPI
260  EFI_HANDLE device, UINTN num_children,
261  EFI_HANDLE *children ) {
263  struct efi_driver *efidrv;
264  struct efi_device *efidev;
265  EFI_TPL saved_tpl;
266  UINTN i;
267 
268  DBGC ( device, "EFIDRV %s DRIVER_STOP", efi_handle_name ( device ) );
269  for ( i = 0 ; i < num_children ; i++ ) {
270  DBGC ( device, "%s%s", ( i ? ", " : " child " ),
271  efi_handle_name ( children[i] ) );
272  }
273  DBGC ( device, "\n" );
274 
275  /* Do nothing unless we are driving this device */
276  efidev = efidev_find ( device );
277  if ( ! efidev ) {
278  DBGCP ( device, "EFIDRV %s is not started\n",
279  efi_handle_name ( device ) );
280  return EFI_DEVICE_ERROR;
281  }
282 
283  /* Raise TPL */
284  saved_tpl = bs->RaiseTPL ( TPL_CALLBACK );
285 
286  /* Stop this device */
287  efidrv = efidev->driver;
288  assert ( efidrv != NULL );
289  efidrv->stop ( efidev );
290  list_del ( &efidev->dev.siblings );
291  free ( efidev );
292 
293  bs->RestoreTPL ( saved_tpl );
294  return 0;
295 }
296 
297 /** EFI driver binding protocol */
300  .Start = efi_driver_start,
301  .Stop = efi_driver_stop,
302 };
303 
304 /**
305  * Look up driver name
306  *
307  * @v wtf Component name protocol
308  * @v language Language to use
309  * @v driver_name Driver name to fill in
310  * @ret efirc EFI status code
311  */
312 static EFI_STATUS EFIAPI
314  CHAR8 *language __unused, CHAR16 **driver_name ) {
315  const wchar_t *name;
316 
318  *driver_name = ( ( wchar_t * ) name );
319  return 0;
320 }
321 
322 /**
323  * Look up controller name
324  *
325  * @v wtf Component name protocol
326  * @v device Device
327  * @v child Child device, or NULL
328  * @v language Language to use
329  * @v driver_name Device name to fill in
330  * @ret efirc EFI status code
331  */
332 static EFI_STATUS EFIAPI
335  CHAR8 *language, CHAR16 **controller_name ) {
337  union {
339  void *interface;
340  } name2;
341  EFI_STATUS efirc;
342 
343  /* Delegate to the EFI_COMPONENT_NAME2_PROTOCOL instance
344  * installed on child handle, if present.
345  */
346  if ( ( child != NULL ) &&
347  ( ( efirc = bs->OpenProtocol (
349  &name2.interface, NULL, NULL,
350  EFI_OPEN_PROTOCOL_GET_PROTOCOL ) ) == 0 ) ) {
351  return name2.name2->GetControllerName ( name2.name2, device,
352  child, language,
353  controller_name );
354  }
355 
356  /* Otherwise, let EFI use the default Device Path Name */
357  return EFI_UNSUPPORTED;
358 }
359 
360 /** EFI component name protocol */
363  .GetControllerName = efi_driver_controller_name,
364  .SupportedLanguages = "en",
365 };
366 
367 /**
368  * Install EFI driver
369  *
370  * @ret rc Return status code
371  */
372 int efi_driver_install ( void ) {
374  EFI_STATUS efirc;
375  int rc;
376 
377  /* Calculate driver version number. We use the build
378  * timestamp (in seconds since the Epoch) shifted right by six
379  * bits: this gives us an approximately one-minute resolution
380  * and a scheme which will last until the year 10680.
381  */
383 
384  /* Install protocols on image handle */
387  if ( ( efirc = bs->InstallMultipleProtocolInterfaces (
391  NULL ) ) != 0 ) {
392  rc = -EEFI ( efirc );
393  DBGC ( &efi_driver_binding, "EFIDRV could not install "
394  "protocols: %s\n", strerror ( rc ) );
395  return rc;
396  }
397 
398  return 0;
399 }
400 
401 /**
402  * Uninstall EFI driver
403  *
404  */
405 void efi_driver_uninstall ( void ) {
407 
408  /* Uninstall protocols */
413 }
414 
415 /**
416  * Try to connect EFI driver
417  *
418  * @v device EFI device
419  * @ret rc Return status code
420  */
423  EFI_HANDLE drivers[2] =
425  EFI_STATUS efirc;
426  int rc;
427 
428  /* Check if we want to drive this device */
430  NULL ) ) != 0 ) {
431  /* Not supported; not an error */
432  return 0;
433  }
434 
435  /* Disconnect any existing drivers */
436  DBGC2 ( device, "EFIDRV %s before disconnecting:\n",
437  efi_handle_name ( device ) );
439  DBGC ( device, "EFIDRV %s disconnecting existing drivers\n",
440  efi_handle_name ( device ) );
442  if ( ( efirc = bs->DisconnectController ( device, NULL,
443  NULL ) ) != 0 ) {
444  rc = -EEFI ( efirc );
445  DBGC ( device, "EFIDRV %s could not disconnect existing "
446  "drivers: %s\n", efi_handle_name ( device ),
447  strerror ( rc ) );
448  /* Ignore the error and attempt to connect our drivers */
449  }
451  DBGC2 ( device, "EFIDRV %s after disconnecting:\n",
452  efi_handle_name ( device ) );
454 
455  /* Connect our driver */
456  DBGC ( device, "EFIDRV %s connecting new drivers\n",
457  efi_handle_name ( device ) );
458  if ( ( efirc = bs->ConnectController ( device, drivers, NULL,
459  FALSE ) ) != 0 ) {
460  rc = -EEFI ( efirc );
461  DBGC ( device, "EFIDRV %s could not connect new drivers: "
462  "%s\n", efi_handle_name ( device ), strerror ( rc ) );
463  return rc;
464  }
465  DBGC2 ( device, "EFIDRV %s after connecting:\n",
466  efi_handle_name ( device ) );
468 
469  return 0;
470 }
471 
472 /**
473  * Try to disconnect EFI driver
474  *
475  * @v device EFI device
476  * @ret rc Return status code
477  */
480 
481  /* Disconnect our driver */
485  NULL );
487  return 0;
488 }
489 
490 /**
491  * Reconnect original EFI driver
492  *
493  * @v device EFI device
494  * @ret rc Return status code
495  */
498 
499  /* Reconnect any available driver */
501 
502  return 0;
503 }
504 
505 /**
506  * Connect/disconnect EFI driver from all handles
507  *
508  * @v method Connect/disconnect method
509  * @ret rc Return status code
510  */
511 static int efi_driver_handles ( int ( * method ) ( EFI_HANDLE handle ) ) {
513  EFI_HANDLE *handles;
514  UINTN num_handles;
515  EFI_STATUS efirc;
516  UINTN i;
517  int rc;
518 
519  /* Enumerate all handles */
520  if ( ( efirc = bs->LocateHandleBuffer ( AllHandles, NULL, NULL,
521  &num_handles,
522  &handles ) ) != 0 ) {
523  rc = -EEFI ( efirc );
524  DBGC ( &efi_driver_binding, "EFIDRV could not list handles: "
525  "%s\n", strerror ( rc ) );
526  goto err_locate;
527  }
528 
529  /* Connect/disconnect driver from all handles */
530  for ( i = 0 ; i < num_handles ; i++ ) {
531  if ( ( rc = method ( handles[i] ) ) != 0 ) {
532  /* Ignore errors and continue to process
533  * remaining handles.
534  */
535  }
536  }
537 
538  /* Success */
539  rc = 0;
540 
541  bs->FreePool ( handles );
542  err_locate:
543  return rc;
544 }
545 
546 /**
547  * Connect EFI driver to all possible devices
548  *
549  * @ret rc Return status code
550  */
552 
553  DBGC ( &efi_driver_binding, "EFIDRV connecting our drivers\n" );
555 }
556 
557 /**
558  * Disconnect EFI driver from all possible devices
559  *
560  * @ret rc Return status code
561  */
563 
564  DBGC ( &efi_driver_binding, "EFIDRV disconnecting our drivers\n" );
566 }
567 
568 /**
569  * Reconnect original EFI drivers to all possible devices
570  *
571  * @ret rc Return status code
572  */
574 
575  DBGC ( &efi_driver_binding, "EFIDRV reconnecting old drivers\n" );
577 }
int efi_driver_connect_all(void)
Connect EFI driver to all possible devices.
Definition: efi_driver.c:551
void efi_driver_uninstall(void)
Uninstall EFI driver.
Definition: efi_driver.c:405
UEFI DriverBinding Protocol is defined in UEFI specification.
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2000
#define EFI_UNSUPPORTED
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:123
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
const char * name
Definition: ath9k_hw.c:1984
static int efi_driver_connect(EFI_HANDLE device)
Try to connect EFI driver.
Definition: efi_driver.c:421
static EFI_STATUS EFIAPI efi_driver_name(EFI_COMPONENT_NAME2_PROTOCOL *wtf __unused, CHAR8 *language __unused, CHAR16 **driver_name)
Look up driver name.
Definition: efi_driver.c:313
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
Definition: efi.h:157
EFI_RAISE_TPL RaiseTPL
Definition: UefiSpec.h:1845
struct efi_driver * driver
Driver for this device.
Definition: efi_driver.h:25
#define EFI_ALREADY_STARTED
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:140
The device path protocol as defined in UEFI 2.0.
This protocol is used to retrieve user readable names of drivers and controllers managed by UEFI Driv...
EFI driver interface.
FILE_LICENCE(GPL2_OR_LATER)
#define list_add(new, head)
Add a new entry to the head of a list.
Definition: list.h:69
Error codes.
Retrieve all the handles in the handle database.
Definition: UefiSpec.h:1439
EFI_DRIVER_BINDING_SUPPORTED Supported
EFI strings.
static EFI_STATUS EFIAPI efi_driver_controller_name(EFI_COMPONENT_NAME2_PROTOCOL *wtf __unused, EFI_HANDLE device, EFI_HANDLE child, CHAR8 *language, CHAR16 **controller_name)
Look up controller name.
Definition: efi_driver.c:333
void(* stop)(struct efi_device *efidev)
Detach driver from device.
Definition: efi_driver.h:53
static int efi_driver_disconnecting
We are currently disconnecting drivers.
Definition: efi_driver.c:48
static struct efi_device * efidev_find(EFI_HANDLE device)
Find EFI device.
Definition: efi_driver.c:56
#define DBGC(...)
Definition: compiler.h:505
static LIST_HEAD(efi_devices)
List of controlled EFI devices.
EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces
Definition: UefiSpec.h:1915
size_t efi_devpath_len(EFI_DEVICE_PATH_PROTOCOL *path)
Find length of device path (excluding terminator)
Definition: efi_utils.c:59
unsigned short CHAR16
Definition: ProcessorBind.h:59
EFI_HANDLE device
EFI device handle.
Definition: efi_driver.h:21
This protocol can be used on any device handle to obtain generic path/location information concerning...
Definition: DevicePath.h:51
uint8_t method
Definition: ib_mad.h:14
uint16_t device
Device ID.
Definition: ena.h:24
EFI_CLOSE_PROTOCOL CloseProtocol
Definition: UefiSpec.h:1906
struct device * parent
Bus device.
Definition: device.h:85
#define EFI_OUT_OF_RESOURCES
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:129
EFI utilities.
int(* supported)(EFI_HANDLE device)
Check if driver supports device.
Definition: efi_driver.h:40
#define EFI_DEVICE_ERROR
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:127
static EFI_STATUS EFIAPI efi_driver_supported(EFI_DRIVER_BINDING_PROTOCOL *driver __unused, EFI_HANDLE device, EFI_DEVICE_PATH_PROTOCOL *child)
Check to see if driver supports a device.
Definition: efi_driver.c:99
#define list_del(list)
Delete an entry from a list.
Definition: list.h:119
const wchar_t product_wname[]
Wide-character product name string.
Definition: version.c:84
A hardware device.
Definition: device.h:73
char unsigned long const char unsigned long char ** children
Definition: xenstore.h:25
void * memcpy(void *dest, const void *src, size_t len) __nonnull
void efi_driver_reconnect_all(void)
Reconnect original EFI drivers to all possible devices.
Definition: efi_driver.c:573
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
An object interface.
Definition: interface.h:109
#define list_for_each_entry(pos, head, member)
Iterate over entries in a list.
Definition: list.h:420
UEFI Component Name 2 Protocol as defined in the UEFI 2.1 specification.
EFI_COMPONENT_NAME2_GET_DRIVER_NAME GetDriverName
static EFI_STATUS EFIAPI efi_driver_start(EFI_DRIVER_BINDING_PROTOCOL *driver __unused, EFI_HANDLE device, EFI_DEVICE_PATH_PROTOCOL *child)
Attach driver to device.
Definition: efi_driver.c:140
const char * efi_devpath_text(EFI_DEVICE_PATH_PROTOCOL *path)
Get textual representation of device path.
Definition: efi_debug.c:366
#define EFI_OPEN_PROTOCOL_GET_PROTOCOL
Definition: UefiSpec.h:1271
unsigned long build_timestamp
Build timestamp.
Definition: version.c:57
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:713
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
static void(* free)(struct refcnt *refcnt))
Definition: refcnt.h:54
#define EFIAPI
static int efi_driver_reconnect(EFI_HANDLE device)
Reconnect original EFI driver.
Definition: efi_driver.c:496
void * zalloc(size_t size)
Allocate cleared memory.
Definition: malloc.c:624
EFI Boot Services Table.
Definition: UefiSpec.h:1836
static int efi_driver_handles(int(*method)(EFI_HANDLE handle))
Connect/disconnect EFI driver from all handles.
Definition: efi_driver.c:511
EFI_HANDLE efi_image_handle
Image handle passed to entry point.
Definition: efi_init.c:30
EFI_HANDLE DriverBindingHandle
The handle on which this instance of the EFI_DRIVER_BINDING_PROTOCOL is installed.
struct list_head siblings
Devices on the same bus.
Definition: device.h:81
void efi_driver_disconnect_all(void)
Disconnect EFI driver from all possible devices.
Definition: efi_driver.c:562
#define for_each_table_entry(pointer, table)
Iterate through all entries within a linker table.
Definition: tables.h:358
EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces
Definition: UefiSpec.h:1916
EFI_CONNECT_CONTROLLER ConnectController
Definition: UefiSpec.h:1899
#define TPL_CALLBACK
Definition: UefiSpec.h:591
UINT64 UINTN
Unsigned value of native width.
Definition: ProcessorBind.h:71
#define EFI_NOT_READY
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:126
An EFI device.
Definition: efi_driver.h:17
This protocol provides the services required to determine if a driver supports a given controller.
EFI_GUID efi_device_path_protocol_guid
Device path protocol GUID.
Definition: efi_guid.c:132
Version number.
EFI_GUID efi_component_name2_protocol_guid
Component name 2 protocol GUID.
Definition: efi_guid.c:124
#define BUS_TYPE_EFI
EFI bus type.
Definition: device.h:61
EFI_HANDLE ImageHandle
The image handle of the UEFI driver that produced this instance of the EFI_DRIVER_BINDING_PROTOCOL.
EFI_FREE_POOL FreePool
Definition: UefiSpec.h:1855
EFI API.
const wchar_t build_wname[]
Wide-character build name string.
Definition: version.c:90
#define __unused
Declare a variable or data structure as unused.
Definition: compiler.h:573
An EFI driver.
Definition: efi_driver.h:31
#define INIT_LIST_HEAD(list)
Initialise a list head.
Definition: list.h:45
unsigned int bus_type
Bus type.
Definition: device.h:24
UINTN EFI_TPL
Task priority level.
Definition: UefiBaseType.h:47
#define DBGC2(...)
Definition: compiler.h:522
static EFI_DRIVER_BINDING_PROTOCOL efi_driver_binding
EFI driver binding protocol.
Definition: efi_driver.c:42
char CHAR8
Definition: ProcessorBind.h:63
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:35
struct list_head children
Devices attached to this device.
Definition: device.h:83
#define DBGC2_EFI_PROTOCOLS(...)
Definition: efi.h:267
static EFI_STATUS EFIAPI efi_driver_stop(EFI_DRIVER_BINDING_PROTOCOL *driver __unused, EFI_HANDLE device, UINTN num_children, EFI_HANDLE *children)
Detach driver from device.
Definition: efi_driver.c:259
const char * name
Name.
Definition: efi_driver.h:33
struct device_description desc
Device description.
Definition: device.h:79
#define DBGCP(...)
Definition: compiler.h:539
#define FALSE
Definition: tlan.h:45
static int efi_driver_disconnect(EFI_HANDLE device)
Try to disconnect EFI driver.
Definition: efi_driver.c:478
EFI_SYSTEM_TABLE * efi_systab
EFI_OPEN_PROTOCOL OpenProtocol
Definition: UefiSpec.h:1905
EFI_DEVICE_PATH_PROTOCOL * path
EFI device path copy.
Definition: efi_driver.h:23
struct efi_device * efidev_parent(struct device *dev)
Get parent EFI device.
Definition: efi_driver.c:74
static EFI_COMPONENT_NAME2_PROTOCOL efi_wtf
EFI component name protocol.
Definition: efi_driver.c:361
EFI_RESTORE_TPL RestoreTPL
Definition: UefiSpec.h:1846
#define EFI_DRIVERS
EFI driver table.
Definition: efi_driver.h:57
struct device dev
Generic device.
Definition: efi_driver.h:19
uint16_t handle
Handle.
Definition: smbios.h:16
EFI_GUID efi_driver_binding_protocol_guid
Driver binding protocol GUID.
Definition: efi_guid.c:148
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362
String functions.
int efi_driver_install(void)
Install EFI driver.
Definition: efi_driver.c:372
Definition: efi.h:55
EFI_LOCATE_HANDLE_BUFFER LocateHandleBuffer
Definition: UefiSpec.h:1913
int(* start)(struct efi_device *efidev)
Attach driver to device.
Definition: efi_driver.h:47
UINT32 Version
The version number of the UEFI driver that produced the EFI_DRIVER_BINDING_PROTOCOL.
EFI_DISCONNECT_CONTROLLER DisconnectController
Definition: UefiSpec.h:1900