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 " \ 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 ) 89 DBGC (
device,
"EFIDRV %s could not open device path: %s\n",
93 path_len = (
efi_path_len ( path.path ) +
sizeof ( *path_end ) );
96 efidev =
zalloc (
sizeof ( *efidev ) + path_len );
101 efidev->
path = ( ( (
void * ) efidev ) +
sizeof ( *efidev ) );
162 if ( parent == &efidev->
dev )
201 DBGC (
device,
"EFIDRV %s has driver \"%s\"\n",
240 goto err_already_started;
248 DBGC (
device,
"EFIDRV %s refusing to start during " 251 goto err_disconnecting;
264 DBGC (
device,
"EFIDRV %s is not supported by driver " 270 if ( (
rc = efidrv->
start ( efidev ) ) == 0 ) {
272 DBGC (
device,
"EFIDRV %s using driver \"%s\"\n",
278 DBGC (
device,
"EFIDRV %s could not start driver \"%s\": %s\n",
312 for ( i = 0 ; i < num_children ; i++ ) {
313 DBGC (
device,
"%s%s", ( i ?
", " :
" child " ),
332 efidrv->
stop ( efidev );
360 *driver_name = ( (
wchar_t * )
name );
388 if ( ( child !=
NULL ) &&
393 return name2.name2->GetControllerName ( name2.name2,
device,
406 .SupportedLanguages =
"en",
478 DBGC2 (
device,
"EFIDRV %s before disconnecting:\n",
481 DBGC (
device,
"EFIDRV %s disconnecting existing drivers\n",
487 DBGC (
device,
"EFIDRV %s could not disconnect existing " 493 DBGC2 (
device,
"EFIDRV %s after disconnecting:\n",
498 DBGC (
device,
"EFIDRV %s connecting new drivers\n",
503 DBGC (
device,
"EFIDRV %s could not connect new drivers: " 505 DBGC (
device,
"EFIDRV %s connecting driver directly\n",
510 DBGC (
device,
"EFIDRV %s could not connect driver " 573 &handles ) ) != 0 ) {
581 for ( i = 0 ; i < num_handles ; i++ ) {
582 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.
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...
FILE_LICENCE(GPL2_OR_LATER)
#define list_add(new, head)
Add a new entry to the head of a list.
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.
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_HANDLE device
EFI device handle.
This protocol can be used on any device handle to obtain generic path/location information concerning...
uint16_t device
Device ID.
EFI_CLOSE_PROTOCOL CloseProtocol
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 EFI_DEVICE_ERROR
Enumeration of EFI_STATUS.
#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 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.
#define EFI_OPEN_PROTOCOL_GET_PROTOCOL
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
EFI_CONNECT_CONTROLLER ConnectController
#define EEFI_CONNECT(efirc)
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.
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.
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
EFI_OPEN_PROTOCOL OpenProtocol
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.
EFI_DISCONNECT_CONTROLLER DisconnectController