1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40#ifndef SYM_FW_H
41#define SYM_FW_H
42
43
44
45#define SYM_GEN_FW_A(s) \
46 SYM_GEN_A(s, start) SYM_GEN_A(s, getjob_begin) \
47 SYM_GEN_A(s, getjob_end) \
48 SYM_GEN_A(s, select) SYM_GEN_A(s, wf_sel_done) \
49 SYM_GEN_A(s, send_ident) \
50 SYM_GEN_A(s, dispatch) SYM_GEN_A(s, init) \
51 SYM_GEN_A(s, clrack) SYM_GEN_A(s, complete_error) \
52 SYM_GEN_A(s, done) SYM_GEN_A(s, done_end) \
53 SYM_GEN_A(s, idle) SYM_GEN_A(s, ungetjob) \
54 SYM_GEN_A(s, reselect) \
55 SYM_GEN_A(s, resel_tag) SYM_GEN_A(s, resel_dsa) \
56 SYM_GEN_A(s, resel_no_tag) \
57 SYM_GEN_A(s, data_in) SYM_GEN_A(s, data_in2) \
58 SYM_GEN_A(s, data_out) SYM_GEN_A(s, data_out2) \
59 SYM_GEN_A(s, pm0_data) SYM_GEN_A(s, pm1_data)
60
61
62
63
64#define SYM_GEN_FW_B(s) \
65 SYM_GEN_B(s, no_data) \
66 SYM_GEN_B(s, sel_for_abort) SYM_GEN_B(s, sel_for_abort_1) \
67 SYM_GEN_B(s, msg_bad) SYM_GEN_B(s, msg_weird) \
68 SYM_GEN_B(s, wdtr_resp) SYM_GEN_B(s, send_wdtr) \
69 SYM_GEN_B(s, sdtr_resp) SYM_GEN_B(s, send_sdtr) \
70 SYM_GEN_B(s, ppr_resp) SYM_GEN_B(s, send_ppr) \
71 SYM_GEN_B(s, nego_bad_phase) \
72 SYM_GEN_B(s, ident_break) SYM_GEN_B(s, ident_break_atn) \
73 SYM_GEN_B(s, sdata_in) SYM_GEN_B(s, resel_bad_lun) \
74 SYM_GEN_B(s, bad_i_t_l) SYM_GEN_B(s, bad_i_t_l_q) \
75 SYM_GEN_B(s, wsr_ma_helper)
76
77
78
79
80#define SYM_GEN_FW_Z(s) \
81 SYM_GEN_Z(s, snooptest) SYM_GEN_Z(s, snoopend)
82
83
84
85
86
87#define SYM_GEN_A(s, label) s label;
88#define SYM_GEN_B(s, label) s label;
89#define SYM_GEN_Z(s, label) s label;
90struct sym_fwa_ofs {
91 SYM_GEN_FW_A(u_short)
92};
93struct sym_fwb_ofs {
94 SYM_GEN_FW_B(u_short)
95 SYM_GEN_B(u_short, start64)
96 SYM_GEN_B(u_short, pm_handle)
97};
98struct sym_fwz_ofs {
99 SYM_GEN_FW_Z(u_short)
100};
101
102
103
104
105
106struct sym_fwa_ba {
107 SYM_GEN_FW_A(u32)
108};
109struct sym_fwb_ba {
110 SYM_GEN_FW_B(u32)
111 SYM_GEN_B(u32, start64);
112 SYM_GEN_B(u32, pm_handle);
113};
114struct sym_fwz_ba {
115 SYM_GEN_FW_Z(u32)
116};
117#undef SYM_GEN_A
118#undef SYM_GEN_B
119#undef SYM_GEN_Z
120
121
122
123
124
125struct sym_hcb;
126
127
128
129
130struct sym_fw {
131 char *name;
132 u32 *a_base;
133 int a_size;
134 struct sym_fwa_ofs
135 *a_ofs;
136 u32 *b_base;
137 int b_size;
138 struct sym_fwb_ofs
139 *b_ofs;
140 u32 *z_base;
141 int z_size;
142 struct sym_fwz_ofs
143 *z_ofs;
144
145 void (*setup)(struct sym_hcb *, struct sym_fw *);
146 void (*patch)(struct Scsi_Host *);
147};
148
149
150
151
152#define SYM_FW_ENTRY(fw, name) \
153{ \
154 name, \
155 (u32 *) &fw##a_scr, sizeof(fw##a_scr), &fw##a_ofs, \
156 (u32 *) &fw##b_scr, sizeof(fw##b_scr), &fw##b_ofs, \
157 (u32 *) &fw##z_scr, sizeof(fw##z_scr), &fw##z_ofs, \
158 fw##_setup, fw##_patch \
159}
160
161
162
163
164
165#define SCRIPTA_BA(np, label) (np->fwa_bas.label)
166#define SCRIPTB_BA(np, label) (np->fwb_bas.label)
167#define SCRIPTZ_BA(np, label) (np->fwz_bas.label)
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188#define RELOC_SOFTC 0x40000000
189#define RELOC_LABEL_A 0x50000000
190#define RELOC_REGISTER 0x60000000
191#define RELOC_LABEL_B 0x80000000
192#define RELOC_MASK 0xf0000000
193
194#define HADDR_1(label) (RELOC_SOFTC | offsetof(struct sym_hcb, label))
195#define HADDR_2(label,ofs) (RELOC_SOFTC | \
196 (offsetof(struct sym_hcb, label)+(ofs)))
197#define RADDR_1(label) (RELOC_REGISTER | REG(label))
198#define RADDR_2(label,ofs) (RELOC_REGISTER | ((REG(label))+(ofs)))
199
200#define SYM_GEN_PADDR_A(s, label) (RELOC_LABEL_A | offsetof(s, label))
201#define SYM_GEN_PADDR_B(s, label) (RELOC_LABEL_B | offsetof(s, label))
202
203#define SCR_DATA_ZERO 0xf00ff00f
204
205#endif
206