2007-09-24 13:38:43 +02:00
|
|
|
/** @file
|
|
|
|
MDE PI library functions and macros for PEI phase
|
|
|
|
|
2008-09-08 14:53:50 +02:00
|
|
|
Copyright (c) 2007 - 2008, Intel Corporation
|
2007-09-24 13:38:43 +02:00
|
|
|
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 <PiPei.h>
|
|
|
|
#include <Ppi/FirmwareVolumeInfo.h>
|
|
|
|
#include <Guid/FirmwareFileSystem2.h>
|
|
|
|
|
|
|
|
|
|
|
|
#include <Library/DebugLib.h>
|
|
|
|
#include <Library/MemoryAllocationLib.h>
|
|
|
|
#include <Library/PeiServicesLib.h>
|
|
|
|
#include <Library/PeiPiLib.h>
|
2007-10-10 04:08:22 +02:00
|
|
|
#include <Library/BaseMemoryLib.h>
|
2007-09-24 13:38:43 +02:00
|
|
|
|
2008-09-08 14:53:50 +02:00
|
|
|
CONST EFI_PEI_PPI_DESCRIPTOR mPpiListTemplate [] = {
|
|
|
|
{
|
|
|
|
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
|
|
|
|
&gEfiPeiFirmwareVolumeInfoPpiGuid,
|
|
|
|
NULL
|
|
|
|
}
|
2007-09-24 13:38:43 +02:00
|
|
|
};
|
|
|
|
|
2008-02-25 08:01:44 +01:00
|
|
|
/**
|
2008-09-16 08:13:42 +02:00
|
|
|
Install a EFI_PEI_FIRMWARE_VOLUME_INFO PPI to inform PEI core about the existence of a new Firmware Volume.
|
2008-02-25 08:01:44 +01:00
|
|
|
|
2008-09-16 08:13:42 +02:00
|
|
|
The function allocate the EFI_PEI_PPI_DESCRIPTOR structure and update the fields accordingly to parameter passed
|
|
|
|
in and install the PPI.
|
2008-02-25 08:01:44 +01:00
|
|
|
|
2008-09-16 08:13:42 +02:00
|
|
|
@param FvFormat Unique identifier of the format of the memory-mapped firmware volume.
|
|
|
|
If NULL is specified, EFI_FIRMWARE_FILE_SYSTEM2_GUID is used as the Format GUID.
|
|
|
|
@param FvInfo Points to a buffer which allows the EFI_PEI_FIRMWARE_VOLUME_PPI to
|
|
|
|
process the volume. The format of this buffer is specific to the FvFormat. For
|
|
|
|
memory-mapped firmware volumes, this typically points to the first byte of the
|
|
|
|
firmware volume.
|
|
|
|
@param FvInfoSize Size of the data provided by FvInfo. For memory-mapped firmware volumes, this is
|
|
|
|
typically the size of the firmware volume.
|
|
|
|
@param ParentFvName If the firmware volume originally came from a firmware file, then these point to the
|
|
|
|
parent firmware volume name. If it did not originally come from a firmware file,
|
|
|
|
these should be NULL.
|
|
|
|
@param ParentFileName If the firmware volume originally came from a firmware file, then these point to the
|
|
|
|
firmware volume file. If it did not originally come from a firmware file,
|
|
|
|
these should be NULL.
|
|
|
|
|
2008-02-25 08:01:44 +01:00
|
|
|
**/
|
2007-09-24 13:38:43 +02:00
|
|
|
VOID
|
|
|
|
EFIAPI
|
2007-10-10 04:08:22 +02:00
|
|
|
PiLibInstallFvInfoPpi (
|
2008-09-08 14:53:50 +02:00
|
|
|
IN CONST EFI_GUID *FvFormat, OPTIONAL
|
|
|
|
IN CONST VOID *FvInfo,
|
|
|
|
IN UINT32 FvInfoSize,
|
|
|
|
IN CONST EFI_GUID *ParentFvName, OPTIONAL
|
|
|
|
IN CONST EFI_GUID *ParentFileName OPTIONAL
|
2008-06-04 06:33:35 +02:00
|
|
|
)
|
|
|
|
{
|
2007-09-24 13:38:43 +02:00
|
|
|
EFI_STATUS Status;
|
|
|
|
EFI_PEI_FIRMWARE_VOLUME_INFO_PPI *FvInfoPpi;
|
|
|
|
EFI_PEI_PPI_DESCRIPTOR *FvInfoPpiDescriptor;
|
|
|
|
|
2008-09-08 14:53:50 +02:00
|
|
|
FvInfoPpi = AllocateZeroPool (sizeof (EFI_PEI_FIRMWARE_VOLUME_INFO_PPI));
|
2007-09-24 13:38:43 +02:00
|
|
|
ASSERT( FvInfoPpi != NULL);
|
|
|
|
|
2007-10-10 04:08:22 +02:00
|
|
|
if (FvFormat != NULL) {
|
2008-09-08 14:53:50 +02:00
|
|
|
CopyGuid (&FvInfoPpi->FvFormat, FvFormat);
|
|
|
|
} else {
|
|
|
|
CopyGuid (&FvInfoPpi->FvFormat, &gEfiFirmwareFileSystem2Guid);
|
2007-10-10 04:08:22 +02:00
|
|
|
}
|
2008-09-08 14:53:50 +02:00
|
|
|
FvInfoPpi->FvInfo = (VOID *) FvInfo;
|
|
|
|
FvInfoPpi->FvInfoSize = FvInfoSize;
|
|
|
|
FvInfoPpi->ParentFvName = (EFI_GUID *) ParentFvName;
|
|
|
|
FvInfoPpi->ParentFileName = (EFI_GUID *) ParentFileName;
|
2007-09-24 13:38:43 +02:00
|
|
|
|
|
|
|
|
2008-09-08 14:53:50 +02:00
|
|
|
FvInfoPpiDescriptor = AllocateCopyPool (sizeof(EFI_PEI_PPI_DESCRIPTOR), mPpiListTemplate);
|
2007-09-24 13:38:43 +02:00
|
|
|
ASSERT (FvInfoPpiDescriptor != NULL);
|
|
|
|
|
|
|
|
FvInfoPpiDescriptor->Ppi = (VOID *) FvInfoPpi;
|
|
|
|
Status = PeiServicesInstallPpi (FvInfoPpiDescriptor);
|
|
|
|
ASSERT_EFI_ERROR (Status);
|
|
|
|
|
|
|
|
}
|
|
|
|
|