Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[deliverable/linux.git] / arch / powerpc / include / asm / pgtable-types.h
CommitLineData
2bf59916
AK
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 */
8typedef struct { pte_basic_t pte; } pte_t;
9#define __pte(x) ((pte_t) { (x) })
10static inline pte_basic_t pte_val(pte_t x)
11{
12 return x.pte;
13}
14
2bf59916
AK
15/* PMD level */
16#ifdef CONFIG_PPC64
17typedef struct { unsigned long pmd; } pmd_t;
18#define __pmd(x) ((pmd_t) { (x) })
19static inline unsigned long pmd_val(pmd_t x)
20{
21 return x.pmd;
22}
23
368ced78
AK
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)
2bf59916
AK
29typedef struct { unsigned long pud; } pud_t;
30#define __pud(x) ((pud_t) { (x) })
31static inline unsigned long pud_val(pud_t x)
32{
33 return x.pud;
34}
368ced78 35#endif /* CONFIG_PPC_BOOK3S_64 || !CONFIG_PPC_64K_PAGES */
2bf59916
AK
36#endif /* CONFIG_PPC64 */
37
38/* PGD level */
39typedef struct { unsigned long pgd; } pgd_t;
40#define __pgd(x) ((pgd_t) { (x) })
41static inline unsigned long pgd_val(pgd_t x)
42{
43 return x.pgd;
44}
45
46/* Page protection bits */
47typedef 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
57typedef pte_basic_t pte_t;
58#define __pte(x) (x)
59static inline pte_basic_t pte_val(pte_t pte)
60{
61 return pte;
62}
63
2bf59916
AK
64#ifdef CONFIG_PPC64
65typedef unsigned long pmd_t;
66#define __pmd(x) (x)
67static inline unsigned long pmd_val(pmd_t pmd)
68{
69 return pmd;
70}
71
368ced78 72#if defined(CONFIG_PPC_BOOK3S_64) || !defined(CONFIG_PPC_64K_PAGES)
2bf59916
AK
73typedef unsigned long pud_t;
74#define __pud(x) (x)
75static inline unsigned long pud_val(pud_t pud)
76{
77 return pud;
78}
368ced78 79#endif /* CONFIG_PPC_BOOK3S_64 || !CONFIG_PPC_64K_PAGES */
2bf59916
AK
80#endif /* CONFIG_PPC64 */
81
82typedef unsigned long pgd_t;
83#define __pgd(x) (x)
84static inline unsigned long pgd_val(pgd_t pgd)
85{
86 return pgd;
87}
88
89typedef unsigned long pgprot_t;
90#define pgprot_val(x) (x)
91#define __pgprot(x) (x)
92
ae9a71af
AK
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)
99typedef struct { pte_t pte; unsigned long hidx; } real_pte_t;
100#else
101typedef struct { pte_t pte; } real_pte_t;
2bf59916 102#endif
2bf59916 103#endif /* _ASM_POWERPC_PGTABLE_TYPES_H */
This page took 0.066821 seconds and 5 git commands to generate.