1 #ifndef _SPARC_PGTABLE_H
2 #define _SPARC_PGTABLE_H
11 #include <linux/const.h>
18 #include <asm/types.h>
21 #include <asm/oplib.h>
31 #define pte_ERROR(e) __builtin_trap()
32 #define pmd_ERROR(e) __builtin_trap()
33 #define pgd_ERROR(e) __builtin_trap()
36 #define PMD_SIZE (1UL << PMD_SHIFT)
37 #define PMD_MASK (~(PMD_SIZE-1))
38 #define PMD_ALIGN(__addr) (((__addr) + ~PMD_MASK) & PMD_MASK)
39 #define PGDIR_SHIFT SRMMU_PGDIR_SHIFT
40 #define PGDIR_SIZE SRMMU_PGDIR_SIZE
41 #define PGDIR_MASK SRMMU_PGDIR_MASK
42 #define PTRS_PER_PTE 1024
43 #define PTRS_PER_PMD SRMMU_PTRS_PER_PMD
44 #define PTRS_PER_PGD SRMMU_PTRS_PER_PGD
45 #define USER_PTRS_PER_PGD PAGE_OFFSET / SRMMU_PGDIR_SIZE
46 #define FIRST_USER_ADDRESS 0
47 #define PTE_SIZE (PTRS_PER_PTE*4)
49 #define PAGE_NONE SRMMU_PAGE_NONE
50 #define PAGE_SHARED SRMMU_PAGE_SHARED
51 #define PAGE_COPY SRMMU_PAGE_COPY
52 #define PAGE_READONLY SRMMU_PAGE_RDONLY
53 #define PAGE_KERNEL SRMMU_PAGE_KERNEL
57 #define swapper_pg_dir NULL
64 #define __P000 PAGE_NONE
65 #define __P001 PAGE_READONLY
66 #define __P010 PAGE_COPY
67 #define __P011 PAGE_COPY
68 #define __P100 PAGE_READONLY
69 #define __P101 PAGE_READONLY
70 #define __P110 PAGE_COPY
71 #define __P111 PAGE_COPY
73 #define __S000 PAGE_NONE
74 #define __S001 PAGE_READONLY
75 #define __S010 PAGE_SHARED
76 #define __S011 PAGE_SHARED
77 #define __S100 PAGE_READONLY
78 #define __S101 PAGE_READONLY
79 #define __S110 PAGE_SHARED
80 #define __S111 PAGE_SHARED
95 #define ZERO_PAGE(vaddr) (virt_to_page(&empty_zero_page))
102 static inline unsigned long srmmu_swap(
unsigned long *
addr,
unsigned long value)
104 __asm__ __volatile__(
"swap [%2], %0" :
"=&r" (value) :
"0" (value),
"r" (addr));
115 srmmu_swap((
unsigned long *)ptep,
pte_val(pteval));
118 #define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
120 static inline int srmmu_device_memory(
unsigned long x)
122 return ((x & 0xF0000000) != 0);
127 if (srmmu_device_memory(
pmd_val(pmd)))
134 if (srmmu_device_memory(
pgd_val(pgd))) {
152 static inline void __pte_clear(
pte_t *ptep)
186 return !(
pgd_val(pgd) & 0xFFFFFFF);
266 #define pte_mkspecial(pte) (pte)
268 #define pfn_pte(pfn, prot) mk_pte(pfn_to_page(pfn), prot)
272 if (srmmu_device_memory(
pte_val(pte))) {
283 #define pte_page(pte) pfn_to_page(pte_pfn(pte))
299 static inline pte_t mk_pte_io(
unsigned long page,
pgprot_t pgprot,
int space)
304 #define pgprot_noncached pgprot_noncached
318 #define pgd_index(address) ((address) >> PGDIR_SHIFT)
321 #define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address))
324 #define pgd_offset_k(address) pgd_offset(&init_mm, address)
339 #define pte_offset_map(d, a) pte_offset_kernel(d,a)
340 #define pte_unmap(pte) do{}while(0)
346 #define FAULT_CODE_PROT 0x1
347 #define FAULT_CODE_WRITE 0x2
348 #define FAULT_CODE_USER 0x4
350 #define update_mmu_cache(vma, address, ptep) do { } while (0)
353 unsigned long xva,
unsigned int len);
374 #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
375 #define __swp_entry_to_pte(x) ((pte_t) { (x).val })
391 #define PTE_FILE_MAX_BITS 24
393 static inline unsigned long
394 __get_phys (
unsigned long addr)
399 return ((srmmu_get_pte (addr) & 0xffffff00) << 4);
406 __get_iospace (
unsigned long addr)
411 return (srmmu_get_pte (addr) >> 28);
420 #define kern_addr_valid(addr) \
421 (test_bit(__pa((unsigned long)(addr))>>20, sparc_valid_addr_bitmap))
427 #define MK_IOSPACE_PFN(space, pfn) (pfn | (space << (BITS_PER_LONG - 4)))
428 #define GET_IOSPACE(pfn) (pfn >> (BITS_PER_LONG - 4))
429 #define GET_PFN(pfn) (pfn & 0x0fffffffUL)
435 unsigned long from,
unsigned long pfn,
442 phys_base = offset | (space << 32ULL);
447 #define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
448 #define ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
450 int __changed = !pte_same(*(__ptep), __entry); \
452 set_pte_at((__vma)->vm_mm, (__address), __ptep, __entry); \
453 flush_tlb_page(__vma, __address); \
462 #define VMALLOC_START _AC(0xfe600000,UL)
463 #define VMALLOC_END _AC(0xffc00000,UL)
466 #define HAVE_ARCH_UNMAPPED_AREA
471 #define pgtable_cache_init() do { } while (0)