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