.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (C) 2008-2009 Michal Simek <monstr@monstr.eu> |
---|
3 | 4 | * Copyright (C) 2008-2009 PetaLogix |
---|
4 | 5 | * Copyright (C) 2006 Atmark Techno, Inc. |
---|
5 | | - * |
---|
6 | | - * This file is subject to the terms and conditions of the GNU General Public |
---|
7 | | - * License. See the file "COPYING" in the main directory of this archive |
---|
8 | | - * for more details. |
---|
9 | 6 | */ |
---|
10 | 7 | |
---|
11 | 8 | #ifndef _ASM_MICROBLAZE_PGTABLE_H |
---|
.. | .. |
---|
24 | 21 | #define pgd_bad(pgd) (0) |
---|
25 | 22 | #define pgd_clear(pgdp) |
---|
26 | 23 | #define kern_addr_valid(addr) (1) |
---|
27 | | -#define pmd_offset(a, b) ((void *) 0) |
---|
28 | 24 | |
---|
29 | 25 | #define PAGE_NONE __pgprot(0) /* these mean nothing to non MMU */ |
---|
30 | 26 | #define PAGE_SHARED __pgprot(0) /* these mean nothing to non MMU */ |
---|
.. | .. |
---|
46 | 42 | |
---|
47 | 43 | #define swapper_pg_dir ((pgd_t *) NULL) |
---|
48 | 44 | |
---|
49 | | -#define pgtable_cache_init() do {} while (0) |
---|
50 | | - |
---|
51 | 45 | #define arch_enter_lazy_cpu_mode() do {} while (0) |
---|
52 | 46 | |
---|
53 | 47 | #define pgprot_noncached_wc(prot) prot |
---|
.. | .. |
---|
61 | 55 | |
---|
62 | 56 | #else /* CONFIG_MMU */ |
---|
63 | 57 | |
---|
64 | | -#include <asm-generic/4level-fixup.h> |
---|
65 | | - |
---|
66 | | -#define __PAGETABLE_PMD_FOLDED 1 |
---|
| 58 | +#include <asm-generic/pgtable-nopmd.h> |
---|
67 | 59 | |
---|
68 | 60 | #ifdef __KERNEL__ |
---|
69 | 61 | #ifndef __ASSEMBLY__ |
---|
.. | .. |
---|
83 | 75 | * The following only work if pte_present() is true. |
---|
84 | 76 | * Undefined behaviour if not.. |
---|
85 | 77 | */ |
---|
86 | | - |
---|
87 | | -static inline int pte_special(pte_t pte) { return 0; } |
---|
88 | | - |
---|
89 | | -static inline pte_t pte_mkspecial(pte_t pte) { return pte; } |
---|
90 | 78 | |
---|
91 | 79 | /* Start and end of the vmalloc area. */ |
---|
92 | 80 | /* Make sure to map the vmalloc area above the pinned kernel memory area |
---|
.. | .. |
---|
140 | 128 | * |
---|
141 | 129 | */ |
---|
142 | 130 | |
---|
143 | | -/* PMD_SHIFT determines the size of the area mapped by the PTE pages */ |
---|
144 | | -#define PMD_SHIFT (PAGE_SHIFT + PTE_SHIFT) |
---|
145 | | -#define PMD_SIZE (1UL << PMD_SHIFT) |
---|
146 | | -#define PMD_MASK (~(PMD_SIZE-1)) |
---|
147 | | - |
---|
148 | 131 | /* PGDIR_SHIFT determines what a top-level page table entry can map */ |
---|
149 | | -#define PGDIR_SHIFT PMD_SHIFT |
---|
| 132 | +#define PGDIR_SHIFT (PAGE_SHIFT + PTE_SHIFT) |
---|
150 | 133 | #define PGDIR_SIZE (1UL << PGDIR_SHIFT) |
---|
151 | 134 | #define PGDIR_MASK (~(PGDIR_SIZE-1)) |
---|
152 | 135 | |
---|
.. | .. |
---|
167 | 150 | #define pte_ERROR(e) \ |
---|
168 | 151 | printk(KERN_ERR "%s:%d: bad pte "PTE_FMT".\n", \ |
---|
169 | 152 | __FILE__, __LINE__, pte_val(e)) |
---|
170 | | -#define pmd_ERROR(e) \ |
---|
171 | | - printk(KERN_ERR "%s:%d: bad pmd %08lx.\n", \ |
---|
172 | | - __FILE__, __LINE__, pmd_val(e)) |
---|
173 | 153 | #define pgd_ERROR(e) \ |
---|
174 | 154 | printk(KERN_ERR "%s:%d: bad pgd %08lx.\n", \ |
---|
175 | 155 | __FILE__, __LINE__, pgd_val(e)) |
---|
.. | .. |
---|
200 | 180 | * is cleared in the TLB miss handler before the TLB entry is loaded. |
---|
201 | 181 | * - All other bits of the PTE are loaded into TLBLO without |
---|
202 | 182 | * * modification, leaving us only the bits 20, 21, 24, 25, 26, 30 for |
---|
203 | | - * software PTE bits. We actually use use bits 21, 24, 25, and |
---|
| 183 | + * software PTE bits. We actually use bits 21, 24, 25, and |
---|
204 | 184 | * 30 respectively for the software bits: ACCESSED, DIRTY, RW, and |
---|
205 | 185 | * PRESENT. |
---|
206 | 186 | */ |
---|
.. | .. |
---|
315 | 295 | __pte(((pte_basic_t)(pfn) << PFN_SHIFT_OFFSET) | pgprot_val(prot)) |
---|
316 | 296 | |
---|
317 | 297 | #ifndef __ASSEMBLY__ |
---|
318 | | -/* |
---|
319 | | - * The "pgd_xxx()" functions here are trivial for a folded two-level |
---|
320 | | - * setup: the pgd is never bad, and a pmd always exists (as it's folded |
---|
321 | | - * into the pgd entry) |
---|
322 | | - */ |
---|
323 | | -static inline int pgd_none(pgd_t pgd) { return 0; } |
---|
324 | | -static inline int pgd_bad(pgd_t pgd) { return 0; } |
---|
325 | | -static inline int pgd_present(pgd_t pgd) { return 1; } |
---|
326 | | -#define pgd_clear(xp) do { } while (0) |
---|
327 | | -#define pgd_page(pgd) \ |
---|
328 | | - ((unsigned long) __va(pgd_val(pgd) & PAGE_MASK)) |
---|
329 | | - |
---|
330 | 298 | /* |
---|
331 | 299 | * The following only work if pte_present() is true. |
---|
332 | 300 | * Undefined behaviour if not.. |
---|
.. | .. |
---|
469 | 437 | /* Convert pmd entry to page */ |
---|
470 | 438 | /* our pmd entry is an effective address of pte table*/ |
---|
471 | 439 | /* returns effective address of the pmd entry*/ |
---|
472 | | -#define pmd_page_kernel(pmd) ((unsigned long) (pmd_val(pmd) & PAGE_MASK)) |
---|
| 440 | +static inline unsigned long pmd_page_vaddr(pmd_t pmd) |
---|
| 441 | +{ |
---|
| 442 | + return ((unsigned long) (pmd_val(pmd) & PAGE_MASK)); |
---|
| 443 | +} |
---|
473 | 444 | |
---|
474 | 445 | /* returns struct *page of the pmd entry*/ |
---|
475 | 446 | #define pmd_page(pmd) (pfn_to_page(__pa(pmd_val(pmd)) >> PAGE_SHIFT)) |
---|
476 | 447 | |
---|
477 | | -/* to find an entry in a kernel page-table-directory */ |
---|
478 | | -#define pgd_offset_k(address) pgd_offset(&init_mm, address) |
---|
479 | | - |
---|
480 | | -/* to find an entry in a page-table-directory */ |
---|
481 | | -#define pgd_index(address) ((address) >> PGDIR_SHIFT) |
---|
482 | | -#define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address)) |
---|
483 | | - |
---|
484 | | -/* Find an entry in the second-level page table.. */ |
---|
485 | | -static inline pmd_t *pmd_offset(pgd_t *dir, unsigned long address) |
---|
486 | | -{ |
---|
487 | | - return (pmd_t *) dir; |
---|
488 | | -} |
---|
489 | | - |
---|
490 | 448 | /* Find an entry in the third-level page table.. */ |
---|
491 | | -#define pte_index(address) \ |
---|
492 | | - (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) |
---|
493 | | -#define pte_offset_kernel(dir, addr) \ |
---|
494 | | - ((pte_t *) pmd_page_kernel(*(dir)) + pte_index(addr)) |
---|
495 | | -#define pte_offset_map(dir, addr) \ |
---|
496 | | - ((pte_t *) kmap_atomic(pmd_page(*(dir))) + pte_index(addr)) |
---|
497 | | - |
---|
498 | | -#define pte_unmap(pte) kunmap_atomic(pte) |
---|
499 | 449 | |
---|
500 | 450 | extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; |
---|
501 | 451 | |
---|
.. | .. |
---|
526 | 476 | /* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ |
---|
527 | 477 | #define kern_addr_valid(addr) (1) |
---|
528 | 478 | |
---|
529 | | -/* |
---|
530 | | - * No page table caches to initialise |
---|
531 | | - */ |
---|
532 | | -#define pgtable_cache_init() do { } while (0) |
---|
533 | | - |
---|
534 | 479 | void do_page_fault(struct pt_regs *regs, unsigned long address, |
---|
535 | 480 | unsigned long error_code); |
---|
536 | 481 | |
---|
.. | .. |
---|
549 | 494 | #endif /* CONFIG_MMU */ |
---|
550 | 495 | |
---|
551 | 496 | #ifndef __ASSEMBLY__ |
---|
552 | | -#include <asm-generic/pgtable.h> |
---|
553 | | - |
---|
554 | 497 | extern unsigned long ioremap_bot, ioremap_base; |
---|
555 | | - |
---|
556 | | -unsigned long consistent_virt_to_pfn(void *vaddr); |
---|
557 | 498 | |
---|
558 | 499 | void setup_memory(void); |
---|
559 | 500 | #endif /* __ASSEMBLY__ */ |
---|