diff options
author | qwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-09-21 08:18:48 +0000 |
---|---|---|
committer | qwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524> | 2008-09-21 08:18:48 +0000 |
commit | c0522bd7dfae2dd290726dad1b55abd8d4925711 (patch) | |
tree | 95150d96cc29fe81efd114013cd9b4ab87261445 /IntelFrameworkModulePkg/Library | |
parent | 7338117bbfd59cafa56a4ddedd1631b92dccc691 (diff) | |
download | edk2-platforms-c0522bd7dfae2dd290726dad1b55abd8d4925711.tar.xz |
CloseEvent in ReportStatusCodeLibDestruct can only be called when the library instance is not linked with a SMM driver (for example a boot dirver or EFI Runtime capable driver).
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5937 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'IntelFrameworkModulePkg/Library')
-rw-r--r-- | IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/SmmRuntimeDxeSupport.c | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/SmmRuntimeDxeSupport.c b/IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/SmmRuntimeDxeSupport.c index dcd0b38c72..f4dc2f0eb9 100644 --- a/IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/SmmRuntimeDxeSupport.c +++ b/IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/SmmRuntimeDxeSupport.c @@ -32,6 +32,8 @@ EFI_STATUS_CODE_DATA *mStatusCodeData; STATIC
BOOLEAN mInSmm;
+EFI_SMM_BASE_PROTOCOL *mSmmBase;
+
STATIC
EFI_RUNTIME_SERVICES *mRT;
@@ -123,7 +125,6 @@ ReportStatusCodeLibConstruct ( IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_SMM_BASE_PROTOCOL *SmmBase;
EFI_STATUS Status;
mBS = SystemTable->BootServices;
@@ -133,12 +134,12 @@ ReportStatusCodeLibConstruct ( // the SMM driver must be success to locate protocol.
//
ASSERT (mBS != NULL);
- Status = mBS->LocateProtocol (&gEfiSmmBaseProtocolGuid, NULL, (VOID **) &SmmBase);
+ Status = mBS->LocateProtocol (&gEfiSmmBaseProtocolGuid, NULL, (VOID **) &mSmmBase);
if (!EFI_ERROR (Status)) {
- SmmBase->InSmm (SmmBase, &mInSmm);
+ mSmmBase->InSmm (mSmmBase, &mInSmm);
if (mInSmm) {
- Status = SmmBase->SmmAllocatePool (
- SmmBase,
+ Status = mSmmBase->SmmAllocatePool (
+ mSmmBase,
EfiRuntimeServicesData,
sizeof (EFI_STATUS_CODE_DATA) + EFI_STATUS_CODE_DATA_MAX_SIZE,
(VOID **) &mStatusCodeData
@@ -207,18 +208,22 @@ ReportStatusCodeLibDestruct ( {
EFI_STATUS Status;
- //
- // Close SetVirtualAddressMap () notify function
- //
- ASSERT (mBS != NULL);
- Status = mBS->CloseEvent (mVirtualAddressChangeEvent);
- ASSERT_EFI_ERROR (Status);
- Status = mBS->CloseEvent (mExitBootServicesEvent);
- ASSERT_EFI_ERROR (Status);
-
- mBS->FreePool (mStatusCodeData);
+ if (!mInSmm) {
+ //
+ // Close SetVirtualAddressMap () notify function
+ //
+ ASSERT (mBS != NULL);
+ Status = mBS->CloseEvent (mVirtualAddressChangeEvent);
+ ASSERT_EFI_ERROR (Status);
+ Status = mBS->CloseEvent (mExitBootServicesEvent);
+ ASSERT_EFI_ERROR (Status);
+
+ mBS->FreePool (mStatusCodeData);
+ } else {
+ mSmmBase->SmmFreePool (mSmmBase, mStatusCodeData);
+ }
- return Status;
+ return EFI_SUCCESS;
}
/**
|