| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * OpenRISC Linux |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 9 | 10 | * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com> |
|---|
| 10 | 11 | * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se> |
|---|
| 11 | 12 | * et al. |
|---|
| 12 | | - * |
|---|
| 13 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 14 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 15 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 16 | | - * (at your option) any later version. |
|---|
| 17 | 13 | */ |
|---|
| 18 | 14 | |
|---|
| 19 | 15 | /* or32 pgtable.h - macros and functions to manipulate page tables |
|---|
| .. | .. |
|---|
| 25 | 21 | #ifndef __ASM_OPENRISC_PGTABLE_H |
|---|
| 26 | 22 | #define __ASM_OPENRISC_PGTABLE_H |
|---|
| 27 | 23 | |
|---|
| 28 | | -#define __ARCH_USE_5LEVEL_HACK |
|---|
| 29 | 24 | #include <asm-generic/pgtable-nopmd.h> |
|---|
| 30 | 25 | |
|---|
| 31 | 26 | #ifndef __ASSEMBLY__ |
|---|
| .. | .. |
|---|
| 101 | 96 | /* Define some higher level generic page attributes. |
|---|
| 102 | 97 | * |
|---|
| 103 | 98 | * If you change _PAGE_CI definition be sure to change it in |
|---|
| 104 | | - * io.h for ioremap_nocache() too. |
|---|
| 99 | + * io.h for ioremap() too. |
|---|
| 105 | 100 | */ |
|---|
| 106 | 101 | |
|---|
| 107 | 102 | /* |
|---|
| .. | .. |
|---|
| 240 | 235 | static inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_EXEC; } |
|---|
| 241 | 236 | static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; } |
|---|
| 242 | 237 | static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; } |
|---|
| 243 | | -static inline int pte_special(pte_t pte) { return 0; } |
|---|
| 244 | | -static inline pte_t pte_mkspecial(pte_t pte) { return pte; } |
|---|
| 245 | 238 | |
|---|
| 246 | 239 | static inline pte_t pte_wrprotect(pte_t pte) |
|---|
| 247 | 240 | { |
|---|
| .. | .. |
|---|
| 370 | 363 | } |
|---|
| 371 | 364 | |
|---|
| 372 | 365 | #define pmd_page(pmd) (pfn_to_page(pmd_val(pmd) >> PAGE_SHIFT)) |
|---|
| 373 | | -#define pmd_page_kernel(pmd) ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)) |
|---|
| 374 | 366 | |
|---|
| 375 | | -/* to find an entry in a page-table-directory. */ |
|---|
| 376 | | -#define pgd_index(address) ((address >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) |
|---|
| 377 | | - |
|---|
| 378 | | -#define __pgd_offset(address) pgd_index(address) |
|---|
| 379 | | - |
|---|
| 380 | | -#define pgd_offset(mm, address) ((mm)->pgd+pgd_index(address)) |
|---|
| 381 | | - |
|---|
| 382 | | -/* to find an entry in a kernel page-table-directory */ |
|---|
| 383 | | -#define pgd_offset_k(address) pgd_offset(&init_mm, address) |
|---|
| 367 | +static inline unsigned long pmd_page_vaddr(pmd_t pmd) |
|---|
| 368 | +{ |
|---|
| 369 | + return ((unsigned long) __va(pmd_val(pmd) & PAGE_MASK)); |
|---|
| 370 | +} |
|---|
| 384 | 371 | |
|---|
| 385 | 372 | #define __pmd_offset(address) \ |
|---|
| 386 | 373 | (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1)) |
|---|
| 387 | 374 | |
|---|
| 388 | | -/* |
|---|
| 389 | | - * the pte page can be thought of an array like this: pte_t[PTRS_PER_PTE] |
|---|
| 390 | | - * |
|---|
| 391 | | - * this macro returns the index of the entry in the pte page which would |
|---|
| 392 | | - * control the given virtual address |
|---|
| 393 | | - */ |
|---|
| 394 | | -#define __pte_offset(address) \ |
|---|
| 395 | | - (((address) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) |
|---|
| 396 | | -#define pte_offset_kernel(dir, address) \ |
|---|
| 397 | | - ((pte_t *) pmd_page_kernel(*(dir)) + __pte_offset(address)) |
|---|
| 398 | | -#define pte_offset_map(dir, address) \ |
|---|
| 399 | | - ((pte_t *)page_address(pmd_page(*(dir))) + __pte_offset(address)) |
|---|
| 400 | | -#define pte_offset_map_nested(dir, address) \ |
|---|
| 401 | | - pte_offset_map(dir, address) |
|---|
| 402 | | - |
|---|
| 403 | | -#define pte_unmap(pte) do { } while (0) |
|---|
| 404 | | -#define pte_unmap_nested(pte) do { } while (0) |
|---|
| 405 | 375 | #define pte_pfn(x) ((unsigned long)(((x).pte)) >> PAGE_SHIFT) |
|---|
| 406 | 376 | #define pfn_pte(pfn, prot) __pte((((pfn) << PAGE_SHIFT)) | pgprot_val(prot)) |
|---|
| 407 | 377 | |
|---|
| .. | .. |
|---|
| 444 | 414 | #define __swp_entry_to_pte(x) ((pte_t) { (x).val }) |
|---|
| 445 | 415 | |
|---|
| 446 | 416 | #define kern_addr_valid(addr) (1) |
|---|
| 447 | | - |
|---|
| 448 | | -#include <asm-generic/pgtable.h> |
|---|
| 449 | | - |
|---|
| 450 | | -/* |
|---|
| 451 | | - * No page table caches to initialise |
|---|
| 452 | | - */ |
|---|
| 453 | | -#define pgtable_cache_init() do { } while (0) |
|---|
| 454 | 417 | |
|---|
| 455 | 418 | typedef pte_t *pte_addr_t; |
|---|
| 456 | 419 | |
|---|