This source file includes following definitions.
- set_event_mask
- set_tag_mask
- build_dma_list
- enqueue_putllc
- set_tag_update
- read_tag_status
- read_llar_status
1
2
3
4
5
6
7
8 #ifndef _SPU_CONTEXT_UTILS_H_
9 #define _SPU_CONTEXT_UTILS_H_
10
11
12
13
14 typedef union {
15 unsigned long long ull;
16 unsigned int ui[2];
17 } addr64;
18
19
20
21
22 typedef union {
23 unsigned int slot[4];
24 vector unsigned int v;
25 } spu_reg128v;
26
27
28
29
30 struct dma_list_elem {
31 unsigned int size;
32 unsigned int ea_low;
33 };
34
35
36
37
38 struct dma_list_elem dma_list[15] __attribute__ ((aligned(8)));
39
40
41
42
43
44 extern spu_reg128v regs_spill[NR_SPU_SPILL_REGS];
45
46
47
48
49 static struct spu_lscsa *dummy = (struct spu_lscsa *)0;
50 #define LSCSA_BYTE_OFFSET(_field) \
51 ((char *)(&(dummy->_field)) - (char *)(&(dummy->gprs[0].slot[0])))
52 #define LSCSA_QW_OFFSET(_field) (LSCSA_BYTE_OFFSET(_field) >> 4)
53
54 static inline void set_event_mask(void)
55 {
56 unsigned int event_mask = 0;
57
58
59
60
61
62
63 spu_writech(SPU_WrEventMask, event_mask);
64 }
65
66 static inline void set_tag_mask(void)
67 {
68 unsigned int tag_mask = 1;
69
70
71
72
73
74
75 spu_writech(MFC_WrTagMask, tag_mask);
76 }
77
78 static inline void build_dma_list(addr64 lscsa_ea)
79 {
80 unsigned int ea_low;
81 int i;
82
83
84
85
86
87
88 ea_low = lscsa_ea.ui[1];
89 ea_low += LSCSA_BYTE_OFFSET(ls[16384]);
90
91 for (i = 0; i < 15; i++, ea_low += 16384) {
92 dma_list[i].size = 16384;
93 dma_list[i].ea_low = ea_low;
94 }
95 }
96
97 static inline void enqueue_putllc(addr64 lscsa_ea)
98 {
99 unsigned int ls = 0;
100 unsigned int size = 128;
101 unsigned int tag_id = 0;
102 unsigned int cmd = 0xB4;
103
104
105
106
107
108
109
110 spu_writech(MFC_LSA, ls);
111 spu_writech(MFC_EAH, lscsa_ea.ui[0]);
112 spu_writech(MFC_EAL, lscsa_ea.ui[1]);
113 spu_writech(MFC_Size, size);
114 spu_writech(MFC_TagID, tag_id);
115 spu_writech(MFC_Cmd, cmd);
116 }
117
118 static inline void set_tag_update(void)
119 {
120 unsigned int update_any = 1;
121
122
123
124
125
126 spu_writech(MFC_WrTagUpdate, update_any);
127 }
128
129 static inline void read_tag_status(void)
130 {
131
132
133
134
135 spu_readch(MFC_RdTagStat);
136 }
137
138 static inline void read_llar_status(void)
139 {
140
141
142
143
144 spu_readch(MFC_RdAtomicStat);
145 }
146
147 #endif