1) Add CONST to the pointer type input parameter.
2) Use global variable and AllocateCopyPool to save the size of generated binary. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5847 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
MDE PI library functions and macros for PEI phase
|
MDE PI library functions and macros for PEI phase
|
||||||
|
|
||||||
Copyright (c) 2007, Intel Corporation
|
Copyright (c) 2007 - 2008, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@@ -23,13 +23,12 @@
|
|||||||
#include <Library/PeiPiLib.h>
|
#include <Library/PeiPiLib.h>
|
||||||
#include <Library/BaseMemoryLib.h>
|
#include <Library/BaseMemoryLib.h>
|
||||||
|
|
||||||
|
CONST EFI_PEI_PPI_DESCRIPTOR mPpiListTemplate [] = {
|
||||||
CONST EFI_PEI_FIRMWARE_VOLUME_INFO_PPI mFvInfoPpiTemplate = {
|
{
|
||||||
EFI_FIRMWARE_FILE_SYSTEM2_GUID,
|
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
|
||||||
NULL,
|
&gEfiPeiFirmwareVolumeInfoPpiGuid,
|
||||||
0, //FvInfoSize
|
NULL
|
||||||
NULL, //ParentFvName
|
}
|
||||||
NULL //ParentFileName;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -57,35 +56,34 @@ CONST EFI_PEI_FIRMWARE_VOLUME_INFO_PPI mFvInfoPpiTemplate = {
|
|||||||
VOID
|
VOID
|
||||||
EFIAPI
|
EFIAPI
|
||||||
PiLibInstallFvInfoPpi (
|
PiLibInstallFvInfoPpi (
|
||||||
IN EFI_GUID *FvFormat, OPTIONAL
|
IN CONST EFI_GUID *FvFormat, OPTIONAL
|
||||||
IN VOID *FvInfo,
|
IN CONST VOID *FvInfo,
|
||||||
IN UINT32 FvInfoSize,
|
IN UINT32 FvInfoSize,
|
||||||
IN EFI_GUID *ParentFvName, OPTIONAL
|
IN CONST EFI_GUID *ParentFvName, OPTIONAL
|
||||||
IN EFI_GUID *ParentFileName OPTIONAL
|
IN CONST EFI_GUID *ParentFileName OPTIONAL
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_PEI_FIRMWARE_VOLUME_INFO_PPI *FvInfoPpi;
|
EFI_PEI_FIRMWARE_VOLUME_INFO_PPI *FvInfoPpi;
|
||||||
EFI_PEI_PPI_DESCRIPTOR *FvInfoPpiDescriptor;
|
EFI_PEI_PPI_DESCRIPTOR *FvInfoPpiDescriptor;
|
||||||
|
|
||||||
FvInfoPpi = AllocateCopyPool (sizeof (*FvInfoPpi), &mFvInfoPpiTemplate);
|
FvInfoPpi = AllocateZeroPool (sizeof (EFI_PEI_FIRMWARE_VOLUME_INFO_PPI));
|
||||||
ASSERT( FvInfoPpi != NULL);
|
ASSERT( FvInfoPpi != NULL);
|
||||||
|
|
||||||
if (FvFormat != NULL) {
|
if (FvFormat != NULL) {
|
||||||
CopyMem (&FvInfoPpi->FvFormat, FvFormat, sizeof (*FvFormat));
|
CopyGuid (&FvInfoPpi->FvFormat, FvFormat);
|
||||||
|
} else {
|
||||||
|
CopyGuid (&FvInfoPpi->FvFormat, &gEfiFirmwareFileSystem2Guid);
|
||||||
}
|
}
|
||||||
FvInfoPpi->FvInfo = (VOID *) (UINTN) FvInfo;
|
FvInfoPpi->FvInfo = (VOID *) FvInfo;
|
||||||
FvInfoPpi->FvInfoSize = (UINT32) FvInfoSize;
|
FvInfoPpi->FvInfoSize = FvInfoSize;
|
||||||
FvInfoPpi->ParentFvName = ParentFvName;
|
FvInfoPpi->ParentFvName = (EFI_GUID *) ParentFvName;
|
||||||
FvInfoPpi->ParentFileName = ParentFileName;
|
FvInfoPpi->ParentFileName = (EFI_GUID *) ParentFileName;
|
||||||
|
|
||||||
|
|
||||||
FvInfoPpiDescriptor = AllocatePool (sizeof(EFI_PEI_PPI_DESCRIPTOR));
|
FvInfoPpiDescriptor = AllocateCopyPool (sizeof(EFI_PEI_PPI_DESCRIPTOR), mPpiListTemplate);
|
||||||
ASSERT (FvInfoPpiDescriptor != NULL);
|
ASSERT (FvInfoPpiDescriptor != NULL);
|
||||||
|
|
||||||
FvInfoPpiDescriptor->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;
|
|
||||||
FvInfoPpiDescriptor->Guid = &gEfiPeiFirmwareVolumeInfoPpiGuid;
|
|
||||||
FvInfoPpiDescriptor->Ppi = (VOID *) FvInfoPpi;
|
FvInfoPpiDescriptor->Ppi = (VOID *) FvInfoPpi;
|
||||||
Status = PeiServicesInstallPpi (FvInfoPpiDescriptor);
|
Status = PeiServicesInstallPpi (FvInfoPpiDescriptor);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
Reference in New Issue
Block a user