1
2#ifndef _ASM_POWERPC_PGTABLE_TYPES_H
3#define _ASM_POWERPC_PGTABLE_TYPES_H
4
5
6#if defined(CONFIG_PPC_8xx) && defined(CONFIG_PPC_16K_PAGES)
7typedef struct { pte_basic_t pte, pte1, pte2, pte3; } pte_t;
8#else
9typedef struct { pte_basic_t pte; } pte_t;
10#endif
11#define __pte(x) ((pte_t) { (x) })
12static inline pte_basic_t pte_val(pte_t x)
13{
14 return x.pte;
15}
16
17
18#ifdef CONFIG_PPC64
19typedef struct { unsigned long pmd; } pmd_t;
20#define __pmd(x) ((pmd_t) { (x) })
21static inline unsigned long pmd_val(pmd_t x)
22{
23 return x.pmd;
24}
25
26
27typedef struct { unsigned long pud; } pud_t;
28#define __pud(x) ((pud_t) { (x) })
29static inline unsigned long pud_val(pud_t x)
30{
31 return x.pud;
32}
33#endif
34
35
36typedef struct { unsigned long pgd; } pgd_t;
37#define __pgd(x) ((pgd_t) { (x) })
38static inline unsigned long pgd_val(pgd_t x)
39{
40 return x.pgd;
41}
42
43
44typedef struct { unsigned long pgprot; } pgprot_t;
45#define pgprot_val(x) ((x).pgprot)
46#define __pgprot(x) ((pgprot_t) { (x) })
47
48
49
50
51
52#ifdef CONFIG_PPC_64K_PAGES
53typedef struct { pte_t pte; unsigned long hidx; } real_pte_t;
54#else
55typedef struct { pte_t pte; } real_pte_t;
56#endif
57
58#ifdef CONFIG_PPC_BOOK3S_64
59#include <asm/cmpxchg.h>
60
61static inline bool pte_xchg(pte_t *ptep, pte_t old, pte_t new)
62{
63 unsigned long *p = (unsigned long *)ptep;
64
65
66 return pte_val(old) == __cmpxchg_u64(p, pte_val(old), pte_val(new));
67}
68#endif
69
70typedef struct { unsigned long pd; } hugepd_t;
71#define __hugepd(x) ((hugepd_t) { (x) })
72static inline unsigned long hpd_val(hugepd_t x)
73{
74 return x.pd;
75}
76
77#endif
78