2 * This file is part of the libpayload project.
4 * Copyright (C) 2014 Imagination Technologies
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
16 #ifndef __MIPS_ARCH_CACHE_H__
17 #define __MIPS_ARCH_CACHE_H__
28 /* data memory barrier */
29 static inline void dmb(void)
34 /* data sync barrier */
35 static inline void dsb(void)
40 /* instruction sync barrier */
41 static inline void isb(void)
48 * Cache maintenance API
51 /* dcache clean and invalidate all */
52 void dcache_clean_invalidate_all(void);
54 /* dcache clean all */
55 void dcache_clean_all(void);
57 /* dcache invalidate all (on current level given by CCSELR) */
58 void dcache_invalidate_all(void);
60 /* returns number of bytes per cache line */
61 unsigned int dcache_line_bytes(void);
63 /* dcache and MMU disable */
64 void dcache_mmu_disable(void);
66 /* dcache and MMU enable */
67 void dcache_mmu_enable(void);
69 /* perform all icache/dcache maintenance needed after loading new code */
70 void cache_sync_instructions(void);
72 /* tlb invalidate all */
73 void tlb_invalidate_all(void);
76 * Generalized setup/init functions
79 /* mmu initialization (set page table address, set permissions, etc) */
88 /* disable the mmu for a range. Primarily useful to lock out address 0. */
89 void mmu_disable_range(unsigned long start_mb
, unsigned long size_mb
);
90 /* mmu range configuration (set dcache policy) */
91 void mmu_config_range(unsigned long start_mb
, unsigned long size_mb
,
92 enum dcache_policy policy
);
94 #endif /* __MIPS_ARCH_CACHE_H__ */