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