15#define INTEL_MM_SAVE_STATE_REGISTER_SMMREVID_INDEX 1
16#define INTEL_MM_SAVE_STATE_REGISTER_IOMISC_INDEX 2
17#define INTEL_MM_SAVE_STATE_REGISTER_IOMEMADDR_INDEX 3
18#define INTEL_MM_SAVE_STATE_REGISTER_MAX_INDEX 4
23#define MM_CPU_OFFSET(Field) OFFSET_OF (SMRAM_SAVE_STATE_MAP, Field)
30 { 0, 0, 0, 0, 0,
FALSE },
45 { 0, 0, 0, 0, 0,
FALSE },
46 { 0, 0, 0, 0, 0,
FALSE },
47 { 0, 0, 0, 0, 0,
FALSE },
48 { 0, 0, 0, 0, 0,
FALSE },
96 { 0, EFI_MM_SAVE_STATE_IO_WIDTH_UINT8 },
97 { 1, EFI_MM_SAVE_STATE_IO_WIDTH_UINT8 },
98 { 2, EFI_MM_SAVE_STATE_IO_WIDTH_UINT16 },
99 { 0, EFI_MM_SAVE_STATE_IO_WIDTH_UINT8 },
100 { 4, EFI_MM_SAVE_STATE_IO_WIDTH_UINT32 },
101 { 0, EFI_MM_SAVE_STATE_IO_WIDTH_UINT8 },
102 { 0, EFI_MM_SAVE_STATE_IO_WIDTH_UINT8 },
103 { 0, EFI_MM_SAVE_STATE_IO_WIDTH_UINT8 }
110 EFI_MM_SAVE_STATE_IO_TYPE_OUTPUT,
111 EFI_MM_SAVE_STATE_IO_TYPE_INPUT,
112 EFI_MM_SAVE_STATE_IO_TYPE_STRING,
113 EFI_MM_SAVE_STATE_IO_TYPE_STRING,
116 EFI_MM_SAVE_STATE_IO_TYPE_REP_PREFIX,
117 EFI_MM_SAVE_STATE_IO_TYPE_REP_PREFIX,
118 EFI_MM_SAVE_STATE_IO_TYPE_OUTPUT,
119 EFI_MM_SAVE_STATE_IO_TYPE_INPUT,
162 if (
Register == EFI_MM_SAVE_STATE_REGISTER_LMA) {
167 return EFI_INVALID_PARAMETER;
188 return EFI_NOT_FOUND;
199 if (IoMisc.Bits.SmiFlag == 0) {
200 return EFI_NOT_FOUND;
206 if ((
mSmmCpuIoType[IoMisc.Bits.Type] != EFI_MM_SAVE_STATE_IO_TYPE_INPUT) &&
207 (
mSmmCpuIoType[IoMisc.Bits.Type] != EFI_MM_SAVE_STATE_IO_TYPE_OUTPUT))
209 return EFI_NOT_FOUND;
216 return EFI_NOT_FOUND;
223 return EFI_INVALID_PARAMETER;
235 IoInfo->
IoPort = (UINT16)IoMisc.Bits.Port;
280 if (
Register == EFI_MM_SAVE_STATE_REGISTER_LMA) {
288 return EFI_NOT_FOUND;
295 if (RegisterIndex == 0) {
296 return EFI_NOT_FOUND;
305 return EFI_UNSUPPORTED;
316 return EFI_NOT_FOUND;
323 return EFI_INVALID_PARAMETER;
329 ASSERT (CpuSaveState !=
NULL);
336 return EFI_NOT_FOUND;
343 return EFI_INVALID_PARAMETER;
354 CopyMem ((UINT8 *)CpuSaveState +
mCpuWidthOffset[RegisterIndex].Offset64Hi, (UINT8 *)Buffer + 4, Width - 4);
375 UINT8 SmmSaveStateRegisterLma;
381 FamilyId = (RegEax >> 8) & 0xf;
382 ModelId = (RegEax >> 4) & 0xf;
383 if ((FamilyId == 0x06) || (FamilyId == 0x0f)) {
384 ModelId = ModelId | ((RegEax >> 12) & 0xf0);
399 if ((RegEdx & BIT29) != 0) {
400 SmmSaveStateRegisterLma = EFI_MM_SAVE_STATE_REGISTER_LMA_64BIT;
403 if (FamilyId == 0x06) {
404 if ((ModelId == 0x17) || (ModelId == 0x0f) || (ModelId == 0x1c)) {
405 SmmSaveStateRegisterLma = EFI_MM_SAVE_STATE_REGISTER_LMA_64BIT;
409 return SmmSaveStateRegisterLma;
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
EFI_STATUS EFIAPI MmSaveStateWriteRegister(IN UINTN CpuIndex, IN EFI_MM_SAVE_STATE_REGISTER Register, IN UINTN Width, IN CONST VOID *Buffer)
#define MM_CPU_OFFSET(Field)
EFI_STATUS EFIAPI MmSaveStateReadRegister(IN UINTN CpuIndex, IN EFI_MM_SAVE_STATE_REGISTER Register, IN UINTN Width, OUT VOID *Buffer)
CONST CPU_MM_SAVE_STATE_LOOKUP_ENTRY mCpuWidthOffset[]
STATIC CONST EFI_MM_SAVE_STATE_IO_TYPE mSmmCpuIoType[]
STATIC CONST CPU_MM_SAVE_STATE_IO_WIDTH mSmmCpuIoWidth[]
UINT8 MmSaveStateGetRegisterLma(VOID)
#define CPUID_VERSION_INFO
#define CPUID_EXTENDED_CPU_SIG
#define SMRAM_SAVE_STATE_MIN_REV_ID_IOMISC
UINT32 EFIAPI AsmCpuid(IN UINT32 Index, OUT UINT32 *RegisterEax OPTIONAL, OUT UINT32 *RegisterEbx OPTIONAL, OUT UINT32 *RegisterEcx OPTIONAL, OUT UINT32 *RegisterEdx OPTIONAL)
#define EFI_MM_SAVE_STATE_REGISTER_LMA_32BIT
EFI_MM_SAVE_STATE_IO_WIDTH
EFI_MM_SAVE_STATE_REGISTER
@ EFI_MM_SAVE_STATE_REGISTER_IO
EFI_MM_SAVE_STATE_IO_TYPE
UINTN MmSaveStateGetRegisterIndex(IN EFI_MM_SAVE_STATE_REGISTER Register, IN UINTN RegOffset)
EFI_STATUS MmSaveStateReadRegisterByIndex(IN UINTN CpuIndex, IN UINTN RegisterIndex, IN UINTN Width, OUT VOID *Buffer)
EFI_STATUS EFIAPI Register(IN EFI_PEI_RSC_HANDLER_CALLBACK Callback)
EFI_MM_SAVE_STATE_IO_TYPE IoType
EFI_MM_SAVE_STATE_IO_WIDTH IoWidth