]> 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 c81c49bd1d6976bf53dc1028a098a6ad5f03c52b..b34384b14ce79be13dd06c006e07c48a3c634db9 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   MTRR setting library\r
 \r
-  Copyright (c) 2008 - 2009, Intel Corporation\r
+  Copyright (c) 2008 - 2010, Intel Corporation\r
   All rights reserved. This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
 // According to IA32 SDM, MTRRs number and msr offset are always consistent\r
 // for IA32 processor family\r
 //\r
-#define  MTRR_NUMBER_OF_VARIABLE_MTRR   8\r
+\r
+//\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  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_FIX16K_80000             0x258\r
 #define  MTRR_LIB_IA32_MTRR_FIX16K_A0000             0x259\r
@@ -34,6 +48,9 @@
 #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
@@ -111,15 +128,29 @@ typedef enum {
 #define  MTRR_CACHE_WRITE_BACK       6\r
 #define  MTRR_CACHE_INVALID_TYPE     7\r
 \r
-//\r
-// structure for memory attribute descriptor according MTRR setting\r
-//\r
-typedef struct _MTRR_MEMORY_ATTRIBUTE_MAP_ {\r
-       PHYSICAL_ADDRESS       StartAddress;\r
-       PHYSICAL_ADDRESS       EndAddress;\r
-       MTRR_MEMORY_CACHE_TYPE Attribute;\r
-} MTRR_MEMORY_ATTRIBUTE_MAP;\r
+/**\r
+  Returns the variable MTRR count for the CPU.\r
+\r
+  @return Variable MTRR count\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+GetVariableMtrrCount (\r
+  VOID\r
+  );\r
+\r
+/**\r
+  Returns the firmware usable variable MTRR count for the CPU.\r
+\r
+  @return Firmware usable variable MTRR count\r
 \r
+**/\r
+UINT32\r
+EFIAPI\r
+GetFirmwareVariableMtrrCount (\r
+  VOID\r
+  );\r
 \r
 /**\r
   This function attempts to set the attributes for a memory range.\r
@@ -282,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