Merge commit 'ed30f24e8d07d30aa3e69d1f508f4d7bd2e8ea14' of git://git.linaro.org/landi...
[firefly-linux-kernel-4.4.55.git] / arch / arm64 / include / asm / pgtable-2level-types.h
1 /*
2  * Copyright (C) 2012 ARM Ltd.
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
15  */
16 #ifndef __ASM_PGTABLE_2LEVEL_TYPES_H
17 #define __ASM_PGTABLE_2LEVEL_TYPES_H
18
19 typedef u64 pteval_t;
20 typedef u64 pgdval_t;
21 typedef pgdval_t pmdval_t;
22
23 #undef STRICT_MM_TYPECHECKS
24
25 #ifdef STRICT_MM_TYPECHECKS
26
27 /*
28  * These are used to make use of C type-checking..
29  */
30 typedef struct { pteval_t pte; } pte_t;
31 typedef struct { pgdval_t pgd; } pgd_t;
32 typedef struct { pteval_t pgprot; } pgprot_t;
33
34 #define pte_val(x)      ((x).pte)
35 #define pgd_val(x)      ((x).pgd)
36 #define pgprot_val(x)   ((x).pgprot)
37
38 #define __pte(x)        ((pte_t) { (x) } )
39 #define __pgd(x)        ((pgd_t) { (x) } )
40 #define __pgprot(x)     ((pgprot_t) { (x) } )
41
42 #else   /* !STRICT_MM_TYPECHECKS */
43
44 typedef pteval_t pte_t;
45 typedef pgdval_t pgd_t;
46 typedef pteval_t pgprot_t;
47
48 #define pte_val(x)      (x)
49 #define pgd_val(x)      (x)
50 #define pgprot_val(x)   (x)
51
52 #define __pte(x)        (x)
53 #define __pgd(x)        (x)
54 #define __pgprot(x)     (x)
55
56 #endif  /* STRICT_MM_TYPECHECKS */
57
58 #include <asm-generic/pgtable-nopmd.h>
59
60 #endif  /* __ASM_PGTABLE_2LEVEL_TYPES_H */