iPXE
Functions | Variables
efi_driver.c File Reference

EFI driver interface. More...

#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <ipxe/version.h>
#include <ipxe/efi/efi.h>
#include <ipxe/efi/Protocol/DriverBinding.h>
#include <ipxe/efi/Protocol/ComponentName2.h>
#include <ipxe/efi/Protocol/DevicePath.h>
#include <ipxe/efi/efi_strings.h>
#include <ipxe/efi/efi_path.h>
#include <ipxe/efi/efi_driver.h>

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER)
 
 FILE_SECBOOT (PERMITTED)
 
static LIST_HEAD (efi_devices)
 List of controlled EFI devices. More...
 
struct efi_deviceefidev_alloc (EFI_HANDLE device)
 Allocate new EFI device. More...
 
void efidev_free (struct efi_device *efidev)
 Free EFI device. More...
 
static struct efi_deviceefidev_find (EFI_HANDLE device)
 Find EFI device. More...
 
struct efi_deviceefidev_parent (struct device *dev)
 Get parent EFI device. More...
 
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. More...
 
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. More...
 
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. More...
 
static EFI_STATUS EFIAPI efi_driver_name (EFI_COMPONENT_NAME2_PROTOCOL *wtf __unused, CHAR8 *language __unused, CHAR16 **driver_name)
 Look up driver name. More...
 
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. More...
 
int efi_driver_install (void)
 Install EFI driver. More...
 
void efi_driver_uninstall (void)
 Uninstall EFI driver. More...
 
int efi_driver_exclude (EFI_HANDLE device, EFI_GUID *protocol)
 Try to disconnect an existing EFI driver. More...
 
static int efi_driver_connect (EFI_HANDLE device)
 Try to connect EFI driver. More...
 
static int efi_driver_disconnect (EFI_HANDLE device)
 Try to disconnect EFI driver. More...
 
static int efi_driver_reconnect (EFI_HANDLE device)
 Reconnect original EFI driver. More...
 
static int efi_driver_handles (int(*method)(EFI_HANDLE handle))
 Connect/disconnect EFI driver from all handles. More...
 
int efi_driver_connect_all (void)
 Connect EFI driver to all possible devices. More...
 
void efi_driver_disconnect_all (void)
 Disconnect EFI driver from all possible devices. More...
 
void efi_driver_reconnect_all (void)
 Reconnect original EFI drivers to all possible devices. More...
 

Variables

static EFI_DRIVER_BINDING_PROTOCOL efi_driver_binding
 EFI driver binding protocol. More...
 
static int efi_driver_disconnecting
 We are currently disconnecting drivers. More...
 
static EFI_COMPONENT_NAME2_PROTOCOL efi_wtf
 EFI component name protocol. More...
 

Detailed Description

EFI driver interface.

Definition in file efi_driver.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER  )

◆ FILE_SECBOOT()

FILE_SECBOOT ( PERMITTED  )

◆ LIST_HEAD()

static LIST_HEAD ( efi_devices  )
static

List of controlled EFI devices.

◆ efidev_alloc()

struct efi_device* efidev_alloc ( EFI_HANDLE  device)

Allocate new EFI device.

Parameters
deviceEFI device handle
Return values
efidevEFI device, or NULL on error

Definition at line 57 of file efi_driver.c.

57  {
58  struct efi_device *efidev = NULL;
60  EFI_DEVICE_PATH_PROTOCOL *path_end;
61  size_t path_len;
62  int rc;
63 
64  /* Open device path */
66  &path ) ) != 0 ) {
67  DBGC ( device, "EFIDRV %s could not open device path: %s\n",
68  efi_handle_name ( device ), strerror ( rc ) );
69  return NULL;
70  }
71  path_len = ( efi_path_len ( path ) + sizeof ( *path_end ) );
72 
73  /* Allocate and initialise structure */
74  efidev = zalloc ( sizeof ( *efidev ) + path_len );
75  if ( ! efidev )
76  return NULL;
77  efidev->device = device;
78  efidev->dev.desc.bus_type = BUS_TYPE_EFI;
79  efidev->path = ( ( ( void * ) efidev ) + sizeof ( *efidev ) );
80  memcpy ( efidev->path, path, path_len );
81  INIT_LIST_HEAD ( &efidev->dev.children );
82  list_add ( &efidev->dev.siblings, &efi_devices );
83 
84  return efidev;
85 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define list_add(new, head)
Add a new entry to the head of a list.
Definition: list.h:70
#define DBGC(...)
Definition: compiler.h:505
size_t efi_path_len(EFI_DEVICE_PATH_PROTOCOL *path)
Find length of device path (excluding terminator)
Definition: efi_path.c:174
EFI_HANDLE device
EFI device handle.
Definition: efi_driver.h:22
This protocol can be used on any device handle to obtain generic path/location information concerning...
Definition: DevicePath.h:46
uint16_t device
Device ID.
Definition: ena.h:24
A hardware device.
Definition: device.h:77
void * memcpy(void *dest, const void *src, size_t len) __nonnull
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:652
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:79
void * zalloc(size_t size)
Allocate cleared memory.
Definition: malloc.c:662
struct list_head siblings
Devices on the same bus.
Definition: device.h:85
#define efi_open(handle, protocol, interface)
Open protocol for ephemeral use.
Definition: efi.h:444
An EFI device.
Definition: efi_driver.h:18
EFI_GUID efi_device_path_protocol_guid
Device path protocol GUID.
Definition: efi_guid.c:169
#define BUS_TYPE_EFI
EFI bus type.
Definition: device.h:62
#define INIT_LIST_HEAD(list)
Initialise a list head.
Definition: list.h:46
unsigned int bus_type
Bus type.
Definition: device.h:25
struct list_head children
Devices attached to this device.
Definition: device.h:87
struct device_description desc
Device description.
Definition: device.h:83
EFI_DEVICE_PATH_PROTOCOL * path
EFI device path copy.
Definition: efi_driver.h:26
struct device dev
Generic device.
Definition: efi_driver.h:20
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322

References device_description::bus_type, BUS_TYPE_EFI, device::children, DBGC, device::desc, efi_device::dev, efi_device::device, device, efi_device_path_protocol_guid, efi_handle_name(), efi_open, efi_path_len(), INIT_LIST_HEAD, list_add, memcpy(), NULL, efi_device::path, rc, device::siblings, strerror(), and zalloc().

Referenced by efi_driver_start(), and mnptemp_create().

◆ efidev_free()

void efidev_free ( struct efi_device efidev)

Free EFI device.

Parameters
efidevEFI device

Definition at line 92 of file efi_driver.c.

92  {
93 
94  assert ( list_empty ( &efidev->dev.children ) );
95  list_del ( &efidev->dev.siblings );
96  free ( efidev );
97 }
#define list_empty(list)
Test whether a list is empty.
Definition: list.h:137
#define list_del(list)
Delete an entry from a list.
Definition: list.h:120
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
static void(* free)(struct refcnt *refcnt))
Definition: refcnt.h:55
struct list_head siblings
Devices on the same bus.
Definition: device.h:85
struct list_head children
Devices attached to this device.
Definition: device.h:87
struct device dev
Generic device.
Definition: efi_driver.h:20

References assert(), device::children, efi_device::dev, free, list_del, list_empty, and device::siblings.

Referenced by efi_driver_start(), efi_driver_stop(), mnptemp_create(), and mnptemp_destroy().

◆ efidev_find()

static struct efi_device* efidev_find ( EFI_HANDLE  device)
static

Find EFI device.

Parameters
deviceEFI device handle (or child handle)
Return values
efidevEFI device, or NULL if not found

Definition at line 105 of file efi_driver.c.

105  {
106  struct efi_device *efidev;
107 
108  /* Avoid false positive matches against NULL children */
109  if ( ! device )
110  return NULL;
111 
112  /* Look for an existing EFI device */
113  list_for_each_entry ( efidev, &efi_devices, dev.siblings ) {
114  if ( ( device == efidev->device ) ||
115  ( device == efidev->child ) ) {
116  return efidev;
117  }
118  }
119 
120  return NULL;
121 }
EFI_HANDLE device
EFI device handle.
Definition: efi_driver.h:22
EFI_HANDLE child
EFI child device handle (if present)
Definition: efi_driver.h:24
A hardware device.
Definition: device.h:77
#define list_for_each_entry(pos, head, member)
Iterate over entries in a list.
Definition: list.h:432
struct list_head siblings
Devices on the same bus.
Definition: device.h:85
An EFI device.
Definition: efi_driver.h:18
struct device dev
Generic device.
Definition: efi_driver.h:20
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322

References efi_device::child, efi_device::dev, efi_device::device, list_for_each_entry, NULL, and device::siblings.

Referenced by efi_driver_start(), efi_driver_stop(), and efi_driver_supported().

◆ efidev_parent()

struct efi_device* efidev_parent ( struct device dev)

Get parent EFI device.

Parameters
devGeneric device
Return values
efidevParent EFI device, or NULL

Definition at line 129 of file efi_driver.c.

129  {
130  struct device *parent;
131  struct efi_device *efidev;
132 
133  /* Walk upwards until we find a registered EFI device */
134  while ( ( parent = dev->parent ) ) {
135  list_for_each_entry ( efidev, &efi_devices, dev.siblings ) {
136  if ( parent == &efidev->dev )
137  return efidev;
138  }
139  dev = parent;
140  }
141 
142  return NULL;
143 }
struct device * parent
Bus device.
Definition: device.h:89
A hardware device.
Definition: device.h:77
#define list_for_each_entry(pos, head, member)
Iterate over entries in a list.
Definition: list.h:432
struct list_head siblings
Devices on the same bus.
Definition: device.h:85
An EFI device.
Definition: efi_driver.h:18
struct device dev
Generic device.
Definition: efi_driver.h:20
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322

References efi_device::dev, list_for_each_entry, NULL, device::parent, and device::siblings.

Referenced by efi_parent_path(), and efi_snp_probe().

◆ efi_driver_supported()

static EFI_STATUS EFIAPI efi_driver_supported ( EFI_DRIVER_BINDING_PROTOCOL *driver  __unused,
EFI_HANDLE  device,
EFI_DEVICE_PATH_PROTOCOL child 
)
static

Check to see if driver supports a device.

Parameters
driverEFI driver
deviceEFI device
childPath to child device, if any
Return values
efircEFI status code

Definition at line 154 of file efi_driver.c.

155  {
156  struct efi_driver *efidrv;
157  unsigned int count;
158  int rc;
159 
160  DBGCP ( device, "EFIDRV %s DRIVER_SUPPORTED",
161  efi_handle_name ( device ) );
162  if ( child )
163  DBGCP ( device, " (child %s)", efi_devpath_text ( child ) );
164  DBGCP ( device, "\n" );
165 
166  /* Do nothing if we are already driving this device */
167  if ( efidev_find ( device ) != NULL ) {
168  DBGCP ( device, "EFIDRV %s is already started\n",
169  efi_handle_name ( device ) );
170  return EFI_ALREADY_STARTED;
171  }
172 
173  /* Count drivers claiming to support this device */
174  count = 0;
175  for_each_table_entry ( efidrv, EFI_DRIVERS ) {
176  if ( ( rc = efidrv->supported ( device ) ) == 0 ) {
177  DBGC ( device, "EFIDRV %s has driver \"%s\"\n",
178  efi_handle_name ( device ), efidrv->name );
179  count++;
180  }
181  }
182 
183  /* Check that we have at least one driver */
184  if ( ! count ) {
185  DBGCP ( device, "EFIDRV %s has no driver\n",
186  efi_handle_name ( device ) );
187  return EFI_UNSUPPORTED;
188  }
189 
190  return 0;
191 }
#define EFI_UNSUPPORTED
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:118
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define EFI_ALREADY_STARTED
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:135
static struct efi_device * efidev_find(EFI_HANDLE device)
Find EFI device.
Definition: efi_driver.c:105
#define DBGC(...)
Definition: compiler.h:505
int(* supported)(EFI_HANDLE device)
Check if driver supports device.
Definition: efi_driver.h:50
A hardware device.
Definition: device.h:77
static unsigned int count
Number of entries.
Definition: dwmac.h:225
const char * efi_devpath_text(EFI_DEVICE_PATH_PROTOCOL *path)
Get textual representation of device path.
Definition: efi_debug.c:247
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:652
#define for_each_table_entry(pointer, table)
Iterate through all entries within a linker table.
Definition: tables.h:386
An EFI driver.
Definition: efi_driver.h:34
const char * name
Name.
Definition: efi_driver.h:36
#define DBGCP(...)
Definition: compiler.h:539
#define EFI_DRIVERS
EFI driver table.
Definition: efi_driver.h:67
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322

References count, DBGC, DBGCP, EFI_ALREADY_STARTED, efi_devpath_text(), EFI_DRIVERS, efi_handle_name(), EFI_UNSUPPORTED, efidev_find(), for_each_table_entry, efi_driver::name, NULL, rc, and efi_driver::supported.

Referenced by efi_driver_connect().

◆ efi_driver_start()

static EFI_STATUS EFIAPI efi_driver_start ( EFI_DRIVER_BINDING_PROTOCOL *driver  __unused,
EFI_HANDLE  device,
EFI_DEVICE_PATH_PROTOCOL child 
)
static

Attach driver to device.

Parameters
driverEFI driver
deviceEFI device
childPath to child device, if any
Return values
efircEFI status code

Definition at line 202 of file efi_driver.c.

203  {
204  struct efi_driver *efidrv;
205  struct efi_device *efidev;
206  struct efi_saved_tpl tpl;
207  EFI_STATUS efirc;
208  int rc;
209 
210  DBGC ( device, "EFIDRV %s DRIVER_START", efi_handle_name ( device ) );
211  if ( child )
212  DBGC ( device, " (child %s)", efi_devpath_text ( child ) );
213  DBGC ( device, "\n" );
214 
215  /* Do nothing if we are already driving this device */
216  efidev = efidev_find ( device );
217  if ( efidev ) {
218  DBGCP ( device, "EFIDRV %s is already started\n",
219  efi_handle_name ( device ) );
220  efirc = EFI_ALREADY_STARTED;
221  goto err_already_started;
222  }
223 
224  /* Raise TPL */
225  efi_raise_tpl ( &tpl );
226 
227  /* Do nothing if we are currently disconnecting drivers */
228  if ( efi_driver_disconnecting ) {
229  DBGC ( device, "EFIDRV %s refusing to start during "
230  "disconnection\n", efi_handle_name ( device ) );
231  efirc = EFI_NOT_READY;
232  goto err_disconnecting;
233  }
234 
235  /* Add new device */
236  efidev = efidev_alloc ( device );
237  if ( ! efidev ) {
238  efirc = EFI_OUT_OF_RESOURCES;
239  goto err_alloc;
240  }
241 
242  /* Try to start this device */
243  for_each_table_entry ( efidrv, EFI_DRIVERS ) {
244  if ( ( rc = efidrv->supported ( device ) ) != 0 ) {
245  DBGC ( device, "EFIDRV %s is not supported by driver "
246  "\"%s\": %s\n", efi_handle_name ( device ),
247  efidrv->name,
248  strerror ( rc ) );
249  continue;
250  }
251  if ( ( rc = efidrv->start ( efidev ) ) == 0 ) {
252  efidev->driver = efidrv;
253  DBGC ( device, "EFIDRV %s using driver \"%s\"\n",
255  efidev->driver->name );
256  efi_restore_tpl ( &tpl );
257  return 0;
258  }
259  DBGC ( device, "EFIDRV %s could not start driver \"%s\": %s\n",
260  efi_handle_name ( device ), efidrv->name,
261  strerror ( rc ) );
262  }
263  efirc = EFI_UNSUPPORTED;
264 
265  efidev_free ( efidev );
266  err_alloc:
267  err_disconnecting:
268  efi_restore_tpl ( &tpl );
269  err_already_started:
270  return efirc;
271 }
#define EFI_UNSUPPORTED
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:118
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
struct efi_driver * driver
Driver for this device.
Definition: efi_driver.h:28
#define EFI_ALREADY_STARTED
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:135
void efi_raise_tpl(struct efi_saved_tpl *tpl)
Raise task priority level to internal level.
Definition: efi_init.c:383
void efidev_free(struct efi_device *efidev)
Free EFI device.
Definition: efi_driver.c:92
static int efi_driver_disconnecting
We are currently disconnecting drivers.
Definition: efi_driver.c:49
static struct efi_device * efidev_find(EFI_HANDLE device)
Find EFI device.
Definition: efi_driver.c:105
#define DBGC(...)
Definition: compiler.h:505
#define EFI_OUT_OF_RESOURCES
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:124
int(* supported)(EFI_HANDLE device)
Check if driver supports device.
Definition: efi_driver.h:50
A hardware device.
Definition: device.h:77
struct efi_device * efidev_alloc(EFI_HANDLE device)
Allocate new EFI device.
Definition: efi_driver.c:57
const char * efi_devpath_text(EFI_DEVICE_PATH_PROTOCOL *path)
Get textual representation of device path.
Definition: efi_debug.c:247
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:652
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:79
#define for_each_table_entry(pointer, table)
Iterate through all entries within a linker table.
Definition: tables.h:386
#define EFI_NOT_READY
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:121
An EFI device.
Definition: efi_driver.h:18
An EFI driver.
Definition: efi_driver.h:34
An EFI saved task priority level.
Definition: efi.h:80
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
const char * name
Name.
Definition: efi_driver.h:36
#define DBGCP(...)
Definition: compiler.h:539
#define EFI_DRIVERS
EFI driver table.
Definition: efi_driver.h:67
void efi_restore_tpl(struct efi_saved_tpl *tpl)
Restore task priority level.
Definition: efi_init.c:399
int(* start)(struct efi_device *efidev)
Attach driver to device.
Definition: efi_driver.h:57

References DBGC, DBGCP, efi_device::driver, EFI_ALREADY_STARTED, efi_devpath_text(), efi_driver_disconnecting, EFI_DRIVERS, efi_handle_name(), EFI_NOT_READY, EFI_OUT_OF_RESOURCES, efi_raise_tpl(), efi_restore_tpl(), EFI_UNSUPPORTED, efidev_alloc(), efidev_find(), efidev_free(), for_each_table_entry, efi_driver::name, rc, efi_driver::start, strerror(), and efi_driver::supported.

Referenced by efi_driver_connect().

◆ efi_driver_stop()

static EFI_STATUS EFIAPI efi_driver_stop ( EFI_DRIVER_BINDING_PROTOCOL *driver  __unused,
EFI_HANDLE  device,
UINTN  num_children,
EFI_HANDLE children 
)
static

Detach driver from device.

Parameters
driverEFI driver
deviceEFI device
pciPCI device
num_childrenNumber of child devices
childrenList of child devices
Return values
efircEFI status code

Definition at line 284 of file efi_driver.c.

286  {
287  struct efi_driver *efidrv;
288  struct efi_device *efidev;
289  struct efi_saved_tpl tpl;
290  UINTN i;
291 
292  DBGC ( device, "EFIDRV %s DRIVER_STOP", efi_handle_name ( device ) );
293  for ( i = 0 ; i < num_children ; i++ ) {
294  DBGC ( device, "%s%s", ( i ? ", " : " child " ),
295  efi_handle_name ( children[i] ) );
296  }
297  DBGC ( device, "\n" );
298 
299  /* Do nothing unless we are driving this device */
300  efidev = efidev_find ( device );
301  if ( ! efidev ) {
302  DBGCP ( device, "EFIDRV %s is not started\n",
303  efi_handle_name ( device ) );
304  return 0;
305  }
306 
307  /* Raise TPL */
308  efi_raise_tpl ( &tpl );
309 
310  /* Stop this device */
311  efidrv = efidev->driver;
312  assert ( efidrv != NULL );
313  efidrv->stop ( efidev );
314  efidev_free ( efidev );
315 
316  efi_restore_tpl ( &tpl );
317  return 0;
318 }
struct efi_driver * driver
Driver for this device.
Definition: efi_driver.h:28
void efi_raise_tpl(struct efi_saved_tpl *tpl)
Raise task priority level to internal level.
Definition: efi_init.c:383
void(* stop)(struct efi_device *efidev)
Detach driver from device.
Definition: efi_driver.h:63
void efidev_free(struct efi_device *efidev)
Free EFI device.
Definition: efi_driver.c:92
static struct efi_device * efidev_find(EFI_HANDLE device)
Find EFI device.
Definition: efi_driver.c:105
#define DBGC(...)
Definition: compiler.h:505
A hardware device.
Definition: device.h:77
char unsigned long const char unsigned long char ** children
Definition: xenstore.h:26
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:652
UINT64 UINTN
Unsigned value of native width.
An EFI device.
Definition: efi_driver.h:18
An EFI driver.
Definition: efi_driver.h:34
An EFI saved task priority level.
Definition: efi.h:80
#define DBGCP(...)
Definition: compiler.h:539
void efi_restore_tpl(struct efi_saved_tpl *tpl)
Restore task priority level.
Definition: efi_init.c:399
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322

References assert(), children, DBGC, DBGCP, efi_device::driver, efi_handle_name(), efi_raise_tpl(), efi_restore_tpl(), efidev_find(), efidev_free(), NULL, and efi_driver::stop.

◆ efi_driver_name()

static EFI_STATUS EFIAPI efi_driver_name ( EFI_COMPONENT_NAME2_PROTOCOL *wtf  __unused,
CHAR8 *language  __unused,
CHAR16 **  driver_name 
)
static

Look up driver name.

Parameters
wtfComponent name protocol
languageLanguage to use
driver_nameDriver name to fill in
Return values
efircEFI status code

Definition at line 336 of file efi_driver.c.

337  {
338  const wchar_t *name;
339 
341  *driver_name = ( ( wchar_t * ) name );
342  return 0;
343 }
const char * name
Definition: ath9k_hw.c:1986
const wchar_t product_wname[]
Wide-character product name string.
Definition: version.c:86
const wchar_t build_wname[]
Wide-character build name string.
Definition: version.c:92

References build_wname, name, and product_wname.

◆ efi_driver_controller_name()

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 
)
static

Look up controller name.

Parameters
wtfComponent name protocol
deviceDevice
childChild device, or NULL
languageLanguage to use
driver_nameDevice name to fill in
Return values
efircEFI status code

Definition at line 356 of file efi_driver.c.

358  {
360  int rc;
361 
362  /* Delegate to the EFI_COMPONENT_NAME2_PROTOCOL instance
363  * installed on child handle, if present.
364  */
365  if ( ( child != NULL ) &&
367  &name2 ) ) == 0 ) ) {
368  return name2->GetControllerName ( name2, device, child,
369  language, controller_name );
370  }
371 
372  /* Otherwise, let EFI use the default Device Path Name */
373  return EFI_UNSUPPORTED;
374 }
#define EFI_UNSUPPORTED
Enumeration of EFI_STATUS.
Definition: UefiBaseType.h:118
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
This protocol is used to retrieve user readable names of drivers and controllers managed by UEFI Driv...
EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME GetControllerName
A hardware device.
Definition: device.h:77
#define efi_open(handle, protocol, interface)
Open protocol for ephemeral use.
Definition: efi.h:444
EFI_GUID efi_component_name2_protocol_guid
Component name 2 protocol GUID.
Definition: efi_guid.c:161
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322

References efi_component_name2_protocol_guid, efi_open, EFI_UNSUPPORTED, _EFI_COMPONENT_NAME2_PROTOCOL::GetControllerName, NULL, and rc.

◆ efi_driver_install()

int efi_driver_install ( void  )

Install EFI driver.

Return values
rcReturn status code

Definition at line 388 of file efi_driver.c.

388  {
390  EFI_STATUS efirc;
391  int rc;
392 
393  /* Calculate driver version number. We use the build
394  * timestamp (in seconds since the Epoch) shifted right by six
395  * bits: this gives us an approximately one-minute resolution
396  * and a scheme which will last until the year 10680.
397  */
399 
400  /* Install protocols on image handle */
403  if ( ( efirc = bs->InstallMultipleProtocolInterfaces (
407  NULL ) ) != 0 ) {
408  rc = -EEFI ( efirc );
409  DBGC ( &efi_driver_binding, "EFIDRV could not install "
410  "protocols: %s\n", strerror ( rc ) );
411  return rc;
412  }
413 
414  return 0;
415 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
Definition: efi.h:175
#define DBGC(...)
Definition: compiler.h:505
EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces
Definition: UefiSpec.h:2010
unsigned long build_timestamp
Build timestamp.
Definition: version.c:59
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:79
EFI Boot Services Table.
Definition: UefiSpec.h:1931
EFI_HANDLE efi_image_handle
Image handle passed to entry point.
Definition: efi_init.c:36
EFI_HANDLE DriverBindingHandle
The handle on which this instance of the EFI_DRIVER_BINDING_PROTOCOL is installed.
EFI_GUID efi_component_name2_protocol_guid
Component name 2 protocol GUID.
Definition: efi_guid.c:161
EFI_HANDLE ImageHandle
The image handle of the UEFI driver that produced this instance of the EFI_DRIVER_BINDING_PROTOCOL.
static EFI_DRIVER_BINDING_PROTOCOL efi_driver_binding
EFI driver binding protocol.
Definition: efi_driver.c:43
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
EFI_SYSTEM_TABLE * efi_systab
static EFI_COMPONENT_NAME2_PROTOCOL efi_wtf
EFI component name protocol.
Definition: efi_driver.c:377
EFI_GUID efi_driver_binding_protocol_guid
Driver binding protocol GUID.
Definition: efi_guid.c:209
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322
UINT32 Version
The version number of the UEFI driver that produced the EFI_DRIVER_BINDING_PROTOCOL.

References EFI_SYSTEM_TABLE::BootServices, build_timestamp, DBGC, _EFI_DRIVER_BINDING_PROTOCOL::DriverBindingHandle, EEFI, efi_component_name2_protocol_guid, efi_driver_binding, efi_driver_binding_protocol_guid, efi_image_handle, efi_systab, efi_wtf, _EFI_DRIVER_BINDING_PROTOCOL::ImageHandle, EFI_BOOT_SERVICES::InstallMultipleProtocolInterfaces, NULL, rc, strerror(), and _EFI_DRIVER_BINDING_PROTOCOL::Version.

Referenced by efi_init().

◆ efi_driver_uninstall()

void efi_driver_uninstall ( void  )

Uninstall EFI driver.

Definition at line 421 of file efi_driver.c.

421  {
423 
424  /* Uninstall protocols */
429 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
EFI Boot Services Table.
Definition: UefiSpec.h:1931
EFI_HANDLE efi_image_handle
Image handle passed to entry point.
Definition: efi_init.c:36
EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces
Definition: UefiSpec.h:2011
EFI_GUID efi_component_name2_protocol_guid
Component name 2 protocol GUID.
Definition: efi_guid.c:161
static EFI_DRIVER_BINDING_PROTOCOL efi_driver_binding
EFI driver binding protocol.
Definition: efi_driver.c:43
EFI_SYSTEM_TABLE * efi_systab
static EFI_COMPONENT_NAME2_PROTOCOL efi_wtf
EFI component name protocol.
Definition: efi_driver.c:377
EFI_GUID efi_driver_binding_protocol_guid
Driver binding protocol GUID.
Definition: efi_guid.c:209
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322

References EFI_SYSTEM_TABLE::BootServices, efi_component_name2_protocol_guid, efi_driver_binding, efi_driver_binding_protocol_guid, efi_image_handle, efi_systab, efi_wtf, NULL, and EFI_BOOT_SERVICES::UninstallMultipleProtocolInterfaces.

Referenced by efi_init(), and efi_unload().

◆ efi_driver_exclude()

int efi_driver_exclude ( EFI_HANDLE  device,
EFI_GUID protocol 
)

Try to disconnect an existing EFI driver.

Parameters
deviceEFI device
protocolProtocol GUID
Return values
rcReturn status code

Definition at line 438 of file efi_driver.c.

438  {
442  EFI_HANDLE driver;
443  UINTN count;
444  unsigned int i;
445  EFI_STATUS efirc;
446  int rc;
447 
448  /* Retrieve list of openers */
449  if ( ( efirc = bs->OpenProtocolInformation ( device, protocol, &openers,
450  &count ) ) != 0 ) {
451  rc = -EEFI ( efirc );
452  DBGC ( device, "EFIDRV %s could not list %s openers: %s\n",
454  strerror ( rc ) );
455  goto err_list;
456  }
457 
458  /* Identify BY_DRIVER opener */
459  driver = NULL;
460  for ( i = 0 ; i < count ; i++ ) {
461  opener = &openers[i];
462  if ( opener->Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER ) {
463  driver = opener->AgentHandle;
464  break;
465  }
466  }
467 
468  /* Try to disconnect driver */
469  DBGC ( device, "EFIDRV %s disconnecting %s drivers\n",
471  if ( driver ) {
472  DBGC ( device, "EFIDRV %s disconnecting %s driver ",
474  DBGC ( device, "%s\n", efi_handle_name ( driver ) );
475  if ( ( rc = efi_disconnect ( device, driver ) ) != 0 ) {
476  DBGC ( device, "EFIDRV %s could not disconnect ",
477  efi_handle_name ( device ) );
478  DBGC ( device, "%s: %s\n",
479  efi_handle_name ( driver ), strerror ( rc ) );
480  goto err_disconnect;
481  }
482  }
483 
484  /* Success */
485  rc = 0;
486 
487  err_disconnect:
488  bs->FreePool ( openers );
489  err_list:
490  return rc;
491 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
EFI Oprn Protocol Information Entry.
Definition: UefiSpec.h:1432
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
Definition: efi.h:175
EFI_HANDLE AgentHandle
Definition: UefiSpec.h:1433
#define DBGC(...)
Definition: compiler.h:505
#define EFI_OPEN_PROTOCOL_BY_DRIVER
Definition: UefiSpec.h:1358
A hardware device.
Definition: device.h:77
UINT32 Attributes
Definition: UefiSpec.h:1435
static unsigned int count
Number of entries.
Definition: dwmac.h:225
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:652
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:79
EFI Boot Services Table.
Definition: UefiSpec.h:1931
UINT64 UINTN
Unsigned value of native width.
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
Definition: efi_guid.c:726
EFI_FREE_POOL FreePool
Definition: UefiSpec.h:1950
EFI_OPEN_PROTOCOL_INFORMATION OpenProtocolInformation
Definition: UefiSpec.h:2002
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
EFI_SYSTEM_TABLE * efi_systab
uint16_t protocol
Protocol ID.
Definition: stp.h:19
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322
Definition: efi.h:62
int efi_disconnect(EFI_HANDLE device, EFI_HANDLE driver)
Disconnect UEFI driver(s)
Definition: efi_connect.c:90

References EFI_OPEN_PROTOCOL_INFORMATION_ENTRY::AgentHandle, EFI_OPEN_PROTOCOL_INFORMATION_ENTRY::Attributes, EFI_SYSTEM_TABLE::BootServices, count, DBGC, EEFI, efi_disconnect(), efi_guid_ntoa(), efi_handle_name(), EFI_OPEN_PROTOCOL_BY_DRIVER, efi_systab, EFI_BOOT_SERVICES::FreePool, NULL, EFI_BOOT_SERVICES::OpenProtocolInformation, protocol, rc, and strerror().

Referenced by efipci_exclude(), nii_exclude(), snpnet_exclude(), and usbio_exclude().

◆ efi_driver_connect()

static int efi_driver_connect ( EFI_HANDLE  device)
static

Try to connect EFI driver.

Parameters
deviceEFI device
Return values
rcReturn status code

Definition at line 499 of file efi_driver.c.

499  {
501  struct efi_driver *efidrv;
502  EFI_STATUS efirc;
503  int rc;
504 
505  /* Check if we want to drive this device */
507  NULL ) ) != 0 ) {
508  /* Not supported; not an error */
509  return 0;
510  }
511 
512  /* Disconnect any existing drivers */
513  DBGC2 ( device, "EFIDRV %s before disconnecting:\n",
514  efi_handle_name ( device ) );
516  DBGC ( device, "EFIDRV %s disconnecting existing drivers\n",
517  efi_handle_name ( device ) );
520  if ( ! efidrv->exclude )
521  continue;
522  if ( ( rc = efidrv->supported ( device ) ) != 0 )
523  continue;
524  if ( ( rc = efidrv->exclude ( device ) ) != 0 ) {
525  DBGC ( device, "EFIDRV %s could not disconnect "
526  "drivers: %s\n", efi_handle_name ( device ),
527  strerror ( rc ) );
528  /* Ignore the error and attempt to connect anyway */
529  }
530  }
532  DBGC2 ( device, "EFIDRV %s after disconnecting:\n",
533  efi_handle_name ( device ) );
535 
536  /* Connect our driver */
537  DBGC ( device, "EFIDRV %s connecting new drivers\n",
538  efi_handle_name ( device ) );
539  if ( ( rc = efi_connect ( device, driver ) ) != 0 ) {
540  DBGC ( device, "EFIDRV %s could not connect new drivers: "
541  "%s\n", efi_handle_name ( device ), strerror ( rc ) );
542  DBGC ( device, "EFIDRV %s connecting driver directly\n",
543  efi_handle_name ( device ) );
544  if ( ( efirc = efi_driver_start ( &efi_driver_binding, device,
545  NULL ) ) != 0 ) {
546  rc = -EEFI ( efirc );
547  DBGC ( device, "EFIDRV %s could not connect driver "
548  "directly: %s\n", efi_handle_name ( device ),
549  strerror ( rc ) );
550  return rc;
551  }
552  }
553  DBGC2 ( device, "EFIDRV %s after connecting:\n",
554  efi_handle_name ( device ) );
556 
557  return 0;
558 }
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
Definition: efi.h:175
int efi_connect(EFI_HANDLE device, EFI_HANDLE driver)
Connect UEFI driver(s)
Definition: efi_connect.c:58
static int efi_driver_disconnecting
We are currently disconnecting drivers.
Definition: efi_driver.c:49
#define DBGC(...)
Definition: compiler.h:505
int(* exclude)(EFI_HANDLE device)
Exclude existing drivers.
Definition: efi_driver.h:43
#define for_each_table_entry_reverse(pointer, table)
Iterate through all entries within a linker table in reverse order.
Definition: tables.h:441
int(* supported)(EFI_HANDLE device)
Check if driver supports device.
Definition: efi_driver.h:50
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:154
A hardware device.
Definition: device.h:77
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:202
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
Definition: efi_debug.c:652
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:79
EFI_HANDLE DriverBindingHandle
The handle on which this instance of the EFI_DRIVER_BINDING_PROTOCOL is installed.
An EFI driver.
Definition: efi_driver.h:34
#define DBGC2(...)
Definition: compiler.h:522
static EFI_DRIVER_BINDING_PROTOCOL efi_driver_binding
EFI driver binding protocol.
Definition: efi_driver.c:43
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
#define DBGC2_EFI_PROTOCOLS(...)
Definition: efi.h:358
#define EFI_DRIVERS
EFI driver table.
Definition: efi_driver.h:67
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322
Definition: efi.h:62

References DBGC, DBGC2, DBGC2_EFI_PROTOCOLS, _EFI_DRIVER_BINDING_PROTOCOL::DriverBindingHandle, EEFI, efi_connect(), efi_driver_binding, efi_driver_disconnecting, efi_driver_start(), efi_driver_supported(), EFI_DRIVERS, efi_handle_name(), efi_driver::exclude, for_each_table_entry_reverse, NULL, rc, strerror(), and efi_driver::supported.

Referenced by efi_driver_connect_all().

◆ efi_driver_disconnect()

static int efi_driver_disconnect ( EFI_HANDLE  device)
static

Try to disconnect EFI driver.

Parameters
deviceEFI device
Return values
rcReturn status code

Definition at line 566 of file efi_driver.c.

566  {
568 
569  /* Disconnect our driver */
571  efi_disconnect ( device, driver );
573 
574  return 0;
575 }
static int efi_driver_disconnecting
We are currently disconnecting drivers.
Definition: efi_driver.c:49
A hardware device.
Definition: device.h:77
EFI_HANDLE DriverBindingHandle
The handle on which this instance of the EFI_DRIVER_BINDING_PROTOCOL is installed.
static EFI_DRIVER_BINDING_PROTOCOL efi_driver_binding
EFI driver binding protocol.
Definition: efi_driver.c:43
Definition: efi.h:62
int efi_disconnect(EFI_HANDLE device, EFI_HANDLE driver)
Disconnect UEFI driver(s)
Definition: efi_connect.c:90

References _EFI_DRIVER_BINDING_PROTOCOL::DriverBindingHandle, efi_disconnect(), efi_driver_binding, and efi_driver_disconnecting.

Referenced by efi_driver_disconnect_all().

◆ efi_driver_reconnect()

static int efi_driver_reconnect ( EFI_HANDLE  device)
static

Reconnect original EFI driver.

Parameters
deviceEFI device
Return values
rcReturn status code

Definition at line 583 of file efi_driver.c.

583  {
584 
585  /* Reconnect any available driver */
586  efi_connect ( device, NULL );
587 
588  return 0;
589 }
int efi_connect(EFI_HANDLE device, EFI_HANDLE driver)
Connect UEFI driver(s)
Definition: efi_connect.c:58
A hardware device.
Definition: device.h:77
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322

References efi_connect(), and NULL.

Referenced by efi_driver_reconnect_all().

◆ efi_driver_handles()

static int efi_driver_handles ( int(*)(EFI_HANDLE handle method)
static

Connect/disconnect EFI driver from all handles.

Parameters
methodConnect/disconnect method
Return values
rcReturn status code

Definition at line 597 of file efi_driver.c.

597  {
599  EFI_HANDLE *handles;
600  UINTN num_handles;
601  EFI_STATUS efirc;
602  UINTN i;
603  int rc;
604 
605  /* Enumerate all handles */
606  if ( ( efirc = bs->LocateHandleBuffer ( AllHandles, NULL, NULL,
607  &num_handles,
608  &handles ) ) != 0 ) {
609  rc = -EEFI ( efirc );
610  DBGC ( &efi_driver_binding, "EFIDRV could not list handles: "
611  "%s\n", strerror ( rc ) );
612  goto err_locate;
613  }
614 
615  /* Connect/disconnect driver from all handles */
616  for ( i = 0 ; i < num_handles ; i++ ) {
617  if ( ( rc = method ( handles[i] ) ) != 0 ) {
618  /* Ignore errors and continue to process
619  * remaining handles.
620  */
621  }
622  }
623 
624  /* Success */
625  rc = 0;
626 
627  bs->FreePool ( handles );
628  err_locate:
629  return rc;
630 }
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2099
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
Definition: efi.h:175
Retrieve all the handles in the handle database.
Definition: UefiSpec.h:1522
#define DBGC(...)
Definition: compiler.h:505
uint8_t method
Definition: ib_mad.h:15
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:79
EFI Boot Services Table.
Definition: UefiSpec.h:1931
UINT64 UINTN
Unsigned value of native width.
EFI_FREE_POOL FreePool
Definition: UefiSpec.h:1950
static EFI_DRIVER_BINDING_PROTOCOL efi_driver_binding
EFI driver binding protocol.
Definition: efi_driver.c:43
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:32
EFI_SYSTEM_TABLE * efi_systab
#define NULL
NULL pointer (VOID *)
Definition: Base.h:322
Definition: efi.h:62
EFI_LOCATE_HANDLE_BUFFER LocateHandleBuffer
Definition: UefiSpec.h:2008

References AllHandles, EFI_SYSTEM_TABLE::BootServices, DBGC, EEFI, efi_driver_binding, efi_systab, EFI_BOOT_SERVICES::FreePool, EFI_BOOT_SERVICES::LocateHandleBuffer, method, NULL, rc, and strerror().

Referenced by efi_driver_connect_all(), efi_driver_disconnect_all(), and efi_driver_reconnect_all().

◆ efi_driver_connect_all()

int efi_driver_connect_all ( void  )

Connect EFI driver to all possible devices.

Return values
rcReturn status code

Definition at line 637 of file efi_driver.c.

637  {
638 
639  DBGC ( &efi_driver_binding, "EFIDRV connecting our drivers\n" );
641 }
static int efi_driver_connect(EFI_HANDLE device)
Try to connect EFI driver.
Definition: efi_driver.c:499
#define DBGC(...)
Definition: compiler.h:505
static int efi_driver_handles(int(*method)(EFI_HANDLE handle))
Connect/disconnect EFI driver from all handles.
Definition: efi_driver.c:597
static EFI_DRIVER_BINDING_PROTOCOL efi_driver_binding
EFI driver binding protocol.
Definition: efi_driver.c:43

References DBGC, efi_driver_binding, efi_driver_connect(), and efi_driver_handles().

Referenced by efi_probe().

◆ efi_driver_disconnect_all()

void efi_driver_disconnect_all ( void  )

Disconnect EFI driver from all possible devices.

Return values
rcReturn status code

Definition at line 648 of file efi_driver.c.

648  {
649 
650  DBGC ( &efi_driver_binding, "EFIDRV disconnecting our drivers\n" );
652 }
#define DBGC(...)
Definition: compiler.h:505
static int efi_driver_handles(int(*method)(EFI_HANDLE handle))
Connect/disconnect EFI driver from all handles.
Definition: efi_driver.c:597
static EFI_DRIVER_BINDING_PROTOCOL efi_driver_binding
EFI driver binding protocol.
Definition: efi_driver.c:43
static int efi_driver_disconnect(EFI_HANDLE device)
Try to disconnect EFI driver.
Definition: efi_driver.c:566

References DBGC, efi_driver_binding, efi_driver_disconnect(), and efi_driver_handles().

Referenced by efi_remove(), and efi_unload().

◆ efi_driver_reconnect_all()

void efi_driver_reconnect_all ( void  )

Reconnect original EFI drivers to all possible devices.

Return values
rcReturn status code

Definition at line 659 of file efi_driver.c.

659  {
660 
661  DBGC ( &efi_driver_binding, "EFIDRV reconnecting old drivers\n" );
663 }
#define DBGC(...)
Definition: compiler.h:505
static int efi_driver_reconnect(EFI_HANDLE device)
Reconnect original EFI driver.
Definition: efi_driver.c:583
static int efi_driver_handles(int(*method)(EFI_HANDLE handle))
Connect/disconnect EFI driver from all handles.
Definition: efi_driver.c:597
static EFI_DRIVER_BINDING_PROTOCOL efi_driver_binding
EFI driver binding protocol.
Definition: efi_driver.c:43

References DBGC, efi_driver_binding, efi_driver_handles(), and efi_driver_reconnect().

Referenced by _efi_start(), efi_block_boot(), and efi_image_exec().

Variable Documentation

◆ efi_driver_binding

static EFI_DRIVER_BINDING_PROTOCOL efi_driver_binding
static
Initial value:
= {
.Supported = efi_driver_supported,
.Start = efi_driver_start,
.Stop = efi_driver_stop,
}
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:154
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:202
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:284

EFI driver binding protocol.

Definition at line 43 of file efi_driver.c.

Referenced by efi_driver_connect(), efi_driver_connect_all(), efi_driver_disconnect(), efi_driver_disconnect_all(), efi_driver_handles(), efi_driver_install(), efi_driver_reconnect_all(), and efi_driver_uninstall().

◆ efi_driver_disconnecting

int efi_driver_disconnecting
static

We are currently disconnecting drivers.

Definition at line 49 of file efi_driver.c.

Referenced by efi_driver_connect(), efi_driver_disconnect(), and efi_driver_start().

◆ efi_wtf

Initial value:
= {
.GetDriverName = efi_driver_name,
.GetControllerName = efi_driver_controller_name,
.SupportedLanguages = "en",
}
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:336
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:356

EFI component name protocol.

Definition at line 377 of file efi_driver.c.

Referenced by efi_driver_install(), and efi_driver_uninstall().