2 * include/asm-xtensa/highmem.h
4 * This file is subject to the terms and conditions of the GNU General
5 * Public License. See the file "COPYING" in the main directory of
6 * this archive for more details.
8 * Copyright (C) 2003 - 2005 Tensilica Inc.
9 * Copyright (C) 2014 Cadence Design Systems Inc.
12 #ifndef _XTENSA_HIGHMEM_H
13 #define _XTENSA_HIGHMEM_H
16 #include <linux/wait.h>
17 #include <linux/pgtable.h>
18 #include <asm/cacheflush.h>
19 #include <asm/fixmap.h>
21 #define PKMAP_BASE ((FIXADDR_START - \
22 (LAST_PKMAP + 1) * PAGE_SIZE) & PMD_MASK)
23 #define LAST_PKMAP (PTRS_PER_PTE * DCACHE_N_COLORS)
24 #define LAST_PKMAP_MASK (LAST_PKMAP - 1)
25 #define PKMAP_NR(virt) (((virt) - PKMAP_BASE) >> PAGE_SHIFT)
26 #define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT))
28 #define kmap_prot PAGE_KERNEL_EXEC
30 #if DCACHE_WAY_SIZE > PAGE_SIZE
31 #define get_pkmap_color get_pkmap_color
32 static inline int get_pkmap_color(struct page
*page
)
34 return DCACHE_ALIAS(page_to_phys(page
));
37 extern unsigned int last_pkmap_nr_arr
[];
39 static inline unsigned int get_next_pkmap_nr(unsigned int color
)
41 last_pkmap_nr_arr
[color
] =
42 (last_pkmap_nr_arr
[color
] + DCACHE_N_COLORS
) & LAST_PKMAP_MASK
;
43 return last_pkmap_nr_arr
[color
] + color
;
46 static inline int no_more_pkmaps(unsigned int pkmap_nr
, unsigned int color
)
48 return pkmap_nr
< DCACHE_N_COLORS
;
51 static inline int get_pkmap_entries_count(unsigned int color
)
53 return LAST_PKMAP
/ DCACHE_N_COLORS
;
56 extern wait_queue_head_t pkmap_map_wait_arr
[];
58 static inline wait_queue_head_t
*get_pkmap_wait_queue_head(unsigned int color
)
60 return pkmap_map_wait_arr
+ color
;
63 enum fixed_addresses
kmap_local_map_idx(int type
, unsigned long pfn
);
64 #define arch_kmap_local_map_idx kmap_local_map_idx
66 enum fixed_addresses
kmap_local_unmap_idx(int type
, unsigned long addr
);
67 #define arch_kmap_local_unmap_idx kmap_local_unmap_idx
71 extern pte_t
*pkmap_page_table
;
73 static inline void flush_cache_kmaps(void)
78 #define arch_kmap_local_post_unmap(vaddr) \
79 local_flush_tlb_kernel_range(vaddr, vaddr + PAGE_SIZE)
83 #endif /* CONFIG_HIGHMEM */