TianoCore EDK2 master
Loading...
Searching...
No Matches
PiSmmCpuCommon.h
Go to the documentation of this file.
1
12#ifndef _CPU_PISMMCPUDXESMM_H_
13#define _CPU_PISMMCPUDXESMM_H_
14
15#include <PiSmm.h>
16
18#include <Protocol/SmmCpu.h>
22#include <Protocol/MmMp.h>
24
25#include <Guid/AcpiS3Context.h>
29#include <Guid/SmmBaseHob.h>
30#include <Guid/MpInformation2.h>
31#include <Guid/MmProfileData.h>
32#include <Guid/MmAcpiS3Enable.h>
34
35#include <Library/BaseLib.h>
36#include <Library/IoLib.h>
37#include <Library/TimerLib.h>
39#include <Library/DebugLib.h>
41#include <Library/PcdLib.h>
42#include <Library/MtrrLib.h>
47#include <Library/UefiLib.h>
48#include <Library/HobLib.h>
50#include <Library/CpuLib.h>
60
61#include <AcpiCpuData.h>
62#include <CpuHotPlugData.h>
63
65#include <Register/Intel/Msr.h>
66
67#include "CpuService.h"
68#include "SmmProfile.h"
69#include "SmmMpPerf.h"
70
71//
72// CET definition
73//
74#define CPUID_CET_SS BIT7
75#define CPUID_CET_IBT BIT20
76
77#define CR4_CET_ENABLE BIT23
78
79#define MSR_IA32_S_CET 0x6A2
80#define MSR_IA32_PL0_SSP 0x6A4
81#define MSR_IA32_INTERRUPT_SSP_TABLE_ADDR 0x6A8
82
83typedef union {
84 struct {
85 // enable shadow stacks
86 UINT32 SH_STK_ENP : 1;
87 // enable the WRSS{D,Q}W instructions.
88 UINT32 WR_SHSTK_EN : 1;
89 // enable tracking of indirect call/jmp targets to be ENDBRANCH instruction.
90 UINT32 ENDBR_EN : 1;
91 // enable legacy compatibility treatment for indirect call/jmp tracking.
92 UINT32 LEG_IW_EN : 1;
93 // enable use of no-track prefix on indirect call/jmp.
94 UINT32 NO_TRACK_EN : 1;
95 // disable suppression of CET indirect branch tracking on legacy compatibility.
96 UINT32 SUPPRESS_DIS : 1;
97 UINT32 RSVD : 4;
98 // indirect branch tracking is suppressed.
99 // This bit can be written to 1 only if TRACKER is written as IDLE.
100 UINT32 SUPPRESS : 1;
101 // Value of the endbranch state machine
102 // Values: IDLE (0), WAIT_FOR_ENDBRANCH(1).
103 UINT32 TRACKER : 1;
104 // linear address of a bitmap in memory indicating valid
105 // pages as target of CALL/JMP_indirect that do not land on ENDBRANCH when CET is enabled
106 // and not suppressed. Valid when ENDBR_EN is 1. Must be machine canonical when written on
107 // parts that support 64 bit mode. On parts that do not support 64 bit mode, the bits 63:32 are
108 // reserved and must be 0. This value is extended by 12 bits at the low end to form the base address
109 // (this automatically aligns the address on a 4-Kbyte boundary).
110 UINT32 EB_LEG_BITMAP_BASE_low : 12;
111 UINT32 EB_LEG_BITMAP_BASE_high : 32;
112 } Bits;
113 UINT64 Uint64;
115
116//
117// MSRs required for configuration of SMM Code Access Check
118//
119#define EFI_MSR_SMM_MCA_CAP 0x17D
120#define SMM_CODE_ACCESS_CHK_BIT BIT58
121
122#define SMM_FEATURE_CONTROL_LOCK_BIT BIT0
123#define SMM_CODE_CHK_EN_BIT BIT2
124
128#define IA32_PG_P BIT0
129#define IA32_PG_RW BIT1
130#define IA32_PG_U BIT2
131#define IA32_PG_WT BIT3
132#define IA32_PG_CD BIT4
133#define IA32_PG_A BIT5
134#define IA32_PG_D BIT6
135#define IA32_PG_PS BIT7
136#define IA32_PG_PAT_2M BIT12
137#define IA32_PG_PAT_4K IA32_PG_PS
138#define IA32_PG_PMNT BIT62
139#define IA32_PG_NX BIT63
140
141#define PAGE_ATTRIBUTE_BITS (IA32_PG_D | IA32_PG_A | IA32_PG_U | IA32_PG_RW | IA32_PG_P)
142//
143// Bits 1, 2, 5, 6 are reserved in the IA32 PAE PDPTE
144// X64 PAE PDPTE does not have such restriction
145//
146#define IA32_PAE_PDPTE_ATTRIBUTE_BITS (IA32_PG_P)
147
148#define PAGE_PROGATE_BITS (IA32_PG_NX | PAGE_ATTRIBUTE_BITS)
149
150#define PAGING_4K_MASK 0xFFF
151#define PAGING_2M_MASK 0x1FFFFF
152#define PAGING_1G_MASK 0x3FFFFFFF
153
154#define PAGING_PAE_INDEX_MASK 0x1FF
155
156#define PAGING_4K_ADDRESS_MASK_64 0x000FFFFFFFFFF000ull
157#define PAGING_2M_ADDRESS_MASK_64 0x000FFFFFFFE00000ull
158#define PAGING_1G_ADDRESS_MASK_64 0x000FFFFFC0000000ull
159
160#define SMRR_MAX_ADDRESS BASE_4GB
161
162typedef enum {
163 PageNone,
164 Page4K,
165 Page2M,
166 Page1G,
167} PAGE_ATTRIBUTE;
168
169typedef struct {
170 PAGE_ATTRIBUTE Attribute;
171 UINT64 Length;
172 UINT64 AddressMask;
174
175//
176// Size of Task-State Segment defined in IA32 Manual
177//
178#define TSS_SIZE 104
179#define EXCEPTION_TSS_SIZE (TSS_SIZE + 4) // Add 4 bytes SSP
180#define TSS_X64_IST1_OFFSET 36
181#define TSS_IA32_CR3_OFFSET 28
182#define TSS_IA32_ESP_OFFSET 56
183#define TSS_IA32_SSP_OFFSET 104
184
185#define CR0_WP BIT16
186
187//
188// Code select value
189//
190#define PROTECT_MODE_CODE_SEGMENT 0x08
191#define LONG_MODE_CODE_SEGMENT 0x38
192
193#define EXCEPTION_VECTOR_NUMBER 0x20
194
195#define INVALID_APIC_ID 0xFFFFFFFFFFFFFFFFULL
196
197//
198// Wrapper used to convert EFI_AP_PROCEDURE2 and EFI_AP_PROCEDURE.
199//
200typedef struct {
201 EFI_AP_PROCEDURE Procedure;
202 VOID *ProcedureArgument;
204
205#define PROCEDURE_TOKEN_SIGNATURE SIGNATURE_32 ('P', 'R', 'T', 'S')
206
207typedef struct {
208 UINTN Signature;
209 LIST_ENTRY Link;
210
211 SPIN_LOCK *SpinLock;
212 volatile UINT32 RunningApCount;
214
215#define PROCEDURE_TOKEN_FROM_LINK(a) CR (a, PROCEDURE_TOKEN, Link, PROCEDURE_TOKEN_SIGNATURE)
216
217#define TOKEN_BUFFER_SIGNATURE SIGNATURE_32 ('T', 'K', 'B', 'S')
218
219typedef struct {
220 UINTN Signature;
221 LIST_ENTRY Link;
222
223 UINT8 *Buffer;
225
226#define TOKEN_BUFFER_FROM_LINK(a) CR (a, TOKEN_BUFFER, Link, TOKEN_BUFFER_SIGNATURE)
227
228//
229// Private structure for the SMM CPU module that is stored in DXE Runtime memory
230// Contains the SMM Configuration Protocols that is produced.
231// Contains a mix of DXE and SMM contents. All the fields must be used properly.
232//
233#define SMM_CPU_PRIVATE_DATA_SIGNATURE SIGNATURE_32 ('s', 'c', 'p', 'u')
234
235typedef struct {
236 UINTN Signature;
237
238 EFI_HANDLE SmmCpuHandle;
239
240 EFI_PROCESSOR_INFORMATION *ProcessorInfo;
241 SMM_CPU_OPERATION *Operation;
242 UINTN *CpuSaveStateSize;
243 VOID **CpuSaveState;
244
245 EFI_SMM_RESERVED_SMRAM_REGION SmmReservedSmramRegion[1];
246 EFI_SMM_ENTRY_CONTEXT SmmCoreEntryContext;
247 EFI_SMM_ENTRY_POINT SmmCoreEntry;
248
249 EFI_SMM_CONFIGURATION_PROTOCOL SmmConfiguration;
250
251 PROCEDURE_WRAPPER *ApWrapperFunc;
252 LIST_ENTRY TokenList;
253 LIST_ENTRY *FirstFreeToken;
255
256extern const BOOLEAN mIsStandaloneMm;
257
258extern SMM_CPU_PRIVATE_DATA *gSmmCpuPrivate;
259extern CPU_HOT_PLUG_DATA mCpuHotPlugData;
260extern UINTN mMaxNumberOfCpus;
261extern UINTN mNumberOfCpus;
264extern BOOLEAN m5LevelPagingNeeded;
265extern PAGING_MODE mPagingMode;
266extern UINTN mSmmShadowStackSize;
267
271extern UINT8 mSmmSaveStateRegisterLma;
272
273extern BOOLEAN mAcpiS3Enable;
274
275#define PAGE_TABLE_POOL_ALIGNMENT BASE_128KB
276#define PAGE_TABLE_POOL_UNIT_SIZE BASE_128KB
277#define PAGE_TABLE_POOL_UNIT_PAGES EFI_SIZE_TO_PAGES (PAGE_TABLE_POOL_UNIT_SIZE)
278#define PAGE_TABLE_POOL_ALIGN_MASK \
279 (~(EFI_PHYSICAL_ADDRESS)(PAGE_TABLE_POOL_ALIGNMENT - 1))
280
281typedef struct {
282 VOID *NextPool;
283 UINTN Offset;
286
290VOID
291EFIAPI
293 VOID
294 );
295
299VOID
300EFIAPI
302 VOID
303 );
304
305//
306// SMM CPU Protocol function prototypes.
307//
308
324EFIAPI
327 IN UINTN Width,
329 IN UINTN CpuIndex,
330 OUT VOID *Buffer
331 );
332
348EFIAPI
351 IN UINTN Width,
353 IN UINTN CpuIndex,
354 IN CONST VOID *Buffer
355 );
356
361VOID
363 VOID
364 );
365
370VOID
372 VOID
373 );
374
375extern volatile BOOLEAN *mSmmInitialized;
376extern UINT32 mBspApicId;
377
378X86_ASSEMBLY_PATCH_LABEL mPatchCetSupported;
379extern BOOLEAN mCetSupported;
380
384VOID
385EFIAPI
387 VOID
388 );
389
393typedef struct {
394 SPIN_LOCK *Busy;
395 volatile EFI_AP_PROCEDURE2 Procedure;
396 volatile VOID *Parameter;
397 volatile BOOLEAN *Present;
398 PROCEDURE_TOKEN *Token;
399 EFI_STATUS *Status;
401
402typedef struct {
403 //
404 // Pointer to an array. The array should be located immediately after this structure
405 // so that UC cache-ability can be set together.
406 //
407 SMM_CPU_DATA_BLOCK *CpuData;
408 volatile UINT32 BspIndex;
409 volatile BOOLEAN *InsideSmm;
410 volatile BOOLEAN *AllCpusInSync;
411 volatile MM_CPU_SYNC_MODE EffectiveSyncMode;
412 volatile BOOLEAN SwitchBsp;
413 volatile BOOLEAN *CandidateBsp;
414 volatile BOOLEAN AllApArrivedWithException;
415 EFI_AP_PROCEDURE StartupProcedure;
416 VOID *StartupProcArgs;
417 SMM_CPU_SYNC_CONTEXT *SyncContext;
419
420#define SMM_PSD_OFFSET 0xfb00
421
425typedef struct {
426 volatile BOOLEAN *InsideSmm;
427 volatile BOOLEAN *AllCpusInSync;
428 SPIN_LOCK *PFLock;
429 SPIN_LOCK *CodeAccessCheckLock;
431
435typedef struct {
436 SPIN_LOCK *Busy;
437 volatile BOOLEAN *Present;
438 SPIN_LOCK *Token;
440
444typedef struct {
445 SMM_CPU_SEMAPHORE_GLOBAL SemaphoreGlobal;
446 SMM_CPU_SEMAPHORE_CPU SemaphoreCpu;
448
449extern IA32_DESCRIPTOR gcSmiGdtr;
450extern EFI_PHYSICAL_ADDRESS mGdtBuffer;
451extern UINTN mGdtBufferSize;
452extern IA32_DESCRIPTOR gcSmiIdtr;
453extern VOID *gcSmiIdtrPtr;
454extern UINT64 gPhyMask;
455extern SMM_DISPATCHER_MP_SYNC_DATA *mSmmMpSyncData;
456extern UINTN mSmmStackArrayBase;
457extern UINTN mSmmStackArrayEnd;
458extern UINTN mSmmStackSize;
459extern EFI_SMM_CPU_SERVICE_PROTOCOL mSmmCpuService;
460extern SMM_CPU_SEMAPHORES mSmmCpuSemaphores;
461extern UINTN mSemaphoreSize;
462extern SPIN_LOCK *mPFLock;
463extern SPIN_LOCK *mConfigSmmCodeAccessCheckLock;
464extern EFI_SMRAM_DESCRIPTOR *mSmmCpuSmramRanges;
465extern UINTN mSmmCpuSmramRangeCount;
466extern UINT8 mPhysicalAddressBits;
467extern BOOLEAN mSmmDebugAgentSupport;
468extern BOOLEAN mSmmCodeAccessCheckEnable;
469
470//
471// Copy of the PcdPteMemoryEncryptionAddressOrMask
472//
473extern UINT64 mAddressEncMask;
474
475extern UINT64 mTimeoutTicker;
476extern UINT64 mTimeoutTicker2;
477
478typedef struct {
486 UINT64 Length;
490 UINT64 Attribute;
492
500UINT32
502 IN BOOLEAN Is32BitPageTable
503 );
504
514UINTN
516 IN PAGING_MODE PagingMode,
517 IN UINT8 PhysicalAddressBits
518 );
519
528UINT32
530 IN VOID *Stacks,
531 IN UINTN StackSize,
532 IN UINTN ShadowStackSize
533 );
534
539VOID
541 VOID
542 );
543
548UINT64
549EFIAPI
551 VOID
552 );
553
561BOOLEAN
562EFIAPI
564 IN UINT64 Timer,
565 IN UINT64 Timeout
566 );
567
572VOID
573EFIAPI
575 VOID
576 );
577
585VOID
586EFIAPI
588 IN EFI_EXCEPTION_TYPE ExceptionType,
589 IN UINT8 Ist
590 );
591
601VOID *
602InitGdt (
603 IN UINTN Cr3,
604 OUT UINTN *GdtStepSize
605 );
606
618EFIAPI
622 );
623
630UINT32
632 VOID
633 );
634
650EFIAPI
652 IN EFI_AP_PROCEDURE Procedure,
653 IN UINTN CpuIndex,
654 IN OUT VOID *ProcArguments OPTIONAL
655 );
656
672EFIAPI
674 IN EFI_AP_PROCEDURE Procedure,
675 IN UINTN CpuIndex,
676 IN OUT VOID *ProcArguments OPTIONAL
677 );
678
705RETURN_STATUS
707 IN UINTN PageTableBase,
708 IN PAGING_MODE PagingMode,
709 IN PHYSICAL_ADDRESS BaseAddress,
710 IN UINT64 Length,
711 IN UINT64 Attributes,
712 IN BOOLEAN IsSet,
713 OUT BOOLEAN *IsModified OPTIONAL
714 );
715
740 IN EFI_PHYSICAL_ADDRESS BaseAddress,
741 IN UINT64 Length,
742 IN UINT64 Attributes
743 );
744
769 IN EFI_PHYSICAL_ADDRESS BaseAddress,
770 IN UINT64 Length,
771 IN UINT64 Attributes
772 );
773
786EFIAPI
788 IN EFI_GUID *TableGuid,
789 OUT VOID **Table
790 );
791
796VOID
797EFIAPI
799 VOID
800 );
801
810VOID
812 OUT UINT32 *SmrrBase,
813 OUT UINT32 *SmrrSize
814 );
815
824VOID
825EFIAPI
827 IN EFI_EXCEPTION_TYPE InterruptType,
828 IN EFI_SYSTEM_CONTEXT SystemContext
829 );
830
838BOOLEAN
840 VOID
841 );
842
847VOID
849 VOID
850 );
851
856VOID
858 VOID
859 );
860
867VOID
869 IN UINT32 MsrIndex
870 );
871
878VOID
879EFIAPI
881 IN OUT VOID *Buffer
882 );
883
888VOID
890 VOID
891 );
892
899UINTN
900EFIAPI
902 VOID
903 );
904
929VOID
930EFIAPI
932 IN UINTN CpuIndex,
933 IN UINT32 SmBase,
934 IN VOID *SmiStack,
935 IN UINTN StackSize,
936 IN UINTN GdtBase,
937 IN UINTN GdtSize,
938 IN UINTN IdtBase,
939 IN UINTN IdtSize,
940 IN UINT32 Cr3
941 );
942
949VOID
951 IN UINTN CallerIpAddress
952 );
953
960VOID
962 EDKII_PI_SMM_MEMORY_ATTRIBUTES_TABLE *MemoryAttributesTable
963 );
964
975 IN OUT UINT64 *Size
976 );
977
986BOOLEAN
988 IN UINT64 Address
989 );
990
999BOOLEAN
1001 IN UINT64 Address
1002 );
1003
1013VOID
1015 OUT MM_CPU_MEMORY_REGION **MemoryRegion,
1016 OUT UINTN *MemoryRegionCount
1017 );
1018
1029VOID
1031 IN UINT8 PhysicalAddressBits,
1032 OUT MM_CPU_MEMORY_REGION **MemoryRegion,
1033 OUT UINTN *MemoryRegionCount
1034 );
1035
1040VOID
1042 VOID
1043 );
1044
1048VOID
1050 VOID
1051 );
1052
1056VOID
1058 VOID
1059 );
1060
1087 IN UINTN PageTableBase,
1088 IN PAGING_MODE PagingMode,
1089 IN PHYSICAL_ADDRESS BaseAddress,
1090 IN UINT64 Length,
1091 IN UINT64 Attributes
1092 );
1093
1120 IN UINTN PageTableBase,
1121 IN PAGING_MODE PagingMode,
1122 IN EFI_PHYSICAL_ADDRESS BaseAddress,
1123 IN UINT64 Length,
1124 IN UINT64 Attributes
1125 );
1126
1142VOID *
1144 IN UINTN Pages
1145 );
1146
1154VOID *
1156 IN UINTN Pages
1157 );
1158
1159//
1160// S3 related global variable and function prototype.
1161//
1162
1163extern BOOLEAN mSmmS3Flag;
1164
1169VOID
1171 VOID
1172 );
1173
1178VOID
1180 VOID
1181 );
1182
1192VOID
1194 IN OUT BOOLEAN *RelaxedMode, OPTIONAL
1195 IN OUT UINT64 *SyncTimeout, OPTIONAL
1196 IN OUT UINT64 *SyncTimeout2 OPTIONAL
1197 );
1198
1203VOID
1205 VOID
1206 );
1207
1219 IN UINTN Cr3,
1220 IN EFI_PHYSICAL_ADDRESS BaseAddress,
1221 IN UINT64 Length
1222 );
1223
1230VOID
1232 IN UINTN CpuIndex,
1233 IN VOID *ShadowStack
1234 );
1235
1260EFIAPI
1263 IN EFI_PHYSICAL_ADDRESS BaseAddress,
1264 IN UINT64 Length,
1265 IN UINT64 Attributes
1266 );
1267
1292EFIAPI
1295 IN EFI_PHYSICAL_ADDRESS BaseAddress,
1296 IN UINT64 Length,
1297 IN UINT64 Attributes
1298 );
1299
1322EFIAPI
1325 IN EFI_PHYSICAL_ADDRESS BaseAddress,
1326 IN UINT64 Length,
1327 IN UINT64 *Attributes
1328 );
1329
1334VOID
1335EFIAPI
1337 );
1338
1345VOID
1346SaveCr2 (
1347 OUT UINTN *Cr2
1348 );
1349
1356VOID
1357RestoreCr2 (
1358 IN UINTN Cr2
1359 );
1360
1398 IN EFI_AP_PROCEDURE2 Procedure,
1399 IN UINTN CpuIndex,
1400 IN OUT VOID *ProcArguments OPTIONAL,
1401 IN OUT MM_COMPLETION *Token,
1402 IN UINTN TimeoutInMicroseconds,
1403 IN OUT EFI_STATUS *CpuStatus
1404 );
1405
1415BOOLEAN
1417 IN SPIN_LOCK *Token
1418 );
1419
1433IsApReady (
1434 IN SPIN_LOCK *Token
1435 );
1436
1446BOOLEAN
1448 IN UINTN CpuIndex
1449 );
1450
1482 IN EFI_AP_PROCEDURE2 Procedure,
1483 IN UINTN TimeoutInMicroseconds,
1484 IN OUT VOID *ProcedureArguments OPTIONAL,
1485 IN OUT MM_COMPLETION *Token,
1486 IN OUT EFI_STATUS *CPUStatus
1487 );
1488
1509 IN EFI_AP_PROCEDURE Procedure,
1510 IN OUT VOID *ProcedureArguments OPTIONAL
1511 );
1512
1519VOID
1521 VOID
1522 );
1523
1528VOID
1530 VOID
1531 );
1532
1539BOOLEAN
1541 VOID
1542 );
1543
1555EFIAPI
1558 IN BOOLEAN BlockingMode
1559 );
1560
1565VOID
1567 VOID
1568 );
1569
1576VOID
1578 OUT BOOLEAN *WriteProtect
1579 );
1580
1587VOID
1589 IN BOOLEAN WriteProtect
1590 );
1591
1612#define WRITE_UNPROTECT_RO_PAGES(Wp, Cet) \
1613 do { \
1614 Cet = ((AsmReadCr4 () & CR4_CET_ENABLE) != 0); \
1615 if (Cet) { \
1616 DisableCet (); \
1617 } \
1618 SmmWriteUnprotectReadOnlyPage (&Wp); \
1619 } while (FALSE)
1620
1621#define WRITE_PROTECT_RO_PAGES(Wp, Cet) \
1622 do { \
1623 SmmWriteProtectReadOnlyPage (Wp); \
1624 if (Cet) { \
1625 EnableCet (); \
1626 } \
1627 } while (FALSE)
1628
1635UINTN
1637 VOID
1638 );
1639
1650 OUT UINTN *NumberOfCpus,
1651 OUT UINTN *MaxNumberOfCpus
1652 );
1653
1663 VOID
1664 );
1665
1666#endif
UINT64 UINTN
VOID EFIAPI FreePages(IN VOID *Buffer, IN UINTN Pages)
#define CONST
Definition: Base.h:259
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
INTN EFI_EXCEPTION_TYPE
Definition: DebugSupport.h:35
EFI_MM_SAVE_STATE_REGISTER
Definition: MmCpu.h:25
VOID(EFIAPI * EFI_AP_PROCEDURE)(IN OUT VOID *Buffer)
Definition: PiMultiPhase.h:198
EFI_STATUS(EFIAPI * EFI_AP_PROCEDURE2)(IN VOID *ProcedureArgument)
Definition: PiMultiPhase.h:214
VOID(EFIAPI * EFI_SMM_ENTRY_POINT)(IN CONST EFI_SMM_ENTRY_CONTEXT *SmmEntryContext)
Definition: PiSmmCis.h:96
VOID EFIAPI SmmEntryPoint(IN CONST EFI_SMM_ENTRY_CONTEXT *SmmEntryContext)
Definition: PiSmmCore.c:669
VOID EFIAPI InitializeIdtIst(IN EFI_EXCEPTION_TYPE ExceptionType, IN UINT8 Ist)
Definition: SmmFuncsArch.c:34
UINT64 EFIAPI StartSyncTimer(VOID)
Definition: SyncTimer.c:67
BOOLEAN IsPresentAp(IN UINTN CpuIndex)
Definition: MpService.c:403
BOOLEAN IsRestrictedMemoryAccess(VOID)
UINTN GenSmmPageTable(IN PAGING_MODE PagingMode, IN UINT8 PhysicalAddressBits)
EFI_STATUS SmmSetMemoryAttributes(IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN UINT64 Attributes)
VOID GetAcpiS3EnableFlag(VOID)
VOID InitializeDataForMmMp(VOID)
Definition: MpService.c:1791
VOID PerformRemainingTasks(VOID)
VOID EFIAPI EnableCet(VOID)
EFI_STATUS EFIAPI SmmCpuRendezvous(IN EDKII_SMM_CPU_RENDEZVOUS_PROTOCOL *This, IN BOOLEAN BlockingMode)
Definition: CpuService.c:414
EFI_STATUS SmmClearMemoryAttributesEx(IN UINTN PageTableBase, IN PAGING_MODE PagingMode, IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN UINT64 Attributes)
VOID InitSmmS3ResumeState(VOID)
Definition: CpuS3.c:192
EFI_STATUS EFIAPI SmmGetSystemConfigurationTable(IN EFI_GUID *TableGuid, OUT VOID **Table)
VOID FindSmramInfo(OUT UINT32 *SmrrBase, OUT UINT32 *SmrrSize)
EFI_STATUS EFIAPI EdkiiSmmGetMemoryAttributes(IN EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL *This, IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN UINT64 *Attributes)
EFI_PROCESSOR_INFORMATION * GetMpInformationFromMpServices(OUT UINTN *NumberOfCpus, OUT UINTN *MaxNumberOfCpus)
RETURN_STATUS ConvertMemoryPageAttributes(IN UINTN PageTableBase, IN PAGING_MODE PagingMode, IN PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN UINT64 Attributes, IN BOOLEAN IsSet, OUT BOOLEAN *IsModified OPTIONAL)
EFI_STATUS InternalSmmStartupAllAPs(IN EFI_AP_PROCEDURE2 Procedure, IN UINTN TimeoutInMicroseconds, IN OUT VOID *ProcedureArguments OPTIONAL, IN OUT MM_COMPLETION *Token, IN OUT EFI_STATUS *CPUStatus)
Definition: MpService.c:1252
VOID EFIAPI PiSmmCpuSmiEntryFixupAddress()
VOID EFIAPI InitializeIDTSmmStackGuard(VOID)
Definition: SmmFuncsArch.c:29
UINT32 SmmInitPageTable(VOID)
Definition: PageTbl.c:20
VOID InitShadowStack(IN UINTN CpuIndex, IN VOID *ShadowStack)
Definition: SmmFuncsArch.c:151
UINT32 Gen4GPageTable(IN BOOLEAN Is32BitPageTable)
EFI_STATUS RegisterStartupProcedure(IN EFI_AP_PROCEDURE Procedure, IN OUT VOID *ProcedureArguments OPTIONAL)
Definition: MpService.c:2072
BOOLEAN IsNonMmramLoggingAddress(IN UINT64 Address)
VOID ConfigSmmCodeAccessCheck(VOID)
VOID RestoreSmmConfigurationInS3(VOID)
Definition: CpuS3.c:31
VOID EFIAPI SmmRelocationSemaphoreComplete(VOID)
EFI_STATUS SetShadowStack(IN UINTN Cr3, IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length)
EFI_STATUS SmmSetMemoryAttributesEx(IN UINTN PageTableBase, IN PAGING_MODE PagingMode, IN PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN UINT64 Attributes)
VOID SmmWriteUnprotectReadOnlyPage(OUT BOOLEAN *WriteProtect)
VOID * AllocatePageTableMemory(IN UINTN Pages)
VOID EFIAPI DisableCet(VOID)
EFI_STATUS EFIAPI SmmWriteSaveState(IN CONST EFI_SMM_CPU_PROTOCOL *This, IN UINTN Width, IN EFI_SMM_SAVE_STATE_REGISTER Register, IN UINTN CpuIndex, IN CONST VOID *Buffer)
EFI_STATUS EFIAPI EdkiiSmmSetMemoryAttributes(IN EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL *This, IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN UINT64 Attributes)
EFI_STATUS EFIAPI SmmStartupThisAp(IN EFI_AP_PROCEDURE Procedure, IN UINTN CpuIndex, IN OUT VOID *ProcArguments OPTIONAL)
Definition: MpService.c:1434
VOID CreateExtendedProtectionRange(OUT MM_CPU_MEMORY_REGION **MemoryRegion, OUT UINTN *MemoryRegionCount)
VOID InitPackageFirstThreadIndexInfo(VOID)
Definition: MpService.c:1752
UINT32 InitializeMpServiceData(IN VOID *Stacks, IN UINTN StackSize, IN UINTN ShadowStackSize)
Definition: MpService.c:1940
VOID SmmWaitForApArrival(VOID)
Definition: MpService.c:231
EFI_STATUS PiSmmCpuEntryCommon(VOID)
EFI_STATUS EFIAPI RegisterSmmEntry(IN CONST EFI_SMM_CONFIGURATION_PROTOCOL *This, IN EFI_SMM_ENTRY_POINT SmmEntryPoint)
Definition: MpService.c:2041
VOID EFIAPI ConfigSmmCodeAccessCheckOnCurrentProcessor(IN OUT VOID *Buffer)
UINTN EFIAPI GetSmiHandlerSize(VOID)
EFI_STATUS IsApReady(IN SPIN_LOCK *Token)
Definition: MpService.c:1082
VOID GetSmmCpuSyncConfigData(IN OUT BOOLEAN *RelaxedMode, OPTIONAL IN OUT UINT64 *SyncTimeout, OPTIONAL IN OUT UINT64 *SyncTimeout2 OPTIONAL)
VOID InitializeSmmTimer(VOID)
Definition: SyncTimer.c:29
VOID * AllocateCodePages(IN UINTN Pages)
Definition: PrePiLib.c:28
VOID RestoreCr2(IN UINTN Cr2)
Definition: PageTbl.c:226
VOID ExecuteFirstSmiInit(VOID)
BOOLEAN IsSmmProfileEnabled(VOID)
VOID SetMemMapAttributes(EDKII_PI_SMM_MEMORY_ATTRIBUTES_TABLE *MemoryAttributesTable)
VOID EFIAPI SmiPFHandler(IN EFI_EXCEPTION_TYPE InterruptType, IN EFI_SYSTEM_CONTEXT SystemContext)
Definition: PageTbl.c:95
VOID SmmWriteProtectReadOnlyPage(IN BOOLEAN WriteProtect)
VOID InitMsrSpinLockByIndex(IN UINT32 MsrIndex)
VOID InitializeSmm(VOID)
BOOLEAN IsTokenInUse(IN SPIN_LOCK *Token)
Definition: MpService.c:949
VOID DumpModuleInfoByIp(IN UINTN CallerIpAddress)
UINT8 mSmmSaveStateRegisterLma
VOID PerformPreTasks(VOID)
EFI_SMM_CPU_PROTOCOL mSmmCpu
UINTN GetSupportedMaxLogicalProcessorNumber(VOID)
VOID SetPageTableAttributes(VOID)
EFI_PHYSICAL_ADDRESS GetSmmProfileData(IN OUT UINT64 *Size)
EFI_MM_MP_PROTOCOL mSmmMp
Definition: SmmMp.c:16
VOID EFIAPI InstallSmiHandler(IN UINTN CpuIndex, IN UINT32 SmBase, IN VOID *SmiStack, IN UINTN StackSize, IN UINTN GdtBase, IN UINTN GdtSize, IN UINTN IdtBase, IN UINTN IdtSize, IN UINT32 Cr3)
EFI_STATUS EFIAPI SmmReadSaveState(IN CONST EFI_SMM_CPU_PROTOCOL *This, IN UINTN Width, IN EFI_SMM_SAVE_STATE_REGISTER Register, IN UINTN CpuIndex, OUT VOID *Buffer)
VOID CreateNonMmramMemMap(IN UINT8 PhysicalAddressBits, OUT MM_CPU_MEMORY_REGION **MemoryRegion, OUT UINTN *MemoryRegionCount)
VOID UpdateUefiMemMapAttributes(VOID)
BOOLEAN EFIAPI IsSyncTimerTimeout(IN UINT64 Timer, IN UINT64 Timeout)
Definition: SyncTimer.c:83
EFI_STATUS InternalSmmStartupThisAp(IN EFI_AP_PROCEDURE2 Procedure, IN UINTN CpuIndex, IN OUT VOID *ProcArguments OPTIONAL, IN OUT MM_COMPLETION *Token, IN UINTN TimeoutInMicroseconds, IN OUT EFI_STATUS *CpuStatus)
VOID GetUefiMemoryMap(VOID)
VOID * InitGdt(IN UINTN Cr3, OUT UINTN *GdtStepSize)
Definition: SmmFuncsArch.c:55
VOID SaveCr2(OUT UINTN *Cr2)
Definition: PageTbl.c:213
BOOLEAN IsSmmCommBufferForbiddenAddress(IN UINT64 Address)
EFI_STATUS EFIAPI EdkiiSmmClearMemoryAttributes(IN EDKII_SMM_MEMORY_ATTRIBUTE_PROTOCOL *This, IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN UINT64 Attributes)
VOID EFIAPI InitializeMpSyncData(VOID)
Definition: MpService.c:1865
EFI_STATUS EFIAPI SmmBlockingStartupThisAp(IN EFI_AP_PROCEDURE Procedure, IN UINTN CpuIndex, IN OUT VOID *ProcArguments OPTIONAL)
Definition: MpService.c:1401
EFI_STATUS SmmClearMemoryAttributes(IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN UINT64 Attributes)
EFI_STATUS EFIAPI Register(IN EFI_PEI_RSC_HANDLER_CALLBACK Callback)
volatile UINTN SPIN_LOCK
UINT64 EFI_PHYSICAL_ADDRESS
Definition: UefiBaseType.h:50
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
Definition: Base.h:213
EFI_PHYSICAL_ADDRESS Base