1 /*- 2 * Copyright (c) 1997-2009 by Matthew Jacob 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 15 * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE 19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * 27 */ 28 /* 29 * Qlogic Host Adapter Internal Library Functions 30 */ 31 #ifdef __NetBSD__ 32 #include <sys/cdefs.h> 33 __KERNEL_RCSID(0, "$NetBSD$"); 34 #include <dev/ic/isp_netbsd.h> 35 #endif 36 #ifdef __FreeBSD__ 37 #include <sys/cdefs.h> 38 __FBSDID("$FreeBSD$"); 39 #include <dev/isp/isp_freebsd.h> 40 #endif 41 #ifdef __OpenBSD__ 42 #include <dev/ic/isp_openbsd.h> 43 #endif 44 #ifdef __linux__ 45 #include "isp_linux.h" 46 #endif 47 #ifdef __svr4__ 48 #include "isp_solaris.h" 49 #endif 50 51 const char *isp_class3_roles[4] = { 52 "None", "Target", "Initiator", "Target/Initiator" 53 }; 54 55 /* 56 * Command shipping- finish off first queue entry and do dma mapping and additional segments as needed. 57 * 58 * Called with the first queue entry at least partially filled out. 59 */ 60 int 61 isp_send_cmd(ispsoftc_t *isp, void *fqe, void *segp, uint32_t nsegs, uint32_t totalcnt, isp_ddir_t ddir, ispds64_t *ecmd) 62 { 63 uint8_t storage[QENTRY_LEN]; 64 uint8_t type, nqe; 65 uint32_t seg, curseg, seglim, nxt, nxtnxt, ddf; 66 ispds_t *dsp = NULL; 67 ispds64_t *dsp64 = NULL; 68 void *qe0, *qe1; 69 70 qe0 = isp_getrqentry(isp); 71 if (qe0 == NULL) { 72 return (CMD_EAGAIN); 73 } 74 nxt = ISP_NXT_QENTRY(isp->isp_reqidx, RQUEST_QUEUE_LEN(isp)); 75 76 type = ((isphdr_t *)fqe)->rqs_entry_type; 77 nqe = 1; 78 79 /* 80 * If we have no data to transmit, just copy the first IOCB and start it up. 81 */ 82 if (ddir == ISP_NOXFR) { 83 if (type == RQSTYPE_T2RQS || type == RQSTYPE_T3RQS) { 84 ddf = CT2_NO_DATA; 85 } else { 86 ddf = 0; 87 } 88 goto copy_and_sync; 89 } 90 91 /* 92 * First figure out how many pieces of data to transfer and what kind and how many we can put into the first queue entry. 93 */ 94 switch (type) { 95 case RQSTYPE_REQUEST: 96 ddf = (ddir == ISP_TO_DEVICE)? REQFLAG_DATA_OUT : REQFLAG_DATA_IN; 97 dsp = ((ispreq_t *)fqe)->req_dataseg; 98 seglim = ISP_RQDSEG; 99 break; 100 case RQSTYPE_CMDONLY: 101 ddf = (ddir == ISP_TO_DEVICE)? REQFLAG_DATA_OUT : REQFLAG_DATA_IN; 102 seglim = 0; 103 break; 104 case RQSTYPE_T2RQS: 105 ddf = (ddir == ISP_TO_DEVICE)? REQFLAG_DATA_OUT : REQFLAG_DATA_IN; 106 dsp = ((ispreqt2_t *)fqe)->req_dataseg; 107 seglim = ISP_RQDSEG_T2; 108 break; 109 case RQSTYPE_A64: 110 ddf = (ddir == ISP_TO_DEVICE)? REQFLAG_DATA_OUT : REQFLAG_DATA_IN; 111 dsp64 = ((ispreqt3_t *)fqe)->req_dataseg; 112 seglim = ISP_RQDSEG_T3; 113 break; 114 case RQSTYPE_T3RQS: 115 ddf = (ddir == ISP_TO_DEVICE)? REQFLAG_DATA_OUT : REQFLAG_DATA_IN; 116 dsp64 = ((ispreqt3_t *)fqe)->req_dataseg; 117 seglim = ISP_RQDSEG_T3; 118 break; 119 case RQSTYPE_T7RQS: 120 ddf = (ddir == ISP_TO_DEVICE)? FCP_CMND_DATA_WRITE : FCP_CMND_DATA_READ; 121 dsp64 = &((ispreqt7_t *)fqe)->req_dataseg; 122 seglim = 1; 123 break; 124 default: 125 return (CMD_COMPLETE); 126 } 127 128 if (seglim > nsegs) { 129 seglim = nsegs; 130 } 131 132 for (seg = curseg = 0; curseg < seglim; curseg++) { 133 if (dsp64) { 134 XS_GET_DMA64_SEG(dsp64++, segp, seg++); 135 } else { 136 XS_GET_DMA_SEG(dsp++, segp, seg++); 137 } 138 } 139 140 141 /* 142 * Second, start building additional continuation segments as needed. 143 */ 144 while (seg < nsegs) { 145 nxtnxt = ISP_NXT_QENTRY(nxt, RQUEST_QUEUE_LEN(isp)); 146 if (nxtnxt == isp->isp_reqodx) { 147 return (CMD_EAGAIN); 148 } 149 ISP_MEMZERO(storage, QENTRY_LEN); 150 qe1 = ISP_QUEUE_ENTRY(isp->isp_rquest, nxt); 151 nxt = nxtnxt; 152 if (dsp64) { 153 ispcontreq64_t *crq = (ispcontreq64_t *) storage; 154 seglim = ISP_CDSEG64; 155 crq->req_header.rqs_entry_type = RQSTYPE_A64_CONT; 156 crq->req_header.rqs_entry_count = 1; 157 dsp64 = crq->req_dataseg; 158 } else { 159 ispcontreq_t *crq = (ispcontreq_t *) storage; 160 seglim = ISP_CDSEG; 161 crq->req_header.rqs_entry_type = RQSTYPE_DATASEG; 162 crq->req_header.rqs_entry_count = 1; 163 dsp = crq->req_dataseg; 164 } 165 if (seg + seglim > nsegs) { 166 seglim = nsegs - seg; 167 } 168 for (curseg = 0; curseg < seglim; curseg++) { 169 if (dsp64) { 170 XS_GET_DMA64_SEG(dsp64++, segp, seg++); 171 } else { 172 XS_GET_DMA_SEG(dsp++, segp, seg++); 173 } 174 } 175 if (dsp64) { 176 isp_put_cont64_req(isp, (ispcontreq64_t *)storage, qe1); 177 } else { 178 isp_put_cont_req(isp, (ispcontreq_t *)storage, qe1); 179 } 180 if (isp->isp_dblev & ISP_LOGDEBUG1) { 181 isp_print_bytes(isp, "additional queue entry", QENTRY_LEN, storage); 182 } 183 nqe++; 184 } 185 186 copy_and_sync: 187 ((isphdr_t *)fqe)->rqs_entry_count = nqe; 188 switch (type) { 189 case RQSTYPE_REQUEST: 190 ((ispreq_t *)fqe)->req_flags |= ddf; 191 /* 192 * This is historical and not clear whether really needed. 193 */ 194 if (nsegs == 0) { 195 nsegs = 1; 196 } 197 ((ispreq_t *)fqe)->req_seg_count = nsegs; 198 isp_put_request(isp, fqe, qe0); 199 break; 200 case RQSTYPE_CMDONLY: 201 ((ispreq_t *)fqe)->req_flags |= ddf; 202 /* 203 * This is historical and not clear whether really needed. 204 */ 205 if (nsegs == 0) { 206 nsegs = 1; 207 } 208 ((ispextreq_t *)fqe)->req_seg_count = nsegs; 209 isp_put_extended_request(isp, fqe, qe0); 210 break; 211 case RQSTYPE_T2RQS: 212 ((ispreqt2_t *)fqe)->req_flags |= ddf; 213 ((ispreqt2_t *)fqe)->req_seg_count = nsegs; 214 ((ispreqt2_t *)fqe)->req_totalcnt = totalcnt; 215 if (ISP_CAP_2KLOGIN(isp)) { 216 isp_put_request_t2e(isp, fqe, qe0); 217 } else { 218 isp_put_request_t2(isp, fqe, qe0); 219 } 220 break; 221 case RQSTYPE_A64: 222 case RQSTYPE_T3RQS: 223 ((ispreqt3_t *)fqe)->req_flags |= ddf; 224 ((ispreqt3_t *)fqe)->req_seg_count = nsegs; 225 ((ispreqt3_t *)fqe)->req_totalcnt = totalcnt; 226 if (ISP_CAP_2KLOGIN(isp)) { 227 isp_put_request_t3e(isp, fqe, qe0); 228 } else { 229 isp_put_request_t3(isp, fqe, qe0); 230 } 231 break; 232 case RQSTYPE_T7RQS: 233 ((ispreqt7_t *)fqe)->req_alen_datadir = ddf; 234 ((ispreqt7_t *)fqe)->req_seg_count = nsegs; 235 ((ispreqt7_t *)fqe)->req_dl = totalcnt; 236 isp_put_request_t7(isp, fqe, qe0); 237 break; 238 default: 239 return (CMD_COMPLETE); 240 } 241 if (isp->isp_dblev & ISP_LOGDEBUG1) { 242 isp_print_bytes(isp, "first queue entry", QENTRY_LEN, fqe); 243 } 244 ISP_ADD_REQUEST(isp, nxt); 245 return (CMD_QUEUED); 246 } 247 248 int 249 isp_allocate_xs(ispsoftc_t *isp, XS_T *xs, uint32_t *handlep) 250 { 251 isp_hdl_t *hdp; 252 253 hdp = isp->isp_xffree; 254 if (hdp == NULL) { 255 return (-1); 256 } 257 isp->isp_xffree = hdp->cmd; 258 hdp->cmd = xs; 259 hdp->handle = (hdp - isp->isp_xflist); 260 hdp->handle |= (ISP_HANDLE_INITIATOR << ISP_HANDLE_USAGE_SHIFT); 261 hdp->handle |= (isp->isp_seqno++ << ISP_HANDLE_SEQ_SHIFT); 262 *handlep = hdp->handle; 263 return (0); 264 } 265 266 XS_T * 267 isp_find_xs(ispsoftc_t *isp, uint32_t handle) 268 { 269 if (!ISP_VALID_INI_HANDLE(isp, handle)) { 270 isp_prt(isp, ISP_LOGERR, "%s: bad handle 0x%x", __func__, handle); 271 return (NULL); 272 } 273 return (isp->isp_xflist[(handle & ISP_HANDLE_CMD_MASK)].cmd); 274 } 275 276 uint32_t 277 isp_find_handle(ispsoftc_t *isp, XS_T *xs) 278 { 279 uint32_t i, foundhdl = ISP_HANDLE_FREE; 280 281 if (xs != NULL) { 282 for (i = 0; i < isp->isp_maxcmds; i++) { 283 if (isp->isp_xflist[i].cmd != xs) { 284 continue; 285 } 286 foundhdl = isp->isp_xflist[i].handle; 287 break; 288 } 289 } 290 return (foundhdl); 291 } 292 293 uint32_t 294 isp_handle_index(ispsoftc_t *isp, uint32_t handle) 295 { 296 if (!ISP_VALID_HANDLE(isp, handle)) { 297 isp_prt(isp, ISP_LOGERR, "%s: bad handle 0x%x", __func__, handle); 298 return (ISP_BAD_HANDLE_INDEX); 299 } else { 300 return (handle & ISP_HANDLE_CMD_MASK); 301 } 302 } 303 304 void 305 isp_destroy_handle(ispsoftc_t *isp, uint32_t handle) 306 { 307 if (!ISP_VALID_INI_HANDLE(isp, handle)) { 308 isp_prt(isp, ISP_LOGERR, "%s: bad handle 0x%x", __func__, handle); 309 } else { 310 isp->isp_xflist[(handle & ISP_HANDLE_CMD_MASK)].handle = ISP_HANDLE_FREE; 311 isp->isp_xflist[(handle & ISP_HANDLE_CMD_MASK)].cmd = isp->isp_xffree; 312 isp->isp_xffree = &isp->isp_xflist[(handle & ISP_HANDLE_CMD_MASK)]; 313 } 314 } 315 316 /* 317 * Make sure we have space to put something on the request queue. 318 * Return a pointer to that entry if we do. A side effect of this 319 * function is to update the output index. The input index 320 * stays the same. 321 */ 322 void * 323 isp_getrqentry(ispsoftc_t *isp) 324 { 325 isp->isp_reqodx = ISP_READ(isp, isp->isp_rqstoutrp); 326 if (ISP_NXT_QENTRY(isp->isp_reqidx, RQUEST_QUEUE_LEN(isp)) == isp->isp_reqodx) { 327 return (NULL); 328 } 329 return (ISP_QUEUE_ENTRY(isp->isp_rquest, isp->isp_reqidx)); 330 } 331 332 #define TBA (4 * (((QENTRY_LEN >> 2) * 3) + 1) + 1) 333 void 334 isp_print_qentry(ispsoftc_t *isp, const char *msg, int idx, void *arg) 335 { 336 char buf[TBA]; 337 int amt, i, j; 338 uint8_t *ptr = arg; 339 340 isp_prt(isp, ISP_LOGALL, "%s index %d=>", msg, idx); 341 for (buf[0] = 0, amt = i = 0; i < 4; i++) { 342 buf[0] = 0; 343 ISP_SNPRINTF(buf, TBA, " "); 344 for (j = 0; j < (QENTRY_LEN >> 2); j++) { 345 ISP_SNPRINTF(buf, TBA, "%s %02x", buf, ptr[amt++] & 0xff); 346 } 347 isp_prt(isp, ISP_LOGALL, "%s", buf); 348 } 349 } 350 351 void 352 isp_print_bytes(ispsoftc_t *isp, const char *msg, int amt, void *arg) 353 { 354 char buf[128]; 355 uint8_t *ptr = arg; 356 int off; 357 358 if (msg) 359 isp_prt(isp, ISP_LOGALL, "%s:", msg); 360 off = 0; 361 buf[0] = 0; 362 while (off < amt) { 363 int j, to; 364 to = off; 365 for (j = 0; j < 16; j++) { 366 ISP_SNPRINTF(buf, 128, "%s %02x", buf, ptr[off++] & 0xff); 367 if (off == amt) { 368 break; 369 } 370 } 371 isp_prt(isp, ISP_LOGALL, "0x%08x:%s", to, buf); 372 buf[0] = 0; 373 } 374 } 375 376 /* 377 * Do the common path to try and ensure that link is up, we've scanned 378 * the fabric (if we're on a fabric), and that we've synchronized this 379 * all with our own database and done the appropriate logins. 380 * 381 * We repeatedly check for firmware state and loop state after each 382 * action because things may have changed while we were doing this. 383 * Any failure or change of state causes us to return a nonzero value. 384 * 385 * We assume we enter here with any locks held. 386 */ 387 388 int 389 isp_fc_runstate(ispsoftc_t *isp, int chan, int tval) 390 { 391 fcparam *fcp; 392 393 fcp = FCPARAM(isp, chan); 394 if (fcp->role == ISP_ROLE_NONE) { 395 return (0); 396 } 397 if (fcp->isp_fwstate < FW_READY || fcp->isp_loopstate < LOOP_PDB_RCVD) { 398 if (isp_control(isp, ISPCTL_FCLINK_TEST, chan, tval) != 0) { 399 isp_prt(isp, ISP_LOG_SANCFG, "isp_fc_runstate: linktest failed for channel %d", chan); 400 return (-1); 401 } 402 if (fcp->isp_fwstate != FW_READY || fcp->isp_loopstate < LOOP_PDB_RCVD) { 403 isp_prt(isp, ISP_LOG_SANCFG, "isp_fc_runstate: f/w not ready for channel %d", chan); 404 return (-1); 405 } 406 } 407 408 if ((fcp->role & ISP_ROLE_INITIATOR) == 0) { 409 return (0); 410 } 411 412 if (isp_control(isp, ISPCTL_SCAN_LOOP, chan) != 0) { 413 isp_prt(isp, ISP_LOG_SANCFG, "isp_fc_runstate: scan loop fails on channel %d", chan); 414 return (LOOP_PDB_RCVD); 415 } 416 if (isp_control(isp, ISPCTL_SCAN_FABRIC, chan) != 0) { 417 isp_prt(isp, ISP_LOG_SANCFG, "isp_fc_runstate: scan fabric fails on channel %d", chan); 418 return (LOOP_LSCAN_DONE); 419 } 420 if (isp_control(isp, ISPCTL_PDB_SYNC, chan) != 0) { 421 isp_prt(isp, ISP_LOG_SANCFG, "isp_fc_runstate: pdb_sync fails on channel %d", chan); 422 return (LOOP_FSCAN_DONE); 423 } 424 if (fcp->isp_fwstate != FW_READY || fcp->isp_loopstate != LOOP_READY) { 425 isp_prt(isp, ISP_LOG_SANCFG, "isp_fc_runstate: f/w not ready again on channel %d", chan); 426 return (-1); 427 } 428 return (0); 429 } 430 431 /* 432 * Fibre Channel Support routines 433 */ 434 void 435 isp_dump_portdb(ispsoftc_t *isp, int chan) 436 { 437 fcparam *fcp = FCPARAM(isp, chan); 438 int i; 439 440 for (i = 0; i < MAX_FC_TARG; i++) { 441 char mb[4], buf1[64], buf2[64]; 442 const char *dbs[8] = { 443 "NIL ", 444 "PROB", 445 "DEAD", 446 "CHGD", 447 "NEW ", 448 "PVLD", 449 "ZOMB", 450 "VLD " 451 }; 452 fcportdb_t *lp = &fcp->portdb[i]; 453 454 if (lp->state == FC_PORTDB_STATE_NIL && lp->target_mode == 0) { 455 continue; 456 } 457 if (lp->dev_map_idx) { 458 ISP_SNPRINTF(mb, sizeof (mb), "%3d", ((int) lp->dev_map_idx) - 1); 459 } else { 460 ISP_SNPRINTF(mb, sizeof (mb), "---"); 461 } 462 isp_gen_role_str(buf1, sizeof (buf1), lp->prli_word3); 463 isp_gen_role_str(buf2, sizeof (buf2), lp->new_prli_word3); 464 isp_prt(isp, ISP_LOGALL, "Chan %d [%d]: hdl 0x%x %s al%d tgt %s %s 0x%06x =>%s 0x%06x; WWNN 0x%08x%08x WWPN 0x%08x%08x", 465 chan, i, lp->handle, dbs[lp->state], lp->autologin, mb, buf1, lp->portid, buf2, lp->new_portid, 466 (uint32_t) (lp->node_wwn >> 32), (uint32_t) (lp->node_wwn), (uint32_t) (lp->port_wwn >> 32), (uint32_t) (lp->port_wwn)); 467 } 468 } 469 470 void 471 isp_gen_role_str(char *buf, size_t len, uint16_t p3) 472 { 473 int nd = 0; 474 buf[0] = '('; 475 buf[1] = 0; 476 if (p3 & PRLI_WD3_ENHANCED_DISCOVERY) { 477 nd++; 478 strlcat(buf, "EDisc", len); 479 } 480 if (p3 & PRLI_WD3_REC_SUPPORT) { 481 if (nd++) { 482 strlcat(buf, ",", len); 483 } 484 strlcat(buf, "REC", len); 485 } 486 if (p3 & PRLI_WD3_TASK_RETRY_IDENTIFICATION_REQUESTED) { 487 if (nd++) { 488 strlcat(buf, ",", len); 489 } 490 strlcat(buf, "RetryID", len); 491 } 492 if (p3 & PRLI_WD3_RETRY) { 493 if (nd++) { 494 strlcat(buf, ",", len); 495 } 496 strlcat(buf, "Retry", len); 497 } 498 if (p3 & PRLI_WD3_CONFIRMED_COMPLETION_ALLOWED) { 499 if (nd++) { 500 strlcat(buf, ",", len); 501 } 502 strlcat(buf, "CNFRM", len); 503 } 504 if (p3 & PRLI_WD3_DATA_OVERLAY_ALLOWED) { 505 if (nd++) { 506 strlcat(buf, ",", len); 507 } 508 strlcat(buf, "DOver", len); 509 } 510 if (p3 & PRLI_WD3_INITIATOR_FUNCTION) { 511 if (nd++) { 512 strlcat(buf, ",", len); 513 } 514 strlcat(buf, "INI", len); 515 } 516 if (p3 & PRLI_WD3_TARGET_FUNCTION) { 517 if (nd++) { 518 strlcat(buf, ",", len); 519 } 520 strlcat(buf, "TGT", len); 521 } 522 if (p3 & PRLI_WD3_READ_FCP_XFER_RDY_DISABLED) { 523 if (nd++) { 524 strlcat(buf, ",", len); 525 } 526 strlcat(buf, "RdXfrDis", len); 527 } 528 if (p3 & PRLI_WD3_WRITE_FCP_XFER_RDY_DISABLED) { 529 if (nd++) { 530 strlcat(buf, ",", len); 531 } 532 strlcat(buf, "XfrDis", len); 533 } 534 strlcat(buf, ")", len); 535 } 536 537 const char * 538 isp_fc_fw_statename(int state) 539 { 540 switch (state) { 541 case FW_CONFIG_WAIT: return "Config Wait"; 542 case FW_WAIT_AL_PA: return "Waiting for AL_PA"; 543 case FW_WAIT_LOGIN: return "Wait Login"; 544 case FW_READY: return "Ready"; 545 case FW_LOSS_OF_SYNC: return "Loss Of Sync"; 546 case FW_ERROR: return "Error"; 547 case FW_REINIT: return "Re-Init"; 548 case FW_NON_PART: return "Nonparticipating"; 549 default: return "?????"; 550 } 551 } 552 553 const char * 554 isp_fc_loop_statename(int state) 555 { 556 switch (state) { 557 case LOOP_NIL: return "NIL"; 558 case LOOP_LIP_RCVD: return "LIP Received"; 559 case LOOP_PDB_RCVD: return "PDB Received"; 560 case LOOP_SCANNING_LOOP: return "Scanning"; 561 case LOOP_LSCAN_DONE: return "Loop Scan Done"; 562 case LOOP_SCANNING_FABRIC: return "Scanning Fabric"; 563 case LOOP_FSCAN_DONE: return "Fabric Scan Done"; 564 case LOOP_SYNCING_PDB: return "Syncing PDB"; 565 case LOOP_READY: return "Ready"; 566 default: return "?????"; 567 } 568 } 569 570 const char * 571 isp_fc_toponame(fcparam *fcp) 572 { 573 574 if (fcp->isp_fwstate != FW_READY) { 575 return "Unavailable"; 576 } 577 switch (fcp->isp_topo) { 578 case TOPO_NL_PORT: return "Private Loop"; 579 case TOPO_FL_PORT: return "FL Port"; 580 case TOPO_N_PORT: return "N-Port to N-Port"; 581 case TOPO_F_PORT: return "F Port"; 582 case TOPO_PTP_STUB: return "F Port (no FLOGI_ACC response)"; 583 default: return "?????"; 584 } 585 } 586 587 /* 588 * Change Roles 589 */ 590 int 591 isp_fc_change_role(ispsoftc_t *isp, int chan, int new_role) 592 { 593 fcparam *fcp = FCPARAM(isp, chan); 594 595 if (chan >= isp->isp_nchan) { 596 isp_prt(isp, ISP_LOGWARN, "%s: bad channel %d", __func__, chan); 597 return (ENXIO); 598 } 599 if (chan == 0) { 600 #ifdef ISP_TARGET_MODE 601 isp_del_all_wwn_entries(isp, chan); 602 #endif 603 isp_clear_commands(isp); 604 isp_reset(isp, 0); 605 if (isp->isp_state != ISP_RESETSTATE) { 606 isp_prt(isp, ISP_LOGERR, "%s: cannot reset card", __func__); 607 return (EIO); 608 } 609 fcp->role = new_role; 610 isp_init(isp); 611 if (isp->isp_state != ISP_INITSTATE) { 612 isp_prt(isp, ISP_LOGERR, "%s: cannot init card", __func__); 613 return (EIO); 614 } 615 isp->isp_state = ISP_RUNSTATE; 616 return (0); 617 } else if (ISP_CAP_MULTI_ID(isp)) { 618 mbreg_t mbs; 619 vp_modify_t *vp; 620 uint8_t qe[QENTRY_LEN], *scp; 621 622 ISP_MEMZERO(qe, QENTRY_LEN); 623 /* Acquire Scratch */ 624 625 if (FC_SCRATCH_ACQUIRE(isp, chan)) { 626 return (EBUSY); 627 } 628 scp = fcp->isp_scratch; 629 630 /* 631 * Build a VP MODIFY command in memory 632 */ 633 vp = (vp_modify_t *) qe; 634 vp->vp_mod_hdr.rqs_entry_type = RQSTYPE_VP_MODIFY; 635 vp->vp_mod_hdr.rqs_entry_count = 1; 636 vp->vp_mod_cnt = 1; 637 vp->vp_mod_idx0 = chan; 638 vp->vp_mod_cmd = VP_MODIFY_ENA; 639 vp->vp_mod_ports[0].options = ICB2400_VPOPT_ENABLED; 640 if (new_role & ISP_ROLE_INITIATOR) { 641 vp->vp_mod_ports[0].options |= ICB2400_VPOPT_INI_ENABLE; 642 } 643 if ((new_role & ISP_ROLE_TARGET) == 0) { 644 vp->vp_mod_ports[0].options |= ICB2400_VPOPT_TGT_DISABLE; 645 } 646 MAKE_NODE_NAME_FROM_WWN(vp->vp_mod_ports[0].wwpn, fcp->isp_wwpn); 647 MAKE_NODE_NAME_FROM_WWN(vp->vp_mod_ports[0].wwnn, fcp->isp_wwnn); 648 isp_put_vp_modify(isp, vp, (vp_modify_t *) scp); 649 650 /* 651 * Build a EXEC IOCB A64 command that points to the VP MODIFY command 652 */ 653 MBSINIT(&mbs, MBOX_EXEC_COMMAND_IOCB_A64, MBLOGALL, 0); 654 mbs.param[1] = QENTRY_LEN; 655 mbs.param[2] = DMA_WD1(fcp->isp_scdma); 656 mbs.param[3] = DMA_WD0(fcp->isp_scdma); 657 mbs.param[6] = DMA_WD3(fcp->isp_scdma); 658 mbs.param[7] = DMA_WD2(fcp->isp_scdma); 659 MEMORYBARRIER(isp, SYNC_SFORDEV, 0, 2 * QENTRY_LEN, chan); 660 isp_control(isp, ISPCTL_RUN_MBOXCMD, &mbs); 661 if (mbs.param[0] != MBOX_COMMAND_COMPLETE) { 662 FC_SCRATCH_RELEASE(isp, chan); 663 return (EIO); 664 } 665 MEMORYBARRIER(isp, SYNC_SFORCPU, QENTRY_LEN, QENTRY_LEN, chan); 666 isp_get_vp_modify(isp, (vp_modify_t *)&scp[QENTRY_LEN], vp); 667 668 #ifdef ISP_TARGET_MODE 669 isp_del_all_wwn_entries(isp, chan); 670 #endif 671 /* 672 * Release Scratch 673 */ 674 FC_SCRATCH_RELEASE(isp, chan); 675 676 if (vp->vp_mod_status != VP_STS_OK) { 677 isp_prt(isp, ISP_LOGERR, "%s: VP_MODIFY of Chan %d failed with status %d", __func__, chan, vp->vp_mod_status); 678 return (EIO); 679 } 680 fcp->role = new_role; 681 return (0); 682 } else { 683 return (EINVAL); 684 } 685 } 686 687 void 688 isp_clear_commands(ispsoftc_t *isp) 689 { 690 uint32_t tmp; 691 isp_hdl_t *hdp; 692 #ifdef ISP_TARGET_MODE 693 isp_notify_t notify; 694 #endif 695 696 for (tmp = 0; isp->isp_xflist && tmp < isp->isp_maxcmds; tmp++) { 697 XS_T *xs; 698 699 hdp = &isp->isp_xflist[tmp]; 700 if (hdp->handle == ISP_HANDLE_FREE) { 701 continue; 702 } 703 xs = hdp->cmd; 704 if (XS_XFRLEN(xs)) { 705 ISP_DMAFREE(isp, xs, hdp->handle); 706 XS_SET_RESID(xs, XS_XFRLEN(xs)); 707 } else { 708 XS_SET_RESID(xs, 0); 709 } 710 hdp->handle = 0; 711 hdp->cmd = NULL; 712 XS_SETERR(xs, HBA_BUSRESET); 713 isp_done(xs); 714 } 715 #ifdef ISP_TARGET_MODE 716 for (tmp = 0; isp->isp_tgtlist && tmp < isp->isp_maxcmds; tmp++) { 717 uint8_t local[QENTRY_LEN]; 718 hdp = &isp->isp_tgtlist[tmp]; 719 if (hdp->handle == ISP_HANDLE_FREE) { 720 continue; 721 } 722 ISP_DMAFREE(isp, hdp->cmd, hdp->handle); 723 ISP_MEMZERO(local, QENTRY_LEN); 724 if (IS_24XX(isp)) { 725 ct7_entry_t *ctio = (ct7_entry_t *) local; 726 ctio->ct_syshandle = hdp->handle; 727 ctio->ct_nphdl = CT_HBA_RESET; 728 ctio->ct_header.rqs_entry_type = RQSTYPE_CTIO7; 729 } else if (IS_FC(isp)) { 730 ct2_entry_t *ctio = (ct2_entry_t *) local; 731 ctio->ct_syshandle = hdp->handle; 732 ctio->ct_status = CT_HBA_RESET; 733 ctio->ct_header.rqs_entry_type = RQSTYPE_CTIO2; 734 } else { 735 ct_entry_t *ctio = (ct_entry_t *) local; 736 ctio->ct_syshandle = hdp->handle; 737 ctio->ct_status = CT_HBA_RESET & 0xff; 738 ctio->ct_header.rqs_entry_type = RQSTYPE_CTIO; 739 } 740 isp_async(isp, ISPASYNC_TARGET_ACTION, local); 741 } 742 for (tmp = 0; tmp < isp->isp_nchan; tmp++) { 743 ISP_MEMZERO(¬ify, sizeof (isp_notify_t)); 744 notify.nt_ncode = NT_HBA_RESET; 745 notify.nt_hba = isp; 746 notify.nt_wwn = INI_ANY; 747 notify.nt_nphdl = NIL_HANDLE; 748 notify.nt_sid = PORT_ANY; 749 notify.nt_did = PORT_ANY; 750 notify.nt_tgt = TGT_ANY; 751 notify.nt_channel = tmp; 752 notify.nt_lun = LUN_ANY; 753 notify.nt_tagval = TAG_ANY; 754 isp_async(isp, ISPASYNC_TARGET_NOTIFY, ¬ify); 755 } 756 #endif 757 } 758 759 void 760 isp_shutdown(ispsoftc_t *isp) 761 { 762 if (IS_FC(isp)) { 763 if (IS_24XX(isp)) { 764 ISP_WRITE(isp, BIU2400_ICR, 0); 765 ISP_WRITE(isp, BIU2400_HCCR, HCCR_2400_CMD_PAUSE); 766 } else { 767 ISP_WRITE(isp, BIU_ICR, 0); 768 ISP_WRITE(isp, HCCR, HCCR_CMD_PAUSE); 769 ISP_WRITE(isp, BIU2100_CSR, BIU2100_FPM0_REGS); 770 ISP_WRITE(isp, FPM_DIAG_CONFIG, FPM_SOFT_RESET); 771 ISP_WRITE(isp, BIU2100_CSR, BIU2100_FB_REGS); 772 ISP_WRITE(isp, FBM_CMD, FBMCMD_FIFO_RESET_ALL); 773 ISP_WRITE(isp, BIU2100_CSR, BIU2100_RISC_REGS); 774 } 775 } else { 776 ISP_WRITE(isp, BIU_ICR, 0); 777 ISP_WRITE(isp, HCCR, HCCR_CMD_PAUSE); 778 } 779 } 780 781 /* 782 * Functions to move stuff to a form that the QLogic RISC engine understands 783 * and functions to move stuff back to a form the processor understands. 784 * 785 * Each platform is required to provide the 8, 16 and 32 bit 786 * swizzle and unswizzle macros (ISP_IOX{PUT|GET}_{8,16,32}) 787 * 788 * The assumption is that swizzling and unswizzling is mostly done 'in place' 789 * (with a few exceptions for efficiency). 790 */ 791 792 #define ISP_IS_SBUS(isp) (ISP_SBUS_SUPPORTED && (isp)->isp_bustype == ISP_BT_SBUS) 793 794 #define ASIZE(x) (sizeof (x) / sizeof (x[0])) 795 /* 796 * Swizzle/Copy Functions 797 */ 798 void 799 isp_put_hdr(ispsoftc_t *isp, isphdr_t *hpsrc, isphdr_t *hpdst) 800 { 801 if (ISP_IS_SBUS(isp)) { 802 ISP_IOXPUT_8(isp, hpsrc->rqs_entry_type, &hpdst->rqs_entry_count); 803 ISP_IOXPUT_8(isp, hpsrc->rqs_entry_count, &hpdst->rqs_entry_type); 804 ISP_IOXPUT_8(isp, hpsrc->rqs_seqno, &hpdst->rqs_flags); 805 ISP_IOXPUT_8(isp, hpsrc->rqs_flags, &hpdst->rqs_seqno); 806 } else { 807 ISP_IOXPUT_8(isp, hpsrc->rqs_entry_type, &hpdst->rqs_entry_type); 808 ISP_IOXPUT_8(isp, hpsrc->rqs_entry_count, &hpdst->rqs_entry_count); 809 ISP_IOXPUT_8(isp, hpsrc->rqs_seqno, &hpdst->rqs_seqno); 810 ISP_IOXPUT_8(isp, hpsrc->rqs_flags, &hpdst->rqs_flags); 811 } 812 } 813 814 void 815 isp_get_hdr(ispsoftc_t *isp, isphdr_t *hpsrc, isphdr_t *hpdst) 816 { 817 if (ISP_IS_SBUS(isp)) { 818 ISP_IOXGET_8(isp, &hpsrc->rqs_entry_type, hpdst->rqs_entry_count); 819 ISP_IOXGET_8(isp, &hpsrc->rqs_entry_count, hpdst->rqs_entry_type); 820 ISP_IOXGET_8(isp, &hpsrc->rqs_seqno, hpdst->rqs_flags); 821 ISP_IOXGET_8(isp, &hpsrc->rqs_flags, hpdst->rqs_seqno); 822 } else { 823 ISP_IOXGET_8(isp, &hpsrc->rqs_entry_type, hpdst->rqs_entry_type); 824 ISP_IOXGET_8(isp, &hpsrc->rqs_entry_count, hpdst->rqs_entry_count); 825 ISP_IOXGET_8(isp, &hpsrc->rqs_seqno, hpdst->rqs_seqno); 826 ISP_IOXGET_8(isp, &hpsrc->rqs_flags, hpdst->rqs_flags); 827 } 828 } 829 830 int 831 isp_get_response_type(ispsoftc_t *isp, isphdr_t *hp) 832 { 833 uint8_t type; 834 if (ISP_IS_SBUS(isp)) { 835 ISP_IOXGET_8(isp, &hp->rqs_entry_count, type); 836 } else { 837 ISP_IOXGET_8(isp, &hp->rqs_entry_type, type); 838 } 839 return ((int)type); 840 } 841 842 void 843 isp_put_request(ispsoftc_t *isp, ispreq_t *rqsrc, ispreq_t *rqdst) 844 { 845 int i; 846 isp_put_hdr(isp, &rqsrc->req_header, &rqdst->req_header); 847 ISP_IOXPUT_32(isp, rqsrc->req_handle, &rqdst->req_handle); 848 if (ISP_IS_SBUS(isp)) { 849 ISP_IOXPUT_8(isp, rqsrc->req_lun_trn, &rqdst->req_target); 850 ISP_IOXPUT_8(isp, rqsrc->req_target, &rqdst->req_lun_trn); 851 } else { 852 ISP_IOXPUT_8(isp, rqsrc->req_lun_trn, &rqdst->req_lun_trn); 853 ISP_IOXPUT_8(isp, rqsrc->req_target, &rqdst->req_target); 854 } 855 ISP_IOXPUT_16(isp, rqsrc->req_cdblen, &rqdst->req_cdblen); 856 ISP_IOXPUT_16(isp, rqsrc->req_flags, &rqdst->req_flags); 857 ISP_IOXPUT_16(isp, rqsrc->req_time, &rqdst->req_time); 858 ISP_IOXPUT_16(isp, rqsrc->req_seg_count, &rqdst->req_seg_count); 859 for (i = 0; i < ASIZE(rqsrc->req_cdb); i++) { 860 ISP_IOXPUT_8(isp, rqsrc->req_cdb[i], &rqdst->req_cdb[i]); 861 } 862 for (i = 0; i < ISP_RQDSEG; i++) { 863 ISP_IOXPUT_32(isp, rqsrc->req_dataseg[i].ds_base, &rqdst->req_dataseg[i].ds_base); 864 ISP_IOXPUT_32(isp, rqsrc->req_dataseg[i].ds_count, &rqdst->req_dataseg[i].ds_count); 865 } 866 } 867 868 void 869 isp_put_marker(ispsoftc_t *isp, isp_marker_t *src, isp_marker_t *dst) 870 { 871 int i; 872 isp_put_hdr(isp, &src->mrk_header, &dst->mrk_header); 873 ISP_IOXPUT_32(isp, src->mrk_handle, &dst->mrk_handle); 874 if (ISP_IS_SBUS(isp)) { 875 ISP_IOXPUT_8(isp, src->mrk_reserved0, &dst->mrk_target); 876 ISP_IOXPUT_8(isp, src->mrk_target, &dst->mrk_reserved0); 877 } else { 878 ISP_IOXPUT_8(isp, src->mrk_reserved0, &dst->mrk_reserved0); 879 ISP_IOXPUT_8(isp, src->mrk_target, &dst->mrk_target); 880 } 881 ISP_IOXPUT_16(isp, src->mrk_modifier, &dst->mrk_modifier); 882 ISP_IOXPUT_16(isp, src->mrk_flags, &dst->mrk_flags); 883 ISP_IOXPUT_16(isp, src->mrk_lun, &dst->mrk_lun); 884 for (i = 0; i < ASIZE(src->mrk_reserved1); i++) { 885 ISP_IOXPUT_8(isp, src->mrk_reserved1[i], &dst->mrk_reserved1[i]); 886 } 887 } 888 889 void 890 isp_put_marker_24xx(ispsoftc_t *isp, isp_marker_24xx_t *src, isp_marker_24xx_t *dst) 891 { 892 int i; 893 isp_put_hdr(isp, &src->mrk_header, &dst->mrk_header); 894 ISP_IOXPUT_32(isp, src->mrk_handle, &dst->mrk_handle); 895 ISP_IOXPUT_16(isp, src->mrk_nphdl, &dst->mrk_nphdl); 896 ISP_IOXPUT_8(isp, src->mrk_modifier, &dst->mrk_modifier); 897 ISP_IOXPUT_8(isp, src->mrk_reserved0, &dst->mrk_reserved0); 898 ISP_IOXPUT_8(isp, src->mrk_reserved1, &dst->mrk_reserved1); 899 ISP_IOXPUT_8(isp, src->mrk_vphdl, &dst->mrk_vphdl); 900 ISP_IOXPUT_8(isp, src->mrk_reserved2, &dst->mrk_reserved2); 901 for (i = 0; i < ASIZE(src->mrk_lun); i++) { 902 ISP_IOXPUT_8(isp, src->mrk_lun[i], &dst->mrk_lun[i]); 903 } 904 for (i = 0; i < ASIZE(src->mrk_reserved3); i++) { 905 ISP_IOXPUT_8(isp, src->mrk_reserved3[i], &dst->mrk_reserved3[i]); 906 } 907 } 908 909 void 910 isp_put_request_t2(ispsoftc_t *isp, ispreqt2_t *src, ispreqt2_t *dst) 911 { 912 int i; 913 isp_put_hdr(isp, &src->req_header, &dst->req_header); 914 ISP_IOXPUT_32(isp, src->req_handle, &dst->req_handle); 915 ISP_IOXPUT_8(isp, src->req_lun_trn, &dst->req_lun_trn); 916 ISP_IOXPUT_8(isp, src->req_target, &dst->req_target); 917 ISP_IOXPUT_16(isp, src->req_scclun, &dst->req_scclun); 918 ISP_IOXPUT_16(isp, src->req_flags, &dst->req_flags); 919 ISP_IOXPUT_16(isp, src->req_reserved, &dst->req_reserved); 920 ISP_IOXPUT_16(isp, src->req_time, &dst->req_time); 921 ISP_IOXPUT_16(isp, src->req_seg_count, &dst->req_seg_count); 922 for (i = 0; i < ASIZE(src->req_cdb); i++) { 923 ISP_IOXPUT_8(isp, src->req_cdb[i], &dst->req_cdb[i]); 924 } 925 ISP_IOXPUT_32(isp, src->req_totalcnt, &dst->req_totalcnt); 926 for (i = 0; i < ISP_RQDSEG_T2; i++) { 927 ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_base, &dst->req_dataseg[i].ds_base); 928 ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_count, &dst->req_dataseg[i].ds_count); 929 } 930 } 931 932 void 933 isp_put_request_t2e(ispsoftc_t *isp, ispreqt2e_t *src, ispreqt2e_t *dst) 934 { 935 int i; 936 isp_put_hdr(isp, &src->req_header, &dst->req_header); 937 ISP_IOXPUT_32(isp, src->req_handle, &dst->req_handle); 938 ISP_IOXPUT_16(isp, src->req_target, &dst->req_target); 939 ISP_IOXPUT_16(isp, src->req_scclun, &dst->req_scclun); 940 ISP_IOXPUT_16(isp, src->req_flags, &dst->req_flags); 941 ISP_IOXPUT_16(isp, src->req_reserved, &dst->req_reserved); 942 ISP_IOXPUT_16(isp, src->req_time, &dst->req_time); 943 ISP_IOXPUT_16(isp, src->req_seg_count, &dst->req_seg_count); 944 for (i = 0; i < ASIZE(src->req_cdb); i++) { 945 ISP_IOXPUT_8(isp, src->req_cdb[i], &dst->req_cdb[i]); 946 } 947 ISP_IOXPUT_32(isp, src->req_totalcnt, &dst->req_totalcnt); 948 for (i = 0; i < ISP_RQDSEG_T2; i++) { 949 ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_base, &dst->req_dataseg[i].ds_base); 950 ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_count, &dst->req_dataseg[i].ds_count); 951 } 952 } 953 954 void 955 isp_put_request_t3(ispsoftc_t *isp, ispreqt3_t *src, ispreqt3_t *dst) 956 { 957 int i; 958 isp_put_hdr(isp, &src->req_header, &dst->req_header); 959 ISP_IOXPUT_32(isp, src->req_handle, &dst->req_handle); 960 ISP_IOXPUT_8(isp, src->req_lun_trn, &dst->req_lun_trn); 961 ISP_IOXPUT_8(isp, src->req_target, &dst->req_target); 962 ISP_IOXPUT_16(isp, src->req_scclun, &dst->req_scclun); 963 ISP_IOXPUT_16(isp, src->req_flags, &dst->req_flags); 964 ISP_IOXPUT_8(isp, src->req_crn, &dst->req_crn); 965 ISP_IOXPUT_8(isp, src->req_reserved, &dst->req_reserved); 966 ISP_IOXPUT_16(isp, src->req_time, &dst->req_time); 967 ISP_IOXPUT_16(isp, src->req_seg_count, &dst->req_seg_count); 968 for (i = 0; i < ASIZE(src->req_cdb); i++) { 969 ISP_IOXPUT_8(isp, src->req_cdb[i], &dst->req_cdb[i]); 970 } 971 ISP_IOXPUT_32(isp, src->req_totalcnt, &dst->req_totalcnt); 972 for (i = 0; i < ISP_RQDSEG_T3; i++) { 973 ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_base, &dst->req_dataseg[i].ds_base); 974 ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_basehi, &dst->req_dataseg[i].ds_basehi); 975 ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_count, &dst->req_dataseg[i].ds_count); 976 } 977 } 978 979 void 980 isp_put_request_t3e(ispsoftc_t *isp, ispreqt3e_t *src, ispreqt3e_t *dst) 981 { 982 int i; 983 isp_put_hdr(isp, &src->req_header, &dst->req_header); 984 ISP_IOXPUT_32(isp, src->req_handle, &dst->req_handle); 985 ISP_IOXPUT_16(isp, src->req_target, &dst->req_target); 986 ISP_IOXPUT_16(isp, src->req_scclun, &dst->req_scclun); 987 ISP_IOXPUT_16(isp, src->req_flags, &dst->req_flags); 988 ISP_IOXPUT_8(isp, src->req_crn, &dst->req_crn); 989 ISP_IOXPUT_8(isp, src->req_reserved, &dst->req_reserved); 990 ISP_IOXPUT_16(isp, src->req_time, &dst->req_time); 991 ISP_IOXPUT_16(isp, src->req_seg_count, &dst->req_seg_count); 992 for (i = 0; i < ASIZE(src->req_cdb); i++) { 993 ISP_IOXPUT_8(isp, src->req_cdb[i], &dst->req_cdb[i]); 994 } 995 ISP_IOXPUT_32(isp, src->req_totalcnt, &dst->req_totalcnt); 996 for (i = 0; i < ISP_RQDSEG_T3; i++) { 997 ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_base, &dst->req_dataseg[i].ds_base); 998 ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_basehi, &dst->req_dataseg[i].ds_basehi); 999 ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_count, &dst->req_dataseg[i].ds_count); 1000 } 1001 } 1002 1003 void 1004 isp_put_extended_request(ispsoftc_t *isp, ispextreq_t *src, ispextreq_t *dst) 1005 { 1006 int i; 1007 isp_put_hdr(isp, &src->req_header, &dst->req_header); 1008 ISP_IOXPUT_32(isp, src->req_handle, &dst->req_handle); 1009 if (ISP_IS_SBUS(isp)) { 1010 ISP_IOXPUT_8(isp, src->req_lun_trn, &dst->req_target); 1011 ISP_IOXPUT_8(isp, src->req_target, &dst->req_lun_trn); 1012 } else { 1013 ISP_IOXPUT_8(isp, src->req_lun_trn, &dst->req_lun_trn); 1014 ISP_IOXPUT_8(isp, src->req_target, &dst->req_target); 1015 } 1016 ISP_IOXPUT_16(isp, src->req_cdblen, &dst->req_cdblen); 1017 ISP_IOXPUT_16(isp, src->req_flags, &dst->req_flags); 1018 ISP_IOXPUT_16(isp, src->req_time, &dst->req_time); 1019 ISP_IOXPUT_16(isp, src->req_seg_count, &dst->req_seg_count); 1020 for (i = 0; i < ASIZE(src->req_cdb); i++) { 1021 ISP_IOXPUT_8(isp, src->req_cdb[i], &dst->req_cdb[i]); 1022 } 1023 } 1024 1025 void 1026 isp_put_request_t7(ispsoftc_t *isp, ispreqt7_t *src, ispreqt7_t *dst) 1027 { 1028 int i; 1029 uint32_t *a, *b; 1030 1031 isp_put_hdr(isp, &src->req_header, &dst->req_header); 1032 ISP_IOXPUT_32(isp, src->req_handle, &dst->req_handle); 1033 ISP_IOXPUT_16(isp, src->req_nphdl, &dst->req_nphdl); 1034 ISP_IOXPUT_16(isp, src->req_time, &dst->req_time); 1035 ISP_IOXPUT_16(isp, src->req_seg_count, &dst->req_seg_count); 1036 ISP_IOXPUT_16(isp, src->req_reserved, &dst->req_reserved); 1037 a = (uint32_t *) src->req_lun; 1038 b = (uint32_t *) dst->req_lun; 1039 for (i = 0; i < (ASIZE(src->req_lun) >> 2); i++ ) { 1040 *b++ = ISP_SWAP32(isp, *a++); 1041 } 1042 ISP_IOXPUT_8(isp, src->req_alen_datadir, &dst->req_alen_datadir); 1043 ISP_IOXPUT_8(isp, src->req_task_management, &dst->req_task_management); 1044 ISP_IOXPUT_8(isp, src->req_task_attribute, &dst->req_task_attribute); 1045 ISP_IOXPUT_8(isp, src->req_crn, &dst->req_crn); 1046 a = (uint32_t *) src->req_cdb; 1047 b = (uint32_t *) dst->req_cdb; 1048 for (i = 0; i < (ASIZE(src->req_cdb) >> 2); i++) { 1049 *b++ = ISP_SWAP32(isp, *a++); 1050 } 1051 ISP_IOXPUT_32(isp, src->req_dl, &dst->req_dl); 1052 ISP_IOXPUT_16(isp, src->req_tidlo, &dst->req_tidlo); 1053 ISP_IOXPUT_8(isp, src->req_tidhi, &dst->req_tidhi); 1054 ISP_IOXPUT_8(isp, src->req_vpidx, &dst->req_vpidx); 1055 ISP_IOXPUT_32(isp, src->req_dataseg.ds_base, &dst->req_dataseg.ds_base); 1056 ISP_IOXPUT_32(isp, src->req_dataseg.ds_basehi, &dst->req_dataseg.ds_basehi); 1057 ISP_IOXPUT_32(isp, src->req_dataseg.ds_count, &dst->req_dataseg.ds_count); 1058 } 1059 1060 void 1061 isp_put_24xx_tmf(ispsoftc_t *isp, isp24xx_tmf_t *src, isp24xx_tmf_t *dst) 1062 { 1063 int i; 1064 uint32_t *a, *b; 1065 1066 isp_put_hdr(isp, &src->tmf_header, &dst->tmf_header); 1067 ISP_IOXPUT_32(isp, src->tmf_handle, &dst->tmf_handle); 1068 ISP_IOXPUT_16(isp, src->tmf_nphdl, &dst->tmf_nphdl); 1069 ISP_IOXPUT_16(isp, src->tmf_delay, &dst->tmf_delay); 1070 ISP_IOXPUT_16(isp, src->tmf_timeout, &dst->tmf_timeout); 1071 for (i = 0; i < ASIZE(src->tmf_reserved0); i++) { 1072 ISP_IOXPUT_8(isp, src->tmf_reserved0[i], &dst->tmf_reserved0[i]); 1073 } 1074 a = (uint32_t *) src->tmf_lun; 1075 b = (uint32_t *) dst->tmf_lun; 1076 for (i = 0; i < (ASIZE(src->tmf_lun) >> 2); i++ ) { 1077 *b++ = ISP_SWAP32(isp, *a++); 1078 } 1079 ISP_IOXPUT_32(isp, src->tmf_flags, &dst->tmf_flags); 1080 for (i = 0; i < ASIZE(src->tmf_reserved1); i++) { 1081 ISP_IOXPUT_8(isp, src->tmf_reserved1[i], &dst->tmf_reserved1[i]); 1082 } 1083 ISP_IOXPUT_16(isp, src->tmf_tidlo, &dst->tmf_tidlo); 1084 ISP_IOXPUT_8(isp, src->tmf_tidhi, &dst->tmf_tidhi); 1085 ISP_IOXPUT_8(isp, src->tmf_vpidx, &dst->tmf_vpidx); 1086 for (i = 0; i < ASIZE(src->tmf_reserved2); i++) { 1087 ISP_IOXPUT_8(isp, src->tmf_reserved2[i], &dst->tmf_reserved2[i]); 1088 } 1089 } 1090 1091 void 1092 isp_put_24xx_abrt(ispsoftc_t *isp, isp24xx_abrt_t *src, isp24xx_abrt_t *dst) 1093 { 1094 int i; 1095 isp_put_hdr(isp, &src->abrt_header, &dst->abrt_header); 1096 ISP_IOXPUT_32(isp, src->abrt_handle, &dst->abrt_handle); 1097 ISP_IOXPUT_16(isp, src->abrt_nphdl, &dst->abrt_nphdl); 1098 ISP_IOXPUT_16(isp, src->abrt_options, &dst->abrt_options); 1099 ISP_IOXPUT_32(isp, src->abrt_cmd_handle, &dst->abrt_cmd_handle); 1100 for (i = 0; i < ASIZE(src->abrt_reserved); i++) { 1101 ISP_IOXPUT_8(isp, src->abrt_reserved[i], &dst->abrt_reserved[i]); 1102 } 1103 ISP_IOXPUT_16(isp, src->abrt_tidlo, &dst->abrt_tidlo); 1104 ISP_IOXPUT_8(isp, src->abrt_tidhi, &dst->abrt_tidhi); 1105 ISP_IOXPUT_8(isp, src->abrt_vpidx, &dst->abrt_vpidx); 1106 for (i = 0; i < ASIZE(src->abrt_reserved1); i++) { 1107 ISP_IOXPUT_8(isp, src->abrt_reserved1[i], &dst->abrt_reserved1[i]); 1108 } 1109 } 1110 1111 void 1112 isp_put_cont_req(ispsoftc_t *isp, ispcontreq_t *src, ispcontreq_t *dst) 1113 { 1114 int i; 1115 isp_put_hdr(isp, &src->req_header, &dst->req_header); 1116 for (i = 0; i < ISP_CDSEG; i++) { 1117 ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_base, &dst->req_dataseg[i].ds_base); 1118 ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_count, &dst->req_dataseg[i].ds_count); 1119 } 1120 } 1121 1122 void 1123 isp_put_cont64_req(ispsoftc_t *isp, ispcontreq64_t *src, ispcontreq64_t *dst) 1124 { 1125 int i; 1126 isp_put_hdr(isp, &src->req_header, &dst->req_header); 1127 for (i = 0; i < ISP_CDSEG64; i++) { 1128 ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_base, &dst->req_dataseg[i].ds_base); 1129 ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_basehi, &dst->req_dataseg[i].ds_basehi); 1130 ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_count, &dst->req_dataseg[i].ds_count); 1131 } 1132 } 1133 1134 void 1135 isp_get_response(ispsoftc_t *isp, ispstatusreq_t *src, ispstatusreq_t *dst) 1136 { 1137 int i; 1138 isp_get_hdr(isp, &src->req_header, &dst->req_header); 1139 ISP_IOXGET_32(isp, &src->req_handle, dst->req_handle); 1140 ISP_IOXGET_16(isp, &src->req_scsi_status, dst->req_scsi_status); 1141 ISP_IOXGET_16(isp, &src->req_completion_status, dst->req_completion_status); 1142 ISP_IOXGET_16(isp, &src->req_state_flags, dst->req_state_flags); 1143 ISP_IOXGET_16(isp, &src->req_status_flags, dst->req_status_flags); 1144 ISP_IOXGET_16(isp, &src->req_time, dst->req_time); 1145 ISP_IOXGET_16(isp, &src->req_sense_len, dst->req_sense_len); 1146 ISP_IOXGET_32(isp, &src->req_resid, dst->req_resid); 1147 for (i = 0; i < sizeof (src->req_response); i++) { 1148 ISP_IOXGET_8(isp, &src->req_response[i], dst->req_response[i]); 1149 } 1150 for (i = 0; i < sizeof (src->req_sense_data); i++) { 1151 ISP_IOXGET_8(isp, &src->req_sense_data[i], dst->req_sense_data[i]); 1152 } 1153 } 1154 1155 void 1156 isp_get_cont_response(ispsoftc_t *isp, ispstatus_cont_t *src, ispstatus_cont_t *dst) 1157 { 1158 int i; 1159 isp_get_hdr(isp, &src->req_header, &dst->req_header); 1160 if (IS_24XX(isp)) { 1161 uint32_t *a, *b; 1162 a = (uint32_t *) src->req_sense_data; 1163 b = (uint32_t *) dst->req_sense_data; 1164 for (i = 0; i < (sizeof (src->req_sense_data) / sizeof (uint32_t)); i++) { 1165 ISP_IOZGET_32(isp, a++, *b++); 1166 } 1167 } else { 1168 for (i = 0; i < sizeof (src->req_sense_data); i++) { 1169 ISP_IOXGET_8(isp, &src->req_sense_data[i], dst->req_sense_data[i]); 1170 } 1171 } 1172 } 1173 1174 void 1175 isp_get_24xx_response(ispsoftc_t *isp, isp24xx_statusreq_t *src, isp24xx_statusreq_t *dst) 1176 { 1177 int i; 1178 uint32_t *s, *d; 1179 1180 isp_get_hdr(isp, &src->req_header, &dst->req_header); 1181 ISP_IOXGET_32(isp, &src->req_handle, dst->req_handle); 1182 ISP_IOXGET_16(isp, &src->req_completion_status, dst->req_completion_status); 1183 ISP_IOXGET_16(isp, &src->req_oxid, dst->req_oxid); 1184 ISP_IOXGET_32(isp, &src->req_resid, dst->req_resid); 1185 ISP_IOXGET_16(isp, &src->req_reserved0, dst->req_reserved0); 1186 ISP_IOXGET_16(isp, &src->req_state_flags, dst->req_state_flags); 1187 ISP_IOXGET_16(isp, &src->req_reserved1, dst->req_reserved1); 1188 ISP_IOXGET_16(isp, &src->req_scsi_status, dst->req_scsi_status); 1189 ISP_IOXGET_32(isp, &src->req_fcp_residual, dst->req_fcp_residual); 1190 ISP_IOXGET_32(isp, &src->req_sense_len, dst->req_sense_len); 1191 ISP_IOXGET_32(isp, &src->req_response_len, dst->req_response_len); 1192 s = (uint32_t *)src->req_rsp_sense; 1193 d = (uint32_t *)dst->req_rsp_sense; 1194 for (i = 0; i < (ASIZE(src->req_rsp_sense) >> 2); i++) { 1195 d[i] = ISP_SWAP32(isp, s[i]); 1196 } 1197 } 1198 1199 void 1200 isp_get_24xx_abrt(ispsoftc_t *isp, isp24xx_abrt_t *src, isp24xx_abrt_t *dst) 1201 { 1202 int i; 1203 isp_get_hdr(isp, &src->abrt_header, &dst->abrt_header); 1204 ISP_IOXGET_32(isp, &src->abrt_handle, dst->abrt_handle); 1205 ISP_IOXGET_16(isp, &src->abrt_nphdl, dst->abrt_nphdl); 1206 ISP_IOXGET_16(isp, &src->abrt_options, dst->abrt_options); 1207 ISP_IOXGET_32(isp, &src->abrt_cmd_handle, dst->abrt_cmd_handle); 1208 for (i = 0; i < ASIZE(src->abrt_reserved); i++) { 1209 ISP_IOXGET_8(isp, &src->abrt_reserved[i], dst->abrt_reserved[i]); 1210 } 1211 ISP_IOXGET_16(isp, &src->abrt_tidlo, dst->abrt_tidlo); 1212 ISP_IOXGET_8(isp, &src->abrt_tidhi, dst->abrt_tidhi); 1213 ISP_IOXGET_8(isp, &src->abrt_vpidx, dst->abrt_vpidx); 1214 for (i = 0; i < ASIZE(src->abrt_reserved1); i++) { 1215 ISP_IOXGET_8(isp, &src->abrt_reserved1[i], dst->abrt_reserved1[i]); 1216 } 1217 } 1218 1219 1220 void 1221 isp_get_rio1(ispsoftc_t *isp, isp_rio1_t *r1src, isp_rio1_t *r1dst) 1222 { 1223 const int lim = sizeof (r1dst->req_handles) / sizeof (r1dst->req_handles[0]); 1224 int i; 1225 isp_get_hdr(isp, &r1src->req_header, &r1dst->req_header); 1226 if (r1dst->req_header.rqs_seqno > lim) { 1227 r1dst->req_header.rqs_seqno = lim; 1228 } 1229 for (i = 0; i < r1dst->req_header.rqs_seqno; i++) { 1230 ISP_IOXGET_32(isp, &r1src->req_handles[i], r1dst->req_handles[i]); 1231 } 1232 while (i < lim) { 1233 r1dst->req_handles[i++] = 0; 1234 } 1235 } 1236 1237 void 1238 isp_get_rio2(ispsoftc_t *isp, isp_rio2_t *r2src, isp_rio2_t *r2dst) 1239 { 1240 const int lim = sizeof (r2dst->req_handles) / sizeof (r2dst->req_handles[0]); 1241 int i; 1242 1243 isp_get_hdr(isp, &r2src->req_header, &r2dst->req_header); 1244 if (r2dst->req_header.rqs_seqno > lim) { 1245 r2dst->req_header.rqs_seqno = lim; 1246 } 1247 for (i = 0; i < r2dst->req_header.rqs_seqno; i++) { 1248 ISP_IOXGET_16(isp, &r2src->req_handles[i], r2dst->req_handles[i]); 1249 } 1250 while (i < lim) { 1251 r2dst->req_handles[i++] = 0; 1252 } 1253 } 1254 1255 void 1256 isp_put_icb(ispsoftc_t *isp, isp_icb_t *src, isp_icb_t *dst) 1257 { 1258 int i; 1259 if (ISP_IS_SBUS(isp)) { 1260 ISP_IOXPUT_8(isp, src->icb_version, &dst->icb_reserved0); 1261 ISP_IOXPUT_8(isp, src->icb_reserved0, &dst->icb_version); 1262 } else { 1263 ISP_IOXPUT_8(isp, src->icb_version, &dst->icb_version); 1264 ISP_IOXPUT_8(isp, src->icb_reserved0, &dst->icb_reserved0); 1265 } 1266 ISP_IOXPUT_16(isp, src->icb_fwoptions, &dst->icb_fwoptions); 1267 ISP_IOXPUT_16(isp, src->icb_maxfrmlen, &dst->icb_maxfrmlen); 1268 ISP_IOXPUT_16(isp, src->icb_maxalloc, &dst->icb_maxalloc); 1269 ISP_IOXPUT_16(isp, src->icb_execthrottle, &dst->icb_execthrottle); 1270 if (ISP_IS_SBUS(isp)) { 1271 ISP_IOXPUT_8(isp, src->icb_retry_count, &dst->icb_retry_delay); 1272 ISP_IOXPUT_8(isp, src->icb_retry_delay, &dst->icb_retry_count); 1273 } else { 1274 ISP_IOXPUT_8(isp, src->icb_retry_count, &dst->icb_retry_count); 1275 ISP_IOXPUT_8(isp, src->icb_retry_delay, &dst->icb_retry_delay); 1276 } 1277 for (i = 0; i < 8; i++) { 1278 ISP_IOXPUT_8(isp, src->icb_portname[i], &dst->icb_portname[i]); 1279 } 1280 ISP_IOXPUT_16(isp, src->icb_hardaddr, &dst->icb_hardaddr); 1281 if (ISP_IS_SBUS(isp)) { 1282 ISP_IOXPUT_8(isp, src->icb_iqdevtype, &dst->icb_logintime); 1283 ISP_IOXPUT_8(isp, src->icb_logintime, &dst->icb_iqdevtype); 1284 } else { 1285 ISP_IOXPUT_8(isp, src->icb_iqdevtype, &dst->icb_iqdevtype); 1286 ISP_IOXPUT_8(isp, src->icb_logintime, &dst->icb_logintime); 1287 } 1288 for (i = 0; i < 8; i++) { 1289 ISP_IOXPUT_8(isp, src->icb_nodename[i], &dst->icb_nodename[i]); 1290 } 1291 ISP_IOXPUT_16(isp, src->icb_rqstout, &dst->icb_rqstout); 1292 ISP_IOXPUT_16(isp, src->icb_rspnsin, &dst->icb_rspnsin); 1293 ISP_IOXPUT_16(isp, src->icb_rqstqlen, &dst->icb_rqstqlen); 1294 ISP_IOXPUT_16(isp, src->icb_rsltqlen, &dst->icb_rsltqlen); 1295 for (i = 0; i < 4; i++) { 1296 ISP_IOXPUT_16(isp, src->icb_rqstaddr[i], &dst->icb_rqstaddr[i]); 1297 } 1298 for (i = 0; i < 4; i++) { 1299 ISP_IOXPUT_16(isp, src->icb_respaddr[i], &dst->icb_respaddr[i]); 1300 } 1301 ISP_IOXPUT_16(isp, src->icb_lunenables, &dst->icb_lunenables); 1302 if (ISP_IS_SBUS(isp)) { 1303 ISP_IOXPUT_8(isp, src->icb_ccnt, &dst->icb_icnt); 1304 ISP_IOXPUT_8(isp, src->icb_icnt, &dst->icb_ccnt); 1305 } else { 1306 ISP_IOXPUT_8(isp, src->icb_ccnt, &dst->icb_ccnt); 1307 ISP_IOXPUT_8(isp, src->icb_icnt, &dst->icb_icnt); 1308 } 1309 ISP_IOXPUT_16(isp, src->icb_lunetimeout, &dst->icb_lunetimeout); 1310 ISP_IOXPUT_16(isp, src->icb_reserved1, &dst->icb_reserved1); 1311 ISP_IOXPUT_16(isp, src->icb_xfwoptions, &dst->icb_xfwoptions); 1312 if (ISP_IS_SBUS(isp)) { 1313 ISP_IOXPUT_8(isp, src->icb_racctimer, &dst->icb_idelaytimer); 1314 ISP_IOXPUT_8(isp, src->icb_idelaytimer, &dst->icb_racctimer); 1315 } else { 1316 ISP_IOXPUT_8(isp, src->icb_racctimer, &dst->icb_racctimer); 1317 ISP_IOXPUT_8(isp, src->icb_idelaytimer, &dst->icb_idelaytimer); 1318 } 1319 ISP_IOXPUT_16(isp, src->icb_zfwoptions, &dst->icb_zfwoptions); 1320 } 1321 1322 void 1323 isp_put_icb_2400(ispsoftc_t *isp, isp_icb_2400_t *src, isp_icb_2400_t *dst) 1324 { 1325 int i; 1326 ISP_IOXPUT_16(isp, src->icb_version, &dst->icb_version); 1327 ISP_IOXPUT_16(isp, src->icb_reserved0, &dst->icb_reserved0); 1328 ISP_IOXPUT_16(isp, src->icb_maxfrmlen, &dst->icb_maxfrmlen); 1329 ISP_IOXPUT_16(isp, src->icb_execthrottle, &dst->icb_execthrottle); 1330 ISP_IOXPUT_16(isp, src->icb_xchgcnt, &dst->icb_xchgcnt); 1331 ISP_IOXPUT_16(isp, src->icb_hardaddr, &dst->icb_hardaddr); 1332 for (i = 0; i < 8; i++) { 1333 ISP_IOXPUT_8(isp, src->icb_portname[i], &dst->icb_portname[i]); 1334 } 1335 for (i = 0; i < 8; i++) { 1336 ISP_IOXPUT_8(isp, src->icb_nodename[i], &dst->icb_nodename[i]); 1337 } 1338 ISP_IOXPUT_16(isp, src->icb_rspnsin, &dst->icb_rspnsin); 1339 ISP_IOXPUT_16(isp, src->icb_rqstout, &dst->icb_rqstout); 1340 ISP_IOXPUT_16(isp, src->icb_retry_count, &dst->icb_retry_count); 1341 ISP_IOXPUT_16(isp, src->icb_priout, &dst->icb_priout); 1342 ISP_IOXPUT_16(isp, src->icb_rsltqlen, &dst->icb_rsltqlen); 1343 ISP_IOXPUT_16(isp, src->icb_rqstqlen, &dst->icb_rqstqlen); 1344 ISP_IOXPUT_16(isp, src->icb_ldn_nols, &dst->icb_ldn_nols); 1345 ISP_IOXPUT_16(isp, src->icb_prqstqlen, &dst->icb_prqstqlen); 1346 for (i = 0; i < 4; i++) { 1347 ISP_IOXPUT_16(isp, src->icb_rqstaddr[i], &dst->icb_rqstaddr[i]); 1348 } 1349 for (i = 0; i < 4; i++) { 1350 ISP_IOXPUT_16(isp, src->icb_respaddr[i], &dst->icb_respaddr[i]); 1351 } 1352 for (i = 0; i < 4; i++) { 1353 ISP_IOXPUT_16(isp, src->icb_priaddr[i], &dst->icb_priaddr[i]); 1354 } 1355 for (i = 0; i < 4; i++) { 1356 ISP_IOXPUT_16(isp, src->icb_reserved1[i], &dst->icb_reserved1[i]); 1357 } 1358 ISP_IOXPUT_16(isp, src->icb_atio_in, &dst->icb_atio_in); 1359 ISP_IOXPUT_16(isp, src->icb_atioqlen, &dst->icb_atioqlen); 1360 for (i = 0; i < 4; i++) { 1361 ISP_IOXPUT_16(isp, src->icb_atioqaddr[i], &dst->icb_atioqaddr[i]); 1362 } 1363 ISP_IOXPUT_16(isp, src->icb_idelaytimer, &dst->icb_idelaytimer); 1364 ISP_IOXPUT_16(isp, src->icb_logintime, &dst->icb_logintime); 1365 ISP_IOXPUT_32(isp, src->icb_fwoptions1, &dst->icb_fwoptions1); 1366 ISP_IOXPUT_32(isp, src->icb_fwoptions2, &dst->icb_fwoptions2); 1367 ISP_IOXPUT_32(isp, src->icb_fwoptions3, &dst->icb_fwoptions3); 1368 for (i = 0; i < 12; i++) { 1369 ISP_IOXPUT_16(isp, src->icb_reserved2[i], &dst->icb_reserved2[i]); 1370 } 1371 } 1372 1373 void 1374 isp_put_icb_2400_vpinfo(ispsoftc_t *isp, isp_icb_2400_vpinfo_t *src, isp_icb_2400_vpinfo_t *dst) 1375 { 1376 ISP_IOXPUT_16(isp, src->vp_count, &dst->vp_count); 1377 ISP_IOXPUT_16(isp, src->vp_global_options, &dst->vp_global_options); 1378 } 1379 1380 void 1381 isp_put_vp_port_info(ispsoftc_t *isp, vp_port_info_t *src, vp_port_info_t *dst) 1382 { 1383 int i; 1384 ISP_IOXPUT_16(isp, src->vp_port_status, &dst->vp_port_status); 1385 ISP_IOXPUT_8(isp, src->vp_port_options, &dst->vp_port_options); 1386 ISP_IOXPUT_8(isp, src->vp_port_loopid, &dst->vp_port_loopid); 1387 for (i = 0; i < 8; i++) { 1388 ISP_IOXPUT_8(isp, src->vp_port_portname[i], &dst->vp_port_portname[i]); 1389 } 1390 for (i = 0; i < 8; i++) { 1391 ISP_IOXPUT_8(isp, src->vp_port_nodename[i], &dst->vp_port_nodename[i]); 1392 } 1393 /* we never *put* portid_lo/portid_hi */ 1394 } 1395 1396 void 1397 isp_get_vp_port_info(ispsoftc_t *isp, vp_port_info_t *src, vp_port_info_t *dst) 1398 { 1399 int i; 1400 ISP_IOXGET_16(isp, &src->vp_port_status, dst->vp_port_status); 1401 ISP_IOXGET_8(isp, &src->vp_port_options, dst->vp_port_options); 1402 ISP_IOXGET_8(isp, &src->vp_port_loopid, dst->vp_port_loopid); 1403 for (i = 0; i < ASIZE(src->vp_port_portname); i++) { 1404 ISP_IOXGET_8(isp, &src->vp_port_portname[i], dst->vp_port_portname[i]); 1405 } 1406 for (i = 0; i < ASIZE(src->vp_port_nodename); i++) { 1407 ISP_IOXGET_8(isp, &src->vp_port_nodename[i], dst->vp_port_nodename[i]); 1408 } 1409 ISP_IOXGET_16(isp, &src->vp_port_portid_lo, dst->vp_port_portid_lo); 1410 ISP_IOXGET_16(isp, &src->vp_port_portid_hi, dst->vp_port_portid_hi); 1411 } 1412 1413 void 1414 isp_put_vp_ctrl_info(ispsoftc_t *isp, vp_ctrl_info_t *src, vp_ctrl_info_t *dst) 1415 { 1416 int i; 1417 isp_put_hdr(isp, &src->vp_ctrl_hdr, &dst->vp_ctrl_hdr); 1418 ISP_IOXPUT_32(isp, src->vp_ctrl_handle, &dst->vp_ctrl_handle); 1419 ISP_IOXPUT_16(isp, src->vp_ctrl_index_fail, &dst->vp_ctrl_index_fail); 1420 ISP_IOXPUT_16(isp, src->vp_ctrl_status, &dst->vp_ctrl_status); 1421 ISP_IOXPUT_16(isp, src->vp_ctrl_command, &dst->vp_ctrl_command); 1422 ISP_IOXPUT_16(isp, src->vp_ctrl_vp_count, &dst->vp_ctrl_vp_count); 1423 for (i = 0; i < ASIZE(src->vp_ctrl_idmap); i++) { 1424 ISP_IOXPUT_16(isp, src->vp_ctrl_idmap[i], &dst->vp_ctrl_idmap[i]); 1425 } 1426 for (i = 0; i < ASIZE(src->vp_ctrl_reserved); i++) { 1427 ISP_IOXPUT_8(isp, src->vp_ctrl_reserved[i], &dst->vp_ctrl_reserved[i]); 1428 } 1429 } 1430 1431 void 1432 isp_get_vp_ctrl_info(ispsoftc_t *isp, vp_ctrl_info_t *src, vp_ctrl_info_t *dst) 1433 { 1434 int i; 1435 isp_get_hdr(isp, &src->vp_ctrl_hdr, &dst->vp_ctrl_hdr); 1436 ISP_IOXGET_32(isp, &src->vp_ctrl_handle, dst->vp_ctrl_handle); 1437 ISP_IOXGET_16(isp, &src->vp_ctrl_index_fail, dst->vp_ctrl_index_fail); 1438 ISP_IOXGET_16(isp, &src->vp_ctrl_status, dst->vp_ctrl_status); 1439 ISP_IOXGET_16(isp, &src->vp_ctrl_command, dst->vp_ctrl_command); 1440 ISP_IOXGET_16(isp, &src->vp_ctrl_vp_count, dst->vp_ctrl_vp_count); 1441 for (i = 0; i < ASIZE(src->vp_ctrl_idmap); i++) { 1442 ISP_IOXGET_16(isp, &src->vp_ctrl_idmap[i], dst->vp_ctrl_idmap[i]); 1443 } 1444 for (i = 0; i < ASIZE(src->vp_ctrl_reserved); i++) { 1445 ISP_IOXGET_8(isp, &src->vp_ctrl_reserved[i], dst->vp_ctrl_reserved[i]); 1446 } 1447 } 1448 1449 void 1450 isp_put_vp_modify(ispsoftc_t *isp, vp_modify_t *src, vp_modify_t *dst) 1451 { 1452 int i, j; 1453 isp_put_hdr(isp, &src->vp_mod_hdr, &dst->vp_mod_hdr); 1454 ISP_IOXPUT_32(isp, src->vp_mod_hdl, &dst->vp_mod_hdl); 1455 ISP_IOXPUT_16(isp, src->vp_mod_reserved0, &dst->vp_mod_reserved0); 1456 ISP_IOXPUT_16(isp, src->vp_mod_status, &dst->vp_mod_status); 1457 ISP_IOXPUT_8(isp, src->vp_mod_cmd, &dst->vp_mod_cmd); 1458 ISP_IOXPUT_8(isp, src->vp_mod_cnt, &dst->vp_mod_cnt); 1459 ISP_IOXPUT_8(isp, src->vp_mod_idx0, &dst->vp_mod_idx0); 1460 ISP_IOXPUT_8(isp, src->vp_mod_idx1, &dst->vp_mod_idx1); 1461 for (i = 0; i < ASIZE(src->vp_mod_ports); i++) { 1462 ISP_IOXPUT_8(isp, src->vp_mod_ports[i].options, &dst->vp_mod_ports[i].options); 1463 ISP_IOXPUT_8(isp, src->vp_mod_ports[i].loopid, &dst->vp_mod_ports[i].loopid); 1464 ISP_IOXPUT_16(isp, src->vp_mod_ports[i].reserved1, &dst->vp_mod_ports[i].reserved1); 1465 for (j = 0; j < ASIZE(src->vp_mod_ports[i].wwpn); j++) { 1466 ISP_IOXPUT_8(isp, src->vp_mod_ports[i].wwpn[j], &dst->vp_mod_ports[i].wwpn[j]); 1467 } 1468 for (j = 0; j < ASIZE(src->vp_mod_ports[i].wwnn); j++) { 1469 ISP_IOXPUT_8(isp, src->vp_mod_ports[i].wwnn[j], &dst->vp_mod_ports[i].wwnn[j]); 1470 } 1471 } 1472 for (i = 0; i < ASIZE(src->vp_mod_reserved2); i++) { 1473 ISP_IOXPUT_8(isp, src->vp_mod_reserved2[i], &dst->vp_mod_reserved2[i]); 1474 } 1475 } 1476 1477 void 1478 isp_get_vp_modify(ispsoftc_t *isp, vp_modify_t *src, vp_modify_t *dst) 1479 { 1480 int i, j; 1481 isp_get_hdr(isp, &src->vp_mod_hdr, &dst->vp_mod_hdr); 1482 ISP_IOXGET_32(isp, &src->vp_mod_hdl, dst->vp_mod_hdl); 1483 ISP_IOXGET_16(isp, &src->vp_mod_reserved0, dst->vp_mod_reserved0); 1484 ISP_IOXGET_16(isp, &src->vp_mod_status, dst->vp_mod_status); 1485 ISP_IOXGET_8(isp, &src->vp_mod_cmd, dst->vp_mod_cmd); 1486 ISP_IOXGET_8(isp, &src->vp_mod_cnt, dst->vp_mod_cnt); 1487 ISP_IOXGET_8(isp, &src->vp_mod_idx0, dst->vp_mod_idx0); 1488 ISP_IOXGET_8(isp, &src->vp_mod_idx1, dst->vp_mod_idx1); 1489 for (i = 0; i < ASIZE(src->vp_mod_ports); i++) { 1490 ISP_IOXGET_8(isp, &src->vp_mod_ports[i].options, dst->vp_mod_ports[i].options); 1491 ISP_IOXGET_8(isp, &src->vp_mod_ports[i].loopid, dst->vp_mod_ports[i].loopid); 1492 ISP_IOXGET_16(isp, &src->vp_mod_ports[i].reserved1, dst->vp_mod_ports[i].reserved1); 1493 for (j = 0; j < ASIZE(src->vp_mod_ports[i].wwpn); j++) { 1494 ISP_IOXGET_8(isp, &src->vp_mod_ports[i].wwpn[j], dst->vp_mod_ports[i].wwpn[j]); 1495 } 1496 for (j = 0; j < ASIZE(src->vp_mod_ports[i].wwnn); j++) { 1497 ISP_IOXGET_8(isp, &src->vp_mod_ports[i].wwnn[j], dst->vp_mod_ports[i].wwnn[j]); 1498 } 1499 } 1500 for (i = 0; i < ASIZE(src->vp_mod_reserved2); i++) { 1501 ISP_IOXGET_8(isp, &src->vp_mod_reserved2[i], dst->vp_mod_reserved2[i]); 1502 } 1503 } 1504 1505 void 1506 isp_get_pdb_21xx(ispsoftc_t *isp, isp_pdb_21xx_t *src, isp_pdb_21xx_t *dst) 1507 { 1508 int i; 1509 ISP_IOXGET_16(isp, &src->pdb_options, dst->pdb_options); 1510 ISP_IOXGET_8(isp, &src->pdb_mstate, dst->pdb_mstate); 1511 ISP_IOXGET_8(isp, &src->pdb_sstate, dst->pdb_sstate); 1512 for (i = 0; i < 4; i++) { 1513 ISP_IOXGET_8(isp, &src->pdb_hardaddr_bits[i], dst->pdb_hardaddr_bits[i]); 1514 } 1515 for (i = 0; i < 4; i++) { 1516 ISP_IOXGET_8(isp, &src->pdb_portid_bits[i], dst->pdb_portid_bits[i]); 1517 } 1518 for (i = 0; i < 8; i++) { 1519 ISP_IOXGET_8(isp, &src->pdb_nodename[i], dst->pdb_nodename[i]); 1520 } 1521 for (i = 0; i < 8; i++) { 1522 ISP_IOXGET_8(isp, &src->pdb_portname[i], dst->pdb_portname[i]); 1523 } 1524 ISP_IOXGET_16(isp, &src->pdb_execthrottle, dst->pdb_execthrottle); 1525 ISP_IOXGET_16(isp, &src->pdb_exec_count, dst->pdb_exec_count); 1526 ISP_IOXGET_8(isp, &src->pdb_retry_count, dst->pdb_retry_count); 1527 ISP_IOXGET_8(isp, &src->pdb_retry_delay, dst->pdb_retry_delay); 1528 ISP_IOXGET_16(isp, &src->pdb_resalloc, dst->pdb_resalloc); 1529 ISP_IOXGET_16(isp, &src->pdb_curalloc, dst->pdb_curalloc); 1530 ISP_IOXGET_16(isp, &src->pdb_qhead, dst->pdb_qhead); 1531 ISP_IOXGET_16(isp, &src->pdb_qtail, dst->pdb_qtail); 1532 ISP_IOXGET_16(isp, &src->pdb_tl_next, dst->pdb_tl_next); 1533 ISP_IOXGET_16(isp, &src->pdb_tl_last, dst->pdb_tl_last); 1534 ISP_IOXGET_16(isp, &src->pdb_features, dst->pdb_features); 1535 ISP_IOXGET_16(isp, &src->pdb_pconcurrnt, dst->pdb_pconcurrnt); 1536 ISP_IOXGET_16(isp, &src->pdb_roi, dst->pdb_roi); 1537 ISP_IOXGET_8(isp, &src->pdb_target, dst->pdb_target); 1538 ISP_IOXGET_8(isp, &src->pdb_initiator, dst->pdb_initiator); 1539 ISP_IOXGET_16(isp, &src->pdb_rdsiz, dst->pdb_rdsiz); 1540 ISP_IOXGET_16(isp, &src->pdb_ncseq, dst->pdb_ncseq); 1541 ISP_IOXGET_16(isp, &src->pdb_noseq, dst->pdb_noseq); 1542 ISP_IOXGET_16(isp, &src->pdb_labrtflg, dst->pdb_labrtflg); 1543 ISP_IOXGET_16(isp, &src->pdb_lstopflg, dst->pdb_lstopflg); 1544 ISP_IOXGET_16(isp, &src->pdb_sqhead, dst->pdb_sqhead); 1545 ISP_IOXGET_16(isp, &src->pdb_sqtail, dst->pdb_sqtail); 1546 ISP_IOXGET_16(isp, &src->pdb_ptimer, dst->pdb_ptimer); 1547 ISP_IOXGET_16(isp, &src->pdb_nxt_seqid, dst->pdb_nxt_seqid); 1548 ISP_IOXGET_16(isp, &src->pdb_fcount, dst->pdb_fcount); 1549 ISP_IOXGET_16(isp, &src->pdb_prli_len, dst->pdb_prli_len); 1550 ISP_IOXGET_16(isp, &src->pdb_prli_svc0, dst->pdb_prli_svc0); 1551 ISP_IOXGET_16(isp, &src->pdb_prli_svc3, dst->pdb_prli_svc3); 1552 ISP_IOXGET_16(isp, &src->pdb_loopid, dst->pdb_loopid); 1553 ISP_IOXGET_16(isp, &src->pdb_il_ptr, dst->pdb_il_ptr); 1554 ISP_IOXGET_16(isp, &src->pdb_sl_ptr, dst->pdb_sl_ptr); 1555 } 1556 1557 void 1558 isp_get_pdb_24xx(ispsoftc_t *isp, isp_pdb_24xx_t *src, isp_pdb_24xx_t *dst) 1559 { 1560 int i; 1561 ISP_IOXGET_16(isp, &src->pdb_flags, dst->pdb_flags); 1562 ISP_IOXGET_8(isp, &src->pdb_curstate, dst->pdb_curstate); 1563 ISP_IOXGET_8(isp, &src->pdb_laststate, dst->pdb_laststate); 1564 for (i = 0; i < 4; i++) { 1565 ISP_IOXGET_8(isp, &src->pdb_hardaddr_bits[i], dst->pdb_hardaddr_bits[i]); 1566 } 1567 for (i = 0; i < 4; i++) { 1568 ISP_IOXGET_8(isp, &src->pdb_portid_bits[i], dst->pdb_portid_bits[i]); 1569 } 1570 ISP_IOXGET_16(isp, &src->pdb_retry_timer, dst->pdb_retry_timer); 1571 ISP_IOXGET_16(isp, &src->pdb_handle, dst->pdb_handle); 1572 ISP_IOXGET_16(isp, &src->pdb_rcv_dsize, dst->pdb_rcv_dsize); 1573 ISP_IOXGET_16(isp, &src->pdb_reserved0, dst->pdb_reserved0); 1574 ISP_IOXGET_16(isp, &src->pdb_prli_svc0, dst->pdb_prli_svc0); 1575 ISP_IOXGET_16(isp, &src->pdb_prli_svc3, dst->pdb_prli_svc3); 1576 for (i = 0; i < 8; i++) { 1577 ISP_IOXGET_8(isp, &src->pdb_nodename[i], dst->pdb_nodename[i]); 1578 } 1579 for (i = 0; i < 8; i++) { 1580 ISP_IOXGET_8(isp, &src->pdb_portname[i], dst->pdb_portname[i]); 1581 } 1582 for (i = 0; i < 24; i++) { 1583 ISP_IOXGET_8(isp, &src->pdb_reserved1[i], dst->pdb_reserved1[i]); 1584 } 1585 } 1586 1587 /* 1588 * PLOGI/LOGO IOCB canonicalization 1589 */ 1590 1591 void 1592 isp_get_plogx(ispsoftc_t *isp, isp_plogx_t *src, isp_plogx_t *dst) 1593 { 1594 int i; 1595 isp_get_hdr(isp, &src->plogx_header, &dst->plogx_header); 1596 ISP_IOXGET_32(isp, &src->plogx_handle, dst->plogx_handle); 1597 ISP_IOXGET_16(isp, &src->plogx_status, dst->plogx_status); 1598 ISP_IOXGET_16(isp, &src->plogx_nphdl, dst->plogx_nphdl); 1599 ISP_IOXGET_16(isp, &src->plogx_flags, dst->plogx_flags); 1600 ISP_IOXGET_16(isp, &src->plogx_vphdl, dst->plogx_vphdl); 1601 ISP_IOXGET_16(isp, &src->plogx_portlo, dst->plogx_portlo); 1602 ISP_IOXGET_16(isp, &src->plogx_rspsz_porthi, dst->plogx_rspsz_porthi); 1603 for (i = 0; i < 11; i++) { 1604 ISP_IOXGET_16(isp, &src->plogx_ioparm[i].lo16, dst->plogx_ioparm[i].lo16); 1605 ISP_IOXGET_16(isp, &src->plogx_ioparm[i].hi16, dst->plogx_ioparm[i].hi16); 1606 } 1607 } 1608 1609 void 1610 isp_put_plogx(ispsoftc_t *isp, isp_plogx_t *src, isp_plogx_t *dst) 1611 { 1612 int i; 1613 isp_put_hdr(isp, &src->plogx_header, &dst->plogx_header); 1614 ISP_IOXPUT_32(isp, src->plogx_handle, &dst->plogx_handle); 1615 ISP_IOXPUT_16(isp, src->plogx_status, &dst->plogx_status); 1616 ISP_IOXPUT_16(isp, src->plogx_nphdl, &dst->plogx_nphdl); 1617 ISP_IOXPUT_16(isp, src->plogx_flags, &dst->plogx_flags); 1618 ISP_IOXPUT_16(isp, src->plogx_vphdl, &dst->plogx_vphdl); 1619 ISP_IOXPUT_16(isp, src->plogx_portlo, &dst->plogx_portlo); 1620 ISP_IOXPUT_16(isp, src->plogx_rspsz_porthi, &dst->plogx_rspsz_porthi); 1621 for (i = 0; i < 11; i++) { 1622 ISP_IOXPUT_16(isp, src->plogx_ioparm[i].lo16, &dst->plogx_ioparm[i].lo16); 1623 ISP_IOXPUT_16(isp, src->plogx_ioparm[i].hi16, &dst->plogx_ioparm[i].hi16); 1624 } 1625 } 1626 1627 /* 1628 * Report ID canonicalization 1629 */ 1630 void 1631 isp_get_ridacq(ispsoftc_t *isp, isp_ridacq_t *src, isp_ridacq_t *dst) 1632 { 1633 int i; 1634 isp_get_hdr(isp, &src->ridacq_hdr, &dst->ridacq_hdr); 1635 ISP_IOXGET_32(isp, &src->ridacq_handle, dst->ridacq_handle); 1636 ISP_IOXGET_16(isp, &src->ridacq_vp_port_lo, dst->ridacq_vp_port_lo); 1637 ISP_IOXGET_8(isp, &src->ridacq_vp_port_hi, dst->ridacq_vp_port_hi); 1638 ISP_IOXGET_8(isp, &src->ridacq_format, dst->ridacq_format); 1639 for (i = 0; i < sizeof (src->ridacq_map) / sizeof (src->ridacq_map[0]); i++) { 1640 ISP_IOXGET_16(isp, &src->ridacq_map[i], dst->ridacq_map[i]); 1641 } 1642 for (i = 0; i < sizeof (src->ridacq_reserved1) / sizeof (src->ridacq_reserved1[0]); i++) { 1643 ISP_IOXGET_16(isp, &src->ridacq_reserved1[i], dst->ridacq_reserved1[i]); 1644 } 1645 if (dst->ridacq_format == 0) { 1646 ISP_IOXGET_8(isp, &src->un.type0.ridacq_vp_acquired, dst->un.type0.ridacq_vp_acquired); 1647 ISP_IOXGET_8(isp, &src->un.type0.ridacq_vp_setup, dst->un.type0.ridacq_vp_setup); 1648 ISP_IOXGET_16(isp, &src->un.type0.ridacq_reserved0, dst->un.type0.ridacq_reserved0); 1649 } else if (dst->ridacq_format == 1) { 1650 ISP_IOXGET_16(isp, &src->un.type1.ridacq_vp_count, dst->un.type1.ridacq_vp_count); 1651 ISP_IOXGET_8(isp, &src->un.type1.ridacq_vp_index, dst->un.type1.ridacq_vp_index); 1652 ISP_IOXGET_8(isp, &src->un.type1.ridacq_vp_status, dst->un.type1.ridacq_vp_status); 1653 } else { 1654 ISP_MEMZERO(&dst->un, sizeof (dst->un)); 1655 } 1656 } 1657 1658 1659 /* 1660 * CT Passthru canonicalization 1661 */ 1662 void 1663 isp_get_ct_pt(ispsoftc_t *isp, isp_ct_pt_t *src, isp_ct_pt_t *dst) 1664 { 1665 int i; 1666 1667 isp_get_hdr(isp, &src->ctp_header, &dst->ctp_header); 1668 ISP_IOXGET_32(isp, &src->ctp_handle, dst->ctp_handle); 1669 ISP_IOXGET_16(isp, &src->ctp_status, dst->ctp_status); 1670 ISP_IOXGET_16(isp, &src->ctp_nphdl, dst->ctp_nphdl); 1671 ISP_IOXGET_16(isp, &src->ctp_cmd_cnt, dst->ctp_cmd_cnt); 1672 ISP_IOXGET_8(isp, &src->ctp_vpidx, dst->ctp_vpidx); 1673 ISP_IOXGET_8(isp, &src->ctp_reserved0, dst->ctp_reserved0); 1674 ISP_IOXGET_16(isp, &src->ctp_time, dst->ctp_time); 1675 ISP_IOXGET_16(isp, &src->ctp_reserved1, dst->ctp_reserved1); 1676 ISP_IOXGET_16(isp, &src->ctp_rsp_cnt, dst->ctp_rsp_cnt); 1677 for (i = 0; i < 5; i++) { 1678 ISP_IOXGET_16(isp, &src->ctp_reserved2[i], dst->ctp_reserved2[i]); 1679 } 1680 ISP_IOXGET_32(isp, &src->ctp_rsp_bcnt, dst->ctp_rsp_bcnt); 1681 ISP_IOXGET_32(isp, &src->ctp_cmd_bcnt, dst->ctp_cmd_bcnt); 1682 for (i = 0; i < 2; i++) { 1683 ISP_IOXGET_32(isp, &src->ctp_dataseg[i].ds_base, dst->ctp_dataseg[i].ds_base); 1684 ISP_IOXGET_32(isp, &src->ctp_dataseg[i].ds_basehi, dst->ctp_dataseg[i].ds_basehi); 1685 ISP_IOXGET_32(isp, &src->ctp_dataseg[i].ds_count, dst->ctp_dataseg[i].ds_count); 1686 } 1687 } 1688 1689 void 1690 isp_get_ms(ispsoftc_t *isp, isp_ms_t *src, isp_ms_t *dst) 1691 { 1692 int i; 1693 1694 isp_get_hdr(isp, &src->ms_header, &dst->ms_header); 1695 ISP_IOXGET_32(isp, &src->ms_handle, dst->ms_handle); 1696 ISP_IOXGET_16(isp, &src->ms_nphdl, dst->ms_nphdl); 1697 ISP_IOXGET_16(isp, &src->ms_status, dst->ms_status); 1698 ISP_IOXGET_16(isp, &src->ms_flags, dst->ms_flags); 1699 ISP_IOXGET_16(isp, &src->ms_reserved1, dst->ms_reserved1); 1700 ISP_IOXGET_16(isp, &src->ms_time, dst->ms_time); 1701 ISP_IOXGET_16(isp, &src->ms_cmd_cnt, dst->ms_cmd_cnt); 1702 ISP_IOXGET_16(isp, &src->ms_tot_cnt, dst->ms_tot_cnt); 1703 ISP_IOXGET_8(isp, &src->ms_type, dst->ms_type); 1704 ISP_IOXGET_8(isp, &src->ms_r_ctl, dst->ms_r_ctl); 1705 ISP_IOXGET_16(isp, &src->ms_rxid, dst->ms_rxid); 1706 ISP_IOXGET_16(isp, &src->ms_reserved2, dst->ms_reserved2); 1707 ISP_IOXGET_32(isp, &src->ms_rsp_bcnt, dst->ms_rsp_bcnt); 1708 ISP_IOXGET_32(isp, &src->ms_cmd_bcnt, dst->ms_cmd_bcnt); 1709 for (i = 0; i < 2; i++) { 1710 ISP_IOXGET_32(isp, &src->ms_dataseg[i].ds_base, dst->ms_dataseg[i].ds_base); 1711 ISP_IOXGET_32(isp, &src->ms_dataseg[i].ds_basehi, dst->ms_dataseg[i].ds_basehi); 1712 ISP_IOXGET_32(isp, &src->ms_dataseg[i].ds_count, dst->ms_dataseg[i].ds_count); 1713 } 1714 } 1715 1716 void 1717 isp_put_ct_pt(ispsoftc_t *isp, isp_ct_pt_t *src, isp_ct_pt_t *dst) 1718 { 1719 int i; 1720 1721 isp_put_hdr(isp, &src->ctp_header, &dst->ctp_header); 1722 ISP_IOXPUT_32(isp, src->ctp_handle, &dst->ctp_handle); 1723 ISP_IOXPUT_16(isp, src->ctp_status, &dst->ctp_status); 1724 ISP_IOXPUT_16(isp, src->ctp_nphdl, &dst->ctp_nphdl); 1725 ISP_IOXPUT_16(isp, src->ctp_cmd_cnt, &dst->ctp_cmd_cnt); 1726 ISP_IOXPUT_8(isp, src->ctp_vpidx, &dst->ctp_vpidx); 1727 ISP_IOXPUT_8(isp, src->ctp_reserved0, &dst->ctp_reserved0); 1728 ISP_IOXPUT_16(isp, src->ctp_time, &dst->ctp_time); 1729 ISP_IOXPUT_16(isp, src->ctp_reserved1, &dst->ctp_reserved1); 1730 ISP_IOXPUT_16(isp, src->ctp_rsp_cnt, &dst->ctp_rsp_cnt); 1731 for (i = 0; i < 5; i++) { 1732 ISP_IOXPUT_16(isp, src->ctp_reserved2[i], &dst->ctp_reserved2[i]); 1733 } 1734 ISP_IOXPUT_32(isp, src->ctp_rsp_bcnt, &dst->ctp_rsp_bcnt); 1735 ISP_IOXPUT_32(isp, src->ctp_cmd_bcnt, &dst->ctp_cmd_bcnt); 1736 for (i = 0; i < 2; i++) { 1737 ISP_IOXPUT_32(isp, src->ctp_dataseg[i].ds_base, &dst->ctp_dataseg[i].ds_base); 1738 ISP_IOXPUT_32(isp, src->ctp_dataseg[i].ds_basehi, &dst->ctp_dataseg[i].ds_basehi); 1739 ISP_IOXPUT_32(isp, src->ctp_dataseg[i].ds_count, &dst->ctp_dataseg[i].ds_count); 1740 } 1741 } 1742 1743 void 1744 isp_put_ms(ispsoftc_t *isp, isp_ms_t *src, isp_ms_t *dst) 1745 { 1746 int i; 1747 1748 isp_put_hdr(isp, &src->ms_header, &dst->ms_header); 1749 ISP_IOXPUT_32(isp, src->ms_handle, &dst->ms_handle); 1750 ISP_IOXPUT_16(isp, src->ms_nphdl, &dst->ms_nphdl); 1751 ISP_IOXPUT_16(isp, src->ms_status, &dst->ms_status); 1752 ISP_IOXPUT_16(isp, src->ms_flags, &dst->ms_flags); 1753 ISP_IOXPUT_16(isp, src->ms_reserved1, &dst->ms_reserved1); 1754 ISP_IOXPUT_16(isp, src->ms_time, &dst->ms_time); 1755 ISP_IOXPUT_16(isp, src->ms_cmd_cnt, &dst->ms_cmd_cnt); 1756 ISP_IOXPUT_16(isp, src->ms_tot_cnt, &dst->ms_tot_cnt); 1757 ISP_IOXPUT_8(isp, src->ms_type, &dst->ms_type); 1758 ISP_IOXPUT_8(isp, src->ms_r_ctl, &dst->ms_r_ctl); 1759 ISP_IOXPUT_16(isp, src->ms_rxid, &dst->ms_rxid); 1760 ISP_IOXPUT_16(isp, src->ms_reserved2, &dst->ms_reserved2); 1761 ISP_IOXPUT_32(isp, src->ms_rsp_bcnt, &dst->ms_rsp_bcnt); 1762 ISP_IOXPUT_32(isp, src->ms_cmd_bcnt, &dst->ms_cmd_bcnt); 1763 for (i = 0; i < 2; i++) { 1764 ISP_IOXPUT_32(isp, src->ms_dataseg[i].ds_base, &dst->ms_dataseg[i].ds_base); 1765 ISP_IOXPUT_32(isp, src->ms_dataseg[i].ds_basehi, &dst->ms_dataseg[i].ds_basehi); 1766 ISP_IOXPUT_32(isp, src->ms_dataseg[i].ds_count, &dst->ms_dataseg[i].ds_count); 1767 } 1768 } 1769 1770 /* 1771 * Generic SNS request - not particularly useful since the per-command data 1772 * isn't always 16 bit words. 1773 */ 1774 void 1775 isp_put_sns_request(ispsoftc_t *isp, sns_screq_t *src, sns_screq_t *dst) 1776 { 1777 int i, nw = (int) src->snscb_sblen; 1778 ISP_IOXPUT_16(isp, src->snscb_rblen, &dst->snscb_rblen); 1779 for (i = 0; i < 4; i++) { 1780 ISP_IOXPUT_16(isp, src->snscb_addr[i], &dst->snscb_addr[i]); 1781 } 1782 ISP_IOXPUT_16(isp, src->snscb_sblen, &dst->snscb_sblen); 1783 for (i = 0; i < nw; i++) { 1784 ISP_IOXPUT_16(isp, src->snscb_data[i], &dst->snscb_data[i]); 1785 } 1786 } 1787 1788 void 1789 isp_put_gid_ft_request(ispsoftc_t *isp, sns_gid_ft_req_t *src, sns_gid_ft_req_t *dst) 1790 { 1791 ISP_IOXPUT_16(isp, src->snscb_rblen, &dst->snscb_rblen); 1792 ISP_IOXPUT_16(isp, src->snscb_reserved0, &dst->snscb_reserved0); 1793 ISP_IOXPUT_16(isp, src->snscb_addr[0], &dst->snscb_addr[0]); 1794 ISP_IOXPUT_16(isp, src->snscb_addr[1], &dst->snscb_addr[1]); 1795 ISP_IOXPUT_16(isp, src->snscb_addr[2], &dst->snscb_addr[2]); 1796 ISP_IOXPUT_16(isp, src->snscb_addr[3], &dst->snscb_addr[3]); 1797 ISP_IOXPUT_16(isp, src->snscb_sblen, &dst->snscb_sblen); 1798 ISP_IOXPUT_16(isp, src->snscb_reserved1, &dst->snscb_reserved1); 1799 ISP_IOXPUT_16(isp, src->snscb_cmd, &dst->snscb_cmd); 1800 ISP_IOXPUT_16(isp, src->snscb_mword_div_2, &dst->snscb_mword_div_2); 1801 ISP_IOXPUT_32(isp, src->snscb_reserved3, &dst->snscb_reserved3); 1802 ISP_IOXPUT_32(isp, src->snscb_fc4_type, &dst->snscb_fc4_type); 1803 } 1804 1805 void 1806 isp_put_gxn_id_request(ispsoftc_t *isp, sns_gxn_id_req_t *src, sns_gxn_id_req_t *dst) 1807 { 1808 ISP_IOXPUT_16(isp, src->snscb_rblen, &dst->snscb_rblen); 1809 ISP_IOXPUT_16(isp, src->snscb_reserved0, &dst->snscb_reserved0); 1810 ISP_IOXPUT_16(isp, src->snscb_addr[0], &dst->snscb_addr[0]); 1811 ISP_IOXPUT_16(isp, src->snscb_addr[1], &dst->snscb_addr[1]); 1812 ISP_IOXPUT_16(isp, src->snscb_addr[2], &dst->snscb_addr[2]); 1813 ISP_IOXPUT_16(isp, src->snscb_addr[3], &dst->snscb_addr[3]); 1814 ISP_IOXPUT_16(isp, src->snscb_sblen, &dst->snscb_sblen); 1815 ISP_IOXPUT_16(isp, src->snscb_reserved1, &dst->snscb_reserved1); 1816 ISP_IOXPUT_16(isp, src->snscb_cmd, &dst->snscb_cmd); 1817 ISP_IOXPUT_16(isp, src->snscb_reserved2, &dst->snscb_reserved2); 1818 ISP_IOXPUT_32(isp, src->snscb_reserved3, &dst->snscb_reserved3); 1819 ISP_IOXPUT_32(isp, src->snscb_portid, &dst->snscb_portid); 1820 } 1821 1822 /* 1823 * Generic SNS response - not particularly useful since the per-command data 1824 * isn't always 16 bit words. 1825 */ 1826 void 1827 isp_get_sns_response(ispsoftc_t *isp, sns_scrsp_t *src, sns_scrsp_t *dst, int nwords) 1828 { 1829 int i; 1830 isp_get_ct_hdr(isp, &src->snscb_cthdr, &dst->snscb_cthdr); 1831 ISP_IOXGET_8(isp, &src->snscb_port_type, dst->snscb_port_type); 1832 for (i = 0; i < 3; i++) { 1833 ISP_IOXGET_8(isp, &src->snscb_port_id[i], 1834 dst->snscb_port_id[i]); 1835 } 1836 for (i = 0; i < 8; i++) { 1837 ISP_IOXGET_8(isp, &src->snscb_portname[i], 1838 dst->snscb_portname[i]); 1839 } 1840 for (i = 0; i < nwords; i++) { 1841 ISP_IOXGET_16(isp, &src->snscb_data[i], dst->snscb_data[i]); 1842 } 1843 } 1844 1845 void 1846 isp_get_gid_ft_response(ispsoftc_t *isp, sns_gid_ft_rsp_t *src, sns_gid_ft_rsp_t *dst, int nwords) 1847 { 1848 int i; 1849 isp_get_ct_hdr(isp, &src->snscb_cthdr, &dst->snscb_cthdr); 1850 for (i = 0; i < nwords; i++) { 1851 int j; 1852 ISP_IOXGET_8(isp, &src->snscb_ports[i].control, dst->snscb_ports[i].control); 1853 for (j = 0; j < 3; j++) { 1854 ISP_IOXGET_8(isp, &src->snscb_ports[i].portid[j], dst->snscb_ports[i].portid[j]); 1855 } 1856 if (dst->snscb_ports[i].control & 0x80) { 1857 break; 1858 } 1859 } 1860 } 1861 1862 void 1863 isp_get_gxn_id_response(ispsoftc_t *isp, sns_gxn_id_rsp_t *src, sns_gxn_id_rsp_t *dst) 1864 { 1865 int i; 1866 isp_get_ct_hdr(isp, &src->snscb_cthdr, &dst->snscb_cthdr); 1867 for (i = 0; i < 8; i++) { 1868 ISP_IOXGET_8(isp, &src->snscb_wwn[i], dst->snscb_wwn[i]); 1869 } 1870 } 1871 1872 void 1873 isp_get_gff_id_response(ispsoftc_t *isp, sns_gff_id_rsp_t *src, sns_gff_id_rsp_t *dst) 1874 { 1875 int i; 1876 isp_get_ct_hdr(isp, &src->snscb_cthdr, &dst->snscb_cthdr); 1877 for (i = 0; i < 32; i++) { 1878 ISP_IOXGET_32(isp, &src->snscb_fc4_features[i], dst->snscb_fc4_features[i]); 1879 } 1880 } 1881 1882 void 1883 isp_get_ga_nxt_response(ispsoftc_t *isp, sns_ga_nxt_rsp_t *src, sns_ga_nxt_rsp_t *dst) 1884 { 1885 int i; 1886 isp_get_ct_hdr(isp, &src->snscb_cthdr, &dst->snscb_cthdr); 1887 ISP_IOXGET_8(isp, &src->snscb_port_type, dst->snscb_port_type); 1888 for (i = 0; i < 3; i++) { 1889 ISP_IOXGET_8(isp, &src->snscb_port_id[i], dst->snscb_port_id[i]); 1890 } 1891 for (i = 0; i < 8; i++) { 1892 ISP_IOXGET_8(isp, &src->snscb_portname[i], dst->snscb_portname[i]); 1893 } 1894 ISP_IOXGET_8(isp, &src->snscb_pnlen, dst->snscb_pnlen); 1895 for (i = 0; i < 255; i++) { 1896 ISP_IOXGET_8(isp, &src->snscb_pname[i], dst->snscb_pname[i]); 1897 } 1898 for (i = 0; i < 8; i++) { 1899 ISP_IOXGET_8(isp, &src->snscb_nodename[i], dst->snscb_nodename[i]); 1900 } 1901 ISP_IOXGET_8(isp, &src->snscb_nnlen, dst->snscb_nnlen); 1902 for (i = 0; i < 255; i++) { 1903 ISP_IOXGET_8(isp, &src->snscb_nname[i], dst->snscb_nname[i]); 1904 } 1905 for (i = 0; i < 8; i++) { 1906 ISP_IOXGET_8(isp, &src->snscb_ipassoc[i], dst->snscb_ipassoc[i]); 1907 } 1908 for (i = 0; i < 16; i++) { 1909 ISP_IOXGET_8(isp, &src->snscb_ipaddr[i], dst->snscb_ipaddr[i]); 1910 } 1911 for (i = 0; i < 4; i++) { 1912 ISP_IOXGET_8(isp, &src->snscb_svc_class[i], dst->snscb_svc_class[i]); 1913 } 1914 for (i = 0; i < 32; i++) { 1915 ISP_IOXGET_8(isp, &src->snscb_fc4_types[i], dst->snscb_fc4_types[i]); 1916 } 1917 for (i = 0; i < 8; i++) { 1918 ISP_IOXGET_8(isp, &src->snscb_fpname[i], dst->snscb_fpname[i]); 1919 } 1920 ISP_IOXGET_8(isp, &src->snscb_reserved, dst->snscb_reserved); 1921 for (i = 0; i < 3; i++) { 1922 ISP_IOXGET_8(isp, &src->snscb_hardaddr[i], dst->snscb_hardaddr[i]); 1923 } 1924 } 1925 1926 void 1927 isp_get_els(ispsoftc_t *isp, els_t *src, els_t *dst) 1928 { 1929 int i; 1930 1931 isp_get_hdr(isp, &src->els_hdr, &dst->els_hdr); 1932 ISP_IOXGET_32(isp, &src->els_handle, dst->els_handle); 1933 ISP_IOXGET_16(isp, &src->els_status, dst->els_status); 1934 ISP_IOXGET_16(isp, &src->els_nphdl, dst->els_nphdl); 1935 ISP_IOXGET_16(isp, &src->els_xmit_dsd_count, dst->els_xmit_dsd_count); 1936 ISP_IOXGET_8(isp, &src->els_vphdl, dst->els_vphdl); 1937 ISP_IOXGET_8(isp, &src->els_sof, dst->els_sof); 1938 ISP_IOXGET_32(isp, &src->els_rxid, dst->els_rxid); 1939 ISP_IOXGET_16(isp, &src->els_recv_dsd_count, dst->els_recv_dsd_count); 1940 ISP_IOXGET_8(isp, &src->els_opcode, dst->els_opcode); 1941 ISP_IOXGET_8(isp, &src->els_reserved2, dst->els_reserved1); 1942 ISP_IOXGET_8(isp, &src->els_did_lo, dst->els_did_lo); 1943 ISP_IOXGET_8(isp, &src->els_did_mid, dst->els_did_mid); 1944 ISP_IOXGET_8(isp, &src->els_did_hi, dst->els_did_hi); 1945 ISP_IOXGET_8(isp, &src->els_reserved2, dst->els_reserved2); 1946 ISP_IOXGET_16(isp, &src->els_reserved3, dst->els_reserved3); 1947 ISP_IOXGET_16(isp, &src->els_ctl_flags, dst->els_ctl_flags); 1948 ISP_IOXGET_32(isp, &src->els_bytecnt, dst->els_bytecnt); 1949 ISP_IOXGET_32(isp, &src->els_subcode1, dst->els_subcode1); 1950 ISP_IOXGET_32(isp, &src->els_subcode2, dst->els_subcode2); 1951 for (i = 0; i < 20; i++) { 1952 ISP_IOXGET_8(isp, &src->els_reserved4[i], dst->els_reserved4[i]); 1953 } 1954 } 1955 1956 void 1957 isp_put_els(ispsoftc_t *isp, els_t *src, els_t *dst) 1958 { 1959 isp_put_hdr(isp, &src->els_hdr, &dst->els_hdr); 1960 ISP_IOXPUT_32(isp, src->els_handle, &dst->els_handle); 1961 ISP_IOXPUT_16(isp, src->els_status, &dst->els_status); 1962 ISP_IOXPUT_16(isp, src->els_nphdl, &dst->els_nphdl); 1963 ISP_IOXPUT_16(isp, src->els_xmit_dsd_count, &dst->els_xmit_dsd_count); 1964 ISP_IOXPUT_8(isp, src->els_vphdl, &dst->els_vphdl); 1965 ISP_IOXPUT_8(isp, src->els_sof, &dst->els_sof); 1966 ISP_IOXPUT_32(isp, src->els_rxid, &dst->els_rxid); 1967 ISP_IOXPUT_16(isp, src->els_recv_dsd_count, &dst->els_recv_dsd_count); 1968 ISP_IOXPUT_8(isp, src->els_opcode, &dst->els_opcode); 1969 ISP_IOXPUT_8(isp, src->els_reserved2, &dst->els_reserved1); 1970 ISP_IOXPUT_8(isp, src->els_did_lo, &dst->els_did_lo); 1971 ISP_IOXPUT_8(isp, src->els_did_mid, &dst->els_did_mid); 1972 ISP_IOXPUT_8(isp, src->els_did_hi, &dst->els_did_hi); 1973 ISP_IOXPUT_8(isp, src->els_reserved2, &dst->els_reserved2); 1974 ISP_IOXPUT_16(isp, src->els_reserved3, &dst->els_reserved3); 1975 ISP_IOXPUT_16(isp, src->els_ctl_flags, &dst->els_ctl_flags); 1976 ISP_IOXPUT_32(isp, src->els_recv_bytecnt, &dst->els_recv_bytecnt); 1977 ISP_IOXPUT_32(isp, src->els_xmit_bytecnt, &dst->els_xmit_bytecnt); 1978 ISP_IOXPUT_32(isp, src->els_xmit_dsd_length, &dst->els_xmit_dsd_length); 1979 ISP_IOXPUT_16(isp, src->els_xmit_dsd_a1500, &dst->els_xmit_dsd_a1500); 1980 ISP_IOXPUT_16(isp, src->els_xmit_dsd_a3116, &dst->els_xmit_dsd_a3116); 1981 ISP_IOXPUT_16(isp, src->els_xmit_dsd_a4732, &dst->els_xmit_dsd_a4732); 1982 ISP_IOXPUT_16(isp, src->els_xmit_dsd_a6348, &dst->els_xmit_dsd_a6348); 1983 ISP_IOXPUT_32(isp, src->els_recv_dsd_length, &dst->els_recv_dsd_length); 1984 ISP_IOXPUT_16(isp, src->els_recv_dsd_a1500, &dst->els_recv_dsd_a1500); 1985 ISP_IOXPUT_16(isp, src->els_recv_dsd_a3116, &dst->els_recv_dsd_a3116); 1986 ISP_IOXPUT_16(isp, src->els_recv_dsd_a4732, &dst->els_recv_dsd_a4732); 1987 ISP_IOXPUT_16(isp, src->els_recv_dsd_a6348, &dst->els_recv_dsd_a6348); 1988 } 1989 1990 /* 1991 * FC Structure Canonicalization 1992 */ 1993 1994 void 1995 isp_get_fc_hdr(ispsoftc_t *isp, fc_hdr_t *src, fc_hdr_t *dst) 1996 { 1997 ISP_IOZGET_8(isp, &src->r_ctl, dst->r_ctl); 1998 ISP_IOZGET_8(isp, &src->d_id[0], dst->d_id[0]); 1999 ISP_IOZGET_8(isp, &src->d_id[1], dst->d_id[1]); 2000 ISP_IOZGET_8(isp, &src->d_id[2], dst->d_id[2]); 2001 ISP_IOZGET_8(isp, &src->cs_ctl, dst->cs_ctl); 2002 ISP_IOZGET_8(isp, &src->s_id[0], dst->s_id[0]); 2003 ISP_IOZGET_8(isp, &src->s_id[1], dst->s_id[1]); 2004 ISP_IOZGET_8(isp, &src->s_id[2], dst->s_id[2]); 2005 ISP_IOZGET_8(isp, &src->type, dst->type); 2006 ISP_IOZGET_8(isp, &src->f_ctl[0], dst->f_ctl[0]); 2007 ISP_IOZGET_8(isp, &src->f_ctl[1], dst->f_ctl[1]); 2008 ISP_IOZGET_8(isp, &src->f_ctl[2], dst->f_ctl[2]); 2009 ISP_IOZGET_8(isp, &src->seq_id, dst->seq_id); 2010 ISP_IOZGET_8(isp, &src->df_ctl, dst->df_ctl); 2011 ISP_IOZGET_16(isp, &src->seq_cnt, dst->seq_cnt); 2012 ISP_IOZGET_16(isp, &src->ox_id, dst->ox_id); 2013 ISP_IOZGET_16(isp, &src->rx_id, dst->rx_id); 2014 ISP_IOZGET_32(isp, &src->parameter, dst->parameter); 2015 } 2016 2017 void 2018 isp_put_fc_hdr(ispsoftc_t *isp, fc_hdr_t *src, fc_hdr_t *dst) 2019 { 2020 ISP_IOZPUT_8(isp, src->r_ctl, &dst->r_ctl); 2021 ISP_IOZPUT_8(isp, src->d_id[0], &dst->d_id[0]); 2022 ISP_IOZPUT_8(isp, src->d_id[1], &dst->d_id[1]); 2023 ISP_IOZPUT_8(isp, src->d_id[2], &dst->d_id[2]); 2024 ISP_IOZPUT_8(isp, src->cs_ctl, &dst->cs_ctl); 2025 ISP_IOZPUT_8(isp, src->s_id[0], &dst->s_id[0]); 2026 ISP_IOZPUT_8(isp, src->s_id[1], &dst->s_id[1]); 2027 ISP_IOZPUT_8(isp, src->s_id[2], &dst->s_id[2]); 2028 ISP_IOZPUT_8(isp, src->type, &dst->type); 2029 ISP_IOZPUT_8(isp, src->f_ctl[0], &dst->f_ctl[0]); 2030 ISP_IOZPUT_8(isp, src->f_ctl[1], &dst->f_ctl[1]); 2031 ISP_IOZPUT_8(isp, src->f_ctl[2], &dst->f_ctl[2]); 2032 ISP_IOZPUT_8(isp, src->seq_id, &dst->seq_id); 2033 ISP_IOZPUT_8(isp, src->df_ctl, &dst->df_ctl); 2034 ISP_IOZPUT_16(isp, src->seq_cnt, &dst->seq_cnt); 2035 ISP_IOZPUT_16(isp, src->ox_id, &dst->ox_id); 2036 ISP_IOZPUT_16(isp, src->rx_id, &dst->rx_id); 2037 ISP_IOZPUT_32(isp, src->parameter, &dst->parameter); 2038 } 2039 2040 void 2041 isp_get_fcp_cmnd_iu(ispsoftc_t *isp, fcp_cmnd_iu_t *src, fcp_cmnd_iu_t *dst) 2042 { 2043 int i; 2044 2045 for (i = 0; i < 8; i++) { 2046 ISP_IOZGET_8(isp, &src->fcp_cmnd_lun[i], dst->fcp_cmnd_lun[i]); 2047 } 2048 ISP_IOZGET_8(isp, &src->fcp_cmnd_crn, dst->fcp_cmnd_crn); 2049 ISP_IOZGET_8(isp, &src->fcp_cmnd_task_attribute, dst->fcp_cmnd_task_attribute); 2050 ISP_IOZGET_8(isp, &src->fcp_cmnd_task_management, dst->fcp_cmnd_task_management); 2051 ISP_IOZGET_8(isp, &src->fcp_cmnd_alen_datadir, dst->fcp_cmnd_alen_datadir); 2052 for (i = 0; i < 16; i++) { 2053 ISP_IOZGET_8(isp, &src->cdb_dl.sf.fcp_cmnd_cdb[i], dst->cdb_dl.sf.fcp_cmnd_cdb[i]); 2054 } 2055 ISP_IOZGET_32(isp, &src->cdb_dl.sf.fcp_cmnd_dl, dst->cdb_dl.sf.fcp_cmnd_dl); 2056 } 2057 2058 void 2059 isp_put_rft_id(ispsoftc_t *isp, rft_id_t *src, rft_id_t *dst) 2060 { 2061 int i; 2062 isp_put_ct_hdr(isp, &src->rftid_hdr, &dst->rftid_hdr); 2063 ISP_IOZPUT_8(isp, src->rftid_reserved, &dst->rftid_reserved); 2064 for (i = 0; i < 3; i++) { 2065 ISP_IOZPUT_8(isp, src->rftid_portid[i], &dst->rftid_portid[i]); 2066 } 2067 for (i = 0; i < 8; i++) { 2068 ISP_IOZPUT_32(isp, src->rftid_fc4types[i], &dst->rftid_fc4types[i]); 2069 } 2070 } 2071 2072 void 2073 isp_get_ct_hdr(ispsoftc_t *isp, ct_hdr_t *src, ct_hdr_t *dst) 2074 { 2075 ISP_IOZGET_8(isp, &src->ct_revision, dst->ct_revision); 2076 ISP_IOZGET_8(isp, &src->ct_in_id[0], dst->ct_in_id[0]); 2077 ISP_IOZGET_8(isp, &src->ct_in_id[1], dst->ct_in_id[1]); 2078 ISP_IOZGET_8(isp, &src->ct_in_id[2], dst->ct_in_id[2]); 2079 ISP_IOZGET_8(isp, &src->ct_fcs_type, dst->ct_fcs_type); 2080 ISP_IOZGET_8(isp, &src->ct_fcs_subtype, dst->ct_fcs_subtype); 2081 ISP_IOZGET_8(isp, &src->ct_options, dst->ct_options); 2082 ISP_IOZGET_8(isp, &src->ct_reserved0, dst->ct_reserved0); 2083 ISP_IOZGET_16(isp, &src->ct_cmd_resp, dst->ct_cmd_resp); 2084 ISP_IOZGET_16(isp, &src->ct_bcnt_resid, dst->ct_bcnt_resid); 2085 ISP_IOZGET_8(isp, &src->ct_reserved1, dst->ct_reserved1); 2086 ISP_IOZGET_8(isp, &src->ct_reason, dst->ct_reason); 2087 ISP_IOZGET_8(isp, &src->ct_explanation, dst->ct_explanation); 2088 ISP_IOZGET_8(isp, &src->ct_vunique, dst->ct_vunique); 2089 } 2090 2091 void 2092 isp_put_ct_hdr(ispsoftc_t *isp, ct_hdr_t *src, ct_hdr_t *dst) 2093 { 2094 ISP_IOZPUT_8(isp, src->ct_revision, &dst->ct_revision); 2095 ISP_IOZPUT_8(isp, src->ct_in_id[0], &dst->ct_in_id[0]); 2096 ISP_IOZPUT_8(isp, src->ct_in_id[1], &dst->ct_in_id[1]); 2097 ISP_IOZPUT_8(isp, src->ct_in_id[2], &dst->ct_in_id[2]); 2098 ISP_IOZPUT_8(isp, src->ct_fcs_type, &dst->ct_fcs_type); 2099 ISP_IOZPUT_8(isp, src->ct_fcs_subtype, &dst->ct_fcs_subtype); 2100 ISP_IOZPUT_8(isp, src->ct_options, &dst->ct_options); 2101 ISP_IOZPUT_8(isp, src->ct_reserved0, &dst->ct_reserved0); 2102 ISP_IOZPUT_16(isp, src->ct_cmd_resp, &dst->ct_cmd_resp); 2103 ISP_IOZPUT_16(isp, src->ct_bcnt_resid, &dst->ct_bcnt_resid); 2104 ISP_IOZPUT_8(isp, src->ct_reserved1, &dst->ct_reserved1); 2105 ISP_IOZPUT_8(isp, src->ct_reason, &dst->ct_reason); 2106 ISP_IOZPUT_8(isp, src->ct_explanation, &dst->ct_explanation); 2107 ISP_IOZPUT_8(isp, src->ct_vunique, &dst->ct_vunique); 2108 } 2109 2110 void 2111 isp_put_fcp_rsp_iu(ispsoftc_t *isp, fcp_rsp_iu_t *src, fcp_rsp_iu_t *dst) 2112 { 2113 int i; 2114 for (i = 0; i < ((sizeof (src->fcp_rsp_reserved))/(sizeof (src->fcp_rsp_reserved[0]))); i++) { 2115 ISP_IOZPUT_8(isp, src->fcp_rsp_reserved[i], &dst->fcp_rsp_reserved[i]); 2116 } 2117 ISP_IOZPUT_16(isp, src->fcp_rsp_status_qualifier, &dst->fcp_rsp_status_qualifier); 2118 ISP_IOZPUT_8(isp, src->fcp_rsp_bits, &dst->fcp_rsp_bits); 2119 ISP_IOZPUT_8(isp, src->fcp_rsp_scsi_status, &dst->fcp_rsp_scsi_status); 2120 ISP_IOZPUT_32(isp, src->fcp_rsp_resid, &dst->fcp_rsp_resid); 2121 ISP_IOZPUT_32(isp, src->fcp_rsp_snslen, &dst->fcp_rsp_snslen); 2122 ISP_IOZPUT_32(isp, src->fcp_rsp_rsplen, &dst->fcp_rsp_rsplen); 2123 } 2124 2125 #ifdef ISP_TARGET_MODE 2126 2127 /* 2128 * Command shipping- finish off first queue entry and do dma mapping and 2129 * additional segments as needed. 2130 * 2131 * Called with the first queue entry mostly filled out. 2132 * Our job here is to finish that and add additional data 2133 * segments if needed. 2134 * 2135 * We used to do synthetic entries to split data and status 2136 * at this level, but that started getting too tricky. 2137 */ 2138 int 2139 isp_send_tgt_cmd(ispsoftc_t *isp, void *fqe, void *segp, uint32_t nsegs, uint32_t totalcnt, isp_ddir_t ddir, void *snsptr, uint32_t snslen) 2140 { 2141 uint8_t storage[QENTRY_LEN]; 2142 uint8_t type, nqe; 2143 uint32_t seg, curseg, seglim, nxt, nxtnxt; 2144 ispds_t *dsp = NULL; 2145 ispds64_t *dsp64 = NULL; 2146 void *qe0, *qe1; 2147 2148 qe0 = isp_getrqentry(isp); 2149 if (qe0 == NULL) { 2150 return (CMD_EAGAIN); 2151 } 2152 nxt = ISP_NXT_QENTRY(isp->isp_reqidx, RQUEST_QUEUE_LEN(isp)); 2153 2154 type = ((isphdr_t *)fqe)->rqs_entry_type; 2155 nqe = 1; 2156 seglim = 0; 2157 2158 /* 2159 * If we have data to transmit, figure out how many segments can fit into the first entry. 2160 */ 2161 if (ddir != ISP_NOXFR) { 2162 /* 2163 * First, figure out how many pieces of data to transfer and what kind and how many we can put into the first queue entry. 2164 */ 2165 switch (type) { 2166 case RQSTYPE_CTIO: 2167 dsp = ((ct_entry_t *)fqe)->ct_dataseg; 2168 seglim = ISP_RQDSEG; 2169 break; 2170 case RQSTYPE_CTIO2: 2171 dsp = ((ct2_entry_t *)fqe)->rsp.m0.u.ct_dataseg; 2172 seglim = ISP_RQDSEG_T2; 2173 break; 2174 case RQSTYPE_CTIO3: 2175 dsp64 = ((ct2_entry_t *)fqe)->rsp.m0.u.ct_dataseg64; 2176 seglim = ISP_RQDSEG_T3; 2177 break; 2178 case RQSTYPE_CTIO7: 2179 dsp64 = &((ct7_entry_t *)fqe)->rsp.m0.ds; 2180 seglim = 1; 2181 break; 2182 default: 2183 return (CMD_COMPLETE); 2184 } 2185 } 2186 2187 /* 2188 * First, fill out any of the data transfer stuff that fits 2189 * in the first queue entry. 2190 */ 2191 if (seglim > nsegs) { 2192 seglim = nsegs; 2193 } 2194 2195 for (seg = curseg = 0; curseg < seglim; curseg++) { 2196 if (dsp64) { 2197 XS_GET_DMA64_SEG(dsp64++, segp, seg++); 2198 } else { 2199 XS_GET_DMA_SEG(dsp++, segp, seg++); 2200 } 2201 } 2202 2203 /* 2204 * Second, start building additional continuation segments as needed. 2205 */ 2206 while (seg < nsegs) { 2207 nxtnxt = ISP_NXT_QENTRY(nxt, RQUEST_QUEUE_LEN(isp)); 2208 if (nxtnxt == isp->isp_reqodx) { 2209 return (CMD_EAGAIN); 2210 } 2211 ISP_MEMZERO(storage, QENTRY_LEN); 2212 qe1 = ISP_QUEUE_ENTRY(isp->isp_rquest, nxt); 2213 nxt = nxtnxt; 2214 if (dsp64) { 2215 ispcontreq64_t *crq = (ispcontreq64_t *) storage; 2216 seglim = ISP_CDSEG64; 2217 crq->req_header.rqs_entry_type = RQSTYPE_A64_CONT; 2218 crq->req_header.rqs_entry_count = 1; 2219 dsp64 = crq->req_dataseg; 2220 } else { 2221 ispcontreq_t *crq = (ispcontreq_t *) storage; 2222 seglim = ISP_CDSEG; 2223 crq->req_header.rqs_entry_type = RQSTYPE_DATASEG; 2224 crq->req_header.rqs_entry_count = 1; 2225 dsp = crq->req_dataseg; 2226 } 2227 if (seg + seglim > nsegs) { 2228 seglim = nsegs - seg; 2229 } 2230 for (curseg = 0; curseg < seglim; curseg++) { 2231 if (dsp64) { 2232 XS_GET_DMA64_SEG(dsp64++, segp, seg++); 2233 } else { 2234 XS_GET_DMA_SEG(dsp++, segp, seg++); 2235 } 2236 } 2237 if (dsp64) { 2238 isp_put_cont64_req(isp, (ispcontreq64_t *)storage, qe1); 2239 } else { 2240 isp_put_cont_req(isp, (ispcontreq_t *)storage, qe1); 2241 } 2242 if (isp->isp_dblev & ISP_LOGTDEBUG1) { 2243 isp_print_bytes(isp, "additional queue entry", QENTRY_LEN, storage); 2244 } 2245 nqe++; 2246 } 2247 2248 /* 2249 * Third, not patch up the first queue entry with the number of segments 2250 * we actually are going to be transmitting. At the same time, handle 2251 * any mode 2 requests. 2252 */ 2253 ((isphdr_t *)fqe)->rqs_entry_count = nqe; 2254 switch (type) { 2255 case RQSTYPE_CTIO: 2256 ((ct_entry_t *)fqe)->ct_seg_count = nsegs; 2257 isp_put_ctio(isp, fqe, qe0); 2258 break; 2259 case RQSTYPE_CTIO2: 2260 case RQSTYPE_CTIO3: 2261 if (((ct2_entry_t *)fqe)->ct_flags & CT2_FLAG_MODE2) { 2262 ((ct2_entry_t *)fqe)->ct_seg_count = 1; 2263 } else { 2264 ((ct2_entry_t *)fqe)->ct_seg_count = nsegs; 2265 } 2266 if (ISP_CAP_2KLOGIN(isp)) { 2267 isp_put_ctio2e(isp, fqe, qe0); 2268 } else { 2269 isp_put_ctio2(isp, fqe, qe0); 2270 } 2271 break; 2272 case RQSTYPE_CTIO7: 2273 if (((ct7_entry_t *)fqe)->ct_flags & CT7_FLAG_MODE2) { 2274 ((ct7_entry_t *)fqe)->ct_seg_count = 1; 2275 } else { 2276 ((ct7_entry_t *)fqe)->ct_seg_count = nsegs; 2277 } 2278 isp_put_ctio7(isp, fqe, qe0); 2279 break; 2280 default: 2281 return (CMD_COMPLETE); 2282 } 2283 if (isp->isp_dblev & ISP_LOGTDEBUG1) { 2284 isp_print_bytes(isp, "first queue entry", QENTRY_LEN, fqe); 2285 } 2286 ISP_ADD_REQUEST(isp, nxt); 2287 return (CMD_QUEUED); 2288 } 2289 2290 int 2291 isp_allocate_xs_tgt(ispsoftc_t *isp, void *xs, uint32_t *handlep) 2292 { 2293 isp_hdl_t *hdp; 2294 2295 hdp = isp->isp_tgtfree; 2296 if (hdp == NULL) { 2297 return (-1); 2298 } 2299 isp->isp_tgtfree = hdp->cmd; 2300 hdp->cmd = xs; 2301 hdp->handle = (hdp - isp->isp_tgtlist); 2302 hdp->handle |= (ISP_HANDLE_TARGET << ISP_HANDLE_USAGE_SHIFT); 2303 /* 2304 * Target handles for SCSI cards are only 16 bits, so 2305 * sequence number protection will be ommitted. 2306 */ 2307 if (IS_FC(isp)) { 2308 hdp->handle |= (isp->isp_seqno++ << ISP_HANDLE_SEQ_SHIFT); 2309 } 2310 *handlep = hdp->handle; 2311 return (0); 2312 } 2313 2314 void * 2315 isp_find_xs_tgt(ispsoftc_t *isp, uint32_t handle) 2316 { 2317 if (!ISP_VALID_TGT_HANDLE(isp, handle)) { 2318 isp_prt(isp, ISP_LOGERR, "%s: bad handle 0x%x", __func__, handle); 2319 return (NULL); 2320 } 2321 return (isp->isp_tgtlist[(handle & ISP_HANDLE_CMD_MASK)].cmd); 2322 } 2323 2324 uint32_t 2325 isp_find_tgt_handle(ispsoftc_t *isp, void *xs) 2326 { 2327 uint32_t i, foundhdl = ISP_HANDLE_FREE; 2328 2329 if (xs != NULL) { 2330 for (i = 0; i < isp->isp_maxcmds; i++) { 2331 if (isp->isp_tgtlist[i].cmd != xs) { 2332 continue; 2333 } 2334 foundhdl = isp->isp_tgtlist[i].handle; 2335 break; 2336 } 2337 } 2338 return (foundhdl); 2339 } 2340 2341 void 2342 isp_destroy_tgt_handle(ispsoftc_t *isp, uint32_t handle) 2343 { 2344 if (!ISP_VALID_TGT_HANDLE(isp, handle)) { 2345 isp_prt(isp, ISP_LOGERR, "%s: bad handle 0x%x", __func__, handle); 2346 } else { 2347 isp->isp_tgtlist[(handle & ISP_HANDLE_CMD_MASK)].handle = ISP_HANDLE_FREE; 2348 isp->isp_tgtlist[(handle & ISP_HANDLE_CMD_MASK)].cmd = isp->isp_tgtfree; 2349 isp->isp_tgtfree = &isp->isp_tgtlist[(handle & ISP_HANDLE_CMD_MASK)]; 2350 } 2351 } 2352 2353 /* 2354 * Find target mode entries 2355 */ 2356 int 2357 isp_find_pdb_by_wwn(ispsoftc_t *isp, int chan, uint64_t wwn, fcportdb_t **lptr) 2358 { 2359 fcparam *fcp; 2360 int i; 2361 2362 if (chan < isp->isp_nchan) { 2363 fcp = FCPARAM(isp, chan); 2364 for (i = 0; i < MAX_FC_TARG; i++) { 2365 fcportdb_t *lp = &fcp->portdb[i]; 2366 2367 if (lp->target_mode == 0) { 2368 continue; 2369 } 2370 if (lp->port_wwn == wwn) { 2371 *lptr = lp; 2372 return (1); 2373 } 2374 } 2375 } 2376 return (0); 2377 } 2378 2379 int 2380 isp_find_pdb_by_loopid(ispsoftc_t *isp, int chan, uint32_t loopid, fcportdb_t **lptr) 2381 { 2382 fcparam *fcp; 2383 int i; 2384 2385 if (chan < isp->isp_nchan) { 2386 fcp = FCPARAM(isp, chan); 2387 for (i = 0; i < MAX_FC_TARG; i++) { 2388 fcportdb_t *lp = &fcp->portdb[i]; 2389 2390 if (lp->target_mode == 0) { 2391 continue; 2392 } 2393 if (lp->handle == loopid) { 2394 *lptr = lp; 2395 return (1); 2396 } 2397 } 2398 } 2399 return (0); 2400 } 2401 2402 int 2403 isp_find_pdb_by_sid(ispsoftc_t *isp, int chan, uint32_t sid, fcportdb_t **lptr) 2404 { 2405 fcparam *fcp; 2406 int i; 2407 2408 if (chan >= isp->isp_nchan) { 2409 return (0); 2410 } 2411 2412 fcp = FCPARAM(isp, chan); 2413 for (i = 0; i < MAX_FC_TARG; i++) { 2414 fcportdb_t *lp = &fcp->portdb[i]; 2415 2416 if (lp->target_mode == 0) { 2417 continue; 2418 } 2419 if (lp->portid == sid) { 2420 *lptr = lp; 2421 return (1); 2422 } 2423 } 2424 return (0); 2425 } 2426 2427 void 2428 isp_find_chan_by_did(ispsoftc_t *isp, uint32_t did, uint16_t *cp) 2429 { 2430 uint16_t chan; 2431 2432 *cp = ISP_NOCHAN; 2433 for (chan = 0; chan < isp->isp_nchan; chan++) { 2434 fcparam *fcp = FCPARAM(isp, chan); 2435 if ((fcp->role & ISP_ROLE_TARGET) == 0 || fcp->isp_fwstate != FW_READY || fcp->isp_loopstate < LOOP_PDB_RCVD) { 2436 continue; 2437 } 2438 if (fcp->isp_portid == did) { 2439 *cp = chan; 2440 break; 2441 } 2442 } 2443 } 2444 2445 /* 2446 * Add an initiator device to the port database 2447 */ 2448 void 2449 isp_add_wwn_entry(ispsoftc_t *isp, int chan, uint64_t ini, uint16_t nphdl, uint32_t s_id, uint16_t prli_params) 2450 { 2451 char buf[64]; 2452 fcparam *fcp; 2453 fcportdb_t *lp; 2454 isp_notify_t nt; 2455 int i; 2456 2457 fcp = FCPARAM(isp, chan); 2458 2459 if (nphdl >= MAX_NPORT_HANDLE) { 2460 isp_prt(isp, ISP_LOGWARN, "Chan %d IID 0x%016llx bad N-Port handle 0x%04x Port ID 0x%06x", 2461 chan, (unsigned long long) ini, nphdl, s_id); 2462 return; 2463 } 2464 2465 lp = NULL; 2466 if (fcp->isp_tgt_map[nphdl]) { 2467 lp = &fcp->portdb[fcp->isp_tgt_map[nphdl] - 1]; 2468 } else { 2469 /* 2470 * Make sure the addition of a new target mode entry doesn't duplicate entries 2471 * with the same N-Port handles, the same portids or the same Port WWN. 2472 */ 2473 for (i = 0; i < MAX_FC_TARG; i++) { 2474 lp = &fcp->portdb[i]; 2475 if (lp->target_mode == 0) { 2476 lp = NULL; 2477 continue; 2478 } 2479 if (lp->handle == nphdl) { 2480 break; 2481 } 2482 if (s_id != PORT_ANY && lp->portid == s_id) { 2483 break; 2484 } 2485 if (VALID_INI(ini) && lp->port_wwn == ini) { 2486 break; 2487 } 2488 lp = NULL; 2489 } 2490 2491 } 2492 2493 if (lp) { 2494 int something = 0; 2495 if (lp->handle != nphdl) { 2496 isp_prt(isp, ISP_LOGWARN, "Chan %d attempt to re-enter N-port handle 0x%04x IID 0x%016llx Port ID 0x%06x finds IID 0x%016llx N-Port Handle 0x%04x Port ID 0x%06x", 2497 chan, nphdl, (unsigned long long)ini, s_id, (unsigned long long) lp->port_wwn, lp->handle, lp->portid); 2498 isp_dump_portdb(isp, chan); 2499 return; 2500 } 2501 if (s_id != PORT_NONE) { 2502 if (lp->portid == PORT_NONE) { 2503 lp->portid = s_id; 2504 isp_prt(isp, ISP_LOGTINFO, "Chan %d N-port handle 0x%04x gets Port ID 0x%06x", chan, nphdl, s_id); 2505 something++; 2506 } else if (lp->portid != s_id) { 2507 isp_prt(isp, ISP_LOGTINFO, "Chan %d N-port handle 0x%04x tries to change Port ID 0x%06x to 0x%06x", chan, nphdl, lp->portid, s_id); 2508 isp_dump_portdb(isp, chan); 2509 return; 2510 } 2511 } 2512 if (VALID_INI(ini)) { 2513 if (!VALID_INI(lp->port_wwn)) { 2514 lp->port_wwn = ini; 2515 isp_prt(isp, ISP_LOGTINFO, "Chan %d N-port handle 0x%04x gets WWN 0x%016llxx", chan, nphdl, (unsigned long long) ini); 2516 something++; 2517 } else if (lp->port_wwn != ini) { 2518 isp_prt(isp, ISP_LOGWARN, "Chan %d N-port handle 0x%04x tries to change WWN 0x%016llx to 0x%016llx", chan, nphdl, 2519 (unsigned long long) lp->port_wwn, (unsigned long long) ini); 2520 isp_dump_portdb(isp, chan); 2521 return; 2522 } 2523 } 2524 if (prli_params != lp->prli_word3) { 2525 lp->prli_word3 = prli_params; 2526 isp_gen_role_str(buf, sizeof (buf), lp->prli_word3); 2527 isp_prt(isp, ISP_LOGTINFO|ISP_LOGCONFIG, "Chan %d IID 0x%016llx N-Port Handle 0x%04x Port ID 0x%06x new PRLI Word 3 params %s", chan, 2528 (unsigned long long) lp->port_wwn, lp->handle, lp->portid, buf); 2529 something++; 2530 } 2531 if (!something) { 2532 isp_prt(isp, ISP_LOGWARN, "Chan %d IID 0x%016llx N-Port Handle 0x%04x Port ID 0x%06x reentered", chan, 2533 (unsigned long long) lp->port_wwn, lp->handle, lp->portid); 2534 } 2535 return; 2536 } 2537 2538 /* 2539 * Find a new spot 2540 */ 2541 for (i = MAX_FC_TARG - 1; i >= 0; i--) { 2542 if (fcp->portdb[i].target_mode == 1) { 2543 continue; 2544 } 2545 if (fcp->portdb[i].state == FC_PORTDB_STATE_NIL) { 2546 break; 2547 } 2548 } 2549 if (i < 0) { 2550 isp_prt(isp, ISP_LOGWARN, "Chan %d IID 0x%016llx N-Port Handle 0x%04x Port ID 0x%06x- no room in port database", 2551 chan, (unsigned long long) ini, nphdl, s_id); 2552 return; 2553 } 2554 2555 lp = &fcp->portdb[i]; 2556 ISP_MEMZERO(lp, sizeof (fcportdb_t)); 2557 lp->target_mode = 1; 2558 lp->handle = nphdl; 2559 lp->portid = s_id; 2560 lp->port_wwn = ini; 2561 lp->prli_word3 = prli_params; 2562 isp_gen_role_str(buf, sizeof (buf), lp->prli_word3); 2563 fcp->isp_tgt_map[nphdl] = i + 1; 2564 2565 isp_prt(isp, ISP_LOGTINFO, "Chan %d IID 0x%016llx N-Port Handle 0x%04x Port ID 0x%06x vtgt %d %s added", chan, 2566 (unsigned long long) ini, nphdl, s_id, fcp->isp_tgt_map[nphdl] - 1, buf); 2567 2568 ISP_MEMZERO(&nt, sizeof (nt)); 2569 nt.nt_hba = isp; 2570 nt.nt_wwn = ini; 2571 nt.nt_tgt = FCPARAM(isp, chan)->isp_wwpn; 2572 nt.nt_sid = s_id; 2573 nt.nt_did = FCPARAM(isp, chan)->isp_portid; 2574 nt.nt_nphdl = nphdl; 2575 nt.nt_channel = chan; 2576 nt.nt_ncode = NT_ARRIVED; 2577 isp_async(isp, ISPASYNC_TARGET_NOTIFY, &nt); 2578 } 2579 2580 /* 2581 * Remove a target device to the port database 2582 */ 2583 void 2584 isp_del_wwn_entry(ispsoftc_t *isp, int chan, uint64_t ini, uint16_t nphdl, uint32_t s_id) 2585 { 2586 fcparam *fcp; 2587 isp_notify_t nt; 2588 fcportdb_t *lp; 2589 2590 if (nphdl >= MAX_NPORT_HANDLE) { 2591 isp_prt(isp, ISP_LOGWARN, "Chan %d IID 0x%016llx bad N-Port handle 0x%04x Port ID 0x%06x", 2592 chan, (unsigned long long) ini, nphdl, s_id); 2593 return; 2594 } 2595 2596 fcp = FCPARAM(isp, chan); 2597 if (fcp->isp_tgt_map[nphdl] == 0) { 2598 lp = NULL; 2599 } else { 2600 lp = &fcp->portdb[fcp->isp_tgt_map[nphdl] - 1]; 2601 if (lp->target_mode == 0) { 2602 lp = NULL; 2603 } 2604 } 2605 if (lp == NULL) { 2606 isp_prt(isp, ISP_LOGWARN, "Chan %d IID 0x%016llx N-Port Handle 0x%04x Port ID 0x%06x cannot be found to be cleared", 2607 chan, (unsigned long long) ini, nphdl, s_id); 2608 isp_dump_portdb(isp, chan); 2609 return; 2610 } 2611 isp_prt(isp, ISP_LOGTINFO, "Chan %d IID 0x%016llx N-Port Handle 0x%04x Port ID 0x%06x vtgt %d cleared", 2612 chan, (unsigned long long) lp->port_wwn, nphdl, lp->portid, fcp->isp_tgt_map[nphdl] - 1); 2613 fcp->isp_tgt_map[nphdl] = 0; 2614 2615 ISP_MEMZERO(&nt, sizeof (nt)); 2616 nt.nt_hba = isp; 2617 nt.nt_wwn = lp->port_wwn; 2618 nt.nt_tgt = FCPARAM(isp, chan)->isp_wwpn; 2619 nt.nt_sid = lp->portid; 2620 nt.nt_did = FCPARAM(isp, chan)->isp_portid; 2621 nt.nt_nphdl = nphdl; 2622 nt.nt_channel = chan; 2623 nt.nt_ncode = NT_DEPARTED; 2624 isp_async(isp, ISPASYNC_TARGET_NOTIFY, &nt); 2625 } 2626 2627 void 2628 isp_del_all_wwn_entries(ispsoftc_t *isp, int chan) 2629 { 2630 fcparam *fcp; 2631 int i; 2632 2633 if (!IS_FC(isp)) { 2634 return; 2635 } 2636 2637 /* 2638 * Handle iterations over all channels via recursion 2639 */ 2640 if (chan == ISP_NOCHAN) { 2641 for (chan = 0; chan < isp->isp_nchan; chan++) { 2642 isp_del_all_wwn_entries(isp, chan); 2643 } 2644 return; 2645 } 2646 2647 if (chan > isp->isp_nchan) { 2648 return; 2649 } 2650 2651 fcp = FCPARAM(isp, chan); 2652 if (fcp == NULL) { 2653 return; 2654 } 2655 for (i = 0; i < MAX_NPORT_HANDLE; i++) { 2656 if (fcp->isp_tgt_map[i]) { 2657 fcportdb_t *lp = &fcp->portdb[fcp->isp_tgt_map[i] - 1]; 2658 isp_del_wwn_entry(isp, chan, lp->port_wwn, lp->handle, lp->portid); 2659 } 2660 } 2661 } 2662 2663 void 2664 isp_del_wwn_entries(ispsoftc_t *isp, isp_notify_t *mp) 2665 { 2666 fcportdb_t *lp; 2667 2668 /* 2669 * Handle iterations over all channels via recursion 2670 */ 2671 if (mp->nt_channel == ISP_NOCHAN) { 2672 for (mp->nt_channel = 0; mp->nt_channel < isp->isp_nchan; mp->nt_channel++) { 2673 isp_del_wwn_entries(isp, mp); 2674 } 2675 mp->nt_channel = ISP_NOCHAN; 2676 return; 2677 } 2678 2679 /* 2680 * We have an entry which is only partially identified. 2681 * 2682 * It's only known by WWN, N-Port handle, or Port ID. 2683 * We need to find the actual entry so we can delete it. 2684 */ 2685 if (mp->nt_nphdl != NIL_HANDLE) { 2686 if (isp_find_pdb_by_loopid(isp, mp->nt_channel, mp->nt_nphdl, &lp)) { 2687 isp_del_wwn_entry(isp, mp->nt_channel, lp->port_wwn, lp->handle, lp->portid); 2688 return; 2689 } 2690 } 2691 if (mp->nt_wwn != INI_ANY) { 2692 if (isp_find_pdb_by_wwn(isp, mp->nt_channel, mp->nt_wwn, &lp)) { 2693 isp_del_wwn_entry(isp, mp->nt_channel, lp->port_wwn, lp->handle, lp->portid); 2694 return; 2695 } 2696 } 2697 if (mp->nt_sid != PORT_ANY && mp->nt_sid != PORT_NONE) { 2698 if (isp_find_pdb_by_sid(isp, mp->nt_channel, mp->nt_sid, &lp)) { 2699 isp_del_wwn_entry(isp, mp->nt_channel, lp->port_wwn, lp->handle, lp->portid); 2700 return; 2701 } 2702 } 2703 isp_prt(isp, ISP_LOGWARN, "Chan %d unable to find entry to delete N-port handle 0x%04x initiator WWN 0x%016llx Port ID 0x%06x", 2704 mp->nt_channel, mp->nt_nphdl, (unsigned long long) mp->nt_wwn, mp->nt_sid); 2705 } 2706 2707 void 2708 isp_put_atio(ispsoftc_t *isp, at_entry_t *src, at_entry_t *dst) 2709 { 2710 int i; 2711 isp_put_hdr(isp, &src->at_header, &dst->at_header); 2712 ISP_IOXPUT_16(isp, src->at_reserved, &dst->at_reserved); 2713 ISP_IOXPUT_16(isp, src->at_handle, &dst->at_handle); 2714 if (ISP_IS_SBUS(isp)) { 2715 ISP_IOXPUT_8(isp, src->at_lun, &dst->at_iid); 2716 ISP_IOXPUT_8(isp, src->at_iid, &dst->at_lun); 2717 ISP_IOXPUT_8(isp, src->at_cdblen, &dst->at_tgt); 2718 ISP_IOXPUT_8(isp, src->at_tgt, &dst->at_cdblen); 2719 ISP_IOXPUT_8(isp, src->at_status, &dst->at_scsi_status); 2720 ISP_IOXPUT_8(isp, src->at_scsi_status, &dst->at_status); 2721 ISP_IOXPUT_8(isp, src->at_tag_val, &dst->at_tag_type); 2722 ISP_IOXPUT_8(isp, src->at_tag_type, &dst->at_tag_val); 2723 } else { 2724 ISP_IOXPUT_8(isp, src->at_lun, &dst->at_lun); 2725 ISP_IOXPUT_8(isp, src->at_iid, &dst->at_iid); 2726 ISP_IOXPUT_8(isp, src->at_cdblen, &dst->at_cdblen); 2727 ISP_IOXPUT_8(isp, src->at_tgt, &dst->at_tgt); 2728 ISP_IOXPUT_8(isp, src->at_status, &dst->at_status); 2729 ISP_IOXPUT_8(isp, src->at_scsi_status, &dst->at_scsi_status); 2730 ISP_IOXPUT_8(isp, src->at_tag_val, &dst->at_tag_val); 2731 ISP_IOXPUT_8(isp, src->at_tag_type, &dst->at_tag_type); 2732 } 2733 ISP_IOXPUT_32(isp, src->at_flags, &dst->at_flags); 2734 for (i = 0; i < ATIO_CDBLEN; i++) { 2735 ISP_IOXPUT_8(isp, src->at_cdb[i], &dst->at_cdb[i]); 2736 } 2737 for (i = 0; i < QLTM_SENSELEN; i++) { 2738 ISP_IOXPUT_8(isp, src->at_sense[i], &dst->at_sense[i]); 2739 } 2740 } 2741 2742 void 2743 isp_get_atio(ispsoftc_t *isp, at_entry_t *src, at_entry_t *dst) 2744 { 2745 int i; 2746 isp_get_hdr(isp, &src->at_header, &dst->at_header); 2747 ISP_IOXGET_16(isp, &src->at_reserved, dst->at_reserved); 2748 ISP_IOXGET_16(isp, &src->at_handle, dst->at_handle); 2749 if (ISP_IS_SBUS(isp)) { 2750 ISP_IOXGET_8(isp, &src->at_lun, dst->at_iid); 2751 ISP_IOXGET_8(isp, &src->at_iid, dst->at_lun); 2752 ISP_IOXGET_8(isp, &src->at_cdblen, dst->at_tgt); 2753 ISP_IOXGET_8(isp, &src->at_tgt, dst->at_cdblen); 2754 ISP_IOXGET_8(isp, &src->at_status, dst->at_scsi_status); 2755 ISP_IOXGET_8(isp, &src->at_scsi_status, dst->at_status); 2756 ISP_IOXGET_8(isp, &src->at_tag_val, dst->at_tag_type); 2757 ISP_IOXGET_8(isp, &src->at_tag_type, dst->at_tag_val); 2758 } else { 2759 ISP_IOXGET_8(isp, &src->at_lun, dst->at_lun); 2760 ISP_IOXGET_8(isp, &src->at_iid, dst->at_iid); 2761 ISP_IOXGET_8(isp, &src->at_cdblen, dst->at_cdblen); 2762 ISP_IOXGET_8(isp, &src->at_tgt, dst->at_tgt); 2763 ISP_IOXGET_8(isp, &src->at_status, dst->at_status); 2764 ISP_IOXGET_8(isp, &src->at_scsi_status, dst->at_scsi_status); 2765 ISP_IOXGET_8(isp, &src->at_tag_val, dst->at_tag_val); 2766 ISP_IOXGET_8(isp, &src->at_tag_type, dst->at_tag_type); 2767 } 2768 ISP_IOXGET_32(isp, &src->at_flags, dst->at_flags); 2769 for (i = 0; i < ATIO_CDBLEN; i++) { 2770 ISP_IOXGET_8(isp, &src->at_cdb[i], dst->at_cdb[i]); 2771 } 2772 for (i = 0; i < QLTM_SENSELEN; i++) { 2773 ISP_IOXGET_8(isp, &src->at_sense[i], dst->at_sense[i]); 2774 } 2775 } 2776 2777 void 2778 isp_put_atio2(ispsoftc_t *isp, at2_entry_t *src, at2_entry_t *dst) 2779 { 2780 int i; 2781 isp_put_hdr(isp, &src->at_header, &dst->at_header); 2782 ISP_IOXPUT_32(isp, src->at_reserved, &dst->at_reserved); 2783 ISP_IOXPUT_8(isp, src->at_lun, &dst->at_lun); 2784 ISP_IOXPUT_8(isp, src->at_iid, &dst->at_iid); 2785 ISP_IOXPUT_16(isp, src->at_rxid, &dst->at_rxid); 2786 ISP_IOXPUT_16(isp, src->at_flags, &dst->at_flags); 2787 ISP_IOXPUT_16(isp, src->at_status, &dst->at_status); 2788 ISP_IOXPUT_8(isp, src->at_crn, &dst->at_crn); 2789 ISP_IOXPUT_8(isp, src->at_taskcodes, &dst->at_taskcodes); 2790 ISP_IOXPUT_8(isp, src->at_taskflags, &dst->at_taskflags); 2791 ISP_IOXPUT_8(isp, src->at_execodes, &dst->at_execodes); 2792 for (i = 0; i < ATIO2_CDBLEN; i++) { 2793 ISP_IOXPUT_8(isp, src->at_cdb[i], &dst->at_cdb[i]); 2794 } 2795 ISP_IOXPUT_32(isp, src->at_datalen, &dst->at_datalen); 2796 ISP_IOXPUT_16(isp, src->at_scclun, &dst->at_scclun); 2797 for (i = 0; i < 4; i++) { 2798 ISP_IOXPUT_16(isp, src->at_wwpn[i], &dst->at_wwpn[i]); 2799 } 2800 for (i = 0; i < 6; i++) { 2801 ISP_IOXPUT_16(isp, src->at_reserved2[i], &dst->at_reserved2[i]); 2802 } 2803 ISP_IOXPUT_16(isp, src->at_oxid, &dst->at_oxid); 2804 } 2805 2806 void 2807 isp_put_atio2e(ispsoftc_t *isp, at2e_entry_t *src, at2e_entry_t *dst) 2808 { 2809 int i; 2810 isp_put_hdr(isp, &src->at_header, &dst->at_header); 2811 ISP_IOXPUT_32(isp, src->at_reserved, &dst->at_reserved); 2812 ISP_IOXPUT_16(isp, src->at_iid, &dst->at_iid); 2813 ISP_IOXPUT_16(isp, src->at_rxid, &dst->at_rxid); 2814 ISP_IOXPUT_16(isp, src->at_flags, &dst->at_flags); 2815 ISP_IOXPUT_16(isp, src->at_status, &dst->at_status); 2816 ISP_IOXPUT_8(isp, src->at_crn, &dst->at_crn); 2817 ISP_IOXPUT_8(isp, src->at_taskcodes, &dst->at_taskcodes); 2818 ISP_IOXPUT_8(isp, src->at_taskflags, &dst->at_taskflags); 2819 ISP_IOXPUT_8(isp, src->at_execodes, &dst->at_execodes); 2820 for (i = 0; i < ATIO2_CDBLEN; i++) { 2821 ISP_IOXPUT_8(isp, src->at_cdb[i], &dst->at_cdb[i]); 2822 } 2823 ISP_IOXPUT_32(isp, src->at_datalen, &dst->at_datalen); 2824 ISP_IOXPUT_16(isp, src->at_scclun, &dst->at_scclun); 2825 for (i = 0; i < 4; i++) { 2826 ISP_IOXPUT_16(isp, src->at_wwpn[i], &dst->at_wwpn[i]); 2827 } 2828 for (i = 0; i < 6; i++) { 2829 ISP_IOXPUT_16(isp, src->at_reserved2[i], &dst->at_reserved2[i]); 2830 } 2831 ISP_IOXPUT_16(isp, src->at_oxid, &dst->at_oxid); 2832 } 2833 2834 void 2835 isp_get_atio2(ispsoftc_t *isp, at2_entry_t *src, at2_entry_t *dst) 2836 { 2837 int i; 2838 isp_get_hdr(isp, &src->at_header, &dst->at_header); 2839 ISP_IOXGET_32(isp, &src->at_reserved, dst->at_reserved); 2840 ISP_IOXGET_8(isp, &src->at_lun, dst->at_lun); 2841 ISP_IOXGET_8(isp, &src->at_iid, dst->at_iid); 2842 ISP_IOXGET_16(isp, &src->at_rxid, dst->at_rxid); 2843 ISP_IOXGET_16(isp, &src->at_flags, dst->at_flags); 2844 ISP_IOXGET_16(isp, &src->at_status, dst->at_status); 2845 ISP_IOXGET_8(isp, &src->at_crn, dst->at_crn); 2846 ISP_IOXGET_8(isp, &src->at_taskcodes, dst->at_taskcodes); 2847 ISP_IOXGET_8(isp, &src->at_taskflags, dst->at_taskflags); 2848 ISP_IOXGET_8(isp, &src->at_execodes, dst->at_execodes); 2849 for (i = 0; i < ATIO2_CDBLEN; i++) { 2850 ISP_IOXGET_8(isp, &src->at_cdb[i], dst->at_cdb[i]); 2851 } 2852 ISP_IOXGET_32(isp, &src->at_datalen, dst->at_datalen); 2853 ISP_IOXGET_16(isp, &src->at_scclun, dst->at_scclun); 2854 for (i = 0; i < 4; i++) { 2855 ISP_IOXGET_16(isp, &src->at_wwpn[i], dst->at_wwpn[i]); 2856 } 2857 for (i = 0; i < 6; i++) { 2858 ISP_IOXGET_16(isp, &src->at_reserved2[i], dst->at_reserved2[i]); 2859 } 2860 ISP_IOXGET_16(isp, &src->at_oxid, dst->at_oxid); 2861 } 2862 2863 void 2864 isp_get_atio2e(ispsoftc_t *isp, at2e_entry_t *src, at2e_entry_t *dst) 2865 { 2866 int i; 2867 isp_get_hdr(isp, &src->at_header, &dst->at_header); 2868 ISP_IOXGET_32(isp, &src->at_reserved, dst->at_reserved); 2869 ISP_IOXGET_16(isp, &src->at_iid, dst->at_iid); 2870 ISP_IOXGET_16(isp, &src->at_rxid, dst->at_rxid); 2871 ISP_IOXGET_16(isp, &src->at_flags, dst->at_flags); 2872 ISP_IOXGET_16(isp, &src->at_status, dst->at_status); 2873 ISP_IOXGET_8(isp, &src->at_crn, dst->at_crn); 2874 ISP_IOXGET_8(isp, &src->at_taskcodes, dst->at_taskcodes); 2875 ISP_IOXGET_8(isp, &src->at_taskflags, dst->at_taskflags); 2876 ISP_IOXGET_8(isp, &src->at_execodes, dst->at_execodes); 2877 for (i = 0; i < ATIO2_CDBLEN; i++) { 2878 ISP_IOXGET_8(isp, &src->at_cdb[i], dst->at_cdb[i]); 2879 } 2880 ISP_IOXGET_32(isp, &src->at_datalen, dst->at_datalen); 2881 ISP_IOXGET_16(isp, &src->at_scclun, dst->at_scclun); 2882 for (i = 0; i < 4; i++) { 2883 ISP_IOXGET_16(isp, &src->at_wwpn[i], dst->at_wwpn[i]); 2884 } 2885 for (i = 0; i < 6; i++) { 2886 ISP_IOXGET_16(isp, &src->at_reserved2[i], dst->at_reserved2[i]); 2887 } 2888 ISP_IOXGET_16(isp, &src->at_oxid, dst->at_oxid); 2889 } 2890 2891 void 2892 isp_get_atio7(ispsoftc_t *isp, at7_entry_t *src, at7_entry_t *dst) 2893 { 2894 ISP_IOXGET_8(isp, &src->at_type, dst->at_type); 2895 ISP_IOXGET_8(isp, &src->at_count, dst->at_count); 2896 ISP_IOXGET_16(isp, &src->at_ta_len, dst->at_ta_len); 2897 ISP_IOXGET_32(isp, &src->at_rxid, dst->at_rxid); 2898 isp_get_fc_hdr(isp, &src->at_hdr, &dst->at_hdr); 2899 isp_get_fcp_cmnd_iu(isp, &src->at_cmnd, &dst->at_cmnd); 2900 } 2901 2902 void 2903 isp_put_ctio(ispsoftc_t *isp, ct_entry_t *src, ct_entry_t *dst) 2904 { 2905 int i; 2906 isp_put_hdr(isp, &src->ct_header, &dst->ct_header); 2907 ISP_IOXPUT_16(isp, src->ct_syshandle, &dst->ct_syshandle); 2908 ISP_IOXPUT_16(isp, src->ct_fwhandle, &dst->ct_fwhandle); 2909 if (ISP_IS_SBUS(isp)) { 2910 ISP_IOXPUT_8(isp, src->ct_iid, &dst->ct_lun); 2911 ISP_IOXPUT_8(isp, src->ct_lun, &dst->ct_iid); 2912 ISP_IOXPUT_8(isp, src->ct_tgt, &dst->ct_reserved2); 2913 ISP_IOXPUT_8(isp, src->ct_reserved2, &dst->ct_tgt); 2914 ISP_IOXPUT_8(isp, src->ct_status, &dst->ct_scsi_status); 2915 ISP_IOXPUT_8(isp, src->ct_scsi_status, &dst->ct_status); 2916 ISP_IOXPUT_8(isp, src->ct_tag_type, &dst->ct_tag_val); 2917 ISP_IOXPUT_8(isp, src->ct_tag_val, &dst->ct_tag_type); 2918 } else { 2919 ISP_IOXPUT_8(isp, src->ct_iid, &dst->ct_iid); 2920 ISP_IOXPUT_8(isp, src->ct_lun, &dst->ct_lun); 2921 ISP_IOXPUT_8(isp, src->ct_tgt, &dst->ct_tgt); 2922 ISP_IOXPUT_8(isp, src->ct_reserved2, &dst->ct_reserved2); 2923 ISP_IOXPUT_8(isp, src->ct_scsi_status, 2924 &dst->ct_scsi_status); 2925 ISP_IOXPUT_8(isp, src->ct_status, &dst->ct_status); 2926 ISP_IOXPUT_8(isp, src->ct_tag_type, &dst->ct_tag_type); 2927 ISP_IOXPUT_8(isp, src->ct_tag_val, &dst->ct_tag_val); 2928 } 2929 ISP_IOXPUT_32(isp, src->ct_flags, &dst->ct_flags); 2930 ISP_IOXPUT_32(isp, src->ct_xfrlen, &dst->ct_xfrlen); 2931 ISP_IOXPUT_32(isp, src->ct_resid, &dst->ct_resid); 2932 ISP_IOXPUT_16(isp, src->ct_timeout, &dst->ct_timeout); 2933 ISP_IOXPUT_16(isp, src->ct_seg_count, &dst->ct_seg_count); 2934 for (i = 0; i < ISP_RQDSEG; i++) { 2935 ISP_IOXPUT_32(isp, src->ct_dataseg[i].ds_base, &dst->ct_dataseg[i].ds_base); 2936 ISP_IOXPUT_32(isp, src->ct_dataseg[i].ds_count, &dst->ct_dataseg[i].ds_count); 2937 } 2938 } 2939 2940 void 2941 isp_get_ctio(ispsoftc_t *isp, ct_entry_t *src, ct_entry_t *dst) 2942 { 2943 int i; 2944 isp_get_hdr(isp, &src->ct_header, &dst->ct_header); 2945 ISP_IOXGET_16(isp, &src->ct_syshandle, dst->ct_syshandle); 2946 ISP_IOXGET_16(isp, &src->ct_fwhandle, dst->ct_fwhandle); 2947 if (ISP_IS_SBUS(isp)) { 2948 ISP_IOXGET_8(isp, &src->ct_lun, dst->ct_iid); 2949 ISP_IOXGET_8(isp, &src->ct_iid, dst->ct_lun); 2950 ISP_IOXGET_8(isp, &src->ct_reserved2, dst->ct_tgt); 2951 ISP_IOXGET_8(isp, &src->ct_tgt, dst->ct_reserved2); 2952 ISP_IOXGET_8(isp, &src->ct_status, dst->ct_scsi_status); 2953 ISP_IOXGET_8(isp, &src->ct_scsi_status, dst->ct_status); 2954 ISP_IOXGET_8(isp, &src->ct_tag_val, dst->ct_tag_type); 2955 ISP_IOXGET_8(isp, &src->ct_tag_type, dst->ct_tag_val); 2956 } else { 2957 ISP_IOXGET_8(isp, &src->ct_lun, dst->ct_lun); 2958 ISP_IOXGET_8(isp, &src->ct_iid, dst->ct_iid); 2959 ISP_IOXGET_8(isp, &src->ct_reserved2, dst->ct_reserved2); 2960 ISP_IOXGET_8(isp, &src->ct_tgt, dst->ct_tgt); 2961 ISP_IOXGET_8(isp, &src->ct_status, dst->ct_status); 2962 ISP_IOXGET_8(isp, &src->ct_scsi_status, dst->ct_scsi_status); 2963 ISP_IOXGET_8(isp, &src->ct_tag_val, dst->ct_tag_val); 2964 ISP_IOXGET_8(isp, &src->ct_tag_type, dst->ct_tag_type); 2965 } 2966 ISP_IOXGET_32(isp, &src->ct_flags, dst->ct_flags); 2967 ISP_IOXGET_32(isp, &src->ct_xfrlen, dst->ct_xfrlen); 2968 ISP_IOXGET_32(isp, &src->ct_resid, dst->ct_resid); 2969 ISP_IOXGET_16(isp, &src->ct_timeout, dst->ct_timeout); 2970 ISP_IOXGET_16(isp, &src->ct_seg_count, dst->ct_seg_count); 2971 for (i = 0; i < ISP_RQDSEG; i++) { 2972 ISP_IOXGET_32(isp, &src->ct_dataseg[i].ds_base, dst->ct_dataseg[i].ds_base); 2973 ISP_IOXGET_32(isp, &src->ct_dataseg[i].ds_count, dst->ct_dataseg[i].ds_count); 2974 } 2975 } 2976 2977 void 2978 isp_put_ctio2(ispsoftc_t *isp, ct2_entry_t *src, ct2_entry_t *dst) 2979 { 2980 int i; 2981 isp_put_hdr(isp, &src->ct_header, &dst->ct_header); 2982 ISP_IOXPUT_32(isp, src->ct_syshandle, &dst->ct_syshandle); 2983 ISP_IOXPUT_8(isp, src->ct_lun, &dst->ct_lun); 2984 ISP_IOXPUT_8(isp, src->ct_iid, &dst->ct_iid); 2985 ISP_IOXPUT_16(isp, src->ct_rxid, &dst->ct_rxid); 2986 ISP_IOXPUT_16(isp, src->ct_flags, &dst->ct_flags); 2987 ISP_IOXPUT_16(isp, src->ct_timeout, &dst->ct_timeout); 2988 ISP_IOXPUT_16(isp, src->ct_seg_count, &dst->ct_seg_count); 2989 ISP_IOXPUT_32(isp, src->ct_resid, &dst->ct_resid); 2990 ISP_IOXPUT_32(isp, src->ct_reloff, &dst->ct_reloff); 2991 if ((src->ct_flags & CT2_FLAG_MMASK) == CT2_FLAG_MODE0) { 2992 ISP_IOXPUT_32(isp, src->rsp.m0._reserved, &dst->rsp.m0._reserved); 2993 ISP_IOXPUT_16(isp, src->rsp.m0._reserved2, &dst->rsp.m0._reserved2); 2994 ISP_IOXPUT_16(isp, src->rsp.m0.ct_scsi_status, &dst->rsp.m0.ct_scsi_status); 2995 ISP_IOXPUT_32(isp, src->rsp.m0.ct_xfrlen, &dst->rsp.m0.ct_xfrlen); 2996 if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO2) { 2997 for (i = 0; i < ISP_RQDSEG_T2; i++) { 2998 ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dataseg[i].ds_base, &dst->rsp.m0.u.ct_dataseg[i].ds_base); 2999 ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dataseg[i].ds_count, &dst->rsp.m0.u.ct_dataseg[i].ds_count); 3000 } 3001 } else if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO3) { 3002 for (i = 0; i < ISP_RQDSEG_T3; i++) { 3003 ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dataseg64[i].ds_base, &dst->rsp.m0.u.ct_dataseg64[i].ds_base); 3004 ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dataseg64[i].ds_basehi, &dst->rsp.m0.u.ct_dataseg64[i].ds_basehi); 3005 ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dataseg64[i].ds_count, &dst->rsp.m0.u.ct_dataseg64[i].ds_count); 3006 } 3007 } else if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO4) { 3008 ISP_IOXPUT_16(isp, src->rsp.m0.u.ct_dslist.ds_type, &dst->rsp.m0.u.ct_dslist.ds_type); ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dslist.ds_segment, 3009 &dst->rsp.m0.u.ct_dslist.ds_segment); 3010 ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dslist.ds_base, &dst->rsp.m0.u.ct_dslist.ds_base); 3011 } 3012 } else if ((src->ct_flags & CT2_FLAG_MMASK) == CT2_FLAG_MODE1) { 3013 ISP_IOXPUT_16(isp, src->rsp.m1._reserved, &dst->rsp.m1._reserved); 3014 ISP_IOXPUT_16(isp, src->rsp.m1._reserved2, &dst->rsp.m1._reserved2); 3015 ISP_IOXPUT_16(isp, src->rsp.m1.ct_senselen, &dst->rsp.m1.ct_senselen); 3016 ISP_IOXPUT_16(isp, src->rsp.m1.ct_scsi_status, &dst->rsp.m1.ct_scsi_status); 3017 ISP_IOXPUT_16(isp, src->rsp.m1.ct_resplen, &dst->rsp.m1.ct_resplen); 3018 for (i = 0; i < MAXRESPLEN; i++) { 3019 ISP_IOXPUT_8(isp, src->rsp.m1.ct_resp[i], &dst->rsp.m1.ct_resp[i]); 3020 } 3021 } else { 3022 ISP_IOXPUT_32(isp, src->rsp.m2._reserved, &dst->rsp.m2._reserved); 3023 ISP_IOXPUT_16(isp, src->rsp.m2._reserved2, &dst->rsp.m2._reserved2); 3024 ISP_IOXPUT_16(isp, src->rsp.m2._reserved3, &dst->rsp.m2._reserved3); 3025 ISP_IOXPUT_32(isp, src->rsp.m2.ct_datalen, &dst->rsp.m2.ct_datalen); 3026 if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO2) { 3027 ISP_IOXPUT_32(isp, src->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_base, &dst->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_base); 3028 ISP_IOXPUT_32(isp, src->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_count, &dst->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_count); 3029 } else { 3030 ISP_IOXPUT_32(isp, src->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_base, &dst->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_base); 3031 ISP_IOXPUT_32(isp, src->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_basehi, &dst->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_basehi); 3032 ISP_IOXPUT_32(isp, src->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_count, &dst->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_count); 3033 } 3034 } 3035 } 3036 3037 void 3038 isp_put_ctio2e(ispsoftc_t *isp, ct2e_entry_t *src, ct2e_entry_t *dst) 3039 { 3040 int i; 3041 isp_put_hdr(isp, &src->ct_header, &dst->ct_header); 3042 ISP_IOXPUT_32(isp, src->ct_syshandle, &dst->ct_syshandle); 3043 ISP_IOXPUT_16(isp, src->ct_iid, &dst->ct_iid); 3044 ISP_IOXPUT_16(isp, src->ct_rxid, &dst->ct_rxid); 3045 ISP_IOXPUT_16(isp, src->ct_flags, &dst->ct_flags); 3046 ISP_IOXPUT_16(isp, src->ct_timeout, &dst->ct_timeout); 3047 ISP_IOXPUT_16(isp, src->ct_seg_count, &dst->ct_seg_count); 3048 ISP_IOXPUT_32(isp, src->ct_resid, &dst->ct_resid); 3049 ISP_IOXPUT_32(isp, src->ct_reloff, &dst->ct_reloff); 3050 if ((src->ct_flags & CT2_FLAG_MMASK) == CT2_FLAG_MODE0) { 3051 ISP_IOXPUT_32(isp, src->rsp.m0._reserved, &dst->rsp.m0._reserved); 3052 ISP_IOXPUT_16(isp, src->rsp.m0._reserved2, &dst->rsp.m0._reserved2); 3053 ISP_IOXPUT_16(isp, src->rsp.m0.ct_scsi_status, &dst->rsp.m0.ct_scsi_status); 3054 ISP_IOXPUT_32(isp, src->rsp.m0.ct_xfrlen, &dst->rsp.m0.ct_xfrlen); 3055 if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO2) { 3056 for (i = 0; i < ISP_RQDSEG_T2; i++) { 3057 ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dataseg[i].ds_base, &dst->rsp.m0.u.ct_dataseg[i].ds_base); 3058 ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dataseg[i].ds_count, &dst->rsp.m0.u.ct_dataseg[i].ds_count); 3059 } 3060 } else if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO3) { 3061 for (i = 0; i < ISP_RQDSEG_T3; i++) { 3062 ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dataseg64[i].ds_base, &dst->rsp.m0.u.ct_dataseg64[i].ds_base); 3063 ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dataseg64[i].ds_basehi, &dst->rsp.m0.u.ct_dataseg64[i].ds_basehi); 3064 ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dataseg64[i].ds_count, &dst->rsp.m0.u.ct_dataseg64[i].ds_count); 3065 } 3066 } else if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO4) { 3067 ISP_IOXPUT_16(isp, src->rsp.m0.u.ct_dslist.ds_type, &dst->rsp.m0.u.ct_dslist.ds_type); 3068 ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dslist.ds_segment, &dst->rsp.m0.u.ct_dslist.ds_segment); 3069 ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dslist.ds_base, &dst->rsp.m0.u.ct_dslist.ds_base); 3070 } 3071 } else if ((src->ct_flags & CT2_FLAG_MMASK) == CT2_FLAG_MODE1) { 3072 ISP_IOXPUT_16(isp, src->rsp.m1._reserved, &dst->rsp.m1._reserved); 3073 ISP_IOXPUT_16(isp, src->rsp.m1._reserved2, &dst->rsp.m1._reserved2); 3074 ISP_IOXPUT_16(isp, src->rsp.m1.ct_senselen, &dst->rsp.m1.ct_senselen); 3075 ISP_IOXPUT_16(isp, src->rsp.m1.ct_scsi_status, &dst->rsp.m1.ct_scsi_status); 3076 ISP_IOXPUT_16(isp, src->rsp.m1.ct_resplen, &dst->rsp.m1.ct_resplen); 3077 for (i = 0; i < MAXRESPLEN; i++) { 3078 ISP_IOXPUT_8(isp, src->rsp.m1.ct_resp[i], &dst->rsp.m1.ct_resp[i]); 3079 } 3080 } else { 3081 ISP_IOXPUT_32(isp, src->rsp.m2._reserved, &dst->rsp.m2._reserved); 3082 ISP_IOXPUT_16(isp, src->rsp.m2._reserved2, &dst->rsp.m2._reserved2); 3083 ISP_IOXPUT_16(isp, src->rsp.m2._reserved3, &dst->rsp.m2._reserved3); 3084 ISP_IOXPUT_32(isp, src->rsp.m2.ct_datalen, &dst->rsp.m2.ct_datalen); 3085 if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO2) { 3086 ISP_IOXPUT_32(isp, src->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_base, &dst->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_base); 3087 ISP_IOXPUT_32(isp, src->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_count, &dst->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_count); 3088 } else { 3089 ISP_IOXPUT_32(isp, src->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_base, &dst->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_base); 3090 ISP_IOXPUT_32(isp, src->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_basehi, &dst->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_basehi); 3091 ISP_IOXPUT_32(isp, src->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_count, &dst->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_count); 3092 } 3093 } 3094 } 3095 3096 void 3097 isp_put_ctio7(ispsoftc_t *isp, ct7_entry_t *src, ct7_entry_t *dst) 3098 { 3099 int i; 3100 3101 isp_put_hdr(isp, &src->ct_header, &dst->ct_header); 3102 ISP_IOXPUT_32(isp, src->ct_syshandle, &dst->ct_syshandle); 3103 ISP_IOXPUT_16(isp, src->ct_nphdl, &dst->ct_nphdl); 3104 ISP_IOXPUT_16(isp, src->ct_timeout, &dst->ct_timeout); 3105 ISP_IOXPUT_16(isp, src->ct_seg_count, &dst->ct_seg_count); 3106 ISP_IOXPUT_8(isp, src->ct_vpidx, &dst->ct_vpidx); 3107 ISP_IOXPUT_8(isp, src->ct_xflags, &dst->ct_xflags); 3108 ISP_IOXPUT_16(isp, src->ct_iid_lo, &dst->ct_iid_lo); 3109 ISP_IOXPUT_8(isp, src->ct_iid_hi, &dst->ct_iid_hi); 3110 ISP_IOXPUT_8(isp, src->ct_reserved, &dst->ct_reserved); 3111 ISP_IOXPUT_32(isp, src->ct_rxid, &dst->ct_rxid); 3112 ISP_IOXPUT_16(isp, src->ct_senselen, &dst->ct_senselen); 3113 ISP_IOXPUT_16(isp, src->ct_flags, &dst->ct_flags); 3114 ISP_IOXPUT_32(isp, src->ct_resid, &dst->ct_resid); 3115 ISP_IOXPUT_16(isp, src->ct_oxid, &dst->ct_oxid); 3116 ISP_IOXPUT_16(isp, src->ct_scsi_status, &dst->ct_scsi_status); 3117 if ((dst->ct_flags & CT7_FLAG_MMASK) == CT7_FLAG_MODE0) { 3118 ISP_IOXPUT_32(isp, src->rsp.m0.reloff, &dst->rsp.m0.reloff); 3119 ISP_IOXPUT_32(isp, src->rsp.m0.reserved0, &dst->rsp.m0.reserved0); 3120 ISP_IOXPUT_32(isp, src->rsp.m0.ct_xfrlen, &dst->rsp.m0.ct_xfrlen); 3121 ISP_IOXPUT_32(isp, src->rsp.m0.reserved1, &dst->rsp.m0.reserved1); 3122 ISP_IOXPUT_32(isp, src->rsp.m0.ds.ds_base, &dst->rsp.m0.ds.ds_base); 3123 ISP_IOXPUT_32(isp, src->rsp.m0.ds.ds_basehi, &dst->rsp.m0.ds.ds_basehi); 3124 ISP_IOXPUT_32(isp, src->rsp.m0.ds.ds_count, &dst->rsp.m0.ds.ds_count); 3125 } else if ((dst->ct_flags & CT7_FLAG_MMASK) == CT7_FLAG_MODE1) { 3126 uint32_t *a, *b; 3127 3128 ISP_IOXPUT_16(isp, src->rsp.m1.ct_resplen, &dst->rsp.m1.ct_resplen); 3129 ISP_IOXPUT_16(isp, src->rsp.m1.reserved, &dst->rsp.m1.reserved); 3130 a = (uint32_t *) src->rsp.m1.ct_resp; 3131 b = (uint32_t *) dst->rsp.m1.ct_resp; 3132 for (i = 0; i < (ASIZE(src->rsp.m1.ct_resp) >> 2); i++) { 3133 *b++ = ISP_SWAP32(isp, *a++); 3134 } 3135 } else { 3136 ISP_IOXPUT_32(isp, src->rsp.m2.reserved0, &dst->rsp.m2.reserved0); 3137 ISP_IOXPUT_32(isp, src->rsp.m2.reserved1, &dst->rsp.m2.reserved1); 3138 ISP_IOXPUT_32(isp, src->rsp.m2.ct_datalen, &dst->rsp.m2.ct_datalen); 3139 ISP_IOXPUT_32(isp, src->rsp.m2.reserved2, &dst->rsp.m2.reserved2); 3140 ISP_IOXPUT_32(isp, src->rsp.m2.ct_fcp_rsp_iudata.ds_base, &dst->rsp.m2.ct_fcp_rsp_iudata.ds_base); 3141 ISP_IOXPUT_32(isp, src->rsp.m2.ct_fcp_rsp_iudata.ds_basehi, &dst->rsp.m2.ct_fcp_rsp_iudata.ds_basehi); 3142 ISP_IOXPUT_32(isp, src->rsp.m2.ct_fcp_rsp_iudata.ds_count, &dst->rsp.m2.ct_fcp_rsp_iudata.ds_count); 3143 } 3144 } 3145 3146 3147 void 3148 isp_get_ctio2(ispsoftc_t *isp, ct2_entry_t *src, ct2_entry_t *dst) 3149 { 3150 int i; 3151 3152 isp_get_hdr(isp, &src->ct_header, &dst->ct_header); 3153 ISP_IOXGET_32(isp, &src->ct_syshandle, dst->ct_syshandle); 3154 ISP_IOXGET_8(isp, &src->ct_lun, dst->ct_lun); 3155 ISP_IOXGET_8(isp, &src->ct_iid, dst->ct_iid); 3156 ISP_IOXGET_16(isp, &src->ct_rxid, dst->ct_rxid); 3157 ISP_IOXGET_16(isp, &src->ct_flags, dst->ct_flags); 3158 ISP_IOXGET_16(isp, &src->ct_status, dst->ct_status); 3159 ISP_IOXGET_16(isp, &src->ct_timeout, dst->ct_timeout); 3160 ISP_IOXGET_16(isp, &src->ct_seg_count, dst->ct_seg_count); 3161 ISP_IOXGET_32(isp, &src->ct_reloff, dst->ct_reloff); 3162 ISP_IOXGET_32(isp, &src->ct_resid, dst->ct_resid); 3163 if ((dst->ct_flags & CT2_FLAG_MMASK) == CT2_FLAG_MODE0) { 3164 ISP_IOXGET_32(isp, &src->rsp.m0._reserved, dst->rsp.m0._reserved); 3165 ISP_IOXGET_16(isp, &src->rsp.m0._reserved2, dst->rsp.m0._reserved2); 3166 ISP_IOXGET_16(isp, &src->rsp.m0.ct_scsi_status, dst->rsp.m0.ct_scsi_status); 3167 ISP_IOXGET_32(isp, &src->rsp.m0.ct_xfrlen, dst->rsp.m0.ct_xfrlen); 3168 if (dst->ct_header.rqs_entry_type == RQSTYPE_CTIO2) { 3169 for (i = 0; i < ISP_RQDSEG_T2; i++) { 3170 ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dataseg[i].ds_base, dst->rsp.m0.u.ct_dataseg[i].ds_base); 3171 ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dataseg[i].ds_count, dst->rsp.m0.u.ct_dataseg[i].ds_count); 3172 } 3173 } else if (dst->ct_header.rqs_entry_type == RQSTYPE_CTIO3) { 3174 for (i = 0; i < ISP_RQDSEG_T3; i++) { 3175 ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dataseg64[i].ds_base, dst->rsp.m0.u.ct_dataseg64[i].ds_base); 3176 ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dataseg64[i].ds_basehi, dst->rsp.m0.u.ct_dataseg64[i].ds_basehi); 3177 ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dataseg64[i].ds_count, dst->rsp.m0.u.ct_dataseg64[i].ds_count); 3178 } 3179 } else if (dst->ct_header.rqs_entry_type == RQSTYPE_CTIO4) { 3180 ISP_IOXGET_16(isp, &src->rsp.m0.u.ct_dslist.ds_type, dst->rsp.m0.u.ct_dslist.ds_type); 3181 ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dslist.ds_segment, dst->rsp.m0.u.ct_dslist.ds_segment); 3182 ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dslist.ds_base, dst->rsp.m0.u.ct_dslist.ds_base); 3183 } 3184 } else if ((dst->ct_flags & CT2_FLAG_MMASK) == CT2_FLAG_MODE1) { 3185 ISP_IOXGET_16(isp, &src->rsp.m1._reserved, dst->rsp.m1._reserved); 3186 ISP_IOXGET_16(isp, &src->rsp.m1._reserved2, dst->rsp.m1._reserved2); 3187 ISP_IOXGET_16(isp, &src->rsp.m1.ct_senselen, dst->rsp.m1.ct_senselen); 3188 ISP_IOXGET_16(isp, &src->rsp.m1.ct_scsi_status, dst->rsp.m1.ct_scsi_status); 3189 ISP_IOXGET_16(isp, &src->rsp.m1.ct_resplen, dst->rsp.m1.ct_resplen); 3190 for (i = 0; i < MAXRESPLEN; i++) { 3191 ISP_IOXGET_8(isp, &src->rsp.m1.ct_resp[i], dst->rsp.m1.ct_resp[i]); 3192 } 3193 } else { 3194 ISP_IOXGET_32(isp, &src->rsp.m2._reserved, dst->rsp.m2._reserved); 3195 ISP_IOXGET_16(isp, &src->rsp.m2._reserved2, dst->rsp.m2._reserved2); 3196 ISP_IOXGET_16(isp, &src->rsp.m2._reserved3, dst->rsp.m2._reserved3); 3197 ISP_IOXGET_32(isp, &src->rsp.m2.ct_datalen, dst->rsp.m2.ct_datalen); 3198 if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO2) { 3199 ISP_IOXGET_32(isp, &src->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_base, dst->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_base); 3200 ISP_IOXGET_32(isp, &src->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_count, dst->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_count); 3201 } else { 3202 ISP_IOXGET_32(isp, &src->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_base, dst->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_base); 3203 ISP_IOXGET_32(isp, &src->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_basehi, dst->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_basehi); 3204 ISP_IOXGET_32(isp, &src->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_count, dst->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_count); 3205 } 3206 } 3207 } 3208 3209 void 3210 isp_get_ctio2e(ispsoftc_t *isp, ct2e_entry_t *src, ct2e_entry_t *dst) 3211 { 3212 int i; 3213 3214 isp_get_hdr(isp, &src->ct_header, &dst->ct_header); 3215 ISP_IOXGET_32(isp, &src->ct_syshandle, dst->ct_syshandle); 3216 ISP_IOXGET_16(isp, &src->ct_iid, dst->ct_iid); 3217 ISP_IOXGET_16(isp, &src->ct_rxid, dst->ct_rxid); 3218 ISP_IOXGET_16(isp, &src->ct_flags, dst->ct_flags); 3219 ISP_IOXGET_16(isp, &src->ct_status, dst->ct_status); 3220 ISP_IOXGET_16(isp, &src->ct_timeout, dst->ct_timeout); 3221 ISP_IOXGET_16(isp, &src->ct_seg_count, dst->ct_seg_count); 3222 ISP_IOXGET_32(isp, &src->ct_reloff, dst->ct_reloff); 3223 ISP_IOXGET_32(isp, &src->ct_resid, dst->ct_resid); 3224 if ((dst->ct_flags & CT2_FLAG_MMASK) == CT2_FLAG_MODE0) { 3225 ISP_IOXGET_32(isp, &src->rsp.m0._reserved, dst->rsp.m0._reserved); 3226 ISP_IOXGET_16(isp, &src->rsp.m0._reserved2, dst->rsp.m0._reserved2); 3227 ISP_IOXGET_16(isp, &src->rsp.m0.ct_scsi_status, dst->rsp.m0.ct_scsi_status); 3228 ISP_IOXGET_32(isp, &src->rsp.m0.ct_xfrlen, dst->rsp.m0.ct_xfrlen); 3229 if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO2) { 3230 for (i = 0; i < ISP_RQDSEG_T2; i++) { 3231 ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dataseg[i].ds_base, dst->rsp.m0.u.ct_dataseg[i].ds_base); 3232 ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dataseg[i].ds_count, dst->rsp.m0.u.ct_dataseg[i].ds_count); 3233 } 3234 } else if (dst->ct_header.rqs_entry_type == RQSTYPE_CTIO3) { 3235 for (i = 0; i < ISP_RQDSEG_T3; i++) { 3236 ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dataseg64[i].ds_base, dst->rsp.m0.u.ct_dataseg64[i].ds_base); 3237 ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dataseg64[i].ds_basehi, dst->rsp.m0.u.ct_dataseg64[i].ds_basehi); 3238 ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dataseg64[i].ds_count, dst->rsp.m0.u.ct_dataseg64[i].ds_count); 3239 } 3240 } else if (dst->ct_header.rqs_entry_type == RQSTYPE_CTIO4) { 3241 ISP_IOXGET_16(isp, &src->rsp.m0.u.ct_dslist.ds_type, dst->rsp.m0.u.ct_dslist.ds_type); 3242 ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dslist.ds_segment, dst->rsp.m0.u.ct_dslist.ds_segment); 3243 ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dslist.ds_base, dst->rsp.m0.u.ct_dslist.ds_base); 3244 } 3245 } else if ((dst->ct_flags & CT2_FLAG_MMASK) == CT2_FLAG_MODE1) { 3246 ISP_IOXGET_16(isp, &src->rsp.m1._reserved, dst->rsp.m1._reserved); 3247 ISP_IOXGET_16(isp, &src->rsp.m1._reserved2, dst->rsp.m1._reserved2); 3248 ISP_IOXGET_16(isp, &src->rsp.m1.ct_senselen, dst->rsp.m1.ct_senselen); 3249 ISP_IOXGET_16(isp, &src->rsp.m1.ct_scsi_status, dst->rsp.m1.ct_scsi_status); 3250 ISP_IOXGET_16(isp, &src->rsp.m1.ct_resplen, dst->rsp.m1.ct_resplen); 3251 for (i = 0; i < MAXRESPLEN; i++) { 3252 ISP_IOXGET_8(isp, &src->rsp.m1.ct_resp[i], dst->rsp.m1.ct_resp[i]); 3253 } 3254 } else { 3255 ISP_IOXGET_32(isp, &src->rsp.m2._reserved, dst->rsp.m2._reserved); 3256 ISP_IOXGET_16(isp, &src->rsp.m2._reserved2, dst->rsp.m2._reserved2); 3257 ISP_IOXGET_16(isp, &src->rsp.m2._reserved3, dst->rsp.m2._reserved3); 3258 ISP_IOXGET_32(isp, &src->rsp.m2.ct_datalen, dst->rsp.m2.ct_datalen); 3259 if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO2) { 3260 ISP_IOXGET_32(isp, &src->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_base, dst->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_base); 3261 ISP_IOXGET_32(isp, &src->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_count, dst->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_count); 3262 } else { 3263 ISP_IOXGET_32(isp, &src->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_base, dst->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_base); 3264 ISP_IOXGET_32(isp, &src->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_basehi, dst->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_basehi); 3265 ISP_IOXGET_32(isp, &src->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_count, dst->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_count); 3266 } 3267 } 3268 } 3269 3270 void 3271 isp_get_ctio7(ispsoftc_t *isp, ct7_entry_t *src, ct7_entry_t *dst) 3272 { 3273 int i; 3274 3275 isp_get_hdr(isp, &src->ct_header, &dst->ct_header); 3276 ISP_IOXGET_32(isp, &src->ct_syshandle, dst->ct_syshandle); 3277 ISP_IOXGET_16(isp, &src->ct_nphdl, dst->ct_nphdl); 3278 ISP_IOXGET_16(isp, &src->ct_timeout, dst->ct_timeout); 3279 ISP_IOXGET_16(isp, &src->ct_seg_count, dst->ct_seg_count); 3280 ISP_IOXGET_8(isp, &src->ct_vpidx, dst->ct_vpidx); 3281 ISP_IOXGET_8(isp, &src->ct_xflags, dst->ct_xflags); 3282 ISP_IOXGET_16(isp, &src->ct_iid_lo, dst->ct_iid_lo); 3283 ISP_IOXGET_8(isp, &src->ct_iid_hi, dst->ct_iid_hi); 3284 ISP_IOXGET_8(isp, &src->ct_reserved, dst->ct_reserved); 3285 ISP_IOXGET_32(isp, &src->ct_rxid, dst->ct_rxid); 3286 ISP_IOXGET_16(isp, &src->ct_senselen, dst->ct_senselen); 3287 ISP_IOXGET_16(isp, &src->ct_flags, dst->ct_flags); 3288 ISP_IOXGET_32(isp, &src->ct_resid, dst->ct_resid); 3289 ISP_IOXGET_16(isp, &src->ct_oxid, dst->ct_oxid); 3290 ISP_IOXGET_16(isp, &src->ct_scsi_status, dst->ct_scsi_status); 3291 if ((dst->ct_flags & CT7_FLAG_MMASK) == CT7_FLAG_MODE0) { 3292 ISP_IOXGET_32(isp, &src->rsp.m0.reloff, dst->rsp.m0.reloff); 3293 ISP_IOXGET_32(isp, &src->rsp.m0.reserved0, dst->rsp.m0.reserved0); 3294 ISP_IOXGET_32(isp, &src->rsp.m0.ct_xfrlen, dst->rsp.m0.ct_xfrlen); 3295 ISP_IOXGET_32(isp, &src->rsp.m0.reserved1, dst->rsp.m0.reserved1); 3296 ISP_IOXGET_32(isp, &src->rsp.m0.ds.ds_base, dst->rsp.m0.ds.ds_base); 3297 ISP_IOXGET_32(isp, &src->rsp.m0.ds.ds_basehi, dst->rsp.m0.ds.ds_basehi); 3298 ISP_IOXGET_32(isp, &src->rsp.m0.ds.ds_count, dst->rsp.m0.ds.ds_count); 3299 } else if ((dst->ct_flags & CT7_FLAG_MMASK) == CT7_FLAG_MODE1) { 3300 uint32_t *a, *b; 3301 3302 ISP_IOXGET_16(isp, &src->rsp.m1.ct_resplen, dst->rsp.m1.ct_resplen); 3303 ISP_IOXGET_16(isp, &src->rsp.m1.reserved, dst->rsp.m1.reserved); 3304 a = (uint32_t *) src->rsp.m1.ct_resp; 3305 b = (uint32_t *) dst->rsp.m1.ct_resp; 3306 for (i = 0; i < MAXRESPLEN_24XX; i++) { 3307 ISP_IOXGET_8(isp, &src->rsp.m1.ct_resp[i], dst->rsp.m1.ct_resp[i]); 3308 } 3309 for (i = 0; i < (ASIZE(src->rsp.m1.ct_resp) >> 2); i++) { 3310 *b++ = ISP_SWAP32(isp, *a++); 3311 } 3312 } else { 3313 ISP_IOXGET_32(isp, &src->rsp.m2.reserved0, dst->rsp.m2.reserved0); 3314 ISP_IOXGET_32(isp, &src->rsp.m2.ct_datalen, dst->rsp.m2.ct_datalen); 3315 ISP_IOXGET_32(isp, &src->rsp.m2.reserved1, dst->rsp.m2.reserved1); 3316 ISP_IOXGET_32(isp, &src->rsp.m2.ct_fcp_rsp_iudata.ds_base, dst->rsp.m2.ct_fcp_rsp_iudata.ds_base); 3317 ISP_IOXGET_32(isp, &src->rsp.m2.ct_fcp_rsp_iudata.ds_basehi, dst->rsp.m2.ct_fcp_rsp_iudata.ds_basehi); 3318 ISP_IOXGET_32(isp, &src->rsp.m2.ct_fcp_rsp_iudata.ds_count, dst->rsp.m2.ct_fcp_rsp_iudata.ds_count); 3319 } 3320 } 3321 3322 void 3323 isp_put_enable_lun(ispsoftc_t *isp, lun_entry_t *lesrc, lun_entry_t *ledst) 3324 { 3325 int i; 3326 isp_put_hdr(isp, &lesrc->le_header, &ledst->le_header); 3327 ISP_IOXPUT_32(isp, lesrc->le_reserved, &ledst->le_reserved); 3328 if (ISP_IS_SBUS(isp)) { 3329 ISP_IOXPUT_8(isp, lesrc->le_lun, &ledst->le_rsvd); 3330 ISP_IOXPUT_8(isp, lesrc->le_rsvd, &ledst->le_lun); 3331 ISP_IOXPUT_8(isp, lesrc->le_ops, &ledst->le_tgt); 3332 ISP_IOXPUT_8(isp, lesrc->le_tgt, &ledst->le_ops); 3333 ISP_IOXPUT_8(isp, lesrc->le_status, &ledst->le_reserved2); 3334 ISP_IOXPUT_8(isp, lesrc->le_reserved2, &ledst->le_status); 3335 ISP_IOXPUT_8(isp, lesrc->le_cmd_count, &ledst->le_in_count); 3336 ISP_IOXPUT_8(isp, lesrc->le_in_count, &ledst->le_cmd_count); 3337 ISP_IOXPUT_8(isp, lesrc->le_cdb6len, &ledst->le_cdb7len); 3338 ISP_IOXPUT_8(isp, lesrc->le_cdb7len, &ledst->le_cdb6len); 3339 } else { 3340 ISP_IOXPUT_8(isp, lesrc->le_lun, &ledst->le_lun); 3341 ISP_IOXPUT_8(isp, lesrc->le_rsvd, &ledst->le_rsvd); 3342 ISP_IOXPUT_8(isp, lesrc->le_ops, &ledst->le_ops); 3343 ISP_IOXPUT_8(isp, lesrc->le_tgt, &ledst->le_tgt); 3344 ISP_IOXPUT_8(isp, lesrc->le_status, &ledst->le_status); 3345 ISP_IOXPUT_8(isp, lesrc->le_reserved2, &ledst->le_reserved2); 3346 ISP_IOXPUT_8(isp, lesrc->le_cmd_count, &ledst->le_cmd_count); 3347 ISP_IOXPUT_8(isp, lesrc->le_in_count, &ledst->le_in_count); 3348 ISP_IOXPUT_8(isp, lesrc->le_cdb6len, &ledst->le_cdb6len); 3349 ISP_IOXPUT_8(isp, lesrc->le_cdb7len, &ledst->le_cdb7len); 3350 } 3351 ISP_IOXPUT_32(isp, lesrc->le_flags, &ledst->le_flags); 3352 ISP_IOXPUT_16(isp, lesrc->le_timeout, &ledst->le_timeout); 3353 for (i = 0; i < 20; i++) { 3354 ISP_IOXPUT_8(isp, lesrc->le_reserved3[i], &ledst->le_reserved3[i]); 3355 } 3356 } 3357 3358 void 3359 isp_get_enable_lun(ispsoftc_t *isp, lun_entry_t *lesrc, lun_entry_t *ledst) 3360 { 3361 int i; 3362 isp_get_hdr(isp, &lesrc->le_header, &ledst->le_header); 3363 ISP_IOXGET_32(isp, &lesrc->le_reserved, ledst->le_reserved); 3364 if (ISP_IS_SBUS(isp)) { 3365 ISP_IOXGET_8(isp, &lesrc->le_lun, ledst->le_rsvd); 3366 ISP_IOXGET_8(isp, &lesrc->le_rsvd, ledst->le_lun); 3367 ISP_IOXGET_8(isp, &lesrc->le_ops, ledst->le_tgt); 3368 ISP_IOXGET_8(isp, &lesrc->le_tgt, ledst->le_ops); 3369 ISP_IOXGET_8(isp, &lesrc->le_status, ledst->le_reserved2); 3370 ISP_IOXGET_8(isp, &lesrc->le_reserved2, ledst->le_status); 3371 ISP_IOXGET_8(isp, &lesrc->le_cmd_count, ledst->le_in_count); 3372 ISP_IOXGET_8(isp, &lesrc->le_in_count, ledst->le_cmd_count); 3373 ISP_IOXGET_8(isp, &lesrc->le_cdb6len, ledst->le_cdb7len); 3374 ISP_IOXGET_8(isp, &lesrc->le_cdb7len, ledst->le_cdb6len); 3375 } else { 3376 ISP_IOXGET_8(isp, &lesrc->le_lun, ledst->le_lun); 3377 ISP_IOXGET_8(isp, &lesrc->le_rsvd, ledst->le_rsvd); 3378 ISP_IOXGET_8(isp, &lesrc->le_ops, ledst->le_ops); 3379 ISP_IOXGET_8(isp, &lesrc->le_tgt, ledst->le_tgt); 3380 ISP_IOXGET_8(isp, &lesrc->le_status, ledst->le_status); 3381 ISP_IOXGET_8(isp, &lesrc->le_reserved2, ledst->le_reserved2); 3382 ISP_IOXGET_8(isp, &lesrc->le_cmd_count, ledst->le_cmd_count); 3383 ISP_IOXGET_8(isp, &lesrc->le_in_count, ledst->le_in_count); 3384 ISP_IOXGET_8(isp, &lesrc->le_cdb6len, ledst->le_cdb6len); 3385 ISP_IOXGET_8(isp, &lesrc->le_cdb7len, ledst->le_cdb7len); 3386 } 3387 ISP_IOXGET_32(isp, &lesrc->le_flags, ledst->le_flags); 3388 ISP_IOXGET_16(isp, &lesrc->le_timeout, ledst->le_timeout); 3389 for (i = 0; i < 20; i++) { 3390 ISP_IOXGET_8(isp, &lesrc->le_reserved3[i], ledst->le_reserved3[i]); 3391 } 3392 } 3393 3394 void 3395 isp_put_notify(ispsoftc_t *isp, in_entry_t *src, in_entry_t *dst) 3396 { 3397 int i; 3398 isp_put_hdr(isp, &src->in_header, &dst->in_header); 3399 ISP_IOXPUT_32(isp, src->in_reserved, &dst->in_reserved); 3400 if (ISP_IS_SBUS(isp)) { 3401 ISP_IOXPUT_8(isp, src->in_lun, &dst->in_iid); 3402 ISP_IOXPUT_8(isp, src->in_iid, &dst->in_lun); 3403 ISP_IOXPUT_8(isp, src->in_reserved2, &dst->in_tgt); 3404 ISP_IOXPUT_8(isp, src->in_tgt, &dst->in_reserved2); 3405 ISP_IOXPUT_8(isp, src->in_status, &dst->in_rsvd2); 3406 ISP_IOXPUT_8(isp, src->in_rsvd2, &dst->in_status); 3407 ISP_IOXPUT_8(isp, src->in_tag_val, &dst->in_tag_type); 3408 ISP_IOXPUT_8(isp, src->in_tag_type, &dst->in_tag_val); 3409 } else { 3410 ISP_IOXPUT_8(isp, src->in_lun, &dst->in_lun); 3411 ISP_IOXPUT_8(isp, src->in_iid, &dst->in_iid); 3412 ISP_IOXPUT_8(isp, src->in_reserved2, &dst->in_reserved2); 3413 ISP_IOXPUT_8(isp, src->in_tgt, &dst->in_tgt); 3414 ISP_IOXPUT_8(isp, src->in_status, &dst->in_status); 3415 ISP_IOXPUT_8(isp, src->in_rsvd2, &dst->in_rsvd2); 3416 ISP_IOXPUT_8(isp, src->in_tag_val, &dst->in_tag_val); 3417 ISP_IOXPUT_8(isp, src->in_tag_type, &dst->in_tag_type); 3418 } 3419 ISP_IOXPUT_32(isp, src->in_flags, &dst->in_flags); 3420 ISP_IOXPUT_16(isp, src->in_seqid, &dst->in_seqid); 3421 for (i = 0; i < IN_MSGLEN; i++) { 3422 ISP_IOXPUT_8(isp, src->in_msg[i], &dst->in_msg[i]); 3423 } 3424 for (i = 0; i < IN_RSVDLEN; i++) { 3425 ISP_IOXPUT_8(isp, src->in_reserved3[i], &dst->in_reserved3[i]); 3426 } 3427 for (i = 0; i < QLTM_SENSELEN; i++) { 3428 ISP_IOXPUT_8(isp, src->in_sense[i], &dst->in_sense[i]); 3429 } 3430 } 3431 3432 void 3433 isp_get_notify(ispsoftc_t *isp, in_entry_t *src, in_entry_t *dst) 3434 { 3435 int i; 3436 isp_get_hdr(isp, &src->in_header, &dst->in_header); 3437 ISP_IOXGET_32(isp, &src->in_reserved, dst->in_reserved); 3438 if (ISP_IS_SBUS(isp)) { 3439 ISP_IOXGET_8(isp, &src->in_lun, dst->in_iid); 3440 ISP_IOXGET_8(isp, &src->in_iid, dst->in_lun); 3441 ISP_IOXGET_8(isp, &src->in_reserved2, dst->in_tgt); 3442 ISP_IOXGET_8(isp, &src->in_tgt, dst->in_reserved2); 3443 ISP_IOXGET_8(isp, &src->in_status, dst->in_rsvd2); 3444 ISP_IOXGET_8(isp, &src->in_rsvd2, dst->in_status); 3445 ISP_IOXGET_8(isp, &src->in_tag_val, dst->in_tag_type); 3446 ISP_IOXGET_8(isp, &src->in_tag_type, dst->in_tag_val); 3447 } else { 3448 ISP_IOXGET_8(isp, &src->in_lun, dst->in_lun); 3449 ISP_IOXGET_8(isp, &src->in_iid, dst->in_iid); 3450 ISP_IOXGET_8(isp, &src->in_reserved2, dst->in_reserved2); 3451 ISP_IOXGET_8(isp, &src->in_tgt, dst->in_tgt); 3452 ISP_IOXGET_8(isp, &src->in_status, dst->in_status); 3453 ISP_IOXGET_8(isp, &src->in_rsvd2, dst->in_rsvd2); 3454 ISP_IOXGET_8(isp, &src->in_tag_val, dst->in_tag_val); 3455 ISP_IOXGET_8(isp, &src->in_tag_type, dst->in_tag_type); 3456 } 3457 ISP_IOXGET_32(isp, &src->in_flags, dst->in_flags); 3458 ISP_IOXGET_16(isp, &src->in_seqid, dst->in_seqid); 3459 for (i = 0; i < IN_MSGLEN; i++) { 3460 ISP_IOXGET_8(isp, &src->in_msg[i], dst->in_msg[i]); 3461 } 3462 for (i = 0; i < IN_RSVDLEN; i++) { 3463 ISP_IOXGET_8(isp, &src->in_reserved3[i], dst->in_reserved3[i]); 3464 } 3465 for (i = 0; i < QLTM_SENSELEN; i++) { 3466 ISP_IOXGET_8(isp, &src->in_sense[i], dst->in_sense[i]); 3467 } 3468 } 3469 3470 void 3471 isp_put_notify_fc(ispsoftc_t *isp, in_fcentry_t *src, in_fcentry_t *dst) 3472 { 3473 isp_put_hdr(isp, &src->in_header, &dst->in_header); 3474 ISP_IOXPUT_32(isp, src->in_reserved, &dst->in_reserved); 3475 ISP_IOXPUT_8(isp, src->in_lun, &dst->in_lun); 3476 ISP_IOXPUT_8(isp, src->in_iid, &dst->in_iid); 3477 ISP_IOXPUT_16(isp, src->in_scclun, &dst->in_scclun); 3478 ISP_IOXPUT_32(isp, src->in_reserved2, &dst->in_reserved2); 3479 ISP_IOXPUT_16(isp, src->in_status, &dst->in_status); 3480 ISP_IOXPUT_16(isp, src->in_task_flags, &dst->in_task_flags); 3481 ISP_IOXPUT_16(isp, src->in_seqid, &dst->in_seqid); 3482 } 3483 3484 void 3485 isp_put_notify_fc_e(ispsoftc_t *isp, in_fcentry_e_t *src, in_fcentry_e_t *dst) 3486 { 3487 isp_put_hdr(isp, &src->in_header, &dst->in_header); 3488 ISP_IOXPUT_32(isp, src->in_reserved, &dst->in_reserved); 3489 ISP_IOXPUT_16(isp, src->in_iid, &dst->in_iid); 3490 ISP_IOXPUT_16(isp, src->in_scclun, &dst->in_scclun); 3491 ISP_IOXPUT_32(isp, src->in_reserved2, &dst->in_reserved2); 3492 ISP_IOXPUT_16(isp, src->in_status, &dst->in_status); 3493 ISP_IOXPUT_16(isp, src->in_task_flags, &dst->in_task_flags); 3494 ISP_IOXPUT_16(isp, src->in_seqid, &dst->in_seqid); 3495 } 3496 3497 void 3498 isp_put_notify_24xx(ispsoftc_t *isp, in_fcentry_24xx_t *src, in_fcentry_24xx_t *dst) 3499 { 3500 int i; 3501 3502 isp_put_hdr(isp, &src->in_header, &dst->in_header); 3503 ISP_IOXPUT_32(isp, src->in_reserved, &dst->in_reserved); 3504 ISP_IOXPUT_16(isp, src->in_nphdl, &dst->in_nphdl); 3505 ISP_IOXPUT_16(isp, src->in_reserved1, &dst->in_reserved1); 3506 ISP_IOXPUT_16(isp, src->in_flags, &dst->in_flags); 3507 ISP_IOXPUT_16(isp, src->in_srr_rxid, &dst->in_srr_rxid); 3508 ISP_IOXPUT_16(isp, src->in_status, &dst->in_status); 3509 ISP_IOXPUT_8(isp, src->in_status_subcode, &dst->in_status_subcode); 3510 ISP_IOXPUT_16(isp, src->in_reserved2, &dst->in_reserved2); 3511 ISP_IOXPUT_32(isp, src->in_rxid, &dst->in_rxid); 3512 ISP_IOXPUT_16(isp, src->in_srr_reloff_hi, &dst->in_srr_reloff_hi); 3513 ISP_IOXPUT_16(isp, src->in_srr_reloff_lo, &dst->in_srr_reloff_lo); 3514 ISP_IOXPUT_16(isp, src->in_srr_iu, &dst->in_srr_iu); 3515 ISP_IOXPUT_16(isp, src->in_srr_oxid, &dst->in_srr_oxid); 3516 ISP_IOXPUT_16(isp, src->in_nport_id_hi, &dst->in_nport_id_hi); 3517 ISP_IOXPUT_8(isp, src->in_nport_id_lo, &dst->in_nport_id_lo); 3518 ISP_IOXPUT_8(isp, src->in_reserved3, &dst->in_reserved3); 3519 ISP_IOXPUT_16(isp, src->in_np_handle, &dst->in_np_handle); 3520 for (i = 0; i < ASIZE(src->in_reserved4); i++) { 3521 ISP_IOXPUT_8(isp, src->in_reserved4[i], &dst->in_reserved4[i]); 3522 } 3523 ISP_IOXPUT_8(isp, src->in_reserved5, &dst->in_reserved5); 3524 ISP_IOXPUT_8(isp, src->in_vpidx, &dst->in_vpidx); 3525 ISP_IOXPUT_32(isp, src->in_reserved6, &dst->in_reserved6); 3526 ISP_IOXPUT_16(isp, src->in_portid_lo, &dst->in_portid_lo); 3527 ISP_IOXPUT_8(isp, src->in_portid_hi, &dst->in_portid_hi); 3528 ISP_IOXPUT_8(isp, src->in_reserved7, &dst->in_reserved7); 3529 ISP_IOXPUT_16(isp, src->in_reserved8, &dst->in_reserved8); 3530 ISP_IOXPUT_16(isp, src->in_oxid, &dst->in_oxid); 3531 } 3532 3533 void 3534 isp_get_notify_fc(ispsoftc_t *isp, in_fcentry_t *src, in_fcentry_t *dst) 3535 { 3536 isp_get_hdr(isp, &src->in_header, &dst->in_header); 3537 ISP_IOXGET_32(isp, &src->in_reserved, dst->in_reserved); 3538 ISP_IOXGET_8(isp, &src->in_lun, dst->in_lun); 3539 ISP_IOXGET_8(isp, &src->in_iid, dst->in_iid); 3540 ISP_IOXGET_16(isp, &src->in_scclun, dst->in_scclun); 3541 ISP_IOXGET_32(isp, &src->in_reserved2, dst->in_reserved2); 3542 ISP_IOXGET_16(isp, &src->in_status, dst->in_status); 3543 ISP_IOXGET_16(isp, &src->in_task_flags, dst->in_task_flags); 3544 ISP_IOXGET_16(isp, &src->in_seqid, dst->in_seqid); 3545 } 3546 3547 void 3548 isp_get_notify_fc_e(ispsoftc_t *isp, in_fcentry_e_t *src, in_fcentry_e_t *dst) 3549 { 3550 isp_get_hdr(isp, &src->in_header, &dst->in_header); 3551 ISP_IOXGET_32(isp, &src->in_reserved, dst->in_reserved); 3552 ISP_IOXGET_16(isp, &src->in_iid, dst->in_iid); 3553 ISP_IOXGET_16(isp, &src->in_scclun, dst->in_scclun); 3554 ISP_IOXGET_32(isp, &src->in_reserved2, dst->in_reserved2); 3555 ISP_IOXGET_16(isp, &src->in_status, dst->in_status); 3556 ISP_IOXGET_16(isp, &src->in_task_flags, dst->in_task_flags); 3557 ISP_IOXGET_16(isp, &src->in_seqid, dst->in_seqid); 3558 } 3559 3560 void 3561 isp_get_notify_24xx(ispsoftc_t *isp, in_fcentry_24xx_t *src, in_fcentry_24xx_t *dst) 3562 { 3563 int i; 3564 3565 isp_get_hdr(isp, &src->in_header, &dst->in_header); 3566 ISP_IOXGET_32(isp, &src->in_reserved, dst->in_reserved); 3567 ISP_IOXGET_16(isp, &src->in_nphdl, dst->in_nphdl); 3568 ISP_IOXGET_16(isp, &src->in_reserved1, dst->in_reserved1); 3569 ISP_IOXGET_16(isp, &src->in_flags, dst->in_flags); 3570 ISP_IOXGET_16(isp, &src->in_srr_rxid, dst->in_srr_rxid); 3571 ISP_IOXGET_16(isp, &src->in_status, dst->in_status); 3572 ISP_IOXGET_8(isp, &src->in_status_subcode, dst->in_status_subcode); 3573 ISP_IOXGET_16(isp, &src->in_reserved2, dst->in_reserved2); 3574 ISP_IOXGET_32(isp, &src->in_rxid, dst->in_rxid); 3575 ISP_IOXGET_16(isp, &src->in_srr_reloff_hi, dst->in_srr_reloff_hi); 3576 ISP_IOXGET_16(isp, &src->in_srr_reloff_lo, dst->in_srr_reloff_lo); 3577 ISP_IOXGET_16(isp, &src->in_srr_iu, dst->in_srr_iu); 3578 ISP_IOXGET_16(isp, &src->in_srr_oxid, dst->in_srr_oxid); 3579 ISP_IOXGET_16(isp, &src->in_nport_id_hi, dst->in_nport_id_hi); 3580 ISP_IOXGET_8(isp, &src->in_nport_id_lo, dst->in_nport_id_lo); 3581 ISP_IOXGET_8(isp, &src->in_reserved3, dst->in_reserved3); 3582 ISP_IOXGET_16(isp, &src->in_np_handle, dst->in_np_handle); 3583 for (i = 0; i < ASIZE(src->in_reserved4); i++) { 3584 ISP_IOXGET_8(isp, &src->in_reserved4[i], dst->in_reserved4[i]); 3585 } 3586 ISP_IOXGET_8(isp, &src->in_reserved5, dst->in_reserved5); 3587 ISP_IOXGET_8(isp, &src->in_vpidx, dst->in_vpidx); 3588 ISP_IOXGET_32(isp, &src->in_reserved6, dst->in_reserved6); 3589 ISP_IOXGET_16(isp, &src->in_portid_lo, dst->in_portid_lo); 3590 ISP_IOXGET_8(isp, &src->in_portid_hi, dst->in_portid_hi); 3591 ISP_IOXGET_8(isp, &src->in_reserved7, dst->in_reserved7); 3592 ISP_IOXGET_16(isp, &src->in_reserved8, dst->in_reserved8); 3593 ISP_IOXGET_16(isp, &src->in_oxid, dst->in_oxid); 3594 } 3595 3596 void 3597 isp_put_notify_ack(ispsoftc_t *isp, na_entry_t *src, na_entry_t *dst) 3598 { 3599 int i; 3600 isp_put_hdr(isp, &src->na_header, &dst->na_header); 3601 ISP_IOXPUT_32(isp, src->na_reserved, &dst->na_reserved); 3602 if (ISP_IS_SBUS(isp)) { 3603 ISP_IOXPUT_8(isp, src->na_lun, &dst->na_iid); 3604 ISP_IOXPUT_8(isp, src->na_iid, &dst->na_lun); 3605 ISP_IOXPUT_8(isp, src->na_status, &dst->na_event); 3606 ISP_IOXPUT_8(isp, src->na_event, &dst->na_status); 3607 } else { 3608 ISP_IOXPUT_8(isp, src->na_lun, &dst->na_lun); 3609 ISP_IOXPUT_8(isp, src->na_iid, &dst->na_iid); 3610 ISP_IOXPUT_8(isp, src->na_status, &dst->na_status); 3611 ISP_IOXPUT_8(isp, src->na_event, &dst->na_event); 3612 } 3613 ISP_IOXPUT_32(isp, src->na_flags, &dst->na_flags); 3614 for (i = 0; i < NA_RSVDLEN; i++) { 3615 ISP_IOXPUT_16(isp, src->na_reserved3[i], &dst->na_reserved3[i]); 3616 } 3617 } 3618 3619 void 3620 isp_get_notify_ack(ispsoftc_t *isp, na_entry_t *src, na_entry_t *dst) 3621 { 3622 int i; 3623 isp_get_hdr(isp, &src->na_header, &dst->na_header); 3624 ISP_IOXGET_32(isp, &src->na_reserved, dst->na_reserved); 3625 if (ISP_IS_SBUS(isp)) { 3626 ISP_IOXGET_8(isp, &src->na_lun, dst->na_iid); 3627 ISP_IOXGET_8(isp, &src->na_iid, dst->na_lun); 3628 ISP_IOXGET_8(isp, &src->na_status, dst->na_event); 3629 ISP_IOXGET_8(isp, &src->na_event, dst->na_status); 3630 } else { 3631 ISP_IOXGET_8(isp, &src->na_lun, dst->na_lun); 3632 ISP_IOXGET_8(isp, &src->na_iid, dst->na_iid); 3633 ISP_IOXGET_8(isp, &src->na_status, dst->na_status); 3634 ISP_IOXGET_8(isp, &src->na_event, dst->na_event); 3635 } 3636 ISP_IOXGET_32(isp, &src->na_flags, dst->na_flags); 3637 for (i = 0; i < NA_RSVDLEN; i++) { 3638 ISP_IOXGET_16(isp, &src->na_reserved3[i], dst->na_reserved3[i]); 3639 } 3640 } 3641 3642 void 3643 isp_put_notify_ack_fc(ispsoftc_t *isp, na_fcentry_t *src, na_fcentry_t *dst) 3644 { 3645 int i; 3646 isp_put_hdr(isp, &src->na_header, &dst->na_header); 3647 ISP_IOXPUT_32(isp, src->na_reserved, &dst->na_reserved); 3648 ISP_IOXPUT_8(isp, src->na_reserved1, &dst->na_reserved1); 3649 ISP_IOXPUT_8(isp, src->na_iid, &dst->na_iid); 3650 ISP_IOXPUT_16(isp, src->na_response, &dst->na_response); 3651 ISP_IOXPUT_16(isp, src->na_flags, &dst->na_flags); 3652 ISP_IOXPUT_16(isp, src->na_reserved2, &dst->na_reserved2); 3653 ISP_IOXPUT_16(isp, src->na_status, &dst->na_status); 3654 ISP_IOXPUT_16(isp, src->na_task_flags, &dst->na_task_flags); 3655 ISP_IOXPUT_16(isp, src->na_seqid, &dst->na_seqid); 3656 for (i = 0; i < NA2_RSVDLEN; i++) { 3657 ISP_IOXPUT_16(isp, src->na_reserved3[i], &dst->na_reserved3[i]); 3658 } 3659 } 3660 3661 void 3662 isp_put_notify_ack_fc_e(ispsoftc_t *isp, na_fcentry_e_t *src, na_fcentry_e_t *dst) 3663 { 3664 int i; 3665 isp_put_hdr(isp, &src->na_header, &dst->na_header); 3666 ISP_IOXPUT_32(isp, src->na_reserved, &dst->na_reserved); 3667 ISP_IOXPUT_16(isp, src->na_iid, &dst->na_iid); 3668 ISP_IOXPUT_16(isp, src->na_response, &dst->na_response); 3669 ISP_IOXPUT_16(isp, src->na_flags, &dst->na_flags); 3670 ISP_IOXPUT_16(isp, src->na_reserved2, &dst->na_reserved2); 3671 ISP_IOXPUT_16(isp, src->na_status, &dst->na_status); 3672 ISP_IOXPUT_16(isp, src->na_task_flags, &dst->na_task_flags); 3673 ISP_IOXPUT_16(isp, src->na_seqid, &dst->na_seqid); 3674 for (i = 0; i < NA2_RSVDLEN; i++) { 3675 ISP_IOXPUT_16(isp, src->na_reserved3[i], &dst->na_reserved3[i]); 3676 } 3677 } 3678 3679 void 3680 isp_put_notify_24xx_ack(ispsoftc_t *isp, na_fcentry_24xx_t *src, na_fcentry_24xx_t *dst) 3681 { 3682 int i; 3683 3684 isp_put_hdr(isp, &src->na_header, &dst->na_header); 3685 ISP_IOXPUT_32(isp, src->na_handle, &dst->na_handle); 3686 ISP_IOXPUT_16(isp, src->na_nphdl, &dst->na_nphdl); 3687 ISP_IOXPUT_16(isp, src->na_reserved1, &dst->na_reserved1); 3688 ISP_IOXPUT_16(isp, src->na_flags, &dst->na_flags); 3689 ISP_IOXPUT_16(isp, src->na_srr_rxid, &dst->na_srr_rxid); 3690 ISP_IOXPUT_16(isp, src->na_status, &dst->na_status); 3691 ISP_IOXPUT_8(isp, src->na_status_subcode, &dst->na_status_subcode); 3692 ISP_IOXPUT_16(isp, src->na_reserved2, &dst->na_reserved2); 3693 ISP_IOXPUT_32(isp, src->na_rxid, &dst->na_rxid); 3694 ISP_IOXPUT_16(isp, src->na_srr_reloff_hi, &dst->na_srr_reloff_hi); 3695 ISP_IOXPUT_16(isp, src->na_srr_reloff_lo, &dst->na_srr_reloff_lo); 3696 ISP_IOXPUT_16(isp, src->na_srr_iu, &dst->na_srr_iu); 3697 ISP_IOXPUT_16(isp, src->na_srr_flags, &dst->na_srr_flags); 3698 for (i = 0; i < 18; i++) { 3699 ISP_IOXPUT_8(isp, src->na_reserved3[i], &dst->na_reserved3[i]); 3700 } 3701 ISP_IOXPUT_8(isp, src->na_reserved4, &dst->na_reserved4); 3702 ISP_IOXPUT_8(isp, src->na_vpidx, &dst->na_vpidx); 3703 ISP_IOXPUT_8(isp, src->na_srr_reject_vunique, &dst->na_srr_reject_vunique); 3704 ISP_IOXPUT_8(isp, src->na_srr_reject_explanation, &dst->na_srr_reject_explanation); 3705 ISP_IOXPUT_8(isp, src->na_srr_reject_code, &dst->na_srr_reject_code); 3706 ISP_IOXPUT_8(isp, src->na_reserved5, &dst->na_reserved5); 3707 for (i = 0; i < 6; i++) { 3708 ISP_IOXPUT_8(isp, src->na_reserved6[i], &dst->na_reserved6[i]); 3709 } 3710 ISP_IOXPUT_16(isp, src->na_oxid, &dst->na_oxid); 3711 } 3712 3713 void 3714 isp_get_notify_ack_fc(ispsoftc_t *isp, na_fcentry_t *src, na_fcentry_t *dst) 3715 { 3716 int i; 3717 isp_get_hdr(isp, &src->na_header, &dst->na_header); 3718 ISP_IOXGET_32(isp, &src->na_reserved, dst->na_reserved); 3719 ISP_IOXGET_8(isp, &src->na_reserved1, dst->na_reserved1); 3720 ISP_IOXGET_8(isp, &src->na_iid, dst->na_iid); 3721 ISP_IOXGET_16(isp, &src->na_response, dst->na_response); 3722 ISP_IOXGET_16(isp, &src->na_flags, dst->na_flags); 3723 ISP_IOXGET_16(isp, &src->na_reserved2, dst->na_reserved2); 3724 ISP_IOXGET_16(isp, &src->na_status, dst->na_status); 3725 ISP_IOXGET_16(isp, &src->na_task_flags, dst->na_task_flags); 3726 ISP_IOXGET_16(isp, &src->na_seqid, dst->na_seqid); 3727 for (i = 0; i < NA2_RSVDLEN; i++) { 3728 ISP_IOXGET_16(isp, &src->na_reserved3[i], dst->na_reserved3[i]); 3729 } 3730 } 3731 3732 void 3733 isp_get_notify_ack_fc_e(ispsoftc_t *isp, na_fcentry_e_t *src, na_fcentry_e_t *dst) 3734 { 3735 int i; 3736 isp_get_hdr(isp, &src->na_header, &dst->na_header); 3737 ISP_IOXGET_32(isp, &src->na_reserved, dst->na_reserved); 3738 ISP_IOXGET_16(isp, &src->na_iid, dst->na_iid); 3739 ISP_IOXGET_16(isp, &src->na_response, dst->na_response); 3740 ISP_IOXGET_16(isp, &src->na_flags, dst->na_flags); 3741 ISP_IOXGET_16(isp, &src->na_reserved2, dst->na_reserved2); 3742 ISP_IOXGET_16(isp, &src->na_status, dst->na_status); 3743 ISP_IOXGET_16(isp, &src->na_task_flags, dst->na_task_flags); 3744 ISP_IOXGET_16(isp, &src->na_seqid, dst->na_seqid); 3745 for (i = 0; i < NA2_RSVDLEN; i++) { 3746 ISP_IOXGET_16(isp, &src->na_reserved3[i], dst->na_reserved3[i]); 3747 } 3748 } 3749 3750 void 3751 isp_get_notify_ack_24xx(ispsoftc_t *isp, na_fcentry_24xx_t *src, na_fcentry_24xx_t *dst) 3752 { 3753 int i; 3754 3755 isp_get_hdr(isp, &src->na_header, &dst->na_header); 3756 ISP_IOXGET_32(isp, &src->na_handle, dst->na_handle); 3757 ISP_IOXGET_16(isp, &src->na_nphdl, dst->na_nphdl); 3758 ISP_IOXGET_16(isp, &src->na_reserved1, dst->na_reserved1); 3759 ISP_IOXGET_16(isp, &src->na_flags, dst->na_flags); 3760 ISP_IOXGET_16(isp, &src->na_srr_rxid, dst->na_srr_rxid); 3761 ISP_IOXGET_16(isp, &src->na_status, dst->na_status); 3762 ISP_IOXGET_8(isp, &src->na_status_subcode, dst->na_status_subcode); 3763 ISP_IOXGET_16(isp, &src->na_reserved2, dst->na_reserved2); 3764 ISP_IOXGET_32(isp, &src->na_rxid, dst->na_rxid); 3765 ISP_IOXGET_16(isp, &src->na_srr_reloff_hi, dst->na_srr_reloff_hi); 3766 ISP_IOXGET_16(isp, &src->na_srr_reloff_lo, dst->na_srr_reloff_lo); 3767 ISP_IOXGET_16(isp, &src->na_srr_iu, dst->na_srr_iu); 3768 ISP_IOXGET_16(isp, &src->na_srr_flags, dst->na_srr_flags); 3769 for (i = 0; i < 18; i++) { 3770 ISP_IOXGET_8(isp, &src->na_reserved3[i], dst->na_reserved3[i]); 3771 } 3772 ISP_IOXGET_8(isp, &src->na_reserved4, dst->na_reserved4); 3773 ISP_IOXGET_8(isp, &src->na_vpidx, dst->na_vpidx); 3774 ISP_IOXGET_8(isp, &src->na_srr_reject_vunique, dst->na_srr_reject_vunique); 3775 ISP_IOXGET_8(isp, &src->na_srr_reject_explanation, dst->na_srr_reject_explanation); 3776 ISP_IOXGET_8(isp, &src->na_srr_reject_code, dst->na_srr_reject_code); 3777 ISP_IOXGET_8(isp, &src->na_reserved5, dst->na_reserved5); 3778 for (i = 0; i < 6; i++) { 3779 ISP_IOXGET_8(isp, &src->na_reserved6[i], dst->na_reserved6[i]); 3780 } 3781 ISP_IOXGET_16(isp, &src->na_oxid, dst->na_oxid); 3782 } 3783 3784 void 3785 isp_get_abts(ispsoftc_t *isp, abts_t *src, abts_t *dst) 3786 { 3787 int i; 3788 3789 isp_get_hdr(isp, &src->abts_header, &dst->abts_header); 3790 for (i = 0; i < 6; i++) { 3791 ISP_IOXGET_8(isp, &src->abts_reserved0[i], dst->abts_reserved0[i]); 3792 } 3793 ISP_IOXGET_16(isp, &src->abts_nphdl, dst->abts_nphdl); 3794 ISP_IOXGET_16(isp, &src->abts_reserved1, dst->abts_reserved1); 3795 ISP_IOXGET_16(isp, &src->abts_sof, dst->abts_sof); 3796 ISP_IOXGET_32(isp, &src->abts_rxid_abts, dst->abts_rxid_abts); 3797 ISP_IOXGET_16(isp, &src->abts_did_lo, dst->abts_did_lo); 3798 ISP_IOXGET_8(isp, &src->abts_did_hi, dst->abts_did_hi); 3799 ISP_IOXGET_8(isp, &src->abts_r_ctl, dst->abts_r_ctl); 3800 ISP_IOXGET_16(isp, &src->abts_sid_lo, dst->abts_sid_lo); 3801 ISP_IOXGET_8(isp, &src->abts_sid_hi, dst->abts_sid_hi); 3802 ISP_IOXGET_8(isp, &src->abts_cs_ctl, dst->abts_cs_ctl); 3803 ISP_IOXGET_16(isp, &src->abts_fs_ctl, dst->abts_fs_ctl); 3804 ISP_IOXGET_8(isp, &src->abts_f_ctl, dst->abts_f_ctl); 3805 ISP_IOXGET_8(isp, &src->abts_type, dst->abts_type); 3806 ISP_IOXGET_16(isp, &src->abts_seq_cnt, dst->abts_seq_cnt); 3807 ISP_IOXGET_8(isp, &src->abts_df_ctl, dst->abts_df_ctl); 3808 ISP_IOXGET_8(isp, &src->abts_seq_id, dst->abts_seq_id); 3809 ISP_IOXGET_16(isp, &src->abts_rx_id, dst->abts_rx_id); 3810 ISP_IOXGET_16(isp, &src->abts_ox_id, dst->abts_ox_id); 3811 ISP_IOXGET_32(isp, &src->abts_param, dst->abts_param); 3812 for (i = 0; i < 16; i++) { 3813 ISP_IOXGET_8(isp, &src->abts_reserved2[i], dst->abts_reserved2[i]); 3814 } 3815 ISP_IOXGET_32(isp, &src->abts_rxid_task, dst->abts_rxid_task); 3816 } 3817 3818 void 3819 isp_put_abts_rsp(ispsoftc_t *isp, abts_rsp_t *src, abts_rsp_t *dst) 3820 { 3821 int i; 3822 3823 isp_put_hdr(isp, &src->abts_rsp_header, &dst->abts_rsp_header); 3824 ISP_IOXPUT_32(isp, src->abts_rsp_handle, &dst->abts_rsp_handle); 3825 ISP_IOXPUT_16(isp, src->abts_rsp_status, &dst->abts_rsp_status); 3826 ISP_IOXPUT_16(isp, src->abts_rsp_nphdl, &dst->abts_rsp_nphdl); 3827 ISP_IOXPUT_16(isp, src->abts_rsp_ctl_flags, &dst->abts_rsp_ctl_flags); 3828 ISP_IOXPUT_16(isp, src->abts_rsp_sof, &dst->abts_rsp_sof); 3829 ISP_IOXPUT_32(isp, src->abts_rsp_rxid_abts, &dst->abts_rsp_rxid_abts); 3830 ISP_IOXPUT_16(isp, src->abts_rsp_did_lo, &dst->abts_rsp_did_lo); 3831 ISP_IOXPUT_8(isp, src->abts_rsp_did_hi, &dst->abts_rsp_did_hi); 3832 ISP_IOXPUT_8(isp, src->abts_rsp_r_ctl, &dst->abts_rsp_r_ctl); 3833 ISP_IOXPUT_16(isp, src->abts_rsp_sid_lo, &dst->abts_rsp_sid_lo); 3834 ISP_IOXPUT_8(isp, src->abts_rsp_sid_hi, &dst->abts_rsp_sid_hi); 3835 ISP_IOXPUT_8(isp, src->abts_rsp_cs_ctl, &dst->abts_rsp_cs_ctl); 3836 ISP_IOXPUT_16(isp, src->abts_rsp_f_ctl_lo, &dst->abts_rsp_f_ctl_lo); 3837 ISP_IOXPUT_8(isp, src->abts_rsp_f_ctl_hi, &dst->abts_rsp_f_ctl_hi); 3838 ISP_IOXPUT_8(isp, src->abts_rsp_type, &dst->abts_rsp_type); 3839 ISP_IOXPUT_16(isp, src->abts_rsp_seq_cnt, &dst->abts_rsp_seq_cnt); 3840 ISP_IOXPUT_8(isp, src->abts_rsp_df_ctl, &dst->abts_rsp_df_ctl); 3841 ISP_IOXPUT_8(isp, src->abts_rsp_seq_id, &dst->abts_rsp_seq_id); 3842 ISP_IOXPUT_16(isp, src->abts_rsp_rx_id, &dst->abts_rsp_rx_id); 3843 ISP_IOXPUT_16(isp, src->abts_rsp_ox_id, &dst->abts_rsp_ox_id); 3844 ISP_IOXPUT_32(isp, src->abts_rsp_param, &dst->abts_rsp_param); 3845 if (src->abts_rsp_r_ctl == BA_ACC) { 3846 ISP_IOXPUT_16(isp, src->abts_rsp_payload.ba_acc.reserved, &dst->abts_rsp_payload.ba_acc.reserved); 3847 ISP_IOXPUT_8(isp, src->abts_rsp_payload.ba_acc.last_seq_id, &dst->abts_rsp_payload.ba_acc.last_seq_id); 3848 ISP_IOXPUT_8(isp, src->abts_rsp_payload.ba_acc.seq_id_valid, &dst->abts_rsp_payload.ba_acc.seq_id_valid); 3849 ISP_IOXPUT_16(isp, src->abts_rsp_payload.ba_acc.aborted_rx_id, &dst->abts_rsp_payload.ba_acc.aborted_rx_id); 3850 ISP_IOXPUT_16(isp, src->abts_rsp_payload.ba_acc.aborted_ox_id, &dst->abts_rsp_payload.ba_acc.aborted_ox_id); 3851 ISP_IOXPUT_16(isp, src->abts_rsp_payload.ba_acc.high_seq_cnt, &dst->abts_rsp_payload.ba_acc.high_seq_cnt); 3852 ISP_IOXPUT_16(isp, src->abts_rsp_payload.ba_acc.low_seq_cnt, &dst->abts_rsp_payload.ba_acc.low_seq_cnt); 3853 for (i = 0; i < 4; i++) { 3854 ISP_IOXPUT_16(isp, src->abts_rsp_payload.ba_acc.reserved2[i], &dst->abts_rsp_payload.ba_acc.reserved2[i]); 3855 } 3856 } else if (src->abts_rsp_r_ctl == BA_RJT) { 3857 ISP_IOXPUT_8(isp, src->abts_rsp_payload.ba_rjt.vendor_unique, &dst->abts_rsp_payload.ba_rjt.vendor_unique); 3858 ISP_IOXPUT_8(isp, src->abts_rsp_payload.ba_rjt.explanation, &dst->abts_rsp_payload.ba_rjt.explanation); 3859 ISP_IOXPUT_8(isp, src->abts_rsp_payload.ba_rjt.reason, &dst->abts_rsp_payload.ba_rjt.reason); 3860 ISP_IOXPUT_8(isp, src->abts_rsp_payload.ba_rjt.reserved, &dst->abts_rsp_payload.ba_rjt.reserved); 3861 for (i = 0; i < 12; i++) { 3862 ISP_IOXPUT_16(isp, src->abts_rsp_payload.ba_rjt.reserved2[i], &dst->abts_rsp_payload.ba_rjt.reserved2[i]); 3863 } 3864 } else { 3865 for (i = 0; i < 16; i++) { 3866 ISP_IOXPUT_8(isp, src->abts_rsp_payload.reserved[i], &dst->abts_rsp_payload.reserved[i]); 3867 } 3868 } 3869 ISP_IOXPUT_32(isp, src->abts_rsp_rxid_task, &dst->abts_rsp_rxid_task); 3870 } 3871 3872 void 3873 isp_get_abts_rsp(ispsoftc_t *isp, abts_rsp_t *src, abts_rsp_t *dst) 3874 { 3875 int i; 3876 3877 isp_get_hdr(isp, &src->abts_rsp_header, &dst->abts_rsp_header); 3878 ISP_IOXGET_32(isp, &src->abts_rsp_handle, dst->abts_rsp_handle); 3879 ISP_IOXGET_16(isp, &src->abts_rsp_status, dst->abts_rsp_status); 3880 ISP_IOXGET_16(isp, &src->abts_rsp_nphdl, dst->abts_rsp_nphdl); 3881 ISP_IOXGET_16(isp, &src->abts_rsp_ctl_flags, dst->abts_rsp_ctl_flags); 3882 ISP_IOXGET_16(isp, &src->abts_rsp_sof, dst->abts_rsp_sof); 3883 ISP_IOXGET_32(isp, &src->abts_rsp_rxid_abts, dst->abts_rsp_rxid_abts); 3884 ISP_IOXGET_16(isp, &src->abts_rsp_did_lo, dst->abts_rsp_did_lo); 3885 ISP_IOXGET_8(isp, &src->abts_rsp_did_hi, dst->abts_rsp_did_hi); 3886 ISP_IOXGET_8(isp, &src->abts_rsp_r_ctl, dst->abts_rsp_r_ctl); 3887 ISP_IOXGET_16(isp, &src->abts_rsp_sid_lo, dst->abts_rsp_sid_lo); 3888 ISP_IOXGET_8(isp, &src->abts_rsp_sid_hi, dst->abts_rsp_sid_hi); 3889 ISP_IOXGET_8(isp, &src->abts_rsp_cs_ctl, dst->abts_rsp_cs_ctl); 3890 ISP_IOXGET_16(isp, &src->abts_rsp_f_ctl_lo, dst->abts_rsp_f_ctl_lo); 3891 ISP_IOXGET_8(isp, &src->abts_rsp_f_ctl_hi, dst->abts_rsp_f_ctl_hi); 3892 ISP_IOXGET_8(isp, &src->abts_rsp_type, dst->abts_rsp_type); 3893 ISP_IOXGET_16(isp, &src->abts_rsp_seq_cnt, dst->abts_rsp_seq_cnt); 3894 ISP_IOXGET_8(isp, &src->abts_rsp_df_ctl, dst->abts_rsp_df_ctl); 3895 ISP_IOXGET_8(isp, &src->abts_rsp_seq_id, dst->abts_rsp_seq_id); 3896 ISP_IOXGET_16(isp, &src->abts_rsp_rx_id, dst->abts_rsp_rx_id); 3897 ISP_IOXGET_16(isp, &src->abts_rsp_ox_id, dst->abts_rsp_ox_id); 3898 ISP_IOXGET_32(isp, &src->abts_rsp_param, dst->abts_rsp_param); 3899 for (i = 0; i < 8; i++) { 3900 ISP_IOXGET_8(isp, &src->abts_rsp_payload.rsp.reserved[i], dst->abts_rsp_payload.rsp.reserved[i]); 3901 } 3902 ISP_IOXGET_32(isp, &src->abts_rsp_payload.rsp.subcode1, dst->abts_rsp_payload.rsp.subcode1); 3903 ISP_IOXGET_32(isp, &src->abts_rsp_payload.rsp.subcode2, dst->abts_rsp_payload.rsp.subcode2); 3904 ISP_IOXGET_32(isp, &src->abts_rsp_rxid_task, dst->abts_rsp_rxid_task); 3905 } 3906 #endif /* ISP_TARGET_MODE */ 3907 /* 3908 * vim:ts=8:sw=8 3909 */ 3910