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