UefiCpuPkg[all]
0.90
|
Data Structures | |
struct | FIXED_MTRR |
struct | VARIABLE_MTRR |
struct | _MTRR_VARIABLE_SETTING_ |
struct | _MTRR_VARIABLE_SETTINGS_ |
struct | _MTRR_FIXED_SETTINGS_ |
struct | _MTRR_SETTINGS_ |
struct | MTRR_MEMORY_RANGE |
Macros | |
#define | MTRR_NUMBER_OF_VARIABLE_MTRR 32 |
#define | RESERVED_FIRMWARE_VARIABLE_MTRR_NUMBER 2 |
#define | MTRR_NUMBER_OF_FIXED_MTRR 11 |
#define | MTRR_CACHE_UNCACHEABLE 0 |
#define | MTRR_CACHE_WRITE_COMBINING 1 |
#define | MTRR_CACHE_WRITE_THROUGH 4 |
#define | MTRR_CACHE_WRITE_PROTECTED 5 |
#define | MTRR_CACHE_WRITE_BACK 6 |
#define | MTRR_CACHE_INVALID_TYPE 7 |
Typedefs | |
typedef struct _MTRR_VARIABLE_SETTING_ | MTRR_VARIABLE_SETTING |
typedef struct _MTRR_VARIABLE_SETTINGS_ | MTRR_VARIABLE_SETTINGS |
typedef struct _MTRR_FIXED_SETTINGS_ | MTRR_FIXED_SETTINGS |
typedef struct _MTRR_SETTINGS_ | MTRR_SETTINGS |
Enumerations | |
enum | MTRR_MEMORY_CACHE_TYPE { CacheUncacheable = 0, CacheWriteCombining = 1, CacheWriteThrough = 4, CacheWriteProtected = 5, CacheWriteBack = 6, CacheInvalid = 7 } |
Functions | |
UINT32 EFIAPI | GetVariableMtrrCount (VOID) |
UINT32 EFIAPI | GetFirmwareVariableMtrrCount (VOID) |
RETURN_STATUS EFIAPI | MtrrSetMemoryAttribute (IN PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN MTRR_MEMORY_CACHE_TYPE Attribute) |
MTRR_MEMORY_CACHE_TYPE EFIAPI | MtrrGetMemoryAttribute (IN PHYSICAL_ADDRESS Address) |
MTRR_FIXED_SETTINGS *EFIAPI | MtrrGetFixedMtrr (OUT MTRR_FIXED_SETTINGS *FixedSettings) |
MTRR_SETTINGS *EFIAPI | MtrrGetAllMtrrs (OUT MTRR_SETTINGS *MtrrSetting) |
MTRR_SETTINGS *EFIAPI | MtrrSetAllMtrrs (IN MTRR_SETTINGS *MtrrSetting) |
UINT32 EFIAPI | MtrrGetMemoryAttributeInVariableMtrr (IN UINT64 MtrrValidBitsMask, IN UINT64 MtrrValidAddressMask, OUT VARIABLE_MTRR *VariableMtrr) |
VOID EFIAPI | MtrrDebugPrintAllMtrrs (VOID) |
BOOLEAN EFIAPI | IsMtrrSupported (VOID) |
MTRR_MEMORY_CACHE_TYPE EFIAPI | MtrrGetDefaultMemoryType (VOID) |
RETURN_STATUS EFIAPI | MtrrSetMemoryAttributeInMtrrSettings (IN OUT MTRR_SETTINGS *MtrrSetting, IN PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN MTRR_MEMORY_CACHE_TYPE Attribute) |
RETURN_STATUS EFIAPI | MtrrSetMemoryAttributesInMtrrSettings (IN OUT MTRR_SETTINGS *MtrrSetting, IN VOID *Scratch, IN OUT UINTN *ScratchSize, IN CONST MTRR_MEMORY_RANGE *Ranges, IN UINTN RangeCount) |
MTRR setting library
Copyright (c) 2008 - 2020, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
#define MTRR_CACHE_INVALID_TYPE 7 |
#define MTRR_CACHE_UNCACHEABLE 0 |
#define MTRR_CACHE_WRITE_BACK 6 |
#define MTRR_CACHE_WRITE_COMBINING 1 |
#define MTRR_CACHE_WRITE_PROTECTED 5 |
#define MTRR_CACHE_WRITE_THROUGH 4 |
#define MTRR_NUMBER_OF_FIXED_MTRR 11 |
#define MTRR_NUMBER_OF_VARIABLE_MTRR 32 |
#define RESERVED_FIRMWARE_VARIABLE_MTRR_NUMBER 2 |
typedef struct _MTRR_FIXED_SETTINGS_ MTRR_FIXED_SETTINGS |
typedef struct _MTRR_SETTINGS_ MTRR_SETTINGS |
typedef struct _MTRR_VARIABLE_SETTING_ MTRR_VARIABLE_SETTING |
typedef struct _MTRR_VARIABLE_SETTINGS_ MTRR_VARIABLE_SETTINGS |
UINT32 EFIAPI GetFirmwareVariableMtrrCount | ( | VOID | ) |
Returns the firmware usable variable MTRR count for the CPU.
UINT32 EFIAPI GetVariableMtrrCount | ( | VOID | ) |
Returns the variable MTRR count for the CPU.
BOOLEAN EFIAPI IsMtrrSupported | ( | VOID | ) |
Checks if MTRR is supported.
TRUE | MTRR is supported. |
FALSE | MTRR is not supported. |
VOID EFIAPI MtrrDebugPrintAllMtrrs | ( | VOID | ) |
This function prints all MTRRs for debugging.
MTRR_SETTINGS* EFIAPI MtrrGetAllMtrrs | ( | OUT MTRR_SETTINGS * | MtrrSetting | ) |
This function gets the content in all MTRRs (variable and fixed)
[out] | MtrrSetting | A buffer to hold all MTRRs content. |
MTRR_MEMORY_CACHE_TYPE EFIAPI MtrrGetDefaultMemoryType | ( | VOID | ) |
Returns the default MTRR cache type for the system.
MTRR_FIXED_SETTINGS* EFIAPI MtrrGetFixedMtrr | ( | OUT MTRR_FIXED_SETTINGS * | FixedSettings | ) |
This function gets the content in fixed MTRRs
[out] | FixedSettings | A buffer to hold fixed MTRRs content. |
MTRR_MEMORY_CACHE_TYPE EFIAPI MtrrGetMemoryAttribute | ( | IN PHYSICAL_ADDRESS | Address | ) |
This function will get the memory cache type of the specific address. This function is mainly for debugging purposes.
[in] | Address | The specific address |
UINT32 EFIAPI MtrrGetMemoryAttributeInVariableMtrr | ( | IN UINT64 | MtrrValidBitsMask, |
IN UINT64 | MtrrValidAddressMask, | ||
OUT VARIABLE_MTRR * | VariableMtrr | ||
) |
Get the attribute of variable MTRRs.
This function shadows the content of variable MTRRs into an internal array: VariableMtrr
[in] | MtrrValidBitsMask | The mask for the valid bit of the MTRR |
[in] | MtrrValidAddressMask | The valid address mask for MTRR since the base address in MTRR must align to 4K, so valid address mask equal to MtrrValidBitsMask & 0xfffffffffffff000ULL |
[out] | VariableMtrr | The array to shadow variable MTRRs content |
MTRR_SETTINGS* EFIAPI MtrrSetAllMtrrs | ( | IN MTRR_SETTINGS * | MtrrSetting | ) |
This function sets all MTRRs (variable and fixed)
[in] | MtrrSetting | A buffer to hold all MTRRs content. |
RETURN_STATUS EFIAPI MtrrSetMemoryAttribute | ( | IN PHYSICAL_ADDRESS | BaseAddress, |
IN UINT64 | Length, | ||
IN MTRR_MEMORY_CACHE_TYPE | Attribute | ||
) |
This function attempts to set the attributes for a memory range.
[in] | BaseAddress | The physical address that is the start address of a memory region. |
[in] | Length | The size in bytes of the memory region. |
[in] | Attribute | The bit mask of attributes to set for the memory region. |
RETURN_SUCCESS | The attributes were set for the memory region. |
RETURN_INVALID_PARAMETER | Length is zero. |
RETURN_UNSUPPORTED | The processor does not support one or more bytes of the memory resource range specified by BaseAddress and Length. |
RETURN_UNSUPPORTED | The bit mask of attributes is not support for the memory resource range specified by BaseAddress and Length. |
RETURN_ACCESS_DENIED | The attributes for the memory resource range specified by BaseAddress and Length cannot be modified. |
RETURN_OUT_OF_RESOURCES | There are not enough system resources to modify the attributes of the memory resource range. Multiple memory range attributes setting by calling this API multiple times may fail with status RETURN_OUT_OF_RESOURCES. It may not mean the number of CPU MTRRs are too small to set such memory attributes. Pass the multiple memory range attributes to one call of MtrrSetMemoryAttributesInMtrrSettings() may succeed. |
RETURN_BUFFER_TOO_SMALL | The fixed internal scratch buffer is too small for MTRR calculation. Caller should use MtrrSetMemoryAttributesInMtrrSettings() to specify external scratch buffer. |
RETURN_STATUS EFIAPI MtrrSetMemoryAttributeInMtrrSettings | ( | IN OUT MTRR_SETTINGS * | MtrrSetting, |
IN PHYSICAL_ADDRESS | BaseAddress, | ||
IN UINT64 | Length, | ||
IN MTRR_MEMORY_CACHE_TYPE | Attribute | ||
) |
This function attempts to set the attributes into MTRR setting buffer for a memory range.
[in,out] | MtrrSetting | MTRR setting buffer to be set. |
[in] | BaseAddress | The physical address that is the start address of a memory region. |
[in] | Length | The size in bytes of the memory region. |
[in] | Attribute | The bit mask of attributes to set for the memory region. |
RETURN_SUCCESS | The attributes were set for the memory region. |
RETURN_INVALID_PARAMETER | Length is zero. |
RETURN_UNSUPPORTED | The processor does not support one or more bytes of the memory resource range specified by BaseAddress and Length. |
RETURN_UNSUPPORTED | The bit mask of attributes is not support for the memory resource range specified by BaseAddress and Length. |
RETURN_ACCESS_DENIED | The attributes for the memory resource range specified by BaseAddress and Length cannot be modified. |
RETURN_OUT_OF_RESOURCES | There are not enough system resources to modify the attributes of the memory resource range. Multiple memory range attributes setting by calling this API multiple times may fail with status RETURN_OUT_OF_RESOURCES. It may not mean the number of CPU MTRRs are too small to set such memory attributes. Pass the multiple memory range attributes to one call of MtrrSetMemoryAttributesInMtrrSettings() may succeed. |
RETURN_BUFFER_TOO_SMALL | The fixed internal scratch buffer is too small for MTRR calculation. Caller should use MtrrSetMemoryAttributesInMtrrSettings() to specify external scratch buffer. |
RETURN_STATUS EFIAPI MtrrSetMemoryAttributesInMtrrSettings | ( | IN OUT MTRR_SETTINGS * | MtrrSetting, |
IN VOID * | Scratch, | ||
IN OUT UINTN * | ScratchSize, | ||
IN CONST MTRR_MEMORY_RANGE * | Ranges, | ||
IN UINTN | RangeCount | ||
) |
This function attempts to set the attributes into MTRR setting buffer for multiple memory ranges.
[in,out] | MtrrSetting | MTRR setting buffer to be set. |
[in] | Scratch | A temporary scratch buffer that is used to perform the calculation. |
[in,out] | ScratchSize | Pointer to the size in bytes of the scratch buffer. It may be updated to the actual required size when the calculation needs more scratch buffer. |
[in] | Ranges | Pointer to an array of MTRR_MEMORY_RANGE. When range overlap happens, the last one takes higher priority. When the function returns, either all the attributes are set successfully, or none of them is set. |
[in] | RangeCount | Count of MTRR_MEMORY_RANGE. |
RETURN_SUCCESS | The attributes were set for all the memory ranges. |
RETURN_INVALID_PARAMETER | Length in any range is zero. |
RETURN_UNSUPPORTED | The processor does not support one or more bytes of the memory resource range specified by BaseAddress and Length in any range. |
RETURN_UNSUPPORTED | The bit mask of attributes is not support for the memory resource range specified by BaseAddress and Length in any range. |
RETURN_OUT_OF_RESOURCES | There are not enough system resources to modify the attributes of the memory resource ranges. |
RETURN_ACCESS_DENIED | The attributes for the memory resource range specified by BaseAddress and Length cannot be modified. |
RETURN_BUFFER_TOO_SMALL | The scratch buffer is too small for MTRR calculation. |