]> git.proxmox.com Git - mirror_edk2.git/commitdiff
[Description]:
authoryshang1 <yshang1@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 19 Mar 2008 09:35:46 +0000 (09:35 +0000)
committeryshang1 <yshang1@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 19 Mar 2008 09:35:46 +0000 (09:35 +0000)
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

IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/ReportStatusCodeLibInternal.h
IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/SmmRuntimeDxeReportStatusCodeLibFramework.inf
IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/SmmRuntimeDxeSupport.c

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