7.5 Adding HII Config Access Protocol Feature

This protocol provides the services to save and restore configuration settings for a device. For drivers following the UEFI Driver Model, this protocol is typically installed in the Driver Binding Protocol Start() function for each device the driver manages. Only UEFI Drivers not following the UEFI Driver Model would install this protocol in the driver entry point. As a result, only the Service Drivers and Root Bridge Drivers required to save and restore configuration settings can install the HII Config Access Protocol in the driver entry point.

There are no EDK II library functions to help install the HII Config Access Protocol. Instead, the UEFI Driver requiring this feature must install the HII Config Access Protocol using the UEFI Boot Service InstallMultipleProtocolInterfaces(). Example 97, below, expands Example 96, above, and adds an HII Config Access Protocol instance to ImageHandle.

Example 97-HII Config Access Protocol Feature
#include <Uefi.h>
#include <Protocol/HiiConfigAccess.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/DebugLib.h>

GLOBAL_REMOVE_IF_UNREFERENCED
EFI_HII_CONFIG_ACCESS_PROTOCOL gAbcHiiConfigAccess = {
  AbcExtractConfig,
  AbcRouteConfig,
  AbcRouteCallback
};

EFI_STATUS
EFIAPI
AbcDriverEntryPoint (
  IN EFI_HANDLE        ImageHandle,
  IN EFI_SYSTEM_TABLE  *SystemTable
  )
{
  EFI_STATUS  Status;

  //
  // Install HII Config Access Protocol onto ImageHandle
  //
  Status = gBS->InstallMultipleProtocolInterfaces (
                  &ImageHandle,
                  &gEfiHiiConfigAccessProtocolGuid,
                  &gAbcHiiConfigAccess,
                  NULL
                  );
  ASSERT_EFI_ERROR (Status);

  return Status;
}