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