66 DBGC (
device,
"EFIDRV %s could not open device path: %s\n",
73 efidev =
zalloc (
sizeof ( *efidev ) + path_len );
78 efidev->
path = ( ( (
void * ) efidev ) +
sizeof ( *efidev ) );
135 if ( parent == &efidev->
dev )
176 DBGC (
device,
"EFIDRV %s has driver \"%s\"\n",
220 goto err_already_started;
228 DBGC (
device,
"EFIDRV %s refusing to start during " 231 goto err_disconnecting;
244 DBGC (
device,
"EFIDRV %s is not supported by driver " 250 if ( (
rc = efidrv->
start ( efidev ) ) == 0 ) {
252 DBGC (
device,
"EFIDRV %s using driver \"%s\"\n",
258 DBGC (
device,
"EFIDRV %s could not start driver \"%s\": %s\n",
292 for ( i = 0 ; i < num_children ; i++ ) {
293 DBGC (
device,
"%s%s", ( i ?
", " :
" child " ),
312 efidrv->
stop ( efidev );
340 *driver_name = ( (
wchar_t * )
name );
364 if ( ( child !=
NULL ) &&
366 &name2 ) ) == 0 ) ) {
368 language, controller_name );
379 .SupportedLanguages =
"en",
451 DBGC (
device,
"EFIDRV %s could not list %s openers: %s\n",
459 for ( i = 0 ; i <
count ; i++ ) {
460 opener = &openers[i];
468 DBGC (
device,
"EFIDRV %s disconnecting %s drivers\n",
471 DBGC (
device,
"EFIDRV %s disconnecting %s driver ",
475 DBGC (
device,
"EFIDRV %s could not disconnect ",
512 DBGC2 (
device,
"EFIDRV %s before disconnecting:\n",
515 DBGC (
device,
"EFIDRV %s disconnecting existing drivers\n",
524 DBGC (
device,
"EFIDRV %s could not disconnect " 531 DBGC2 (
device,
"EFIDRV %s after disconnecting:\n",
536 DBGC (
device,
"EFIDRV %s connecting new drivers\n",
539 DBGC (
device,
"EFIDRV %s could not connect new drivers: " 541 DBGC (
device,
"EFIDRV %s connecting driver directly\n",
546 DBGC (
device,
"EFIDRV %s could not connect driver " 607 &handles ) ) != 0 ) {
615 for ( i = 0 ; i < num_handles ; i++ ) {
616 if ( (
rc =
method ( handles[i] ) ) != 0 ) {
int efi_driver_connect_all(void)
Connect EFI driver to all possible devices.
void efi_driver_uninstall(void)
Uninstall EFI driver.
UEFI DriverBinding Protocol is defined in UEFI specification.
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
#define EFI_UNSUPPORTED
Enumeration of EFI_STATUS.
struct arbelprm_rc_send_wqe rc
static int efi_driver_connect(EFI_HANDLE device)
Try to connect EFI driver.
EFI Oprn Protocol Information Entry.
static EFI_STATUS EFIAPI efi_driver_name(EFI_COMPONENT_NAME2_PROTOCOL *wtf __unused, CHAR8 *language __unused, CHAR16 **driver_name)
Look up driver name.
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
struct efi_driver * driver
Driver for this device.
#define EFI_ALREADY_STARTED
Enumeration of EFI_STATUS.
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...
int efi_connect(EFI_HANDLE device, EFI_HANDLE driver)
Connect UEFI driver(s)
FILE_LICENCE(GPL2_OR_LATER)
#define list_add(new, head)
Add a new entry to the head of a list.
128 bit buffer containing a unique identifier value.
Retrieve all the handles in the handle database.
void efi_raise_tpl(struct efi_saved_tpl *tpl)
Raise task priority level to internal level.
EFI_DRIVER_BINDING_SUPPORTED Supported
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.
void(* stop)(struct efi_device *efidev)
Detach driver from device.
void efidev_free(struct efi_device *efidev)
Free EFI device.
static int efi_driver_disconnecting
We are currently disconnecting drivers.
static struct efi_device * efidev_find(EFI_HANDLE device)
Find EFI device.
#define EFI_OPEN_PROTOCOL_BY_DRIVER
static LIST_HEAD(efi_devices)
List of controlled EFI devices.
EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces
size_t efi_path_len(EFI_DEVICE_PATH_PROTOCOL *path)
Find length of device path (excluding terminator)
EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME GetControllerName
EFI_HANDLE device
EFI device handle.
int(* exclude)(EFI_HANDLE device)
Exclude existing drivers.
This protocol can be used on any device handle to obtain generic path/location information concerning...
#define for_each_table_entry_reverse(pointer, table)
Iterate through all entries within a linker table in reverse order.
uint16_t device
Device ID.
struct device * parent
Bus device.
#define EFI_OUT_OF_RESOURCES
Enumeration of EFI_STATUS.
int(* supported)(EFI_HANDLE device)
Check if driver supports device.
#define list_empty(list)
Test whether a list is empty.
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.
#define list_del(list)
Delete an entry from a list.
EFI_HANDLE child
EFI child device handle (if present)
const wchar_t product_wname[]
Wide-character product name string.
char unsigned long const char unsigned long char ** children
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.
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
char wtf[42]
Authenticator response string.
#define list_for_each_entry(pos, head, member)
Iterate over entries in a list.
#define __unused
Declare a variable or data structure as unused.
UEFI Component Name 2 Protocol as defined in the UEFI 2.1 specification.
EFI_COMPONENT_NAME2_GET_DRIVER_NAME GetDriverName
struct efi_device * efidev_alloc(EFI_HANDLE device)
Allocate new EFI device.
static unsigned int count
Number of entries.
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.
const char * efi_devpath_text(EFI_DEVICE_PATH_PROTOCOL *path)
Get textual representation of device path.
unsigned long build_timestamp
Build timestamp.
const char * efi_handle_name(EFI_HANDLE handle)
Get name of an EFI handle.
char * strerror(int errno)
Retrieve string representation of error number.
static void(* free)(struct refcnt *refcnt))
static int efi_driver_reconnect(EFI_HANDLE device)
Reconnect original EFI driver.
void * zalloc(size_t size)
Allocate cleared memory.
static int efi_driver_handles(int(*method)(EFI_HANDLE handle))
Connect/disconnect EFI driver from all handles.
EFI_HANDLE efi_image_handle
Image handle passed to entry point.
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.
void efi_driver_disconnect_all(void)
Disconnect EFI driver from all possible devices.
#define for_each_table_entry(pointer, table)
Iterate through all entries within a linker table.
EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces
#define efi_open(handle, protocol, interface)
Open protocol for ephemeral use.
int efi_driver_exclude(EFI_HANDLE device, EFI_GUID *protocol)
Try to disconnect an existing EFI driver.
UINT64 UINTN
Unsigned value of native width.
#define EFI_NOT_READY
Enumeration of EFI_STATUS.
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.
const char * efi_guid_ntoa(CONST EFI_GUID *guid)
Convert GUID to a printable string.
EFI_GUID efi_component_name2_protocol_guid
Component name 2 protocol GUID.
#define BUS_TYPE_EFI
EFI bus type.
EFI_HANDLE ImageHandle
The image handle of the UEFI driver that produced this instance of the EFI_DRIVER_BINDING_PROTOCOL.
EFI_OPEN_PROTOCOL_INFORMATION OpenProtocolInformation
const wchar_t build_wname[]
Wide-character build name string.
#define INIT_LIST_HEAD(list)
Initialise a list head.
unsigned int bus_type
Bus type.
An EFI saved task priority level.
static EFI_DRIVER_BINDING_PROTOCOL efi_driver_binding
EFI driver binding protocol.
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
struct list_head children
Devices attached to this device.
#define DBGC2_EFI_PROTOCOLS(...)
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.
struct device_description desc
Device description.
static int efi_driver_disconnect(EFI_HANDLE device)
Try to disconnect EFI driver.
EFI_SYSTEM_TABLE * efi_systab
uint16_t protocol
Protocol ID.
EFI_DEVICE_PATH_PROTOCOL * path
EFI device path copy.
struct efi_device * efidev_parent(struct device *dev)
Get parent EFI device.
static EFI_COMPONENT_NAME2_PROTOCOL efi_wtf
EFI component name protocol.
#define EFI_DRIVERS
EFI driver table.
struct device dev
Generic device.
EFI_GUID efi_driver_binding_protocol_guid
Driver binding protocol GUID.
void efi_restore_tpl(struct efi_saved_tpl *tpl)
Restore task priority level.
#define NULL
NULL pointer (VOID *)
int efi_driver_install(void)
Install EFI driver.
EFI_LOCATE_HANDLE_BUFFER LocateHandleBuffer
int(* start)(struct efi_device *efidev)
Attach driver to device.
UINT32 Version
The version number of the UEFI driver that produced the EFI_DRIVER_BINDING_PROTOCOL.
int efi_disconnect(EFI_HANDLE device, EFI_HANDLE driver)
Disconnect UEFI driver(s)