]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/CpuDxe/CpuDxe.c
MdeModulePkg ScsiBusDxe: Fix caller event may nerver be signaled
[mirror_edk2.git] / UefiCpuPkg / CpuDxe / CpuDxe.c
index f165e17c5934942bec6b14884efc6268cdf69a1a..daf97bd4a6cf6b762b103d6db7d35205e204c89a 100644 (file)
@@ -13,6 +13,7 @@
 **/\r
 \r
 #include "CpuDxe.h"\r
+#include "CpuMp.h"\r
 \r
 //\r
 // Global Variables\r
@@ -349,6 +350,9 @@ CpuSetMemoryAttributes (
 {\r
   RETURN_STATUS             Status;\r
   MTRR_MEMORY_CACHE_TYPE    CacheType;\r
+  EFI_STATUS                MpStatus;\r
+  EFI_MP_SERVICES_PROTOCOL  *MpService;\r
+  MTRR_SETTINGS             MtrrSettings;\r
 \r
   if (!IsMtrrSupported ()) {\r
     return EFI_UNSUPPORTED;\r
@@ -404,6 +408,29 @@ CpuSetMemoryAttributes (
              CacheType\r
              );\r
 \r
+  if (!RETURN_ERROR (Status)) {\r
+    MpStatus = gBS->LocateProtocol (\r
+                      &gEfiMpServiceProtocolGuid,\r
+                      NULL,\r
+                      (VOID **)&MpService\r
+                      );\r
+    //\r
+    // Synchronize the update with all APs\r
+    //\r
+    if (!EFI_ERROR (MpStatus)) {\r
+      MtrrGetAllMtrrs (&MtrrSettings);\r
+      MpStatus = MpService->StartupAllAPs (\r
+                              MpService,          // This\r
+                              SetMtrrsFromBuffer, // Procedure\r
+                              TRUE,               // SingleThread\r
+                              NULL,               // WaitEvent\r
+                              0,                  // TimeoutInMicrosecsond\r
+                              &MtrrSettings,      // ProcedureArgument\r
+                              NULL                // FailedCpuList\r
+                              );\r
+      ASSERT (MpStatus == EFI_SUCCESS || MpStatus == EFI_NOT_STARTED);\r
+    }\r
+  }\r
   return (EFI_STATUS) Status;\r
 }\r
 \r
@@ -897,6 +924,8 @@ InitializeCpu (
                   );\r
   ASSERT_EFI_ERROR (Status);\r
 \r
+  InitializeMpSupport ();\r
+\r
   return Status;\r
 }\r
 \r