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_path.h>
34 #include <ipxe/efi/efi_driver.h>
35 
36 /** @file
37  *
38  * EFI driver interface
39  *
40  */
41 
42 /* Disambiguate the various error causes */
43 #define EINFO_EEFI_CONNECT \
44  __einfo_uniqify ( EINFO_EPLATFORM, 0x01, \
45  "Could not connect controllers" )
46 #define EINFO_EEFI_CONNECT_PROHIBITED \
47  __einfo_platformify ( EINFO_EEFI_CONNECT, \
48  EFI_SECURITY_VIOLATION, \
49  "Connecting controllers prohibited by " \
50  "security policy" )
51 #define EEFI_CONNECT_PROHIBITED \
52  __einfo_error ( EINFO_EEFI_CONNECT_PROHIBITED )
53 #define EEFI_CONNECT( efirc ) EPLATFORM ( EINFO_EEFI_CONNECT, efirc, \
54  EEFI_CONNECT_PROHIBITED )
55 
57 
58 /** List of controlled EFI devices */
59 static LIST_HEAD ( efi_devices );
60 
61 /** We are currently disconnecting drivers */
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 
73  /* Look for an existing EFI device */
74  list_for_each_entry ( efidev, &efi_devices, dev.siblings ) {
75  if ( efidev->device == device )
76  return efidev;
77  }
78 
79  return NULL;
80 }
81 
82 /**
83  * Get parent EFI device
84  *
85  * @v dev Generic device
86  * @ret efidev Parent EFI device, or NULL
87  */
88 struct efi_device * efidev_parent ( struct device *dev ) {
89  struct device *parent;
90  struct efi_device *efidev;
91 
92  /* Walk upwards until we find a registered EFI device */
93  while ( ( parent = dev->parent ) ) {
94  list_for_each_entry ( efidev, &efi_devices, dev.siblings ) {
95  if ( parent == &efidev->dev )
96  return efidev;
97  }
98  dev = parent;
99  }
100 
101  return NULL;
102 }
103 
104 /**
105  * Check to see if driver supports a device
106  *
107  * @v driver EFI driver
108  * @v device EFI device
109  * @v child Path to child device, if any
110  * @ret efirc EFI status code
111  */
112 static EFI_STATUS EFIAPI
115  struct efi_driver *efidrv;
116  int rc;
117 
118  DBGCP ( device, "EFIDRV %s DRIVER_SUPPORTED",
119  efi_handle_name ( device ) );
120  if ( child )
121  DBGCP ( device, " (child %s)", efi_devpath_text ( child ) );
122  DBGCP ( device, "\n" );
123 
124  /* Do nothing if we are already driving this device */
125  if ( efidev_find ( device ) != NULL ) {
126  DBGCP ( device, "EFIDRV %s is already started\n",
127  efi_handle_name ( device ) );
128  return EFI_ALREADY_STARTED;
129  }
130 
131  /* Look for a driver claiming to support this device */
132  for_each_table_entry ( efidrv, EFI_DRIVERS ) {
133  if ( ( rc = efidrv->supported ( device ) ) == 0 ) {
134  DBGC ( device, "EFIDRV %s has driver \"%s\"\n",
135  efi_handle_name ( device ), efidrv->name );
136  return 0;
137  }
138  }
139  DBGCP ( device, "EFIDRV %s has no driver\n",
140  efi_handle_name ( device ) );
141 
142  return EFI_UNSUPPORTED;
143 }
144 
145 /**
146  * Attach driver to device
147  *
148  * @v driver EFI driver
149  * @v device EFI device
150  * @v child Path to child device, if any
151  * @ret efirc EFI status code
152  */
153 static EFI_STATUS EFIAPI
157  struct efi_driver *efidrv;
158  struct efi_device *efidev;
159  struct efi_saved_tpl tpl;
160  union {
162  void *interface;
163  } path;
164  EFI_DEVICE_PATH_PROTOCOL *path_end;
165  size_t path_len;
166  EFI_STATUS efirc;
167  int rc;
168 
169  DBGC ( device, "EFIDRV %s DRIVER_START", efi_handle_name ( device ) );
170  if ( child )
171  DBGC ( device, " (child %s)", efi_devpath_text ( child ) );
172  DBGC ( device, "\n" );
173 
174  /* Do nothing if we are already driving this device */
175  efidev = efidev_find ( device );
176  if ( efidev ) {
177  DBGCP ( device, "EFIDRV %s is already started\n",
178  efi_handle_name ( device ) );
179  efirc = EFI_ALREADY_STARTED;
180  goto err_already_started;
181  }
182 
183  /* Raise TPL */
184  efi_raise_tpl ( &tpl );
185 
186  /* Do nothing if we are currently disconnecting drivers */
187  if ( efi_driver_disconnecting ) {
188  DBGC ( device, "EFIDRV %s refusing to start during "
189  "disconnection\n", efi_handle_name ( device ) );
190  efirc = EFI_NOT_READY;
191  goto err_disconnecting;
192  }
193 
194  /* Open device path */
195  if ( ( efirc = bs->OpenProtocol ( device,
197  &path.interface, efi_image_handle,
198  device,
200  rc = -EEFI ( efirc );
201  DBGC ( device, "EFIDRV %s could not open device path: %s\n",
202  efi_handle_name ( device ), strerror ( rc ) );
203  goto err_open_path;
204  }
205  path_len = ( efi_path_len ( path.path ) + sizeof ( *path_end ) );
206 
207  /* Allocate and initialise structure */
208  efidev = zalloc ( sizeof ( *efidev ) + path_len );
209  if ( ! efidev ) {
210  efirc = EFI_OUT_OF_RESOURCES;
211  goto err_alloc;
212  }
213  efidev->device = device;
214  efidev->dev.desc.bus_type = BUS_TYPE_EFI;
215  efidev->path = ( ( ( void * ) efidev ) + sizeof ( *efidev ) );
216  memcpy ( efidev->path, path.path, path_len );
217  INIT_LIST_HEAD ( &efidev->dev.children );
218  list_add ( &efidev->dev.siblings, &efi_devices );
219 
220  /* Close device path */
223  path.path = NULL;
224 
225  /* Try to start this device */
226  for_each_table_entry ( efidrv, EFI_DRIVERS ) {
227  if ( ( rc = efidrv->supported ( device ) ) != 0 ) {
228  DBGC ( device, "EFIDRV %s is not supported by driver "
229  "\"%s\": %s\n", efi_handle_name ( device ),
230  efidrv->name,
231  strerror ( rc ) );
232  continue;
233  }
234  if ( ( rc = efidrv->start ( efidev ) ) == 0 ) {
235  efidev->driver = efidrv;
236  DBGC ( device, "EFIDRV %s using driver \"%s\"\n",
238  efidev->driver->name );
239  efi_restore_tpl ( &tpl );
240  return 0;
241  }
242  DBGC ( device, "EFIDRV %s could not start driver \"%s\": %s\n",
243  efi_handle_name ( device ), efidrv->name,
244  strerror ( rc ) );
245  }
246  efirc = EFI_UNSUPPORTED;
247 
248  list_del ( &efidev->dev.siblings );
249  free ( efidev );
250  err_alloc:
251  if ( path.path ) {
254  }
255  err_open_path:
256  err_disconnecting:
257  efi_restore_tpl ( &tpl );
258  err_already_started:
259  return efirc;
260 }
261 
262 /**
263  * Detach driver from device
264  *
265  * @v driver EFI driver
266  * @v device EFI device
267  * @v pci PCI device
268  * @v num_children Number of child devices
269  * @v children List of child devices
270  * @ret efirc EFI status code
271  */
272 static EFI_STATUS EFIAPI
274  EFI_HANDLE device, UINTN num_children,
275  EFI_HANDLE *children ) {
276  struct efi_driver *efidrv;
277  struct efi_device *efidev;
278  struct efi_saved_tpl tpl;
279  UINTN i;
280 
281  DBGC ( device, "EFIDRV %s DRIVER_STOP", efi_handle_name ( device ) );
282  for ( i = 0 ; i < num_children ; i++ ) {
283  DBGC ( device, "%s%s", ( i ? ", " : " child " ),
284  efi_handle_name ( children[i] ) );
285  }
286  DBGC ( device, "\n" );
287 
288  /* Do nothing unless we are driving this device */
289  efidev = efidev_find ( device );
290  if ( ! efidev ) {
291  DBGCP ( device, "EFIDRV %s is not started\n",
292  efi_handle_name ( device ) );
293  return EFI_DEVICE_ERROR;
294  }
295 
296  /* Raise TPL */
297  efi_raise_tpl ( &tpl );
298 
299  /* Stop this device */
300  efidrv = efidev->driver;
301  assert ( efidrv != NULL );
302  efidrv->stop ( efidev );
303  list_del ( &efidev->dev.siblings );
304  free ( efidev );
305 
306  efi_restore_tpl ( &tpl );
307  return 0;
308 }
309 
310 /** EFI driver binding protocol */
313  .Start = efi_driver_start,
314  .Stop = efi_driver_stop,
315 };
316 
317 /**
318  * Look up driver name
319  *
320  * @v wtf Component name protocol
321  * @v language Language to use
322  * @v driver_name Driver name to fill in
323  * @ret efirc EFI status code
324  */
325 static EFI_STATUS EFIAPI
327  CHAR8 *language __unused, CHAR16 **driver_name ) {
328  const wchar_t *name;
329 
331  *driver_name = ( ( wchar_t * ) name );
332  return 0;
333 }
334 
335 /**
336  * Look up controller name
337  *
338  * @v wtf Component name protocol
339  * @v device Device
340  * @v child Child device, or NULL
341  * @v language Language to use
342  * @v driver_name Device name to fill in
343  * @ret efirc EFI status code
344  */
345 static EFI_STATUS EFIAPI
348  CHAR8 *language, CHAR16 **controller_name ) {
350  union {
352  void *interface;
353  } name2;
354  EFI_STATUS efirc;
355 
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 (
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 
369  /* Otherwise, let EFI use the default Device Path Name */
370  return EFI_UNSUPPORTED;
371 }
372 
373 /** EFI component name protocol */
376  .GetControllerName = efi_driver_controller_name,
377  .SupportedLanguages = "en",
378 };
379 
380 /**
381  * Install EFI driver
382  *
383  * @ret rc Return status code
384  */
385 int efi_driver_install ( void ) {
387  EFI_STATUS efirc;
388  int rc;
389 
390  /* Calculate driver version number. We use the build
391  * timestamp (in seconds since the Epoch) shifted right by six
392  * bits: this gives us an approximately one-minute resolution
393  * and a scheme which will last until the year 10680.
394  */
396 
397  /* Install protocols on image handle */
400  if ( ( efirc = bs->InstallMultipleProtocolInterfaces (
404  NULL ) ) != 0 ) {
405  rc = -EEFI ( efirc );
406  DBGC ( &efi_driver_binding, "EFIDRV could not install "
407  "protocols: %s\n", strerror ( rc ) );
408  return rc;
409  }
410 
411  return 0;
412 }
413 
414 /**
415  * Uninstall EFI driver
416  *
417  */
418 void efi_driver_uninstall ( void ) {
420 
421  /* Uninstall protocols */
426 }
427 
428 /**
429  * Try to connect EFI driver
430  *
431  * @v device EFI device
432  * @ret rc Return status code
433  */
436  EFI_HANDLE drivers[2] =
438  EFI_STATUS efirc;
439  int rc;
440 
441  /* Check if we want to drive this device */
443  NULL ) ) != 0 ) {
444  /* Not supported; not an error */
445  return 0;
446  }
447 
448  /* Disconnect any existing drivers */
449  DBGC2 ( device, "EFIDRV %s before disconnecting:\n",
450  efi_handle_name ( device ) );
452  DBGC ( device, "EFIDRV %s disconnecting existing drivers\n",
453  efi_handle_name ( device ) );
455  if ( ( efirc = bs->DisconnectController ( device, NULL,
456  NULL ) ) != 0 ) {
457  rc = -EEFI ( efirc );
458  DBGC ( device, "EFIDRV %s could not disconnect existing "
459  "drivers: %s\n", efi_handle_name ( device ),
460  strerror ( rc ) );
461  /* Ignore the error and attempt to connect our drivers */
462  }
464  DBGC2 ( device, "EFIDRV %s after disconnecting:\n",
465  efi_handle_name ( device ) );
467 
468  /* Connect our driver */
469  DBGC ( device, "EFIDRV %s connecting new drivers\n",
470  efi_handle_name ( device ) );
471  if ( ( efirc = bs->ConnectController ( device, drivers, NULL,
472  TRUE ) ) != 0 ) {
473  rc = -EEFI_CONNECT ( efirc );
474  DBGC ( device, "EFIDRV %s could not connect new drivers: "
475  "%s\n", efi_handle_name ( device ), strerror ( rc ) );
476  DBGC ( device, "EFIDRV %s connecting driver directly\n",
477  efi_handle_name ( device ) );
478  if ( ( efirc = efi_driver_start ( &efi_driver_binding, device,
479  NULL ) ) != 0 ) {
480  rc = -EEFI_CONNECT ( efirc );
481  DBGC ( device, "EFIDRV %s could not connect driver "
482  "directly: %s\n", efi_handle_name ( device ),
483  strerror ( rc ) );
484  return rc;
485  }
486  }
487  DBGC2 ( device, "EFIDRV %s after connecting:\n",
488  efi_handle_name ( device ) );
490 
491  return 0;
492 }
493 
494 /**
495  * Try to disconnect EFI driver
496  *
497  * @v device EFI device
498  * @ret rc Return status code
499  */
502 
503  /* Disconnect our driver */
507  NULL );
509  return 0;
510 }
511 
512 /**
513  * Reconnect original EFI driver
514  *
515  * @v device EFI device
516  * @ret rc Return status code
517  */
520 
521  /* Reconnect any available driver */
523 
524  return 0;
525 }
526 
527 /**
528  * Connect/disconnect EFI driver from all handles
529  *
530  * @v method Connect/disconnect method
531  * @ret rc Return status code
532  */
533 static int efi_driver_handles ( int ( * method ) ( EFI_HANDLE handle ) ) {
535  EFI_HANDLE *handles;
536  UINTN num_handles;
537  EFI_STATUS efirc;
538  UINTN i;
539  int rc;
540 
541  /* Enumerate all handles */
542  if ( ( efirc = bs->LocateHandleBuffer ( AllHandles, NULL, NULL,
543  &num_handles,
544  &handles ) ) != 0 ) {
545  rc = -EEFI ( efirc );
546  DBGC ( &efi_driver_binding, "EFIDRV could not list handles: "
547  "%s\n", strerror ( rc ) );
548  goto err_locate;
549  }
550 
551  /* Connect/disconnect driver from all handles */
552  for ( i = 0 ; i < num_handles ; i++ ) {
553  if ( ( rc = method ( handles[i] ) ) != 0 ) {
554  /* Ignore errors and continue to process
555  * remaining handles.
556  */
557  }
558  }
559 
560  /* Success */
561  rc = 0;
562 
563  bs->FreePool ( handles );
564  err_locate:
565  return rc;
566 }
567 
568 /**
569  * Connect EFI driver to all possible devices
570  *
571  * @ret rc Return status code
572  */
574 
575  DBGC ( &efi_driver_binding, "EFIDRV connecting our drivers\n" );
577 }
578 
579 /**
580  * Disconnect EFI driver from all possible devices
581  *
582  * @ret rc Return status code
583  */
585 
586  DBGC ( &efi_driver_binding, "EFIDRV disconnecting our drivers\n" );
588 }
589 
590 /**
591  * Reconnect original EFI drivers to all possible devices
592  *
593  * @ret rc Return status code
594  */
596 
597  DBGC ( &efi_driver_binding, "EFIDRV reconnecting old drivers\n" );
599 }
int efi_driver_connect_all(void)
Connect EFI driver to all possible devices.
Definition: efi_driver.c:573
void efi_driver_uninstall(void)
Uninstall EFI driver.
Definition: efi_driver.c:418
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:434
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:326
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
Definition: efi.h:167
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
void efi_raise_tpl(struct efi_saved_tpl *tpl)
Raise task priority level to TPL_CALLBACK.
Definition: efi_init.c:373
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:346
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:62
static struct efi_device * efidev_find(EFI_HANDLE device)
Find EFI device.
Definition: efi_driver.c:70
#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_path_len(EFI_DEVICE_PATH_PROTOCOL *path)
Find length of device path (excluding terminator)
Definition: efi_path.c:67
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
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:113
#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:595
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
An object interface.
Definition: interface.h:124
#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:154
const char * efi_devpath_text(EFI_DEVICE_PATH_PROTOCOL *path)
Get textual representation of device path.
Definition: efi_debug.c:375
#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:722
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:518
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:533
EFI_HANDLE efi_image_handle
Image handle passed to entry point.
Definition: efi_init.c:33
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:584
#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 EEFI_CONNECT(efirc)
Definition: efi_driver.c:53
EFI device paths.
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
#define TRUE
Definition: tlan.h:46
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
An EFI saved task priority level.
Definition: efi.h:72
#define DBGC2(...)
Definition: compiler.h:522
static EFI_DRIVER_BINDING_PROTOCOL efi_driver_binding
EFI driver binding protocol.
Definition: efi_driver.c:56
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:299
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:273
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
static int efi_driver_disconnect(EFI_HANDLE device)
Try to disconnect EFI driver.
Definition: efi_driver.c:500
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:88
static EFI_COMPONENT_NAME2_PROTOCOL efi_wtf
EFI component name protocol.
Definition: efi_driver.c:374
#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
void efi_restore_tpl(struct efi_saved_tpl *tpl)
Restore task priority level.
Definition: efi_init.c:389
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362
String functions.
int efi_driver_install(void)
Install EFI driver.
Definition: efi_driver.c:385
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