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