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
This commit is contained in:
118
IntelFrameworkPkg/Library/HiiLibFramework/HiiLibFramework.c
Normal file
118
IntelFrameworkPkg/Library/HiiLibFramework/HiiLibFramework.c
Normal file
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user