This source file includes following definitions.
- sun4c_get_synchronous_error
- sun4c_get_synchronous_address
- sun4c_get_segmap
- sun4c_put_segmap
- sun4c_get_pte
- sun4c_put_pte
- sun4c_get_context
- sun4c_set_context
1
2
3
4
5
6 #ifndef _SPARC_PGTSUN4C_H
7 #define _SPARC_PGTSUN4C_H
8
9
10 #define SUN4C_PMD_SHIFT 22
11 #define SUN4C_PMD_SIZE (1UL << SUN4C_PMD_SHIFT)
12 #define SUN4C_PMD_MASK (~(SUN4C_PMD_SIZE-1))
13 #define SUN4C_PMD_ALIGN(addr) (((addr)+SUN4C_PMD_SIZE-1)&SUN4C_PMD_MASK)
14
15
16 #define SUN4C_PGDIR_SHIFT 22
17 #define SUN4C_PGDIR_SIZE (1UL << SUN4C_PGDIR_SHIFT)
18 #define SUN4C_PGDIR_MASK (~(SUN4C_PGDIR_SIZE-1))
19 #define SUN4C_PGDIR_ALIGN(addr) (((addr)+SUN4C_PGDIR_SIZE-1)&SUN4C_PGDIR_MASK)
20
21
22 #define SUN4C_REAL_PGDIR_SHIFT 18
23 #define SUN4C_REAL_PGDIR_SIZE (1UL << SUN4C_REAL_PGDIR_SHIFT)
24 #define SUN4C_REAL_PGDIR_MASK (~(SUN4C_REAL_PGDIR_SIZE-1))
25 #define SUN4C_REAL_PGDIR_ALIGN(addr) (((addr)+SUN4C_REAL_PGDIR_SIZE-1)&SUN4C_REAL_PGDIR_MASK)
26
27
28
29
30
31
32 #define SUN4C_PTRS_PER_PTE 1024
33 #define SUN4C_PTRS_PER_PMD 1
34 #define SUN4C_PTRS_PER_PGD 1024
35
36
37
38
39
40 #define SUN4C_VMALLOC_START (0xfe200000)
41
42
43
44
45 #define _SUN4C_PAGE_VALID 0x80000000
46 #define _SUN4C_PAGE_WRITE 0x40000000
47 #define _SUN4C_PAGE_PRIV 0x20000000
48 #define _SUN4C_PAGE_USER 0x00000000
49 #define _SUN4C_PAGE_NOCACHE 0x10000000
50 #define _SUN4C_PAGE_IO 0x04000000
51 #define _SUN4C_PAGE_REF 0x02000000
52 #define _SUN4C_PAGE_DIRTY 0x01000000
53
54 #define _SUN4C_PAGE_CHG_MASK (0xffff | _SUN4C_PAGE_REF | _SUN4C_PAGE_DIRTY)
55
56 #define SUN4C_PAGE_NONE __pgprot(_SUN4C_PAGE_VALID | _SUN4C_PAGE_PRIV | \
57 _SUN4C_PAGE_REF)
58 #define SUN4C_PAGE_SHARED __pgprot(_SUN4C_PAGE_VALID | _SUN4C_PAGE_WRITE | \
59 _SUN4C_PAGE_USER | _SUN4C_PAGE_REF)
60 #define SUN4C_PAGE_COPY __pgprot(_SUN4C_PAGE_VALID | _SUN4C_PAGE_USER | \
61 _SUN4C_PAGE_REF)
62 #define SUN4C_PAGE_READONLY __pgprot(_SUN4C_PAGE_VALID | _SUN4C_PAGE_USER | \
63 _SUN4C_PAGE_REF)
64 #define SUN4C_PAGE_KERNEL __pgprot(_SUN4C_PAGE_VALID | _SUN4C_PAGE_WRITE | \
65 _SUN4C_PAGE_PRIV | _SUN4C_PAGE_DIRTY | \
66 _SUN4C_PAGE_REF | _SUN4C_PAGE_NOCACHE)
67
68 extern __inline__ unsigned long sun4c_get_synchronous_error(void)
69 {
70 unsigned long sync_err;
71
72 __asm__ __volatile__("lda [%1] %2, %0\n\t" :
73 "=r" (sync_err) :
74 "r" (AC_SYNC_ERR), "i" (ASI_CONTROL));
75 return sync_err;
76 }
77
78 extern __inline__ unsigned long sun4c_get_synchronous_address(void)
79 {
80 unsigned long sync_addr;
81
82 __asm__ __volatile__("lda [%1] %2, %0\n\t" :
83 "=r" (sync_addr) :
84 "r" (AC_SYNC_VA), "i" (ASI_CONTROL));
85 return sync_addr;
86 }
87
88
89 extern __inline__ unsigned long sun4c_get_segmap(unsigned long addr)
90 {
91 register unsigned long entry;
92
93 __asm__ __volatile__("\n\tlduba [%1] %2, %0\n\t" :
94 "=r" (entry) :
95 "r" (addr), "i" (ASI_SEGMAP));
96
97 return entry;
98 }
99
100 extern __inline__ void sun4c_put_segmap(unsigned long addr, unsigned long entry)
101 {
102
103 __asm__ __volatile__("\n\tstba %1, [%0] %2\n\t" : :
104 "r" (addr), "r" (entry),
105 "i" (ASI_SEGMAP));
106
107 return;
108 }
109
110 extern __inline__ unsigned long sun4c_get_pte(unsigned long addr)
111 {
112 register unsigned long entry;
113
114 __asm__ __volatile__("\n\tlda [%1] %2, %0\n\t" :
115 "=r" (entry) :
116 "r" (addr), "i" (ASI_PTE));
117 return entry;
118 }
119
120 extern __inline__ void sun4c_put_pte(unsigned long addr, unsigned long entry)
121 {
122 __asm__ __volatile__("\n\tsta %1, [%0] %2\n\t" : :
123 "r" (addr),
124 "r" (entry), "i" (ASI_PTE));
125
126 return;
127 }
128
129 extern __inline__ int sun4c_get_context(void)
130 {
131 register int ctx;
132
133 __asm__ __volatile__("\n\tlduba [%1] %2, %0\n\t" :
134 "=r" (ctx) :
135 "r" (AC_CONTEXT), "i" (ASI_CONTROL));
136
137 return ctx;
138 }
139
140 extern __inline__ int sun4c_set_context(int ctx)
141 {
142 __asm__ __volatile__("\n\tstba %0, [%1] %2\n\t" : :
143 "r" (ctx), "r" (AC_CONTEXT), "i" (ASI_CONTROL));
144
145 return ctx;
146 }
147
148 #endif