isp_netbsd.h revision 1.29 1 1.29 mjacob /* $NetBSD: isp_netbsd.h,v 1.29 2000/08/14 07:10:09 mjacob Exp $ */
2 1.29 mjacob /*
3 1.29 mjacob * This driver, which is contained in NetBSD in the files:
4 1.29 mjacob *
5 1.29 mjacob * sys/dev/ic/isp.c
6 1.29 mjacob * sys/dev/ic/ic/isp.c
7 1.29 mjacob * sys/dev/ic/ic/isp_inline.h
8 1.29 mjacob * sys/dev/ic/ic/isp_netbsd.c
9 1.29 mjacob * sys/dev/ic/ic/isp_netbsd.h
10 1.29 mjacob * sys/dev/ic/ic/isp_target.c
11 1.29 mjacob * sys/dev/ic/ic/isp_target.h
12 1.29 mjacob * sys/dev/ic/ic/isp_tpublic.h
13 1.29 mjacob * sys/dev/ic/ic/ispmbox.h
14 1.29 mjacob * sys/dev/ic/ic/ispreg.h
15 1.29 mjacob * sys/dev/ic/ic/ispvar.h
16 1.29 mjacob * sys/microcode/isp/asm_sbus.h
17 1.29 mjacob * sys/microcode/isp/asm_1040.h
18 1.29 mjacob * sys/microcode/isp/asm_1080.h
19 1.29 mjacob * sys/microcode/isp/asm_12160.h
20 1.29 mjacob * sys/microcode/isp/asm_2100.h
21 1.29 mjacob * sys/microcode/isp/asm_2200.h
22 1.29 mjacob * sys/pci/isp_pci.c
23 1.29 mjacob * sys/sbus/isp_sbus.c
24 1.29 mjacob *
25 1.29 mjacob * Is being actively maintained by Matthew Jacob (mjacob (at) netbsd.org).
26 1.29 mjacob * This driver also is shared source with FreeBSD, OpenBSD, Linux, Solaris,
27 1.29 mjacob * Linux versions. This tends to be an interesting maintenance problem.
28 1.29 mjacob *
29 1.29 mjacob * Please coordinate with Matthew Jacob on changes you wish to make here.
30 1.29 mjacob */
31 1.1 mjacob /*
32 1.1 mjacob * NetBSD Specific definitions for the Qlogic ISP Host Adapter
33 1.15 mjacob * Matthew Jacob <mjacob (at) nas.nasa.gov>
34 1.15 mjacob */
35 1.15 mjacob /*
36 1.15 mjacob * Copyright (C) 1997, 1998, 1999 National Aeronautics & Space Administration
37 1.1 mjacob * All rights reserved.
38 1.1 mjacob *
39 1.1 mjacob * Redistribution and use in source and binary forms, with or without
40 1.1 mjacob * modification, are permitted provided that the following conditions
41 1.1 mjacob * are met:
42 1.1 mjacob * 1. Redistributions of source code must retain the above copyright
43 1.15 mjacob * notice, this list of conditions and the following disclaimer.
44 1.1 mjacob * 2. Redistributions in binary form must reproduce the above copyright
45 1.1 mjacob * notice, this list of conditions and the following disclaimer in the
46 1.1 mjacob * documentation and/or other materials provided with the distribution.
47 1.1 mjacob * 3. The name of the author may not be used to endorse or promote products
48 1.15 mjacob * derived from this software without specific prior written permission
49 1.1 mjacob *
50 1.15 mjacob * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
51 1.15 mjacob * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
52 1.15 mjacob * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
53 1.15 mjacob * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
54 1.15 mjacob * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
55 1.15 mjacob * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
56 1.15 mjacob * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
57 1.15 mjacob * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
58 1.15 mjacob * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
59 1.15 mjacob * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
60 1.1 mjacob */
61 1.1 mjacob #ifndef _ISP_NETBSD_H
62 1.1 mjacob #define _ISP_NETBSD_H
63 1.1 mjacob
64 1.1 mjacob #include <sys/types.h>
65 1.1 mjacob #include <sys/param.h>
66 1.1 mjacob #include <sys/systm.h>
67 1.1 mjacob #include <sys/kernel.h>
68 1.1 mjacob #include <sys/errno.h>
69 1.1 mjacob #include <sys/ioctl.h>
70 1.1 mjacob #include <sys/device.h>
71 1.1 mjacob #include <sys/malloc.h>
72 1.1 mjacob #include <sys/buf.h>
73 1.1 mjacob #include <sys/proc.h>
74 1.1 mjacob #include <sys/user.h>
75 1.1 mjacob
76 1.1 mjacob
77 1.1 mjacob #include <dev/scsipi/scsi_all.h>
78 1.1 mjacob #include <dev/scsipi/scsipi_all.h>
79 1.1 mjacob #include <dev/scsipi/scsiconf.h>
80 1.1 mjacob
81 1.1 mjacob #include <dev/scsipi/scsi_message.h>
82 1.1 mjacob #include <dev/scsipi/scsipi_debug.h>
83 1.1 mjacob
84 1.15 mjacob #include "opt_isp.h"
85 1.26 mjacob
86 1.15 mjacob
87 1.27 mjacob #define ISP_PLATFORM_VERSION_MAJOR 1
88 1.27 mjacob #define ISP_PLATFORM_VERSION_MINOR 0
89 1.1 mjacob
90 1.1 mjacob struct isposinfo {
91 1.1 mjacob struct device _dev;
92 1.1 mjacob struct scsipi_link _link;
93 1.14 mjacob struct scsipi_link _link_b;
94 1.6 mjacob struct scsipi_adapter _adapter;
95 1.27 mjacob int splsaved;
96 1.27 mjacob int mboxwaiting;
97 1.29 mjacob u_int32_t islocked;
98 1.29 mjacob u_int32_t onintstack;
99 1.29 mjacob unsigned int : 30,
100 1.27 mjacob no_mbox_ints : 1,
101 1.29 mjacob blocked : 1;
102 1.18 mjacob union {
103 1.27 mjacob u_int64_t _wwn;
104 1.18 mjacob u_int16_t _discovered[2];
105 1.27 mjacob #define wwn_seed un._wwn
106 1.27 mjacob #define discovered un._discovered
107 1.18 mjacob } un;
108 1.10 mjacob TAILQ_HEAD(, scsipi_xfer) waitq;
109 1.23 thorpej struct callout _restart;
110 1.1 mjacob };
111 1.18 mjacob
112 1.27 mjacob /*
113 1.27 mjacob * Required Macros/Defines
114 1.27 mjacob */
115 1.27 mjacob
116 1.27 mjacob #define INLINE inline
117 1.27 mjacob
118 1.27 mjacob #define ISP2100_FABRIC 1
119 1.15 mjacob #define ISP2100_SCRLEN 0x400
120 1.1 mjacob
121 1.27 mjacob #define MEMZERO bzero
122 1.27 mjacob #define MEMCPY(dst, src, amt) bcopy((src), (dst), (amt))
123 1.27 mjacob #define SNPRINTF snprintf
124 1.27 mjacob #define STRNCAT strncat
125 1.27 mjacob #define USEC_DELAY DELAY
126 1.27 mjacob
127 1.27 mjacob #define NANOTIME_T struct timeval
128 1.27 mjacob #define GET_NANOTIME microtime
129 1.27 mjacob #define GET_NANOSEC(x) (((x)->tv_sec * 1000000 + (x)->tv_usec) * 1000)
130 1.27 mjacob #define NANOTIME_SUB isp_microtime_sub
131 1.1 mjacob
132 1.27 mjacob #define MAXISPREQUEST(isp) 256
133 1.8 mjacob
134 1.11 mjacob #ifdef __alpha__
135 1.27 mjacob #define MEMORYBARRIER(isp, type, offset, size) alpha_mb()
136 1.11 mjacob #else
137 1.27 mjacob #define MEMORYBARRIER(isp, type, offset, size)
138 1.11 mjacob #endif
139 1.3 mjacob
140 1.27 mjacob #define MBOX_ACQUIRE(isp)
141 1.27 mjacob #define MBOX_WAIT_COMPLETE isp_wait_complete
142 1.13 mjacob
143 1.27 mjacob #define MBOX_NOTIFY_COMPLETE(isp) \
144 1.27 mjacob if (isp->isp_osinfo.mboxwaiting) { \
145 1.27 mjacob isp->isp_osinfo.mboxwaiting = 0; \
146 1.27 mjacob wakeup(&isp->isp_osinfo.mboxwaiting); \
147 1.27 mjacob } \
148 1.27 mjacob isp->isp_mboxbsy = 0
149 1.1 mjacob
150 1.27 mjacob #define MBOX_RELEASE(isp)
151 1.26 mjacob
152 1.27 mjacob #ifndef SCSI_GOOD
153 1.27 mjacob #define SCSI_GOOD 0x0
154 1.27 mjacob #endif
155 1.27 mjacob #ifndef SCSI_CHECK
156 1.27 mjacob #define SCSI_CHECK 0x2
157 1.27 mjacob #endif
158 1.27 mjacob #ifndef SCSI_BUSY
159 1.27 mjacob #define SCSI_BUSY 0x8
160 1.27 mjacob #endif
161 1.27 mjacob #ifndef SCSI_QFULL
162 1.27 mjacob #define SCSI_QFULL 0x28
163 1.27 mjacob #endif
164 1.26 mjacob
165 1.27 mjacob #define XS_T struct scsipi_xfer
166 1.27 mjacob #define XS_CHANNEL(xs) \
167 1.27 mjacob (((int) (xs)->sc_link->scsipi_scsi.channel == SCSI_CHANNEL_ONLY_ONE) ? \
168 1.27 mjacob 0 : (xs)->sc_link->scsipi_scsi.channel)
169 1.1 mjacob #define XS_ISP(xs) (xs)->sc_link->adapter_softc
170 1.11 mjacob #define XS_LUN(xs) ((int) (xs)->sc_link->scsipi_scsi.lun)
171 1.11 mjacob #define XS_TGT(xs) ((int) (xs)->sc_link->scsipi_scsi.target)
172 1.27 mjacob #define XS_CDBP(xs) ((caddr_t) (xs)->cmd)
173 1.27 mjacob #define XS_CDBLEN(xs) (xs)->cmdlen
174 1.1 mjacob #define XS_XFRLEN(xs) (xs)->datalen
175 1.1 mjacob #define XS_TIME(xs) (xs)->timeout
176 1.27 mjacob #define XS_RESID(xs) (xs)->resid
177 1.27 mjacob #define XS_STSP(xs) (&(xs)->status)
178 1.1 mjacob #define XS_SNSP(xs) (&(xs)->sense.scsi_sense)
179 1.27 mjacob #define XS_SNSLEN(xs) (sizeof (xs)->sense)
180 1.1 mjacob #define XS_SNSKEY(xs) ((xs)->sense.scsi_sense.flags)
181 1.27 mjacob #define XS_TAG_P(ccb) (((xs)->xs_control & XS_CTL_POLL) != 0)
182 1.27 mjacob #define XS_TAG_TYPE(xs) \
183 1.28 tls (((xs)->xs_control & XS_CTL_URGENT) ? REQFLAG_HTAG : \
184 1.28 tls ((xs)->bp && xs->bp->b_flags & B_ASYNC) ? REQFLAG_STAG : REQFLAG_OTAG)
185 1.27 mjacob
186 1.27 mjacob #define XS_SETERR(xs, v) (xs)->error = v
187 1.27 mjacob
188 1.27 mjacob # define HBA_NOERROR XS_NOERROR
189 1.27 mjacob # define HBA_BOTCH XS_DRIVER_STUFFUP
190 1.27 mjacob # define HBA_CMDTIMEOUT XS_TIMEOUT
191 1.27 mjacob # define HBA_SELTIMEOUT XS_SELTIMEOUT
192 1.27 mjacob # define HBA_TGTBSY XS_BUSY
193 1.27 mjacob # define HBA_BUSRESET XS_RESET
194 1.27 mjacob # define HBA_ABORTED XS_DRIVER_STUFFUP
195 1.27 mjacob # define HBA_DATAOVR XS_DRIVER_STUFFUP
196 1.27 mjacob # define HBA_ARQFAIL XS_DRIVER_STUFFUP
197 1.1 mjacob
198 1.27 mjacob #define XS_ERR(xs) (xs)->error
199 1.27 mjacob
200 1.27 mjacob #define XS_NOERR(xs) (xs)->error == XS_NOERROR
201 1.27 mjacob
202 1.27 mjacob #define XS_INITERR(xs) (xs)->error = 0, XS_CMD_S_CLEAR(xs)
203 1.27 mjacob
204 1.27 mjacob #define XS_SAVE_SENSE(xs, sp) \
205 1.27 mjacob bcopy(sp->req_sense_data, &(xs)->sense, \
206 1.27 mjacob imin(XS_SNSLEN(xs), sp->req_sense_len))
207 1.27 mjacob
208 1.27 mjacob #define XS_SET_STATE_STAT(a, b, c)
209 1.27 mjacob
210 1.27 mjacob #define DEFAULT_IID(x) 7
211 1.27 mjacob #define DEFAULT_LOOPID(x) 108
212 1.27 mjacob #define DEFAULT_NODEWWN(isp) (isp)->isp_osinfo.un._wwn
213 1.27 mjacob #define DEFAULT_PORTWWN(isp) \
214 1.27 mjacob isp_port_from_node_wwn((isp), DEFAULT_NODEWWN(isp))
215 1.27 mjacob #define PORT_FROM_NODE_WWN isp_port_from_node_wwn
216 1.27 mjacob
217 1.27 mjacob #define ISP_UNSWIZZLE_AND_COPY_PDBP(isp, dest, src) \
218 1.27 mjacob if((void *)src != (void *)dest) bcopy(src, dest, sizeof (isp_pdb_t))
219 1.27 mjacob #define ISP_SWIZZLE_ICB(a, b)
220 1.27 mjacob #ifdef __sparc__
221 1.27 mjacob #define ISP_SWIZZLE_REQUEST(a, b) \
222 1.27 mjacob ISP_SBUSIFY_ISPHDR(a, &(b)->req_header); \
223 1.27 mjacob ISP_SBUSIFY_ISPREQ(a, b)
224 1.27 mjacob #define ISP_UNSWIZZLE_RESPONSE(a, b, c) \
225 1.27 mjacob ISP_SBUSIFY_ISPHDR(a, &(b)->req_header)
226 1.3 mjacob #else
227 1.27 mjacob #define ISP_SWIZZLE_REQUEST(a, b)
228 1.27 mjacob #define ISP_UNSWIZZLE_RESPONSE(a, b, c)
229 1.3 mjacob #endif
230 1.27 mjacob #define ISP_SWIZZLE_SNS_REQ(a, b)
231 1.27 mjacob #define ISP_UNSWIZZLE_SNS_RSP(a, b, c)
232 1.27 mjacob #ifdef __sparc__
233 1.27 mjacob #define ISP_SWIZZLE_NVRAM_WORD(isp, rp) \
234 1.27 mjacob { \
235 1.27 mjacob u_int16_t tmp = *rp >> 8; \
236 1.27 mjacob tmp |= ((*rp & 0xff) << 8); \
237 1.27 mjacob *rp = tmp; \
238 1.27 mjacob }
239 1.27 mjacob #else
240 1.27 mjacob #define ISP_SWIZZLE_NVRAM_WORD(isp, rp)
241 1.27 mjacob #endif
242 1.27 mjacob
243 1.27 mjacob /*
244 1.27 mjacob * Includes of common header files
245 1.27 mjacob */
246 1.1 mjacob
247 1.27 mjacob #include <dev/ic/ispreg.h>
248 1.27 mjacob #include <dev/ic/ispvar.h>
249 1.27 mjacob #include <dev/ic/ispmbox.h>
250 1.27 mjacob
251 1.27 mjacob /*
252 1.27 mjacob * isp_osinfo definitions, extensions and shorthand.
253 1.27 mjacob */
254 1.27 mjacob #define isp_name isp_osinfo._dev.dv_xname
255 1.27 mjacob #define isp_unit isp_osinfo._dev.dv_unit
256 1.27 mjacob
257 1.27 mjacob /*
258 1.27 mjacob * Driver prototypes..
259 1.27 mjacob */
260 1.27 mjacob void isp_attach __P((struct ispsoftc *));
261 1.27 mjacob void isp_uninit __P((struct ispsoftc *));
262 1.27 mjacob
263 1.27 mjacob static inline void isp_lock __P((struct ispsoftc *));
264 1.27 mjacob static inline void isp_unlock __P((struct ispsoftc *));
265 1.27 mjacob static inline char *strncat __P((char *, const char *, size_t));
266 1.27 mjacob static inline u_int64_t
267 1.27 mjacob isp_port_from_node_wwn __P((struct ispsoftc *, u_int64_t));
268 1.27 mjacob static inline u_int64_t
269 1.27 mjacob isp_microtime_sub __P((struct timeval *, struct timeval *));
270 1.27 mjacob static void isp_wait_complete __P((struct ispsoftc *));
271 1.27 mjacob
272 1.27 mjacob /*
273 1.27 mjacob * Driver wide data...
274 1.27 mjacob */
275 1.27 mjacob
276 1.27 mjacob /*
277 1.27 mjacob * Locking macros...
278 1.27 mjacob */
279 1.27 mjacob #define ISP_LOCK isp_lock
280 1.27 mjacob #define ISP_UNLOCK isp_unlock
281 1.29 mjacob #define ISP_ILOCK(x) isp_lock(x); isp->isp_osinfo.onintstack++
282 1.29 mjacob #define ISP_IUNLOCK(x) isp->isp_osinfo.onintstack--; isp_unlock(x)
283 1.27 mjacob
284 1.27 mjacob /*
285 1.27 mjacob * Platform private flags
286 1.27 mjacob */
287 1.1 mjacob
288 1.26 mjacob #define XS_PSTS_INWDOG 0x10000000
289 1.26 mjacob #define XS_PSTS_GRACE 0x20000000
290 1.26 mjacob #define XS_PSTS_ALL 0x30000000
291 1.26 mjacob
292 1.26 mjacob #define XS_CMD_S_WDOG(xs) (xs)->xs_status |= XS_PSTS_INWDOG
293 1.26 mjacob #define XS_CMD_C_WDOG(xs) (xs)->xs_status &= ~XS_PSTS_INWDOG
294 1.26 mjacob #define XS_CMD_WDOG_P(xs) (((xs)->xs_status & XS_PSTS_INWDOG) != 0)
295 1.26 mjacob
296 1.26 mjacob #define XS_CMD_S_GRACE(xs) (xs)->xs_status |= XS_PSTS_GRACE
297 1.26 mjacob #define XS_CMD_C_GRACE(xs) (xs)->xs_status &= ~XS_PSTS_GRACE
298 1.26 mjacob #define XS_CMD_GRACE_P(xs) (((xs)->xs_status & XS_PSTS_GRACE) != 0)
299 1.26 mjacob
300 1.26 mjacob #define XS_CMD_S_DONE(xs) (xs)->xs_status |= XS_STS_DONE
301 1.26 mjacob #define XS_CMD_C_DONE(xs) (xs)->xs_status &= ~XS_STS_DONE
302 1.26 mjacob #define XS_CMD_DONE_P(xs) (((xs)->xs_status & XS_STS_DONE) != 0)
303 1.26 mjacob
304 1.26 mjacob #define XS_CMD_S_CLEAR(xs) (xs)->xs_status &= ~XS_PSTS_ALL
305 1.26 mjacob
306 1.1 mjacob /*
307 1.27 mjacob * Platform specific 'inline' or support functions
308 1.1 mjacob */
309 1.27 mjacob static inline void
310 1.27 mjacob isp_lock(isp)
311 1.27 mjacob struct ispsoftc *isp;
312 1.27 mjacob {
313 1.27 mjacob int s = splbio();
314 1.29 mjacob if (isp->isp_osinfo.islocked++ == 0) {
315 1.27 mjacob isp->isp_osinfo.splsaved = s;
316 1.27 mjacob } else {
317 1.27 mjacob splx(s);
318 1.27 mjacob }
319 1.27 mjacob }
320 1.1 mjacob
321 1.27 mjacob static inline void
322 1.27 mjacob isp_unlock(isp)
323 1.27 mjacob struct ispsoftc *isp;
324 1.27 mjacob {
325 1.29 mjacob if (isp->isp_osinfo.islocked <= 1) {
326 1.27 mjacob isp->isp_osinfo.islocked = 0;
327 1.27 mjacob splx(isp->isp_osinfo.splsaved);
328 1.27 mjacob }
329 1.27 mjacob }
330 1.1 mjacob
331 1.26 mjacob static inline char *
332 1.27 mjacob strncat(d, s, c)
333 1.27 mjacob char *d;
334 1.27 mjacob const char *s;
335 1.27 mjacob size_t c;
336 1.26 mjacob {
337 1.26 mjacob char *t = d;
338 1.26 mjacob
339 1.26 mjacob if (c) {
340 1.26 mjacob while (*d)
341 1.26 mjacob d++;
342 1.26 mjacob while ((*d++ = *s++)) {
343 1.26 mjacob if (--c == 0) {
344 1.26 mjacob *d = '\0';
345 1.26 mjacob break;
346 1.26 mjacob }
347 1.26 mjacob }
348 1.26 mjacob }
349 1.26 mjacob return (t);
350 1.26 mjacob }
351 1.26 mjacob
352 1.27 mjacob static inline u_int64_t
353 1.27 mjacob isp_microtime_sub(b, a)
354 1.27 mjacob struct timeval *b;
355 1.27 mjacob struct timeval *a;
356 1.27 mjacob {
357 1.27 mjacob struct timeval x;
358 1.27 mjacob u_int64_t elapsed;
359 1.27 mjacob timersub(b, a, &x);
360 1.27 mjacob elapsed = GET_NANOSEC(&x);
361 1.27 mjacob if (elapsed == 0)
362 1.27 mjacob elapsed++;
363 1.27 mjacob return (elapsed);
364 1.27 mjacob }
365 1.18 mjacob
366 1.27 mjacob static inline void
367 1.27 mjacob isp_wait_complete(isp)
368 1.27 mjacob struct ispsoftc *isp;
369 1.27 mjacob {
370 1.27 mjacob if (isp->isp_osinfo.onintstack || isp->isp_osinfo.no_mbox_ints) {
371 1.27 mjacob int usecs = 0;
372 1.27 mjacob while (usecs < 2 * 1000000) {
373 1.27 mjacob (void) isp_intr(isp);
374 1.27 mjacob if (isp->isp_mboxbsy == 0) {
375 1.27 mjacob break;
376 1.27 mjacob }
377 1.27 mjacob USEC_DELAY(500);
378 1.27 mjacob usecs += 500;
379 1.27 mjacob }
380 1.27 mjacob if (isp->isp_mboxbsy != 0) {
381 1.27 mjacob isp_prt(isp, ISP_LOGWARN, "Mailbox Cmd (poll) Timeout");
382 1.27 mjacob }
383 1.27 mjacob } else {
384 1.27 mjacob int rv = 0;
385 1.27 mjacob isp->isp_osinfo.mboxwaiting = 1;
386 1.27 mjacob while (isp->isp_osinfo.mboxwaiting && rv == 0) {
387 1.27 mjacob static struct timeval twosec = { 2, 0 };
388 1.27 mjacob int timo;
389 1.27 mjacob struct timeval tv;
390 1.27 mjacob microtime(&tv);
391 1.27 mjacob timeradd(&tv, &twosec, &tv);
392 1.27 mjacob if ((timo = hzto(&tv)) == 0) {
393 1.27 mjacob timo = 1;
394 1.27 mjacob }
395 1.27 mjacob rv = tsleep(&isp->isp_osinfo.mboxwaiting,
396 1.27 mjacob PRIBIO, "isp_mboxcmd", timo);
397 1.27 mjacob }
398 1.27 mjacob if (rv == EWOULDBLOCK) {
399 1.27 mjacob isp->isp_mboxbsy = 0;
400 1.27 mjacob isp->isp_osinfo.mboxwaiting = 0;
401 1.27 mjacob isp_prt(isp, ISP_LOGWARN, "Mailbox Cmd (intr) Timeout");
402 1.27 mjacob }
403 1.27 mjacob }
404 1.27 mjacob }
405 1.27 mjacob
406 1.27 mjacob static inline u_int64_t
407 1.27 mjacob isp_port_from_node_wwn(struct ispsoftc *isp, u_int64_t node_wwn)
408 1.27 mjacob {
409 1.27 mjacob u_int64_t rv = node_wwn;
410 1.27 mjacob if ((node_wwn >> 60) == 2) {
411 1.27 mjacob rv = node_wwn |
412 1.27 mjacob (((u_int64_t)(isp->isp_unit+1)) << 48);
413 1.27 mjacob }
414 1.27 mjacob return (rv);
415 1.27 mjacob }
416 1.27 mjacob
417 1.27 mjacob /*
418 1.27 mjacob * Common inline functions
419 1.27 mjacob */
420 1.18 mjacob #define INLINE inline
421 1.18 mjacob #include <dev/ic/isp_inline.h>
422 1.18 mjacob
423 1.19 mjacob #if !defined(ISP_DISABLE_FW) && !defined(ISP_COMPILE_FW)
424 1.19 mjacob #define ISP_COMPILE_FW 1
425 1.19 mjacob #endif
426 1.1 mjacob #endif /* _ISP_NETBSD_H */
427