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