]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UefiCpuPkg/Include/Library/MtrrLib.h
Fixed GCC 4.4 build issues due to EFIAPI not being used when required.
[mirror_edk2.git] / UefiCpuPkg / Include / Library / MtrrLib.h
index 14453719bf6ec0ac6592322caa75f4302514a3c1..b34384b14ce79be13dd06c006e07c48a3c634db9 100644 (file)
 //\r
 \r
 //\r
-// We can not use Pcd as macro to define structure, so we have to define MAX_MTRR_NUMBER_OF_VARIABLE_MTRR\r
+// The semantics of below macro is MAX_MTRR_NUMBER_OF_VARIABLE_MTRR, the real number can be read out from MTRR_CAP register.\r
 //\r
-#define  MAX_MTRR_NUMBER_OF_VARIABLE_MTRR  32\r
+#define  MTRR_NUMBER_OF_VARIABLE_MTRR  32\r
 //\r
 // Firmware need reserve 2 MTRR for OS\r
 //\r
 #define  RESERVED_FIRMWARE_VARIABLE_MTRR_NUMBER  2\r
 \r
 #define  MTRR_NUMBER_OF_FIXED_MTRR      11\r
+//\r
+// Below macro is deprecated, and should not be used.\r
+//\r
+#define  FIRMWARE_VARIABLE_MTRR_NUMBER  6\r
 #define  MTRR_LIB_IA32_MTRR_CAP                      0x0FE\r
 #define  MTRR_LIB_IA32_MTRR_CAP_VCNT_MASK            0x0FF\r
 #define  MTRR_LIB_IA32_MTRR_FIX64K_00000             0x250\r
 #define  MTRR_LIB_IA32_MTRR_FIX4K_F0000              0x26E\r
 #define  MTRR_LIB_IA32_MTRR_FIX4K_F8000              0x26F\r
 #define  MTRR_LIB_IA32_VARIABLE_MTRR_BASE            0x200\r
+//\r
+// Below macro is deprecated, and should not be used.\r
+//\r
+#define  MTRR_LIB_IA32_VARIABLE_MTRR_END             0x20F\r
 #define  MTRR_LIB_IA32_MTRR_DEF_TYPE                 0x2FF\r
 #define  MTRR_LIB_MSR_VALID_MASK                     0xFFFFFFFFFULL\r
 #define  MTRR_LIB_CACHE_VALID_ADDRESS                0xFFFFFF000ULL\r
@@ -83,7 +91,7 @@ typedef struct _MTRR_VARIABLE_SETTING_ {
 // Array for variable MTRRs\r
 //\r
 typedef struct _MTRR_VARIABLE_SETTINGS_ {\r
-       MTRR_VARIABLE_SETTING   Mtrr[MAX_MTRR_NUMBER_OF_VARIABLE_MTRR];\r
+       MTRR_VARIABLE_SETTING   Mtrr[MTRR_NUMBER_OF_VARIABLE_MTRR];\r
 }      MTRR_VARIABLE_SETTINGS;\r
 \r
 //\r
@@ -127,6 +135,7 @@ typedef enum {
 \r
 **/\r
 UINT32\r
+EFIAPI\r
 GetVariableMtrrCount (\r
   VOID\r
   );\r
@@ -138,6 +147,7 @@ GetVariableMtrrCount (
 \r
 **/\r
 UINT32\r
+EFIAPI\r
 GetFirmwareVariableMtrrCount (\r
   VOID\r
   );\r
@@ -282,25 +292,19 @@ MtrrSetAllMtrrs (
   This function shadows the content of variable MTRRs into\r
   an internal array: VariableMtrr\r
 \r
-  @param  MtrrValidBitsMask        The mask for the valid bit of the MTRR\r
-  @param  MtrrValidAddressMask     The valid address mask for MTRR since the base address in\r
-                                   MTRR must align to 4K, so valid address mask equal to\r
-                                   MtrrValidBitsMask & 0xfffffffffffff000ULL\r
-  @param  VariableMtrrCount        On input, it means the array number of variable MTRRs passed in.\r
-                                   On output, it means the number of MTRRs which has been used if EFI_SUCCESS,\r
-                                   or the number of MTRR required if BUFFER_TOO_SMALL.\r
-  @param  VariableMtrr             The array to shadow variable MTRRs content\r
-\r
-  @retval RETURN_SUCCESS           The variable MTRRs are returned.\r
-  @retval RETURN_BUFFER_TOO_SMALL  The input buffer is too small to hold the variable MTRRs.\r
-\r
+  @param  MtrrValidBitsMask     The mask for the valid bit of the MTRR\r
+  @param  MtrrValidAddressMask  The valid address mask for MTRR since the base address in\r
+                                MTRR must align to 4K, so valid address mask equal to\r
+                                MtrrValidBitsMask & 0xfffffffffffff000ULL\r
+  @param  VariableMtrr          The array to shadow variable MTRRs content\r
+  @return                       The ruturn value of this paramter indicates the number of\r
+                                MTRRs which has been used.\r
 **/\r
-RETURN_STATUS\r
+UINT32\r
 EFIAPI\r
 MtrrGetMemoryAttributeInVariableMtrr (\r
   IN  UINT64                    MtrrValidBitsMask,\r
   IN  UINT64                    MtrrValidAddressMask,\r
-  IN OUT UINT32                 *VariableMtrrCount,\r
   OUT VARIABLE_MTRR             *VariableMtrr\r
   );\r
 \r
@@ -309,7 +313,21 @@ MtrrGetMemoryAttributeInVariableMtrr (
   This function prints all MTRRs for debugging.\r
 **/\r
 VOID\r
+EFIAPI\r
 MtrrDebugPrintAllMtrrs (\r
   );\r
 \r
+/**\r
+  Checks if MTRR is supported.\r
+\r
+  @retval TRUE  MTRR is supported.\r
+  @retval FALSE MTRR is not supported.\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+IsMtrrSupported (\r
+  VOID\r
+  );\r
+\r
 #endif // _MTRR_LIB_H_\r