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_GLUE_H
41#define SYM_GLUE_H
42
43#include <linux/completion.h>
44#include <linux/delay.h>
45#include <linux/interrupt.h>
46#include <linux/ioport.h>
47#include <linux/pci.h>
48#include <linux/string.h>
49#include <linux/timer.h>
50#include <linux/types.h>
51
52#include <asm/io.h>
53#ifdef __sparc__
54# include <asm/irq.h>
55#endif
56
57#include <scsi/scsi.h>
58#include <scsi/scsi_cmnd.h>
59#include <scsi/scsi_device.h>
60#include <scsi/scsi_transport_spi.h>
61#include <scsi/scsi_host.h>
62
63#include "sym53c8xx.h"
64#include "sym_defs.h"
65#include "sym_misc.h"
66
67
68
69
70#define SYM_CONF_TIMER_INTERVAL ((HZ+1)/2)
71
72#undef SYM_OPT_HANDLE_DEVICE_QUEUEING
73#define SYM_OPT_LIMIT_COMMAND_REORDERING
74
75
76
77
78#define printf_emerg(args...) printk(KERN_EMERG args)
79#define printf_alert(args...) printk(KERN_ALERT args)
80#define printf_crit(args...) printk(KERN_CRIT args)
81#define printf_err(args...) printk(KERN_ERR args)
82#define printf_warning(args...) printk(KERN_WARNING args)
83#define printf_notice(args...) printk(KERN_NOTICE args)
84#define printf_info(args...) printk(KERN_INFO args)
85#define printf_debug(args...) printk(KERN_DEBUG args)
86#define printf(args...) printk(args)
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105#define MEMORY_READ_BARRIER() rmb()
106#define MEMORY_WRITE_BARRIER() wmb()
107
108
109
110
111
112
113#ifdef __BIG_ENDIAN
114
115#define readw_l2b readw
116#define readl_l2b readl
117#define writew_b2l writew
118#define writel_b2l writel
119
120#else
121
122#define readw_raw readw
123#define readl_raw readl
124#define writew_raw writew
125#define writel_raw writel
126
127#endif
128
129#ifdef SYM_CONF_CHIP_BIG_ENDIAN
130#error "Chips in BIG ENDIAN addressing mode are not (yet) supported"
131#endif
132
133
134
135
136
137
138
139
140
141#define cpu_to_scr(dw) cpu_to_le32(dw)
142#define scr_to_cpu(dw) le32_to_cpu(dw)
143
144
145
146
147
148#define SCSI_SUCCESS SUCCESS
149#define SCSI_FAILED FAILED
150
151
152
153
154
155
156
157
158
159
160#define SYM_HAVE_SLCB
161struct sym_slcb {
162 u_short reqtags;
163 u_short scdev_depth;
164};
165
166
167
168
169
170
171
172
173
174
175struct sym_shcb {
176
177
178
179 int unit;
180 char inst_name[16];
181 char chip_name[8];
182
183 struct Scsi_Host *host;
184
185 void __iomem * ioaddr;
186 void __iomem * ramaddr;
187
188 struct timer_list timer;
189 u_long lasttime;
190 u_long settle_time;
191 u_char settle_time_valid;
192};
193
194
195
196
197#define sym_name(np) (np)->s.inst_name
198
199struct sym_nvram;
200
201
202
203
204struct sym_device {
205 struct pci_dev *pdev;
206 unsigned long mmio_base;
207 unsigned long ram_base;
208 struct {
209 void __iomem *ioaddr;
210 void __iomem *ramaddr;
211 } s;
212 struct sym_chip chip;
213 struct sym_nvram *nvram;
214 u_char host_id;
215};
216
217
218
219
220struct sym_data {
221 struct sym_hcb *ncb;
222 struct completion *io_reset;
223 struct pci_dev *pdev;
224};
225
226static inline struct sym_hcb * sym_get_hcb(struct Scsi_Host *host)
227{
228 return ((struct sym_data *)host->hostdata)->ncb;
229}
230
231#include "sym_fw.h"
232#include "sym_hipd.h"
233
234
235
236
237static inline void
238sym_set_cam_status(struct scsi_cmnd *cmd, int status)
239{
240 cmd->result &= ~(0xff << 16);
241 cmd->result |= (status << 16);
242}
243
244
245
246
247static inline int
248sym_get_cam_status(struct scsi_cmnd *cmd)
249{
250 return host_byte(cmd->result);
251}
252
253
254
255
256static inline void sym_set_cam_result_ok(struct sym_ccb *cp, struct scsi_cmnd *cmd, int resid)
257{
258 scsi_set_resid(cmd, resid);
259 cmd->result = (((DID_OK) << 16) + ((cp->ssss_status) & 0x7f));
260}
261void sym_set_cam_result_error(struct sym_hcb *np, struct sym_ccb *cp, int resid);
262
263void sym_xpt_done(struct sym_hcb *np, struct scsi_cmnd *ccb);
264#define sym_print_addr(cmd, arg...) dev_info(&cmd->device->sdev_gendev , ## arg)
265void sym_xpt_async_bus_reset(struct sym_hcb *np);
266int sym_setup_data_and_start (struct sym_hcb *np, struct scsi_cmnd *csio, struct sym_ccb *cp);
267void sym_log_bus_error(struct Scsi_Host *);
268void sym_dump_registers(struct Scsi_Host *);
269
270#endif
271