summaryrefslogtreecommitdiffstats
path: root/UefiCpuPkg/Include
diff options
context:
space:
mode:
authorYuanhaoXie <yuanhao.xie@intel.com>2023-09-11 18:41:34 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2023-10-09 08:22:02 +0000
commit4b7b32f846edbd2970f5b7c34041c2abe9d0724e (patch)
treec2e2dad82cc5f23a974de51ee4449e5d85f27294 /UefiCpuPkg/Include
parentc032db330805993bb29e4ff3d9daad160f3fb35e (diff)
downloadedk2-4b7b32f846edbd2970f5b7c34041c2abe9d0724e.tar.gz
edk2-4b7b32f846edbd2970f5b7c34041c2abe9d0724e.tar.bz2
edk2-4b7b32f846edbd2970f5b7c34041c2abe9d0724e.zip
UefiCpuPkg/MtrrLib: Add API MtrrGetMemoryAttributesInMtrrSettings.
MtrrGetMemoryAttributesInMtrrSettings parses the MTRR settings either from hardware or from the parameter and returns an array containing the memory cache types of all memory addresses. This API could elinimate the needs of following APIs: 1. MtrrGetMemoryAttributeInVariableMtr 2. MtrrGetFixedMtrr Signed-off-by: Ray Ni <ray.ni@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Rahul Kumar <rahul1.kumar@intel.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
Diffstat (limited to 'UefiCpuPkg/Include')
-rw-r--r--UefiCpuPkg/Include/Library/MtrrLib.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/UefiCpuPkg/Include/Library/MtrrLib.h b/UefiCpuPkg/Include/Library/MtrrLib.h
index 94cf615901..86cc1aab3b 100644
--- a/UefiCpuPkg/Include/Library/MtrrLib.h
+++ b/UefiCpuPkg/Include/Library/MtrrLib.h
@@ -359,4 +359,27 @@ MtrrSetMemoryAttributesInMtrrSettings (
IN UINTN RangeCount
);
+/**
+ This function returns a Ranges array containing the memory cache types
+ of all memory addresses.
+
+ @param[in] MtrrSetting MTRR setting buffer to parse.
+ @param[out] Ranges Pointer to an array of MTRR_MEMORY_RANGE.
+ @param[in,out] RangeCount Count of MTRR_MEMORY_RANGE.
+ On input, the maximum entries the Ranges can hold.
+ On output, the actual entries that the function returns.
+
+ @retval RETURN_INVALID_PARAMETER RangeCount is NULL.
+ @retval RETURN_INVALID_PARAMETER *RangeCount is not 0 but Ranges is NULL.
+ @retval RETURN_BUFFER_TOO_SMALL *RangeCount is too small.
+ @retval RETURN_SUCCESS Ranges are successfully returned.
+**/
+RETURN_STATUS
+EFIAPI
+MtrrGetMemoryAttributesInMtrrSettings (
+ IN CONST MTRR_SETTINGS *MtrrSetting OPTIONAL,
+ OUT MTRR_MEMORY_RANGE *Ranges,
+ IN OUT UINTN *RangeCount
+ );
+
#endif // _MTRR_LIB_H_