mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-23 21:54:27 +02:00
Add compatibility modules for Firmware Volume, PCI CFG, and Read Only Variable
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4984 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
107eebef21
commit
a69a84d3cb
1492
EdkCompatibilityPkg/Compatiblity/Fv2ToFvThunk/Fv2ToFvThunk.c
Normal file
1492
EdkCompatibilityPkg/Compatiblity/Fv2ToFvThunk/Fv2ToFvThunk.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -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
|
619
EdkCompatibilityPkg/Compatiblity/FvToFv2Thunk/FvToFv2Thunk.c
Normal file
619
EdkCompatibilityPkg/Compatiblity/FvToFv2Thunk/FvToFv2Thunk.c
Normal 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
|
||||||
|
);
|
||||||
|
}
|
@ -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
|
@ -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);
|
||||||
|
}
|
@ -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
|
@ -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);
|
||||||
|
}
|
@ -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
|
@ -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
|
||||||
|
);
|
||||||
|
}
|
@ -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
|
@ -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
|
||||||
|
);
|
||||||
|
}
|
@ -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
|
Loading…
x
Reference in New Issue
Block a user