]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UefiCpuPkg/MtrrLib: Add comments to recommend to use batch-set API
authorRuiyu Ni <ruiyu.ni@intel.com>
Thu, 18 Jan 2018 06:13:32 +0000 (14:13 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Wed, 24 Jan 2018 03:13:17 +0000 (11:13 +0800)
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>
UefiCpuPkg/Include/Library/MtrrLib.h
UefiCpuPkg/Library/MtrrLib/MtrrLib.c

index d56f1057e1677551649e710fc233b16dfa662a70..f82c27ea0c7e9bc13e6de66858556220cad8e26a 100644 (file)
@@ -157,6 +157,11 @@ GetFirmwareVariableMtrrCount (
   @retval RETURN_OUT_OF_RESOURCES   There are not enough system resources to\r
                                     modify the attributes of the memory\r
                                     resource range.\r
+                                    Multiple memory range attributes setting by calling this API multiple\r
+                                    times may fail with status RETURN_OUT_OF_RESOURCES. It may not mean\r
+                                    the number of CPU MTRRs are too small to set such memory attributes.\r
+                                    Pass the multiple memory range attributes to one call of\r
+                                    MtrrSetMemoryAttributesInMtrrSettings() may succeed.\r
   @retval RETURN_BUFFER_TOO_SMALL   The fixed internal scratch buffer is too small for MTRR calculation.\r
                                     Caller should use MtrrSetMemoryAttributesInMtrrSettings() to specify\r
                                     external scratch buffer.\r
@@ -354,6 +359,11 @@ MtrrGetDefaultMemoryType (
                                     BaseAddress and Length cannot be modified.\r
   @retval RETURN_OUT_OF_RESOURCES   There are not enough system resources to modify the attributes of\r
                                     the memory resource range.\r
+                                    Multiple memory range attributes setting by calling this API multiple\r
+                                    times may fail with status RETURN_OUT_OF_RESOURCES. It may not mean\r
+                                    the number of CPU MTRRs are too small to set such memory attributes.\r
+                                    Pass the multiple memory range attributes to one call of\r
+                                    MtrrSetMemoryAttributesInMtrrSettings() may succeed.\r
   @retval RETURN_BUFFER_TOO_SMALL   The fixed internal scratch buffer is too small for MTRR calculation.\r
                                     Caller should use MtrrSetMemoryAttributesInMtrrSettings() to specify\r
                                     external scratch buffer.\r
index 2496d08ad4c05db55d59221f31c60a849c550aff..dfce9a996b3b80ae2a1494fabc2aa6e0389ea215 100644 (file)
@@ -2513,6 +2513,11 @@ Exit:
                                     BaseAddress and Length cannot be modified.\r
   @retval RETURN_OUT_OF_RESOURCES   There are not enough system resources to modify the attributes of\r
                                     the memory resource range.\r
+                                    Multiple memory range attributes setting by calling this API multiple\r
+                                    times may fail with status RETURN_OUT_OF_RESOURCES. It may not mean\r
+                                    the number of CPU MTRRs are too small to set such memory attributes.\r
+                                    Pass the multiple memory range attributes to one call of\r
+                                    MtrrSetMemoryAttributesInMtrrSettings() may succeed.\r
   @retval RETURN_BUFFER_TOO_SMALL   The fixed internal scratch buffer is too small for MTRR calculation.\r
                                     Caller should use MtrrSetMemoryAttributesInMtrrSettings() to specify\r
                                     external scratch buffer.\r
@@ -2561,6 +2566,11 @@ MtrrSetMemoryAttributeInMtrrSettings (
   @retval RETURN_OUT_OF_RESOURCES   There are not enough system resources to\r
                                     modify the attributes of the memory\r
                                     resource range.\r
+                                    Multiple memory range attributes setting by calling this API multiple\r
+                                    times may fail with status RETURN_OUT_OF_RESOURCES. It may not mean\r
+                                    the number of CPU MTRRs are too small to set such memory attributes.\r
+                                    Pass the multiple memory range attributes to one call of\r
+                                    MtrrSetMemoryAttributesInMtrrSettings() may succeed.\r
   @retval RETURN_BUFFER_TOO_SMALL   The fixed internal scratch buffer is too small for MTRR calculation.\r
                                     Caller should use MtrrSetMemoryAttributesInMtrrSettings() to specify\r
                                     external scratch buffer.\r