]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/CpuDxe/CpuDxe.c
UefiCpuPkg: CpuDxe: broadcast MTRR changes to APs
[mirror_edk2.git] / UefiCpuPkg / CpuDxe / CpuDxe.c
index c9df4e146ac37d9c1424e7a7e4becdb9381bc01a..daf97bd4a6cf6b762b103d6db7d35205e204c89a 100644 (file)
@@ -350,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
@@ -405,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