| 1 | /* |
| 2 | * arch/ubicom32/include/asm/pgtable.h |
| 3 | * Ubicom32 pseudo page table definitions and operations. |
| 4 | * |
| 5 | * (C) Copyright 2009, Ubicom, Inc. |
| 6 | * Copyright (C) 2004 Microtronix Datacom Ltd |
| 7 | * |
| 8 | * This file is part of the Ubicom32 Linux Kernel Port. |
| 9 | * |
| 10 | * The Ubicom32 Linux Kernel Port is free software: you can redistribute |
| 11 | * it and/or modify it under the terms of the GNU General Public License |
| 12 | * as published by the Free Software Foundation, either version 2 of the |
| 13 | * License, or (at your option) any later version. |
| 14 | * |
| 15 | * The Ubicom32 Linux Kernel Port is distributed in the hope that it |
| 16 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied |
| 17 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See |
| 18 | * the GNU General Public License for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU General Public License |
| 21 | * along with the Ubicom32 Linux Kernel Port. If not, |
| 22 | * see <http://www.gnu.org/licenses/>. |
| 23 | * |
| 24 | * Ubicom32 implementation derived from (with many thanks): |
| 25 | * arch/m68knommu |
| 26 | * arch/blackfin |
| 27 | * arch/parisc |
| 28 | * and various works, Alpha, ix86, M68K, Sparc, ...et al |
| 29 | */ |
| 30 | #ifndef _ASM_UBICOM32_PGTABLE_H |
| 31 | #define _ASM_UBICOM32_PGTABLE_H |
| 32 | |
| 33 | #include <asm-generic/4level-fixup.h> |
| 34 | |
| 35 | //vic - this bit copied from m68knommu version |
| 36 | #include <asm/setup.h> |
| 37 | #include <asm/io.h> |
| 38 | #include <linux/sched.h> |
| 39 | |
| 40 | typedef pte_t *pte_addr_t; |
| 41 | |
| 42 | #define pgd_present(pgd) (1) /* pages are always present on NO_MM */ |
| 43 | #define pgd_none(pgd) (0) |
| 44 | #define pgd_bad(pgd) (0) |
| 45 | #define pgd_clear(pgdp) |
| 46 | #define kern_addr_valid(addr) (1) |
| 47 | #define pmd_offset(a, b) ((void *)0) |
| 48 | |
| 49 | #define PAGE_NONE __pgprot(0) /* these mean nothing to NO_MM */ |
| 50 | #define PAGE_SHARED __pgprot(0) /* these mean nothing to NO_MM */ |
| 51 | #define PAGE_COPY __pgprot(0) /* these mean nothing to NO_MM */ |
| 52 | #define PAGE_READONLY __pgprot(0) /* these mean nothing to NO_MM */ |
| 53 | #define PAGE_KERNEL __pgprot(0) /* these mean nothing to NO_MM */ |
| 54 | //vic - this bit copied from m68knommu version |
| 55 | |
| 56 | extern void paging_init(void); |
| 57 | #define swapper_pg_dir ((pgd_t *) 0) |
| 58 | |
| 59 | #define __swp_type(x) (0) |
| 60 | #define __swp_offset(x) (0) |
| 61 | #define __swp_entry(typ,off) ((swp_entry_t) { ((typ) | ((off) << 7)) }) |
| 62 | #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) |
| 63 | #define __swp_entry_to_pte(x) ((pte_t) { (x).val }) |
| 64 | |
| 65 | /* |
| 66 | * pgprot_noncached() is only for infiniband pci support, and a real |
| 67 | * implementation for RAM would be more complicated. |
| 68 | */ |
| 69 | #define pgprot_noncached(prot) (prot) |
| 70 | |
| 71 | static inline int pte_file(pte_t pte) { return 0; } |
| 72 | |
| 73 | /* |
| 74 | * ZERO_PAGE is a global shared page that is always zero: used |
| 75 | * for zero-mapped memory areas etc.. |
| 76 | */ |
| 77 | #define ZERO_PAGE(vaddr) (virt_to_page(0)) |
| 78 | |
| 79 | extern unsigned int kobjsize(const void *objp); |
| 80 | extern int is_in_rom(unsigned long); |
| 81 | |
| 82 | /* |
| 83 | * No page table caches to initialise |
| 84 | */ |
| 85 | #define pgtable_cache_init() do { } while (0) |
| 86 | |
| 87 | #define io_remap_pfn_range(vma, vaddr, pfn, size, prot) \ |
| 88 | remap_pfn_range(vma, vaddr, pfn, size, prot) |
| 89 | |
| 90 | extern inline void flush_cache_mm(struct mm_struct *mm) |
| 91 | { |
| 92 | } |
| 93 | |
| 94 | extern inline void flush_cache_range(struct mm_struct *mm, |
| 95 | unsigned long start, |
| 96 | unsigned long end) |
| 97 | { |
| 98 | } |
| 99 | |
| 100 | /* Push the page at kernel virtual address and clear the icache */ |
| 101 | extern inline void flush_page_to_ram (unsigned long address) |
| 102 | { |
| 103 | } |
| 104 | |
| 105 | /* Push n pages at kernel virtual address and clear the icache */ |
| 106 | extern inline void flush_pages_to_ram (unsigned long address, int n) |
| 107 | { |
| 108 | } |
| 109 | |
| 110 | /* |
| 111 | * All 32bit addresses are effectively valid for vmalloc... |
| 112 | * Sort of meaningless for non-VM targets. |
| 113 | */ |
| 114 | #define VMALLOC_START 0 |
| 115 | #define VMALLOC_END 0xffffffff |
| 116 | |
| 117 | #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,32) |
| 118 | #include <asm-generic/pgtable.h> |
| 119 | #else |
| 120 | #define arch_enter_lazy_mmu_mode() do {} while (0) |
| 121 | #define arch_leave_lazy_mmu_mode() do {} while (0) |
| 122 | #define arch_flush_lazy_mmu_mode() do {} while (0) |
| 123 | #define arch_enter_lazy_cpu_mode() do {} while (0) |
| 124 | #define arch_leave_lazy_cpu_mode() do {} while (0) |
| 125 | #define arch_flush_lazy_cpu_mode() do {} while (0) |
| 126 | #endif |
| 127 | |
| 128 | #endif /* _ASM_UBICOM32_PGTABLE_H */ |
| 129 | |