TianoCore EDK2 master
Loading...
Searching...
No Matches
IntelMmSaveState.c File Reference

Go to the source code of this file.

Data Structures

struct  CPU_MM_SAVE_STATE_IO_WIDTH
 

Macros

#define INTEL_MM_SAVE_STATE_REGISTER_SMMREVID_INDEX   1
 
#define INTEL_MM_SAVE_STATE_REGISTER_IOMISC_INDEX   2
 
#define INTEL_MM_SAVE_STATE_REGISTER_IOMEMADDR_INDEX   3
 
#define INTEL_MM_SAVE_STATE_REGISTER_MAX_INDEX   4
 
#define MM_CPU_OFFSET(Field)   OFFSET_OF (SMRAM_SAVE_STATE_MAP, Field)
 

Functions

EFI_STATUS EFIAPI MmSaveStateReadRegister (IN UINTN CpuIndex, IN EFI_MM_SAVE_STATE_REGISTER Register, IN UINTN Width, OUT VOID *Buffer)
 
EFI_STATUS EFIAPI MmSaveStateWriteRegister (IN UINTN CpuIndex, IN EFI_MM_SAVE_STATE_REGISTER Register, IN UINTN Width, IN CONST VOID *Buffer)
 
UINT8 MmSaveStateGetRegisterLma (VOID)
 

Variables

CONST CPU_MM_SAVE_STATE_LOOKUP_ENTRY mCpuWidthOffset []
 
STATIC CONST CPU_MM_SAVE_STATE_IO_WIDTH mSmmCpuIoWidth []
 
STATIC CONST EFI_MM_SAVE_STATE_IO_TYPE mSmmCpuIoType []
 

Detailed Description

Provides services to access SMRAM Save State Map

Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.
Copyright (C) 2023 Advanced Micro Devices, Inc. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file IntelMmSaveState.c.

Macro Definition Documentation

◆ INTEL_MM_SAVE_STATE_REGISTER_IOMEMADDR_INDEX

#define INTEL_MM_SAVE_STATE_REGISTER_IOMEMADDR_INDEX   3

Definition at line 17 of file IntelMmSaveState.c.

◆ INTEL_MM_SAVE_STATE_REGISTER_IOMISC_INDEX

#define INTEL_MM_SAVE_STATE_REGISTER_IOMISC_INDEX   2

Definition at line 16 of file IntelMmSaveState.c.

◆ INTEL_MM_SAVE_STATE_REGISTER_MAX_INDEX

#define INTEL_MM_SAVE_STATE_REGISTER_MAX_INDEX   4

Definition at line 18 of file IntelMmSaveState.c.

◆ INTEL_MM_SAVE_STATE_REGISTER_SMMREVID_INDEX

#define INTEL_MM_SAVE_STATE_REGISTER_SMMREVID_INDEX   1

Definition at line 15 of file IntelMmSaveState.c.

◆ MM_CPU_OFFSET

#define MM_CPU_OFFSET (   Field)    OFFSET_OF (SMRAM_SAVE_STATE_MAP, Field)

Macro used to simplify the lookup table entries of type CPU_MM_SAVE_STATE_LOOKUP_ENTRY

Definition at line 23 of file IntelMmSaveState.c.

Function Documentation

◆ MmSaveStateGetRegisterLma()

UINT8 MmSaveStateGetRegisterLma ( VOID  )

Returns LMA value of the Processor.

Return values
UINT8returns LMA bit value.

Definition at line 367 of file IntelMmSaveState.c.

◆ MmSaveStateReadRegister()

EFI_STATUS EFIAPI MmSaveStateReadRegister ( IN UINTN  CpuIndex,
IN EFI_MM_SAVE_STATE_REGISTER  Register,
IN UINTN  Width,
OUT VOID *  Buffer 
)

Read an SMM Save State register on the target processor. If this function returns EFI_UNSUPPORTED, then the caller is responsible for reading the SMM Save Sate register.

Parameters
[in]CpuIndexThe index of the CPU to read the SMM Save State. The value must be between 0 and the NumberOfCpus field in the System Management System Table (SMST).
[in]RegisterThe SMM Save State register to read.
[in]WidthThe number of bytes to read from the CPU save state.
[out]BufferUpon return, this holds the CPU register value read from the save state.
Return values
EFI_SUCCESSThe register was read from Save State.
EFI_INVALID_PARAMTERBuffer is NULL.
EFI_UNSUPPORTEDThis function does not support reading Register.
EFI_NOT_FOUNDIf desired Register not found.

Definition at line 148 of file IntelMmSaveState.c.

◆ MmSaveStateWriteRegister()

EFI_STATUS EFIAPI MmSaveStateWriteRegister ( IN UINTN  CpuIndex,
IN EFI_MM_SAVE_STATE_REGISTER  Register,
IN UINTN  Width,
IN CONST VOID *  Buffer 
)

Writes an SMM Save State register on the target processor. If this function returns EFI_UNSUPPORTED, then the caller is responsible for writing the SMM Save Sate register.

Parameters
[in]CpuIndexThe index of the CPU to write the SMM Save State. The value must be between 0 and the NumberOfCpus field in the System Management System Table (SMST).
[in]RegisterThe SMM Save State register to write.
[in]WidthThe number of bytes to write to the CPU save state.
[in]BufferUpon entry, this holds the new CPU register value.
Return values
EFI_SUCCESSThe register was written to Save State.
EFI_INVALID_PARAMTERBuffer is NULL.
EFI_UNSUPPORTEDThis function does not support writing Register.
EFI_NOT_FOUNDIf desired Register not found.

Definition at line 267 of file IntelMmSaveState.c.

Variable Documentation

◆ mCpuWidthOffset

Lookup table used to retrieve the widths and offsets associated with each supported EFI_MM_SAVE_STATE_REGISTER value

Definition at line 29 of file IntelMmSaveState.c.

◆ mSmmCpuIoType

Initial value:
= {
EFI_MM_SAVE_STATE_IO_TYPE_OUTPUT,
EFI_MM_SAVE_STATE_IO_TYPE_INPUT,
EFI_MM_SAVE_STATE_IO_TYPE_STRING,
EFI_MM_SAVE_STATE_IO_TYPE_STRING,
EFI_MM_SAVE_STATE_IO_TYPE_REP_PREFIX,
EFI_MM_SAVE_STATE_IO_TYPE_REP_PREFIX,
EFI_MM_SAVE_STATE_IO_TYPE_OUTPUT,
EFI_MM_SAVE_STATE_IO_TYPE_INPUT,
}
EFI_MM_SAVE_STATE_IO_TYPE
Definition: MmCpu.h:129

Lookup table for the IOMisc type information

Definition at line 109 of file IntelMmSaveState.c.

◆ mSmmCpuIoWidth

Initial value:
= {
{ 0, EFI_MM_SAVE_STATE_IO_WIDTH_UINT8 },
{ 1, EFI_MM_SAVE_STATE_IO_WIDTH_UINT8 },
{ 2, EFI_MM_SAVE_STATE_IO_WIDTH_UINT16 },
{ 0, EFI_MM_SAVE_STATE_IO_WIDTH_UINT8 },
{ 4, EFI_MM_SAVE_STATE_IO_WIDTH_UINT32 },
{ 0, EFI_MM_SAVE_STATE_IO_WIDTH_UINT8 },
{ 0, EFI_MM_SAVE_STATE_IO_WIDTH_UINT8 },
{ 0, EFI_MM_SAVE_STATE_IO_WIDTH_UINT8 }
}

Lookup table for the IOMisc width information

Definition at line 95 of file IntelMmSaveState.c.