Merge remote-tracking branch 'lsk/v3.10/topic/arm64-cpuidle' into linux-linaro-lsk
[firefly-linux-kernel-4.4.55.git] / arch / arm64 / include / asm / pgtable-3level-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_3LEVEL_TYPES_H
17 #define __ASM_PGTABLE_3LEVEL_TYPES_H
18
19 #include <asm/types.h>
20
21 typedef u64 pteval_t;
22 typedef u64 pmdval_t;
23 typedef u64 pgdval_t;
24
25 #undef STRICT_MM_TYPECHECKS
26
27 #ifdef STRICT_MM_TYPECHECKS
28
29 /*
30  * These are used to make use of C type-checking..
31  */
32 typedef struct { pteval_t pte; } pte_t;
33 typedef struct { pmdval_t pmd; } pmd_t;
34 typedef struct { pgdval_t pgd; } pgd_t;
35 typedef struct { pteval_t pgprot; } pgprot_t;
36
37 #define pte_val(x)      ((x).pte)
38 #define pmd_val(x)      ((x).pmd)
39 #define pgd_val(x)      ((x).pgd)
40 #define pgprot_val(x)   ((x).pgprot)
41
42 #define __pte(x)        ((pte_t) { (x) } )
43 #define __pmd(x)        ((pmd_t) { (x) } )
44 #define __pgd(x)        ((pgd_t) { (x) } )
45 #define __pgprot(x)     ((pgprot_t) { (x) } )
46
47 #else   /* !STRICT_MM_TYPECHECKS */
48
49 typedef pteval_t pte_t;
50 typedef pmdval_t pmd_t;
51 typedef pgdval_t pgd_t;
52 typedef pteval_t pgprot_t;
53
54 #define pte_val(x)      (x)
55 #define pmd_val(x)      (x)
56 #define pgd_val(x)      (x)
57 #define pgprot_val(x)   (x)
58
59 #define __pte(x)        (x)
60 #define __pmd(x)        (x)
61 #define __pgd(x)        (x)
62 #define __pgprot(x)     (x)
63
64 #endif  /* STRICT_MM_TYPECHECKS */
65
66 #include <asm-generic/pgtable-nopud.h>
67
68 #endif  /* __ASM_PGTABLE_3LEVEL_TYPES_H */