Extensible Firmware Interface Specification
4-16 12/01/02 Version 1.10
//
// Implement driver initialization here.
//
return EFI_DEVICE_ERROR;
}
4.7.2 EFI Driver Model Example
The following is an EFI Driver Model example that shows the driver initialization routine for the
ABC device controller that is on the XYZ bus. The EFI_DRIVER_BINDING_PROTOCOL
is
defined in Chapter 9. The function prototypes for the AbcSupported()
, AbcStart(), and
AbcStop()
functions are defined in Section 9.1. This function saves the driver’s image handle
and a pointer to the EFI boot services table in global variables, so the other functions in the same
driver can have access to these values. It then creates an instance of the
EFI_DRIVER_BINDING_PROTOCOL and installs it onto the driver's image handle.
extern EFI_GUID gEfiDriverBindingProtocolGuid;
EFI_BOOT_SERVICES_TABLE *gBS;
static EFI_DRIVER_BINDING_PROTOCOL mAbcDriverBinding = {
AbcSupported,
AbcStart,
AbcStop,
1,
NULL,
NULL
};
AbcEntryPoint(
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
gBS = SystemTable->BootServices;
mAbcDriverBinding->ImageHandle = ImageHandle;
mAbcDriverBinding->DriverBindingHandle = ImageHandle;
Status = gBS->InstallMultipleProtocolInterfaces(
&mAbcDriverBinding->DriverBindingHandle,
&gEfiDriverBindingProtocolGuid, &mAbcDriverBinding,
NULL
);
return Status;
}