1ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao/** @file 2ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao This library retrieves pointers to the UEFI HII Protocol instances in the 3ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao library's constructor. All of the UEFI HII related protocols are optional, 4ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao so the consumers of this library class must verify that the global variable 5ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao pointers are not NULL before use. 6ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao 7cd5ebaa06dca3e6ef3c464081e6defe00d358c69hhtian Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR> 8cd5ebaa06dca3e6ef3c464081e6defe00d358c69hhtian This program and the accompanying materials 9ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao are licensed and made available under the terms and conditions of the BSD License 10ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao which accompanies this distribution. The full text of the license may be found at 11ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao http://opensource.org/licenses/bsd-license.php 12ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao 13ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 14ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 15ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao 16ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao**/ 17ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao 18ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao#include <Uefi.h> 19ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao 20ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao#include <Library/UefiHiiServicesLib.h> 21ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao#include <Library/UefiBootServicesTableLib.h> 22ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao#include <Library/DebugLib.h> 23ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao 24ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao#include <Protocol/HiiFont.h> 25ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao#include <Protocol/HiiString.h> 26ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao#include <Protocol/HiiImage.h> 27ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao#include <Protocol/HiiDatabase.h> 28ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao#include <Protocol/HiiConfigRouting.h> 29ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao 30ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao/// 31ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao/// Pointer to the UEFI HII Font Protocol 32ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao/// 33ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgaoEFI_HII_FONT_PROTOCOL *gHiiFont = NULL; 34ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao 35ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao/// 36ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao/// Pointer to the UEFI HII String Protocol 37ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao/// 38ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgaoEFI_HII_STRING_PROTOCOL *gHiiString = NULL; 39ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao 40ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao/// 41ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao/// Pointer to the UEFI HII Image Protocol 42ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao/// 43ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgaoEFI_HII_IMAGE_PROTOCOL *gHiiImage = NULL; 44ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao 45ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao/// 46ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao/// Pointer to the UEFI HII Database Protocol 47ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao/// 48ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgaoEFI_HII_DATABASE_PROTOCOL *gHiiDatabase = NULL; 49ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao 50ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao/// 51ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao/// Pointer to the UEFI HII Config Rounting Protocol 52ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao/// 53ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgaoEFI_HII_CONFIG_ROUTING_PROTOCOL *gHiiConfigRouting = NULL; 54ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao 55ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao/** 56ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao The constructor function retrieves pointers to the UEFI HII protocol instances 57ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao 58ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao The constructor function retrieves pointers to the four UEFI HII protocols from the 59ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao handle database. These include the UEFI HII Font Protocol, the UEFI HII String 60ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao Protocol, the UEFI HII Image Protocol, the UEFI HII Database Protocol, and the 61ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao UEFI HII Config Routing Protocol. This function always return EFI_SUCCESS. 62ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao All of these protocols are optional if the platform does not support configuration 63ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao and the UEFI HII Image Protocol and the UEFI HII Font Protocol are optional if 64ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao the platform does not support a graphical console. As a result, the consumers 65ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao of this library much check the protocol pointers againt NULL before using them, 66ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao or use dependency expressions to guarantee that some of them are present before 67ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao assuming they are not NULL. 68ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao 69ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao @param ImageHandle The firmware allocated handle for the EFI image. 70ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao @param SystemTable A pointer to the EFI System Table. 71ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao 72ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. 73ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao 74ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao**/ 75ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgaoEFI_STATUS 76ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgaoEFIAPI 77ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgaoUefiHiiServicesLibConstructor ( 78ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao IN EFI_HANDLE ImageHandle, 79ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao IN EFI_SYSTEM_TABLE *SystemTable 80ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao ) 81ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao{ 82d6a6483cad4d28f141ba3916deee68a31b45cb9elgao EFI_STATUS Status; 83d6a6483cad4d28f141ba3916deee68a31b45cb9elgao 84ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao // 85d6a6483cad4d28f141ba3916deee68a31b45cb9elgao // Retrieve the pointer to the UEFI HII String Protocol 86ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao // 87d6a6483cad4d28f141ba3916deee68a31b45cb9elgao Status = gBS->LocateProtocol (&gEfiHiiStringProtocolGuid, NULL, (VOID **) &gHiiString); 88d6a6483cad4d28f141ba3916deee68a31b45cb9elgao ASSERT_EFI_ERROR (Status); 89ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao 90ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao // 91d6a6483cad4d28f141ba3916deee68a31b45cb9elgao // Retrieve the pointer to the UEFI HII Database Protocol 92ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao // 93d6a6483cad4d28f141ba3916deee68a31b45cb9elgao Status = gBS->LocateProtocol (&gEfiHiiDatabaseProtocolGuid, NULL, (VOID **) &gHiiDatabase); 94d6a6483cad4d28f141ba3916deee68a31b45cb9elgao ASSERT_EFI_ERROR (Status); 95ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao 96ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao // 97d6a6483cad4d28f141ba3916deee68a31b45cb9elgao // Retrieve the pointer to the UEFI HII Config Routing Protocol 98ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao // 99d6a6483cad4d28f141ba3916deee68a31b45cb9elgao Status = gBS->LocateProtocol (&gEfiHiiConfigRoutingProtocolGuid, NULL, (VOID **) &gHiiConfigRouting); 100d6a6483cad4d28f141ba3916deee68a31b45cb9elgao ASSERT_EFI_ERROR (Status); 101ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao 102ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao // 103d6a6483cad4d28f141ba3916deee68a31b45cb9elgao // Retrieve the pointer to the optional UEFI HII Font Protocol 104ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao // 105d6a6483cad4d28f141ba3916deee68a31b45cb9elgao gBS->LocateProtocol (&gEfiHiiFontProtocolGuid, NULL, (VOID **) &gHiiFont); 106ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao 107ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao // 108d6a6483cad4d28f141ba3916deee68a31b45cb9elgao // Retrieve the pointer to the optional UEFI HII Image Protocol 109ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao // 110d6a6483cad4d28f141ba3916deee68a31b45cb9elgao gBS->LocateProtocol (&gEfiHiiImageProtocolGuid, NULL, (VOID **) &gHiiImage); 111ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao 112ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao return EFI_SUCCESS; 113ef7df998f7a5680b09b931f47c8a5d46a6c7fd77lgao} 114