summaryrefslogtreecommitdiff
path: root/IntelFrameworkPkg/Library
diff options
context:
space:
mode:
authorqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2008-01-22 01:27:53 +0000
committerqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2008-01-22 01:27:53 +0000
commit6178919748ecbe78fcde282a7f6b49bac4fe4243 (patch)
treec32404d95a4c5d6718020e2dc4e50a107e8ff3f7 /IntelFrameworkPkg/Library
parent5fd5fcd321e3d778aa51f1a47732c8d886c1ff4c (diff)
downloadedk2-platforms-6178919748ecbe78fcde282a7f6b49bac4fe4243.tar.xz
UEFI HII: Merge UEFI HII support changes from branch.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4603 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'IntelFrameworkPkg/Library')
-rw-r--r--IntelFrameworkPkg/Library/HiiLibFramework/HiiLibFramework.c118
-rw-r--r--IntelFrameworkPkg/Library/HiiLibFramework/HiiLibFramework.inf47
2 files changed, 165 insertions, 0 deletions
diff --git a/IntelFrameworkPkg/Library/HiiLibFramework/HiiLibFramework.c b/IntelFrameworkPkg/Library/HiiLibFramework/HiiLibFramework.c
new file mode 100644
index 0000000000..ca7febda4b
--- /dev/null
+++ b/IntelFrameworkPkg/Library/HiiLibFramework/HiiLibFramework.c
@@ -0,0 +1,118 @@
+/** @file
+ HII Library implementation that uses DXE protocols and services.
+
+ Copyright (c) 2006, 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.
+
+ Module Name: HiiLib.c
+
+**/
+
+
+#include <FrameworkDxe.h>
+
+
+#include <Protocol/FrameworkHii.h>
+
+#include <Library/HiiLib.h>
+#include <Library/DebugLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/MemoryAllocationLib.h>
+
+EFI_HII_PROTOCOL *gHiiProtocol = NULL;
+
+
+EFI_STATUS
+EFIAPI
+HiiLibFrameworkConstructor (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+
+ Status = gBS->LocateProtocol (
+ &gEfiHiiProtocolGuid,
+ NULL,
+ &gHiiProtocol
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ return Status;
+
+}
+
+/**
+ This function allocates pool for an EFI_HII_PACKAGES structure
+ with enough space for the variable argument list of package pointers.
+ The allocated structure is initialized using NumberOfPackages, Guid,
+ and the variable length argument list of package pointers.
+
+ @param NumberOfPackages The number of HII packages to prepare.
+ @param Guid Package GUID.
+
+ @return The allocated and initialized packages.
+
+**/
+EFI_HII_PACKAGES *
+InternalPreparePackages (
+ IN UINTN NumberOfPackages,
+ IN CONST EFI_GUID *Guid OPTIONAL,
+ IN VA_LIST Args
+ )
+{
+ EFI_HII_PACKAGES *HiiPackages;
+ VOID **Package;
+ UINTN Index;
+
+ ASSERT (NumberOfPackages > 0);
+
+ HiiPackages = AllocateZeroPool (sizeof (EFI_HII_PACKAGES) + NumberOfPackages * sizeof (VOID *));
+ ASSERT (HiiPackages != NULL);
+
+ HiiPackages->GuidId = (EFI_GUID *) Guid;
+ HiiPackages->NumberOfPackages = NumberOfPackages;
+ Package = (VOID **) (((UINT8 *) HiiPackages) + sizeof (EFI_HII_PACKAGES));
+
+ for (Index = 0; Index < NumberOfPackages; Index++) {
+ *Package = VA_ARG (Args, VOID *);
+ Package++;
+ }
+
+ return HiiPackages;
+
+}
+
+EFI_STATUS
+EFIAPI
+PrepareAndCreateNewPackages (
+ IN UINTN NumberOfPackages,
+ IN CONST EFI_GUID *GuidId,
+ OUT VOID **HiiHandle, //Framework is FRAMEWORK_HII_HANDLE; UEFI is EFI_HII_HANDLE;
+ // C:\D\Work\Tiano\Tiano_Main_Trunk\TIANO\Platform\IntelEpg\SR870BN4\MemorySubClassDriver\DualChannelDdr\MemorySubClass.c make use of this output value
+ ...
+ )
+{
+ EFI_STATUS Status;
+ EFI_HII_PACKAGES *PackageList;
+ VA_LIST Args;
+ FRAMEWORK_EFI_HII_HANDLE FrameworkHiiHandle;
+
+
+ VA_START (Args, HiiHandle);
+ PackageList = InternalPreparePackages (NumberOfPackages, GuidId, Args);
+ VA_END (Args);
+
+ Status = gHiiProtocol->NewPack (gHiiProtocol, PackageList, &FrameworkHiiHandle);
+ *HiiHandle = (VOID *) (UINTN) FrameworkHiiHandle;
+
+ return Status;
+}
+
+
diff --git a/IntelFrameworkPkg/Library/HiiLibFramework/HiiLibFramework.inf b/IntelFrameworkPkg/Library/HiiLibFramework/HiiLibFramework.inf
new file mode 100644
index 0000000000..169cf00846
--- /dev/null
+++ b/IntelFrameworkPkg/Library/HiiLibFramework/HiiLibFramework.inf
@@ -0,0 +1,47 @@
+#/** @file
+# Library instance for HII common routines.
+#
+# This library instance implements the common HII routines.
+# Copyright (c) 2006, 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 = HiiLibFramework
+ FILE_GUID = BD4BB0E3-1AFF-4304-AD0B-32A80B20FCAD
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = HiiLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER
+ EDK_RELEASE_VERSION = 0x00020000
+ EFI_SPECIFICATION_VERSION = 0x00020000
+
+ CONSTRUCTOR = HiiLibFrameworkConstructor
+
+
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC
+#
+
+[Sources.common]
+ HiiLibFramework.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ IntelFrameworkPkg/IntelFrameworkPkg.dec
+
+[LibraryClasses]
+ MemoryAllocationLib
+ DebugLib
+