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 bus_space_tag_t bus_tag; 144 bus_space_handle_t bus_handle; 145 uint64_t default_port_wwn; 146 uint64_t default_node_wwn; 147 uint32_t default_id; 148 device_t dev; 149 struct cam_sim *sim; 150 struct cam_path *path; 151 struct cam_sim *sim2; 152 struct cam_path *path2; 153 struct intr_config_hook ehook; 154 uint32_t loop_down_time; 155 uint32_t loop_down_limit; 156 uint32_t gone_device_time; 157 uint32_t : 5, 158 simqfrozen : 3, 159 hysteresis : 8, 160 gdt_running : 1, 161 ldt_running : 1, 162 disabled : 1, 163 fcbsy : 1, 164 mbox_sleeping : 1, 165 mbox_sleep_ok : 1, 166 mboxcmd_done : 1, 167 mboxbsy : 1; 168 struct callout_handle ldt; /* loop down timer */ 169 struct callout_handle gdt; /* gone device timer */ 170 #if __FreeBSD_version >= 500000 171 const struct firmware * fw; 172 struct mtx lock; 173 struct cv kthread_cv; 174 union { 175 struct { 176 char wwnn[17]; 177 char wwpn[17]; 178 } fc; 179 } sysctl_info; 180 #endif 181 struct proc *kproc; 182 bus_dma_tag_t cdmat; 183 bus_dmamap_t cdmap; 184 #define isp_cdmat isp_osinfo.cdmat 185 #define isp_cdmap isp_osinfo.cdmap 186 #ifdef ISP_TARGET_MODE 187 #define TM_WILDCARD_ENABLED 0x02 188 #define TM_TMODE_ENABLED 0x01 189 uint8_t tmflags[2]; /* two busses */ 190 #define NLEACT 4 191 union ccb * leact[NLEACT]; 192 tstate_t tsdflt[2]; /* two busses */ 193 tstate_t *lun_hash[LUN_HASH_SIZE]; 194 atio_private_data_t atpdp[ATPDPSIZE]; 195 #endif 196 }; 197 198 #define isp_lock isp_osinfo.lock 199 #define isp_bus_tag isp_osinfo.bus_tag 200 #define isp_bus_handle isp_osinfo.bus_handle 201 202 /* 203 * Locking macros... 204 */ 205 206 #ifdef ISP_SMPLOCK 207 #define ISP_LOCK(x) mtx_lock(&(x)->isp_lock) 208 #define ISP_UNLOCK(x) mtx_unlock(&(x)->isp_lock) 209 #define ISPLOCK_2_CAMLOCK(isp) \ 210 mtx_unlock(&(isp)->isp_lock); mtx_lock(&Giant) 211 #define CAMLOCK_2_ISPLOCK(isp) \ 212 mtx_unlock(&Giant); mtx_lock(&(isp)->isp_lock) 213 #else 214 #if __FreeBSD_version < 500000 215 #define ISP_LOCK(x) do { } while (0) 216 #define ISP_UNLOCK(x) do { } while (0) 217 #define ISPLOCK_2_CAMLOCK(isp) do { } while (0) 218 #define CAMLOCK_2_ISPLOCK(isp) do { } while (0) 219 #else 220 #define ISP_LOCK(x) GIANT_REQUIRED 221 #define ISP_UNLOCK(x) do { } while (0) 222 #define ISPLOCK_2_CAMLOCK(isp) do { } while (0) 223 #define CAMLOCK_2_ISPLOCK(isp) GIANT_REQUIRED 224 #endif 225 #endif 226 227 /* 228 * Required Macros/Defines 229 */ 230 231 #define ISP2100_SCRLEN 0x1000 232 233 #define MEMZERO(a, b) memset(a, 0, b) 234 #define MEMCPY memcpy 235 #define SNPRINTF snprintf 236 #define USEC_DELAY DELAY 237 #define USEC_SLEEP(isp, x) DELAY(x) 238 239 #define NANOTIME_T struct timespec 240 #define GET_NANOTIME nanotime 241 #define GET_NANOSEC(x) ((x)->tv_sec * 1000000000 + (x)->tv_nsec) 242 #define NANOTIME_SUB isp_nanotime_sub 243 244 #define MAXISPREQUEST(isp) ((IS_FC(isp) || IS_ULTRA2(isp))? 1024 : 256) 245 246 #define MEMORYBARRIER(isp, type, offset, size) \ 247 switch (type) { \ 248 case SYNC_SFORDEV: \ 249 case SYNC_REQUEST: \ 250 bus_dmamap_sync(isp->isp_cdmat, isp->isp_cdmap, \ 251 BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); \ 252 break; \ 253 case SYNC_SFORCPU: \ 254 case SYNC_RESULT: \ 255 bus_dmamap_sync(isp->isp_cdmat, isp->isp_cdmap, \ 256 BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); \ 257 break; \ 258 case SYNC_REG: \ 259 bus_space_barrier(isp->isp_bus_tag, \ 260 isp->isp_bus_handle, offset, size, \ 261 BUS_SPACE_BARRIER_READ); \ 262 break; \ 263 default: \ 264 break; \ 265 } 266 267 #define MBOX_ACQUIRE isp_mbox_acquire 268 #define MBOX_WAIT_COMPLETE isp_mbox_wait_complete 269 #define MBOX_NOTIFY_COMPLETE isp_mbox_notify_done 270 #define MBOX_RELEASE isp_mbox_release 271 272 #define FC_SCRATCH_ACQUIRE(isp) \ 273 if (isp->isp_osinfo.fcbsy) { \ 274 isp_prt(isp, ISP_LOGWARN, \ 275 "FC scratch area busy (line %d)!", __LINE__); \ 276 } else \ 277 isp->isp_osinfo.fcbsy = 1 278 #define FC_SCRATCH_RELEASE(isp) isp->isp_osinfo.fcbsy = 0 279 280 #ifndef SCSI_GOOD 281 #define SCSI_GOOD SCSI_STATUS_OK 282 #endif 283 #ifndef SCSI_CHECK 284 #define SCSI_CHECK SCSI_STATUS_CHECK_COND 285 #endif 286 #ifndef SCSI_BUSY 287 #define SCSI_BUSY SCSI_STATUS_BUSY 288 #endif 289 #ifndef SCSI_QFULL 290 #define SCSI_QFULL SCSI_STATUS_QUEUE_FULL 291 #endif 292 293 #define XS_T struct ccb_scsiio 294 #define XS_DMA_ADDR_T bus_addr_t 295 #define XS_ISP(ccb) ((ispsoftc_t *) (ccb)->ccb_h.spriv_ptr1) 296 #define XS_CHANNEL(ccb) cam_sim_bus(xpt_path_sim((ccb)->ccb_h.path)) 297 #define XS_TGT(ccb) (ccb)->ccb_h.target_id 298 #define XS_LUN(ccb) (ccb)->ccb_h.target_lun 299 300 #define XS_CDBP(ccb) \ 301 (((ccb)->ccb_h.flags & CAM_CDB_POINTER)? \ 302 (ccb)->cdb_io.cdb_ptr : (ccb)->cdb_io.cdb_bytes) 303 304 #define XS_CDBLEN(ccb) (ccb)->cdb_len 305 #define XS_XFRLEN(ccb) (ccb)->dxfer_len 306 #define XS_TIME(ccb) (ccb)->ccb_h.timeout 307 #define XS_RESID(ccb) (ccb)->resid 308 #define XS_STSP(ccb) (&(ccb)->scsi_status) 309 #define XS_SNSP(ccb) (&(ccb)->sense_data) 310 311 #define XS_SNSLEN(ccb) \ 312 imin((sizeof((ccb)->sense_data)), ccb->sense_len) 313 314 #define XS_SNSKEY(ccb) ((ccb)->sense_data.flags & 0xf) 315 #define XS_TAG_P(ccb) \ 316 (((ccb)->ccb_h.flags & CAM_TAG_ACTION_VALID) && \ 317 (ccb)->tag_action != CAM_TAG_ACTION_NONE) 318 319 #define XS_TAG_TYPE(ccb) \ 320 ((ccb->tag_action == MSG_SIMPLE_Q_TAG)? REQFLAG_STAG : \ 321 ((ccb->tag_action == MSG_HEAD_OF_Q_TAG)? REQFLAG_HTAG : REQFLAG_OTAG)) 322 323 324 #define XS_SETERR(ccb, v) (ccb)->ccb_h.status &= ~CAM_STATUS_MASK, \ 325 (ccb)->ccb_h.status |= v, \ 326 (ccb)->ccb_h.spriv_field0 |= ISP_SPRIV_ERRSET 327 328 # define HBA_NOERROR CAM_REQ_INPROG 329 # define HBA_BOTCH CAM_UNREC_HBA_ERROR 330 # define HBA_CMDTIMEOUT CAM_CMD_TIMEOUT 331 # define HBA_SELTIMEOUT CAM_SEL_TIMEOUT 332 # define HBA_TGTBSY CAM_SCSI_STATUS_ERROR 333 # define HBA_BUSRESET CAM_SCSI_BUS_RESET 334 # define HBA_ABORTED CAM_REQ_ABORTED 335 # define HBA_DATAOVR CAM_DATA_RUN_ERR 336 # define HBA_ARQFAIL CAM_AUTOSENSE_FAIL 337 338 339 #define XS_ERR(ccb) ((ccb)->ccb_h.status & CAM_STATUS_MASK) 340 341 #define XS_NOERR(ccb) \ 342 (((ccb)->ccb_h.spriv_field0 & ISP_SPRIV_ERRSET) == 0 || \ 343 ((ccb)->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_INPROG) 344 345 #define XS_INITERR(ccb) \ 346 XS_SETERR(ccb, CAM_REQ_INPROG), (ccb)->ccb_h.spriv_field0 = 0 347 348 #define XS_SAVE_SENSE(xs, sense_ptr, sense_len) \ 349 (xs)->ccb_h.status |= CAM_AUTOSNS_VALID; \ 350 memcpy(&(xs)->sense_data, sense_ptr, imin(XS_SNSLEN(xs), sense_len)) 351 352 #define XS_SET_STATE_STAT(a, b, c) 353 354 #define DEFAULT_IID(x) (isp)->isp_osinfo.default_id 355 #define DEFAULT_LOOPID(x) (isp)->isp_osinfo.default_id 356 #define DEFAULT_NODEWWN(isp) (isp)->isp_osinfo.default_node_wwn 357 #define DEFAULT_PORTWWN(isp) (isp)->isp_osinfo.default_port_wwn 358 #define ISP_NODEWWN(isp) FCPARAM(isp)->isp_wwnn_nvram 359 #define ISP_PORTWWN(isp) FCPARAM(isp)->isp_wwpn_nvram 360 361 362 #if __FreeBSD_version < 500000 363 #if _BYTE_ORDER == _LITTLE_ENDIAN 364 #define bswap16 htobe16 365 #define bswap32 htobe32 366 #else 367 #define bswap16 htole16 368 #define bswap32 htole32 369 #endif 370 #endif 371 372 #if BYTE_ORDER == BIG_ENDIAN 373 #ifdef ISP_SBUS_SUPPORTED 374 #define ISP_IOXPUT_8(isp, s, d) *(d) = s 375 #define ISP_IOXPUT_16(isp, s, d) \ 376 *(d) = (isp->isp_bustype == ISP_BT_SBUS)? s : bswap16(s) 377 #define ISP_IOXPUT_32(isp, s, d) \ 378 *(d) = (isp->isp_bustype == ISP_BT_SBUS)? s : bswap32(s) 379 #define ISP_IOXGET_8(isp, s, d) d = (*((uint8_t *)s)) 380 #define ISP_IOXGET_16(isp, s, d) \ 381 d = (isp->isp_bustype == ISP_BT_SBUS)? \ 382 *((uint16_t *)s) : bswap16(*((uint16_t *)s)) 383 #define ISP_IOXGET_32(isp, s, d) \ 384 d = (isp->isp_bustype == ISP_BT_SBUS)? \ 385 *((uint32_t *)s) : bswap32(*((uint32_t *)s)) 386 387 #else /* ISP_SBUS_SUPPORTED */ 388 #define ISP_IOXPUT_8(isp, s, d) *(d) = s 389 #define ISP_IOXPUT_16(isp, s, d) *(d) = bswap16(s) 390 #define ISP_IOXPUT_32(isp, s, d) *(d) = bswap32(s) 391 #define ISP_IOXGET_8(isp, s, d) d = (*((uint8_t *)s)) 392 #define ISP_IOXGET_16(isp, s, d) d = bswap16(*((uint16_t *)s)) 393 #define ISP_IOXGET_32(isp, s, d) d = bswap32(*((uint32_t *)s)) 394 #endif 395 #define ISP_SWIZZLE_NVRAM_WORD(isp, rp) *rp = bswap16(*rp) 396 397 #define ISP_IOZGET_8(isp, s, d) d = (*((uint8_t *)s)) 398 #define ISP_IOZGET_16(isp, s, d) d = (*((uint16_t *)s)) 399 #define ISP_IOZGET_32(isp, s, d) d = (*((uint32_t *)s)) 400 #define ISP_IOZPUT_8(isp, s, d) *(d) = s 401 #define ISP_IOZPUT_16(isp, s, d) *(d) = s 402 #define ISP_IOZPUT_32(isp, s, d) *(d) = s 403 404 405 #else 406 #define ISP_IOXPUT_8(isp, s, d) *(d) = s 407 #define ISP_IOXPUT_16(isp, s, d) *(d) = s 408 #define ISP_IOXPUT_32(isp, s, d) *(d) = s 409 #define ISP_IOXGET_8(isp, s, d) d = *(s) 410 #define ISP_IOXGET_16(isp, s, d) d = *(s) 411 #define ISP_IOXGET_32(isp, s, d) d = *(s) 412 #define ISP_SWIZZLE_NVRAM_WORD(isp, rp) 413 414 #define ISP_IOZPUT_8(isp, s, d) *(d) = s 415 #define ISP_IOZPUT_16(isp, s, d) *(d) = bswap16(s) 416 #define ISP_IOZPUT_32(isp, s, d) *(d) = bswap32(s) 417 418 #define ISP_IOZGET_8(isp, s, d) d = (*((uint8_t *)(s))) 419 #define ISP_IOZGET_16(isp, s, d) d = bswap16(*((uint16_t *)(s))) 420 #define ISP_IOZGET_32(isp, s, d) d = bswap32(*((uint32_t *)(s))) 421 422 #endif 423 424 /* 425 * Includes of common header files 426 */ 427 428 #include <dev/isp/ispreg.h> 429 #include <dev/isp/ispvar.h> 430 #include <dev/isp/ispmbox.h> 431 432 #ifdef ISP_TARGET_MODE 433 #include <dev/isp/isp_tpublic.h> 434 #endif 435 436 /* 437 * isp_osinfo definiitions && shorthand 438 */ 439 #define SIMQFRZ_RESOURCE 0x1 440 #define SIMQFRZ_LOOPDOWN 0x2 441 #define SIMQFRZ_TIMED 0x4 442 443 #define isp_sim isp_osinfo.sim 444 #define isp_path isp_osinfo.path 445 #define isp_sim2 isp_osinfo.sim2 446 #define isp_path2 isp_osinfo.path2 447 #define isp_dev isp_osinfo.dev 448 449 /* 450 * prototypes for isp_pci && isp_freebsd to share 451 */ 452 extern void isp_attach(ispsoftc_t *); 453 extern void isp_uninit(ispsoftc_t *); 454 455 /* 456 * driver global data 457 */ 458 extern int isp_announced; 459 extern int isp_fabric_hysteresis; 460 extern int isp_loop_down_limit; 461 extern int isp_gone_device_time; 462 extern int isp_quickboot_time; 463 464 /* 465 * Platform private flags 466 */ 467 #define ISP_SPRIV_ERRSET 0x1 468 #define ISP_SPRIV_INWDOG 0x2 469 #define ISP_SPRIV_GRACE 0x4 470 #define ISP_SPRIV_DONE 0x8 471 472 #define XS_CMD_S_WDOG(sccb) (sccb)->ccb_h.spriv_field0 |= ISP_SPRIV_INWDOG 473 #define XS_CMD_C_WDOG(sccb) (sccb)->ccb_h.spriv_field0 &= ~ISP_SPRIV_INWDOG 474 #define XS_CMD_WDOG_P(sccb) ((sccb)->ccb_h.spriv_field0 & ISP_SPRIV_INWDOG) 475 476 #define XS_CMD_S_GRACE(sccb) (sccb)->ccb_h.spriv_field0 |= ISP_SPRIV_GRACE 477 #define XS_CMD_C_GRACE(sccb) (sccb)->ccb_h.spriv_field0 &= ~ISP_SPRIV_GRACE 478 #define XS_CMD_GRACE_P(sccb) ((sccb)->ccb_h.spriv_field0 & ISP_SPRIV_GRACE) 479 480 #define XS_CMD_S_DONE(sccb) (sccb)->ccb_h.spriv_field0 |= ISP_SPRIV_DONE 481 #define XS_CMD_C_DONE(sccb) (sccb)->ccb_h.spriv_field0 &= ~ISP_SPRIV_DONE 482 #define XS_CMD_DONE_P(sccb) ((sccb)->ccb_h.spriv_field0 & ISP_SPRIV_DONE) 483 484 #define XS_CMD_S_CLEAR(sccb) (sccb)->ccb_h.spriv_field0 = 0 485 486 /* 487 * Platform Library Functions 488 */ 489 void isp_prt(ispsoftc_t *, int level, const char *, ...) __printflike(3, 4); 490 uint64_t isp_nanotime_sub(struct timespec *, struct timespec *); 491 int isp_mbox_acquire(ispsoftc_t *); 492 void isp_mbox_wait_complete(ispsoftc_t *, mbreg_t *); 493 void isp_mbox_notify_done(ispsoftc_t *); 494 void isp_mbox_release(ispsoftc_t *); 495 int isp_mstohz(int); 496 497 /* 498 * Platform specific defines 499 */ 500 #if __FreeBSD_version < 500000 501 #define BUS_DMA_ROOTARG(x) NULL 502 #define isp_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, z) \ 503 bus_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, z) 504 #elif __FreeBSD_version < 700020 505 #define BUS_DMA_ROOTARG(x) NULL 506 #define isp_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, z) \ 507 bus_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, \ 508 busdma_lock_mutex, &Giant, z) 509 #else 510 #define BUS_DMA_ROOTARG(x) bus_get_dma_tag(x) 511 #define isp_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, z) \ 512 bus_dma_tag_create(a, b, c, d, e, f, g, h, i, j, k, \ 513 busdma_lock_mutex, &Giant, z) 514 #endif 515 #if __FreeBSD_version < 700031 516 #define isp_setup_intr(d, i, f, U, if, ifa, hp) \ 517 bus_setup_intr(d, i, f, if, ifa, hp) 518 #else 519 #define isp_setup_intr bus_setup_intr 520 #endif 521 522 /* Should be BUS_SPACE_MAXSIZE, but MAXPHYS is larger than BUS_SPACE_MAXSIZE */ 523 #define ISP_NSEGS ((MAXPHYS / PAGE_SIZE) + 1) 524 525 /* 526 * Platform specific inline functions 527 */ 528 529 /* 530 * ISP General Library functions 531 */ 532 533 #include <dev/isp/isp_library.h> 534 535 #endif /* _ISP_FREEBSD_H */ 536