summaryrefslogtreecommitdiff
path: root/MdeModulePkg
diff options
context:
space:
mode:
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2010-05-05 01:58:36 +0000
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>2010-05-05 01:58:36 +0000
commitd7aaf1dcb5a459955e2a57948732fc64acc66216 (patch)
tree24336db77ccbae4ebc964c45f760112c9040d0ef /MdeModulePkg
parent682cee4c06ed1b7961a966135a8be1f92d6c5c89 (diff)
Use new API GetSectionFromAnyFvByFileType() of MdePkg DxeServicesLib library to get PE data of SMM_CORE driver.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10457 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c90
-rw-r--r--MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf2
2 files changed, 12 insertions, 80 deletions
diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
index 6f84a855a..61ed062d2 100644
--- a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
+++ b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.c
@@ -20,7 +20,6 @@
#include <Protocol/SmmConfiguration.h>
#include <Protocol/SmmControl2.h>
#include <Protocol/DxeSmmReadyToLock.h>
-#include <Protocol/FirmwareVolume2.h>
#include <Guid/EventGroup.h>
#include <Guid/EventLegacyBios.h>
@@ -34,6 +33,7 @@
#include <Library/DebugLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/DxeServicesTableLib.h>
+#include <Library/DxeServicesLib.h>
#include <Library/UefiLib.h>
#include <Library/UefiRuntimeLib.h>
#include <Library/PcdLib.h>
@@ -684,81 +684,6 @@ SmmIplSetVirtualAddressNotify (
}
/**
- Searches all Firmware Volumes for the first file matching FileType and SectionType and returns the section data.
-
- @param FileType FileType to search for within any of the firmware volumes in the platform.
- @param SectionType SectionType to search for within any of the matching FileTypes in the firmware volumes in the platform.
- @param SourceSize Return the size of the returned section data..
-
- @retval != NULL Pointer to the allocated buffer containing the section data.
- @retval NULL Section data was not found.
-
-**/
-VOID *
-GetSectionInAnyFv (
- IN EFI_FV_FILETYPE FileType,
- IN EFI_SECTION_TYPE SectionType,
- OUT UINTN *SourceSize
- )
-{
- EFI_STATUS Status;
- UINTN HandleCount;
- EFI_HANDLE *HandleBuffer;
- UINTN Index;
- EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv;
- UINTN Key;
- EFI_GUID NameGuid;
- EFI_FV_FILE_ATTRIBUTES Attributes;
- VOID *SourceBuffer;
- UINT32 AuthenticationStatus;
-
- HandleBuffer = NULL;
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gEfiFirmwareVolume2ProtocolGuid,
- NULL,
- &HandleCount,
- &HandleBuffer
- );
- if (EFI_ERROR (Status)) {
- return NULL;
- }
-
- for (Index = 0; Index < HandleCount; Index++) {
- Status = gBS->HandleProtocol (
- HandleBuffer[Index],
- &gEfiFirmwareVolume2ProtocolGuid,
- (VOID **)&Fv
- );
- if (EFI_ERROR (Status)) {
- continue;
- }
-
- //
- // Use Firmware Volume 2 Protocol to search for a file of type FileType
- //
- Key = 0;
- Status = Fv->GetNextFile (Fv, &Key, &FileType, &NameGuid, &Attributes, SourceSize);
- if (EFI_ERROR (Status)) {
- continue;
- }
-
- //
- // Use Firmware Volume 2 Protocol to read a section of type SectionType
- //
- SourceBuffer = NULL;
- Status = Fv->ReadSection (Fv, &NameGuid, SectionType, 0, &SourceBuffer, SourceSize, &AuthenticationStatus);
- if (!EFI_ERROR (Status)) {
- FreePool (HandleBuffer);
- return SourceBuffer;
- }
- }
-
- FreePool(HandleBuffer);
-
- return NULL;
-}
-/**
Get the fixed loadding address from image header assigned by build tool. This function only be called
when Loading module at Fixed address feature enabled.
@@ -880,9 +805,16 @@ ExecuteSmmCoreFromSmram (
//
// Search all Firmware Volumes for a PE/COFF image in a file of type SMM_CORE
//
- SourceBuffer = GetSectionInAnyFv (EFI_FV_FILETYPE_SMM_CORE, EFI_SECTION_PE32, &SourceSize);
- if (SourceBuffer == NULL) {
- return EFI_NOT_FOUND;
+ Status = GetSectionFromAnyFvByFileType (
+ EFI_FV_FILETYPE_SMM_CORE,
+ 0,
+ EFI_SECTION_PE32,
+ 0,
+ &SourceBuffer,
+ &SourceSize
+ );
+ if (EFI_ERROR (Status)) {
+ return Status;
}
//
diff --git a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf
index a7e0c962d..8cbaf8d5d 100644
--- a/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf
+++ b/MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf
@@ -47,6 +47,7 @@
DxeServicesTableLib
UefiLib
UefiRuntimeLib
+ DxeServicesLib
[Protocols]
gEfiSmmBase2ProtocolGuid # PROTOCOL ALWAYS_PRODUCED
@@ -55,7 +56,6 @@
gEfiSmmConfigurationProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiSmmControl2ProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiDxeSmmReadyToLockProtocolGuid # PROTOCOL ALWAYS_CONSUMED
- gEfiFirmwareVolume2ProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiCpuArchProtocolGuid # PROTOCOL ALWAYS_CONSUMED
[Guids]