1
2
3
4
5
6
7#ifndef _SPARC_SWIFT_H
8#define _SPARC_SWIFT_H
9
10
11#define SWIFT_ST 0x00800000
12#define SWIFT_WP 0x00400000
13
14
15#define SWIFT_BF 0x00200000
16#define SWIFT_PMC 0x00180000
17#define SWIFT_PE 0x00040000
18#define SWIFT_PC 0x00020000
19#define SWIFT_AP 0x00010000
20#define SWIFT_AC 0x00008000
21#define SWIFT_BM 0x00004000
22#define SWIFT_RC 0x00003c00
23#define SWIFT_IE 0x00000200
24#define SWIFT_DE 0x00000100
25#define SWIFT_SA 0x00000080
26#define SWIFT_NF 0x00000002
27#define SWIFT_EN 0x00000001
28
29
30static inline void swift_inv_insn_tag(unsigned long addr)
31{
32 __asm__ __volatile__("sta %%g0, [%0] %1\n\t"
33 :
34 : "r" (addr), "i" (ASI_M_TXTC_TAG)
35 : "memory");
36}
37
38
39static inline void swift_inv_data_tag(unsigned long addr)
40{
41 __asm__ __volatile__("sta %%g0, [%0] %1\n\t"
42 :
43 : "r" (addr), "i" (ASI_M_DATAC_TAG)
44 : "memory");
45}
46
47static inline void swift_flush_dcache(void)
48{
49 unsigned long addr;
50
51 for (addr = 0; addr < 0x2000; addr += 0x10)
52 swift_inv_data_tag(addr);
53}
54
55static inline void swift_flush_icache(void)
56{
57 unsigned long addr;
58
59 for (addr = 0; addr < 0x4000; addr += 0x20)
60 swift_inv_insn_tag(addr);
61}
62
63static inline void swift_idflash_clear(void)
64{
65 unsigned long addr;
66
67 for (addr = 0; addr < 0x2000; addr += 0x10) {
68 swift_inv_insn_tag(addr<<1);
69 swift_inv_data_tag(addr);
70 }
71}
72
73
74static inline void swift_flush_page(unsigned long page)
75{
76 __asm__ __volatile__("sta %%g0, [%0] %1\n\t"
77 :
78 : "r" (page), "i" (ASI_M_FLUSH_PAGE)
79 : "memory");
80}
81
82static inline void swift_flush_segment(unsigned long addr)
83{
84 __asm__ __volatile__("sta %%g0, [%0] %1\n\t"
85 :
86 : "r" (addr), "i" (ASI_M_FLUSH_SEG)
87 : "memory");
88}
89
90static inline void swift_flush_region(unsigned long addr)
91{
92 __asm__ __volatile__("sta %%g0, [%0] %1\n\t"
93 :
94 : "r" (addr), "i" (ASI_M_FLUSH_REGION)
95 : "memory");
96}
97
98static inline void swift_flush_context(void)
99{
100 __asm__ __volatile__("sta %%g0, [%%g0] %0\n\t"
101 :
102 : "i" (ASI_M_FLUSH_CTX)
103 : "memory");
104}
105
106#endif
107