From 0a869bf895adafde73f055c9890d2f007b78d94e Mon Sep 17 00:00:00 2001 From: qwang12 Date: Wed, 27 Jun 2007 01:46:13 +0000 Subject: [PATCH] Add in Intel Framework HiiLib class and instance. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2760 6f19259b-4bc3-4df7-8a09-765794883524 --- IntelFrameworkPkg/Include/Library/HiiLib.h | 44 ++++++++++++ .../Library/HiiLib/CommonHeader.h | 33 +++++++++ IntelFrameworkPkg/Library/HiiLib/HiiLib.c | 67 ++++++++++++++++++ IntelFrameworkPkg/Library/HiiLib/HiiLib.inf | 70 +++++++++++++++++++ IntelFrameworkPkg/Library/HiiLib/HiiLib.msa | 45 ++++++++++++ 5 files changed, 259 insertions(+) create mode 100644 IntelFrameworkPkg/Include/Library/HiiLib.h create mode 100644 IntelFrameworkPkg/Library/HiiLib/CommonHeader.h create mode 100644 IntelFrameworkPkg/Library/HiiLib/HiiLib.c create mode 100644 IntelFrameworkPkg/Library/HiiLib/HiiLib.inf create mode 100644 IntelFrameworkPkg/Library/HiiLib/HiiLib.msa diff --git a/IntelFrameworkPkg/Include/Library/HiiLib.h b/IntelFrameworkPkg/Include/Library/HiiLib.h new file mode 100644 index 0000000000..51fde1460d --- /dev/null +++ b/IntelFrameworkPkg/Include/Library/HiiLib.h @@ -0,0 +1,44 @@ +/** @file + Public include file for the HII Library + + 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. + + Module Name: HiiLib.h + +**/ + +#ifndef __HII_LIB_H__ +#define __HII_LIB_H__ + +/** + 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 * +EFIAPI +PreparePackages ( + IN UINTN NumberOfPackages, + IN CONST EFI_GUID *Guid OPTIONAL, + ... + ) +; + + + +#endif diff --git a/IntelFrameworkPkg/Library/HiiLib/CommonHeader.h b/IntelFrameworkPkg/Library/HiiLib/CommonHeader.h new file mode 100644 index 0000000000..7b3891c82a --- /dev/null +++ b/IntelFrameworkPkg/Library/HiiLib/CommonHeader.h @@ -0,0 +1,33 @@ +/**@file + Common header file shared by all source files. + + This file includes package header files, library classes and protocol, PPI & GUID definitions. + + 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. +**/ + +#ifndef __COMMON_HEADER_H_ +#define __COMMON_HEADER_H_ + + +// +// The package level header files this module uses +// +#include +// +// The protocols, PPI and GUID defintions for this module +// +// +// The Library classes this module consumes +// +#include +#include +#include + +#endif diff --git a/IntelFrameworkPkg/Library/HiiLib/HiiLib.c b/IntelFrameworkPkg/Library/HiiLib/HiiLib.c new file mode 100644 index 0000000000..3b0876cc3b --- /dev/null +++ b/IntelFrameworkPkg/Library/HiiLib/HiiLib.c @@ -0,0 +1,67 @@ +/** @file + HII Library implementation that uses DXE protocols and services. + + 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. + + Module Name: HiiLib.c + +**/ + +// +// Include common header file for this module. +// +#include "CommonHeader.h" + +/** + 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 * +EFIAPI +PreparePackages ( + IN UINTN NumberOfPackages, + IN CONST EFI_GUID *Guid OPTIONAL, + ... + ) +{ + 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)); + + VA_START (Args, Guid); + + for (Index = 0; Index < NumberOfPackages; Index++) { + *Package = VA_ARG (Args, VOID *); + Package++; + } + + VA_END (Args); + + return HiiPackages; + +} diff --git a/IntelFrameworkPkg/Library/HiiLib/HiiLib.inf b/IntelFrameworkPkg/Library/HiiLib/HiiLib.inf new file mode 100644 index 0000000000..80ec9fff58 --- /dev/null +++ b/IntelFrameworkPkg/Library/HiiLib/HiiLib.inf @@ -0,0 +1,70 @@ +#/** @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 Section - statements that will be processed to create a Makefile. +# +################################################################################ +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = HiiLib + FILE_GUID = 1e2c4c2e-67e6-4e57-b3ae-cf5a5af72c2c + 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 + + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# + +################################################################################ +# +# Sources Section - list of files that are required for the build to succeed. +# +################################################################################ + +[Sources.common] + HiiLib.c + CommonHeader.h + + +################################################################################ +# +# Includes Section - list of Include locations that are required for +# this module. +# +################################################################################ + +[Includes] + $(WORKSPACE)/MdePkg/Include/Library + +################################################################################ +# +# Library Class Section - list of Library Classes that are required for +# this module. +# +################################################################################ + +[LibraryClasses] + MemoryAllocationLib + DebugLib + diff --git a/IntelFrameworkPkg/Library/HiiLib/HiiLib.msa b/IntelFrameworkPkg/Library/HiiLib/HiiLib.msa new file mode 100644 index 0000000000..d3eac8fb35 --- /dev/null +++ b/IntelFrameworkPkg/Library/HiiLib/HiiLib.msa @@ -0,0 +1,45 @@ + + + + HiiLib + DXE_DRIVER + 1e2c4c2e-67e6-4e57-b3ae-cf5a5af72c2c + 1.0 + 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. + FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052 + + + IA32 X64 IPF EBC + false + HiiLib + + + + HiiLib + + + DebugLib + + + MemoryAllocationLib + + + + HiiLib.c + + + + + + EFI_SPECIFICATION_VERSION 0x00020000 + EDK_RELEASE_VERSION 0x00020000 + + \ No newline at end of file