UefiCpuPkg/MtrrLib: Add comments to recommend to use batch-set API

MtrrSetMemoryAttributesInMtrrSettings() is a batch-set API.
When setting multiple ranges of memory attributes, the single-set
API (MtrrSetMemoryAttributeInMtrrSettings and MtrrSetMemoryAttribute)
may fail, but batch-set API may succeed.
Add comments to recommend caller to use batch-set API when setting
multiple ranges.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Ming Shao <ming.shao@intel.com>
This commit is contained in:
Ruiyu Ni 2018-01-18 14:13:32 +08:00
parent 8b2eb7b3f6
commit bc6a8b78aa
2 changed files with 20 additions and 0 deletions

View File

@ -157,6 +157,11 @@ GetFirmwareVariableMtrrCount (
@retval RETURN_OUT_OF_RESOURCES There are not enough system resources to @retval RETURN_OUT_OF_RESOURCES There are not enough system resources to
modify the attributes of the memory modify the attributes of the memory
resource range. 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.
@retval RETURN_BUFFER_TOO_SMALL The fixed internal scratch buffer is too small for MTRR calculation. @retval RETURN_BUFFER_TOO_SMALL The fixed internal scratch buffer is too small for MTRR calculation.
Caller should use MtrrSetMemoryAttributesInMtrrSettings() to specify Caller should use MtrrSetMemoryAttributesInMtrrSettings() to specify
external scratch buffer. external scratch buffer.
@ -354,6 +359,11 @@ MtrrGetDefaultMemoryType (
BaseAddress and Length cannot be modified. BaseAddress and Length cannot be modified.
@retval RETURN_OUT_OF_RESOURCES There are not enough system resources to modify the attributes of @retval RETURN_OUT_OF_RESOURCES There are not enough system resources to modify the attributes of
the memory resource range. 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.
@retval RETURN_BUFFER_TOO_SMALL The fixed internal scratch buffer is too small for MTRR calculation. @retval RETURN_BUFFER_TOO_SMALL The fixed internal scratch buffer is too small for MTRR calculation.
Caller should use MtrrSetMemoryAttributesInMtrrSettings() to specify Caller should use MtrrSetMemoryAttributesInMtrrSettings() to specify
external scratch buffer. external scratch buffer.

View File

@ -2513,6 +2513,11 @@ Exit:
BaseAddress and Length cannot be modified. BaseAddress and Length cannot be modified.
@retval RETURN_OUT_OF_RESOURCES There are not enough system resources to modify the attributes of @retval RETURN_OUT_OF_RESOURCES There are not enough system resources to modify the attributes of
the memory resource range. 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.
@retval RETURN_BUFFER_TOO_SMALL The fixed internal scratch buffer is too small for MTRR calculation. @retval RETURN_BUFFER_TOO_SMALL The fixed internal scratch buffer is too small for MTRR calculation.
Caller should use MtrrSetMemoryAttributesInMtrrSettings() to specify Caller should use MtrrSetMemoryAttributesInMtrrSettings() to specify
external scratch buffer. external scratch buffer.
@ -2561,6 +2566,11 @@ MtrrSetMemoryAttributeInMtrrSettings (
@retval RETURN_OUT_OF_RESOURCES There are not enough system resources to @retval RETURN_OUT_OF_RESOURCES There are not enough system resources to
modify the attributes of the memory modify the attributes of the memory
resource range. 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.
@retval RETURN_BUFFER_TOO_SMALL The fixed internal scratch buffer is too small for MTRR calculation. @retval RETURN_BUFFER_TOO_SMALL The fixed internal scratch buffer is too small for MTRR calculation.
Caller should use MtrrSetMemoryAttributesInMtrrSettings() to specify Caller should use MtrrSetMemoryAttributesInMtrrSettings() to specify
external scratch buffer. external scratch buffer.