diff options
author | qwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-09-08 12:53:50 +0000 |
---|---|---|
committer | qwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-09-08 12:53:50 +0000 |
commit | 23a2150bcf88299dc8dfd45b2cd8a0cbf94859c8 (patch) | |
tree | 1c812be68af7d6e84a6d250a103bf91f6d3b67ce /MdePkg | |
parent | b9066aae2514ddf6dd5dfa6fe93f2ef500fddc95 (diff) | |
download | edk2-platforms-23a2150bcf88299dc8dfd45b2cd8a0cbf94859c8.tar.xz |
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
Diffstat (limited to 'MdePkg')
-rw-r--r-- | MdePkg/Library/PeiPiLib/PeiPiLib.c | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/MdePkg/Library/PeiPiLib/PeiPiLib.c b/MdePkg/Library/PeiPiLib/PeiPiLib.c index cbdc92b6ab..4c9cea865c 100644 --- a/MdePkg/Library/PeiPiLib/PeiPiLib.c +++ b/MdePkg/Library/PeiPiLib/PeiPiLib.c @@ -1,7 +1,7 @@ /** @file
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
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
@@ -23,13 +23,12 @@ #include <Library/PeiPiLib.h>
#include <Library/BaseMemoryLib.h>
-
-CONST EFI_PEI_FIRMWARE_VOLUME_INFO_PPI mFvInfoPpiTemplate = {
- EFI_FIRMWARE_FILE_SYSTEM2_GUID,
- NULL,
- 0, //FvInfoSize
- NULL, //ParentFvName
- NULL //ParentFileName;
+CONST EFI_PEI_PPI_DESCRIPTOR mPpiListTemplate [] = {
+ {
+ (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
+ &gEfiPeiFirmwareVolumeInfoPpiGuid,
+ NULL
+ }
};
/**
@@ -57,35 +56,34 @@ CONST EFI_PEI_FIRMWARE_VOLUME_INFO_PPI mFvInfoPpiTemplate = { VOID
EFIAPI
PiLibInstallFvInfoPpi (
- IN EFI_GUID *FvFormat, OPTIONAL
- IN VOID *FvInfo,
- IN UINT32 FvInfoSize,
- IN EFI_GUID *ParentFvName, OPTIONAL
- IN EFI_GUID *ParentFileName OPTIONAL
+ 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
)
{
-
EFI_STATUS Status;
EFI_PEI_FIRMWARE_VOLUME_INFO_PPI *FvInfoPpi;
EFI_PEI_PPI_DESCRIPTOR *FvInfoPpiDescriptor;
- FvInfoPpi = AllocateCopyPool (sizeof (*FvInfoPpi), &mFvInfoPpiTemplate);
+ FvInfoPpi = AllocateZeroPool (sizeof (EFI_PEI_FIRMWARE_VOLUME_INFO_PPI));
ASSERT( FvInfoPpi != 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->FvInfoSize = (UINT32) FvInfoSize;
- FvInfoPpi->ParentFvName = ParentFvName;
- FvInfoPpi->ParentFileName = ParentFileName;
+ FvInfoPpi->FvInfo = (VOID *) FvInfo;
+ FvInfoPpi->FvInfoSize = FvInfoSize;
+ FvInfoPpi->ParentFvName = (EFI_GUID *) ParentFvName;
+ FvInfoPpi->ParentFileName = (EFI_GUID *) ParentFileName;
- FvInfoPpiDescriptor = AllocatePool (sizeof(EFI_PEI_PPI_DESCRIPTOR));
+ FvInfoPpiDescriptor = AllocateCopyPool (sizeof(EFI_PEI_PPI_DESCRIPTOR), mPpiListTemplate);
ASSERT (FvInfoPpiDescriptor != NULL);
- FvInfoPpiDescriptor->Flags = EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;
- FvInfoPpiDescriptor->Guid = &gEfiPeiFirmwareVolumeInfoPpiGuid;
FvInfoPpiDescriptor->Ppi = (VOID *) FvInfoPpi;
Status = PeiServicesInstallPpi (FvInfoPpiDescriptor);
ASSERT_EFI_ERROR (Status);
|