From 9226efe5ebb83ad0d5882e3eb7a54f3d63f81e9d Mon Sep 17 00:00:00 2001 From: qwang12 Date: Sat, 2 Feb 2008 13:15:44 +0000 Subject: 1) Cleanup HiiLib, IfrSupportLib. 2) Add ExtendedHiiLib and ExtendedIfrSupportLib which implement APIs that require the OPcode and Device Path which is specific to Intel's implementation. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4662 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Library/ExtendedHiiLib/ExtendedHiiLib.c | 116 +++++++++++++++++++++ .../Library/ExtendedHiiLib/ExtendedHiiLib.inf | 47 +++++++++ .../Library/ExtendedHiiLib/ExtendedHiiLib.msa | 45 ++++++++ 3 files changed, 208 insertions(+) create mode 100644 MdeModulePkg/Library/ExtendedHiiLib/ExtendedHiiLib.c create mode 100644 MdeModulePkg/Library/ExtendedHiiLib/ExtendedHiiLib.inf create mode 100644 MdeModulePkg/Library/ExtendedHiiLib/ExtendedHiiLib.msa (limited to 'MdeModulePkg/Library/ExtendedHiiLib') diff --git a/MdeModulePkg/Library/ExtendedHiiLib/ExtendedHiiLib.c b/MdeModulePkg/Library/ExtendedHiiLib/ExtendedHiiLib.c new file mode 100644 index 0000000000..22b9763fad --- /dev/null +++ b/MdeModulePkg/Library/ExtendedHiiLib/ExtendedHiiLib.c @@ -0,0 +1,116 @@ +/** @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. + +**/ + + +#include + +#include + +#include +#include +#include +#include +#include + + +// +// Hii vendor device path template +// +HII_VENDOR_DEVICE_PATH mHiiVendorDevicePathTemplate = { + { + { + { + HARDWARE_DEVICE_PATH, + HW_VENDOR_DP, + { + (UINT8) (sizeof (HII_VENDOR_DEVICE_PATH_NODE)), + (UINT8) ((sizeof (HII_VENDOR_DEVICE_PATH_NODE)) >> 8) + } + }, + EFI_IFR_TIANO_GUID + }, + 0 + }, + { + END_DEVICE_PATH_TYPE, + END_ENTIRE_DEVICE_PATH_SUBTYPE, + { + END_DEVICE_PATH_LENGTH + } + } +}; + + +EFI_STATUS +EFIAPI +HiiLibCreateHiiDriverHandle ( + OUT EFI_HANDLE *DriverHandle + ) +{ + EFI_STATUS Status; + HII_VENDOR_DEVICE_PATH_NODE *VendorDevicePath; + UINT64 MonotonicCount; + + VendorDevicePath = AllocateCopyPool (sizeof (HII_VENDOR_DEVICE_PATH), &mHiiVendorDevicePathTemplate); + if (VendorDevicePath == NULL) { + return EFI_OUT_OF_RESOURCES; + } + + gBS->GetNextMonotonicCount (&MonotonicCount); + VendorDevicePath->MonotonicCount = (UINT32) MonotonicCount; + + *DriverHandle = NULL; + Status = gBS->InstallProtocolInterface ( + DriverHandle, + &gEfiDevicePathProtocolGuid, + EFI_NATIVE_INTERFACE, + VendorDevicePath + ); + if (EFI_ERROR (Status)) { + return Status; + } + + return EFI_SUCCESS; +} + + +VOID +EFIAPI +HiiLibDestroyHiiDriverHandle ( + IN EFI_HANDLE DriverHandle + ) +{ + EFI_STATUS Status; + EFI_DEVICE_PATH_PROTOCOL *DevicePath; + + Status = gBS->HandleProtocol ( + DriverHandle, + &gEfiDevicePathProtocolGuid, + (VOID **) &DevicePath + ); + ASSERT_EFI_ERROR (Status); + + Status = gBS->UninstallProtocolInterface ( + DriverHandle, + &gEfiDevicePathProtocolGuid, + DevicePath + ); + ASSERT_EFI_ERROR (Status); + + FreePool (DevicePath); + +} + + + diff --git a/MdeModulePkg/Library/ExtendedHiiLib/ExtendedHiiLib.inf b/MdeModulePkg/Library/ExtendedHiiLib/ExtendedHiiLib.inf new file mode 100644 index 0000000000..f7b8e340ae --- /dev/null +++ b/MdeModulePkg/Library/ExtendedHiiLib/ExtendedHiiLib.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 = ExtendedHiiLib + FILE_GUID = 35961516-ABA1-4636-A4C0-608E62BE8BB0 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = ExtendedHiiLib|DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER + EDK_RELEASE_VERSION = 0x00020000 + EFI_SPECIFICATION_VERSION = 0x0002000A + +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# + +[Sources.common] + ExtendedHiiLib.c + + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + +[LibraryClasses] + MemoryAllocationLib + DebugLib + PcdLib + UefiRuntimeServicesTableLib + +[Protocols] + gEfiDevicePathProtocolGuid + diff --git a/MdeModulePkg/Library/ExtendedHiiLib/ExtendedHiiLib.msa b/MdeModulePkg/Library/ExtendedHiiLib/ExtendedHiiLib.msa new file mode 100644 index 0000000000..feedd2103e --- /dev/null +++ b/MdeModulePkg/Library/ExtendedHiiLib/ExtendedHiiLib.msa @@ -0,0 +1,45 @@ + + + + HiiLib + DXE_DRIVER + 3143687A-7C80-404e-B5FE-2D88980E1B1C + 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 -- cgit v1.2.3