diff options
author | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2009-04-09 15:12:01 +0000 |
---|---|---|
committer | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2009-04-09 15:12:01 +0000 |
commit | ef7df998f7a5680b09b931f47c8a5d46a6c7fd77 (patch) | |
tree | a9671059107def0c77065ce2ecad78919b24fed4 /MdeModulePkg/Library/UefiHiiServicesLib | |
parent | 253a25e8cca4d7076eebee76d22949eb1457a3df (diff) | |
download | edk2-platforms-ef7df998f7a5680b09b931f47c8a5d46a6c7fd77.tar.xz |
Add NewHii and UefiHiiServices library instances.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8049 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Library/UefiHiiServicesLib')
-rw-r--r-- | MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.c | 108 | ||||
-rw-r--r-- | MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf | 66 |
2 files changed, 174 insertions, 0 deletions
diff --git a/MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.c b/MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.c new file mode 100644 index 0000000000..5cecf56e14 --- /dev/null +++ b/MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.c @@ -0,0 +1,108 @@ +/** @file
+ This library retrieves pointers to the UEFI HII Protocol instances in the
+ library's constructor. All of the UEFI HII related protocols are optional,
+ so the consumers of this library class must verify that the global variable
+ pointers are not NULL before use.
+
+ Copyright (c) 2006 - 2009, Intel Corporation<BR>
+ All rights reserved. This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include <Uefi.h>
+
+#include <Library/UefiHiiServicesLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/DebugLib.h>
+
+#include <Protocol/HiiFont.h>
+#include <Protocol/HiiString.h>
+#include <Protocol/HiiImage.h>
+#include <Protocol/HiiDatabase.h>
+#include <Protocol/HiiConfigRouting.h>
+
+///
+/// Pointer to the UEFI HII Font Protocol
+///
+EFI_HII_FONT_PROTOCOL *gHiiFont = NULL;
+
+///
+/// Pointer to the UEFI HII String Protocol
+///
+EFI_HII_STRING_PROTOCOL *gHiiString = NULL;
+
+///
+/// Pointer to the UEFI HII Image Protocol
+///
+EFI_HII_IMAGE_PROTOCOL *gHiiImage = NULL;
+
+///
+/// Pointer to the UEFI HII Database Protocol
+///
+EFI_HII_DATABASE_PROTOCOL *gHiiDatabase = NULL;
+
+///
+/// Pointer to the UEFI HII Config Rounting Protocol
+///
+EFI_HII_CONFIG_ROUTING_PROTOCOL *gHiiConfigRouting = NULL;
+
+/**
+ The constructor function retrieves pointers to the UEFI HII protocol instances
+
+ The constructor function retrieves pointers to the four UEFI HII protocols from the
+ handle database. These include the UEFI HII Font Protocol, the UEFI HII String
+ Protocol, the UEFI HII Image Protocol, the UEFI HII Database Protocol, and the
+ UEFI HII Config Routing Protocol. This function always return EFI_SUCCESS.
+ All of these protocols are optional if the platform does not support configuration
+ and the UEFI HII Image Protocol and the UEFI HII Font Protocol are optional if
+ the platform does not support a graphical console. As a result, the consumers
+ of this library much check the protocol pointers againt NULL before using them,
+ or use dependency expressions to guarantee that some of them are present before
+ assuming they are not NULL.
+
+ @param ImageHandle The firmware allocated handle for the EFI image.
+ @param SystemTable A pointer to the EFI System Table.
+
+ @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS.
+
+**/
+EFI_STATUS
+EFIAPI
+UefiHiiServicesLibConstructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ //
+ // Retrieve the pointer to the UEFI HII Font Protocol
+ //
+ gBS->LocateProtocol (&gEfiHiiFontProtocolGuid, NULL, (VOID **) &gHiiFont);
+
+ //
+ // Retrieve the pointer to the UEFI HII String Protocol
+ //
+ gBS->LocateProtocol (&gEfiHiiStringProtocolGuid, NULL, (VOID **) &gHiiString);
+
+ //
+ // Retrieve the pointer to the UEFI HII Image Protocol
+ //
+ gBS->LocateProtocol (&gEfiHiiImageProtocolGuid, NULL, (VOID **) &gHiiImage);
+
+ //
+ // Retrieve the pointer to the UEFI HII Database Protocol
+ //
+ gBS->LocateProtocol (&gEfiHiiDatabaseProtocolGuid, NULL, (VOID **) &gHiiDatabase);
+
+ //
+ // Retrieve the pointer to the UEFI HII Config Routing Protocol
+ //
+ gBS->LocateProtocol (&gEfiHiiConfigRoutingProtocolGuid, NULL, (VOID **) &gHiiConfigRouting);
+
+ return EFI_SUCCESS;
+}
diff --git a/MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf b/MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf new file mode 100644 index 0000000000..fde41b09b7 --- /dev/null +++ b/MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf @@ -0,0 +1,66 @@ +#/** @file
+# UEFI HII Services Library implementation.
+#
+# Copyright (c) 2007 - 2009, Intel Corporation.
+#
+# All rights reserved. This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution. The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+#
+#**/
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = UefiHiiServicesLib
+ FILE_GUID = 894DC1B6-07A3-4a9d-8CDD-333580B3D4B1
+ MODULE_TYPE = UEFI_DRIVER
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = UefiHiiServicesLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER
+
+ CONSTRUCTOR = UefiHiiServicesLibConstructor
+
+#
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC
+#
+
+[Sources.common]
+ UefiHiiServicesLib.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+
+[LibraryClasses]
+ UefiBootServicesTableLib
+ DebugLib
+
+[Protocols]
+ gEfiHiiFontProtocolGuid
+ gEfiHiiStringProtocolGuid
+ gEfiHiiImageProtocolGuid
+ gEfiHiiDatabaseProtocolGuid
+ gEfiHiiConfigRoutingProtocolGuid
+
+[Depex.common.DXE_DRIVER]
+ gEfiHiiStringProtocolGuid AND
+ gEfiHiiDatabaseProtocolGuid AND
+ gEfiHiiConfigRoutingProtocolGuid
+
+[Depex.common.DXE_RUNTIME_DRIVER]
+ gEfiHiiStringProtocolGuid AND
+ gEfiHiiDatabaseProtocolGuid AND
+ gEfiHiiConfigRoutingProtocolGuid
+
+[Depex.common.DXE_SAL_DRIVER]
+ gEfiHiiStringProtocolGuid AND
+ gEfiHiiDatabaseProtocolGuid AND
+ gEfiHiiConfigRoutingProtocolGuid
+
+[Depex.common.DXE_SMM_DRIVER]
+ gEfiHiiStringProtocolGuid AND
+ gEfiHiiDatabaseProtocolGuid AND
+ gEfiHiiConfigRoutingProtocolGuid
|