1 /* highmem.h: virtual kernel memory mappings for high memory
3 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 * - Derived from include/asm-i386/highmem.h
7 * See Documentation/frv/mmu-layout.txt for more information.
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
15 #ifndef _ASM_HIGHMEM_H
16 #define _ASM_HIGHMEM_H
20 #include <linux/init.h>
21 #include <linux/highmem.h>
22 #include <asm/mem-layout.h>
23 #include <asm/spr-regs.h>
24 #include <asm/mb-regs.h>
26 #define NR_TLB_LINES 64 /* number of lines in the TLB */
30 #include <linux/interrupt.h>
31 #include <asm/kmap_types.h>
32 #include <asm/pgtable.h>
34 #ifdef CONFIG_DEBUG_HIGHMEM
35 #define HIGHMEM_DEBUG 1
37 #define HIGHMEM_DEBUG 0
40 /* declarations for highmem.c */
41 extern unsigned long highstart_pfn
, highend_pfn
;
43 #define kmap_prot PAGE_KERNEL
44 #define kmap_pte ______kmap_pte_in_TLB
45 extern pte_t
*pkmap_page_table
;
47 #define flush_cache_kmaps() do { } while (0)
50 * Right now we initialize only a single pte table. It can be extended
51 * easily, subsequent pte tables have to be allocated in one physical
54 #define LAST_PKMAP PTRS_PER_PTE
55 #define LAST_PKMAP_MASK (LAST_PKMAP - 1)
56 #define PKMAP_NR(virt) ((virt - PKMAP_BASE) >> PAGE_SHIFT)
57 #define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT))
59 extern void *kmap_high(struct page
*page
);
60 extern void kunmap_high(struct page
*page
);
62 extern void *kmap(struct page
*page
);
63 extern void kunmap(struct page
*page
);
65 #endif /* !__ASSEMBLY__ */
68 * The use of kmap_atomic/kunmap_atomic is discouraged - kmap/kunmap
69 * gives a more generic (and caching) interface. But kmap_atomic can
70 * be used in IRQ contexts, so in some (very limited) cases we need
73 #define KMAP_ATOMIC_CACHE_DAMR 8
77 #define __kmap_atomic_primary(cached, paddr, ampr) \
79 unsigned long damlr, dampr; \
81 dampr = paddr | xAMPRx_L | xAMPRx_M | xAMPRx_S | xAMPRx_SS_16Kb | xAMPRx_V; \
84 asm volatile("movgs %0,dampr"#ampr :: "r"(dampr) : "memory"); \
86 /* cache flush page attachment point */ \
87 asm volatile("movgs %0,iampr"#ampr"\n" \
88 "movgs %0,dampr"#ampr"\n" \
89 :: "r"(dampr) : "memory" \
92 asm("movsg damlr"#ampr",%0" : "=r"(damlr)); \
94 /*printk("DAMR"#ampr": PRIM sl=%d L=%08lx P=%08lx\n", type, damlr, dampr);*/ \
99 #define __kmap_atomic_secondary(slot, paddr) \
101 unsigned long damlr = KMAP_ATOMIC_SECONDARY_FRAME + (slot) * PAGE_SIZE; \
102 unsigned long dampr = paddr | xAMPRx_L | xAMPRx_M | xAMPRx_S | xAMPRx_SS_16Kb | xAMPRx_V; \
104 asm volatile("movgs %0,tplr \n" \
106 "tlbpr %0,gr0,#2,#1" \
107 : : "r"(damlr), "r"(dampr) : "memory"); \
109 /*printk("TLB: SECN sl=%d L=%08lx P=%08lx\n", slot, damlr, dampr);*/ \
114 static inline void *kmap_atomic_primary(struct page
*page
)
119 paddr
= page_to_phys(page
);
121 return __kmap_atomic_primary(1, paddr
, 2);
124 #define __kunmap_atomic_primary(cached, ampr) \
126 asm volatile("movgs gr0,dampr"#ampr"\n" ::: "memory"); \
128 asm volatile("movgs gr0,iampr"#ampr"\n" ::: "memory"); \
131 #define __kunmap_atomic_secondary(slot, vaddr) \
133 asm volatile("tlbpr %0,gr0,#4,#1" : : "r"(vaddr) : "memory"); \
136 static inline void kunmap_atomic_primary(void *kvaddr
)
138 __kunmap_atomic_primary(1, 2);
142 void *kmap_atomic(struct page
*page
);
143 void __kunmap_atomic(void *kvaddr
);
145 #endif /* !__ASSEMBLY__ */
147 #endif /* __KERNEL__ */
149 #endif /* _ASM_HIGHMEM_H */