iPXE
|
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.
Macros | |
#define | EINFO_EEFI_CONNECT |
#define | EINFO_EEFI_CONNECT_PROHIBITED |
#define | EEFI_CONNECT_PROHIBITED __einfo_error ( EINFO_EEFI_CONNECT_PROHIBITED ) |
#define | EEFI_CONNECT(efirc) |
Functions | |
FILE_LICENCE (GPL2_OR_LATER) | |
static | LIST_HEAD (efi_devices) |
List of controlled EFI devices. More... | |
struct efi_device * | efidev_alloc (EFI_HANDLE device) |
Allocate new EFI device. More... | |
void | efidev_free (struct efi_device *efidev) |
Free EFI device. More... | |
static struct efi_device * | efidev_find (EFI_HANDLE device) |
Find EFI device. More... | |
struct efi_device * | efidev_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... | |
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... | |
EFI driver interface.
Definition in file efi_driver.c.
#define EINFO_EEFI_CONNECT |
Definition at line 43 of file efi_driver.c.
#define EINFO_EEFI_CONNECT_PROHIBITED |
Definition at line 46 of file efi_driver.c.
#define EEFI_CONNECT_PROHIBITED __einfo_error ( EINFO_EEFI_CONNECT_PROHIBITED ) |
Definition at line 51 of file efi_driver.c.
#define EEFI_CONNECT | ( | efirc | ) |
Definition at line 53 of file efi_driver.c.
FILE_LICENCE | ( | GPL2_OR_LATER | ) |
|
static |
List of controlled EFI devices.
struct efi_device* efidev_alloc | ( | EFI_HANDLE | device | ) |
Allocate new EFI device.
device | EFI device handle |
efidev | EFI device, or NULL on error |
Definition at line 70 of file efi_driver.c.
References EFI_SYSTEM_TABLE::BootServices, device_description::bus_type, BUS_TYPE_EFI, device::children, EFI_BOOT_SERVICES::CloseProtocol, DBGC, device::desc, efi_device::dev, efi_device::device, device, EEFI, efi_device_path_protocol_guid, efi_handle_name(), efi_image_handle, EFI_OPEN_PROTOCOL_GET_PROTOCOL, efi_path_len(), efi_systab, INIT_LIST_HEAD, list_add, memcpy(), NULL, EFI_BOOT_SERVICES::OpenProtocol, efi_device::path, rc, device::siblings, strerror(), and zalloc().
Referenced by efi_driver_start(), and mnptemp_create().
void efidev_free | ( | struct efi_device * | efidev | ) |
Free EFI device.
efidev | EFI device |
Definition at line 118 of file efi_driver.c.
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().
|
static |
Find EFI device.
device | EFI device handle (or child handle) |
efidev | EFI device, or NULL if not found |
Definition at line 131 of file efi_driver.c.
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().
struct efi_device* efidev_parent | ( | struct device * | dev | ) |
Get parent EFI device.
dev | Generic device |
efidev | Parent EFI device, or NULL |
Definition at line 155 of file efi_driver.c.
References efi_device::dev, list_for_each_entry, NULL, device::parent, and device::siblings.
Referenced by efi_ib_srp_path(), efi_netdev_path(), efi_snp_probe(), and efi_usb_path().
|
static |
Check to see if driver supports a device.
driver | EFI driver |
device | EFI device |
child | Path to child device, if any |
efirc | EFI status code |
Definition at line 180 of file efi_driver.c.
References 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().
|
static |
Attach driver to device.
driver | EFI driver |
device | EFI device |
child | Path to child device, if any |
efirc | EFI status code |
Definition at line 221 of file efi_driver.c.
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().
|
static |
Detach driver from device.
driver | EFI driver |
device | EFI device |
pci | PCI device |
num_children | Number of child devices |
children | List of child devices |
efirc | EFI status code |
Definition at line 303 of file efi_driver.c.
References assert(), children, DBGC, DBGCP, efi_device::driver, EFI_DEVICE_ERROR, efi_handle_name(), efi_raise_tpl(), efi_restore_tpl(), efidev_find(), efidev_free(), NULL, and efi_driver::stop.
|
static |
Look up driver name.
wtf | Component name protocol |
language | Language to use |
driver_name | Driver name to fill in |
efirc | EFI status code |
Definition at line 355 of file efi_driver.c.
References build_wname, name, and product_wname.
|
static |
Look up controller name.
wtf | Component name protocol |
device | Device |
child | Child device, or NULL |
language | Language to use |
driver_name | Device name to fill in |
efirc | EFI status code |
Definition at line 375 of file efi_driver.c.
References EFI_SYSTEM_TABLE::BootServices, efi_component_name2_protocol_guid, EFI_OPEN_PROTOCOL_GET_PROTOCOL, efi_systab, EFI_UNSUPPORTED, NULL, and EFI_BOOT_SERVICES::OpenProtocol.
int efi_driver_install | ( | void | ) |
Install EFI driver.
rc | Return status code |
Definition at line 414 of file efi_driver.c.
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().
void efi_driver_uninstall | ( | void | ) |
Uninstall EFI driver.
Definition at line 447 of file efi_driver.c.
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().
|
static |
Try to connect EFI driver.
device | EFI device |
rc | Return status code |
Definition at line 463 of file efi_driver.c.
References EFI_SYSTEM_TABLE::BootServices, EFI_BOOT_SERVICES::ConnectController, DBGC, DBGC2, DBGC2_EFI_PROTOCOLS, EFI_BOOT_SERVICES::DisconnectController, _EFI_DRIVER_BINDING_PROTOCOL::DriverBindingHandle, EEFI, EEFI_CONNECT, efi_driver_binding, efi_driver_disconnecting, efi_driver_start(), efi_driver_supported(), efi_handle_name(), efi_systab, NULL, rc, strerror(), and TRUE.
Referenced by efi_driver_connect_all().
|
static |
Try to disconnect EFI driver.
device | EFI device |
rc | Return status code |
Definition at line 529 of file efi_driver.c.
References EFI_SYSTEM_TABLE::BootServices, EFI_BOOT_SERVICES::DisconnectController, _EFI_DRIVER_BINDING_PROTOCOL::DriverBindingHandle, efi_driver_binding, efi_driver_disconnecting, efi_systab, and NULL.
Referenced by efi_driver_disconnect_all().
|
static |
Reconnect original EFI driver.
device | EFI device |
rc | Return status code |
Definition at line 547 of file efi_driver.c.
References EFI_SYSTEM_TABLE::BootServices, EFI_BOOT_SERVICES::ConnectController, efi_systab, NULL, and TRUE.
Referenced by efi_driver_reconnect_all().
|
static |
Connect/disconnect EFI driver from all handles.
method | Connect/disconnect method |
rc | Return status code |
Definition at line 562 of file efi_driver.c.
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().
int efi_driver_connect_all | ( | void | ) |
Connect EFI driver to all possible devices.
rc | Return status code |
Definition at line 602 of file efi_driver.c.
References DBGC, efi_driver_binding, efi_driver_connect(), and efi_driver_handles().
Referenced by efi_probe().
void efi_driver_disconnect_all | ( | void | ) |
Disconnect EFI driver from all possible devices.
rc | Return status code |
Definition at line 613 of file efi_driver.c.
References DBGC, efi_driver_binding, efi_driver_disconnect(), and efi_driver_handles().
Referenced by efi_remove(), and efi_unload().
void efi_driver_reconnect_all | ( | void | ) |
Reconnect original EFI drivers to all possible devices.
rc | Return status code |
Definition at line 624 of file efi_driver.c.
References DBGC, efi_driver_binding, efi_driver_handles(), and efi_driver_reconnect().
Referenced by _efi_start(), efi_block_boot(), and efi_image_exec().
|
static |
EFI driver binding protocol.
Definition at line 56 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().
|
static |
We are currently disconnecting drivers.
Definition at line 62 of file efi_driver.c.
Referenced by efi_driver_connect(), efi_driver_disconnect(), and efi_driver_start().
|
static |
EFI component name protocol.
Definition at line 403 of file efi_driver.c.
Referenced by efi_driver_install(), and efi_driver_uninstall().