]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UefiCpuPkg/PiSmmCpu: Update function call for 2 new APIs.
authorYao, Jiewen <jiewen.yao@intel.com>
Fri, 27 Nov 2015 13:48:12 +0000 (13:48 +0000)
committerlersek <lersek@Edk2>
Fri, 27 Nov 2015 13:48:12 +0000 (13:48 +0000)
All page table allocation will use AllocatePageTableMemory().
Add SmmCpuFeaturesCompleteSmmReadyToLock() to PerformRemainingTasks()
and PerformPreTasks().

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: "Yao, Jiewen" <jiewen.yao@intel.com>
Reviewed-by: "Kinney, Michael D" <michael.d.kinney@intel.com>
Cc: "Fan, Jeff" <jeff.fan@intel.com>
Cc: "Kinney, Michael D" <michael.d.kinney@intel.com>
Cc: "Laszlo Ersek" <lersek@redhat.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18981 6f19259b-4bc3-4df7-8a09-765794883524

UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.c
UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c

index 83f5bf962d575c21cf7dce53ecbaa19f135c1bfd..06ffc6dd86a830963eb9a431af1087d8bbd3acd1 100644 (file)
@@ -770,7 +770,7 @@ Gen4GPageTable (
   //\r
   // Allocate the page table\r
   //\r
   //\r
   // Allocate the page table\r
   //\r
-  PageTable = AllocatePages (ExtraPages + 5 + PagesNeeded);\r
+  PageTable = AllocatePageTableMemory (ExtraPages + 5 + PagesNeeded);\r
   ASSERT (PageTable != NULL);\r
 \r
   PageTable = (VOID *)((UINTN)PageTable + EFI_PAGES_TO_SIZE (ExtraPages));\r
   ASSERT (PageTable != NULL);\r
 \r
   PageTable = (VOID *)((UINTN)PageTable + EFI_PAGES_TO_SIZE (ExtraPages));\r
@@ -872,7 +872,7 @@ SetCacheability (
     //\r
     // Allocate a page from SMRAM\r
     //\r
     //\r
     // Allocate a page from SMRAM\r
     //\r
-    NewPageTableAddress = AllocatePages (1);\r
+    NewPageTableAddress = AllocatePageTableMemory (1);\r
     ASSERT (NewPageTableAddress != NULL);\r
 \r
     NewPageTable = (UINT64 *)NewPageTableAddress;\r
     ASSERT (NewPageTableAddress != NULL);\r
 \r
     NewPageTable = (UINT64 *)NewPageTableAddress;\r
index 670a5cf663f8c573a65aa061caaf7176743a9d7f..fb4655128fadaa3ee96c173b372439b17348fa58 100644 (file)
@@ -970,9 +970,9 @@ PiCpuSmmEntry (
   //\r
   BufferPages = EFI_SIZE_TO_PAGES (SIZE_32KB + TileSize * (mMaxNumberOfCpus - 1));\r
   if ((FamilyId == 4) || (FamilyId == 5)) {\r
   //\r
   BufferPages = EFI_SIZE_TO_PAGES (SIZE_32KB + TileSize * (mMaxNumberOfCpus - 1));\r
   if ((FamilyId == 4) || (FamilyId == 5)) {\r
-    Buffer = AllocateAlignedCodePages (BufferPages, SIZE_32KB);\r
+    Buffer = AllocateAlignedPages (BufferPages, SIZE_32KB);\r
   } else {\r
   } else {\r
-    Buffer = AllocateAlignedCodePages (BufferPages, SIZE_4KB);\r
+    Buffer = AllocateAlignedPages (BufferPages, SIZE_4KB);\r
   }\r
   ASSERT (Buffer != NULL);\r
   DEBUG ((EFI_D_INFO, "SMRAM SaveState Buffer (0x%08x, 0x%08x)\n", Buffer, EFI_PAGES_TO_SIZE(BufferPages)));\r
   }\r
   ASSERT (Buffer != NULL);\r
   DEBUG ((EFI_D_INFO, "SMRAM SaveState Buffer (0x%08x, 0x%08x)\n", Buffer, EFI_PAGES_TO_SIZE(BufferPages)));\r
@@ -1415,6 +1415,35 @@ ConfigSmmCodeAccessCheck (
   }\r
 }\r
 \r
   }\r
 }\r
 \r
+/**\r
+  This API provides a way to allocate memory for page table.\r
+\r
+  This API can be called more once to allocate memory for page tables.\r
+\r
+  Allocates the number of 4KB pages of type EfiRuntimeServicesData and returns a pointer to the\r
+  allocated buffer.  The buffer returned is aligned on a 4KB boundary.  If Pages is 0, then NULL\r
+  is returned.  If there is not enough memory remaining to satisfy the request, then NULL is\r
+  returned.\r
+\r
+  @param  Pages                 The number of 4 KB pages to allocate.\r
+\r
+  @return A pointer to the allocated buffer or NULL if allocation fails.\r
+\r
+**/\r
+VOID *\r
+AllocatePageTableMemory (\r
+  IN UINTN           Pages\r
+  )\r
+{\r
+  VOID  *Buffer;\r
+\r
+  Buffer = SmmCpuFeaturesAllocatePageTableMemory (Pages);\r
+  if (Buffer != NULL) {\r
+    return Buffer;\r
+  }\r
+  return AllocatePages (Pages);\r
+}\r
+\r
 /**\r
   Perform the remaining tasks.\r
 \r
 /**\r
   Perform the remaining tasks.\r
 \r
@@ -1440,6 +1469,8 @@ PerformRemainingTasks (
     //\r
     ConfigSmmCodeAccessCheck ();\r
 \r
     //\r
     ConfigSmmCodeAccessCheck ();\r
 \r
+    SmmCpuFeaturesCompleteSmmReadyToLock ();\r
+\r
     //\r
     // Clean SMM ready to lock flag\r
     //\r
     //\r
     // Clean SMM ready to lock flag\r
     //\r
@@ -1465,6 +1496,8 @@ PerformPreTasks (
     //\r
     ConfigSmmCodeAccessCheck ();\r
 \r
     //\r
     ConfigSmmCodeAccessCheck ();\r
 \r
+    SmmCpuFeaturesCompleteSmmReadyToLock ();\r
+\r
     mRestoreSmmConfigurationInS3 = FALSE;\r
   }\r
 }\r
     mRestoreSmmConfigurationInS3 = FALSE;\r
   }\r
 }\r
index 66d85d80e1266bb8de1ae39570e8ba663955cbcf..f2a91655a33b85bdbf3c69b30252d172c877fe98 100644 (file)
@@ -718,4 +718,25 @@ VOID
 DumpModuleInfoByIp (\r
   IN  UINTN              CallerIpAddress\r
   );\r
 DumpModuleInfoByIp (\r
   IN  UINTN              CallerIpAddress\r
   );\r
+\r
+/**\r
+  This API provides a way to allocate memory for page table.\r
+\r
+  This API can be called more once to allocate memory for page tables.\r
+\r
+  Allocates the number of 4KB pages of type EfiRuntimeServicesData and returns a pointer to the\r
+  allocated buffer.  The buffer returned is aligned on a 4KB boundary.  If Pages is 0, then NULL\r
+  is returned.  If there is not enough memory remaining to satisfy the request, then NULL is\r
+  returned.\r
+\r
+  @param  Pages                 The number of 4 KB pages to allocate.\r
+\r
+  @return A pointer to the allocated buffer or NULL if allocation fails.\r
+\r
+**/\r
+VOID *\r
+AllocatePageTableMemory (\r
+  IN UINTN           Pages\r
+  );\r
+\r
 #endif\r
 #endif\r
index 8ddde9acb55c331fca5cc66e9fea0d935e2eee79..ff4e28ec58e43572fcb0057e24d859ed102d0628 100644 (file)
@@ -552,7 +552,7 @@ InitPaging (
           //\r
           ASSERT (Address == (*Pte & PHYSICAL_ADDRESS_MASK));\r
 \r
           //\r
           ASSERT (Address == (*Pte & PHYSICAL_ADDRESS_MASK));\r
 \r
-          Pt = AllocatePages (1);\r
+          Pt = AllocatePageTableMemory (1);\r
           ASSERT (Pt != NULL);\r
 \r
           // Split it\r
           ASSERT (Pt != NULL);\r
 \r
           // Split it\r