Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
[deliverable/linux.git] / arch / powerpc / include / asm / pgtable-types.h
1 #ifndef _ASM_POWERPC_PGTABLE_TYPES_H
2 #define _ASM_POWERPC_PGTABLE_TYPES_H
3
4 #ifdef CONFIG_STRICT_MM_TYPECHECKS
5 /* These are used to make use of C type-checking. */
6
7 /* PTE level */
8 typedef struct { pte_basic_t pte; } pte_t;
9 #define __pte(x) ((pte_t) { (x) })
10 static inline pte_basic_t pte_val(pte_t x)
11 {
12 return x.pte;
13 }
14
15 /* PMD level */
16 #ifdef CONFIG_PPC64
17 typedef struct { unsigned long pmd; } pmd_t;
18 #define __pmd(x) ((pmd_t) { (x) })
19 static inline unsigned long pmd_val(pmd_t x)
20 {
21 return x.pmd;
22 }
23
24 /*
25 * 64 bit hash always use 4 level table. Everybody else use 4 level
26 * only for 4K page size.
27 */
28 #if defined(CONFIG_PPC_BOOK3S_64) || !defined(CONFIG_PPC_64K_PAGES)
29 typedef struct { unsigned long pud; } pud_t;
30 #define __pud(x) ((pud_t) { (x) })
31 static inline unsigned long pud_val(pud_t x)
32 {
33 return x.pud;
34 }
35 #endif /* CONFIG_PPC_BOOK3S_64 || !CONFIG_PPC_64K_PAGES */
36 #endif /* CONFIG_PPC64 */
37
38 /* PGD level */
39 typedef struct { unsigned long pgd; } pgd_t;
40 #define __pgd(x) ((pgd_t) { (x) })
41 static inline unsigned long pgd_val(pgd_t x)
42 {
43 return x.pgd;
44 }
45
46 /* Page protection bits */
47 typedef struct { unsigned long pgprot; } pgprot_t;
48 #define pgprot_val(x) ((x).pgprot)
49 #define __pgprot(x) ((pgprot_t) { (x) })
50
51 #else
52
53 /*
54 * .. while these make it easier on the compiler
55 */
56
57 typedef pte_basic_t pte_t;
58 #define __pte(x) (x)
59 static inline pte_basic_t pte_val(pte_t pte)
60 {
61 return pte;
62 }
63
64 #ifdef CONFIG_PPC64
65 typedef unsigned long pmd_t;
66 #define __pmd(x) (x)
67 static inline unsigned long pmd_val(pmd_t pmd)
68 {
69 return pmd;
70 }
71
72 #if defined(CONFIG_PPC_BOOK3S_64) || !defined(CONFIG_PPC_64K_PAGES)
73 typedef unsigned long pud_t;
74 #define __pud(x) (x)
75 static inline unsigned long pud_val(pud_t pud)
76 {
77 return pud;
78 }
79 #endif /* CONFIG_PPC_BOOK3S_64 || !CONFIG_PPC_64K_PAGES */
80 #endif /* CONFIG_PPC64 */
81
82 typedef unsigned long pgd_t;
83 #define __pgd(x) (x)
84 static inline unsigned long pgd_val(pgd_t pgd)
85 {
86 return pgd;
87 }
88
89 typedef unsigned long pgprot_t;
90 #define pgprot_val(x) (x)
91 #define __pgprot(x) (x)
92
93 #endif /* CONFIG_STRICT_MM_TYPECHECKS */
94 /*
95 * With hash config 64k pages additionally define a bigger "real PTE" type that
96 * gathers the "second half" part of the PTE for pseudo 64k pages
97 */
98 #if defined(CONFIG_PPC_64K_PAGES) && defined(CONFIG_PPC_STD_MMU_64)
99 typedef struct { pte_t pte; unsigned long hidx; } real_pte_t;
100 #else
101 typedef struct { pte_t pte; } real_pte_t;
102 #endif
103 #endif /* _ASM_POWERPC_PGTABLE_TYPES_H */
This page took 0.033985 seconds and 5 git commands to generate.