]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFspPkg/Include/Library/CacheLib.h
IntelFspPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / IntelFspPkg / Include / Library / CacheLib.h
1 /** @file
2
3 Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
4 SPDX-License-Identifier: BSD-2-Clause-Patent
5
6 **/
7
8 #ifndef _CACHE_LIB_H_
9 #define _CACHE_LIB_H_
10
11 //
12 // EFI_MEMORY_CACHE_TYPE
13 //
14 typedef INT32 EFI_MEMORY_CACHE_TYPE;
15
16 #define EFI_CACHE_UNCACHEABLE 0
17 #define EFI_CACHE_WRITECOMBINING 1
18 #define EFI_CACHE_WRITETHROUGH 4
19 #define EFI_CACHE_WRITEPROTECTED 5
20 #define EFI_CACHE_WRITEBACK 6
21
22 /**
23 Reset all the MTRRs to a known state.
24
25 @retval EFI_SUCCESS All MTRRs have been reset successfully.
26
27 **/
28 EFI_STATUS
29 EFIAPI
30 ResetCacheAttributes (
31 VOID
32 );
33
34 /**
35 Given the memory range and cache type, programs the MTRRs.
36
37 @param[in] MemoryAddress Base Address of Memory to program MTRR.
38 @param[in] MemoryLength Length of Memory to program MTRR.
39 @param[in] MemoryCacheType Cache Type.
40
41 @retval EFI_SUCCESS Mtrr are set successfully.
42 @retval EFI_LOAD_ERROR No empty MTRRs to use.
43 @retval EFI_INVALID_PARAMETER The input parameter is not valid.
44 @retval others An error occurs when setting MTTR.
45
46 **/
47 EFI_STATUS
48 EFIAPI
49 SetCacheAttributes (
50 IN EFI_PHYSICAL_ADDRESS MemoryAddress,
51 IN UINT64 MemoryLength,
52 IN EFI_MEMORY_CACHE_TYPE MemoryCacheType
53 );
54
55 #endif
56