]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Library/SmmRuntimeDxeReportStatusCodeLibFramework/SmmRuntimeDxeSupport.c
[Description]:
[mirror_edk2.git] / IntelFrameworkModulePkg / Library / SmmRuntimeDxeReportStatusCodeLibFramework / SmmRuntimeDxeSupport.c
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