iPXE
Data Structures | Defines | Functions
efi_driver.h File Reference

EFI driver interface. More...

#include <ipxe/device.h>
#include <ipxe/tables.h>
#include <ipxe/efi/efi.h>
#include <ipxe/efi/Protocol/DevicePath.h>

Go to the source code of this file.

Data Structures

struct  efi_device
 An EFI device. More...
struct  efi_driver
 An EFI driver. More...

Defines

#define EFI_DRIVERS   __table ( struct efi_driver, "efi_drivers" )
 EFI driver table.
#define __efi_driver(order)   __table_entry ( EFI_DRIVERS, order )
 Declare an EFI driver.
#define EFI_DRIVER_EARLY   01
 Early drivers.
#define EFI_DRIVER_NORMAL   02
 Normal drivers.
#define EFI_DRIVER_LATE   03
 Late drivers.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
static void efidev_set_drvdata (struct efi_device *efidev, void *priv)
 Set EFI driver-private data.
static void * efidev_get_drvdata (struct efi_device *efidev)
 Get EFI driver-private data.
struct efi_deviceefidev_parent (struct device *dev)
 Get parent EFI device.
int efi_driver_install (void)
 Install EFI driver.
void efi_driver_uninstall (void)
 Uninstall EFI driver.
int efi_driver_connect_all (void)
 Connect EFI driver to all possible devices.
void efi_driver_disconnect_all (void)
 Disconnect EFI driver from all possible devices.
void efi_driver_reconnect_all (void)
 Reconnect original EFI drivers to all possible devices.

Detailed Description

EFI driver interface.

Definition in file efi_driver.h.


Define Documentation

#define EFI_DRIVERS   __table ( struct efi_driver, "efi_drivers" )

EFI driver table.

Definition at line 57 of file efi_driver.h.

Referenced by efi_driver_start(), and efi_driver_supported().

#define __efi_driver (   order)    __table_entry ( EFI_DRIVERS, order )

Declare an EFI driver.

Definition at line 60 of file efi_driver.h.

#define EFI_DRIVER_EARLY   01

Early drivers.

Definition at line 62 of file efi_driver.h.

#define EFI_DRIVER_NORMAL   02

Normal drivers.

Definition at line 63 of file efi_driver.h.

#define EFI_DRIVER_LATE   03

Late drivers.

Definition at line 64 of file efi_driver.h.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL  )
static void efidev_set_drvdata ( struct efi_device efidev,
void *  priv 
) [inline, static]

Set EFI driver-private data.

Parameters:
efidevEFI device
privPrivate data

Definition at line 72 of file efi_driver.h.

References efi_device::priv, and priv.

Referenced by efipci_start(), nii_start(), snpnet_start(), and usbio_start().

                                                     {
        efidev->priv = priv;
}
static void* efidev_get_drvdata ( struct efi_device efidev) [inline, static]

Get EFI driver-private data.

Parameters:
efidevEFI device
Return values:
privPrivate data

Definition at line 83 of file efi_driver.h.

References efi_device::priv.

Referenced by efipci_stop(), nii_stop(), snpnet_stop(), and usbio_stop().

                                                                      {
        return efidev->priv;
}
struct efi_device* efidev_parent ( struct device dev) [read]

Get parent EFI device.

Parameters:
devGeneric device
Return values:
efidevParent EFI device, or NULL

Definition at line 74 of file efi_driver.c.

References device_description::bus_type, BUS_TYPE_EFI, container_of, device::desc, NULL, and device::parent.

Referenced by efi_snp_probe(), and efi_usb_probe().

                                                         {
        struct device *parent;

        /* Walk upwards until we find an EFI device */
        while ( ( parent = dev->parent ) ) {
                if ( parent->desc.bus_type == BUS_TYPE_EFI )
                        return container_of ( parent, struct efi_device, dev );
                dev = parent;
        }

        return NULL;
}
int efi_driver_install ( void  )

Install EFI driver.

Return values:
rcReturn status code

Definition at line 369 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_protocol_guid, efi_image_handle, efi_systab, _EFI_DRIVER_BINDING_PROTOCOL::ImageHandle, EFI_BOOT_SERVICES::InstallMultipleProtocolInterfaces, NULL, rc, strerror(), and _EFI_DRIVER_BINDING_PROTOCOL::Version.

Referenced by efi_init().

                                {
        EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
        EFI_STATUS efirc;
        int rc;

        /* Calculate driver version number.  We use the build
         * timestamp (in seconds since the Epoch) shifted right by six
         * bits: this gives us an approximately one-minute resolution
         * and a scheme which will last until the year 10680.
         */
        efi_driver_binding.Version = ( build_timestamp >> 6 );

        /* Install protocols on image handle */
        efi_driver_binding.ImageHandle = efi_image_handle;
        efi_driver_binding.DriverBindingHandle = efi_image_handle;
        if ( ( efirc = bs->InstallMultipleProtocolInterfaces (
                        &efi_image_handle,
                        &efi_driver_binding_protocol_guid, &efi_driver_binding,
                        &efi_component_name2_protocol_guid, &efi_wtf,
                        NULL ) ) != 0 ) {
                rc = -EEFI ( efirc );
                DBGC ( &efi_driver_binding, "EFIDRV could not install "
                       "protocols: %s\n", strerror ( rc ) );
                return rc;
        }

        return 0;
}
void efi_driver_uninstall ( void  )
int efi_driver_connect_all ( void  )

Connect EFI driver to all possible devices.

Return values:
rcReturn status code

Definition at line 548 of file efi_driver.c.

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

Referenced by efi_probe().

                                    {

        DBGC ( &efi_driver_binding, "EFIDRV connecting our drivers\n" );
        return efi_driver_handles ( efi_driver_connect );
}
void efi_driver_disconnect_all ( void  )

Disconnect EFI driver from all possible devices.

Return values:
rcReturn status code

Definition at line 559 of file efi_driver.c.

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

Referenced by efi_remove(), and efi_unload().

                                        {

        DBGC ( &efi_driver_binding, "EFIDRV disconnecting our drivers\n" );
        efi_driver_handles ( efi_driver_disconnect );
}
void efi_driver_reconnect_all ( void  )

Reconnect original EFI drivers to all possible devices.

Return values:
rcReturn status code

Definition at line 570 of file efi_driver.c.

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

Referenced by _efi_start().

                                       {

        DBGC ( &efi_driver_binding, "EFIDRV reconnecting old drivers\n" );
        efi_driver_handles ( efi_driver_reconnect );
}