xref: /freebsd/sys/dev/isp/isp_freebsd.h (revision 2b743a9e9ddc6736208dc8ca1ce06ce64ad20a19)
1 /* $FreeBSD$ */
2 /*-
3  * Qlogic ISP SCSI Host Adapter FreeBSD Wrapper Definitions
4  *
5  * Copyright (c) 1997-2006 by Matthew Jacob
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice immediately at the beginning of the file, without modification,
13  *    this list of conditions, and the following disclaimer.
14  * 2. The name of the author may not be used to endorse or promote products
15  *    derived from this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
21  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27  * SUCH DAMAGE.
28  */
29 #ifndef	_ISP_FREEBSD_H
30 #define	_ISP_FREEBSD_H
31 
32 #include <sys/param.h>
33 #include <sys/systm.h>
34 #include <sys/endian.h>
35 #if __FreeBSD_version < 500000
36 #include <sys/kernel.h>
37 #include <sys/queue.h>
38 #include <sys/malloc.h>
39 #else
40 #include <sys/lock.h>
41 #include <sys/kernel.h>
42 #include <sys/queue.h>
43 #include <sys/malloc.h>
44 #include <sys/mutex.h>
45 #include <sys/condvar.h>
46 #endif
47 
48 #include <sys/proc.h>
49 #include <sys/bus.h>
50 
51 #include <machine/bus.h>
52 #if __FreeBSD_version < 500000
53 #include <machine/clock.h>
54 #endif
55 #include <machine/cpu.h>
56 
57 #include <cam/cam.h>
58 #include <cam/cam_debug.h>
59 #include <cam/cam_ccb.h>
60 #include <cam/cam_sim.h>
61 #include <cam/cam_xpt.h>
62 #include <cam/cam_xpt_sim.h>
63 #include <cam/cam_debug.h>
64 #include <cam/scsi/scsi_all.h>
65 #include <cam/scsi/scsi_message.h>
66 
67 #include "opt_ddb.h"
68 #include "opt_isp.h"
69 
70 #if __FreeBSD_version < 500000
71 #define	ISP_PLATFORM_VERSION_MAJOR	4
72 #define	ISP_PLATFORM_VERSION_MINOR	17
73 #else
74 #define	ISP_PLATFORM_VERSION_MAJOR	5
75 #define	ISP_PLATFORM_VERSION_MINOR	9
76 #endif
77 
78 /*
79  * Efficiency- get rid of SBus code && tests unless we need them.
80  */
81 #ifdef __sparc64__
82 #define	ISP_SBUS_SUPPORTED	1
83 #else
84 #define	ISP_SBUS_SUPPORTED	0
85 #endif
86 
87 #define	HANDLE_LOOPSTATE_IN_OUTER_LAYERS	1
88 /* #define	ISP_SMPLOCK			1 */
89 
90 #if __FreeBSD_version < 500000
91 #define	ISP_IFLAGS	INTR_TYPE_CAM
92 #else
93 #ifdef	ISP_SMPLOCK
94 #define	ISP_IFLAGS	INTR_TYPE_CAM | INTR_ENTROPY | INTR_MPSAFE
95 #else
96 #define	ISP_IFLAGS	INTR_TYPE_CAM | INTR_ENTROPY
97 #endif
98 #endif
99 
100 #if __FreeBSD_version < 700000
101 typedef void ispfwfunc(int, int, int, void **);
102 #endif
103 
104 #ifdef	ISP_TARGET_MODE
105 #define	ISP_TARGET_FUNCTIONS	1
106 #define	ATPDPSIZE	256
107 typedef struct {
108 	uint32_t	orig_datalen;
109 	uint32_t	bytes_xfered;
110 	uint32_t	last_xframt;
111 	uint32_t	tag	: 16,
112 			lun	: 13,	/* not enough */
113 			state	: 3;
114 } atio_private_data_t;
115 #define	ATPD_STATE_FREE			0
116 #define	ATPD_STATE_ATIO			1
117 #define	ATPD_STATE_CAM			2
118 #define	ATPD_STATE_CTIO			3
119 #define	ATPD_STATE_LAST_CTIO		4
120 #define	ATPD_STATE_PDON			5
121 
122 typedef struct tstate {
123 	struct tstate *next;
124 	struct cam_path *owner;
125 	struct ccb_hdr_slist atios;
126 	struct ccb_hdr_slist inots;
127 	lun_id_t lun;
128 	int bus;
129 	uint32_t hold;
130 	int atio_count;
131 	int inot_count;
132 } tstate_t;
133 
134 #define	LUN_HASH_SIZE			32
135 #define	LUN_HASH_FUNC(isp, port, lun)					\
136 	((IS_DUALBUS(isp)) ?						\
137 		(((lun) & ((LUN_HASH_SIZE >> 1) - 1)) << (port)) :	\
138 		((lun) & (LUN_HASH_SIZE - 1)))
139 #endif
140 
141 struct isposinfo {
142 	struct ispsoftc *	next;
143 	uint64_t		default_port_wwn;
144 	uint64_t		default_node_wwn;
145 	uint32_t		default_id;
146 	device_t		dev;
147 	struct cam_sim		*sim;
148 	struct cam_path		*path;
149 	struct cam_sim		*sim2;
150 	struct cam_path		*path2;
151 	struct intr_config_hook	ehook;
152 	uint32_t		loop_down_time;
153 	uint32_t		loop_down_limit;
154 	uint32_t		gone_device_time;
155 	uint32_t		: 5,
156 		simqfrozen	: 3,
157 		hysteresis	: 8,
158 		gdt_running	: 1,
159 		ldt_running	: 1,
160 		disabled	: 1,
161 		fcbsy		: 1,
162 		mbox_sleeping	: 1,
163 		mbox_sleep_ok	: 1,
164 		mboxcmd_done	: 1,
165 		mboxbsy		: 1;
166 	struct callout_handle 	ldt;	/* loop down timer */
167 	struct callout_handle	gdt;	/* gone device timer */
168 #if __FreeBSD_version >= 500000
169 	const struct firmware *	fw;
170 	struct mtx		lock;
171 	struct cv		kthread_cv;
172 	union {
173 		struct {
174 			char wwnn[17];
175 			char wwpn[17];
176 		} fc;
177 	} sysctl_info;
178 #endif
179 	struct proc		*kproc;
180 	bus_dma_tag_t		cdmat;
181 	bus_dmamap_t		cdmap;
182 #define	isp_cdmat		isp_osinfo.cdmat
183 #define	isp_cdmap		isp_osinfo.cdmap
184 #ifdef	ISP_TARGET_MODE
185 #define	TM_WILDCARD_ENABLED	0x02
186 #define	TM_TMODE_ENABLED	0x01
187 	uint8_t			tmflags[2];	/* two busses */
188 #define	NLEACT	4
189 	union ccb *		leact[NLEACT];
190 	tstate_t		tsdflt[2];	/* two busses */
191 	tstate_t		*lun_hash[LUN_HASH_SIZE];
192 	atio_private_data_t	atpdp[ATPDPSIZE];
193 #endif
194 };
195 
196 #define	isp_lock	isp_osinfo.lock
197 
198 /*
199  * Locking macros...
200  */
201 
202 #ifdef	ISP_SMPLOCK
203 #define	ISP_LOCK(x)		mtx_lock(&(x)->isp_lock)
204 #define	ISP_UNLOCK(x)		mtx_unlock(&(x)->isp_lock)
205 #define	ISPLOCK_2_CAMLOCK(isp)	\
206 	mtx_unlock(&(isp)->isp_lock); mtx_lock(&Giant)
207 #define	CAMLOCK_2_ISPLOCK(isp)	\
208 	mtx_unlock(&Giant); mtx_lock(&(isp)->isp_lock)
209 #else
210 #if __FreeBSD_version < 500000
211 #define	ISP_LOCK(x)		do { } while (0)
212 #define	ISP_UNLOCK(x)		do { } while (0)
213 #define	ISPLOCK_2_CAMLOCK(isp)	do { } while (0)
214 #define	CAMLOCK_2_ISPLOCK(isp)	do { } while (0)
215 #else
216 #define	ISP_LOCK(x)		GIANT_REQUIRED
217 #define	ISP_UNLOCK(x)		do { } while (0)
218 #define	ISPLOCK_2_CAMLOCK(isp)	do { } while (0)
219 #define	CAMLOCK_2_ISPLOCK(isp)	GIANT_REQUIRED
220 #endif
221 #endif
222 
223 /*
224  * Required Macros/Defines
225  */
226 
227 #define	ISP2100_SCRLEN		0x1000
228 
229 #define	MEMZERO(a, b)		memset(a, 0, b)
230 #define	MEMCPY			memcpy
231 #define	SNPRINTF		snprintf
232 #define	USEC_DELAY		DELAY
233 #define	USEC_SLEEP(isp, x)	DELAY(x)
234 
235 #define	NANOTIME_T		struct timespec
236 #define	GET_NANOTIME		nanotime
237 #define	GET_NANOSEC(x)		((x)->tv_sec * 1000000000 + (x)->tv_nsec)
238 #define	NANOTIME_SUB		isp_nanotime_sub
239 
240 #define	MAXISPREQUEST(isp)	((IS_FC(isp) || IS_ULTRA2(isp))? 1024 : 256)
241 
242 #define	MEMORYBARRIER(isp, type, offset, size)			\
243 switch (type) {							\
244 case SYNC_SFORDEV:						\
245 case SYNC_REQUEST:						\
246 	bus_dmamap_sync(isp->isp_cdmat, isp->isp_cdmap, 	\
247 	   BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);		\
248 	break;							\
249 case SYNC_SFORCPU:						\
250 case SYNC_RESULT:						\
251 	bus_dmamap_sync(isp->isp_cdmat, isp->isp_cdmap,		\
252 	   BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);	\
253 	break;							\
254 default:							\
255 	break;							\
256 }
257 
258 #define	MBOX_ACQUIRE			isp_mbox_acquire
259 #define	MBOX_WAIT_COMPLETE		isp_mbox_wait_complete
260 #define	MBOX_NOTIFY_COMPLETE		isp_mbox_notify_done
261 #define	MBOX_RELEASE			isp_mbox_release
262 
263 #define	FC_SCRATCH_ACQUIRE(isp)						\
264 	if (isp->isp_osinfo.fcbsy) {					\
265 		isp_prt(isp, ISP_LOGWARN,				\
266 		    "FC scratch area busy (line %d)!", __LINE__);	\
267 	} else								\
268 		isp->isp_osinfo.fcbsy = 1
269 #define	FC_SCRATCH_RELEASE(isp)		 isp->isp_osinfo.fcbsy = 0
270 
271 #ifndef	SCSI_GOOD
272 #define	SCSI_GOOD	SCSI_STATUS_OK
273 #endif
274 #ifndef	SCSI_CHECK
275 #define	SCSI_CHECK	SCSI_STATUS_CHECK_COND
276 #endif
277 #ifndef	SCSI_BUSY
278 #define	SCSI_BUSY	SCSI_STATUS_BUSY
279 #endif
280 #ifndef	SCSI_QFULL
281 #define	SCSI_QFULL	SCSI_STATUS_QUEUE_FULL
282 #endif
283 
284 #define	XS_T			struct ccb_scsiio
285 #define	XS_DMA_ADDR_T		bus_addr_t
286 #define	XS_ISP(ccb)		((ispsoftc_t *) (ccb)->ccb_h.spriv_ptr1)
287 #define	XS_CHANNEL(ccb)		cam_sim_bus(xpt_path_sim((ccb)->ccb_h.path))
288 #define	XS_TGT(ccb)		(ccb)->ccb_h.target_id
289 #define	XS_LUN(ccb)		(ccb)->ccb_h.target_lun
290 
291 #define	XS_CDBP(ccb)	\
292 	(((ccb)->ccb_h.flags & CAM_CDB_POINTER)? \
293 	 (ccb)->cdb_io.cdb_ptr : (ccb)->cdb_io.cdb_bytes)
294 
295 #define	XS_CDBLEN(ccb)		(ccb)->cdb_len
296 #define	XS_XFRLEN(ccb)		(ccb)->dxfer_len
297 #define	XS_TIME(ccb)		(ccb)->ccb_h.timeout
298 #define	XS_RESID(ccb)		(ccb)->resid
299 #define	XS_STSP(ccb)		(&(ccb)->scsi_status)
300 #define	XS_SNSP(ccb)		(&(ccb)->sense_data)
301 
302 #define	XS_SNSLEN(ccb)		\
303 	imin((sizeof((ccb)->sense_data)), ccb->sense_len)
304 
305 #define	XS_SNSKEY(ccb)		((ccb)->sense_data.flags & 0xf)
306 #define	XS_TAG_P(ccb)	\
307 	(((ccb)->ccb_h.flags & CAM_TAG_ACTION_VALID) && \
308 	 (ccb)->tag_action != CAM_TAG_ACTION_NONE)
309 
310 #define	XS_TAG_TYPE(ccb)	\
311 	((ccb->tag_action == MSG_SIMPLE_Q_TAG)? REQFLAG_STAG : \
312 	 ((ccb->tag_action == MSG_HEAD_OF_Q_TAG)? REQFLAG_HTAG : REQFLAG_OTAG))
313 
314 
315 #define	XS_SETERR(ccb, v)	(ccb)->ccb_h.status &= ~CAM_STATUS_MASK, \
316 				(ccb)->ccb_h.status |= v, \
317 				(ccb)->ccb_h.spriv_field0 |= ISP_SPRIV_ERRSET
318 
319 #	define	HBA_NOERROR		CAM_REQ_INPROG
320 #	define	HBA_BOTCH		CAM_UNREC_HBA_ERROR
321 #	define	HBA_CMDTIMEOUT		CAM_CMD_TIMEOUT
322 #	define	HBA_SELTIMEOUT		CAM_SEL_TIMEOUT
323 #	define	HBA_TGTBSY		CAM_SCSI_STATUS_ERROR
324 #	define	HBA_BUSRESET		CAM_SCSI_BUS_RESET
325 #	define	HBA_ABORTED		CAM_REQ_ABORTED
326 #	define	HBA_DATAOVR		CAM_DATA_RUN_ERR
327 #	define	HBA_ARQFAIL		CAM_AUTOSENSE_FAIL
328 
329 
330 #define	XS_ERR(ccb)		((ccb)->ccb_h.status & CAM_STATUS_MASK)
331 
332 #define	XS_NOERR(ccb)		\
333 	(((ccb)->ccb_h.spriv_field0 & ISP_SPRIV_ERRSET) == 0 || \
334 	 ((ccb)->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_INPROG)
335 
336 #define	XS_INITERR(ccb)		\
337 	XS_SETERR(ccb, CAM_REQ_INPROG), (ccb)->ccb_h.spriv_field0 = 0
338 
339 #define	XS_SAVE_SENSE(xs, sense_ptr, sense_len)		\
340 	(xs)->ccb_h.status |= CAM_AUTOSNS_VALID;	\
341 	memcpy(&(xs)->sense_data, sense_ptr, imin(XS_SNSLEN(xs), sense_len))
342 
343 #define	XS_SET_STATE_STAT(a, b, c)
344 
345 #define	DEFAULT_IID(x)		(isp)->isp_osinfo.default_id
346 #define	DEFAULT_LOOPID(x)	(isp)->isp_osinfo.default_id
347 #define	DEFAULT_NODEWWN(isp)	(isp)->isp_osinfo.default_node_wwn
348 #define	DEFAULT_PORTWWN(isp)	(isp)->isp_osinfo.default_port_wwn
349 #define	ISP_NODEWWN(isp)	FCPARAM(isp)->isp_wwnn_nvram
350 #define	ISP_PORTWWN(isp)	FCPARAM(isp)->isp_wwpn_nvram
351 
352 #if	BYTE_ORDER == BIG_ENDIAN
353 #ifdef	ISP_SBUS_SUPPORTED
354 #define	ISP_IOXPUT_8(isp, s, d)		*(d) = s
355 #define	ISP_IOXPUT_16(isp, s, d)				\
356 	*(d) = (isp->isp_bustype == ISP_BT_SBUS)? s : bswap16(s)
357 #define	ISP_IOXPUT_32(isp, s, d)				\
358 	*(d) = (isp->isp_bustype == ISP_BT_SBUS)? s : bswap32(s)
359 #define	ISP_IOXGET_8(isp, s, d)		d = (*((uint8_t *)s))
360 #define	ISP_IOXGET_16(isp, s, d)				\
361 	d = (isp->isp_bustype == ISP_BT_SBUS)?			\
362 	*((uint16_t *)s) : bswap16(*((uint16_t *)s))
363 #define	ISP_IOXGET_32(isp, s, d)				\
364 	d = (isp->isp_bustype == ISP_BT_SBUS)?			\
365 	*((uint32_t *)s) : bswap32(*((uint32_t *)s))
366 
367 #else	/* ISP_SBUS_SUPPORTED */
368 #define	ISP_IOXPUT_8(isp, s, d)		*(d) = s
369 #define	ISP_IOXPUT_16(isp, s, d)	*(d) = bswap16(s)
370 #define	ISP_IOXPUT_32(isp, s, d)	*(d) = bswap32(s)
371 #define	ISP_IOXGET_8(isp, s, d)		d = (*((uint8_t *)s))
372 #define	ISP_IOXGET_16(isp, s, d)	d = bswap16(*((uint16_t *)s))
373 #define	ISP_IOXGET_32(isp, s, d)	d = bswap32(*((uint32_t *)s))
374 #endif
375 #define	ISP_SWIZZLE_NVRAM_WORD(isp, rp)	*rp = bswap16(*rp)
376 
377 #define	ISP_IOZGET_8(isp, s, d)		d = (*((uint8_t *)s))
378 #define	ISP_IOZGET_16(isp, s, d)	d = (*((uint16_t *)s))
379 #define	ISP_IOZGET_32(isp, s, d)	d = (*((uint32_t *)s))
380 #define	ISP_IOZPUT_8(isp, s, d)		*(d) = s
381 #define	ISP_IOZPUT_16(isp, s, d)	*(d) = s
382 #define	ISP_IOZPUT_32(isp, s, d)	*(d) = s
383 
384 
385 #else
386 #define	ISP_IOXPUT_8(isp, s, d)		*(d) = s
387 #define	ISP_IOXPUT_16(isp, s, d)	*(d) = s
388 #define	ISP_IOXPUT_32(isp, s, d)	*(d) = s
389 #define	ISP_IOXGET_8(isp, s, d)		d = *(s)
390 #define	ISP_IOXGET_16(isp, s, d)	d = *(s)
391 #define	ISP_IOXGET_32(isp, s, d)	d = *(s)
392 #define	ISP_SWIZZLE_NVRAM_WORD(isp, rp)
393 
394 #define	ISP_IOZPUT_8(isp, s, d)		*(d) = s
395 #define	ISP_IOZPUT_16(isp, s, d)	*(d) = bswap16(s)
396 #define	ISP_IOZPUT_32(isp, s, d)	*(d) = bswap32(s)
397 
398 #define	ISP_IOZGET_8(isp, s, d)		d = (*((uint8_t *)(s)))
399 #define	ISP_IOZGET_16(isp, s, d)	d = bswap16(*((uint16_t *)(s)))
400 #define	ISP_IOZGET_32(isp, s, d)	d = bswap32(*((uint32_t *)(s)))
401 
402 #endif
403 
404 /*
405  * Includes of common header files
406  */
407 
408 #include <dev/isp/ispreg.h>
409 #include <dev/isp/ispvar.h>
410 #include <dev/isp/ispmbox.h>
411 
412 #ifdef	ISP_TARGET_MODE
413 #include <dev/isp/isp_tpublic.h>
414 #endif
415 
416 /*
417  * isp_osinfo definiitions && shorthand
418  */
419 #define	SIMQFRZ_RESOURCE	0x1
420 #define	SIMQFRZ_LOOPDOWN	0x2
421 #define	SIMQFRZ_TIMED		0x4
422 
423 #define	isp_sim		isp_osinfo.sim
424 #define	isp_path	isp_osinfo.path
425 #define	isp_sim2	isp_osinfo.sim2
426 #define	isp_path2	isp_osinfo.path2
427 #define	isp_dev		isp_osinfo.dev
428 
429 /*
430  * prototypes for isp_pci && isp_freebsd to share
431  */
432 extern void isp_attach(ispsoftc_t *);
433 extern void isp_uninit(ispsoftc_t *);
434 
435 /*
436  * driver global data
437  */
438 extern int isp_announced;
439 extern int isp_fabric_hysteresis;
440 extern int isp_loop_down_limit;
441 extern int isp_gone_device_time;
442 extern int isp_quickboot_time;
443 
444 /*
445  * Platform private flags
446  */
447 #define	ISP_SPRIV_ERRSET	0x1
448 #define	ISP_SPRIV_INWDOG	0x2
449 #define	ISP_SPRIV_GRACE		0x4
450 #define	ISP_SPRIV_DONE		0x8
451 
452 #define	XS_CMD_S_WDOG(sccb)	(sccb)->ccb_h.spriv_field0 |= ISP_SPRIV_INWDOG
453 #define	XS_CMD_C_WDOG(sccb)	(sccb)->ccb_h.spriv_field0 &= ~ISP_SPRIV_INWDOG
454 #define	XS_CMD_WDOG_P(sccb)	((sccb)->ccb_h.spriv_field0 & ISP_SPRIV_INWDOG)
455 
456 #define	XS_CMD_S_GRACE(sccb)	(sccb)->ccb_h.spriv_field0 |= ISP_SPRIV_GRACE
457 #define	XS_CMD_C_GRACE(sccb)	(sccb)->ccb_h.spriv_field0 &= ~ISP_SPRIV_GRACE
458 #define	XS_CMD_GRACE_P(sccb)	((sccb)->ccb_h.spriv_field0 & ISP_SPRIV_GRACE)
459 
460 #define	XS_CMD_S_DONE(sccb)	(sccb)->ccb_h.spriv_field0 |= ISP_SPRIV_DONE
461 #define	XS_CMD_C_DONE(sccb)	(sccb)->ccb_h.spriv_field0 &= ~ISP_SPRIV_DONE
462 #define	XS_CMD_DONE_P(sccb)	((sccb)->ccb_h.spriv_field0 & ISP_SPRIV_DONE)
463 
464 #define	XS_CMD_S_CLEAR(sccb)	(sccb)->ccb_h.spriv_field0 = 0
465 
466 /*
467  * Platform Library Functions
468  */
469 void isp_prt(ispsoftc_t *, int level, const char *, ...) __printflike(3, 4);
470 uint64_t isp_nanotime_sub(struct timespec *, struct timespec *);
471 int isp_mbox_acquire(ispsoftc_t *);
472 void isp_mbox_wait_complete(ispsoftc_t *, mbreg_t *);
473 void isp_mbox_notify_done(ispsoftc_t *);
474 void isp_mbox_release(ispsoftc_t *);
475 int isp_mstohz(int);
476 
477 /*
478  * Platform specific defines
479  */
480 #if __FreeBSD_version < 500000
481 #define	BUS_DMA_ROOTARG(x)	NULL
482 #define	isp_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, z)	\
483 	bus_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, z)
484 #elif	__FreeBSD_version < 700020
485 #define	BUS_DMA_ROOTARG(x)	NULL
486 #define	isp_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, z)	\
487 	bus_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, \
488 	busdma_lock_mutex, &Giant, z)
489 #else
490 #define	BUS_DMA_ROOTARG(x)	bus_get_dma_tag(x)
491 #define	isp_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, z)	\
492 	bus_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, \
493 	busdma_lock_mutex, &Giant, z)
494 #endif
495 #if __FreeBSD_version < 700031
496 #define	isp_setup_intr(d, i, f, U, if, ifa, hp)	\
497 	bus_setup_intr(d, i, f, if, ifa, hp)
498 #else
499 #define	isp_setup_intr	bus_setup_intr
500 #endif
501 
502 /* Should be BUS_SPACE_MAXSIZE, but MAXPHYS is larger than BUS_SPACE_MAXSIZE */
503 #define ISP_NSEGS ((MAXPHYS / PAGE_SIZE) + 1)
504 
505 /*
506  * Platform specific inline functions
507  */
508 
509 /*
510  * ISP General Library functions
511  */
512 
513 #include <dev/isp/isp_library.h>
514 
515 #endif	/* _ISP_FREEBSD_H */
516