]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
UefiCpuPkg/PiSmmCpuDxeSmm: Avoid allocate Token every time
[mirror_edk2.git] / UefiCpuPkg / PiSmmCpuDxeSmm / PiSmmCpuDxeSmm.h
index 186809f43119e5d6af88e5732fbcc3a7ada8299d..5c1a01e42bf33ebd4eb2e04640bfb583563d07f7 100644 (file)
@@ -53,8 +53,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include <AcpiCpuData.h>\r
 #include <CpuHotPlugData.h>\r
 \r
-#include <Register/Cpuid.h>\r
-#include <Register/Msr.h>\r
+#include <Register/Intel/Cpuid.h>\r
+#include <Register/Intel/Msr.h>\r
 \r
 #include "CpuService.h"\r
 #include "SmmProfile.h"\r
@@ -217,6 +217,17 @@ typedef struct {
 \r
 #define PROCEDURE_TOKEN_FROM_LINK(a)  CR (a, PROCEDURE_TOKEN, Link, PROCEDURE_TOKEN_SIGNATURE)\r
 \r
+#define TOKEN_BUFFER_SIGNATURE  SIGNATURE_32 ('T', 'K', 'B', 'S')\r
+\r
+typedef struct {\r
+  UINTN                   Signature;\r
+  LIST_ENTRY              Link;\r
+\r
+  UINT8                   *Buffer;\r
+} TOKEN_BUFFER;\r
+\r
+#define TOKEN_BUFFER_FROM_LINK(a)  CR (a, TOKEN_BUFFER, Link, TOKEN_BUFFER_SIGNATURE)\r
+\r
 //\r
 // Private structure for the SMM CPU module that is stored in DXE Runtime memory\r
 // Contains the SMM Configuration Protocols that is produced.\r
@@ -243,6 +254,10 @@ typedef struct {
   PROCEDURE_WRAPPER               *ApWrapperFunc;\r
   LIST_ENTRY                      TokenList;\r
 \r
+  LIST_ENTRY                      OldTokenBufList;\r
+\r
+  UINT8                           *CurrentTokenBuf;\r
+  UINT32                          UsedTokenNum;     // Only record tokens used in CurrentTokenBuf.\r
 } SMM_CPU_PRIVATE_DATA;\r
 \r
 extern SMM_CPU_PRIVATE_DATA  *gSmmCpuPrivate;\r
@@ -1311,7 +1326,7 @@ RestoreCr2 (
                                             Note that timeout support is optional. Whether an implementation\r
                                             supports this feature can be determined via the Attributes data\r
                                             member.\r
-  @param[in,out]   CPUStatus                This optional pointer may be used to get the status code returned\r
+  @param[in,out]   CpuStatus                This optional pointer may be used to get the status code returned\r
                                             by Procedure when it completes execution on the target AP, or with\r
                                             EFI_TIMEOUT if the Procedure fails to complete within the optional\r
                                             timeout. The implementation will update this variable with\r
@@ -1329,7 +1344,7 @@ InternalSmmStartupThisAp (
   IN      EFI_AP_PROCEDURE2              Procedure,\r
   IN      UINTN                          CpuIndex,\r
   IN OUT  VOID                           *ProcArguments OPTIONAL,\r
-  IN      MM_COMPLETION                  *Token,\r
+  IN OUT  MM_COMPLETION                  *Token,\r
   IN      UINTN                          TimeoutInMicroseconds,\r
   IN OUT  EFI_STATUS                     *CpuStatus\r
   );\r
@@ -1387,7 +1402,7 @@ IsPresentAp (
   @param[in]     TimeoutInMicroseconds   Indicates the time limit in microseconds for\r
                                          APs to return from Procedure, either for\r
                                          blocking or non-blocking mode.\r
-  @param[in,out] ProcedureArgument       The parameter passed into Procedure for\r
+  @param[in,out] ProcedureArguments      The parameter passed into Procedure for\r
                                          all APs.\r
   @param[in,out] Token                   This is an optional parameter that allows the caller to execute the\r
                                          procedure in a blocking or non-blocking fashion. If it is NULL the\r
@@ -1437,8 +1452,8 @@ InternalSmmStartupAllAPs (
 **/\r
 EFI_STATUS\r
 RegisterStartupProcedure (\r
-  IN EFI_AP_PROCEDURE    Procedure,\r
-  IN VOID                *ProcedureArguments OPTIONAL\r
+  IN     EFI_AP_PROCEDURE    Procedure,\r
+  IN OUT VOID                *ProcedureArguments OPTIONAL\r
   );\r
 \r
 /**\r
@@ -1450,4 +1465,15 @@ InitializeDataForMmMp (
   VOID\r
   );\r
 \r
+/**\r
+  Return whether access to non-SMRAM is restricted.\r
+\r
+  @retval TRUE  Access to non-SMRAM is restricted.\r
+  @retval FALSE Access to non-SMRAM is not restricted.\r
+**/\r
+BOOLEAN\r
+IsRestrictedMemoryAccess (\r
+  VOID\r
+  );\r
+\r
 #endif\r