| 1 |
/* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 |
/* |
| 3 |
* Page table types definitions. |
| 4 |
* |
| 5 |
* Copyright (C) 2014 ARM Ltd. |
| 6 |
* Author: Catalin Marinas <[email protected]> |
| 7 |
*/ |
| 8 |
|
| 9 |
#ifndef __ASM_PGTABLE_TYPES_H |
| 10 |
#define __ASM_PGTABLE_TYPES_H |
| 11 |
|
| 12 |
#include <asm/types.h> |
| 13 |
|
| 14 |
/* |
| 15 |
* Page Table Descriptor |
| 16 |
* |
| 17 |
* Generic page table descriptor format from which |
| 18 |
* all level specific descriptors can be derived. |
| 19 |
*/ |
| 20 |
typedef u64 ptdesc_t; |
| 21 |
|
| 22 |
typedef ptdesc_t pteval_t; |
| 23 |
typedef ptdesc_t pmdval_t; |
| 24 |
typedef ptdesc_t pudval_t; |
| 25 |
typedef ptdesc_t p4dval_t; |
| 26 |
typedef ptdesc_t pgdval_t; |
| 27 |
|
| 28 |
/* |
| 29 |
* These are used to make use of C type-checking.. |
| 30 |
*/ |
| 31 |
typedef struct { pteval_t pte; } pte_t; |
| 32 |
#define pte_val(x) ((x).pte) |
| 33 |
#define __pte(x) ((pte_t) { (x) } ) |
| 34 |
|
| 35 |
#if CONFIG_PGTABLE_LEVELS > 2 |
| 36 |
typedef struct { pmdval_t pmd; } pmd_t; |
| 37 |
#define pmd_val(x) ((x).pmd) |
| 38 |
#define __pmd(x) ((pmd_t) { (x) } ) |
| 39 |
#endif |
| 40 |
|
| 41 |
#if CONFIG_PGTABLE_LEVELS > 3 |
| 42 |
typedef struct { pudval_t pud; } pud_t; |
| 43 |
#define pud_val(x) ((x).pud) |
| 44 |
#define __pud(x) ((pud_t) { (x) } ) |
| 45 |
#endif |
| 46 |
|
| 47 |
#if CONFIG_PGTABLE_LEVELS > 4 |
| 48 |
typedef struct { p4dval_t p4d; } p4d_t; |
| 49 |
#define p4d_val(x) ((x).p4d) |
| 50 |
#define __p4d(x) ((p4d_t) { (x) } ) |
| 51 |
#endif |
| 52 |
|
| 53 |
typedef struct { pgdval_t pgd; } pgd_t; |
| 54 |
#define pgd_val(x) ((x).pgd) |
| 55 |
#define __pgd(x) ((pgd_t) { (x) } ) |
| 56 |
|
| 57 |
typedef struct { ptdesc_t pgprot; } pgprot_t; |
| 58 |
#define pgprot_val(x) ((x).pgprot) |
| 59 |
#define __pgprot(x) ((pgprot_t) { (x) } ) |
| 60 |
|
| 61 |
#if CONFIG_PGTABLE_LEVELS == 2 |
| 62 |
#include <asm-generic/pgtable-nopmd.h> |
| 63 |
#elif CONFIG_PGTABLE_LEVELS == 3 |
| 64 |
#include <asm-generic/pgtable-nopud.h> |
| 65 |
#elif CONFIG_PGTABLE_LEVELS == 4 |
| 66 |
#include <asm-generic/pgtable-nop4d.h> |
| 67 |
#endif |
| 68 |
|
| 69 |
#endif /* __ASM_PGTABLE_TYPES_H */ |