7.3 Adding the Driver Supported EFI Version Protocol Feature
This feature provides information on the version of the UEFI Specification to which the UEFI Driver conforms. The version information follows the same format as the version field in the EFI System Table. This feature is required for UEFI Drivers on PCI and other plug in cards.
There are no EDK II library functions to help install the Driver Supported EFI
Version Protocol. Instead, the UEFI Driver requiring this feature must install the
Driver Supported EFI Version Protocol using the UEFI Boot Service
InstallMultipleProtocolInterfaces()
. A UEFI Driver must install, at most, one
instance of this protocol and, if it is produced, it must be installed onto the
ImageHandle. This protocol is composed of only data fields, so no functions
need be implemented to complete its implementation. Example 94, below, expands
Example 93, above, and adds a Driver Supported EFI Version Protocol instance to
ImageHandle. The Driver Supported EFI Version Protocol instance in this
example specifies that this UEFI Driver follows the UEFI 2.3.1 Specification.
Example 94-Driver Supported EFI Version Protocol Feature
#include <Uefi.h>
#include <Protocol/DriverBinding.h>
#include <Protocol/ComponentName2.h>
#include <Protocol/ComponentName.h>
#include <Protocol/DriverSupportedEfiVersion.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiLib.h>
#include <Library/DebugLib.h>
#define ABC_VERSION 0x10
EFI_DRIVER_BINDING_PROTOCOL gAbcDriverBinding = {
AbcSupported,
AbcStart,
AbcStop,
ABC_VERSION,
NULL,
NULL
};
GLOBAL_REMOVE_IF_UNREFERENCED
EFI_COMPONENT_NAME_PROTOCOL gAbcComponentName = {
(EFI_COMPONENT_NAME_GET_DRIVER_NAME) AbcGetDriverName,
(EFI_COMPONENT_NAME_GET_CONTROLLER_NAME) AbcGetControllerName,
"eng"
};
GLOBAL_REMOVE_IF_UNREFERENCED
EFI_COMPONENT_NAME2_PROTOCOL gAbcComponentName2 = {
AbcGetDriverName,
AbcGetControllerName,
"en"
};
GLOBAL_REMOVE_IF_UNREFERENCED
EFI_DRIVER_SUPPORTED_EFI_VERSION_PROTOCOL gAbcDriverSupportedEfiVersion = {
sizeof (EFI_DRIVER_SUPPORTED_EFI_VERSION_PROTOCOL),
EFI_2_31_SYSTEM_TABLE_REVISION
};
EFI_STATUS
EFIAPI
AbcDriverEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
//
// Install Driver Supported EFI Version Protocol onto ImageHandle
//
Status = gBS->InstallMultipleProtocolInterfaces (
&ImageHandle,
&gEfiDriverSupportedEfiVersionProtocolGuid,
& gAbcDriverSupportedEfiVersion,
NULL
);
ASSERT_EFI_ERROR (Status);
//
// Install driver model protocol(s) on ImageHandle
//
Status = EfiLibInstallDriverBindingComponentName2 (
ImageHandle, // ImageHandle
SystemTable, // SystemTable
&gAbcDriverBinding, // DriverBinding
ImageHandle, // DriverBindingHandle
&gAbcComponentName, // ComponentName
&gAbcComponentName2 // ComponentName2
);
ASSERT_EFI_ERROR (Status);
return Status;
}