[Description]:

The patch enhances the SmmRuntimeDxeReportStatusCodeLibFramework instance to reduce the library dependency, since DebugLib, UefiBootServicesTableLib and original SmmRuntimeDxeReportStatusCodeLibFramework may result in the circular dependency.

[Impaction]:
It is backward-compatible.

[Reference Info]:
N/A

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4919 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
yshang1 2008-03-19 09:35:46 +00:00
parent 4a73341484
commit e12848a3a3
3 changed files with 15 additions and 13 deletions

View File

@ -19,7 +19,6 @@
#include <Library/ReportStatusCodeLib.h>
#include <Library/DebugLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/PcdLib.h>
@ -31,7 +30,6 @@
#include <FrameworkModuleBase.h>
#include <DebugInfo.h>
/**
Locatet he report status code service.

View File

@ -47,7 +47,6 @@
PcdLib
BaseMemoryLib
BaseLib
UefiBootServicesTableLib
DebugLib
UefiRuntimeServicesTableLib
OemHookStatusCodeLib

View File

@ -35,6 +35,9 @@ BOOLEAN mInSmm;
STATIC
EFI_RUNTIME_SERVICES *mRT;
STATIC
EFI_BOOT_SERVICES *mBS;
STATIC
BOOLEAN mHaveExitedBootServices = FALSE;
@ -57,7 +60,7 @@ InternalGetReportStatusCode (
} else if (mRT->Hdr.Revision < 0x20000) {
return ((FRAMEWORK_EFI_RUNTIME_SERVICES*)mRT)->ReportStatusCode;
} else if (!mHaveExitedBootServices) {
Status = gBS->LocateProtocol (&gEfiStatusCodeRuntimeProtocolGuid, NULL, (VOID**)&StatusCodeProtocol);
Status = mBS->LocateProtocol (&gEfiStatusCodeRuntimeProtocolGuid, NULL, (VOID**)&StatusCodeProtocol);
if (!EFI_ERROR (Status) && StatusCodeProtocol != NULL) {
return StatusCodeProtocol->ReportStatusCode;
}
@ -123,12 +126,14 @@ ReportStatusCodeLibConstruct (
EFI_SMM_BASE_PROTOCOL *SmmBase;
EFI_STATUS Status;
mBS = SystemTable->BootServices;
//
// SMM driver depends on the SMM BASE protocol.
// the SMM driver must be success to locate protocol.
//
ASSERT (gBS != NULL);
Status = gBS->LocateProtocol (&gEfiSmmBaseProtocolGuid, NULL, (VOID **) &SmmBase);
ASSERT (mBS != NULL);
Status = mBS->LocateProtocol (&gEfiSmmBaseProtocolGuid, NULL, (VOID **) &SmmBase);
if (!EFI_ERROR (Status)) {
SmmBase->InSmm (SmmBase, &mInSmm);
if (mInSmm) {
@ -151,7 +156,7 @@ ReportStatusCodeLibConstruct (
mRT = gRT;
mInSmm = FALSE;
gBS->AllocatePool (EfiRuntimeServicesData, sizeof (EFI_STATUS_CODE_DATA) + EFI_STATUS_CODE_DATA_MAX_SIZE, (VOID **)&mStatusCodeData);
mBS->AllocatePool (EfiRuntimeServicesData, sizeof (EFI_STATUS_CODE_DATA) + EFI_STATUS_CODE_DATA_MAX_SIZE, (VOID **)&mStatusCodeData);
ASSERT (NULL != mStatusCodeData);
//
// Cache the report status code service
@ -161,7 +166,7 @@ ReportStatusCodeLibConstruct (
//
// Register the call back of virtual address change
//
Status = gBS->CreateEvent (
Status = mBS->CreateEvent (
EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE,
TPL_NOTIFY,
ReportStatusCodeLibVirtualAddressChange,
@ -174,7 +179,7 @@ ReportStatusCodeLibConstruct (
//
// Register the call back of virtual address change
//
Status = gBS->CreateEvent (
Status = mBS->CreateEvent (
EVT_SIGNAL_EXIT_BOOT_SERVICES,
TPL_NOTIFY,
ReportStatusCodeLibExitBootServices,
@ -199,13 +204,13 @@ ReportStatusCodeLibDestruct (
//
// Close SetVirtualAddressMap () notify function
//
ASSERT (gBS != NULL);
Status = gBS->CloseEvent (mVirtualAddressChangeEvent);
ASSERT (mBS != NULL);
Status = mBS->CloseEvent (mVirtualAddressChangeEvent);
ASSERT_EFI_ERROR (Status);
Status = gBS->CloseEvent (mExitBootServicesEvent);
Status = mBS->CloseEvent (mExitBootServicesEvent);
ASSERT_EFI_ERROR (Status);
gBS->FreePool (mStatusCodeData);
mBS->FreePool (mStatusCodeData);
return Status;
}