From 4259256b48aea70035b8e68e75ed12cdde36c908 Mon Sep 17 00:00:00 2001 From: qwang12 Date: Thu, 3 Apr 2008 10:36:52 +0000 Subject: Fix a type in the directory name. Compatiblity -> Compatibility. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4994 6f19259b-4bc3-4df7-8a09-765794883524 --- .../FrameworkHiiToUefiHiiThunk/Fonts.c | 68 + .../FrameworkHiiToUefiHiiThunk/Forms.c | 154 ++ .../FrameworkHiiToUefiHiiThunk.inf | 75 + .../FrameworkHiiToUefiHiiThunk/HiiDatabase.c | 207 +++ .../FrameworkHiiToUefiHiiThunk/HiiDatabase.h | 322 +++++ .../FrameworkHiiToUefiHiiThunk/Keyboard.c | 37 + .../FrameworkHiiToUefiHiiThunk/Package.c | 518 +++++++ .../FrameworkHiiToUefiHiiThunk/Strings.c | 315 +++++ .../FrameworkHiiToUefiHiiThunk/Utility.c | 41 + .../FrameworkHiiToUefiHiiThunk/Utility.h | 24 + .../Compatibility/Fv2ToFvThunk/Fv2ToFvThunk.c | 1492 ++++++++++++++++++++ .../Compatibility/Fv2ToFvThunk/Fv2ToFvThunk.inf | 53 + .../Compatibility/FvToFv2Thunk/FvToFv2Thunk.c | 619 ++++++++ .../Compatibility/FvToFv2Thunk/FvToFv2Thunk.inf | 53 + .../PciCfg2ToPciCfgThunk/PciCfg2ToPciCfgThunk.c | 219 +++ .../PciCfg2ToPciCfgThunk/PciCfg2ToPciCfgThunk.inf | 53 + .../PciCfgToPciCfg2Thunk/PciCfgToPciCfg2Thunk.c | 155 ++ .../PciCfgToPciCfg2Thunk/PciCfgToPciCfg2Thunk.inf | 50 + .../ReadOnlyVariable2ToReadOnlyVariableThunk.c | 208 +++ .../ReadOnlyVariable2ToReadOnlyVariableThunk.inf | 52 + .../ReadOnlyVariableToReadOnlyVariable2Thunk.c | 208 +++ .../ReadOnlyVariableToReadOnlyVariable2Thunk.inf | 52 + 22 files changed, 4975 insertions(+) create mode 100644 EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Fonts.c create mode 100644 EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Forms.c create mode 100644 EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/FrameworkHiiToUefiHiiThunk.inf create mode 100644 EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.c create mode 100644 EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.h create mode 100644 EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Keyboard.c create mode 100644 EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Package.c create mode 100644 EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Strings.c create mode 100644 EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Utility.c create mode 100644 EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Utility.h create mode 100644 EdkCompatibilityPkg/Compatibility/Fv2ToFvThunk/Fv2ToFvThunk.c create mode 100644 EdkCompatibilityPkg/Compatibility/Fv2ToFvThunk/Fv2ToFvThunk.inf create mode 100644 EdkCompatibilityPkg/Compatibility/FvToFv2Thunk/FvToFv2Thunk.c create mode 100644 EdkCompatibilityPkg/Compatibility/FvToFv2Thunk/FvToFv2Thunk.inf create mode 100644 EdkCompatibilityPkg/Compatibility/PciCfg2ToPciCfgThunk/PciCfg2ToPciCfgThunk.c create mode 100644 EdkCompatibilityPkg/Compatibility/PciCfg2ToPciCfgThunk/PciCfg2ToPciCfgThunk.inf create mode 100644 EdkCompatibilityPkg/Compatibility/PciCfgToPciCfg2Thunk/PciCfgToPciCfg2Thunk.c create mode 100644 EdkCompatibilityPkg/Compatibility/PciCfgToPciCfg2Thunk/PciCfgToPciCfg2Thunk.inf create mode 100644 EdkCompatibilityPkg/Compatibility/ReadOnlyVariable2ToReadOnlyVariableThunk/ReadOnlyVariable2ToReadOnlyVariableThunk.c create mode 100644 EdkCompatibilityPkg/Compatibility/ReadOnlyVariable2ToReadOnlyVariableThunk/ReadOnlyVariable2ToReadOnlyVariableThunk.inf create mode 100644 EdkCompatibilityPkg/Compatibility/ReadOnlyVariableToReadOnlyVariable2Thunk/ReadOnlyVariableToReadOnlyVariable2Thunk.c create mode 100644 EdkCompatibilityPkg/Compatibility/ReadOnlyVariableToReadOnlyVariable2Thunk/ReadOnlyVariableToReadOnlyVariable2Thunk.inf (limited to 'EdkCompatibilityPkg') diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Fonts.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Fonts.c new file mode 100644 index 0000000..eadc5b3 --- /dev/null +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Fonts.c @@ -0,0 +1,68 @@ +/**@file + + This file contains the Glyph related function. + +Copyright (c) 2006 - 2008, 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 "HiiDatabase.h" + +EFI_STATUS +EFIAPI +HiiGetGlyph ( + IN EFI_HII_PROTOCOL *This, + IN CHAR16 *Source, + IN OUT UINT16 *Index, + OUT UINT8 **GlyphBuffer, + OUT UINT16 *BitWidth, + IN OUT UINT32 *InternalStatus + ) +/*++ + +Routine Description: + Translates a Unicode character into the corresponding font glyph. + If the Source was pointing to a non-spacing character, the next Source[*Index] + character will be parsed and OR'd to the GlyphBuffer until a spacing character + is found in the Source. Since non-spacing characters are considered to be the + same pixel width as a regular character their BitWidth will be reflected correctly + however due to their special attribute, they are considered to be zero advancing width. + This basically means that the cursor would not advance, thus the character that follows + it would overlay the non-spacing character. The Index is modified to reflect both the + incoming array entry into the Source string but also the outgoing array entry after having + parsed the equivalent of a single Glyph's worth of data. + +Arguments: + +Returns: + +--*/ +{ + ASSERT (FALSE); + return EFI_SUCCESS; +} + +EFI_STATUS +EFIAPI +HiiGlyphToBlt ( + IN EFI_HII_PROTOCOL *This, + IN UINT8 *GlyphBuffer, + IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground, + IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background, + IN UINTN Count, + IN UINTN Width, + IN UINTN Height, + IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer + ) +{ + ASSERT (FALSE); + return EFI_SUCCESS; +} diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Forms.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Forms.c new file mode 100644 index 0000000..0e49e20 --- /dev/null +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Forms.c @@ -0,0 +1,154 @@ +/**@file + This file contains the form processing code to the HII database. + +Copyright (c) 2006 - 2008 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 "HiiDatabase.h" + +EFI_STATUS +EFIAPI +HiiExportDatabase ( + IN EFI_HII_PROTOCOL *This, + IN FRAMEWORK_EFI_HII_HANDLE Handle, + IN OUT UINTN *BufferSize, + OUT VOID *Buffer + ) +/*++ + +Routine Description: + + This function allows a program to extract a form or form package that has + previously been registered with the EFI HII database. + +Arguments: + +Returns: + +--*/ +{ + ASSERT (FALSE); + return EFI_UNSUPPORTED; +} + +EFI_STATUS +EFIAPI +HiiGetForms ( + IN EFI_HII_PROTOCOL *This, + IN FRAMEWORK_EFI_HII_HANDLE Handle, + IN EFI_FORM_ID FormId, + IN OUT UINTN *BufferLengthTemp, + OUT UINT8 *Buffer + ) +/*++ + +Routine Description: + + This function allows a program to extract a form or form package that has + previously been registered with the EFI HII database. + +Arguments: + This - A pointer to the EFI_HII_PROTOCOL instance. + + Handle - Handle on which the form resides. Type FRAMEWORK_EFI_HII_HANDLE is defined in + EFI_HII_PROTOCOL.NewPack() in the Packages section. + + FormId - The ID of the form to return. If the ID is zero, the entire form package is returned. + Type EFI_FORM_ID is defined in "Related Definitions" below. + + BufferLength - On input, the length of the Buffer. On output, the length of the returned buffer, if + the length was sufficient and, if it was not, the length that is required to fit the + requested form(s). + + Buffer - The buffer designed to receive the form(s). + +Returns: + + EFI_SUCCESS - Buffer filled with the requested forms. BufferLength + was updated. + + EFI_INVALID_PARAMETER - The handle is unknown. + + EFI_NOT_FOUND - A form on the requested handle cannot be found with the + requested FormId. + + EFI_BUFFER_TOO_SMALL - The buffer provided was not large enough to allow the form to be stored. + +--*/ +{ + ASSERT (FALSE); + return EFI_UNSUPPORTED; +} + +EFI_STATUS +EFIAPI +HiiGetDefaultImage ( + IN EFI_HII_PROTOCOL *This, + IN FRAMEWORK_EFI_HII_HANDLE Handle, + IN UINTN DefaultMask, + OUT EFI_HII_VARIABLE_PACK_LIST **VariablePackList + ) +/*++ + + Routine Description: + + This function allows a program to extract the NV Image + that represents the default storage image + + Arguments: + This - A pointer to the EFI_HII_PROTOCOL instance. + Handle - The HII handle from which will have default data retrieved. + UINTN - Mask used to retrieve the default image. + VariablePackList - Callee allocated, tightly-packed, link list data + structure that contain all default varaible packs + from the Hii Database. + + Returns: + EFI_NOT_FOUND - If Hii database does not contain any default images. + EFI_INVALID_PARAMETER - Invalid input parameter. + EFI_SUCCESS - Operation successful. + +--*/ +{ + return EFI_SUCCESS; +} + + +EFI_STATUS +EFIAPI +HiiUpdateForm ( + IN EFI_HII_PROTOCOL *This, + IN FRAMEWORK_EFI_HII_HANDLE Handle, + IN EFI_FORM_LABEL Label, + IN BOOLEAN AddData, + IN EFI_HII_UPDATE_DATA *Data + ) +/*++ + +Routine Description: + This function allows the caller to update a form that has + previously been registered with the EFI HII database. + +Arguments: + Handle - Hii Handle associated with the Formset to modify + Label - Update information starting immediately after this label in the IFR + AddData - If TRUE, add data. If FALSE, remove data + Data - If adding data, this is the pointer to the data to add + +Returns: + EFI_SUCCESS - Update success. + Other - Update fail. + +--*/ +{ + return EFI_SUCCESS; +} diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/FrameworkHiiToUefiHiiThunk.inf b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/FrameworkHiiToUefiHiiThunk.inf new file mode 100644 index 0000000..38f7a9b --- /dev/null +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/FrameworkHiiToUefiHiiThunk.inf @@ -0,0 +1,75 @@ +#/** @file +# Component description file for HiiDatabase module which produce a Framework HII instance +# based on the avaliable UEFI HII protocol found in the platform. +# +# This module inits HII database and installs HII protocol based on the avaliable UEFI HII protocol found in the platform.. +# Copyright (c) 2006 - 2008, 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 = FrameworkHiiToUefiHiiThunk + FILE_GUID = AC3435BB-B1D3-4EF8-957C-8048606FF671 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + EDK_RELEASE_VERSION = 0x00020000 + EFI_SPECIFICATION_VERSION = 0x00020000 + + ENTRY_POINT = InitializeHiiDatabase + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# + +[Sources.common] + Keyboard.c + Fonts.c + Package.c + Strings.c + Forms.c + HiiDatabase.h + HiiDatabase.c + Utility.c + Utility.h + + +[Packages] + MdePkg/MdePkg.dec + IntelFrameworkPkg/IntelFrameworkPkg.dec + +[LibraryClasses] + UefiRuntimeServicesTableLib + UefiBootServicesTableLib + BaseMemoryLib + MemoryAllocationLib + UefiDriverEntryPoint + DebugLib + BaseLib + HiiLib + + + +[Protocols] + gEfiHiiProtocolGuid + gEfiHiiImageProtocolGuid + gEfiHiiDatabaseProtocolGuid + gEfiHiiStringProtocolGuid + gEfiHiiFontProtocolGuid + +[Depex] + gEfiHiiImageProtocolGuid AND + gEfiHiiDatabaseProtocolGuid AND + gEfiHiiStringProtocolGuid AND + gEfiHiiFontProtocolGuid + diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.c new file mode 100644 index 0000000..c7d339e --- /dev/null +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.c @@ -0,0 +1,207 @@ +/**@file + +Framework to UEFI 2.1 HII Thunk + +Copyright (c) 2003, 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 "HiiDatabase.h" + + +EFI_HII_THUNK_PRIVATE_DATA HiiThunkPrivateDataTempate = { + {//Signature + EFI_HII_THUNK_DRIVER_DATA_SIGNATURE + }, + {//Handle + (EFI_HANDLE) NULL + }, + { //Hii + HiiNewPack, + HiiRemovePack, + HiiFindHandles, + HiiExportDatabase, + + HiiTestString, + HiiGetGlyph, + HiiGlyphToBlt, + + HiiNewString, + HiiGetPrimaryLanguages, + HiiGetSecondaryLanguages, + HiiGetString, + HiiResetStrings, + HiiGetLine, + HiiGetForms, + HiiGetDefaultImage, + HiiUpdateForm, + + HiiGetKeyboardLayout + }, + { //StaticHiiHandle + //The FRAMEWORK_EFI_HII_HANDLE starts from 1 + // and increase upwords untill reach 2^(sizeof (FRAMEWORK_EFI_HII_HANDLE)) - 1. + // The code will assert to prevent overflow. + (FRAMEWORK_EFI_HII_HANDLE) 1 + }, + { + NULL, NULL //HiiHandleLinkList + }, +}; + +EFI_HII_DATABASE_PROTOCOL *mUefiHiiDatabaseProtocol; +EFI_HII_FONT_PROTOCOL *mUefiHiiFontProtocol; +EFI_HII_IMAGE_PROTOCOL *mUefiHiiImageProtocol; +EFI_HII_STRING_PROTOCOL *mUefiStringProtocol; + +EFI_STATUS +EFIAPI +InitializeHiiDatabase ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +/*++ + +Routine Description: + Initialize HII Database + +Arguments: + (Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT) + +Returns: + EFI_SUCCESS - Setup loaded. + other - Setup Error + +--*/ +{ + EFI_HII_THUNK_PRIVATE_DATA *HiiData; + EFI_HANDLE Handle; + EFI_STATUS Status; + + ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiProtocolGuid); + + HiiData = AllocateCopyPool (sizeof (EFI_HII_THUNK_PRIVATE_DATA), &HiiThunkPrivateDataTempate); + ASSERT (HiiData != NULL); + InitializeListHead (&HiiData->HiiThunkHandleMappingDBListHead); + + Status = gBS->LocateProtocol ( + &gEfiHiiDatabaseProtocolGuid, + NULL, + (VOID **) &mUefiHiiDatabaseProtocol + ); + ASSERT_EFI_ERROR (Status); + + Status = gBS->LocateProtocol ( + &gEfiHiiFontProtocolGuid, + NULL, + (VOID **) &mUefiHiiFontProtocol + ); + ASSERT_EFI_ERROR (Status); + + Status = gBS->LocateProtocol ( + &gEfiHiiImageProtocolGuid, + NULL, + (VOID **) &mUefiHiiImageProtocol + ); + ASSERT_EFI_ERROR (Status); + + Status = gBS->LocateProtocol ( + &gEfiHiiStringProtocolGuid, + NULL, + (VOID **) &mUefiStringProtocol + ); + ASSERT_EFI_ERROR (Status); + + // + // Install protocol interface + // + Handle = NULL; + Status = gBS->InstallProtocolInterface ( + &HiiData->Handle, + &gEfiHiiProtocolGuid, + EFI_NATIVE_INTERFACE, + (VOID *) &HiiData->Hii + ); + ASSERT_EFI_ERROR (Status); + + return Status; +} + +EFI_STATUS +EFIAPI +HiiFindHandles ( + IN EFI_HII_PROTOCOL *This, + IN OUT UINT16 *HandleBufferLength, + OUT FRAMEWORK_EFI_HII_HANDLE Handle[1] + ) +/*++ + +Routine Description: + Determines the handles that are currently active in the database. + +Arguments: + +Returns: + +--*/ +{ + ASSERT (FALSE); + return EFI_SUCCESS; +} + +EFI_STATUS +EFIAPI +HiiGetPrimaryLanguages ( + IN EFI_HII_PROTOCOL *This, + IN FRAMEWORK_EFI_HII_HANDLE Handle, + OUT EFI_STRING *LanguageString + ) +/*++ + +Routine Description: + + This function allows a program to determine what the primary languages that are supported on a given handle. + +Arguments: + +Returns: + +--*/ +{ + ASSERT (FALSE); + return EFI_SUCCESS; +} + +EFI_STATUS +EFIAPI +HiiGetSecondaryLanguages ( + IN EFI_HII_PROTOCOL *This, + IN FRAMEWORK_EFI_HII_HANDLE Handle, + IN CHAR16 *PrimaryLanguage, + OUT EFI_STRING *LanguageString + ) +/*++ + +Routine Description: + + This function allows a program to determine which secondary languages are supported + on a given handle for a given primary language. + + Arguments: + +Returns: + +--*/ +{ + ASSERT (FALSE); + return EFI_SUCCESS; +} + + diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.h b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.h new file mode 100644 index 0000000..f0ef02e --- /dev/null +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/HiiDatabase.h @@ -0,0 +1,322 @@ +/**@file + + This file contains global defines and prototype definitions + for the HII database. + +Copyright (c) 2006 - 2008, 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 _HIIDATABASE_H +#define _HIIDATABASE_H + + +#include + +#include +#include +#include + +// +// UEFI HII Protocols +// +#include +#include +#include +#include +#include +#include + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "Utility.h" + +// +// Macros +// + + +// +// Typedef +// + +typedef struct { + UINT32 BinaryLength; + EFI_HII_PACKAGE_HEADER PackageHeader; +} TIANO_AUTOGEN_PACKAGES_HEADER; + +#define EFI_HII_THUNK_PRIVATE_DATA_FROM_THIS(Record) CR(Record, EFI_HII_THUNK_PRIVATE_DATA, Hii, EFI_HII_THUNK_DRIVER_DATA_SIGNATURE) +#define EFI_HII_THUNK_DRIVER_DATA_SIGNATURE EFI_SIGNATURE_32 ('H', 'i', 'I', 'T') +typedef struct { + UINTN Signature; + EFI_HANDLE Handle; + EFI_HII_PROTOCOL Hii; + FRAMEWORK_EFI_HII_HANDLE StaticHiiHandle; + + // + // This LIST_ENTRY is the list head which has HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY type + // as list entry. + // + LIST_ENTRY HiiThunkHandleMappingDBListHead; + +} EFI_HII_THUNK_PRIVATE_DATA; + + +#define HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY_FROM_LISTENTRY(Record) CR(Record, HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY, List, HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY_SIGNATURE) +#define HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY_SIGNATURE EFI_SIGNATURE_32 ('H', 'T', 'H', 'M') +typedef struct { + LIST_ENTRY List; + UINT32 Signature; + FRAMEWORK_EFI_HII_HANDLE FrameworkHiiHandle; + EFI_HII_HANDLE UefiHiiHandle; + + BOOLEAN IsPackageListWithOnlyStringPackages; + // + // The field below is only valid if IsPackageListWithOnlyStringPack is TRUE. + // The HII 0.92 version of HII data implementation in EDK 1.03 and 1.04 make an the following assumption + // in both HII Database implementation and all modules that registering packages: + // If a Package List has only IFR package and no String Package, the String Package containing the strings + // referenced by this IFR package is in another Package List + // registered with the HII database with the same EFI_HII_PACKAGES.GuidId. + // + // + // Only valid if IsPackageListWithSingleStringPack is TRUE. + // UEFI Package List Head Pointer, pointing to a allocated buffer containing the package + // + EFI_HII_PACKAGE_LIST_HEADER *UefiStringPackageListHeader; //Only valid if IsStringPack is TRUE. + //This UEFI Package list only consists of a list of string packages. + + EFI_GUID TagGuid; + // + // TRUE if the package list identified by UefiHiiHandle imports String Packages from + // other package list with IsPackageListWithOnlyStringPackages is TRUE. + // + BOOLEAN DoesPackageListImportStringPackages; + EFI_HII_PACKAGE_LIST_HEADER *ImportedUefiStringPackageListHeader; //Only valid if DoesPackageListImportStringPackages is true. + +} HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY; + +// +// Extern Variables +// +extern EFI_HII_DATABASE_PROTOCOL *mUefiHiiDatabaseProtocol; +extern EFI_HII_FONT_PROTOCOL *mUefiHiiFontProtocol; +extern EFI_HII_IMAGE_PROTOCOL *mUefiHiiImageProtocol; +extern EFI_HII_STRING_PROTOCOL *mUefiStringProtocol; + +// +// Prototypes +// + +// +// Public Interface Prototypes +// +EFI_STATUS +EFIAPI +InitializeHiiDatabase ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +; + +EFI_STATUS +EFIAPI +HiiNewPack ( + IN EFI_HII_PROTOCOL *This, + IN EFI_HII_PACKAGES *PackageList, + OUT FRAMEWORK_EFI_HII_HANDLE *Handle + ) +; + +EFI_STATUS +EFIAPI +HiiRemovePack ( + IN EFI_HII_PROTOCOL *This, + IN FRAMEWORK_EFI_HII_HANDLE Handle + ) +; + +EFI_STATUS +EFIAPI +HiiFindHandles ( + IN EFI_HII_PROTOCOL *This, + IN OUT UINT16 *HandleBufferLength, + OUT FRAMEWORK_EFI_HII_HANDLE *Handle + ) +; + +EFI_STATUS +EFIAPI +HiiExportDatabase ( + IN EFI_HII_PROTOCOL *This, + IN FRAMEWORK_EFI_HII_HANDLE Handle, + IN OUT UINTN *BufferSize, + OUT VOID *Buffer + ) +; + +EFI_STATUS +EFIAPI +HiiGetGlyph ( + IN EFI_HII_PROTOCOL *This, + IN CHAR16 *Source, + IN OUT UINT16 *Index, + OUT UINT8 **GlyphBuffer, + OUT UINT16 *BitWidth, + IN OUT UINT32 *InternalStatus + ) +; + +EFI_STATUS +EFIAPI +HiiGlyphToBlt ( + IN EFI_HII_PROTOCOL *This, + IN UINT8 *GlyphBuffer, + IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground, + IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background, + IN UINTN Count, + IN UINTN Width, + IN UINTN Height, + IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer + ) +; + +EFI_STATUS +EFIAPI +HiiNewString ( + IN EFI_HII_PROTOCOL *This, + IN CHAR16 *Language, + IN FRAMEWORK_EFI_HII_HANDLE Handle, + IN OUT STRING_REF *Reference, + IN CHAR16 *NewString + ) +; + +EFI_STATUS +EFIAPI +HiiGetString ( + IN EFI_HII_PROTOCOL *This, + IN FRAMEWORK_EFI_HII_HANDLE Handle, + IN STRING_REF Token, + IN BOOLEAN Raw, + IN CHAR16 *LanguageString, + IN OUT UINTN *BufferLength, + OUT EFI_STRING StringBuffer + ) +; + +EFI_STATUS +EFIAPI +HiiResetStrings ( + IN EFI_HII_PROTOCOL *This, + IN FRAMEWORK_EFI_HII_HANDLE Handle + ) +; + +EFI_STATUS +EFIAPI +HiiTestString ( + IN EFI_HII_PROTOCOL *This, + IN CHAR16 *StringToTest, + IN OUT UINT32 *FirstMissing, + OUT UINT32 *GlyphBufferSize + ) +; + +EFI_STATUS +EFIAPI +HiiGetPrimaryLanguages ( + IN EFI_HII_PROTOCOL *This, + IN FRAMEWORK_EFI_HII_HANDLE Handle, + OUT EFI_STRING *LanguageString + ) +; + +EFI_STATUS +EFIAPI +HiiGetSecondaryLanguages ( + IN EFI_HII_PROTOCOL *This, + IN FRAMEWORK_EFI_HII_HANDLE Handle, + IN CHAR16 *PrimaryLanguage, + OUT EFI_STRING *LanguageString + ) +; + +EFI_STATUS +EFIAPI +HiiGetLine ( + IN EFI_HII_PROTOCOL *This, + IN FRAMEWORK_EFI_HII_HANDLE Handle, + IN STRING_REF Token, + IN OUT UINT16 *Index, + IN UINT16 LineWidth, + IN CHAR16 *LanguageString, + IN OUT UINT16 *BufferLength, + OUT EFI_STRING StringBuffer + ) +; + +EFI_STATUS +EFIAPI +HiiGetForms ( + IN EFI_HII_PROTOCOL *This, + IN FRAMEWORK_EFI_HII_HANDLE Handle, + IN EFI_FORM_ID FormId, + IN OUT UINTN *BufferLength, + OUT UINT8 *Buffer + ) +; + +EFI_STATUS +EFIAPI +HiiGetDefaultImage ( + IN EFI_HII_PROTOCOL *This, + IN FRAMEWORK_EFI_HII_HANDLE Handle, + IN UINTN DefaultMask, + OUT EFI_HII_VARIABLE_PACK_LIST **VariablePackList + ) +; + +EFI_STATUS +EFIAPI +HiiUpdateForm ( + IN EFI_HII_PROTOCOL *This, + IN FRAMEWORK_EFI_HII_HANDLE Handle, + IN EFI_FORM_LABEL Label, + IN BOOLEAN AddData, + IN EFI_HII_UPDATE_DATA *Data + ) +; + +EFI_STATUS +EFIAPI +HiiGetKeyboardLayout ( + IN EFI_HII_PROTOCOL *This, + OUT UINT16 *DescriptorCount, + OUT FRAMEWORK_EFI_KEY_DESCRIPTOR *Descriptor + ) +; + +EFI_STATUS +HiiCompareLanguage ( + IN CHAR16 *LanguageStringLocation, + IN CHAR16 *Language + ) +; + +#endif diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Keyboard.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Keyboard.c new file mode 100644 index 0000000..d54c9b9 --- /dev/null +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Keyboard.c @@ -0,0 +1,37 @@ +/**@file + + This file contains the keyboard processing code to the HII database. + +Copyright (c) 2006 - 2008, 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 "HiiDatabase.h" + +EFI_STATUS +EFIAPI +HiiGetKeyboardLayout ( + IN EFI_HII_PROTOCOL *This, + OUT UINT16 *DescriptorCount, + OUT FRAMEWORK_EFI_KEY_DESCRIPTOR *Descriptor + ) +/*++ + +Routine Description: + +Arguments: + +Returns: + +--*/ +{ + return EFI_SUCCESS; +} diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Package.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Package.c new file mode 100644 index 0000000..2a1407c --- /dev/null +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Package.c @@ -0,0 +1,518 @@ +/**@file + + This file contains the keyboard processing code to the HII database. + +Copyright (c) 2006 - 2008, 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 "HiiDatabase.h" + + +EFI_STATUS +GetIfrAndStringPackNum ( + IN CONST EFI_HII_PACKAGES *Packages, + UINTN *IfrPackNum, + UINTN *StringPackNum + ) +{ + UINTN Index; + TIANO_AUTOGEN_PACKAGES_HEADER **TianoAutogenPackageHdrArray; + + ASSERT (Packages != NULL); + ASSERT (IfrPackNum != NULL); + ASSERT (StringPackNum != NULL); + + *IfrPackNum = 0; + *StringPackNum = 0; + + TianoAutogenPackageHdrArray = (TIANO_AUTOGEN_PACKAGES_HEADER **) (((UINT8 *) &Packages->GuidId) + sizeof (Packages->GuidId)); + for (Index = 0; Index < Packages->NumberOfPackages; Index++) { + // + // BugBug: The current UEFI HII build tool generate a binary in the format defined in: + // TIANO_AUTOGEN_PACKAGES_HEADER. We assume that all packages generated in + // this binary is with same package type. So the returned IfrPackNum and StringPackNum + // may not be the exact number of valid package number in the binary generated + // by HII Build tool. + // + switch (TianoAutogenPackageHdrArray[Index]->PackageHeader.Type) { + case EFI_HII_PACKAGE_FORM: + *IfrPackNum += 1; + break; + case EFI_HII_PACKAGE_STRINGS: + *StringPackNum += 1; + break; + + case EFI_HII_PACKAGE_SIMPLE_FONTS: + break; + + // + // The following fonts are invalid for a module that using Framework to UEFI thunk layer. + // + case EFI_HII_PACKAGE_KEYBOARD_LAYOUT: + case EFI_HII_PACKAGE_FONTS: + case EFI_HII_PACKAGE_IMAGES: + default: + ASSERT (FALSE); + return EFI_INVALID_PARAMETER; + break; + } + } + + return EFI_SUCCESS; +} + +EFI_STATUS +LibExportPackageLists ( + IN EFI_HII_HANDLE UefiHiiHandle, + OUT EFI_HII_PACKAGE_LIST_HEADER **PackageListHeader, + OUT UINTN *PackageListSize + ) +{ + EFI_STATUS Status; + UINTN Size; + EFI_HII_PACKAGE_LIST_HEADER *PackageListHdr; + + ASSERT (PackageListSize != NULL); + ASSERT (PackageListHeader != NULL); + + Size = 0; + PackageListHdr = NULL; + Status = mUefiHiiDatabaseProtocol->ExportPackageLists ( + mUefiHiiDatabaseProtocol, + UefiHiiHandle, + &Size, + PackageListHdr + ); + ASSERT_EFI_ERROR (Status == EFI_BUFFER_TOO_SMALL); + if (Status == EFI_BUFFER_TOO_SMALL) { + PackageListHdr = AllocateZeroPool (Size); + ASSERT (PackageListHdr != NULL); + + if (PackageListHeader == NULL) { + return EFI_OUT_OF_RESOURCES; + } else { + Status = mUefiHiiDatabaseProtocol->ExportPackageLists ( + mUefiHiiDatabaseProtocol, + UefiHiiHandle, + &Size, + PackageListHdr + ); + ASSERT_EFI_ERROR (Status); + } + } + + if (!EFI_ERROR (Status)) { + *PackageListHeader = PackageListHdr; + *PackageListSize = Size; + } + + return Status; +} + +BOOLEAN +IsOnlyStringPackagesInPackageList ( + IN CONST EFI_HII_PACKAGE_LIST_HEADER *StringPackageListHeader + ) +{ + EFI_HII_PACKAGE_HEADER *PackageHeader; + + PackageHeader = (EFI_HII_PACKAGE_HEADER *) (StringPackageListHeader + 1); + + while (PackageHeader->Type != EFI_HII_PACKAGE_END) { + PackageHeader = (EFI_HII_PACKAGE_HEADER *) (PackageHeader ); + } +} + + +EFI_STATUS +InsertStringPackagesToIfrPackageList ( + IN CONST EFI_HII_PACKAGE_LIST_HEADER *StringPackageListHeader, + IN EFI_HII_HANDLE UefiHiiHandle + ) +{ + EFI_STATUS Status; + Status = mUefiHiiDatabaseProtocol->UpdatePackageList ( + mUefiHiiDatabaseProtocol, + UefiHiiHandle, + StringPackageListHeader + ); + + return Status; +} + + +/** + Removes a node from a doubly linked list, and returns the node that follows + the removed node. + + Removes the node Entry from a doubly linked list. It is up to the caller of + this function to release the memory used by this node if that is required. On + exit, the node following Entry in the doubly linked list is returned. If + Entry is the only node in the linked list, then the head node of the linked + list is returned. + + If Entry is NULL, then ASSERT(). + If Entry is the head node of an empty list, then ASSERT(). + If PcdMaximumLinkedListLength is not zero, and the number of nodes in the + linked list containing Entry, including the Entry node, is greater than + or equal to PcdMaximumLinkedListLength, then ASSERT(). + + @param Entry A pointer to a node in a linked list + + @return Entry + +**/ +EFI_STATUS +AddStringPackagesToMatchingIfrPackageList ( + IN EFI_HII_THUNK_PRIVATE_DATA *Private, + IN CONST EFI_HII_PACKAGE_LIST_HEADER *StringPackageListHeader + ) +{ + EFI_STATUS Status; + LIST_ENTRY *ListEntry; + HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY *HandleMapEntry; + + for (ListEntry = Private->HiiThunkHandleMappingDBListHead.ForwardLink; + ListEntry != &Private->HiiThunkHandleMappingDBListHead; + ListEntry = ListEntry->ForwardLink + ) { + HandleMapEntry = HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY_FROM_LISTENTRY (ListEntry); + if (CompareGuid (&StringPackageListHeader->PackageListGuid, &HandleMapEntry->TagGuid)) { + Status = InsertStringPackagesToIfrPackageList (StringPackageListHeader, HandleMapEntry->UefiHiiHandle); + } + } + + return EFI_NOT_FOUND; +} +EFI_HII_PACKAGE_LIST_HEADER * +PrepareUefiPackageListFromFrameworkHiiPackages ( + IN CONST EFI_HII_PACKAGES *Packages, + IN CONST EFI_GUID *GuidId OPTIONAL + ) +{ + UINTN NumberOfPackages; + EFI_HII_PACKAGE_LIST_HEADER *PackageListHeader; + UINT8 *PackageListData; + UINT32 PackageListLength; + UINT32 PackageLength; + EFI_HII_PACKAGE_HEADER PackageHeader; + UINTN Index; + TIANO_AUTOGEN_PACKAGES_HEADER **TianoAutogenPackageHdrArray; + + TianoAutogenPackageHdrArray = (TIANO_AUTOGEN_PACKAGES_HEADER **) ((UINT8 *) &Packages->GuidId + sizeof (Packages->GuidId)); + NumberOfPackages = Packages->NumberOfPackages; + + PackageListLength = sizeof (EFI_HII_PACKAGE_LIST_HEADER); + + for (Index = 0; Index < NumberOfPackages; Index++) { + CopyMem (&PackageLength, &TianoAutogenPackageHdrArray[Index]->BinaryLength, sizeof (UINT32)); + PackageListLength += PackageLength; + } + + // + // Include the lenght of EFI_HII_PACKAGE_END + // + PackageListLength += sizeof (EFI_HII_PACKAGE_HEADER); + PackageListHeader = AllocateZeroPool (PackageListLength); + ASSERT (PackageListHeader != NULL); + if (GuidId == NULL) { + CopyMem (&PackageListHeader->PackageListGuid, Packages->GuidId, sizeof (EFI_GUID)); + } else { + CopyMem (&PackageListHeader->PackageListGuid, GuidId, sizeof (EFI_GUID)); + } + PackageListHeader->PackageLength = PackageListLength; + + PackageListData = ((UINT8 *) PackageListHeader) + sizeof (EFI_HII_PACKAGE_LIST_HEADER); + + for (Index = 0; Index < NumberOfPackages; Index++) { + CopyMem (&PackageLength, &(TianoAutogenPackageHdrArray[Index]->BinaryLength), sizeof (UINT32)); + PackageLength -= sizeof (UINT32); + CopyMem (PackageListData, &(TianoAutogenPackageHdrArray[Index]->PackageHeader), PackageLength); + PackageListData += PackageLength; + } + + // + // Append EFI_HII_PACKAGE_END + // + PackageHeader.Type = EFI_HII_PACKAGE_END; + PackageHeader.Length = sizeof (EFI_HII_PACKAGE_HEADER); + CopyMem (PackageListData, &PackageHeader, PackageHeader.Length); + + return PackageListHeader; +} + +EFI_GUID * +UefiGeneratePackageListGuidId ( + IN CONST EFI_HII_PACKAGES * Packages + ) +{ + EFI_GUID *Guid; + UINT64 MonotonicCount; + + Guid = AllocateCopyPool (sizeof (EFI_GUID), Packages->GuidId); + + gBS->GetNextMonotonicCount (&MonotonicCount); + // + // Use Monotonic Count as a psedo random number generator. + // + *((UINT64 *) Guid) = *((UINT64 *) Guid) + MonotonicCount; + + return Guid; +} + +EFI_STATUS +FindAndAddStringPackageToIfrPackageList( + EFI_HII_THUNK_PRIVATE_DATA *Private, + EFI_GUID *GuidId, + EFI_HII_HANDLE UefiIfrHiiHandle + ) +{ + EFI_STATUS Status; + LIST_ENTRY *ListEntry; + HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY *HandleMapEntry; + EFI_HII_PACKAGE_LIST_HEADER *StringPackageListHeader; + UINTN Size; + + for (ListEntry = Private->HiiThunkHandleMappingDBListHead.ForwardLink; + ListEntry != &Private->HiiThunkHandleMappingDBListHead; + ListEntry = ListEntry->ForwardLink + ) { + HandleMapEntry = HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY_FROM_LISTENTRY (ListEntry); + if (CompareGuid (GuidId, &HandleMapEntry->TagGuid) && (!HandleMapEntry->DoesPackageListImportStringPackages)) { + Status = LibExportPackageLists (HandleMapEntry->UefiHiiHandle, &StringPackageListHeader, &Size); + ASSERT_EFI_ERROR (Status); + + // + // Add Function to only get only String Packages from the Package List + // + + Status = InsertStringPackagesToIfrPackageList (StringPackageListHeader, UefiIfrHiiHandle); + ASSERT_EFI_ERROR (Status); + + FreePool (StringPackageListHeader); + return EFI_SUCCESS; + } + } + + return EFI_NOT_FOUND; + +} + +EFI_STATUS +InstallDefaultUefiConfigAccessProtocol ( + IN EFI_HII_PACKAGES *Packages, + OUT EFI_HANDLE *Handle + ) +{ + return EFI_SUCCESS; +} + +EFI_STATUS +UefiRegisterPackageList( + EFI_HII_THUNK_PRIVATE_DATA *Private, + EFI_HII_PACKAGES *Packages, + FRAMEWORK_EFI_HII_HANDLE *Handle + ) +{ + EFI_STATUS Status; + UINTN StringPackNum; + UINTN IfrPackNum; + EFI_HII_PACKAGE_LIST_HEADER *UefiPackageListHeader; + HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY *HandleMappingEntry; + EFI_GUID *GuidId; + EFI_HANDLE UefiHiiDriverHandle; + + GuidId = NULL; + UefiHiiDriverHandle = NULL; + + Status = GetIfrAndStringPackNum (Packages, &IfrPackNum, &StringPackNum); + ASSERT_EFI_ERROR (Status); + + HandleMappingEntry = AllocateZeroPool (sizeof (*HandleMappingEntry)); + ASSERT (HandleMappingEntry != NULL); + + HandleMappingEntry->Signature = HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY_SIGNATURE; + HandleMappingEntry->FrameworkHiiHandle = Private->StaticHiiHandle++; + CopyGuid (&HandleMappingEntry->TagGuid, Packages->GuidId); + + if ((StringPackNum == 0) && (IfrPackNum != 0)) { + // + // UEFI HII database does not allow two package list with the same GUID. + // In Framework HII implementation, Packages->GuidId is used as an identifier to associate + // a PackageList with only IFR to a Package list the with String package. + // + GuidId = UefiGeneratePackageListGuidId (Packages); + } + + // + // UEFI HII require EFI_HII_CONFIG_ACCESS_PROTOCOL to be installed on a EFI_HANDLE, so + // that Setup Utility will load the Buffer Storage + // + if (IfrPackNum != 0) { + InstallDefaultUefiConfigAccessProtocol (Packages, &UefiHiiDriverHandle); + } + UefiPackageListHeader = PrepareUefiPackageListFromFrameworkHiiPackages (Packages, GuidId); + Status = mUefiHiiDatabaseProtocol->NewPackageList ( + mUefiHiiDatabaseProtocol, + UefiPackageListHeader, + UefiHiiDriverHandle, + &HandleMappingEntry->UefiHiiHandle + ); + ASSERT_EFI_ERROR (Status); + if (EFI_ERROR (Status)) { + goto Done; + } + + if (IfrPackNum == 0) { + if (StringPackNum != 0) { + // + // Look for a package list with IFR Pack which has already registed with HII Database + // + HandleMappingEntry->IsPackageListWithOnlyStringPackages = TRUE; + Status = AddStringPackagesToMatchingIfrPackageList ( + Private, + UefiPackageListHeader + ); + + if (!EFI_ERROR (Status) || Status == EFI_NOT_FOUND) { + + if (Status == EFI_NOT_FOUND) { + Status = EFI_SUCCESS; + } + } + } + } else { + if (StringPackNum == 0) { + // + // Register the Package List to UEFI HII first. + // + Status = FindAndAddStringPackageToIfrPackageList ( + Private, + Packages->GuidId, + HandleMappingEntry->UefiHiiHandle + ); + ASSERT_EFI_ERROR (Status); + if (!EFI_ERROR (Status)) { + HandleMappingEntry->DoesPackageListImportStringPackages = TRUE; + } + } + } + + if (!EFI_ERROR (Status)) { + InsertTailList (&Private->HiiThunkHandleMappingDBListHead, &HandleMappingEntry->List); + } + +Done: + if (EFI_ERROR (Status)) { + FreePool (HandleMappingEntry); + } else { + *Handle = HandleMappingEntry->FrameworkHiiHandle; + } + + FreePool (UefiPackageListHeader); + SafeFreePool (GuidId); + + return Status; +} + +EFI_STATUS +EFIAPI +HiiNewPack ( + IN EFI_HII_PROTOCOL *This, + IN EFI_HII_PACKAGES *Packages, + OUT FRAMEWORK_EFI_HII_HANDLE *Handle + ) +/*++ + +Routine Description: + + Extracts the various packs from a package list. + +Arguments: + + This - Pointer of HII protocol. + Packages - Pointer of HII packages. + Handle - Handle value to be returned. + +Returns: + + EFI_SUCCESS - Pacakges has added to HII database successfully. + EFI_INVALID_PARAMETER - Invalid parameter. + +--*/ +{ + EFI_STATUS Status; + EFI_HII_THUNK_PRIVATE_DATA *Private; + + if (Handle == NULL) { + return EFI_INVALID_PARAMETER; + } + + if (Packages == NULL) { + return EFI_INVALID_PARAMETER; + } + + Private = EFI_HII_THUNK_PRIVATE_DATA_FROM_THIS(This); + + Status = UefiRegisterPackageList ( + Private, + Packages, + Handle + ); + + return Status; +} + +EFI_STATUS +EFIAPI +HiiRemovePack ( + IN EFI_HII_PROTOCOL *This, + IN FRAMEWORK_EFI_HII_HANDLE Handle + ) +/*++ + +Routine Description: + Removes the various packs from a Handle + +Arguments: + +Returns: + +--*/ +{ + EFI_STATUS Status; + EFI_HII_THUNK_PRIVATE_DATA *Private; + LIST_ENTRY *ListEntry; + HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY *HandleMapEntry; + + Private = EFI_HII_THUNK_PRIVATE_DATA_FROM_THIS(This); + + for (ListEntry = Private->HiiThunkHandleMappingDBListHead.ForwardLink; + ListEntry != &Private->HiiThunkHandleMappingDBListHead; + ListEntry = ListEntry->ForwardLink + ) { + HandleMapEntry = HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY_FROM_LISTENTRY (ListEntry); + + if (Handle == HandleMapEntry->FrameworkHiiHandle) { + Status = mUefiHiiDatabaseProtocol->RemovePackageList ( + mUefiHiiDatabaseProtocol, + HandleMapEntry->UefiHiiHandle + ); + ASSERT_EFI_ERROR (Status); + + RemoveEntryList (ListEntry); + return Status; + } + } + + return EFI_NOT_FOUND; +} diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Strings.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Strings.c new file mode 100644 index 0000000..0054ee4 --- /dev/null +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Strings.c @@ -0,0 +1,315 @@ +/**@file + + This file contains the keyboard processing code to the HII database. + +Copyright (c) 2006 - 2008, 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 "HiiDatabase.h" + +EFI_STATUS +EFIAPI +HiiTestString ( + IN EFI_HII_PROTOCOL *This, + IN CHAR16 *StringToTest, + IN OUT UINT32 *FirstMissing, + OUT UINT32 *GlyphBufferSize + ) +/*++ + +Routine Description: + Test if all of the characters in a string have corresponding font characters. + +Arguments: + +Returns: + +--*/ +{ + ASSERT (FALSE); + return EFI_SUCCESS; +} + +EFI_STATUS +GetTagGuidByFrameworkHiiHandle ( + IN CONST EFI_HII_THUNK_PRIVATE_DATA *Private, + IN FRAMEWORK_EFI_HII_HANDLE FrameworkHiiHandle, + OUT EFI_GUID *TagGuid + ) +{ + LIST_ENTRY *ListEntry; + HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY *HandleMapEntry; + + ASSERT (TagGuid != NULL); + + for (ListEntry = Private->HiiThunkHandleMappingDBListHead.ForwardLink; + ListEntry != &Private->HiiThunkHandleMappingDBListHead; + ListEntry = ListEntry->ForwardLink + ) { + + HandleMapEntry = HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY_FROM_LISTENTRY (ListEntry); + + if (FrameworkHiiHandle == HandleMapEntry->FrameworkHiiHandle) { + CopyGuid (TagGuid, &HandleMapEntry->TagGuid); + return EFI_SUCCESS; + } + } + + return EFI_NOT_FOUND; +} + +EFI_STATUS +HiiThunkNewStringForAllStringPackages ( + IN CONST EFI_HII_THUNK_PRIVATE_DATA *Private, + OUT CONST EFI_GUID *TagGuid, + IN CHAR16 *Language, + IN OUT STRING_REF *Reference, + IN CHAR16 *NewString + ) +{ + EFI_STATUS Status; + LIST_ENTRY *ListEntry; + HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY *HandleMapEntry; + EFI_STRING_ID StringId1; + EFI_STRING_ID StringId2; + CHAR8 *UefiStringProtocolLanguage; + BOOLEAN Found; + + ASSERT (TagGuid != NULL); + + StringId1 = (EFI_STRING_ID) 0; + StringId2 = (EFI_STRING_ID) 0; + Found = FALSE; + + // + // BugBug: We will handle the case that Language is not NULL later. + // + ASSERT (Language == NULL); + + //if (Language == NULL) { + UefiStringProtocolLanguage = NULL; + //} + + for (ListEntry = Private->HiiThunkHandleMappingDBListHead.ForwardLink; + ListEntry != &Private->HiiThunkHandleMappingDBListHead; + ListEntry = ListEntry->ForwardLink + ) { + + HandleMapEntry = HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY_FROM_LISTENTRY (ListEntry); + + if (CompareGuid (TagGuid, &HandleMapEntry->TagGuid)) { + Found = TRUE; + if (*Reference == 0) { + Status = HiiLibNewString (HandleMapEntry->UefiHiiHandle, &StringId2, NewString); + } else { + Status = HiiLibSetString (HandleMapEntry->UefiHiiHandle, *Reference, NewString); + } + if (EFI_ERROR (Status)) { + return Status; + } + if (*Reference == 0) { + if (StringId1 == (EFI_STRING_ID) 0) { + StringId1 = StringId2; + } else { + if (StringId1 != StringId2) { + ASSERT(FALSE); + return EFI_INVALID_PARAMETER; + } + } + } + } + } + + if (Found) { + *Reference = StringId1; + Status = EFI_SUCCESS; + } else { + Status = EFI_NOT_FOUND; + } + + return Status; +} + +EFI_STATUS +EFIAPI +HiiNewString ( + IN EFI_HII_PROTOCOL *This, + IN CHAR16 *Language, + IN FRAMEWORK_EFI_HII_HANDLE Handle, + IN OUT STRING_REF *Reference, + IN CHAR16 *NewString + ) +/*++ + +Routine Description: + This function allows a new String to be added to an already existing String Package. + We will make a buffer the size of the package + StrSize of the new string. We will + copy the string package that first gets changed and the following language packages until + we encounter the NULL string package. All this time we will ensure that the offsets have + been adjusted. + +Arguments: + +Returns: + +--*/ +{ + EFI_STATUS Status; + EFI_HII_THUNK_PRIVATE_DATA *Private; + EFI_GUID TagGuid; + + Private = EFI_HII_THUNK_PRIVATE_DATA_FROM_THIS(This); + + Status = GetTagGuidByFrameworkHiiHandle (Private, Handle, &TagGuid); + ASSERT_EFI_ERROR (Status); + + Status = HiiThunkNewStringForAllStringPackages (Private, &TagGuid, Language, Reference, NewString); + ASSERT_EFI_ERROR (Status); + + return EFI_SUCCESS; +} + +EFI_STATUS +EFIAPI +HiiResetStrings ( + IN EFI_HII_PROTOCOL *This, + IN FRAMEWORK_EFI_HII_HANDLE Handle + ) +/*++ + +Routine Description: + + This function removes any new strings that were added after the initial string export for this handle. + +Arguments: + +Returns: + +--*/ +{ + ASSERT (FALSE); + return EFI_UNSUPPORTED; +} + +EFI_STATUS +EFIAPI +HiiGetString ( + IN EFI_HII_PROTOCOL *This, + IN FRAMEWORK_EFI_HII_HANDLE Handle, + IN STRING_REF Token, + IN BOOLEAN Raw, + IN CHAR16 *LanguageString, + IN OUT UINTN *BufferLengthTemp, + OUT EFI_STRING StringBuffer + ) +/*++ + +Routine Description: + + This function extracts a string from a package already registered with the EFI HII database. + +Arguments: + This - A pointer to the EFI_HII_PROTOCOL instance. + Handle - The HII handle on which the string resides. + Token - The string token assigned to the string. + Raw - If TRUE, the string is returned unedited in the internal storage format described + above. If false, the string returned is edited by replacing with + and by removing special characters such as the prefix. + LanguageString - Pointer to a NULL-terminated string containing a single ISO 639-2 language + identifier, indicating the language to print. If the LanguageString is empty (starts + with a NULL), the default system language will be used to determine the language. + BufferLength - Length of the StringBuffer. If the status reports that the buffer width is too + small, this parameter is filled with the length of the buffer needed. + StringBuffer - The buffer designed to receive the characters in the string. Type EFI_STRING is + defined in String. + +Returns: + EFI_INVALID_PARAMETER - If input parameter is invalid. + EFI_BUFFER_TOO_SMALL - If the *BufferLength is too small. + EFI_SUCCESS - Operation is successful. + +--*/ +{ + LIST_ENTRY *ListEntry; + HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY *HandleMapEntry; + CHAR8 *AsciiLanguage; + EFI_HII_THUNK_PRIVATE_DATA *Private; + + Private = EFI_HII_THUNK_PRIVATE_DATA_FROM_THIS(This); + + if (LanguageString == NULL) { + AsciiLanguage = NULL; + } else { + AsciiLanguage = AllocateZeroPool (StrLen (LanguageString) + 1); + if (AsciiLanguage == NULL) { + return EFI_OUT_OF_RESOURCES; + } + UnicodeStrToAsciiStr (LanguageString, AsciiLanguage); + } + + for (ListEntry = Private->HiiThunkHandleMappingDBListHead.ForwardLink; + ListEntry != &Private->HiiThunkHandleMappingDBListHead; + ListEntry = ListEntry->ForwardLink + ) { + + HandleMapEntry = HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY_FROM_LISTENTRY (ListEntry); + + if (Handle == HandleMapEntry->FrameworkHiiHandle) { + if (AsciiLanguage == NULL) { + return HiiLibGetString (HandleMapEntry->UefiHiiHandle, Token, StringBuffer, BufferLengthTemp); + } else { + return mUefiStringProtocol->GetString ( + mUefiStringProtocol, + AsciiLanguage, + HandleMapEntry->UefiHiiHandle, + Token, + StringBuffer, + BufferLengthTemp, + NULL + ); + } + } + } + + return EFI_NOT_FOUND; +} + +EFI_STATUS +EFIAPI +HiiGetLine ( + IN EFI_HII_PROTOCOL *This, + IN FRAMEWORK_EFI_HII_HANDLE Handle, + IN STRING_REF Token, + IN OUT UINT16 *Index, + IN UINT16 LineWidth, + IN CHAR16 *LanguageString, + IN OUT UINT16 *BufferLength, + OUT EFI_STRING StringBuffer + ) +/*++ + +Routine Description: + + This function allows a program to extract a part of a string of not more than a given width. + With repeated calls, this allows a calling program to extract "lines" of text that fit inside + columns. The effort of measuring the fit of strings inside columns is localized to this call. + +Arguments: + +Returns: + +--*/ +{ + ASSERT (FALSE); + return EFI_UNSUPPORTED; +} + diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Utility.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Utility.c new file mode 100644 index 0000000..30b743e --- /dev/null +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Utility.c @@ -0,0 +1,41 @@ +/**@file + + This file contains the keyboard processing code to the HII database. + +Copyright (c) 2006 - 2008, 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 "HiiDatabase.h" + +EFI_GUID * +GetGuidOfFirstFormset ( + CONST EFI_HII_FORM_PACKAGE * FormPackage +) +{ + UINT8 *StartOfNextPackage; + EFI_IFR_OP_HEADER *OpCodeData; + + StartOfNextPackage = (UINT8 *) FormPackage + FormPackage->Header.Length; + OpCodeData = (EFI_IFR_OP_HEADER *) (FormPackage + 1); + + while ((UINT8 *) OpCodeData < StartOfNextPackage) { + if (OpCodeData->OpCode == EFI_IFR_FORM_SET_OP) { + return &(((EFI_IFR_FORM_SET *) OpCodeData)->Guid); + } + OpCodeData = (EFI_IFR_OP_HEADER *) ((UINT8 *) OpCodeData + OpCodeData->Length); + } + + ASSERT (FALSE); + + return NULL; +} + diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Utility.h b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Utility.h new file mode 100644 index 0000000..5edde94 --- /dev/null +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiToUefiHiiThunk/Utility.h @@ -0,0 +1,24 @@ +/**@file + + This file contains utility functions by HII Thunk Modules. + +Copyright (c) 2006 - 2008, 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 _HII_THUNK_UTILITY_H +#define _HII_THUNK_UTILITY_H + +EFI_GUID * +GetGuidOfFirstFormset ( + CONST EFI_HII_FORM_PACKAGE * FormPackage +); + +#endif diff --git a/EdkCompatibilityPkg/Compatibility/Fv2ToFvThunk/Fv2ToFvThunk.c b/EdkCompatibilityPkg/Compatibility/Fv2ToFvThunk/Fv2ToFvThunk.c new file mode 100644 index 0000000..da2ada6 --- /dev/null +++ b/EdkCompatibilityPkg/Compatibility/Fv2ToFvThunk/Fv2ToFvThunk.c @@ -0,0 +1,1492 @@ +/*++ + +Copyright (c) 2006 - 2008 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: + + FvToFv2Thunk.c + +Abstract: + + DXE driver + +--*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/** + + Because of constraints imposed by the underlying firmware + storage, an instance of the Firmware Volume Protocol may not + be to able to support all possible variations of this + architecture. These constraints and the current state of the + firmware volume are exposed to the caller using the + GetVolumeAttributes() function. GetVolumeAttributes() is + callable only from TPL_NOTIFY and below. Behavior of + GetVolumeAttributes() at any EFI_TPL above TPL_NOTIFY is + undefined. Type EFI_TPL is defined in RaiseTPL() in the UEFI + 2.0 specification. + + @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL + instance. + + @param FvAttributes Pointer to an EFI_FV_ATTRIBUTES in which + the attributes and current settings are + returned. + + + @retval EFI_SUCCESS The firmware volume attributes were + returned. + +**/ +EFI_STATUS +EFIAPI +Fv2GetVolumeAttributes ( + IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This, + OUT EFI_FV_ATTRIBUTES *FvAttributes + ); + + +/** + The SetVolumeAttributes() function is used to set configurable + firmware volume attributes. Only EFI_FV_READ_STATUS, + EFI_FV_WRITE_STATUS, and EFI_FV_LOCK_STATUS may be modified, and + then only in accordance with the declared capabilities. All + other bits of FvAttributes are ignored on input. On successful + return, all bits of *FvAttributes are valid and it contains the + completed EFI_FV_ATTRIBUTES for the volume. To modify an + attribute, the corresponding status bit in the EFI_FV_ATTRIBUTES + is set to the desired value on input. The EFI_FV_LOCK_STATUS bit + does not affect the ability to read or write the firmware + volume. Rather, once the EFI_FV_LOCK_STATUS bit is set, it + prevents further modification to all the attribute bits. + SetVolumeAttributes() is callable only from TPL_NOTIFY and + below. Behavior of SetVolumeAttributes() at any EFI_TPL above + TPL_NOTIFY is undefined. Type EFI_TPL is defined in + RaiseTPL() in the UEFI 2.0 specification. + + + @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL + instance. + + @param FvAttributes On input, FvAttributes is a pointer to + an EFI_FV_ATTRIBUTES containing the + desired firmware volume settings. On + successful return, it contains the new + settings of the firmware volume. On + unsuccessful return, FvAttributes is not + modified and the firmware volume + settings are not changed. + + @retval EFI_SUCCESS The requested firmware volume attributes + were set and the resulting + EFI_FV_ATTRIBUTES is returned in + FvAttributes. + + @retval EFI_INVALID_PARAMETER FvAttributes:EFI_FV_READ_STATUS + is set to 1 on input, but the + device does not support enabling + reads + (FvAttributes:EFI_FV_READ_ENABLE + is clear on return from + GetVolumeAttributes()). Actual + volume attributes are unchanged. + + @retval EFI_INVALID_PARAMETER FvAttributes:EFI_FV_READ_STATUS + is cleared to 0 on input, but + the device does not support + disabling reads + (FvAttributes:EFI_FV_READ_DISABL + is clear on return from + GetVolumeAttributes()). Actual + volume attributes are unchanged. + + @retval EFI_INVALID_PARAMETER FvAttributes:EFI_FV_WRITE_STATUS + is set to 1 on input, but the + device does not support enabling + writes + (FvAttributes:EFI_FV_WRITE_ENABL + is clear on return from + GetVolumeAttributes()). Actual + volume attributes are unchanged. + + @retval EFI_INVALID_PARAMETER FvAttributes:EFI_FV_WRITE_STATUS + is cleared to 0 on input, but + the device does not support + disabling writes + (FvAttributes:EFI_FV_WRITE_DISAB + is clear on return from + GetVolumeAttributes()). Actual + volume attributes are unchanged. + + @retval EFI_INVALID_PARAMETER FvAttributes:EFI_FV_LOCK_STATUS + is set on input, but the device + does not support locking + (FvAttributes:EFI_FV_LOCK_CAP is + clear on return from + GetVolumeAttributes()). Actual + volume attributes are unchanged. + + @retval EFI_ACCESS_DENIED Device is locked and does not + allow attribute modification + (FvAttributes:EFI_FV_LOCK_STATUS + is set on return from + GetVolumeAttributes()). Actual + volume attributes are unchanged. + +**/ +EFI_STATUS +EFIAPI +Fv2SetVolumeAttributes ( + IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This, + IN OUT EFI_FV_ATTRIBUTES *FvAttributes + ); + + +/** + ReadFile() is used to retrieve any file from a firmware volume + during the DXE phase. The actual binary encoding of the file in + the firmware volume media may be in any arbitrary format as long + as it does the following: ?It is accessed using the Firmware + Volume Protocol. ?The image that is returned follows the image + format defined in Code Definitions: PI Firmware File Format. + If the input value of Buffer==NULL, it indicates the caller is + requesting only that the type, attributes, and size of the + file be returned and that there is no output buffer. In this + case, the following occurs: + - BufferSize is returned with the size that is required to + successfully complete the read. + - The output parameters FoundType and *FileAttributes are + returned with valid values. + - The returned value of *AuthenticationStatus is undefined. + + If the input value of Buffer!=NULL, the output buffer is + specified by a double indirection of the Buffer parameter. The + input value of *Buffer is used to determine if the output + buffer is caller allocated or is dynamically allocated by + ReadFile(). If the input value of *Buffer!=NULL, it indicates + the output buffer is caller allocated. In this case, the input + value of *BufferSize indicates the size of the + caller-allocated output buffer. If the output buffer is not + large enough to contain the entire requested output, it is + filled up to the point that the output buffer is exhausted and + EFI_WARN_BUFFER_TOO_SMALL is returned, and then BufferSize is + returned with the size required to successfully complete the + read. All other output parameters are returned with valid + values. If the input value of *Buffer==NULL, it indicates the + output buffer is to be allocated by ReadFile(). In this case, + ReadFile() will allocate an appropriately sized buffer from + boot services pool memory, which will be returned in Buffer. + The size of the new buffer is returned in BufferSize and all + other output parameters are returned with valid values. + ReadFile() is callable only from TPL_NOTIFY and below. + Behavior of ReadFile() at any EFI_TPL above TPL_NOTIFY is + undefined. Type EFI_TPL is defined in RaiseTPL() in the UEFI + 2.0 specification. + + @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL + instance. + + @param NameGuid Pointer to an EFI_GUID, which is the file + name. All firmware file names are EFI_GUIDs. + A single firmware volume must not have two + valid files with the same file name + EFI_GUID. + + @param Buffer Pointer to a pointer to a buffer in which the + file contents are returned, not including the + file header. + @param BufferSize Pointer to a caller-allocated UINTN. It + indicates the size of the memory + represented by Buffer. + + @param FoundType Pointer to a caller-allocated + EFI_FV_FILETYPE. + + @param FileAttributes Pointer to a caller-allocated + EFI_FV_FILE_ATTRIBUTES. + + @param AuthenticationStatus Pointer to a caller-allocated + UINT32 in which the + authentication status is + returned. + + @retval EFI_SUCCESS The call completed successfully. + + @retval EFI_WARN_BUFFER_TOO_SMALL The buffer is too small to + contain the requested + output. The buffer is + filled and the output is + truncated. + + @retval EFI_OUT_OF_RESOURCES An allocation failure occurred. + + @retavl EFI_NOT_FOUND Name was not found in the firmware + volume. + + @retval EFI_DEVICE_ERROR A hardware error occurred when + attempting to access the firmware + volume. + + @retval EFI_ACCESS_DENIED The firmware volume is configured to + isallow reads. + +**/ +EFI_STATUS +EFIAPI +Fv2ReadFile ( + IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This, + IN CONST EFI_GUID *NameGuid, + IN OUT VOID **Buffer, + IN OUT UINTN *BufferSize, + OUT EFI_FV_FILETYPE *FoundType, + OUT EFI_FV_FILE_ATTRIBUTES *FileAttributes, + OUT UINT32 *AuthenticationStatus + ); + +/** + ReadSection() is used to retrieve a specific section from a file + within a firmware volume. The section returned is determined + using a depth-first, left-to-right search algorithm through all + sections found in the specified file. See + ????Firmware File Sections???? on page 9 for more details about + sections. The output buffer is specified by a double indirection + of the Buffer parameter. The input value of Buffer is used to + determine if the output buffer is caller allocated or is + dynamically allocated by ReadSection(). If the input value of + Buffer!=NULL, it indicates that the output buffer is caller + allocated. In this case, the input value of *BufferSize + indicates the size of the caller-allocated output buffer. If + the output buffer is not large enough to contain the entire + requested output, it is filled up to the point that the output + buffer is exhausted and EFI_WARN_BUFFER_TOO_SMALL is returned, + and then BufferSize is returned with the size that is required + to successfully complete the read. All other + output parameters are returned with valid values. If the input + value of *Buffer==NULL, it indicates the output buffer is to + be allocated by ReadSection(). In this case, ReadSection() + will allocate an appropriately sized buffer from boot services + pool memory, which will be returned in *Buffer. The size of + the new buffer is returned in *BufferSize and all other output + parameters are returned with valid values. ReadSection() is + callable only from TPL_NOTIFY and below. Behavior of + ReadSection() at any EFI_TPL above TPL_NOTIFY is + undefined. Type EFI_TPL is defined in RaiseTPL() in the UEFI + 2.0 specification. + + + @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL + instance. + + @param NameGuid Pointer to an EFI_GUID, which indicates the + file name from which the requested section + will be read. + + @param SectionType Indicates the section type to return. + SectionType in conjunction with + SectionInstance indicates which section to + return. + + @param SectionInstance Indicates which instance of sections + with a type of SectionType to return. + SectionType in conjunction with + SectionInstance indicates which + section to return. SectionInstance is + zero based. + + @param Buffer Pointer to a pointer to a buffer in which the + section contents are returned, not including + the section header. + + @param BufferSize Pointer to a caller-allocated UINTN. It + indicates the size of the memory + represented by Buffer. + + @param AuthenticationStatus Pointer to a caller-allocated + UINT32 in which the authentication + status is returned. + + + @retval EFI_SUCCESS The call completed successfully. + + @retval EFI_WARN_BUFFER_TOO_SMALL The caller-allocated + buffer is too small to + contain the requested + output. The buffer is + filled and the output is + truncated. + + @retval EFI_OUT_OF_RESOURCES An allocation failure occurred. + + @retval EFI_NOT_FOUND The requested file was not found in + the firmware volume. EFI_NOT_FOUND The + requested section was not found in the + specified file. + + @retval EFI_DEVICE_ERROR A hardware error occurred when + attempting to access the firmware + volume. + + @retval EFI_ACCESS_DENIED The firmware volume is configured to + disallow reads. EFI_PROTOCOL_ERROR + The requested section was not found, + but the file could not be fully + parsed because a required + GUIDED_SECTION_EXTRACTION_PROTOCOL + was not found. It is possible the + requested section exists within the + file and could be successfully + extracted once the required + GUIDED_SECTION_EXTRACTION_PROTOCOL + is published. + +**/ +EFI_STATUS +EFIAPI +Fv2ReadSection ( + IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This, + IN CONST EFI_GUID *NameGuid, + IN EFI_SECTION_TYPE SectionType, + IN UINTN SectionInstance, + IN OUT VOID **Buffer, + IN OUT UINTN *BufferSize, + OUT UINT32 *AuthenticationStatus + ); + +/** + WriteFile() is used to write one or more files to a firmware + volume. Each file to be written is described by an + EFI_FV_WRITE_FILE_DATA structure. The caller must ensure that + any required alignment for all files listed in the FileData + array is compatible with the firmware volume. Firmware volume + capabilities can be determined using the GetVolumeAttributes() + call. Similarly, if the WritePolicy is set to + EFI_FV_RELIABLE_WRITE, the caller must check the firmware volume + capabilities to ensure EFI_FV_RELIABLE_WRITE is supported by the + firmware volume. EFI_FV_UNRELIABLE_WRITE must always be + supported. Writing a file with a size of zero + (FileData[n].BufferSize == 0) deletes the file from the firmware + volume if it exists. Deleting a file must be done one at a time. + Deleting a file as part of a multiple file write is not allowed. + Platform Initialization Specification VOLUME 3 Shared + Architectural Elements 84 August 21, 2006 Version 1.0 + WriteFile() is callable only from TPL_NOTIFY and below. + Behavior of WriteFile() at any EFI_TPL above TPL_NOTIFY is + undefined. Type EFI_TPL is defined in RaiseTPL() in the UEFI 2.0 + specification. + + @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL + instance. NumberOfFiles Indicates the number of + elements in the array pointed to by FileData. + + + @param WritePolicy Indicates the level of reliability for the + write in the event of a power failure or + other system failure during the write + operation. + + @param FileData Pointer to an array of + EFI_FV_WRITE_FILE_DATA. Each element of + FileData[] represents a file to be written. + + + @retval EFI_SUCCESS The write completed successfully. + + @retval EFI_OUT_OF_RESOURCES The firmware volume does not + have enough free space to + storefile(s). + + @retval EFI_DEVICE_ERROR A hardware error occurred when + attempting to access the firmware volume. + + @retval EFI_WRITE_PROTECTED The firmware volume is + configured to disallow writes. + + @retval EFI_NOT_FOUND A delete was requested, but the + requested file was not found in the + firmware volume. + + @retval EFI_INVALID_PARAMETER A delete was requested with a + multiple file write. + + @retval EFI_INVALID_PARAMETER An unsupported WritePolicy was + requested. + + @retval EFI_INVALID_PARAMETER An unknown file type was + specified. + + @retval EFI_INVALID_PARAMETER A file system specific error + has occurred. + +**/ +EFI_STATUS +EFIAPI +Fv2WriteFile ( + IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This, + IN UINT32 NumberOfFiles, + IN EFI_FV_WRITE_POLICY WritePolicy, + IN EFI_FV_WRITE_FILE_DATA *FileData + ); + +/** + GetNextFile() is the interface that is used to search a firmware + volume for a particular file. It is called successively until + the desired file is located or the function returns + EFI_NOT_FOUND. To filter uninteresting files from the output, + the type of file to search for may be specified in FileType. For + example, if *FileType is EFI_FV_FILETYPE_DRIVER, only files of + this type will be returned in the output. If *FileType is + EFI_FV_FILETYPE_ALL, no filtering of file types is done. The Key + parameter is used to indicate a starting point of the search. If + the buffer *Key is completely initialized to zero, the search + re-initialized and starts at the beginning. Subsequent calls to + GetNextFile() must maintain the value of *Key returned by the + immediately previous call. The actual contents of *Key are + implementation specific and no semantic content is implied. + GetNextFile() is callable only from TPL_NOTIFY and below. + Behavior of GetNextFile() at any EFI_TPL above TPL_NOTIFY is + undefined. Type EFI_TPL is defined in RaiseTPL() in the UEFI 2.0 + specification. Status Codes Returned + + + @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL + instance. Key Pointer to a caller-allocated buffer + that contains implementation-specific data that is + used to track where to begin the search for the + next file. The size of the buffer must be at least + This->KeySize bytes long. To re-initialize the + search and begin from the beginning of the + firmware volume, the entire buffer must be cleared + to zero. Other than clearing the buffer to + initiate a new search, the caller must not modify + the data in the buffer between calls to + GetNextFile(). + + @param FileType Pointer to a caller-allocated + EFI_FV_FILETYPE. The GetNextFile() API can + filter its search for files based on the + value of the FileType input. A *FileType + input of EFI_FV_FILETYPE_ALL causes + GetNextFile() to search for files of all + types. If a file is found, the file's type + is returned in FileType. *FileType is not + modified if no file is found. + + @param NameGuid Pointer to a caller-allocated EFI_GUID. If a + matching file is found, the file's name is + returned in NameGuid. If no matching file is + found, *NameGuid is not modified. + + @param Attributes Pointer to a caller-allocated + EFI_FV_FILE_ATTRIBUTES. If a matching file + is found, the file's attributes are returned + in Attributes. If no matching file is found, + Attributes is not modified. Type + EFI_FV_FILE_ATTRIBUTES is defined in + ReadFile(). + + @param Size Pointer to a caller-allocated UINTN. If a + matching file is found, the file's size is + returned in *Size. If no matching file is found, + Size is not modified. + + @retval EFI_SUCCESS The output parameters are filled with data + obtained from the first matching file that + was found. + + @retval FI_NOT_FOUND No files of type FileType were found. + + + @retval EFI_DEVICE_ERROR A hardware error occurred when + attempting to access the firmware + volume. + + @retval EFI_ACCESS_DENIED The firmware volume is configured to + disallow reads. + + +**/ +EFI_STATUS +EFIAPI +Fv2GetNextFile ( + IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This, + IN OUT VOID *Key, + IN OUT EFI_FV_FILETYPE *FileType, + OUT EFI_GUID *NameGuid, + OUT EFI_FV_FILE_ATTRIBUTES *Attributes, + OUT UINTN *Size + ); + +/** + The GetInfo() function returns information of type + InformationType for the requested firmware volume. If the volume + does not support the requested information type, then + EFI_UNSUPPORTED is returned. If the buffer is not large enough + to hold the requested structure, EFI_BUFFER_TOO_SMALL is + returned and the BufferSize is set to the size of buffer that is + required to make the request. The information types defined by + this specification are required information types that all file + systems must support. + + @param This A pointer to the EFI_FIRMWARE_VOLUME2_PROTOCOL + instance that is the file handle the requested + information is for. + + @param InformationType The type identifier for the + information being requested. + + @param BufferSize On input, the size of Buffer. On output, + the amount of data returned in Buffer. In + both cases, the size is measured in bytes. + + @param Buffer A pointer to the data buffer to return. The + buffer's type is indicated by InformationType. + + + @retval EFI_SUCCESS The information was retrieved. + + @retval EFI_UNSUPPORTED The InformationType is not known. + + @retval EFI_NO_MEDIA The device has no medium. + + @retval EFI_DEVICE_ERROR The device reported an error. + + @retval EFI_VOLUME_CORRUPTED The file system structures are + corrupted. + + @retval EFI_BUFFER_TOO_SMALL The BufferSize is too small to + read the current directory + entry. BufferSize has been + updated with the size needed to + complete the request. + + +**/ +EFI_STATUS +EFIAPI +Fv2GetInfo ( + IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This, + IN CONST EFI_GUID *InformationType, + IN OUT UINTN *BufferSize, + OUT VOID *Buffer + ); + +/** + + The SetInfo() function sets information of type InformationType + on the requested firmware volume. + + + @param This A pointer to the EFI_FIRMWARE_VOLUME2_PROTOCOL + instance that is the file handle the information + is for. + + @param InformationType The type identifier for the + information being set. + + @param BufferSize The size, in bytes, of Buffer. + + @param Buffer A pointer to the data buffer to write. The + buffer's type is indicated by InformationType. + + @retval EFI_SUCCESS The information was set. + + @retval EFI_UNSUPPORTED The InformationType is not known. + + @retval EFI_NO_MEDIA The device has no medium. + + @retval EFI_DEVICE_ERROR The device reported an error. + + @retval EFI_VOLUME_CORRUPTED The file system structures are + corrupted. + + + @retval EFI_WRITE_PROTECTED The media is read only. + + @retval EFI_VOLUME_FULL The volume is full. + + @retval EFI_BAD_BUFFER_SIZE BufferSize is smaller than the + size of the type indicated by + InformationType. + +**/ +EFI_STATUS +EFIAPI +Fv2SetInfo ( + IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This, + IN CONST EFI_GUID *InformationType, + IN UINTN BufferSize, + IN CONST VOID *Buffer + ); + +// +// +// +#define FIRMWARE_VOLUME2_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('f', 'v', '2', 't') + +typedef struct { + UINTN Signature; + EFI_FIRMWARE_VOLUME2_PROTOCOL FirmwareVolume2; + EFI_FIRMWARE_VOLUME_PROTOCOL *FirmwareVolume; +} FIRMWARE_VOLUME2_PRIVATE_DATA; + +#define FIRMWARE_VOLUME2_PRIVATE_DATA_FROM_THIS(a) CR (a, FIRMWARE_VOLUME2_PRIVATE_DATA, FirmwareVolume2, FIRMWARE_VOLUME2_PRIVATE_DATA_SIGNATURE) + +// +// Firmware Volume Protocol template +// +EFI_EVENT mFv2Registration; + +FIRMWARE_VOLUME2_PRIVATE_DATA gFirmwareVolume2PrivateDataTemplate = { + FIRMWARE_VOLUME2_PRIVATE_DATA_SIGNATURE, + { + Fv2GetVolumeAttributes, + Fv2SetVolumeAttributes, + Fv2ReadFile, + Fv2ReadSection, + Fv2WriteFile, + Fv2GetNextFile, + 0, + NULL, + Fv2GetInfo, + Fv2SetInfo + }, + NULL +}; + +// +// Module globals +// + +VOID +EFIAPI +Fv2NotificationEvent ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + EFI_STATUS Status; + UINTN BufferSize; + EFI_HANDLE Handle; + FIRMWARE_VOLUME2_PRIVATE_DATA *Private; + EFI_FIRMWARE_VOLUME2_PROTOCOL *FirmwareVolume2; + + while (TRUE) { + BufferSize = sizeof (Handle); + Status = gBS->LocateHandle ( + ByRegisterNotify, + &gEfiFirmwareVolumeProtocolGuid, + mFv2Registration, + &BufferSize, + &Handle + ); + if (EFI_ERROR (Status)) { + // + // Exit Path of While Loop.... + // + break; + } + + // + // Skip this handle if the Firmware Volume Protocol is already installed + // + Status = gBS->HandleProtocol ( + Handle, + &gEfiFirmwareVolume2ProtocolGuid, + (VOID **)&FirmwareVolume2 + ); + if (!EFI_ERROR (Status)) { + continue; + } + + // + // Allocate private data structure + // + Private = AllocateCopyPool (sizeof (FIRMWARE_VOLUME2_PRIVATE_DATA), &gFirmwareVolume2PrivateDataTemplate); + if (Private == NULL) { + continue; + } + + // + // Retrieve the Firmware Volume2 Protocol + // + Status = gBS->HandleProtocol ( + Handle, + &gEfiFirmwareVolumeProtocolGuid, + (VOID **)&Private->FirmwareVolume + ); + ASSERT_EFI_ERROR (Status); + + // + // Fill in rest of private data structure + // + Private->FirmwareVolume2.KeySize = Private->FirmwareVolume->KeySize; + Private->FirmwareVolume2.ParentHandle = Private->FirmwareVolume->ParentHandle; + + // + // Install Firmware Volume Protocol onto same handle + // + Status = gBS->InstallMultipleProtocolInterfaces ( + &Handle, + &gEfiFirmwareVolume2ProtocolGuid, + &Private->FirmwareVolume2, + NULL + ); + ASSERT_EFI_ERROR (Status); + } +} + + +/** + The user Entry Point for DXE driver. The user code starts with this function + as the real entry point for the image goes into a library that calls this + function. + + @param[in] ImageHandle The firmware allocated handle for the EFI image. + @param[in] SystemTable A pointer to the EFI System Table. + + @retval EFI_SUCCESS The entry point is executed successfully. + @retval other Some error occurs when executing this entry point. + +**/ +EFI_STATUS +EFIAPI +InitializeFirmwareVolume ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EfiCreateProtocolNotifyEvent ( + &gEfiFirmwareVolumeProtocolGuid, + TPL_CALLBACK, + Fv2NotificationEvent, + NULL, + &mFv2Registration + ); + return EFI_SUCCESS; +} + +/** + + Because of constraints imposed by the underlying firmware + storage, an instance of the Firmware Volume Protocol may not + be to able to support all possible variations of this + architecture. These constraints and the current state of the + firmware volume are exposed to the caller using the + GetVolumeAttributes() function. GetVolumeAttributes() is + callable only from TPL_NOTIFY and below. Behavior of + GetVolumeAttributes() at any EFI_TPL above TPL_NOTIFY is + undefined. Type EFI_TPL is defined in RaiseTPL() in the UEFI + 2.0 specification. + + @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL + instance. + + @param FvAttributes Pointer to an EFI_FV_ATTRIBUTES in which + the attributes and current settings are + returned. + + + @retval EFI_SUCCESS The firmware volume attributes were + returned. + +**/ +EFI_STATUS +EFIAPI +Fv2GetVolumeAttributes ( + IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This, + OUT EFI_FV_ATTRIBUTES *FvAttributes + ) +{ + EFI_STATUS Status; + FIRMWARE_VOLUME2_PRIVATE_DATA *Private; + EFI_FIRMWARE_VOLUME_PROTOCOL *FirmwareVolume; + INTN Alignment; + + Private = FIRMWARE_VOLUME2_PRIVATE_DATA_FROM_THIS (This); + FirmwareVolume = Private->FirmwareVolume; + Status = FirmwareVolume->GetVolumeAttributes ( + FirmwareVolume, + (FRAMEWORK_EFI_FV_ATTRIBUTES *)FvAttributes + ); + if (!EFI_ERROR (Status)) { + Alignment = LowBitSet64 (RShiftU64 (*FvAttributes, 16) & 0xffff); + if (Alignment != -1) { + Alignment = Alignment << 16; + } else { + Alignment = 0; + } + *FvAttributes = (*FvAttributes & 0x1ff) | Alignment; + } + return Status; +} + +/** + The SetVolumeAttributes() function is used to set configurable + firmware volume attributes. Only EFI_FV_READ_STATUS, + EFI_FV_WRITE_STATUS, and EFI_FV_LOCK_STATUS may be modified, and + then only in accordance with the declared capabilities. All + other bits of FvAttributes are ignored on input. On successful + return, all bits of *FvAttributes are valid and it contains the + completed EFI_FV_ATTRIBUTES for the volume. To modify an + attribute, the corresponding status bit in the EFI_FV_ATTRIBUTES + is set to the desired value on input. The EFI_FV_LOCK_STATUS bit + does not affect the ability to read or write the firmware + volume. Rather, once the EFI_FV_LOCK_STATUS bit is set, it + prevents further modification to all the attribute bits. + SetVolumeAttributes() is callable only from TPL_NOTIFY and + below. Behavior of SetVolumeAttributes() at any EFI_TPL above + TPL_NOTIFY is undefined. Type EFI_TPL is defined in + RaiseTPL() in the UEFI 2.0 specification. + + + @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL + instance. + + @param FvAttributes On input, FvAttributes is a pointer to + an EFI_FV_ATTRIBUTES containing the + desired firmware volume settings. On + successful return, it contains the new + settings of the firmware volume. On + unsuccessful return, FvAttributes is not + modified and the firmware volume + settings are not changed. + + @retval EFI_SUCCESS The requested firmware volume attributes + were set and the resulting + EFI_FV_ATTRIBUTES is returned in + FvAttributes. + + @retval EFI_INVALID_PARAMETER FvAttributes:EFI_FV_READ_STATUS + is set to 1 on input, but the + device does not support enabling + reads + (FvAttributes:EFI_FV_READ_ENABLE + is clear on return from + GetVolumeAttributes()). Actual + volume attributes are unchanged. + + @retval EFI_INVALID_PARAMETER FvAttributes:EFI_FV_READ_STATUS + is cleared to 0 on input, but + the device does not support + disabling reads + (FvAttributes:EFI_FV_READ_DISABL + is clear on return from + GetVolumeAttributes()). Actual + volume attributes are unchanged. + + @retval EFI_INVALID_PARAMETER FvAttributes:EFI_FV_WRITE_STATUS + is set to 1 on input, but the + device does not support enabling + writes + (FvAttributes:EFI_FV_WRITE_ENABL + is clear on return from + GetVolumeAttributes()). Actual + volume attributes are unchanged. + + @retval EFI_INVALID_PARAMETER FvAttributes:EFI_FV_WRITE_STATUS + is cleared to 0 on input, but + the device does not support + disabling writes + (FvAttributes:EFI_FV_WRITE_DISAB + is clear on return from + GetVolumeAttributes()). Actual + volume attributes are unchanged. + + @retval EFI_INVALID_PARAMETER FvAttributes:EFI_FV_LOCK_STATUS + is set on input, but the device + does not support locking + (FvAttributes:EFI_FV_LOCK_CAP is + clear on return from + GetVolumeAttributes()). Actual + volume attributes are unchanged. + + @retval EFI_ACCESS_DENIED Device is locked and does not + allow attribute modification + (FvAttributes:EFI_FV_LOCK_STATUS + is set on return from + GetVolumeAttributes()). Actual + volume attributes are unchanged. + +**/ +EFI_STATUS +EFIAPI +Fv2SetVolumeAttributes ( + IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This, + IN OUT EFI_FV_ATTRIBUTES *FvAttributes + ) +{ + FIRMWARE_VOLUME2_PRIVATE_DATA *Private; + EFI_FIRMWARE_VOLUME_PROTOCOL *FirmwareVolume; + FRAMEWORK_EFI_FV_ATTRIBUTES FrameworkFvAttributes; + + Private = FIRMWARE_VOLUME2_PRIVATE_DATA_FROM_THIS (This); + FirmwareVolume = Private->FirmwareVolume; + + FrameworkFvAttributes = (*FvAttributes & 0x1ff) | ((UINTN)EFI_FV_ALIGNMENT_2 << ((*FvAttributes & EFI_FV2_ALIGNMENT) >> 16)); + + return FirmwareVolume->SetVolumeAttributes ( + FirmwareVolume, + &FrameworkFvAttributes + ); +} + +/** + ReadFile() is used to retrieve any file from a firmware volume + during the DXE phase. The actual binary encoding of the file in + the firmware volume media may be in any arbitrary format as long + as it does the following: ?It is accessed using the Firmware + Volume Protocol. ?The image that is returned follows the image + format defined in Code Definitions: PI Firmware File Format. + If the input value of Buffer==NULL, it indicates the caller is + requesting only that the type, attributes, and size of the + file be returned and that there is no output buffer. In this + case, the following occurs: + - BufferSize is returned with the size that is required to + successfully complete the read. + - The output parameters FoundType and *FileAttributes are + returned with valid values. + - The returned value of *AuthenticationStatus is undefined. + + If the input value of Buffer!=NULL, the output buffer is + specified by a double indirection of the Buffer parameter. The + input value of *Buffer is used to determine if the output + buffer is caller allocated or is dynamically allocated by + ReadFile(). If the input value of *Buffer!=NULL, it indicates + the output buffer is caller allocated. In this case, the input + value of *BufferSize indicates the size of the + caller-allocated output buffer. If the output buffer is not + large enough to contain the entire requested output, it is + filled up to the point that the output buffer is exhausted and + EFI_WARN_BUFFER_TOO_SMALL is returned, and then BufferSize is + returned with the size required to successfully complete the + read. All other output parameters are returned with valid + values. If the input value of *Buffer==NULL, it indicates the + output buffer is to be allocated by ReadFile(). In this case, + ReadFile() will allocate an appropriately sized buffer from + boot services pool memory, which will be returned in Buffer. + The size of the new buffer is returned in BufferSize and all + other output parameters are returned with valid values. + ReadFile() is callable only from TPL_NOTIFY and below. + Behavior of ReadFile() at any EFI_TPL above TPL_NOTIFY is + undefined. Type EFI_TPL is defined in RaiseTPL() in the UEFI + 2.0 specification. + + @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL + instance. + + @param NameGuid Pointer to an EFI_GUID, which is the file + name. All firmware file names are EFI_GUIDs. + A single firmware volume must not have two + valid files with the same file name + EFI_GUID. + + @param Buffer Pointer to a pointer to a buffer in which the + file contents are returned, not including the + file header. + @param BufferSize Pointer to a caller-allocated UINTN. It + indicates the size of the memory + represented by Buffer. + + @param FoundType Pointer to a caller-allocated + EFI_FV_FILETYPE. + + @param FileAttributes Pointer to a caller-allocated + EFI_FV_FILE_ATTRIBUTES. + + @param AuthenticationStatus Pointer to a caller-allocated + UINT32 in which the + authentication status is + returned. + + @retval EFI_SUCCESS The call completed successfully. + + @retval EFI_WARN_BUFFER_TOO_SMALL The buffer is too small to + contain the requested + output. The buffer is + filled and the output is + truncated. + + @retval EFI_OUT_OF_RESOURCES An allocation failure occurred. + + @retavl EFI_NOT_FOUND Name was not found in the firmware + volume. + + @retval EFI_DEVICE_ERROR A hardware error occurred when + attempting to access the firmware + volume. + + @retval EFI_ACCESS_DENIED The firmware volume is configured to + isallow reads. + +**/ +EFI_STATUS +EFIAPI +Fv2ReadFile ( + IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This, + IN CONST EFI_GUID *NameGuid, + IN OUT VOID **Buffer, + IN OUT UINTN *BufferSize, + OUT EFI_FV_FILETYPE *FoundType, + OUT EFI_FV_FILE_ATTRIBUTES *FileAttributes, + OUT UINT32 *AuthenticationStatus + ) +{ + FIRMWARE_VOLUME2_PRIVATE_DATA *Private; + EFI_FIRMWARE_VOLUME_PROTOCOL *FirmwareVolume; + + Private = FIRMWARE_VOLUME2_PRIVATE_DATA_FROM_THIS (This); + FirmwareVolume = Private->FirmwareVolume; + + return FirmwareVolume->ReadFile ( + FirmwareVolume, + (EFI_GUID *)NameGuid, + Buffer, + BufferSize, + FoundType, + FileAttributes, + AuthenticationStatus + ); +} + +/** + ReadSection() is used to retrieve a specific section from a file + within a firmware volume. The section returned is determined + using a depth-first, left-to-right search algorithm through all + sections found in the specified file. See + ????Firmware File Sections???? on page 9 for more details about + sections. The output buffer is specified by a double indirection + of the Buffer parameter. The input value of Buffer is used to + determine if the output buffer is caller allocated or is + dynamically allocated by ReadSection(). If the input value of + Buffer!=NULL, it indicates that the output buffer is caller + allocated. In this case, the input value of *BufferSize + indicates the size of the caller-allocated output buffer. If + the output buffer is not large enough to contain the entire + requested output, it is filled up to the point that the output + buffer is exhausted and EFI_WARN_BUFFER_TOO_SMALL is returned, + and then BufferSize is returned with the size that is required + to successfully complete the read. All other + output parameters are returned with valid values. If the input + value of *Buffer==NULL, it indicates the output buffer is to + be allocated by ReadSection(). In this case, ReadSection() + will allocate an appropriately sized buffer from boot services + pool memory, which will be returned in *Buffer. The size of + the new buffer is returned in *BufferSize and all other output + parameters are returned with valid values. ReadSection() is + callable only from TPL_NOTIFY and below. Behavior of + ReadSection() at any EFI_TPL above TPL_NOTIFY is + undefined. Type EFI_TPL is defined in RaiseTPL() in the UEFI + 2.0 specification. + + + @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL + instance. + + @param NameGuid Pointer to an EFI_GUID, which indicates the + file name from which the requested section + will be read. + + @param SectionType Indicates the section type to return. + SectionType in conjunction with + SectionInstance indicates which section to + return. + + @param SectionInstance Indicates which instance of sections + with a type of SectionType to return. + SectionType in conjunction with + SectionInstance indicates which + section to return. SectionInstance is + zero based. + + @param Buffer Pointer to a pointer to a buffer in which the + section contents are returned, not including + the section header. + + @param BufferSize Pointer to a caller-allocated UINTN. It + indicates the size of the memory + represented by Buffer. + + @param AuthenticationStatus Pointer to a caller-allocated + UINT32 in which the authentication + status is returned. + + + @retval EFI_SUCCESS The call completed successfully. + + @retval EFI_WARN_BUFFER_TOO_SMALL The caller-allocated + buffer is too small to + contain the requested + output. The buffer is + filled and the output is + truncated. + + @retval EFI_OUT_OF_RESOURCES An allocation failure occurred. + + @retval EFI_NOT_FOUND The requested file was not found in + the firmware volume. EFI_NOT_FOUND The + requested section was not found in the + specified file. + + @retval EFI_DEVICE_ERROR A hardware error occurred when + attempting to access the firmware + volume. + + @retval EFI_ACCESS_DENIED The firmware volume is configured to + disallow reads. EFI_PROTOCOL_ERROR + The requested section was not found, + but the file could not be fully + parsed because a required + GUIDED_SECTION_EXTRACTION_PROTOCOL + was not found. It is possible the + requested section exists within the + file and could be successfully + extracted once the required + GUIDED_SECTION_EXTRACTION_PROTOCOL + is published. + +**/ +EFI_STATUS +EFIAPI +Fv2ReadSection ( + IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This, + IN CONST EFI_GUID *NameGuid, + IN EFI_SECTION_TYPE SectionType, + IN UINTN SectionInstance, + IN OUT VOID **Buffer, + IN OUT UINTN *BufferSize, + OUT UINT32 *AuthenticationStatus + ) +{ + FIRMWARE_VOLUME2_PRIVATE_DATA *Private; + EFI_FIRMWARE_VOLUME_PROTOCOL *FirmwareVolume; + + Private = FIRMWARE_VOLUME2_PRIVATE_DATA_FROM_THIS (This); + FirmwareVolume = Private->FirmwareVolume; + + return FirmwareVolume->ReadSection ( + FirmwareVolume, + (EFI_GUID *)NameGuid, + SectionType, + SectionInstance, + Buffer, + BufferSize, + AuthenticationStatus + ); +} + +/** + WriteFile() is used to write one or more files to a firmware + volume. Each file to be written is described by an + EFI_FV_WRITE_FILE_DATA structure. The caller must ensure that + any required alignment for all files listed in the FileData + array is compatible with the firmware volume. Firmware volume + capabilities can be determined using the GetVolumeAttributes() + call. Similarly, if the WritePolicy is set to + EFI_FV_RELIABLE_WRITE, the caller must check the firmware volume + capabilities to ensure EFI_FV_RELIABLE_WRITE is supported by the + firmware volume. EFI_FV_UNRELIABLE_WRITE must always be + supported. Writing a file with a size of zero + (FileData[n].BufferSize == 0) deletes the file from the firmware + volume if it exists. Deleting a file must be done one at a time. + Deleting a file as part of a multiple file write is not allowed. + Platform Initialization Specification VOLUME 3 Shared + Architectural Elements 84 August 21, 2006 Version 1.0 + WriteFile() is callable only from TPL_NOTIFY and below. + Behavior of WriteFile() at any EFI_TPL above TPL_NOTIFY is + undefined. Type EFI_TPL is defined in RaiseTPL() in the UEFI 2.0 + specification. + + @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL + instance. NumberOfFiles Indicates the number of + elements in the array pointed to by FileData. + + + @param WritePolicy Indicates the level of reliability for the + write in the event of a power failure or + other system failure during the write + operation. + + @param FileData Pointer to an array of + EFI_FV_WRITE_FILE_DATA. Each element of + FileData[] represents a file to be written. + + + @retval EFI_SUCCESS The write completed successfully. + + @retval EFI_OUT_OF_RESOURCES The firmware volume does not + have enough free space to + storefile(s). + + @retval EFI_DEVICE_ERROR A hardware error occurred when + attempting to access the firmware volume. + + @retval EFI_WRITE_PROTECTED The firmware volume is + configured to disallow writes. + + @retval EFI_NOT_FOUND A delete was requested, but the + requested file was not found in the + firmware volume. + + @retval EFI_INVALID_PARAMETER A delete was requested with a + multiple file write. + + @retval EFI_INVALID_PARAMETER An unsupported WritePolicy was + requested. + + @retval EFI_INVALID_PARAMETER An unknown file type was + specified. + + @retval EFI_INVALID_PARAMETER A file system specific error + has occurred. + +**/ +EFI_STATUS +EFIAPI +Fv2WriteFile ( + IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This, + IN UINT32 NumberOfFiles, + IN EFI_FV_WRITE_POLICY WritePolicy, + IN EFI_FV_WRITE_FILE_DATA *FileData + ) +{ + FIRMWARE_VOLUME2_PRIVATE_DATA *Private; + EFI_FIRMWARE_VOLUME_PROTOCOL *FirmwareVolume; + + Private = FIRMWARE_VOLUME2_PRIVATE_DATA_FROM_THIS (This); + FirmwareVolume = Private->FirmwareVolume; + + return FirmwareVolume->WriteFile ( + FirmwareVolume, + NumberOfFiles, + WritePolicy, + (FRAMEWORK_EFI_FV_WRITE_FILE_DATA *)FileData + ); +} + +/** + GetNextFile() is the interface that is used to search a firmware + volume for a particular file. It is called successively until + the desired file is located or the function returns + EFI_NOT_FOUND. To filter uninteresting files from the output, + the type of file to search for may be specified in FileType. For + example, if *FileType is EFI_FV_FILETYPE_DRIVER, only files of + this type will be returned in the output. If *FileType is + EFI_FV_FILETYPE_ALL, no filtering of file types is done. The Key + parameter is used to indicate a starting point of the search. If + the buffer *Key is completely initialized to zero, the search + re-initialized and starts at the beginning. Subsequent calls to + GetNextFile() must maintain the value of *Key returned by the + immediately previous call. The actual contents of *Key are + implementation specific and no semantic content is implied. + GetNextFile() is callable only from TPL_NOTIFY and below. + Behavior of GetNextFile() at any EFI_TPL above TPL_NOTIFY is + undefined. Type EFI_TPL is defined in RaiseTPL() in the UEFI 2.0 + specification. Status Codes Returned + + + @param This Indicates the EFI_FIRMWARE_VOLUME2_PROTOCOL + instance. Key Pointer to a caller-allocated buffer + that contains implementation-specific data that is + used to track where to begin the search for the + next file. The size of the buffer must be at least + This->KeySize bytes long. To re-initialize the + search and begin from the beginning of the + firmware volume, the entire buffer must be cleared + to zero. Other than clearing the buffer to + initiate a new search, the caller must not modify + the data in the buffer between calls to + GetNextFile(). + + @param FileType Pointer to a caller-allocated + EFI_FV_FILETYPE. The GetNextFile() API can + filter its search for files based on the + value of the FileType input. A *FileType + input of EFI_FV_FILETYPE_ALL causes + GetNextFile() to search for files of all + types. If a file is found, the file's type + is returned in FileType. *FileType is not + modified if no file is found. + + @param NameGuid Pointer to a caller-allocated EFI_GUID. If a + matching file is found, the file's name is + returned in NameGuid. If no matching file is + found, *NameGuid is not modified. + + @param Attributes Pointer to a caller-allocated + EFI_FV_FILE_ATTRIBUTES. If a matching file + is found, the file's attributes are returned + in Attributes. If no matching file is found, + Attributes is not modified. Type + EFI_FV_FILE_ATTRIBUTES is defined in + ReadFile(). + + @param Size Pointer to a caller-allocated UINTN. If a + matching file is found, the file's size is + returned in *Size. If no matching file is found, + Size is not modified. + + @retval EFI_SUCCESS The output parameters are filled with data + obtained from the first matching file that + was found. + + @retval FI_NOT_FOUND No files of type FileType were found. + + + @retval EFI_DEVICE_ERROR A hardware error occurred when + attempting to access the firmware + volume. + + @retval EFI_ACCESS_DENIED The firmware volume is configured to + disallow reads. + + +**/ +EFI_STATUS +EFIAPI +Fv2GetNextFile ( + IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This, + IN OUT VOID *Key, + IN OUT EFI_FV_FILETYPE *FileType, + OUT EFI_GUID *NameGuid, + OUT EFI_FV_FILE_ATTRIBUTES *Attributes, + OUT UINTN *Size + ) +{ + FIRMWARE_VOLUME2_PRIVATE_DATA *Private; + EFI_FIRMWARE_VOLUME_PROTOCOL *FirmwareVolume; + + Private = FIRMWARE_VOLUME2_PRIVATE_DATA_FROM_THIS (This); + FirmwareVolume = Private->FirmwareVolume; + + return FirmwareVolume->GetNextFile ( + FirmwareVolume, + Key, + FileType, + NameGuid, + Attributes, + Size + ); +} + +/** + The GetInfo() function returns information of type + InformationType for the requested firmware volume. If the volume + does not support the requested information type, then + EFI_UNSUPPORTED is returned. If the buffer is not large enough + to hold the requested structure, EFI_BUFFER_TOO_SMALL is + returned and the BufferSize is set to the size of buffer that is + required to make the request. The information types defined by + this specification are required information types that all file + systems must support. + + @param This A pointer to the EFI_FIRMWARE_VOLUME2_PROTOCOL + instance that is the file handle the requested + information is for. + + @param InformationType The type identifier for the + information being requested. + + @param BufferSize On input, the size of Buffer. On output, + the amount of data returned in Buffer. In + both cases, the size is measured in bytes. + + @param Buffer A pointer to the data buffer to return. The + buffer's type is indicated by InformationType. + + + @retval EFI_SUCCESS The information was retrieved. + + @retval EFI_UNSUPPORTED The InformationType is not known. + + @retval EFI_NO_MEDIA The device has no medium. + + @retval EFI_DEVICE_ERROR The device reported an error. + + @retval EFI_VOLUME_CORRUPTED The file system structures are + corrupted. + + @retval EFI_BUFFER_TOO_SMALL The BufferSize is too small to + read the current directory + entry. BufferSize has been + updated with the size needed to + complete the request. + + +**/ +EFI_STATUS +EFIAPI +Fv2GetInfo ( + IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This, + IN CONST EFI_GUID *InformationType, + IN OUT UINTN *BufferSize, + OUT VOID *Buffer + ) +{ + return EFI_UNSUPPORTED; +} + +/** + + The SetInfo() function sets information of type InformationType + on the requested firmware volume. + + + @param This A pointer to the EFI_FIRMWARE_VOLUME2_PROTOCOL + instance that is the file handle the information + is for. + + @param InformationType The type identifier for the + information being set. + + @param BufferSize The size, in bytes, of Buffer. + + @param Buffer A pointer to the data buffer to write. The + buffer's type is indicated by InformationType. + + @retval EFI_SUCCESS The information was set. + + @retval EFI_UNSUPPORTED The InformationType is not known. + + @retval EFI_NO_MEDIA The device has no medium. + + @retval EFI_DEVICE_ERROR The device reported an error. + + @retval EFI_VOLUME_CORRUPTED The file system structures are + corrupted. + + + @retval EFI_WRITE_PROTECTED The media is read only. + + @retval EFI_VOLUME_FULL The volume is full. + + @retval EFI_BAD_BUFFER_SIZE BufferSize is smaller than the + size of the type indicated by + InformationType. + +**/ +EFI_STATUS +EFIAPI +Fv2SetInfo ( + IN CONST EFI_FIRMWARE_VOLUME2_PROTOCOL *This, + IN CONST EFI_GUID *InformationType, + IN UINTN BufferSize, + IN CONST VOID *Buffer + ) +{ + return EFI_UNSUPPORTED; +} diff --git a/EdkCompatibilityPkg/Compatibility/Fv2ToFvThunk/Fv2ToFvThunk.inf b/EdkCompatibilityPkg/Compatibility/Fv2ToFvThunk/Fv2ToFvThunk.inf new file mode 100644 index 0000000..b7a3862 --- /dev/null +++ b/EdkCompatibilityPkg/Compatibility/Fv2ToFvThunk/Fv2ToFvThunk.inf @@ -0,0 +1,53 @@ +#/** @file +# Component description file for PeiVariable module. +# +# PEIM to provide the Variable functionality. +# Copyright (c) 2006 - 2007, 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 = Fv2ToFvThunk + FILE_GUID = D8A6F4A6-0E97-4a8b-A475-39F1B28B5AEC + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + EDK_RELEASE_VERSION = 0x00020000 + EFI_SPECIFICATION_VERSION = 0x00020000 + ENTRY_POINT = InitializeFirmwareVolume + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# + +[Sources.common] + Fv2ToFvThunk.c + +[Packages] + MdePkg/MdePkg.dec + IntelFrameworkPkg/IntelFrameworkPkg.dec + +[LibraryClasses] + UefiDriverEntryPoint + UefiBootServicesTableLib + BaseLib + DebugLib + UefiLib + MemoryAllocationLib + +[Protocols] + gEfiFirmwareVolume2ProtocolGuid + gEfiFirmwareVolumeProtocolGuid + +[Depex] + TRUE diff --git a/EdkCompatibilityPkg/Compatibility/FvToFv2Thunk/FvToFv2Thunk.c b/EdkCompatibilityPkg/Compatibility/FvToFv2Thunk/FvToFv2Thunk.c new file mode 100644 index 0000000..61b2b04 --- /dev/null +++ b/EdkCompatibilityPkg/Compatibility/FvToFv2Thunk/FvToFv2Thunk.c @@ -0,0 +1,619 @@ +/*++ + +Copyright (c) 2006 - 2008 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: + + FvToFv2Thunk.c + +Abstract: + + DXE driver + +--*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/** + Retrieves attributes, insures positive polarity of attribute bits, returns + resulting attributes in output parameter + + @param This Calling context + @param Attributes output buffer which contains attributes + + @retval EFI_INVALID_PARAMETER + @retval EFI_SUCCESS + +**/ +EFI_STATUS +EFIAPI +FvGetVolumeAttributes ( + IN EFI_FIRMWARE_VOLUME_PROTOCOL *This, + OUT FRAMEWORK_EFI_FV_ATTRIBUTES *Attributes + ); + +/** + Sets volume attributes + + @param This Calling context + @param Attributes Buffer which contains attributes + + @retval EFI_INVALID_PARAMETER + @retval EFI_DEVICE_ERROR + @retval EFI_SUCCESS + +**/ +EFI_STATUS +EFIAPI +FvSetVolumeAttributes ( + IN EFI_FIRMWARE_VOLUME_PROTOCOL *This, + IN OUT FRAMEWORK_EFI_FV_ATTRIBUTES *Attributes + ); + +/** + Read the requested file (NameGuid) and returns data in Buffer. + + @param This Calling context + @param NameGuid Filename identifying which file to read + @param Buffer Pointer to pointer to buffer in which contents of file are returned. +
+ If Buffer is NULL, only type, attributes, and size are returned as + there is no output buffer. +
+ If Buffer != NULL and *Buffer == NULL, the output buffer is allocated + from BS pool by ReadFile +
+ If Buffer != NULL and *Buffer != NULL, the output buffer has been + allocated by the caller and is being passed in. + @param BufferSize Indicates the buffer size passed in, and on output the size + required to complete the read + @param FoundType Indicates the type of the file who's data is returned + @param FileAttributes Indicates the attributes of the file who's data is resturned + @param AuthenticationStatus Indicates the authentication status of the data + + @retval EFI_SUCCESS + @retval EFI_WARN_BUFFER_TOO_SMALL + @retval EFI_NOT_FOUND + @retval EFI_DEVICE_ERROR + @retval EFI_ACCESS_DENIED + +**/ +EFI_STATUS +EFIAPI +FvReadFile ( + IN EFI_FIRMWARE_VOLUME_PROTOCOL *This, + IN EFI_GUID *NameGuid, + IN OUT VOID **Buffer, + IN OUT UINTN *BufferSize, + OUT EFI_FV_FILETYPE *FoundType, + OUT EFI_FV_FILE_ATTRIBUTES *FileAttributes, + OUT UINT32 *AuthenticationStatus + ); + +/** + Read the requested section from the specified file and returns data in Buffer. + + @param This Calling context + @param NameGuid Filename identifying the file from which to read + @param SectionType Indicates what section type to retrieve + @param SectionInstance Indicates which instance of SectionType to retrieve + @param Buffer Pointer to pointer to buffer in which contents of file are returned. +
+ If Buffer is NULL, only type, attributes, and size are returned as + there is no output buffer. +
+ If Buffer != NULL and *Buffer == NULL, the output buffer is allocated + from BS pool by ReadFile +
+ If Buffer != NULL and *Buffer != NULL, the output buffer has been + allocated by the caller and is being passed in. + @param BufferSize Indicates the buffer size passed in, and on output the size + required to complete the read + @param AuthenticationStatus Indicates the authentication status of the data + + @retval EFI_SUCCESS + @retval EFI_WARN_BUFFER_TOO_SMALL + @retval EFI_OUT_OF_RESOURCES + @retval EFI_NOT_FOUND + @retval EFI_DEVICE_ERROR + @retval EFI_ACCESS_DENIED + +**/ +EFI_STATUS +EFIAPI +FvReadSection ( + IN EFI_FIRMWARE_VOLUME_PROTOCOL *This, + IN EFI_GUID *NameGuid, + IN EFI_SECTION_TYPE SectionType, + IN UINTN SectionInstance, + IN OUT VOID **Buffer, + IN OUT UINTN *BufferSize, + OUT UINT32 *AuthenticationStatus + ); + +/** + Write the supplied file (NameGuid) to the FV. + + @param This Calling context + @param NumberOfFiles Indicates the number of file records pointed to by FileData + @param WritePolicy Indicates the level of reliability of the write with respect to + things like power failure events. + @param FileData A pointer to an array of EFI_FV_WRITE_FILE_DATA structures. Each + element in the array indicates a file to write, and there are + NumberOfFiles elements in the input array. + + @retval EFI_SUCCESS + @retval EFI_OUT_OF_RESOURCES + @retval EFI_DEVICE_ERROR + @retval EFI_WRITE_PROTECTED + @retval EFI_NOT_FOUND + @retval EFI_INVALID_PARAMETER + +**/ +EFI_STATUS +EFIAPI +FvWriteFile ( + IN EFI_FIRMWARE_VOLUME_PROTOCOL *This, + IN UINT32 NumberOfFiles, + IN FRAMEWORK_EFI_FV_WRITE_POLICY WritePolicy, + IN FRAMEWORK_EFI_FV_WRITE_FILE_DATA *FileData + ); + +/** + Given the input key, search for the next matching file in the volume. + + @param This Calling context + @param Key Pointer to a caller allocated buffer that contains an implementation + specific key that is used to track where to begin searching on + successive calls. + @param FileType Indicates the file type to filter for + @param NameGuid Guid filename of the file found + @param Attributes Attributes of the file found + @param Size Size in bytes of the file found + + @retval EFI_SUCCESS + @retval EFI_NOT_FOUND + @retval EFI_DEVICE_ERROR + @retval EFI_ACCESS_DENIED + +**/ +EFI_STATUS +EFIAPI +FvGetNextFile ( + IN EFI_FIRMWARE_VOLUME_PROTOCOL *This, + IN OUT VOID *Key, + IN OUT EFI_FV_FILETYPE *FileType, + OUT EFI_GUID *NameGuid, + OUT EFI_FV_FILE_ATTRIBUTES *Attributes, + OUT UINTN *Size + ); + +#define FIRMWARE_VOLUME_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('f', 'v', 't', 'h') + +typedef struct { + UINTN Signature; + EFI_FIRMWARE_VOLUME_PROTOCOL FirmwareVolume; + EFI_FIRMWARE_VOLUME2_PROTOCOL *FirmwareVolume2; +} FIRMWARE_VOLUME_PRIVATE_DATA; + +#define FIRMWARE_VOLUME_PRIVATE_DATA_FROM_THIS(a) CR (a, FIRMWARE_VOLUME_PRIVATE_DATA, FirmwareVolume, FIRMWARE_VOLUME_PRIVATE_DATA_SIGNATURE) + +// +// Firmware Volume Protocol template +// +EFI_EVENT mFvRegistration; + +FIRMWARE_VOLUME_PRIVATE_DATA gFirmwareVolumePrivateDataTemplate = { + FIRMWARE_VOLUME_PRIVATE_DATA_SIGNATURE, + { + FvGetVolumeAttributes, + FvSetVolumeAttributes, + FvReadFile, + FvReadSection, + FvWriteFile, + FvGetNextFile, + 0, + NULL + }, + NULL +}; + +// +// Module globals +// + +VOID +EFIAPI +FvNotificationEvent ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + EFI_STATUS Status; + UINTN BufferSize; + EFI_HANDLE Handle; + FIRMWARE_VOLUME_PRIVATE_DATA *Private; + EFI_FIRMWARE_VOLUME_PROTOCOL *FirmwareVolume; + + while (TRUE) { + BufferSize = sizeof (Handle); + Status = gBS->LocateHandle ( + ByRegisterNotify, + &gEfiFirmwareVolume2ProtocolGuid, + mFvRegistration, + &BufferSize, + &Handle + ); + if (EFI_ERROR (Status)) { + // + // Exit Path of While Loop.... + // + break; + } + + // + // Skip this handle if the Firmware Volume Protocol is already installed + // + Status = gBS->HandleProtocol ( + Handle, + &gEfiFirmwareVolumeProtocolGuid, + (VOID **)&FirmwareVolume + ); + if (!EFI_ERROR (Status)) { + continue; + } + + // + // Allocate private data structure + // + Private = AllocateCopyPool (sizeof (FIRMWARE_VOLUME_PRIVATE_DATA), &gFirmwareVolumePrivateDataTemplate); + if (Private == NULL) { + continue; + } + + // + // Retrieve the Firmware Volume2 Protocol + // + Status = gBS->HandleProtocol ( + Handle, + &gEfiFirmwareVolume2ProtocolGuid, + (VOID **)&Private->FirmwareVolume2 + ); + ASSERT_EFI_ERROR (Status); + + // + // Fill in rest of private data structure + // + Private->FirmwareVolume.KeySize = Private->FirmwareVolume2->KeySize; + Private->FirmwareVolume.ParentHandle = Private->FirmwareVolume2->ParentHandle; + + // + // Install Firmware Volume Protocol onto same handle + // + Status = gBS->InstallMultipleProtocolInterfaces ( + &Handle, + &gEfiFirmwareVolumeProtocolGuid, + &Private->FirmwareVolume, + NULL + ); + ASSERT_EFI_ERROR (Status); + } +} + + +/** + The user Entry Point for DXE driver. The user code starts with this function + as the real entry point for the image goes into a library that calls this + function. + + @param[in] ImageHandle The firmware allocated handle for the EFI image. + @param[in] SystemTable A pointer to the EFI System Table. + + @retval EFI_SUCCESS The entry point is executed successfully. + @retval other Some error occurs when executing this entry point. + +**/ +EFI_STATUS +EFIAPI +InitializeFirmwareVolume2 ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EfiCreateProtocolNotifyEvent ( + &gEfiFirmwareVolume2ProtocolGuid, + TPL_CALLBACK, + FvNotificationEvent, + NULL, + &mFvRegistration + ); + return EFI_SUCCESS; +} + +/** + Retrieves attributes, insures positive polarity of attribute bits, returns + resulting attributes in output parameter + + @param This Calling context + @param Attributes output buffer which contains attributes + + @retval EFI_INVALID_PARAMETER + @retval EFI_SUCCESS + +**/ +EFI_STATUS +EFIAPI +FvGetVolumeAttributes ( + IN EFI_FIRMWARE_VOLUME_PROTOCOL *This, + OUT FRAMEWORK_EFI_FV_ATTRIBUTES *Attributes + ) +{ + EFI_STATUS Status; + FIRMWARE_VOLUME_PRIVATE_DATA *Private; + EFI_FIRMWARE_VOLUME2_PROTOCOL *FirmwareVolume2; + + Private = FIRMWARE_VOLUME_PRIVATE_DATA_FROM_THIS (This); + FirmwareVolume2 = Private->FirmwareVolume2; + + Status = FirmwareVolume2->GetVolumeAttributes ( + FirmwareVolume2, + Attributes + ); + if (!EFI_ERROR (Status)) { + *Attributes = (*Attributes & 0x1ff) | ((UINTN)EFI_FV_ALIGNMENT_2 << ((*Attributes & EFI_FV2_ALIGNMENT) >> 16)); + } + return Status; +} + +/** + Sets volume attributes + + @param This Calling context + @param Attributes Buffer which contains attributes + + @retval EFI_INVALID_PARAMETER + @retval EFI_DEVICE_ERROR + @retval EFI_SUCCESS + +**/ +EFI_STATUS +EFIAPI +FvSetVolumeAttributes ( + IN EFI_FIRMWARE_VOLUME_PROTOCOL *This, + IN OUT FRAMEWORK_EFI_FV_ATTRIBUTES *Attributes + ) +{ + FIRMWARE_VOLUME_PRIVATE_DATA *Private; + EFI_FIRMWARE_VOLUME2_PROTOCOL *FirmwareVolume2; + INTN Alignment; + EFI_FV_ATTRIBUTES Fv2Attributes; + + Private = FIRMWARE_VOLUME_PRIVATE_DATA_FROM_THIS (This); + FirmwareVolume2 = Private->FirmwareVolume2; + + Fv2Attributes = (*Attributes & 0x1ff); + Alignment = LowBitSet64 (RShiftU64 (*Attributes, 16) & 0xffff); + if (Alignment != -1) { + Fv2Attributes |= LShiftU64 (Alignment, 16); + } + return FirmwareVolume2->SetVolumeAttributes ( + FirmwareVolume2, + &Fv2Attributes + ); +} + +/** + Read the requested file (NameGuid) and returns data in Buffer. + + @param This Calling context + @param NameGuid Filename identifying which file to read + @param Buffer Pointer to pointer to buffer in which contents of file are returned. +
+ If Buffer is NULL, only type, attributes, and size are returned as + there is no output buffer. +
+ If Buffer != NULL and *Buffer == NULL, the output buffer is allocated + from BS pool by ReadFile +
+ If Buffer != NULL and *Buffer != NULL, the output buffer has been + allocated by the caller and is being passed in. + @param BufferSize Indicates the buffer size passed in, and on output the size + required to complete the read + @param FoundType Indicates the type of the file who's data is returned + @param FileAttributes Indicates the attributes of the file who's data is resturned + @param AuthenticationStatus Indicates the authentication status of the data + + @retval EFI_SUCCESS + @retval EFI_WARN_BUFFER_TOO_SMALL + @retval EFI_NOT_FOUND + @retval EFI_DEVICE_ERROR + @retval EFI_ACCESS_DENIED + +**/ +EFI_STATUS +EFIAPI +FvReadFile ( + IN EFI_FIRMWARE_VOLUME_PROTOCOL *This, + IN EFI_GUID *NameGuid, + IN OUT VOID **Buffer, + IN OUT UINTN *BufferSize, + OUT EFI_FV_FILETYPE *FoundType, + OUT EFI_FV_FILE_ATTRIBUTES *FileAttributes, + OUT UINT32 *AuthenticationStatus + ) +{ + FIRMWARE_VOLUME_PRIVATE_DATA *Private; + EFI_FIRMWARE_VOLUME2_PROTOCOL *FirmwareVolume2; + + Private = FIRMWARE_VOLUME_PRIVATE_DATA_FROM_THIS (This); + FirmwareVolume2 = Private->FirmwareVolume2; + + return FirmwareVolume2->ReadFile ( + FirmwareVolume2, + NameGuid, + Buffer, + BufferSize, + FoundType, + FileAttributes, + AuthenticationStatus + ); +} + +/** + Read the requested section from the specified file and returns data in Buffer. + + @param This Calling context + @param NameGuid Filename identifying the file from which to read + @param SectionType Indicates what section type to retrieve + @param SectionInstance Indicates which instance of SectionType to retrieve + @param Buffer Pointer to pointer to buffer in which contents of file are returned. +
+ If Buffer is NULL, only type, attributes, and size are returned as + there is no output buffer. +
+ If Buffer != NULL and *Buffer == NULL, the output buffer is allocated + from BS pool by ReadFile +
+ If Buffer != NULL and *Buffer != NULL, the output buffer has been + allocated by the caller and is being passed in. + @param BufferSize Indicates the buffer size passed in, and on output the size + required to complete the read + @param AuthenticationStatus Indicates the authentication status of the data + + @retval EFI_SUCCESS + @retval EFI_WARN_BUFFER_TOO_SMALL + @retval EFI_OUT_OF_RESOURCES + @retval EFI_NOT_FOUND + @retval EFI_DEVICE_ERROR + @retval EFI_ACCESS_DENIED + +**/ +EFI_STATUS +EFIAPI +FvReadSection ( + IN EFI_FIRMWARE_VOLUME_PROTOCOL *This, + IN EFI_GUID *NameGuid, + IN EFI_SECTION_TYPE SectionType, + IN UINTN SectionInstance, + IN OUT VOID **Buffer, + IN OUT UINTN *BufferSize, + OUT UINT32 *AuthenticationStatus + ) +{ + FIRMWARE_VOLUME_PRIVATE_DATA *Private; + EFI_FIRMWARE_VOLUME2_PROTOCOL *FirmwareVolume2; + + Private = FIRMWARE_VOLUME_PRIVATE_DATA_FROM_THIS (This); + FirmwareVolume2 = Private->FirmwareVolume2; + + return FirmwareVolume2->ReadSection ( + FirmwareVolume2, + NameGuid, + SectionType, + SectionInstance, + Buffer, + BufferSize, + AuthenticationStatus + ); +} + +/** + Write the supplied file (NameGuid) to the FV. + + @param This Calling context + @param NumberOfFiles Indicates the number of file records pointed to by FileData + @param WritePolicy Indicates the level of reliability of the write with respect to + things like power failure events. + @param FileData A pointer to an array of EFI_FV_WRITE_FILE_DATA structures. Each + element in the array indicates a file to write, and there are + NumberOfFiles elements in the input array. + + @retval EFI_SUCCESS + @retval EFI_OUT_OF_RESOURCES + @retval EFI_DEVICE_ERROR + @retval EFI_WRITE_PROTECTED + @retval EFI_NOT_FOUND + @retval EFI_INVALID_PARAMETER + +**/ +EFI_STATUS +EFIAPI +FvWriteFile ( + IN EFI_FIRMWARE_VOLUME_PROTOCOL *This, + IN UINT32 NumberOfFiles, + IN FRAMEWORK_EFI_FV_WRITE_POLICY WritePolicy, + IN FRAMEWORK_EFI_FV_WRITE_FILE_DATA *FileData + ) +{ + FIRMWARE_VOLUME_PRIVATE_DATA *Private; + EFI_FIRMWARE_VOLUME2_PROTOCOL *FirmwareVolume2; + + Private = FIRMWARE_VOLUME_PRIVATE_DATA_FROM_THIS (This); + FirmwareVolume2 = Private->FirmwareVolume2; + + return FirmwareVolume2->WriteFile ( + FirmwareVolume2, + NumberOfFiles, + WritePolicy, + (EFI_FV_WRITE_FILE_DATA *)FileData + ); +} + +/** + Given the input key, search for the next matching file in the volume. + + @param This Calling context + @param Key Pointer to a caller allocated buffer that contains an implementation + specific key that is used to track where to begin searching on + successive calls. + @param FileType Indicates the file type to filter for + @param NameGuid Guid filename of the file found + @param Attributes Attributes of the file found + @param Size Size in bytes of the file found + + @retval EFI_SUCCESS + @retval EFI_NOT_FOUND + @retval EFI_DEVICE_ERROR + @retval EFI_ACCESS_DENIED + +**/ +EFI_STATUS +EFIAPI +FvGetNextFile ( + IN EFI_FIRMWARE_VOLUME_PROTOCOL *This, + IN OUT VOID *Key, + IN OUT EFI_FV_FILETYPE *FileType, + OUT EFI_GUID *NameGuid, + OUT EFI_FV_FILE_ATTRIBUTES *Attributes, + OUT UINTN *Size + ) +{ + FIRMWARE_VOLUME_PRIVATE_DATA *Private; + EFI_FIRMWARE_VOLUME2_PROTOCOL *FirmwareVolume2; + + Private = FIRMWARE_VOLUME_PRIVATE_DATA_FROM_THIS (This); + FirmwareVolume2 = Private->FirmwareVolume2; + + return FirmwareVolume2->GetNextFile ( + FirmwareVolume2, + Key, + FileType, + NameGuid, + Attributes, + Size + ); +} diff --git a/EdkCompatibilityPkg/Compatibility/FvToFv2Thunk/FvToFv2Thunk.inf b/EdkCompatibilityPkg/Compatibility/FvToFv2Thunk/FvToFv2Thunk.inf new file mode 100644 index 0000000..8eaf4a2 --- /dev/null +++ b/EdkCompatibilityPkg/Compatibility/FvToFv2Thunk/FvToFv2Thunk.inf @@ -0,0 +1,53 @@ +#/** @file +# Component description file for PeiVariable module. +# +# PEIM to provide the Variable functionality. +# Copyright (c) 2006 - 2007, 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 = FvToFv2Thunk + FILE_GUID = 5007A40E-A5E0-44f7-86AE-662F9A91DA26 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + EDK_RELEASE_VERSION = 0x00020000 + EFI_SPECIFICATION_VERSION = 0x00020000 + ENTRY_POINT = InitializeFirmwareVolume2 + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# + +[Sources.common] + FvToFv2Thunk.c + +[Packages] + MdePkg/MdePkg.dec + IntelFrameworkPkg/IntelFrameworkPkg.dec + +[LibraryClasses] + UefiDriverEntryPoint + UefiBootServicesTableLib + BaseLib + DebugLib + UefiLib + MemoryAllocationLib + +[Protocols] + gEfiFirmwareVolume2ProtocolGuid + gEfiFirmwareVolumeProtocolGuid + +[Depex] + TRUE diff --git a/EdkCompatibilityPkg/Compatibility/PciCfg2ToPciCfgThunk/PciCfg2ToPciCfgThunk.c b/EdkCompatibilityPkg/Compatibility/PciCfg2ToPciCfgThunk/PciCfg2ToPciCfgThunk.c new file mode 100644 index 0000000..9cdf65a --- /dev/null +++ b/EdkCompatibilityPkg/Compatibility/PciCfg2ToPciCfgThunk/PciCfg2ToPciCfgThunk.c @@ -0,0 +1,219 @@ +/*++ + +Copyright (c) 2006 - 2008 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: + + Variable.c + +Abstract: + + PEIM to provide the Variable functionality + +--*/ + +#include +#include +#include +#include +#include + +// +// Function Prototypes - Callbacks +// +EFI_STATUS +EFIAPI +EcpPciCfgPpiNotifyCallback ( + IN EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor, + IN VOID *Ppi + ); + +// +// Function Prototypes +// +EFI_STATUS +EFIAPI +PciCfg2Read ( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_PCI_CFG2_PPI *This, + IN EFI_PEI_PCI_CFG_PPI_WIDTH Width, + IN UINT64 Address, + IN OUT VOID *Buffer + ); + +EFI_STATUS +EFIAPI +PciCfg2Write ( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_PCI_CFG2_PPI *This, + IN EFI_PEI_PCI_CFG_PPI_WIDTH Width, + IN UINT64 Address, + IN OUT VOID *Buffer + ); + +EFI_STATUS +EFIAPI +PciCfg2Modify ( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_PCI_CFG2_PPI *This, + IN EFI_PEI_PCI_CFG_PPI_WIDTH Width, + IN UINT64 Address, + IN CONST VOID *SetBits, + IN CONST VOID *ClearBits + ); + +// +// Module globals +// +EFI_PEI_NOTIFY_DESCRIPTOR mNotifyOnEcpPciCfgList = { + (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), + &gEcpPeiPciCfgPpiGuid, + EcpPciCfgPpiNotifyCallback +}; + +EFI_PEI_PCI_CFG2_PPI mPciCfg2Ppi = { + PciCfg2Read, + PciCfg2Write, + PciCfg2Modify, + 0 +}; + +EFI_PEI_PPI_DESCRIPTOR mPpiListPciCfg2 = { + (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), + &gEfiPciCfg2PpiGuid, + &mPciCfg2Ppi +}; + + +EFI_STATUS +EFIAPI +PeimInitializePciCfg2 ( + IN EFI_FFS_FILE_HEADER *FfsHeader, + IN CONST EFI_PEI_SERVICES **PeiServices + ) +/*++ + +Routine Description: + + Provide the functionality of the variable services. + +Arguments: + + FfsHeadher - The FFS file header + PeiServices - General purpose services available to every PEIM. + +Returns: + + Status - EFI_SUCCESS if the interface could be successfully + installed + +--*/ +{ + EFI_STATUS Status; + + // + // Register a notification for ECP PCI CFG PPI + // + Status = (*PeiServices)->NotifyPpi (PeiServices, &mNotifyOnEcpPciCfgList); + ASSERT_EFI_ERROR (Status); + return Status; +} + +EFI_STATUS +EFIAPI +EcpPciCfgPpiNotifyCallback ( + IN EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor, + IN VOID *Ppi + ) +{ + // + // When ECP PCI CFG PPI is installed, publish the PCI CFG2 PPI in the + // PEI Services Table and the PPI database + // + (*PeiServices)->PciCfg = &mPciCfg2Ppi; + return (*PeiServices)->InstallPpi ((CONST EFI_PEI_SERVICES **)PeiServices, &mPpiListPciCfg2); +} + +EFI_STATUS +EFIAPI +PciCfg2Read ( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_PCI_CFG2_PPI *This, + IN EFI_PEI_PCI_CFG_PPI_WIDTH Width, + IN UINT64 Address, + IN OUT VOID *Buffer + ) +{ + EFI_STATUS Status; + EFI_PEI_PCI_CFG_PPI *PciCfg; + + Status = (*PeiServices)->LocatePpi ( + PeiServices, + &gEcpPeiPciCfgPpiGuid, + 0, + NULL, + (VOID **)&PciCfg + ); + ASSERT_EFI_ERROR (Status); + + return PciCfg->Read ((EFI_PEI_SERVICES **)PeiServices, PciCfg, Width, Address, Buffer); +} + +EFI_STATUS +EFIAPI +PciCfg2Write ( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_PCI_CFG2_PPI *This, + IN EFI_PEI_PCI_CFG_PPI_WIDTH Width, + IN UINT64 Address, + IN OUT VOID *Buffer + ) +{ + EFI_STATUS Status; + EFI_PEI_PCI_CFG_PPI *PciCfg; + + Status = (*PeiServices)->LocatePpi ( + PeiServices, + &gEcpPeiPciCfgPpiGuid, + 0, + NULL, + (VOID **)&PciCfg + ); + ASSERT_EFI_ERROR (Status); + + return PciCfg->Write ((EFI_PEI_SERVICES **)PeiServices, PciCfg, Width, Address, Buffer); +} + +EFI_STATUS +EFIAPI +PciCfg2Modify ( + IN CONST EFI_PEI_SERVICES **PeiServices, + IN CONST EFI_PEI_PCI_CFG2_PPI *This, + IN EFI_PEI_PCI_CFG_PPI_WIDTH Width, + IN UINT64 Address, + IN CONST VOID *SetBits, + IN CONST VOID *ClearBits + ) +{ + EFI_STATUS Status; + EFI_PEI_PCI_CFG_PPI *PciCfg; + + Status = (*PeiServices)->LocatePpi ( + PeiServices, + &gEcpPeiPciCfgPpiGuid, + 0, + NULL, + (VOID **)&PciCfg + ); + ASSERT_EFI_ERROR (Status); + + return PciCfg->Modify ((EFI_PEI_SERVICES **)PeiServices, PciCfg, Width, Address, *(UINTN *)SetBits, *(UINTN *)ClearBits); +} diff --git a/EdkCompatibilityPkg/Compatibility/PciCfg2ToPciCfgThunk/PciCfg2ToPciCfgThunk.inf b/EdkCompatibilityPkg/Compatibility/PciCfg2ToPciCfgThunk/PciCfg2ToPciCfgThunk.inf new file mode 100644 index 0000000..85e84e5 --- /dev/null +++ b/EdkCompatibilityPkg/Compatibility/PciCfg2ToPciCfgThunk/PciCfg2ToPciCfgThunk.inf @@ -0,0 +1,53 @@ +#/** @file +# Component description file for PeiVariable module. +# +# PEIM to provide the Variable functionality. +# Copyright (c) 2006 - 2007, 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 = PciCfg2ToPciCfgThunk + FILE_GUID = 41401688-2862-431b-BAAC-6ECADAC384AB + MODULE_TYPE = PEIM + VERSION_STRING = 1.0 + EDK_RELEASE_VERSION = 0x00020000 + EFI_SPECIFICATION_VERSION = 0x00020000 + + ENTRY_POINT = PeimInitializePciCfg2 + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# + +[Sources.common] + PciCfg2ToPciCfgThunk.c + +[Packages] + MdePkg/MdePkg.dec + IntelFrameworkPkg/IntelFrameworkPkg.dec + EdkCompatibilityPkg/EdkCompatibilityPkg.dec + +[LibraryClasses] + PeimEntryPoint + DebugLib + +[Ppis] + gEfiPciCfgPpiInServiceTableGuid + gEfiPciCfg2PpiGuid + gEcpPeiPciCfgPpiGuid + +[Depex] + TRUE +# gEcpPeiPciCfgPpiGuid diff --git a/EdkCompatibilityPkg/Compatibility/PciCfgToPciCfg2Thunk/PciCfgToPciCfg2Thunk.c b/EdkCompatibilityPkg/Compatibility/PciCfgToPciCfg2Thunk/PciCfgToPciCfg2Thunk.c new file mode 100644 index 0000000..9821253 --- /dev/null +++ b/EdkCompatibilityPkg/Compatibility/PciCfgToPciCfg2Thunk/PciCfgToPciCfg2Thunk.c @@ -0,0 +1,155 @@ +/*++ + +Copyright (c) 2006 - 2008 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: + + Variable.c + +Abstract: + + PEIM to provide the Variable functionality + +--*/ + +#include +#include +#include +#include + +// +// Function Prototypes +// +EFI_STATUS +EFIAPI +PciCfgRead ( + IN EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_PCI_CFG_PPI *This, + IN EFI_PEI_PCI_CFG_PPI_WIDTH Width, + IN UINT64 Address, + IN OUT VOID *Buffer + ); + +EFI_STATUS +EFIAPI +PciCfgWrite ( + IN EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_PCI_CFG_PPI *This, + IN EFI_PEI_PCI_CFG_PPI_WIDTH Width, + IN UINT64 Address, + IN OUT VOID *Buffer + ); + +EFI_STATUS +EFIAPI +PciCfgModify ( + IN EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_PCI_CFG_PPI *This, + IN EFI_PEI_PCI_CFG_PPI_WIDTH Width, + IN UINT64 Address, + IN UINTN SetBits, + IN UINTN ClearBits + ); + +// +// Module globals +// +EFI_PEI_PCI_CFG_PPI mPciCfgPpi = { + PciCfgRead, + PciCfgWrite, + PciCfgModify, +}; + +EFI_PEI_PPI_DESCRIPTOR mPpiListPciCfg = { + (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), + &gEfiPciCfgPpiInServiceTableGuid, + &mPciCfgPpi +}; + +EFI_STATUS +EFIAPI +PeimInitializePciCfg ( + IN EFI_FFS_FILE_HEADER *FfsHeader, + IN CONST EFI_PEI_SERVICES **PeiServices + ) +/*++ + +Routine Description: + + Provide the functionality of the variable services. + +Arguments: + + FfsHeadher - The FFS file header + PeiServices - General purpose services available to every PEIM. + +Returns: + + Status - EFI_SUCCESS if the interface could be successfully + installed + +--*/ +{ + // + // Publish the variable capability to other modules + // + return (*PeiServices)->InstallPpi (PeiServices, &mPpiListPciCfg); +} + +EFI_STATUS +EFIAPI +PciCfgRead ( + IN EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_PCI_CFG_PPI *This, + IN EFI_PEI_PCI_CFG_PPI_WIDTH Width, + IN UINT64 Address, + IN OUT VOID *Buffer + ) +{ + EFI_PEI_PCI_CFG2_PPI *PciCfg2; + + PciCfg2 = (*PeiServices)->PciCfg; + + return PciCfg2->Read ((CONST EFI_PEI_SERVICES **)PeiServices, PciCfg2, Width, Address, Buffer); +} + +EFI_STATUS +EFIAPI +PciCfgWrite ( + IN EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_PCI_CFG_PPI *This, + IN EFI_PEI_PCI_CFG_PPI_WIDTH Width, + IN UINT64 Address, + IN OUT VOID *Buffer + ) +{ + EFI_PEI_PCI_CFG2_PPI *PciCfg2; + + PciCfg2 = (*PeiServices)->PciCfg; + + return PciCfg2->Write ((CONST EFI_PEI_SERVICES **)PeiServices, PciCfg2, Width, Address, Buffer); +} + +EFI_STATUS +EFIAPI +PciCfgModify ( + IN EFI_PEI_SERVICES **PeiServices, + IN EFI_PEI_PCI_CFG_PPI *This, + IN EFI_PEI_PCI_CFG_PPI_WIDTH Width, + IN UINT64 Address, + IN UINTN SetBits, + IN UINTN ClearBits + ) +{ + EFI_PEI_PCI_CFG2_PPI *PciCfg2; + + PciCfg2 = (*PeiServices)->PciCfg; + + return PciCfg2->Modify ((CONST EFI_PEI_SERVICES **)PeiServices, PciCfg2, Width, Address, &SetBits, &ClearBits); +} diff --git a/EdkCompatibilityPkg/Compatibility/PciCfgToPciCfg2Thunk/PciCfgToPciCfg2Thunk.inf b/EdkCompatibilityPkg/Compatibility/PciCfgToPciCfg2Thunk/PciCfgToPciCfg2Thunk.inf new file mode 100644 index 0000000..a264ab4 --- /dev/null +++ b/EdkCompatibilityPkg/Compatibility/PciCfgToPciCfg2Thunk/PciCfgToPciCfg2Thunk.inf @@ -0,0 +1,50 @@ +#/** @file +# Component description file for PeiVariable module. +# +# PEIM to provide the Variable functionality. +# Copyright (c) 2006 - 2007, 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 = PciCfgToPciCfg2Thunk + FILE_GUID = 717886AB-C40A-44cf-9114-4119E84B0DC7 + MODULE_TYPE = PEIM + VERSION_STRING = 1.0 + EDK_RELEASE_VERSION = 0x00020000 + EFI_SPECIFICATION_VERSION = 0x00020000 + + ENTRY_POINT = PeimInitializePciCfg + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# + +[Sources.common] + PciCfgToPciCfg2Thunk.c + +[Packages] + MdePkg/MdePkg.dec + IntelFrameworkPkg/IntelFrameworkPkg.dec + +[LibraryClasses] + PeimEntryPoint + DebugLib + +[Ppis] + gEfiPciCfgPpiInServiceTableGuid + gEfiPciCfg2PpiGuid + +[Depex] + gEfiPciCfg2PpiGuid diff --git a/EdkCompatibilityPkg/Compatibility/ReadOnlyVariable2ToReadOnlyVariableThunk/ReadOnlyVariable2ToReadOnlyVariableThunk.c b/EdkCompatibilityPkg/Compatibility/ReadOnlyVariable2ToReadOnlyVariableThunk/ReadOnlyVariable2ToReadOnlyVariableThunk.c new file mode 100644 index 0000000..832dc52 --- /dev/null +++ b/EdkCompatibilityPkg/Compatibility/ReadOnlyVariable2ToReadOnlyVariableThunk/ReadOnlyVariable2ToReadOnlyVariableThunk.c @@ -0,0 +1,208 @@ +/*++ + +Copyright (c) 2006 - 2008 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: + + Variable.c + +Abstract: + + PEIM to provide the Variable functionality + +--*/ + +#include +#include +#include +#include +#include +#include + +// +// Function Prototypes +// +EFI_STATUS +EFIAPI +PeiGetVariable ( + IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This, + IN CONST CHAR16 *VariableName, + IN CONST EFI_GUID *VariableGuid, + OUT UINT32 *Attributes, + IN OUT UINTN *DataSize, + OUT VOID *Data + ); + +EFI_STATUS +EFIAPI +PeiGetNextVariableName ( + IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This, + IN OUT UINTN *VariableNameSize, + IN OUT CHAR16 *VariableName, + IN OUT EFI_GUID *VariableGuid + ); + +// +// Module globals +// +EFI_PEI_READ_ONLY_VARIABLE2_PPI mVariablePpi = { + PeiGetVariable, + PeiGetNextVariableName +}; + +EFI_PEI_PPI_DESCRIPTOR mPpiListVariable = { + (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), + &gEfiPeiReadOnlyVariable2PpiGuid, + &mVariablePpi +}; + +EFI_STATUS +EFIAPI +PeimInitializeReadOnlyVariable2 ( + IN EFI_FFS_FILE_HEADER *FfsHeader, + IN EFI_PEI_SERVICES **PeiServices + ) +/*++ + +Routine Description: + + Provide the functionality of the variable services. + +Arguments: + + FfsHeadher - The FFS file header + PeiServices - General purpose services available to every PEIM. + +Returns: + + Status - EFI_SUCCESS if the interface could be successfully + installed + +--*/ +{ + // + // Publish the variable capability to other modules + // + return PeiServicesInstallPpi (&mPpiListVariable); +} + +EFI_STATUS +EFIAPI +PeiGetVariable ( + IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This, + IN CONST CHAR16 *VariableName, + IN CONST EFI_GUID *VariableGuid, + OUT UINT32 *Attributes, + IN OUT UINTN *DataSize, + OUT VOID *Data + ) +/*++ + +Routine Description: + + Provide the read variable functionality of the variable services. + +Arguments: + + PeiServices - General purpose services available to every PEIM. + + VariableName - The variable name + + VendorGuid - The vendor's GUID + + Attributes - Pointer to the attribute + + DataSize - Size of data + + Data - Pointer to data + +Returns: + + EFI_SUCCESS - The interface could be successfully installed + + EFI_NOT_FOUND - The variable could not be discovered + + EFI_BUFFER_TOO_SMALL - The caller buffer is not large enough + +--*/ +{ + EFI_STATUS Status; + EFI_PEI_READ_ONLY_VARIABLE_PPI *ReadOnlyVariable; + + Status = PeiServicesLocatePpi ( + &gEfiPeiReadOnlyVariablePpiGuid, + 0, + NULL, + (VOID **)&ReadOnlyVariable + ); + ASSERT_EFI_ERROR (Status); + + return ReadOnlyVariable->PeiGetVariable ( + GetPeiServicesTablePointer (), + (CHAR16 *)VariableName, + (EFI_GUID *)VariableGuid, + Attributes, + DataSize, + Data + ); +} + +EFI_STATUS +EFIAPI +PeiGetNextVariableName ( + IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This, + IN OUT UINTN *VariableNameSize, + IN OUT CHAR16 *VariableName, + IN OUT EFI_GUID *VariableGuid + ) +/*++ + +Routine Description: + + Provide the get next variable functionality of the variable services. + +Arguments: + + PeiServices - General purpose services available to every PEIM. + VariabvleNameSize - The variable name's size. + VariableName - A pointer to the variable's name. + VariableGuid - A pointer to the EFI_GUID structure. + + VariableNameSize - Size of the variable name + + VariableName - The variable name + + VendorGuid - The vendor's GUID + +Returns: + + EFI_SUCCESS - The interface could be successfully installed + + EFI_NOT_FOUND - The variable could not be discovered + +--*/ +{ + EFI_STATUS Status; + EFI_PEI_READ_ONLY_VARIABLE_PPI *ReadOnlyVariable; + + Status = PeiServicesLocatePpi ( + &gEfiPeiReadOnlyVariablePpiGuid, + 0, + NULL, + (VOID **)&ReadOnlyVariable + ); + ASSERT_EFI_ERROR (Status); + + return ReadOnlyVariable->PeiGetNextVariableName ( + GetPeiServicesTablePointer (), + VariableNameSize, + VariableName, + VariableGuid + ); +} diff --git a/EdkCompatibilityPkg/Compatibility/ReadOnlyVariable2ToReadOnlyVariableThunk/ReadOnlyVariable2ToReadOnlyVariableThunk.inf b/EdkCompatibilityPkg/Compatibility/ReadOnlyVariable2ToReadOnlyVariableThunk/ReadOnlyVariable2ToReadOnlyVariableThunk.inf new file mode 100644 index 0000000..c9b08f1 --- /dev/null +++ b/EdkCompatibilityPkg/Compatibility/ReadOnlyVariable2ToReadOnlyVariableThunk/ReadOnlyVariable2ToReadOnlyVariableThunk.inf @@ -0,0 +1,52 @@ +#/** @file +# Component description file for PeiVariable module. +# +# PEIM to provide the Variable functionality. +# Copyright (c) 2006 - 2007, 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 = ReadOnlyVariable2ToReadOnlyVariableThunk + FILE_GUID = 950216A2-A621-479c-A13D-2990617BDFE7 + MODULE_TYPE = PEIM + VERSION_STRING = 1.0 + EDK_RELEASE_VERSION = 0x00020000 + EFI_SPECIFICATION_VERSION = 0x00020000 + + ENTRY_POINT = PeimInitializeReadOnlyVariable2 + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# + +[Sources.common] + ReadOnlyVariable2ToReadOnlyVariableThunk.c + +[Packages] + MdePkg/MdePkg.dec + IntelFrameworkPkg/IntelFrameworkPkg.dec + +[LibraryClasses] + PeimEntryPoint + PeiServicesLib + PeiServicesTablePointerLib + DebugLib + +[Ppis] + gEfiPeiReadOnlyVariablePpiGuid # PPI ALWAYS_CONSUMED + gEfiPeiReadOnlyVariable2PpiGuid # PPI ALWAYS_PRODUCED + +[Depex] + gEfiPeiReadOnlyVariablePpiGuid diff --git a/EdkCompatibilityPkg/Compatibility/ReadOnlyVariableToReadOnlyVariable2Thunk/ReadOnlyVariableToReadOnlyVariable2Thunk.c b/EdkCompatibilityPkg/Compatibility/ReadOnlyVariableToReadOnlyVariable2Thunk/ReadOnlyVariableToReadOnlyVariable2Thunk.c new file mode 100644 index 0000000..8da77e1 --- /dev/null +++ b/EdkCompatibilityPkg/Compatibility/ReadOnlyVariableToReadOnlyVariable2Thunk/ReadOnlyVariableToReadOnlyVariable2Thunk.c @@ -0,0 +1,208 @@ +/*++ + +Copyright (c) 2006 - 2008 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: + + Variable.c + +Abstract: + + PEIM to provide the Variable functionality + +--*/ + +#include +#include +#include +#include + +// +// Function Prototypes +// +EFI_STATUS +EFIAPI +PeiGetVariable ( + IN EFI_PEI_SERVICES **PeiServices, + IN CHAR16 *VariableName, + IN EFI_GUID *VendorGuid, + OUT UINT32 *Attributes OPTIONAL, + IN OUT UINTN *DataSize, + OUT VOID *Data + ); + +EFI_STATUS +EFIAPI +PeiGetNextVariableName ( + IN EFI_PEI_SERVICES **PeiServices, + IN OUT UINTN *VariableNameSize, + IN OUT CHAR16 *VariableName, + IN OUT EFI_GUID *VendorGuid + ); + +// +// Module globals +// +EFI_PEI_READ_ONLY_VARIABLE_PPI mVariablePpi = { + PeiGetVariable, + PeiGetNextVariableName +}; + +EFI_PEI_PPI_DESCRIPTOR mPpiListVariable = { + (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), + &gEfiPeiReadOnlyVariablePpiGuid, + &mVariablePpi +}; + +EFI_STATUS +EFIAPI +PeimInitializeReadOnlyVariable ( + IN EFI_FFS_FILE_HEADER *FfsHeader, + IN CONST EFI_PEI_SERVICES **PeiServices + ) +/*++ + +Routine Description: + + Provide the functionality of the variable services. + +Arguments: + + FfsHeadher - The FFS file header + PeiServices - General purpose services available to every PEIM. + +Returns: + + Status - EFI_SUCCESS if the interface could be successfully + installed + +--*/ +{ + // + // Publish the variable capability to other modules + // + return (*PeiServices)->InstallPpi (PeiServices, &mPpiListVariable); +} + +EFI_STATUS +EFIAPI +PeiGetVariable ( + IN EFI_PEI_SERVICES **PeiServices, + IN CHAR16 *VariableName, + IN EFI_GUID *VendorGuid, + OUT UINT32 *Attributes OPTIONAL, + IN OUT UINTN *DataSize, + OUT VOID *Data + ) +/*++ + +Routine Description: + + Provide the read variable functionality of the variable services. + +Arguments: + + PeiServices - General purpose services available to every PEIM. + + VariableName - The variable name + + VendorGuid - The vendor's GUID + + Attributes - Pointer to the attribute + + DataSize - Size of data + + Data - Pointer to data + +Returns: + + EFI_SUCCESS - The interface could be successfully installed + + EFI_NOT_FOUND - The variable could not be discovered + + EFI_BUFFER_TOO_SMALL - The caller buffer is not large enough + +--*/ +{ + EFI_STATUS Status; + EFI_PEI_READ_ONLY_VARIABLE2_PPI *ReadOnlyVariable2; + + Status = (*PeiServices)->LocatePpi ( + (CONST EFI_PEI_SERVICES **)PeiServices, + &gEfiPeiReadOnlyVariable2PpiGuid, + 0, + NULL, + (VOID **)&ReadOnlyVariable2 + ); + ASSERT_EFI_ERROR (Status); + + return ReadOnlyVariable2->GetVariable ( + ReadOnlyVariable2, + VariableName, + VendorGuid, + Attributes, + DataSize, + Data + ); +} + +EFI_STATUS +EFIAPI +PeiGetNextVariableName ( + IN EFI_PEI_SERVICES **PeiServices, + IN OUT UINTN *VariableNameSize, + IN OUT CHAR16 *VariableName, + IN OUT EFI_GUID *VendorGuid + ) +/*++ + +Routine Description: + + Provide the get next variable functionality of the variable services. + +Arguments: + + PeiServices - General purpose services available to every PEIM. + VariabvleNameSize - The variable name's size. + VariableName - A pointer to the variable's name. + VariableGuid - A pointer to the EFI_GUID structure. + + VariableNameSize - Size of the variable name + + VariableName - The variable name + + VendorGuid - The vendor's GUID + +Returns: + + EFI_SUCCESS - The interface could be successfully installed + + EFI_NOT_FOUND - The variable could not be discovered + +--*/ +{ + EFI_STATUS Status; + EFI_PEI_READ_ONLY_VARIABLE2_PPI *ReadOnlyVariable2; + + Status = (*PeiServices)->LocatePpi ( + (CONST EFI_PEI_SERVICES **)PeiServices, + &gEfiPeiReadOnlyVariable2PpiGuid, + 0, + NULL, + (VOID **)&ReadOnlyVariable2 + ); + ASSERT_EFI_ERROR (Status); + + return ReadOnlyVariable2->NextVariableName ( + ReadOnlyVariable2, + VariableNameSize, + VariableName, + VendorGuid + ); +} diff --git a/EdkCompatibilityPkg/Compatibility/ReadOnlyVariableToReadOnlyVariable2Thunk/ReadOnlyVariableToReadOnlyVariable2Thunk.inf b/EdkCompatibilityPkg/Compatibility/ReadOnlyVariableToReadOnlyVariable2Thunk/ReadOnlyVariableToReadOnlyVariable2Thunk.inf new file mode 100644 index 0000000..3142eed --- /dev/null +++ b/EdkCompatibilityPkg/Compatibility/ReadOnlyVariableToReadOnlyVariable2Thunk/ReadOnlyVariableToReadOnlyVariable2Thunk.inf @@ -0,0 +1,52 @@ +#/** @file +# Component description file for PeiVariable module. +# +# PEIM to provide the Variable functionality. +# Copyright (c) 2006 - 2007, 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 = ReadOnlyVariableToReadOnlyVariable2Thunk + FILE_GUID = 0FDB764B-E669-4c69-83AC-5EDD99A2711E + MODULE_TYPE = PEIM + VERSION_STRING = 1.0 + EDK_RELEASE_VERSION = 0x00020000 + EFI_SPECIFICATION_VERSION = 0x00020000 + + ENTRY_POINT = PeimInitializeReadOnlyVariable + +# +# The following information is for reference only and not required by the build tools. +# +# VALID_ARCHITECTURES = IA32 X64 IPF EBC +# + +[Sources.common] + ReadOnlyVariableToReadOnlyVariable2Thunk.c + +[Packages] + MdePkg/MdePkg.dec + IntelFrameworkPkg/IntelFrameworkPkg.dec + +[LibraryClasses] + PeimEntryPoint +# PeiServicesLib +# PeiServicesTablePointerLib + DebugLib + +[Ppis] + gEfiPeiReadOnlyVariable2PpiGuid # PPI ALWAYS_CONSUMED + gEfiPeiReadOnlyVariablePpiGuid # PPI ALWAYS_PRODUCED + +[Depex] + gEfiPeiReadOnlyVariable2PpiGuid -- cgit v1.1