1 /*
2  * Copyright 2022 NXP
3  * All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  */
7 
8 #include "fsl_cache.h"
9 #include "cache_armv8a.h"
10 
11 /* Component ID definition, used by tools. */
12 #ifndef FSL_COMPONENT_ID
13 #define FSL_COMPONENT_ID "platform.drivers.cache_armv8a"
14 #endif
15 
16 /*!
17  * brief Invalidates all instruction caches by range.
18  *
19  * param address The virtual address.
20  * param size_byte size of the memory to be invalidated.
21  */
ICACHE_InvalidateByRange(uintptr_t address,size_t size_byte)22 void ICACHE_InvalidateByRange(uintptr_t address, size_t size_byte)
23 {
24 	icache_invalidate_range(address, size_byte);
25 }
26 
27 /*!
28  * brief Invalidates all data caches by range.
29  *
30  * param address The virtual address.
31  * param size_byte size of the memory to be invalidated.
32  */
DCACHE_InvalidateByRange(uintptr_t address,size_t size_byte)33 void DCACHE_InvalidateByRange(uintptr_t address, size_t size_byte)
34 {
35 	dcache_invalidate_range(address, size_byte);
36 }
37 
38 /*!
39  * brief Cleans all data caches by range.
40  *
41  * param address The virtual address.
42  * param size_byte size of the memory to be cleaned.
43  */
DCACHE_CleanByRange(uintptr_t address,size_t size_byte)44 void DCACHE_CleanByRange(uintptr_t address, size_t size_byte)
45 {
46 	dcache_clean_range(address, size_byte);
47 }
48 
49 /*!
50  * brief Cleans and Invalidates all data caches by range.
51  *
52  * param address The virtual address.
53  * param size_byte size of the memory to be cleaned and invalidated.
54  */
DCACHE_CleanInvalidateByRange(uintptr_t address,size_t size_byte)55 void DCACHE_CleanInvalidateByRange(uintptr_t address, size_t size_byte)
56 {
57 	dcache_clean_invalidate_range(address, size_byte);
58 }
59