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