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