]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFsp2Pkg/Include/Library/CacheLib.h
Add IntelFsp2Pkg and IntelFsp2WrapperPkg.
[mirror_edk2.git] / IntelFsp2Pkg / Include / Library / CacheLib.h
diff --git a/IntelFsp2Pkg/Include/Library/CacheLib.h b/IntelFsp2Pkg/Include/Library/CacheLib.h
new file mode 100644 (file)
index 0000000..909ae92
--- /dev/null
@@ -0,0 +1,62 @@
+/** @file\r
+\r
+  Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\r
+  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
+  http://opensource.org/licenses/bsd-license.php.\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef _CACHE_LIB_H_\r
+#define _CACHE_LIB_H_\r
+\r
+//\r
+// EFI_MEMORY_CACHE_TYPE\r
+//\r
+typedef INT32 EFI_MEMORY_CACHE_TYPE;\r
+\r
+#define EFI_CACHE_UNCACHEABLE                 0\r
+#define EFI_CACHE_WRITECOMBINING              1\r
+#define EFI_CACHE_WRITETHROUGH                4\r
+#define EFI_CACHE_WRITEPROTECTED              5\r
+#define EFI_CACHE_WRITEBACK                   6\r
+\r
+/**\r
+ Reset all the MTRRs to a known state.\r
+\r
+  @retval  EFI_SUCCESS All MTRRs have been reset successfully.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+ResetCacheAttributes (\r
+  VOID\r
+  );\r
+\r
+/**\r
+  Given the memory range and cache type, programs the MTRRs.\r
+\r
+  @param[in] MemoryAddress           Base Address of Memory to program MTRR.\r
+  @param[in] MemoryLength            Length of Memory to program MTRR.\r
+  @param[in] MemoryCacheType         Cache Type.\r
+\r
+  @retval EFI_SUCCESS            Mtrr are set successfully.\r
+  @retval EFI_LOAD_ERROR         No empty MTRRs to use.\r
+  @retval EFI_INVALID_PARAMETER  The input parameter is not valid.\r
+  @retval others                 An error occurs when setting MTTR.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SetCacheAttributes (\r
+  IN  EFI_PHYSICAL_ADDRESS      MemoryAddress,\r
+  IN  UINT64                    MemoryLength,\r
+  IN  EFI_MEMORY_CACHE_TYPE     MemoryCacheType\r
+  );\r
+\r
+#endif\r
+\r