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