• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 <catalin.marinas@arm.com>
7  */
8 
9 #ifndef __ASM_PGTABLE_TYPES_H
10 #define __ASM_PGTABLE_TYPES_H
11 
12 #include <asm/types.h>
13 
14 typedef u64 pteval_t;
15 typedef u64 pmdval_t;
16 typedef u64 pudval_t;
17 typedef u64 pgdval_t;
18 
19 /*
20  * These are used to make use of C type-checking..
21  */
22 typedef struct { pteval_t pte; } pte_t;
23 #define pte_val(x)	((x).pte)
24 #define __pte(x)	((pte_t) { (x) } )
25 
26 #if CONFIG_PGTABLE_LEVELS > 2
27 typedef struct { pmdval_t pmd; } pmd_t;
28 #define pmd_val(x)	((x).pmd)
29 #define __pmd(x)	((pmd_t) { (x) } )
30 #endif
31 
32 #if CONFIG_PGTABLE_LEVELS > 3
33 typedef struct { pudval_t pud; } pud_t;
34 #define pud_val(x)	((x).pud)
35 #define __pud(x)	((pud_t) { (x) } )
36 #endif
37 
38 typedef struct { pgdval_t pgd; } pgd_t;
39 #define pgd_val(x)	((x).pgd)
40 #define __pgd(x)	((pgd_t) { (x) } )
41 
42 typedef struct { pteval_t pgprot; } pgprot_t;
43 #define pgprot_val(x)	((x).pgprot)
44 #define __pgprot(x)	((pgprot_t) { (x) } )
45 
46 #if CONFIG_PGTABLE_LEVELS == 2
47 #define __ARCH_USE_5LEVEL_HACK
48 #include <asm-generic/pgtable-nopmd.h>
49 #elif CONFIG_PGTABLE_LEVELS == 3
50 #define __ARCH_USE_5LEVEL_HACK
51 #include <asm-generic/pgtable-nopud.h>
52 #elif CONFIG_PGTABLE_LEVELS == 4
53 #include <asm-generic/5level-fixup.h>
54 #endif
55 
56 #endif	/* __ASM_PGTABLE_TYPES_H */
57