Fix a type in the directory name. Compatiblity -> Compatibility.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4994 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qwang12 2008-04-03 10:36:52 +00:00
parent a8bf2e5a3c
commit 4259256b48
22 changed files with 4975 additions and 0 deletions

View File

@ -0,0 +1,68 @@
/**@file
This file contains the Glyph related function.
Copyright (c) 2006 - 2008, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "HiiDatabase.h"
EFI_STATUS
EFIAPI
HiiGetGlyph (
IN EFI_HII_PROTOCOL *This,
IN CHAR16 *Source,
IN OUT UINT16 *Index,
OUT UINT8 **GlyphBuffer,
OUT UINT16 *BitWidth,
IN OUT UINT32 *InternalStatus
)
/*++
Routine Description:
Translates a Unicode character into the corresponding font glyph.
If the Source was pointing to a non-spacing character, the next Source[*Index]
character will be parsed and OR'd to the GlyphBuffer until a spacing character
is found in the Source. Since non-spacing characters are considered to be the
same pixel width as a regular character their BitWidth will be reflected correctly
however due to their special attribute, they are considered to be zero advancing width.
This basically means that the cursor would not advance, thus the character that follows
it would overlay the non-spacing character. The Index is modified to reflect both the
incoming array entry into the Source string but also the outgoing array entry after having
parsed the equivalent of a single Glyph's worth of data.
Arguments:
Returns:
--*/
{
ASSERT (FALSE);
return EFI_SUCCESS;
}
EFI_STATUS
EFIAPI
HiiGlyphToBlt (
IN EFI_HII_PROTOCOL *This,
IN UINT8 *GlyphBuffer,
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground,
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background,
IN UINTN Count,
IN UINTN Width,
IN UINTN Height,
IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer
)
{
ASSERT (FALSE);
return EFI_SUCCESS;
}

View File

@ -0,0 +1,154 @@
/**@file
This file contains the form processing code to the HII database.
Copyright (c) 2006 - 2008 Intel Corporation. <BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "HiiDatabase.h"
EFI_STATUS
EFIAPI
HiiExportDatabase (
IN EFI_HII_PROTOCOL *This,
IN FRAMEWORK_EFI_HII_HANDLE Handle,
IN OUT UINTN *BufferSize,
OUT VOID *Buffer
)
/*++
Routine Description:
This function allows a program to extract a form or form package that has
previously been registered with the EFI HII database.
Arguments:
Returns:
--*/
{
ASSERT (FALSE);
return EFI_UNSUPPORTED;
}
EFI_STATUS
EFIAPI
HiiGetForms (
IN EFI_HII_PROTOCOL *This,
IN FRAMEWORK_EFI_HII_HANDLE Handle,
IN EFI_FORM_ID FormId,
IN OUT UINTN *BufferLengthTemp,
OUT UINT8 *Buffer
)
/*++
Routine Description:
This function allows a program to extract a form or form package that has
previously been registered with the EFI HII database.
Arguments:
This - A pointer to the EFI_HII_PROTOCOL instance.
Handle - Handle on which the form resides. Type FRAMEWORK_EFI_HII_HANDLE is defined in
EFI_HII_PROTOCOL.NewPack() in the Packages section.
FormId - The ID of the form to return. If the ID is zero, the entire form package is returned.
Type EFI_FORM_ID is defined in "Related Definitions" below.
BufferLength - On input, the length of the Buffer. On output, the length of the returned buffer, if
the length was sufficient and, if it was not, the length that is required to fit the
requested form(s).
Buffer - The buffer designed to receive the form(s).
Returns:
EFI_SUCCESS - Buffer filled with the requested forms. BufferLength
was updated.
EFI_INVALID_PARAMETER - The handle is unknown.
EFI_NOT_FOUND - A form on the requested handle cannot be found with the
requested FormId.
EFI_BUFFER_TOO_SMALL - The buffer provided was not large enough to allow the form to be stored.
--*/
{
ASSERT (FALSE);
return EFI_UNSUPPORTED;
}
EFI_STATUS
EFIAPI
HiiGetDefaultImage (
IN EFI_HII_PROTOCOL *This,
IN FRAMEWORK_EFI_HII_HANDLE Handle,
IN UINTN DefaultMask,
OUT EFI_HII_VARIABLE_PACK_LIST **VariablePackList
)
/*++
Routine Description:
This function allows a program to extract the NV Image
that represents the default storage image
Arguments:
This - A pointer to the EFI_HII_PROTOCOL instance.
Handle - The HII handle from which will have default data retrieved.
UINTN - Mask used to retrieve the default image.
VariablePackList - Callee allocated, tightly-packed, link list data
structure that contain all default varaible packs
from the Hii Database.
Returns:
EFI_NOT_FOUND - If Hii database does not contain any default images.
EFI_INVALID_PARAMETER - Invalid input parameter.
EFI_SUCCESS - Operation successful.
--*/
{
return EFI_SUCCESS;
}
EFI_STATUS
EFIAPI
HiiUpdateForm (
IN EFI_HII_PROTOCOL *This,
IN FRAMEWORK_EFI_HII_HANDLE Handle,
IN EFI_FORM_LABEL Label,
IN BOOLEAN AddData,
IN EFI_HII_UPDATE_DATA *Data
)
/*++
Routine Description:
This function allows the caller to update a form that has
previously been registered with the EFI HII database.
Arguments:
Handle - Hii Handle associated with the Formset to modify
Label - Update information starting immediately after this label in the IFR
AddData - If TRUE, add data. If FALSE, remove data
Data - If adding data, this is the pointer to the data to add
Returns:
EFI_SUCCESS - Update success.
Other - Update fail.
--*/
{
return EFI_SUCCESS;
}

View File

@ -0,0 +1,75 @@
#/** @file
# Component description file for HiiDatabase module which produce a Framework HII instance
# based on the avaliable UEFI HII protocol found in the platform.
#
# This module inits HII database and installs HII protocol based on the avaliable UEFI HII protocol found in the platform..
# Copyright (c) 2006 - 2008, Intel Corporation
#
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
#
#**/
[Defines]
INF_VERSION = 0x00010005
BASE_NAME = FrameworkHiiToUefiHiiThunk
FILE_GUID = AC3435BB-B1D3-4EF8-957C-8048606FF671
MODULE_TYPE = DXE_DRIVER
VERSION_STRING = 1.0
EDK_RELEASE_VERSION = 0x00020000
EFI_SPECIFICATION_VERSION = 0x00020000
ENTRY_POINT = InitializeHiiDatabase
#
# The following information is for reference only and not required by the build tools.
#
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
#
[Sources.common]
Keyboard.c
Fonts.c
Package.c
Strings.c
Forms.c
HiiDatabase.h
HiiDatabase.c
Utility.c
Utility.h
[Packages]
MdePkg/MdePkg.dec
IntelFrameworkPkg/IntelFrameworkPkg.dec
[LibraryClasses]
UefiRuntimeServicesTableLib
UefiBootServicesTableLib
BaseMemoryLib
MemoryAllocationLib
UefiDriverEntryPoint
DebugLib
BaseLib
HiiLib
[Protocols]
gEfiHiiProtocolGuid
gEfiHiiImageProtocolGuid
gEfiHiiDatabaseProtocolGuid
gEfiHiiStringProtocolGuid
gEfiHiiFontProtocolGuid
[Depex]
gEfiHiiImageProtocolGuid AND
gEfiHiiDatabaseProtocolGuid AND
gEfiHiiStringProtocolGuid AND
gEfiHiiFontProtocolGuid

View File

@ -0,0 +1,207 @@
/**@file
Framework to UEFI 2.1 HII Thunk
Copyright (c) 2003, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "HiiDatabase.h"
EFI_HII_THUNK_PRIVATE_DATA HiiThunkPrivateDataTempate = {
{//Signature
EFI_HII_THUNK_DRIVER_DATA_SIGNATURE
},
{//Handle
(EFI_HANDLE) NULL
},
{ //Hii
HiiNewPack,
HiiRemovePack,
HiiFindHandles,
HiiExportDatabase,
HiiTestString,
HiiGetGlyph,
HiiGlyphToBlt,
HiiNewString,
HiiGetPrimaryLanguages,
HiiGetSecondaryLanguages,
HiiGetString,
HiiResetStrings,
HiiGetLine,
HiiGetForms,
HiiGetDefaultImage,
HiiUpdateForm,
HiiGetKeyboardLayout
},
{ //StaticHiiHandle
//The FRAMEWORK_EFI_HII_HANDLE starts from 1
// and increase upwords untill reach 2^(sizeof (FRAMEWORK_EFI_HII_HANDLE)) - 1.
// The code will assert to prevent overflow.
(FRAMEWORK_EFI_HII_HANDLE) 1
},
{
NULL, NULL //HiiHandleLinkList
},
};
EFI_HII_DATABASE_PROTOCOL *mUefiHiiDatabaseProtocol;
EFI_HII_FONT_PROTOCOL *mUefiHiiFontProtocol;
EFI_HII_IMAGE_PROTOCOL *mUefiHiiImageProtocol;
EFI_HII_STRING_PROTOCOL *mUefiStringProtocol;
EFI_STATUS
EFIAPI
InitializeHiiDatabase (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
/*++
Routine Description:
Initialize HII Database
Arguments:
(Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)
Returns:
EFI_SUCCESS - Setup loaded.
other - Setup Error
--*/
{
EFI_HII_THUNK_PRIVATE_DATA *HiiData;
EFI_HANDLE Handle;
EFI_STATUS Status;
ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiHiiProtocolGuid);
HiiData = AllocateCopyPool (sizeof (EFI_HII_THUNK_PRIVATE_DATA), &HiiThunkPrivateDataTempate);
ASSERT (HiiData != NULL);
InitializeListHead (&HiiData->HiiThunkHandleMappingDBListHead);
Status = gBS->LocateProtocol (
&gEfiHiiDatabaseProtocolGuid,
NULL,
(VOID **) &mUefiHiiDatabaseProtocol
);
ASSERT_EFI_ERROR (Status);
Status = gBS->LocateProtocol (
&gEfiHiiFontProtocolGuid,
NULL,
(VOID **) &mUefiHiiFontProtocol
);
ASSERT_EFI_ERROR (Status);
Status = gBS->LocateProtocol (
&gEfiHiiImageProtocolGuid,
NULL,
(VOID **) &mUefiHiiImageProtocol
);
ASSERT_EFI_ERROR (Status);
Status = gBS->LocateProtocol (
&gEfiHiiStringProtocolGuid,
NULL,
(VOID **) &mUefiStringProtocol
);
ASSERT_EFI_ERROR (Status);
//
// Install protocol interface
//
Handle = NULL;
Status = gBS->InstallProtocolInterface (
&HiiData->Handle,
&gEfiHiiProtocolGuid,
EFI_NATIVE_INTERFACE,
(VOID *) &HiiData->Hii
);
ASSERT_EFI_ERROR (Status);
return Status;
}
EFI_STATUS
EFIAPI
HiiFindHandles (
IN EFI_HII_PROTOCOL *This,
IN OUT UINT16 *HandleBufferLength,
OUT FRAMEWORK_EFI_HII_HANDLE Handle[1]
)
/*++
Routine Description:
Determines the handles that are currently active in the database.
Arguments:
Returns:
--*/
{
ASSERT (FALSE);
return EFI_SUCCESS;
}
EFI_STATUS
EFIAPI
HiiGetPrimaryLanguages (
IN EFI_HII_PROTOCOL *This,
IN FRAMEWORK_EFI_HII_HANDLE Handle,
OUT EFI_STRING *LanguageString
)
/*++
Routine Description:
This function allows a program to determine what the primary languages that are supported on a given handle.
Arguments:
Returns:
--*/
{
ASSERT (FALSE);
return EFI_SUCCESS;
}
EFI_STATUS
EFIAPI
HiiGetSecondaryLanguages (
IN EFI_HII_PROTOCOL *This,
IN FRAMEWORK_EFI_HII_HANDLE Handle,
IN CHAR16 *PrimaryLanguage,
OUT EFI_STRING *LanguageString
)
/*++
Routine Description:
This function allows a program to determine which secondary languages are supported
on a given handle for a given primary language.
Arguments:
Returns:
--*/
{
ASSERT (FALSE);
return EFI_SUCCESS;
}

View File

@ -0,0 +1,322 @@
/**@file
This file contains global defines and prototype definitions
for the HII database.
Copyright (c) 2006 - 2008, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef _HIIDATABASE_H
#define _HIIDATABASE_H
#include <FrameworkDxe.h>
#include <Guid/GlobalVariable.h>
#include <Protocol/FrameworkFormCallback.h>
#include <Protocol/FrameworkHii.h>
//
// UEFI HII Protocols
//
#include <Protocol/HiiFont.h>
#include <Protocol/HiiImage.h>
#include <Protocol/HiiString.h>
#include <Protocol/HiiDatabase.h>
#include <Protocol/HiiConfigRouting.h>
#include <Protocol/HiiConfigAccess.h>
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
#include <Library/UefiDriverEntryPoint.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/FrameworkIfrSupportLib.h>
#include <Library/HiiLib.h>
#include "Utility.h"
//
// Macros
//
//
// Typedef
//
typedef struct {
UINT32 BinaryLength;
EFI_HII_PACKAGE_HEADER PackageHeader;
} TIANO_AUTOGEN_PACKAGES_HEADER;
#define EFI_HII_THUNK_PRIVATE_DATA_FROM_THIS(Record) CR(Record, EFI_HII_THUNK_PRIVATE_DATA, Hii, EFI_HII_THUNK_DRIVER_DATA_SIGNATURE)
#define EFI_HII_THUNK_DRIVER_DATA_SIGNATURE EFI_SIGNATURE_32 ('H', 'i', 'I', 'T')
typedef struct {
UINTN Signature;
EFI_HANDLE Handle;
EFI_HII_PROTOCOL Hii;
FRAMEWORK_EFI_HII_HANDLE StaticHiiHandle;
//
// This LIST_ENTRY is the list head which has HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY type
// as list entry.
//
LIST_ENTRY HiiThunkHandleMappingDBListHead;
} EFI_HII_THUNK_PRIVATE_DATA;
#define HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY_FROM_LISTENTRY(Record) CR(Record, HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY, List, HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY_SIGNATURE)
#define HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY_SIGNATURE EFI_SIGNATURE_32 ('H', 'T', 'H', 'M')
typedef struct {
LIST_ENTRY List;
UINT32 Signature;
FRAMEWORK_EFI_HII_HANDLE FrameworkHiiHandle;
EFI_HII_HANDLE UefiHiiHandle;
BOOLEAN IsPackageListWithOnlyStringPackages;
//
// The field below is only valid if IsPackageListWithOnlyStringPack is TRUE.
// The HII 0.92 version of HII data implementation in EDK 1.03 and 1.04 make an the following assumption
// in both HII Database implementation and all modules that registering packages:
// If a Package List has only IFR package and no String Package, the String Package containing the strings
// referenced by this IFR package is in another Package List
// registered with the HII database with the same EFI_HII_PACKAGES.GuidId.
//
//
// Only valid if IsPackageListWithSingleStringPack is TRUE.
// UEFI Package List Head Pointer, pointing to a allocated buffer containing the package
//
EFI_HII_PACKAGE_LIST_HEADER *UefiStringPackageListHeader; //Only valid if IsStringPack is TRUE.
//This UEFI Package list only consists of a list of string packages.
EFI_GUID TagGuid;
//
// TRUE if the package list identified by UefiHiiHandle imports String Packages from
// other package list with IsPackageListWithOnlyStringPackages is TRUE.
//
BOOLEAN DoesPackageListImportStringPackages;
EFI_HII_PACKAGE_LIST_HEADER *ImportedUefiStringPackageListHeader; //Only valid if DoesPackageListImportStringPackages is true.
} HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY;
//
// Extern Variables
//
extern EFI_HII_DATABASE_PROTOCOL *mUefiHiiDatabaseProtocol;
extern EFI_HII_FONT_PROTOCOL *mUefiHiiFontProtocol;
extern EFI_HII_IMAGE_PROTOCOL *mUefiHiiImageProtocol;
extern EFI_HII_STRING_PROTOCOL *mUefiStringProtocol;
//
// Prototypes
//
//
// Public Interface Prototypes
//
EFI_STATUS
EFIAPI
InitializeHiiDatabase (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
;
EFI_STATUS
EFIAPI
HiiNewPack (
IN EFI_HII_PROTOCOL *This,
IN EFI_HII_PACKAGES *PackageList,
OUT FRAMEWORK_EFI_HII_HANDLE *Handle
)
;
EFI_STATUS
EFIAPI
HiiRemovePack (
IN EFI_HII_PROTOCOL *This,
IN FRAMEWORK_EFI_HII_HANDLE Handle
)
;
EFI_STATUS
EFIAPI
HiiFindHandles (
IN EFI_HII_PROTOCOL *This,
IN OUT UINT16 *HandleBufferLength,
OUT FRAMEWORK_EFI_HII_HANDLE *Handle
)
;
EFI_STATUS
EFIAPI
HiiExportDatabase (
IN EFI_HII_PROTOCOL *This,
IN FRAMEWORK_EFI_HII_HANDLE Handle,
IN OUT UINTN *BufferSize,
OUT VOID *Buffer
)
;
EFI_STATUS
EFIAPI
HiiGetGlyph (
IN EFI_HII_PROTOCOL *This,
IN CHAR16 *Source,
IN OUT UINT16 *Index,
OUT UINT8 **GlyphBuffer,
OUT UINT16 *BitWidth,
IN OUT UINT32 *InternalStatus
)
;
EFI_STATUS
EFIAPI
HiiGlyphToBlt (
IN EFI_HII_PROTOCOL *This,
IN UINT8 *GlyphBuffer,
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL Foreground,
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background,
IN UINTN Count,
IN UINTN Width,
IN UINTN Height,
IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer
)
;
EFI_STATUS
EFIAPI
HiiNewString (
IN EFI_HII_PROTOCOL *This,
IN CHAR16 *Language,
IN FRAMEWORK_EFI_HII_HANDLE Handle,
IN OUT STRING_REF *Reference,
IN CHAR16 *NewString
)
;
EFI_STATUS
EFIAPI
HiiGetString (
IN EFI_HII_PROTOCOL *This,
IN FRAMEWORK_EFI_HII_HANDLE Handle,
IN STRING_REF Token,
IN BOOLEAN Raw,
IN CHAR16 *LanguageString,
IN OUT UINTN *BufferLength,
OUT EFI_STRING StringBuffer
)
;
EFI_STATUS
EFIAPI
HiiResetStrings (
IN EFI_HII_PROTOCOL *This,
IN FRAMEWORK_EFI_HII_HANDLE Handle
)
;
EFI_STATUS
EFIAPI
HiiTestString (
IN EFI_HII_PROTOCOL *This,
IN CHAR16 *StringToTest,
IN OUT UINT32 *FirstMissing,
OUT UINT32 *GlyphBufferSize
)
;
EFI_STATUS
EFIAPI
HiiGetPrimaryLanguages (
IN EFI_HII_PROTOCOL *This,
IN FRAMEWORK_EFI_HII_HANDLE Handle,
OUT EFI_STRING *LanguageString
)
;
EFI_STATUS
EFIAPI
HiiGetSecondaryLanguages (
IN EFI_HII_PROTOCOL *This,
IN FRAMEWORK_EFI_HII_HANDLE Handle,
IN CHAR16 *PrimaryLanguage,
OUT EFI_STRING *LanguageString
)
;
EFI_STATUS
EFIAPI
HiiGetLine (
IN EFI_HII_PROTOCOL *This,
IN FRAMEWORK_EFI_HII_HANDLE Handle,
IN STRING_REF Token,
IN OUT UINT16 *Index,
IN UINT16 LineWidth,
IN CHAR16 *LanguageString,
IN OUT UINT16 *BufferLength,
OUT EFI_STRING StringBuffer
)
;
EFI_STATUS
EFIAPI
HiiGetForms (
IN EFI_HII_PROTOCOL *This,
IN FRAMEWORK_EFI_HII_HANDLE Handle,
IN EFI_FORM_ID FormId,
IN OUT UINTN *BufferLength,
OUT UINT8 *Buffer
)
;
EFI_STATUS
EFIAPI
HiiGetDefaultImage (
IN EFI_HII_PROTOCOL *This,
IN FRAMEWORK_EFI_HII_HANDLE Handle,
IN UINTN DefaultMask,
OUT EFI_HII_VARIABLE_PACK_LIST **VariablePackList
)
;
EFI_STATUS
EFIAPI
HiiUpdateForm (
IN EFI_HII_PROTOCOL *This,
IN FRAMEWORK_EFI_HII_HANDLE Handle,
IN EFI_FORM_LABEL Label,
IN BOOLEAN AddData,
IN EFI_HII_UPDATE_DATA *Data
)
;
EFI_STATUS
EFIAPI
HiiGetKeyboardLayout (
IN EFI_HII_PROTOCOL *This,
OUT UINT16 *DescriptorCount,
OUT FRAMEWORK_EFI_KEY_DESCRIPTOR *Descriptor
)
;
EFI_STATUS
HiiCompareLanguage (
IN CHAR16 *LanguageStringLocation,
IN CHAR16 *Language
)
;
#endif

View File

@ -0,0 +1,37 @@
/**@file
This file contains the keyboard processing code to the HII database.
Copyright (c) 2006 - 2008, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "HiiDatabase.h"
EFI_STATUS
EFIAPI
HiiGetKeyboardLayout (
IN EFI_HII_PROTOCOL *This,
OUT UINT16 *DescriptorCount,
OUT FRAMEWORK_EFI_KEY_DESCRIPTOR *Descriptor
)
/*++
Routine Description:
Arguments:
Returns:
--*/
{
return EFI_SUCCESS;
}

View File

@ -0,0 +1,518 @@
/**@file
This file contains the keyboard processing code to the HII database.
Copyright (c) 2006 - 2008, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "HiiDatabase.h"
EFI_STATUS
GetIfrAndStringPackNum (
IN CONST EFI_HII_PACKAGES *Packages,
UINTN *IfrPackNum,
UINTN *StringPackNum
)
{
UINTN Index;
TIANO_AUTOGEN_PACKAGES_HEADER **TianoAutogenPackageHdrArray;
ASSERT (Packages != NULL);
ASSERT (IfrPackNum != NULL);
ASSERT (StringPackNum != NULL);
*IfrPackNum = 0;
*StringPackNum = 0;
TianoAutogenPackageHdrArray = (TIANO_AUTOGEN_PACKAGES_HEADER **) (((UINT8 *) &Packages->GuidId) + sizeof (Packages->GuidId));
for (Index = 0; Index < Packages->NumberOfPackages; Index++) {
//
// BugBug: The current UEFI HII build tool generate a binary in the format defined in:
// TIANO_AUTOGEN_PACKAGES_HEADER. We assume that all packages generated in
// this binary is with same package type. So the returned IfrPackNum and StringPackNum
// may not be the exact number of valid package number in the binary generated
// by HII Build tool.
//
switch (TianoAutogenPackageHdrArray[Index]->PackageHeader.Type) {
case EFI_HII_PACKAGE_FORM:
*IfrPackNum += 1;
break;
case EFI_HII_PACKAGE_STRINGS:
*StringPackNum += 1;
break;
case EFI_HII_PACKAGE_SIMPLE_FONTS:
break;
//
// The following fonts are invalid for a module that using Framework to UEFI thunk layer.
//
case EFI_HII_PACKAGE_KEYBOARD_LAYOUT:
case EFI_HII_PACKAGE_FONTS:
case EFI_HII_PACKAGE_IMAGES:
default:
ASSERT (FALSE);
return EFI_INVALID_PARAMETER;
break;
}
}
return EFI_SUCCESS;
}
EFI_STATUS
LibExportPackageLists (
IN EFI_HII_HANDLE UefiHiiHandle,
OUT EFI_HII_PACKAGE_LIST_HEADER **PackageListHeader,
OUT UINTN *PackageListSize
)
{
EFI_STATUS Status;
UINTN Size;
EFI_HII_PACKAGE_LIST_HEADER *PackageListHdr;
ASSERT (PackageListSize != NULL);
ASSERT (PackageListHeader != NULL);
Size = 0;
PackageListHdr = NULL;
Status = mUefiHiiDatabaseProtocol->ExportPackageLists (
mUefiHiiDatabaseProtocol,
UefiHiiHandle,
&Size,
PackageListHdr
);
ASSERT_EFI_ERROR (Status == EFI_BUFFER_TOO_SMALL);
if (Status == EFI_BUFFER_TOO_SMALL) {
PackageListHdr = AllocateZeroPool (Size);
ASSERT (PackageListHdr != NULL);
if (PackageListHeader == NULL) {
return EFI_OUT_OF_RESOURCES;
} else {
Status = mUefiHiiDatabaseProtocol->ExportPackageLists (
mUefiHiiDatabaseProtocol,
UefiHiiHandle,
&Size,
PackageListHdr
);
ASSERT_EFI_ERROR (Status);
}
}
if (!EFI_ERROR (Status)) {
*PackageListHeader = PackageListHdr;
*PackageListSize = Size;
}
return Status;
}
BOOLEAN
IsOnlyStringPackagesInPackageList (
IN CONST EFI_HII_PACKAGE_LIST_HEADER *StringPackageListHeader
)
{
EFI_HII_PACKAGE_HEADER *PackageHeader;
PackageHeader = (EFI_HII_PACKAGE_HEADER *) (StringPackageListHeader + 1);
while (PackageHeader->Type != EFI_HII_PACKAGE_END) {
PackageHeader = (EFI_HII_PACKAGE_HEADER *) (PackageHeader );
}
}
EFI_STATUS
InsertStringPackagesToIfrPackageList (
IN CONST EFI_HII_PACKAGE_LIST_HEADER *StringPackageListHeader,
IN EFI_HII_HANDLE UefiHiiHandle
)
{
EFI_STATUS Status;
Status = mUefiHiiDatabaseProtocol->UpdatePackageList (
mUefiHiiDatabaseProtocol,
UefiHiiHandle,
StringPackageListHeader
);
return Status;
}
/**
Removes a node from a doubly linked list, and returns the node that follows
the removed node.
Removes the node Entry from a doubly linked list. It is up to the caller of
this function to release the memory used by this node if that is required. On
exit, the node following Entry in the doubly linked list is returned. If
Entry is the only node in the linked list, then the head node of the linked
list is returned.
If Entry is NULL, then ASSERT().
If Entry is the head node of an empty list, then ASSERT().
If PcdMaximumLinkedListLength is not zero, and the number of nodes in the
linked list containing Entry, including the Entry node, is greater than
or equal to PcdMaximumLinkedListLength, then ASSERT().
@param Entry A pointer to a node in a linked list
@return Entry
**/
EFI_STATUS
AddStringPackagesToMatchingIfrPackageList (
IN EFI_HII_THUNK_PRIVATE_DATA *Private,
IN CONST EFI_HII_PACKAGE_LIST_HEADER *StringPackageListHeader
)
{
EFI_STATUS Status;
LIST_ENTRY *ListEntry;
HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY *HandleMapEntry;
for (ListEntry = Private->HiiThunkHandleMappingDBListHead.ForwardLink;
ListEntry != &Private->HiiThunkHandleMappingDBListHead;
ListEntry = ListEntry->ForwardLink
) {
HandleMapEntry = HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY_FROM_LISTENTRY (ListEntry);
if (CompareGuid (&StringPackageListHeader->PackageListGuid, &HandleMapEntry->TagGuid)) {
Status = InsertStringPackagesToIfrPackageList (StringPackageListHeader, HandleMapEntry->UefiHiiHandle);
}
}
return EFI_NOT_FOUND;
}
EFI_HII_PACKAGE_LIST_HEADER *
PrepareUefiPackageListFromFrameworkHiiPackages (
IN CONST EFI_HII_PACKAGES *Packages,
IN CONST EFI_GUID *GuidId OPTIONAL
)
{
UINTN NumberOfPackages;
EFI_HII_PACKAGE_LIST_HEADER *PackageListHeader;
UINT8 *PackageListData;
UINT32 PackageListLength;
UINT32 PackageLength;
EFI_HII_PACKAGE_HEADER PackageHeader;
UINTN Index;
TIANO_AUTOGEN_PACKAGES_HEADER **TianoAutogenPackageHdrArray;
TianoAutogenPackageHdrArray = (TIANO_AUTOGEN_PACKAGES_HEADER **) ((UINT8 *) &Packages->GuidId + sizeof (Packages->GuidId));
NumberOfPackages = Packages->NumberOfPackages;
PackageListLength = sizeof (EFI_HII_PACKAGE_LIST_HEADER);
for (Index = 0; Index < NumberOfPackages; Index++) {
CopyMem (&PackageLength, &TianoAutogenPackageHdrArray[Index]->BinaryLength, sizeof (UINT32));
PackageListLength += PackageLength;
}
//
// Include the lenght of EFI_HII_PACKAGE_END
//
PackageListLength += sizeof (EFI_HII_PACKAGE_HEADER);
PackageListHeader = AllocateZeroPool (PackageListLength);
ASSERT (PackageListHeader != NULL);
if (GuidId == NULL) {
CopyMem (&PackageListHeader->PackageListGuid, Packages->GuidId, sizeof (EFI_GUID));
} else {
CopyMem (&PackageListHeader->PackageListGuid, GuidId, sizeof (EFI_GUID));
}
PackageListHeader->PackageLength = PackageListLength;
PackageListData = ((UINT8 *) PackageListHeader) + sizeof (EFI_HII_PACKAGE_LIST_HEADER);
for (Index = 0; Index < NumberOfPackages; Index++) {
CopyMem (&PackageLength, &(TianoAutogenPackageHdrArray[Index]->BinaryLength), sizeof (UINT32));
PackageLength -= sizeof (UINT32);
CopyMem (PackageListData, &(TianoAutogenPackageHdrArray[Index]->PackageHeader), PackageLength);
PackageListData += PackageLength;
}
//
// Append EFI_HII_PACKAGE_END
//
PackageHeader.Type = EFI_HII_PACKAGE_END;
PackageHeader.Length = sizeof (EFI_HII_PACKAGE_HEADER);
CopyMem (PackageListData, &PackageHeader, PackageHeader.Length);
return PackageListHeader;
}
EFI_GUID *
UefiGeneratePackageListGuidId (
IN CONST EFI_HII_PACKAGES * Packages
)
{
EFI_GUID *Guid;
UINT64 MonotonicCount;
Guid = AllocateCopyPool (sizeof (EFI_GUID), Packages->GuidId);
gBS->GetNextMonotonicCount (&MonotonicCount);
//
// Use Monotonic Count as a psedo random number generator.
//
*((UINT64 *) Guid) = *((UINT64 *) Guid) + MonotonicCount;
return Guid;
}
EFI_STATUS
FindAndAddStringPackageToIfrPackageList(
EFI_HII_THUNK_PRIVATE_DATA *Private,
EFI_GUID *GuidId,
EFI_HII_HANDLE UefiIfrHiiHandle
)
{
EFI_STATUS Status;
LIST_ENTRY *ListEntry;
HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY *HandleMapEntry;
EFI_HII_PACKAGE_LIST_HEADER *StringPackageListHeader;
UINTN Size;
for (ListEntry = Private->HiiThunkHandleMappingDBListHead.ForwardLink;
ListEntry != &Private->HiiThunkHandleMappingDBListHead;
ListEntry = ListEntry->ForwardLink
) {
HandleMapEntry = HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY_FROM_LISTENTRY (ListEntry);
if (CompareGuid (GuidId, &HandleMapEntry->TagGuid) && (!HandleMapEntry->DoesPackageListImportStringPackages)) {
Status = LibExportPackageLists (HandleMapEntry->UefiHiiHandle, &StringPackageListHeader, &Size);
ASSERT_EFI_ERROR (Status);
//
// Add Function to only get only String Packages from the Package List
//
Status = InsertStringPackagesToIfrPackageList (StringPackageListHeader, UefiIfrHiiHandle);
ASSERT_EFI_ERROR (Status);
FreePool (StringPackageListHeader);
return EFI_SUCCESS;
}
}
return EFI_NOT_FOUND;
}
EFI_STATUS
InstallDefaultUefiConfigAccessProtocol (
IN EFI_HII_PACKAGES *Packages,
OUT EFI_HANDLE *Handle
)
{
return EFI_SUCCESS;
}
EFI_STATUS
UefiRegisterPackageList(
EFI_HII_THUNK_PRIVATE_DATA *Private,
EFI_HII_PACKAGES *Packages,
FRAMEWORK_EFI_HII_HANDLE *Handle
)
{
EFI_STATUS Status;
UINTN StringPackNum;
UINTN IfrPackNum;
EFI_HII_PACKAGE_LIST_HEADER *UefiPackageListHeader;
HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY *HandleMappingEntry;
EFI_GUID *GuidId;
EFI_HANDLE UefiHiiDriverHandle;
GuidId = NULL;
UefiHiiDriverHandle = NULL;
Status = GetIfrAndStringPackNum (Packages, &IfrPackNum, &StringPackNum);
ASSERT_EFI_ERROR (Status);
HandleMappingEntry = AllocateZeroPool (sizeof (*HandleMappingEntry));
ASSERT (HandleMappingEntry != NULL);
HandleMappingEntry->Signature = HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY_SIGNATURE;
HandleMappingEntry->FrameworkHiiHandle = Private->StaticHiiHandle++;
CopyGuid (&HandleMappingEntry->TagGuid, Packages->GuidId);
if ((StringPackNum == 0) && (IfrPackNum != 0)) {
//
// UEFI HII database does not allow two package list with the same GUID.
// In Framework HII implementation, Packages->GuidId is used as an identifier to associate
// a PackageList with only IFR to a Package list the with String package.
//
GuidId = UefiGeneratePackageListGuidId (Packages);
}
//
// UEFI HII require EFI_HII_CONFIG_ACCESS_PROTOCOL to be installed on a EFI_HANDLE, so
// that Setup Utility will load the Buffer Storage
//
if (IfrPackNum != 0) {
InstallDefaultUefiConfigAccessProtocol (Packages, &UefiHiiDriverHandle);
}
UefiPackageListHeader = PrepareUefiPackageListFromFrameworkHiiPackages (Packages, GuidId);
Status = mUefiHiiDatabaseProtocol->NewPackageList (
mUefiHiiDatabaseProtocol,
UefiPackageListHeader,
UefiHiiDriverHandle,
&HandleMappingEntry->UefiHiiHandle
);
ASSERT_EFI_ERROR (Status);
if (EFI_ERROR (Status)) {
goto Done;
}
if (IfrPackNum == 0) {
if (StringPackNum != 0) {
//
// Look for a package list with IFR Pack which has already registed with HII Database
//
HandleMappingEntry->IsPackageListWithOnlyStringPackages = TRUE;
Status = AddStringPackagesToMatchingIfrPackageList (
Private,
UefiPackageListHeader
);
if (!EFI_ERROR (Status) || Status == EFI_NOT_FOUND) {
if (Status == EFI_NOT_FOUND) {
Status = EFI_SUCCESS;
}
}
}
} else {
if (StringPackNum == 0) {
//
// Register the Package List to UEFI HII first.
//
Status = FindAndAddStringPackageToIfrPackageList (
Private,
Packages->GuidId,
HandleMappingEntry->UefiHiiHandle
);
ASSERT_EFI_ERROR (Status);
if (!EFI_ERROR (Status)) {
HandleMappingEntry->DoesPackageListImportStringPackages = TRUE;
}
}
}
if (!EFI_ERROR (Status)) {
InsertTailList (&Private->HiiThunkHandleMappingDBListHead, &HandleMappingEntry->List);
}
Done:
if (EFI_ERROR (Status)) {
FreePool (HandleMappingEntry);
} else {
*Handle = HandleMappingEntry->FrameworkHiiHandle;
}
FreePool (UefiPackageListHeader);
SafeFreePool (GuidId);
return Status;
}
EFI_STATUS
EFIAPI
HiiNewPack (
IN EFI_HII_PROTOCOL *This,
IN EFI_HII_PACKAGES *Packages,
OUT FRAMEWORK_EFI_HII_HANDLE *Handle
)
/*++
Routine Description:
Extracts the various packs from a package list.
Arguments:
This - Pointer of HII protocol.
Packages - Pointer of HII packages.
Handle - Handle value to be returned.
Returns:
EFI_SUCCESS - Pacakges has added to HII database successfully.
EFI_INVALID_PARAMETER - Invalid parameter.
--*/
{
EFI_STATUS Status;
EFI_HII_THUNK_PRIVATE_DATA *Private;
if (Handle == NULL) {
return EFI_INVALID_PARAMETER;
}
if (Packages == NULL) {
return EFI_INVALID_PARAMETER;
}
Private = EFI_HII_THUNK_PRIVATE_DATA_FROM_THIS(This);
Status = UefiRegisterPackageList (
Private,
Packages,
Handle
);
return Status;
}
EFI_STATUS
EFIAPI
HiiRemovePack (
IN EFI_HII_PROTOCOL *This,
IN FRAMEWORK_EFI_HII_HANDLE Handle
)
/*++
Routine Description:
Removes the various packs from a Handle
Arguments:
Returns:
--*/
{
EFI_STATUS Status;
EFI_HII_THUNK_PRIVATE_DATA *Private;
LIST_ENTRY *ListEntry;
HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY *HandleMapEntry;
Private = EFI_HII_THUNK_PRIVATE_DATA_FROM_THIS(This);
for (ListEntry = Private->HiiThunkHandleMappingDBListHead.ForwardLink;
ListEntry != &Private->HiiThunkHandleMappingDBListHead;
ListEntry = ListEntry->ForwardLink
) {
HandleMapEntry = HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY_FROM_LISTENTRY (ListEntry);
if (Handle == HandleMapEntry->FrameworkHiiHandle) {
Status = mUefiHiiDatabaseProtocol->RemovePackageList (
mUefiHiiDatabaseProtocol,
HandleMapEntry->UefiHiiHandle
);
ASSERT_EFI_ERROR (Status);
RemoveEntryList (ListEntry);
return Status;
}
}
return EFI_NOT_FOUND;
}

View File

@ -0,0 +1,315 @@
/**@file
This file contains the keyboard processing code to the HII database.
Copyright (c) 2006 - 2008, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "HiiDatabase.h"
EFI_STATUS
EFIAPI
HiiTestString (
IN EFI_HII_PROTOCOL *This,
IN CHAR16 *StringToTest,
IN OUT UINT32 *FirstMissing,
OUT UINT32 *GlyphBufferSize
)
/*++
Routine Description:
Test if all of the characters in a string have corresponding font characters.
Arguments:
Returns:
--*/
{
ASSERT (FALSE);
return EFI_SUCCESS;
}
EFI_STATUS
GetTagGuidByFrameworkHiiHandle (
IN CONST EFI_HII_THUNK_PRIVATE_DATA *Private,
IN FRAMEWORK_EFI_HII_HANDLE FrameworkHiiHandle,
OUT EFI_GUID *TagGuid
)
{
LIST_ENTRY *ListEntry;
HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY *HandleMapEntry;
ASSERT (TagGuid != NULL);
for (ListEntry = Private->HiiThunkHandleMappingDBListHead.ForwardLink;
ListEntry != &Private->HiiThunkHandleMappingDBListHead;
ListEntry = ListEntry->ForwardLink
) {
HandleMapEntry = HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY_FROM_LISTENTRY (ListEntry);
if (FrameworkHiiHandle == HandleMapEntry->FrameworkHiiHandle) {
CopyGuid (TagGuid, &HandleMapEntry->TagGuid);
return EFI_SUCCESS;
}
}
return EFI_NOT_FOUND;
}
EFI_STATUS
HiiThunkNewStringForAllStringPackages (
IN CONST EFI_HII_THUNK_PRIVATE_DATA *Private,
OUT CONST EFI_GUID *TagGuid,
IN CHAR16 *Language,
IN OUT STRING_REF *Reference,
IN CHAR16 *NewString
)
{
EFI_STATUS Status;
LIST_ENTRY *ListEntry;
HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY *HandleMapEntry;
EFI_STRING_ID StringId1;
EFI_STRING_ID StringId2;
CHAR8 *UefiStringProtocolLanguage;
BOOLEAN Found;
ASSERT (TagGuid != NULL);
StringId1 = (EFI_STRING_ID) 0;
StringId2 = (EFI_STRING_ID) 0;
Found = FALSE;
//
// BugBug: We will handle the case that Language is not NULL later.
//
ASSERT (Language == NULL);
//if (Language == NULL) {
UefiStringProtocolLanguage = NULL;
//}
for (ListEntry = Private->HiiThunkHandleMappingDBListHead.ForwardLink;
ListEntry != &Private->HiiThunkHandleMappingDBListHead;
ListEntry = ListEntry->ForwardLink
) {
HandleMapEntry = HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY_FROM_LISTENTRY (ListEntry);
if (CompareGuid (TagGuid, &HandleMapEntry->TagGuid)) {
Found = TRUE;
if (*Reference == 0) {
Status = HiiLibNewString (HandleMapEntry->UefiHiiHandle, &StringId2, NewString);
} else {
Status = HiiLibSetString (HandleMapEntry->UefiHiiHandle, *Reference, NewString);
}
if (EFI_ERROR (Status)) {
return Status;
}
if (*Reference == 0) {
if (StringId1 == (EFI_STRING_ID) 0) {
StringId1 = StringId2;
} else {
if (StringId1 != StringId2) {
ASSERT(FALSE);
return EFI_INVALID_PARAMETER;
}
}
}
}
}
if (Found) {
*Reference = StringId1;
Status = EFI_SUCCESS;
} else {
Status = EFI_NOT_FOUND;
}
return Status;
}
EFI_STATUS
EFIAPI
HiiNewString (
IN EFI_HII_PROTOCOL *This,
IN CHAR16 *Language,
IN FRAMEWORK_EFI_HII_HANDLE Handle,
IN OUT STRING_REF *Reference,
IN CHAR16 *NewString
)
/*++
Routine Description:
This function allows a new String to be added to an already existing String Package.
We will make a buffer the size of the package + StrSize of the new string. We will
copy the string package that first gets changed and the following language packages until
we encounter the NULL string package. All this time we will ensure that the offsets have
been adjusted.
Arguments:
Returns:
--*/
{
EFI_STATUS Status;
EFI_HII_THUNK_PRIVATE_DATA *Private;
EFI_GUID TagGuid;
Private = EFI_HII_THUNK_PRIVATE_DATA_FROM_THIS(This);
Status = GetTagGuidByFrameworkHiiHandle (Private, Handle, &TagGuid);
ASSERT_EFI_ERROR (Status);
Status = HiiThunkNewStringForAllStringPackages (Private, &TagGuid, Language, Reference, NewString);
ASSERT_EFI_ERROR (Status);
return EFI_SUCCESS;
}
EFI_STATUS
EFIAPI
HiiResetStrings (
IN EFI_HII_PROTOCOL *This,
IN FRAMEWORK_EFI_HII_HANDLE Handle
)
/*++
Routine Description:
This function removes any new strings that were added after the initial string export for this handle.
Arguments:
Returns:
--*/
{
ASSERT (FALSE);
return EFI_UNSUPPORTED;
}
EFI_STATUS
EFIAPI
HiiGetString (
IN EFI_HII_PROTOCOL *This,
IN FRAMEWORK_EFI_HII_HANDLE Handle,
IN STRING_REF Token,
IN BOOLEAN Raw,
IN CHAR16 *LanguageString,
IN OUT UINTN *BufferLengthTemp,
OUT EFI_STRING StringBuffer
)
/*++
Routine Description:
This function extracts a string from a package already registered with the EFI HII database.
Arguments:
This - A pointer to the EFI_HII_PROTOCOL instance.
Handle - The HII handle on which the string resides.
Token - The string token assigned to the string.
Raw - If TRUE, the string is returned unedited in the internal storage format described
above. If false, the string returned is edited by replacing <cr> with <space>
and by removing special characters such as the <wide> prefix.
LanguageString - Pointer to a NULL-terminated string containing a single ISO 639-2 language
identifier, indicating the language to print. If the LanguageString is empty (starts
with a NULL), the default system language will be used to determine the language.
BufferLength - Length of the StringBuffer. If the status reports that the buffer width is too
small, this parameter is filled with the length of the buffer needed.
StringBuffer - The buffer designed to receive the characters in the string. Type EFI_STRING is
defined in String.
Returns:
EFI_INVALID_PARAMETER - If input parameter is invalid.
EFI_BUFFER_TOO_SMALL - If the *BufferLength is too small.
EFI_SUCCESS - Operation is successful.
--*/
{
LIST_ENTRY *ListEntry;
HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY *HandleMapEntry;
CHAR8 *AsciiLanguage;
EFI_HII_THUNK_PRIVATE_DATA *Private;
Private = EFI_HII_THUNK_PRIVATE_DATA_FROM_THIS(This);
if (LanguageString == NULL) {
AsciiLanguage = NULL;
} else {
AsciiLanguage = AllocateZeroPool (StrLen (LanguageString) + 1);
if (AsciiLanguage == NULL) {
return EFI_OUT_OF_RESOURCES;
}
UnicodeStrToAsciiStr (LanguageString, AsciiLanguage);
}
for (ListEntry = Private->HiiThunkHandleMappingDBListHead.ForwardLink;
ListEntry != &Private->HiiThunkHandleMappingDBListHead;
ListEntry = ListEntry->ForwardLink
) {
HandleMapEntry = HII_TRHUNK_HANDLE_MAPPING_DATABASE_ENTRY_FROM_LISTENTRY (ListEntry);
if (Handle == HandleMapEntry->FrameworkHiiHandle) {
if (AsciiLanguage == NULL) {
return HiiLibGetString (HandleMapEntry->UefiHiiHandle, Token, StringBuffer, BufferLengthTemp);
} else {
return mUefiStringProtocol->GetString (
mUefiStringProtocol,
AsciiLanguage,
HandleMapEntry->UefiHiiHandle,
Token,
StringBuffer,
BufferLengthTemp,
NULL
);
}
}
}
return EFI_NOT_FOUND;
}
EFI_STATUS
EFIAPI
HiiGetLine (
IN EFI_HII_PROTOCOL *This,
IN FRAMEWORK_EFI_HII_HANDLE Handle,
IN STRING_REF Token,
IN OUT UINT16 *Index,
IN UINT16 LineWidth,
IN CHAR16 *LanguageString,
IN OUT UINT16 *BufferLength,
OUT EFI_STRING StringBuffer
)
/*++
Routine Description:
This function allows a program to extract a part of a string of not more than a given width.
With repeated calls, this allows a calling program to extract "lines" of text that fit inside
columns. The effort of measuring the fit of strings inside columns is localized to this call.
Arguments:
Returns:
--*/
{
ASSERT (FALSE);
return EFI_UNSUPPORTED;
}

View File

@ -0,0 +1,41 @@
/**@file
This file contains the keyboard processing code to the HII database.
Copyright (c) 2006 - 2008, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "HiiDatabase.h"
EFI_GUID *
GetGuidOfFirstFormset (
CONST EFI_HII_FORM_PACKAGE * FormPackage
)
{
UINT8 *StartOfNextPackage;
EFI_IFR_OP_HEADER *OpCodeData;
StartOfNextPackage = (UINT8 *) FormPackage + FormPackage->Header.Length;
OpCodeData = (EFI_IFR_OP_HEADER *) (FormPackage + 1);
while ((UINT8 *) OpCodeData < StartOfNextPackage) {
if (OpCodeData->OpCode == EFI_IFR_FORM_SET_OP) {
return &(((EFI_IFR_FORM_SET *) OpCodeData)->Guid);
}
OpCodeData = (EFI_IFR_OP_HEADER *) ((UINT8 *) OpCodeData + OpCodeData->Length);
}
ASSERT (FALSE);
return NULL;
}

View File

@ -0,0 +1,24 @@
/**@file
This file contains utility functions by HII Thunk Modules.
Copyright (c) 2006 - 2008, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef _HII_THUNK_UTILITY_H
#define _HII_THUNK_UTILITY_H
EFI_GUID *
GetGuidOfFirstFormset (
CONST EFI_HII_FORM_PACKAGE * FormPackage
);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,53 @@
#/** @file
# Component description file for PeiVariable module.
#
# PEIM to provide the Variable functionality.
# Copyright (c) 2006 - 2007, Intel Corporation
#
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
#
#**/
[Defines]
INF_VERSION = 0x00010005
BASE_NAME = Fv2ToFvThunk
FILE_GUID = D8A6F4A6-0E97-4a8b-A475-39F1B28B5AEC
MODULE_TYPE = DXE_DRIVER
VERSION_STRING = 1.0
EDK_RELEASE_VERSION = 0x00020000
EFI_SPECIFICATION_VERSION = 0x00020000
ENTRY_POINT = InitializeFirmwareVolume
#
# The following information is for reference only and not required by the build tools.
#
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
#
[Sources.common]
Fv2ToFvThunk.c
[Packages]
MdePkg/MdePkg.dec
IntelFrameworkPkg/IntelFrameworkPkg.dec
[LibraryClasses]
UefiDriverEntryPoint
UefiBootServicesTableLib
BaseLib
DebugLib
UefiLib
MemoryAllocationLib
[Protocols]
gEfiFirmwareVolume2ProtocolGuid
gEfiFirmwareVolumeProtocolGuid
[Depex]
TRUE

View File

@ -0,0 +1,619 @@
/*++
Copyright (c) 2006 - 2008 Intel Corporation. <BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
FvToFv2Thunk.c
Abstract:
DXE driver
--*/
#include <PiDxe.h>
#include <Protocol/FirmwareVolume2.h>
#include <Protocol/FirmwareVolume.h>
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiDriverEntryPoint.h>
#include <Library/UefiLib.h>
#include <Library/MemoryAllocationLib.h>
/**
Retrieves attributes, insures positive polarity of attribute bits, returns
resulting attributes in output parameter
@param This Calling context
@param Attributes output buffer which contains attributes
@retval EFI_INVALID_PARAMETER
@retval EFI_SUCCESS
**/
EFI_STATUS
EFIAPI
FvGetVolumeAttributes (
IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
OUT FRAMEWORK_EFI_FV_ATTRIBUTES *Attributes
);
/**
Sets volume attributes
@param This Calling context
@param Attributes Buffer which contains attributes
@retval EFI_INVALID_PARAMETER
@retval EFI_DEVICE_ERROR
@retval EFI_SUCCESS
**/
EFI_STATUS
EFIAPI
FvSetVolumeAttributes (
IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
IN OUT FRAMEWORK_EFI_FV_ATTRIBUTES *Attributes
);
/**
Read the requested file (NameGuid) and returns data in Buffer.
@param This Calling context
@param NameGuid Filename identifying which file to read
@param Buffer Pointer to pointer to buffer in which contents of file are returned.
<br>
If Buffer is NULL, only type, attributes, and size are returned as
there is no output buffer.
<br>
If Buffer != NULL and *Buffer == NULL, the output buffer is allocated
from BS pool by ReadFile
<br>
If Buffer != NULL and *Buffer != NULL, the output buffer has been
allocated by the caller and is being passed in.
@param BufferSize Indicates the buffer size passed in, and on output the size
required to complete the read
@param FoundType Indicates the type of the file who's data is returned
@param FileAttributes Indicates the attributes of the file who's data is resturned
@param AuthenticationStatus Indicates the authentication status of the data
@retval EFI_SUCCESS
@retval EFI_WARN_BUFFER_TOO_SMALL
@retval EFI_NOT_FOUND
@retval EFI_DEVICE_ERROR
@retval EFI_ACCESS_DENIED
**/
EFI_STATUS
EFIAPI
FvReadFile (
IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
IN EFI_GUID *NameGuid,
IN OUT VOID **Buffer,
IN OUT UINTN *BufferSize,
OUT EFI_FV_FILETYPE *FoundType,
OUT EFI_FV_FILE_ATTRIBUTES *FileAttributes,
OUT UINT32 *AuthenticationStatus
);
/**
Read the requested section from the specified file and returns data in Buffer.
@param This Calling context
@param NameGuid Filename identifying the file from which to read
@param SectionType Indicates what section type to retrieve
@param SectionInstance Indicates which instance of SectionType to retrieve
@param Buffer Pointer to pointer to buffer in which contents of file are returned.
<br>
If Buffer is NULL, only type, attributes, and size are returned as
there is no output buffer.
<br>
If Buffer != NULL and *Buffer == NULL, the output buffer is allocated
from BS pool by ReadFile
<br>
If Buffer != NULL and *Buffer != NULL, the output buffer has been
allocated by the caller and is being passed in.
@param BufferSize Indicates the buffer size passed in, and on output the size
required to complete the read
@param AuthenticationStatus Indicates the authentication status of the data
@retval EFI_SUCCESS
@retval EFI_WARN_BUFFER_TOO_SMALL
@retval EFI_OUT_OF_RESOURCES
@retval EFI_NOT_FOUND
@retval EFI_DEVICE_ERROR
@retval EFI_ACCESS_DENIED
**/
EFI_STATUS
EFIAPI
FvReadSection (
IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
IN EFI_GUID *NameGuid,
IN EFI_SECTION_TYPE SectionType,
IN UINTN SectionInstance,
IN OUT VOID **Buffer,
IN OUT UINTN *BufferSize,
OUT UINT32 *AuthenticationStatus
);
/**
Write the supplied file (NameGuid) to the FV.
@param This Calling context
@param NumberOfFiles Indicates the number of file records pointed to by FileData
@param WritePolicy Indicates the level of reliability of the write with respect to
things like power failure events.
@param FileData A pointer to an array of EFI_FV_WRITE_FILE_DATA structures. Each
element in the array indicates a file to write, and there are
NumberOfFiles elements in the input array.
@retval EFI_SUCCESS
@retval EFI_OUT_OF_RESOURCES
@retval EFI_DEVICE_ERROR
@retval EFI_WRITE_PROTECTED
@retval EFI_NOT_FOUND
@retval EFI_INVALID_PARAMETER
**/
EFI_STATUS
EFIAPI
FvWriteFile (
IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
IN UINT32 NumberOfFiles,
IN FRAMEWORK_EFI_FV_WRITE_POLICY WritePolicy,
IN FRAMEWORK_EFI_FV_WRITE_FILE_DATA *FileData
);
/**
Given the input key, search for the next matching file in the volume.
@param This Calling context
@param Key Pointer to a caller allocated buffer that contains an implementation
specific key that is used to track where to begin searching on
successive calls.
@param FileType Indicates the file type to filter for
@param NameGuid Guid filename of the file found
@param Attributes Attributes of the file found
@param Size Size in bytes of the file found
@retval EFI_SUCCESS
@retval EFI_NOT_FOUND
@retval EFI_DEVICE_ERROR
@retval EFI_ACCESS_DENIED
**/
EFI_STATUS
EFIAPI
FvGetNextFile (
IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
IN OUT VOID *Key,
IN OUT EFI_FV_FILETYPE *FileType,
OUT EFI_GUID *NameGuid,
OUT EFI_FV_FILE_ATTRIBUTES *Attributes,
OUT UINTN *Size
);
#define FIRMWARE_VOLUME_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('f', 'v', 't', 'h')
typedef struct {
UINTN Signature;
EFI_FIRMWARE_VOLUME_PROTOCOL FirmwareVolume;
EFI_FIRMWARE_VOLUME2_PROTOCOL *FirmwareVolume2;
} FIRMWARE_VOLUME_PRIVATE_DATA;
#define FIRMWARE_VOLUME_PRIVATE_DATA_FROM_THIS(a) CR (a, FIRMWARE_VOLUME_PRIVATE_DATA, FirmwareVolume, FIRMWARE_VOLUME_PRIVATE_DATA_SIGNATURE)
//
// Firmware Volume Protocol template
//
EFI_EVENT mFvRegistration;
FIRMWARE_VOLUME_PRIVATE_DATA gFirmwareVolumePrivateDataTemplate = {
FIRMWARE_VOLUME_PRIVATE_DATA_SIGNATURE,
{
FvGetVolumeAttributes,
FvSetVolumeAttributes,
FvReadFile,
FvReadSection,
FvWriteFile,
FvGetNextFile,
0,
NULL
},
NULL
};
//
// Module globals
//
VOID
EFIAPI
FvNotificationEvent (
IN EFI_EVENT Event,
IN VOID *Context
)
{
EFI_STATUS Status;
UINTN BufferSize;
EFI_HANDLE Handle;
FIRMWARE_VOLUME_PRIVATE_DATA *Private;
EFI_FIRMWARE_VOLUME_PROTOCOL *FirmwareVolume;
while (TRUE) {
BufferSize = sizeof (Handle);
Status = gBS->LocateHandle (
ByRegisterNotify,
&gEfiFirmwareVolume2ProtocolGuid,
mFvRegistration,
&BufferSize,
&Handle
);
if (EFI_ERROR (Status)) {
//
// Exit Path of While Loop....
//
break;
}
//
// Skip this handle if the Firmware Volume Protocol is already installed
//
Status = gBS->HandleProtocol (
Handle,
&gEfiFirmwareVolumeProtocolGuid,
(VOID **)&FirmwareVolume
);
if (!EFI_ERROR (Status)) {
continue;
}
//
// Allocate private data structure
//
Private = AllocateCopyPool (sizeof (FIRMWARE_VOLUME_PRIVATE_DATA), &gFirmwareVolumePrivateDataTemplate);
if (Private == NULL) {
continue;
}
//
// Retrieve the Firmware Volume2 Protocol
//
Status = gBS->HandleProtocol (
Handle,
&gEfiFirmwareVolume2ProtocolGuid,
(VOID **)&Private->FirmwareVolume2
);
ASSERT_EFI_ERROR (Status);
//
// Fill in rest of private data structure
//
Private->FirmwareVolume.KeySize = Private->FirmwareVolume2->KeySize;
Private->FirmwareVolume.ParentHandle = Private->FirmwareVolume2->ParentHandle;
//
// Install Firmware Volume Protocol onto same handle
//
Status = gBS->InstallMultipleProtocolInterfaces (
&Handle,
&gEfiFirmwareVolumeProtocolGuid,
&Private->FirmwareVolume,
NULL
);
ASSERT_EFI_ERROR (Status);
}
}
/**
The user Entry Point for DXE driver. The user code starts with this function
as the real entry point for the image goes into a library that calls this
function.
@param[in] ImageHandle The firmware allocated handle for the EFI image.
@param[in] SystemTable A pointer to the EFI System Table.
@retval EFI_SUCCESS The entry point is executed successfully.
@retval other Some error occurs when executing this entry point.
**/
EFI_STATUS
EFIAPI
InitializeFirmwareVolume2 (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
)
{
EfiCreateProtocolNotifyEvent (
&gEfiFirmwareVolume2ProtocolGuid,
TPL_CALLBACK,
FvNotificationEvent,
NULL,
&mFvRegistration
);
return EFI_SUCCESS;
}
/**
Retrieves attributes, insures positive polarity of attribute bits, returns
resulting attributes in output parameter
@param This Calling context
@param Attributes output buffer which contains attributes
@retval EFI_INVALID_PARAMETER
@retval EFI_SUCCESS
**/
EFI_STATUS
EFIAPI
FvGetVolumeAttributes (
IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
OUT FRAMEWORK_EFI_FV_ATTRIBUTES *Attributes
)
{
EFI_STATUS Status;
FIRMWARE_VOLUME_PRIVATE_DATA *Private;
EFI_FIRMWARE_VOLUME2_PROTOCOL *FirmwareVolume2;
Private = FIRMWARE_VOLUME_PRIVATE_DATA_FROM_THIS (This);
FirmwareVolume2 = Private->FirmwareVolume2;
Status = FirmwareVolume2->GetVolumeAttributes (
FirmwareVolume2,
Attributes
);
if (!EFI_ERROR (Status)) {
*Attributes = (*Attributes & 0x1ff) | ((UINTN)EFI_FV_ALIGNMENT_2 << ((*Attributes & EFI_FV2_ALIGNMENT) >> 16));
}
return Status;
}
/**
Sets volume attributes
@param This Calling context
@param Attributes Buffer which contains attributes
@retval EFI_INVALID_PARAMETER
@retval EFI_DEVICE_ERROR
@retval EFI_SUCCESS
**/
EFI_STATUS
EFIAPI
FvSetVolumeAttributes (
IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
IN OUT FRAMEWORK_EFI_FV_ATTRIBUTES *Attributes
)
{
FIRMWARE_VOLUME_PRIVATE_DATA *Private;
EFI_FIRMWARE_VOLUME2_PROTOCOL *FirmwareVolume2;
INTN Alignment;
EFI_FV_ATTRIBUTES Fv2Attributes;
Private = FIRMWARE_VOLUME_PRIVATE_DATA_FROM_THIS (This);
FirmwareVolume2 = Private->FirmwareVolume2;
Fv2Attributes = (*Attributes & 0x1ff);
Alignment = LowBitSet64 (RShiftU64 (*Attributes, 16) & 0xffff);
if (Alignment != -1) {
Fv2Attributes |= LShiftU64 (Alignment, 16);
}
return FirmwareVolume2->SetVolumeAttributes (
FirmwareVolume2,
&Fv2Attributes
);
}
/**
Read the requested file (NameGuid) and returns data in Buffer.
@param This Calling context
@param NameGuid Filename identifying which file to read
@param Buffer Pointer to pointer to buffer in which contents of file are returned.
<br>
If Buffer is NULL, only type, attributes, and size are returned as
there is no output buffer.
<br>
If Buffer != NULL and *Buffer == NULL, the output buffer is allocated
from BS pool by ReadFile
<br>
If Buffer != NULL and *Buffer != NULL, the output buffer has been
allocated by the caller and is being passed in.
@param BufferSize Indicates the buffer size passed in, and on output the size
required to complete the read
@param FoundType Indicates the type of the file who's data is returned
@param FileAttributes Indicates the attributes of the file who's data is resturned
@param AuthenticationStatus Indicates the authentication status of the data
@retval EFI_SUCCESS
@retval EFI_WARN_BUFFER_TOO_SMALL
@retval EFI_NOT_FOUND
@retval EFI_DEVICE_ERROR
@retval EFI_ACCESS_DENIED
**/
EFI_STATUS
EFIAPI
FvReadFile (
IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
IN EFI_GUID *NameGuid,
IN OUT VOID **Buffer,
IN OUT UINTN *BufferSize,
OUT EFI_FV_FILETYPE *FoundType,
OUT EFI_FV_FILE_ATTRIBUTES *FileAttributes,
OUT UINT32 *AuthenticationStatus
)
{
FIRMWARE_VOLUME_PRIVATE_DATA *Private;
EFI_FIRMWARE_VOLUME2_PROTOCOL *FirmwareVolume2;
Private = FIRMWARE_VOLUME_PRIVATE_DATA_FROM_THIS (This);
FirmwareVolume2 = Private->FirmwareVolume2;
return FirmwareVolume2->ReadFile (
FirmwareVolume2,
NameGuid,
Buffer,
BufferSize,
FoundType,
FileAttributes,
AuthenticationStatus
);
}
/**
Read the requested section from the specified file and returns data in Buffer.
@param This Calling context
@param NameGuid Filename identifying the file from which to read
@param SectionType Indicates what section type to retrieve
@param SectionInstance Indicates which instance of SectionType to retrieve
@param Buffer Pointer to pointer to buffer in which contents of file are returned.
<br>
If Buffer is NULL, only type, attributes, and size are returned as
there is no output buffer.
<br>
If Buffer != NULL and *Buffer == NULL, the output buffer is allocated
from BS pool by ReadFile
<br>
If Buffer != NULL and *Buffer != NULL, the output buffer has been
allocated by the caller and is being passed in.
@param BufferSize Indicates the buffer size passed in, and on output the size
required to complete the read
@param AuthenticationStatus Indicates the authentication status of the data
@retval EFI_SUCCESS
@retval EFI_WARN_BUFFER_TOO_SMALL
@retval EFI_OUT_OF_RESOURCES
@retval EFI_NOT_FOUND
@retval EFI_DEVICE_ERROR
@retval EFI_ACCESS_DENIED
**/
EFI_STATUS
EFIAPI
FvReadSection (
IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
IN EFI_GUID *NameGuid,
IN EFI_SECTION_TYPE SectionType,
IN UINTN SectionInstance,
IN OUT VOID **Buffer,
IN OUT UINTN *BufferSize,
OUT UINT32 *AuthenticationStatus
)
{
FIRMWARE_VOLUME_PRIVATE_DATA *Private;
EFI_FIRMWARE_VOLUME2_PROTOCOL *FirmwareVolume2;
Private = FIRMWARE_VOLUME_PRIVATE_DATA_FROM_THIS (This);
FirmwareVolume2 = Private->FirmwareVolume2;
return FirmwareVolume2->ReadSection (
FirmwareVolume2,
NameGuid,
SectionType,
SectionInstance,
Buffer,
BufferSize,
AuthenticationStatus
);
}
/**
Write the supplied file (NameGuid) to the FV.
@param This Calling context
@param NumberOfFiles Indicates the number of file records pointed to by FileData
@param WritePolicy Indicates the level of reliability of the write with respect to
things like power failure events.
@param FileData A pointer to an array of EFI_FV_WRITE_FILE_DATA structures. Each
element in the array indicates a file to write, and there are
NumberOfFiles elements in the input array.
@retval EFI_SUCCESS
@retval EFI_OUT_OF_RESOURCES
@retval EFI_DEVICE_ERROR
@retval EFI_WRITE_PROTECTED
@retval EFI_NOT_FOUND
@retval EFI_INVALID_PARAMETER
**/
EFI_STATUS
EFIAPI
FvWriteFile (
IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
IN UINT32 NumberOfFiles,
IN FRAMEWORK_EFI_FV_WRITE_POLICY WritePolicy,
IN FRAMEWORK_EFI_FV_WRITE_FILE_DATA *FileData
)
{
FIRMWARE_VOLUME_PRIVATE_DATA *Private;
EFI_FIRMWARE_VOLUME2_PROTOCOL *FirmwareVolume2;
Private = FIRMWARE_VOLUME_PRIVATE_DATA_FROM_THIS (This);
FirmwareVolume2 = Private->FirmwareVolume2;
return FirmwareVolume2->WriteFile (
FirmwareVolume2,
NumberOfFiles,
WritePolicy,
(EFI_FV_WRITE_FILE_DATA *)FileData
);
}
/**
Given the input key, search for the next matching file in the volume.
@param This Calling context
@param Key Pointer to a caller allocated buffer that contains an implementation
specific key that is used to track where to begin searching on
successive calls.
@param FileType Indicates the file type to filter for
@param NameGuid Guid filename of the file found
@param Attributes Attributes of the file found
@param Size Size in bytes of the file found
@retval EFI_SUCCESS
@retval EFI_NOT_FOUND
@retval EFI_DEVICE_ERROR
@retval EFI_ACCESS_DENIED
**/
EFI_STATUS
EFIAPI
FvGetNextFile (
IN EFI_FIRMWARE_VOLUME_PROTOCOL *This,
IN OUT VOID *Key,
IN OUT EFI_FV_FILETYPE *FileType,
OUT EFI_GUID *NameGuid,
OUT EFI_FV_FILE_ATTRIBUTES *Attributes,
OUT UINTN *Size
)
{
FIRMWARE_VOLUME_PRIVATE_DATA *Private;
EFI_FIRMWARE_VOLUME2_PROTOCOL *FirmwareVolume2;
Private = FIRMWARE_VOLUME_PRIVATE_DATA_FROM_THIS (This);
FirmwareVolume2 = Private->FirmwareVolume2;
return FirmwareVolume2->GetNextFile (
FirmwareVolume2,
Key,
FileType,
NameGuid,
Attributes,
Size
);
}

View File

@ -0,0 +1,53 @@
#/** @file
# Component description file for PeiVariable module.
#
# PEIM to provide the Variable functionality.
# Copyright (c) 2006 - 2007, Intel Corporation
#
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
#
#**/
[Defines]
INF_VERSION = 0x00010005
BASE_NAME = FvToFv2Thunk
FILE_GUID = 5007A40E-A5E0-44f7-86AE-662F9A91DA26
MODULE_TYPE = DXE_DRIVER
VERSION_STRING = 1.0
EDK_RELEASE_VERSION = 0x00020000
EFI_SPECIFICATION_VERSION = 0x00020000
ENTRY_POINT = InitializeFirmwareVolume2
#
# The following information is for reference only and not required by the build tools.
#
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
#
[Sources.common]
FvToFv2Thunk.c
[Packages]
MdePkg/MdePkg.dec
IntelFrameworkPkg/IntelFrameworkPkg.dec
[LibraryClasses]
UefiDriverEntryPoint
UefiBootServicesTableLib
BaseLib
DebugLib
UefiLib
MemoryAllocationLib
[Protocols]
gEfiFirmwareVolume2ProtocolGuid
gEfiFirmwareVolumeProtocolGuid
[Depex]
TRUE

View File

@ -0,0 +1,219 @@
/*++
Copyright (c) 2006 - 2008 Intel Corporation. <BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Variable.c
Abstract:
PEIM to provide the Variable functionality
--*/
#include <PiPei.h>
#include <Ppi/PciCfg.h>
#include <Ppi/PciCfg2.h>
#include <Ppi/EcpPciCfg.h>
#include <Library/DebugLib.h>
//
// Function Prototypes - Callbacks
//
EFI_STATUS
EFIAPI
EcpPciCfgPpiNotifyCallback (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
IN VOID *Ppi
);
//
// Function Prototypes
//
EFI_STATUS
EFIAPI
PciCfg2Read (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_PCI_CFG2_PPI *This,
IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
IN UINT64 Address,
IN OUT VOID *Buffer
);
EFI_STATUS
EFIAPI
PciCfg2Write (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_PCI_CFG2_PPI *This,
IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
IN UINT64 Address,
IN OUT VOID *Buffer
);
EFI_STATUS
EFIAPI
PciCfg2Modify (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_PCI_CFG2_PPI *This,
IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
IN UINT64 Address,
IN CONST VOID *SetBits,
IN CONST VOID *ClearBits
);
//
// Module globals
//
EFI_PEI_NOTIFY_DESCRIPTOR mNotifyOnEcpPciCfgList = {
(EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
&gEcpPeiPciCfgPpiGuid,
EcpPciCfgPpiNotifyCallback
};
EFI_PEI_PCI_CFG2_PPI mPciCfg2Ppi = {
PciCfg2Read,
PciCfg2Write,
PciCfg2Modify,
0
};
EFI_PEI_PPI_DESCRIPTOR mPpiListPciCfg2 = {
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
&gEfiPciCfg2PpiGuid,
&mPciCfg2Ppi
};
EFI_STATUS
EFIAPI
PeimInitializePciCfg2 (
IN EFI_FFS_FILE_HEADER *FfsHeader,
IN CONST EFI_PEI_SERVICES **PeiServices
)
/*++
Routine Description:
Provide the functionality of the variable services.
Arguments:
FfsHeadher - The FFS file header
PeiServices - General purpose services available to every PEIM.
Returns:
Status - EFI_SUCCESS if the interface could be successfully
installed
--*/
{
EFI_STATUS Status;
//
// Register a notification for ECP PCI CFG PPI
//
Status = (*PeiServices)->NotifyPpi (PeiServices, &mNotifyOnEcpPciCfgList);
ASSERT_EFI_ERROR (Status);
return Status;
}
EFI_STATUS
EFIAPI
EcpPciCfgPpiNotifyCallback (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
IN VOID *Ppi
)
{
//
// When ECP PCI CFG PPI is installed, publish the PCI CFG2 PPI in the
// PEI Services Table and the PPI database
//
(*PeiServices)->PciCfg = &mPciCfg2Ppi;
return (*PeiServices)->InstallPpi ((CONST EFI_PEI_SERVICES **)PeiServices, &mPpiListPciCfg2);
}
EFI_STATUS
EFIAPI
PciCfg2Read (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_PCI_CFG2_PPI *This,
IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
IN UINT64 Address,
IN OUT VOID *Buffer
)
{
EFI_STATUS Status;
EFI_PEI_PCI_CFG_PPI *PciCfg;
Status = (*PeiServices)->LocatePpi (
PeiServices,
&gEcpPeiPciCfgPpiGuid,
0,
NULL,
(VOID **)&PciCfg
);
ASSERT_EFI_ERROR (Status);
return PciCfg->Read ((EFI_PEI_SERVICES **)PeiServices, PciCfg, Width, Address, Buffer);
}
EFI_STATUS
EFIAPI
PciCfg2Write (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_PCI_CFG2_PPI *This,
IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
IN UINT64 Address,
IN OUT VOID *Buffer
)
{
EFI_STATUS Status;
EFI_PEI_PCI_CFG_PPI *PciCfg;
Status = (*PeiServices)->LocatePpi (
PeiServices,
&gEcpPeiPciCfgPpiGuid,
0,
NULL,
(VOID **)&PciCfg
);
ASSERT_EFI_ERROR (Status);
return PciCfg->Write ((EFI_PEI_SERVICES **)PeiServices, PciCfg, Width, Address, Buffer);
}
EFI_STATUS
EFIAPI
PciCfg2Modify (
IN CONST EFI_PEI_SERVICES **PeiServices,
IN CONST EFI_PEI_PCI_CFG2_PPI *This,
IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
IN UINT64 Address,
IN CONST VOID *SetBits,
IN CONST VOID *ClearBits
)
{
EFI_STATUS Status;
EFI_PEI_PCI_CFG_PPI *PciCfg;
Status = (*PeiServices)->LocatePpi (
PeiServices,
&gEcpPeiPciCfgPpiGuid,
0,
NULL,
(VOID **)&PciCfg
);
ASSERT_EFI_ERROR (Status);
return PciCfg->Modify ((EFI_PEI_SERVICES **)PeiServices, PciCfg, Width, Address, *(UINTN *)SetBits, *(UINTN *)ClearBits);
}

View File

@ -0,0 +1,53 @@
#/** @file
# Component description file for PeiVariable module.
#
# PEIM to provide the Variable functionality.
# Copyright (c) 2006 - 2007, Intel Corporation
#
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
#
#**/
[Defines]
INF_VERSION = 0x00010005
BASE_NAME = PciCfg2ToPciCfgThunk
FILE_GUID = 41401688-2862-431b-BAAC-6ECADAC384AB
MODULE_TYPE = PEIM
VERSION_STRING = 1.0
EDK_RELEASE_VERSION = 0x00020000
EFI_SPECIFICATION_VERSION = 0x00020000
ENTRY_POINT = PeimInitializePciCfg2
#
# The following information is for reference only and not required by the build tools.
#
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
#
[Sources.common]
PciCfg2ToPciCfgThunk.c
[Packages]
MdePkg/MdePkg.dec
IntelFrameworkPkg/IntelFrameworkPkg.dec
EdkCompatibilityPkg/EdkCompatibilityPkg.dec
[LibraryClasses]
PeimEntryPoint
DebugLib
[Ppis]
gEfiPciCfgPpiInServiceTableGuid
gEfiPciCfg2PpiGuid
gEcpPeiPciCfgPpiGuid
[Depex]
TRUE
# gEcpPeiPciCfgPpiGuid

View File

@ -0,0 +1,155 @@
/*++
Copyright (c) 2006 - 2008 Intel Corporation. <BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Variable.c
Abstract:
PEIM to provide the Variable functionality
--*/
#include <PiPei.h>
#include <Ppi/PciCfg.h>
#include <Ppi/PciCfg2.h>
#include <Library/DebugLib.h>
//
// Function Prototypes
//
EFI_STATUS
EFIAPI
PciCfgRead (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_PCI_CFG_PPI *This,
IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
IN UINT64 Address,
IN OUT VOID *Buffer
);
EFI_STATUS
EFIAPI
PciCfgWrite (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_PCI_CFG_PPI *This,
IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
IN UINT64 Address,
IN OUT VOID *Buffer
);
EFI_STATUS
EFIAPI
PciCfgModify (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_PCI_CFG_PPI *This,
IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
IN UINT64 Address,
IN UINTN SetBits,
IN UINTN ClearBits
);
//
// Module globals
//
EFI_PEI_PCI_CFG_PPI mPciCfgPpi = {
PciCfgRead,
PciCfgWrite,
PciCfgModify,
};
EFI_PEI_PPI_DESCRIPTOR mPpiListPciCfg = {
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
&gEfiPciCfgPpiInServiceTableGuid,
&mPciCfgPpi
};
EFI_STATUS
EFIAPI
PeimInitializePciCfg (
IN EFI_FFS_FILE_HEADER *FfsHeader,
IN CONST EFI_PEI_SERVICES **PeiServices
)
/*++
Routine Description:
Provide the functionality of the variable services.
Arguments:
FfsHeadher - The FFS file header
PeiServices - General purpose services available to every PEIM.
Returns:
Status - EFI_SUCCESS if the interface could be successfully
installed
--*/
{
//
// Publish the variable capability to other modules
//
return (*PeiServices)->InstallPpi (PeiServices, &mPpiListPciCfg);
}
EFI_STATUS
EFIAPI
PciCfgRead (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_PCI_CFG_PPI *This,
IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
IN UINT64 Address,
IN OUT VOID *Buffer
)
{
EFI_PEI_PCI_CFG2_PPI *PciCfg2;
PciCfg2 = (*PeiServices)->PciCfg;
return PciCfg2->Read ((CONST EFI_PEI_SERVICES **)PeiServices, PciCfg2, Width, Address, Buffer);
}
EFI_STATUS
EFIAPI
PciCfgWrite (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_PCI_CFG_PPI *This,
IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
IN UINT64 Address,
IN OUT VOID *Buffer
)
{
EFI_PEI_PCI_CFG2_PPI *PciCfg2;
PciCfg2 = (*PeiServices)->PciCfg;
return PciCfg2->Write ((CONST EFI_PEI_SERVICES **)PeiServices, PciCfg2, Width, Address, Buffer);
}
EFI_STATUS
EFIAPI
PciCfgModify (
IN EFI_PEI_SERVICES **PeiServices,
IN EFI_PEI_PCI_CFG_PPI *This,
IN EFI_PEI_PCI_CFG_PPI_WIDTH Width,
IN UINT64 Address,
IN UINTN SetBits,
IN UINTN ClearBits
)
{
EFI_PEI_PCI_CFG2_PPI *PciCfg2;
PciCfg2 = (*PeiServices)->PciCfg;
return PciCfg2->Modify ((CONST EFI_PEI_SERVICES **)PeiServices, PciCfg2, Width, Address, &SetBits, &ClearBits);
}

View File

@ -0,0 +1,50 @@
#/** @file
# Component description file for PeiVariable module.
#
# PEIM to provide the Variable functionality.
# Copyright (c) 2006 - 2007, Intel Corporation
#
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
#
#**/
[Defines]
INF_VERSION = 0x00010005
BASE_NAME = PciCfgToPciCfg2Thunk
FILE_GUID = 717886AB-C40A-44cf-9114-4119E84B0DC7
MODULE_TYPE = PEIM
VERSION_STRING = 1.0
EDK_RELEASE_VERSION = 0x00020000
EFI_SPECIFICATION_VERSION = 0x00020000
ENTRY_POINT = PeimInitializePciCfg
#
# The following information is for reference only and not required by the build tools.
#
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
#
[Sources.common]
PciCfgToPciCfg2Thunk.c
[Packages]
MdePkg/MdePkg.dec
IntelFrameworkPkg/IntelFrameworkPkg.dec
[LibraryClasses]
PeimEntryPoint
DebugLib
[Ppis]
gEfiPciCfgPpiInServiceTableGuid
gEfiPciCfg2PpiGuid
[Depex]
gEfiPciCfg2PpiGuid

View File

@ -0,0 +1,208 @@
/*++
Copyright (c) 2006 - 2008 Intel Corporation. <BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Variable.c
Abstract:
PEIM to provide the Variable functionality
--*/
#include <PiPei.h>
#include <Ppi/ReadOnlyVariable2.h>
#include <Ppi/ReadOnlyVariable.h>
#include <Library/DebugLib.h>
#include <Library/PeiServicesTablePointerLib.h>
#include <Library/PeiServicesLib.h>
//
// Function Prototypes
//
EFI_STATUS
EFIAPI
PeiGetVariable (
IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This,
IN CONST CHAR16 *VariableName,
IN CONST EFI_GUID *VariableGuid,
OUT UINT32 *Attributes,
IN OUT UINTN *DataSize,
OUT VOID *Data
);
EFI_STATUS
EFIAPI
PeiGetNextVariableName (
IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This,
IN OUT UINTN *VariableNameSize,
IN OUT CHAR16 *VariableName,
IN OUT EFI_GUID *VariableGuid
);
//
// Module globals
//
EFI_PEI_READ_ONLY_VARIABLE2_PPI mVariablePpi = {
PeiGetVariable,
PeiGetNextVariableName
};
EFI_PEI_PPI_DESCRIPTOR mPpiListVariable = {
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
&gEfiPeiReadOnlyVariable2PpiGuid,
&mVariablePpi
};
EFI_STATUS
EFIAPI
PeimInitializeReadOnlyVariable2 (
IN EFI_FFS_FILE_HEADER *FfsHeader,
IN EFI_PEI_SERVICES **PeiServices
)
/*++
Routine Description:
Provide the functionality of the variable services.
Arguments:
FfsHeadher - The FFS file header
PeiServices - General purpose services available to every PEIM.
Returns:
Status - EFI_SUCCESS if the interface could be successfully
installed
--*/
{
//
// Publish the variable capability to other modules
//
return PeiServicesInstallPpi (&mPpiListVariable);
}
EFI_STATUS
EFIAPI
PeiGetVariable (
IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This,
IN CONST CHAR16 *VariableName,
IN CONST EFI_GUID *VariableGuid,
OUT UINT32 *Attributes,
IN OUT UINTN *DataSize,
OUT VOID *Data
)
/*++
Routine Description:
Provide the read variable functionality of the variable services.
Arguments:
PeiServices - General purpose services available to every PEIM.
VariableName - The variable name
VendorGuid - The vendor's GUID
Attributes - Pointer to the attribute
DataSize - Size of data
Data - Pointer to data
Returns:
EFI_SUCCESS - The interface could be successfully installed
EFI_NOT_FOUND - The variable could not be discovered
EFI_BUFFER_TOO_SMALL - The caller buffer is not large enough
--*/
{
EFI_STATUS Status;
EFI_PEI_READ_ONLY_VARIABLE_PPI *ReadOnlyVariable;
Status = PeiServicesLocatePpi (
&gEfiPeiReadOnlyVariablePpiGuid,
0,
NULL,
(VOID **)&ReadOnlyVariable
);
ASSERT_EFI_ERROR (Status);
return ReadOnlyVariable->PeiGetVariable (
GetPeiServicesTablePointer (),
(CHAR16 *)VariableName,
(EFI_GUID *)VariableGuid,
Attributes,
DataSize,
Data
);
}
EFI_STATUS
EFIAPI
PeiGetNextVariableName (
IN CONST EFI_PEI_READ_ONLY_VARIABLE2_PPI *This,
IN OUT UINTN *VariableNameSize,
IN OUT CHAR16 *VariableName,
IN OUT EFI_GUID *VariableGuid
)
/*++
Routine Description:
Provide the get next variable functionality of the variable services.
Arguments:
PeiServices - General purpose services available to every PEIM.
VariabvleNameSize - The variable name's size.
VariableName - A pointer to the variable's name.
VariableGuid - A pointer to the EFI_GUID structure.
VariableNameSize - Size of the variable name
VariableName - The variable name
VendorGuid - The vendor's GUID
Returns:
EFI_SUCCESS - The interface could be successfully installed
EFI_NOT_FOUND - The variable could not be discovered
--*/
{
EFI_STATUS Status;
EFI_PEI_READ_ONLY_VARIABLE_PPI *ReadOnlyVariable;
Status = PeiServicesLocatePpi (
&gEfiPeiReadOnlyVariablePpiGuid,
0,
NULL,
(VOID **)&ReadOnlyVariable
);
ASSERT_EFI_ERROR (Status);
return ReadOnlyVariable->PeiGetNextVariableName (
GetPeiServicesTablePointer (),
VariableNameSize,
VariableName,
VariableGuid
);
}

View File

@ -0,0 +1,52 @@
#/** @file
# Component description file for PeiVariable module.
#
# PEIM to provide the Variable functionality.
# Copyright (c) 2006 - 2007, Intel Corporation
#
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
#
#**/
[Defines]
INF_VERSION = 0x00010005
BASE_NAME = ReadOnlyVariable2ToReadOnlyVariableThunk
FILE_GUID = 950216A2-A621-479c-A13D-2990617BDFE7
MODULE_TYPE = PEIM
VERSION_STRING = 1.0
EDK_RELEASE_VERSION = 0x00020000
EFI_SPECIFICATION_VERSION = 0x00020000
ENTRY_POINT = PeimInitializeReadOnlyVariable2
#
# The following information is for reference only and not required by the build tools.
#
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
#
[Sources.common]
ReadOnlyVariable2ToReadOnlyVariableThunk.c
[Packages]
MdePkg/MdePkg.dec
IntelFrameworkPkg/IntelFrameworkPkg.dec
[LibraryClasses]
PeimEntryPoint
PeiServicesLib
PeiServicesTablePointerLib
DebugLib
[Ppis]
gEfiPeiReadOnlyVariablePpiGuid # PPI ALWAYS_CONSUMED
gEfiPeiReadOnlyVariable2PpiGuid # PPI ALWAYS_PRODUCED
[Depex]
gEfiPeiReadOnlyVariablePpiGuid

View File

@ -0,0 +1,208 @@
/*++
Copyright (c) 2006 - 2008 Intel Corporation. <BR>
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
Variable.c
Abstract:
PEIM to provide the Variable functionality
--*/
#include <PiPei.h>
#include <Ppi/ReadOnlyVariable.h>
#include <Ppi/ReadOnlyVariable2.h>
#include <Library/DebugLib.h>
//
// Function Prototypes
//
EFI_STATUS
EFIAPI
PeiGetVariable (
IN EFI_PEI_SERVICES **PeiServices,
IN CHAR16 *VariableName,
IN EFI_GUID *VendorGuid,
OUT UINT32 *Attributes OPTIONAL,
IN OUT UINTN *DataSize,
OUT VOID *Data
);
EFI_STATUS
EFIAPI
PeiGetNextVariableName (
IN EFI_PEI_SERVICES **PeiServices,
IN OUT UINTN *VariableNameSize,
IN OUT CHAR16 *VariableName,
IN OUT EFI_GUID *VendorGuid
);
//
// Module globals
//
EFI_PEI_READ_ONLY_VARIABLE_PPI mVariablePpi = {
PeiGetVariable,
PeiGetNextVariableName
};
EFI_PEI_PPI_DESCRIPTOR mPpiListVariable = {
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
&gEfiPeiReadOnlyVariablePpiGuid,
&mVariablePpi
};
EFI_STATUS
EFIAPI
PeimInitializeReadOnlyVariable (
IN EFI_FFS_FILE_HEADER *FfsHeader,
IN CONST EFI_PEI_SERVICES **PeiServices
)
/*++
Routine Description:
Provide the functionality of the variable services.
Arguments:
FfsHeadher - The FFS file header
PeiServices - General purpose services available to every PEIM.
Returns:
Status - EFI_SUCCESS if the interface could be successfully
installed
--*/
{
//
// Publish the variable capability to other modules
//
return (*PeiServices)->InstallPpi (PeiServices, &mPpiListVariable);
}
EFI_STATUS
EFIAPI
PeiGetVariable (
IN EFI_PEI_SERVICES **PeiServices,
IN CHAR16 *VariableName,
IN EFI_GUID *VendorGuid,
OUT UINT32 *Attributes OPTIONAL,
IN OUT UINTN *DataSize,
OUT VOID *Data
)
/*++
Routine Description:
Provide the read variable functionality of the variable services.
Arguments:
PeiServices - General purpose services available to every PEIM.
VariableName - The variable name
VendorGuid - The vendor's GUID
Attributes - Pointer to the attribute
DataSize - Size of data
Data - Pointer to data
Returns:
EFI_SUCCESS - The interface could be successfully installed
EFI_NOT_FOUND - The variable could not be discovered
EFI_BUFFER_TOO_SMALL - The caller buffer is not large enough
--*/
{
EFI_STATUS Status;
EFI_PEI_READ_ONLY_VARIABLE2_PPI *ReadOnlyVariable2;
Status = (*PeiServices)->LocatePpi (
(CONST EFI_PEI_SERVICES **)PeiServices,
&gEfiPeiReadOnlyVariable2PpiGuid,
0,
NULL,
(VOID **)&ReadOnlyVariable2
);
ASSERT_EFI_ERROR (Status);
return ReadOnlyVariable2->GetVariable (
ReadOnlyVariable2,
VariableName,
VendorGuid,
Attributes,
DataSize,
Data
);
}
EFI_STATUS
EFIAPI
PeiGetNextVariableName (
IN EFI_PEI_SERVICES **PeiServices,
IN OUT UINTN *VariableNameSize,
IN OUT CHAR16 *VariableName,
IN OUT EFI_GUID *VendorGuid
)
/*++
Routine Description:
Provide the get next variable functionality of the variable services.
Arguments:
PeiServices - General purpose services available to every PEIM.
VariabvleNameSize - The variable name's size.
VariableName - A pointer to the variable's name.
VariableGuid - A pointer to the EFI_GUID structure.
VariableNameSize - Size of the variable name
VariableName - The variable name
VendorGuid - The vendor's GUID
Returns:
EFI_SUCCESS - The interface could be successfully installed
EFI_NOT_FOUND - The variable could not be discovered
--*/
{
EFI_STATUS Status;
EFI_PEI_READ_ONLY_VARIABLE2_PPI *ReadOnlyVariable2;
Status = (*PeiServices)->LocatePpi (
(CONST EFI_PEI_SERVICES **)PeiServices,
&gEfiPeiReadOnlyVariable2PpiGuid,
0,
NULL,
(VOID **)&ReadOnlyVariable2
);
ASSERT_EFI_ERROR (Status);
return ReadOnlyVariable2->NextVariableName (
ReadOnlyVariable2,
VariableNameSize,
VariableName,
VendorGuid
);
}

View File

@ -0,0 +1,52 @@
#/** @file
# Component description file for PeiVariable module.
#
# PEIM to provide the Variable functionality.
# Copyright (c) 2006 - 2007, Intel Corporation
#
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
#
#**/
[Defines]
INF_VERSION = 0x00010005
BASE_NAME = ReadOnlyVariableToReadOnlyVariable2Thunk
FILE_GUID = 0FDB764B-E669-4c69-83AC-5EDD99A2711E
MODULE_TYPE = PEIM
VERSION_STRING = 1.0
EDK_RELEASE_VERSION = 0x00020000
EFI_SPECIFICATION_VERSION = 0x00020000
ENTRY_POINT = PeimInitializeReadOnlyVariable
#
# The following information is for reference only and not required by the build tools.
#
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
#
[Sources.common]
ReadOnlyVariableToReadOnlyVariable2Thunk.c
[Packages]
MdePkg/MdePkg.dec
IntelFrameworkPkg/IntelFrameworkPkg.dec
[LibraryClasses]
PeimEntryPoint
# PeiServicesLib
# PeiServicesTablePointerLib
DebugLib
[Ppis]
gEfiPeiReadOnlyVariable2PpiGuid # PPI ALWAYS_CONSUMED
gEfiPeiReadOnlyVariablePpiGuid # PPI ALWAYS_PRODUCED
[Depex]
gEfiPeiReadOnlyVariable2PpiGuid