2 * Copyright (c) 1997-2009 by Matthew Jacob
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * Qlogic Host Adapter Internal Library Functions
32 #include <sys/cdefs.h>
33 __KERNEL_RCSID(0, "$NetBSD$");
34 #include <dev/ic/isp_netbsd.h>
37 #include <sys/cdefs.h>
38 __FBSDID("$FreeBSD$");
39 #include <dev/isp/isp_freebsd.h>
42 #include <dev/ic/isp_openbsd.h>
45 #include "isp_linux.h"
48 #include "isp_solaris.h"
51 const char *isp_class3_roles[4] = {
52 "None", "Target", "Initiator", "Target/Initiator"
56 * Command shipping- finish off first queue entry and do dma mapping and additional segments as needed.
58 * Called with the first queue entry at least partially filled out.
61 isp_send_cmd(ispsoftc_t *isp, void *fqe, void *segp, uint32_t nsegs, uint32_t totalcnt, isp_ddir_t ddir, ispds64_t *ecmd)
63 uint8_t storage[QENTRY_LEN];
65 uint32_t seg, curseg, seglim, nxt, nxtnxt, ddf;
67 ispds64_t *dsp64 = NULL;
70 qe0 = isp_getrqentry(isp);
74 nxt = ISP_NXT_QENTRY(isp->isp_reqidx, RQUEST_QUEUE_LEN(isp));
76 type = ((isphdr_t *)fqe)->rqs_entry_type;
80 * If we have no data to transmit, just copy the first IOCB and start it up.
82 if (ddir == ISP_NOXFR) {
83 if (type == RQSTYPE_T2RQS || type == RQSTYPE_T3RQS) {
92 * First figure out how many pieces of data to transfer and what kind and how many we can put into the first queue entry.
96 ddf = (ddir == ISP_TO_DEVICE)? REQFLAG_DATA_OUT : REQFLAG_DATA_IN;
97 dsp = ((ispreq_t *)fqe)->req_dataseg;
100 case RQSTYPE_CMDONLY:
101 ddf = (ddir == ISP_TO_DEVICE)? REQFLAG_DATA_OUT : REQFLAG_DATA_IN;
105 ddf = (ddir == ISP_TO_DEVICE)? REQFLAG_DATA_OUT : REQFLAG_DATA_IN;
106 dsp = ((ispreqt2_t *)fqe)->req_dataseg;
107 seglim = ISP_RQDSEG_T2;
110 ddf = (ddir == ISP_TO_DEVICE)? REQFLAG_DATA_OUT : REQFLAG_DATA_IN;
111 dsp64 = ((ispreqt3_t *)fqe)->req_dataseg;
112 seglim = ISP_RQDSEG_T3;
115 ddf = (ddir == ISP_TO_DEVICE)? REQFLAG_DATA_OUT : REQFLAG_DATA_IN;
116 dsp64 = ((ispreqt3_t *)fqe)->req_dataseg;
117 seglim = ISP_RQDSEG_T3;
120 ddf = (ddir == ISP_TO_DEVICE)? FCP_CMND_DATA_WRITE : FCP_CMND_DATA_READ;
121 dsp64 = &((ispreqt7_t *)fqe)->req_dataseg;
125 return (CMD_COMPLETE);
128 if (seglim > nsegs) {
132 for (seg = curseg = 0; curseg < seglim; curseg++) {
134 XS_GET_DMA64_SEG(dsp64++, segp, seg++);
136 XS_GET_DMA_SEG(dsp++, segp, seg++);
142 * Second, start building additional continuation segments as needed.
144 while (seg < nsegs) {
145 nxtnxt = ISP_NXT_QENTRY(nxt, RQUEST_QUEUE_LEN(isp));
146 if (nxtnxt == isp->isp_reqodx) {
147 isp->isp_reqodx = ISP_READ(isp, isp->isp_rqstoutrp);
148 if (nxtnxt == isp->isp_reqodx)
151 ISP_MEMZERO(storage, QENTRY_LEN);
152 qe1 = ISP_QUEUE_ENTRY(isp->isp_rquest, nxt);
155 ispcontreq64_t *crq = (ispcontreq64_t *) storage;
156 seglim = ISP_CDSEG64;
157 crq->req_header.rqs_entry_type = RQSTYPE_A64_CONT;
158 crq->req_header.rqs_entry_count = 1;
159 dsp64 = crq->req_dataseg;
161 ispcontreq_t *crq = (ispcontreq_t *) storage;
163 crq->req_header.rqs_entry_type = RQSTYPE_DATASEG;
164 crq->req_header.rqs_entry_count = 1;
165 dsp = crq->req_dataseg;
167 if (seg + seglim > nsegs) {
168 seglim = nsegs - seg;
170 for (curseg = 0; curseg < seglim; curseg++) {
172 XS_GET_DMA64_SEG(dsp64++, segp, seg++);
174 XS_GET_DMA_SEG(dsp++, segp, seg++);
178 isp_put_cont64_req(isp, (ispcontreq64_t *)storage, qe1);
180 isp_put_cont_req(isp, (ispcontreq_t *)storage, qe1);
182 if (isp->isp_dblev & ISP_LOGDEBUG1) {
183 isp_print_bytes(isp, "additional queue entry",
190 ((isphdr_t *)fqe)->rqs_entry_count = nqe;
192 case RQSTYPE_REQUEST:
193 ((ispreq_t *)fqe)->req_flags |= ddf;
195 * This is historical and not clear whether really needed.
200 ((ispreq_t *)fqe)->req_seg_count = nsegs;
201 isp_put_request(isp, fqe, qe0);
203 case RQSTYPE_CMDONLY:
204 ((ispreq_t *)fqe)->req_flags |= ddf;
206 * This is historical and not clear whether really needed.
211 ((ispextreq_t *)fqe)->req_seg_count = nsegs;
212 isp_put_extended_request(isp, fqe, qe0);
215 ((ispreqt2_t *)fqe)->req_flags |= ddf;
216 ((ispreqt2_t *)fqe)->req_seg_count = nsegs;
217 ((ispreqt2_t *)fqe)->req_totalcnt = totalcnt;
218 if (ISP_CAP_2KLOGIN(isp)) {
219 isp_put_request_t2e(isp, fqe, qe0);
221 isp_put_request_t2(isp, fqe, qe0);
226 ((ispreqt3_t *)fqe)->req_flags |= ddf;
227 ((ispreqt3_t *)fqe)->req_seg_count = nsegs;
228 ((ispreqt3_t *)fqe)->req_totalcnt = totalcnt;
229 if (ISP_CAP_2KLOGIN(isp)) {
230 isp_put_request_t3e(isp, fqe, qe0);
232 isp_put_request_t3(isp, fqe, qe0);
236 ((ispreqt7_t *)fqe)->req_alen_datadir = ddf;
237 ((ispreqt7_t *)fqe)->req_seg_count = nsegs;
238 ((ispreqt7_t *)fqe)->req_dl = totalcnt;
239 isp_put_request_t7(isp, fqe, qe0);
242 return (CMD_COMPLETE);
244 if (isp->isp_dblev & ISP_LOGDEBUG1) {
245 isp_print_bytes(isp, "first queue entry", QENTRY_LEN, qe0);
247 ISP_ADD_REQUEST(isp, nxt);
252 isp_allocate_handle(ispsoftc_t *isp, void *xs, int type)
256 hdp = isp->isp_xffree;
258 return (ISP_HANDLE_FREE);
259 isp->isp_xffree = hdp->cmd;
261 hdp->handle = (hdp - isp->isp_xflist);
262 hdp->handle |= (type << ISP_HANDLE_USAGE_SHIFT);
263 hdp->handle |= (isp->isp_seqno++ << ISP_HANDLE_SEQ_SHIFT);
264 return (hdp->handle);
268 isp_find_xs(ispsoftc_t *isp, uint32_t handle)
270 if (!ISP_VALID_HANDLE(isp, handle)) {
271 isp_prt(isp, ISP_LOGERR, "%s: bad handle 0x%x", __func__, handle);
274 return (isp->isp_xflist[(handle & ISP_HANDLE_CMD_MASK)].cmd);
278 isp_find_handle(ispsoftc_t *isp, void *xs)
280 uint32_t i, foundhdl = ISP_HANDLE_FREE;
283 for (i = 0; i < isp->isp_maxcmds; i++) {
284 if (isp->isp_xflist[i].cmd != xs) {
287 foundhdl = isp->isp_xflist[i].handle;
295 isp_destroy_handle(ispsoftc_t *isp, uint32_t handle)
297 if (!ISP_VALID_HANDLE(isp, handle)) {
298 isp_prt(isp, ISP_LOGERR, "%s: bad handle 0x%x", __func__, handle);
300 isp->isp_xflist[(handle & ISP_HANDLE_CMD_MASK)].handle = ISP_HANDLE_FREE;
301 isp->isp_xflist[(handle & ISP_HANDLE_CMD_MASK)].cmd = isp->isp_xffree;
302 isp->isp_xffree = &isp->isp_xflist[(handle & ISP_HANDLE_CMD_MASK)];
307 * Make sure we have space to put something on the request queue.
308 * Return a pointer to that entry if we do. A side effect of this
309 * function is to update the output index. The input index
313 isp_getrqentry(ispsoftc_t *isp)
317 next = ISP_NXT_QENTRY(isp->isp_reqidx, RQUEST_QUEUE_LEN(isp));
318 if (next == isp->isp_reqodx) {
319 isp->isp_reqodx = ISP_READ(isp, isp->isp_rqstoutrp);
320 if (next == isp->isp_reqodx)
323 return (ISP_QUEUE_ENTRY(isp->isp_rquest, isp->isp_reqidx));
326 #define TBA (4 * (((QENTRY_LEN >> 2) * 3) + 1) + 1)
328 isp_print_qentry(ispsoftc_t *isp, const char *msg, int idx, void *arg)
334 isp_prt(isp, ISP_LOGALL, "%s index %d=>", msg, idx);
335 for (buf[0] = 0, amt = i = 0; i < 4; i++) {
337 ISP_SNPRINTF(buf, TBA, " ");
338 for (j = 0; j < (QENTRY_LEN >> 2); j++) {
339 ISP_SNPRINTF(buf, TBA, "%s %02x", buf, ptr[amt++] & 0xff);
341 isp_prt(isp, ISP_LOGALL, "%s", buf);
346 isp_print_bytes(ispsoftc_t *isp, const char *msg, int amt, void *arg)
353 isp_prt(isp, ISP_LOGALL, "%s:", msg);
359 for (j = 0; j < 16; j++) {
360 ISP_SNPRINTF(buf, 128, "%s %02x", buf, ptr[off++] & 0xff);
365 isp_prt(isp, ISP_LOGALL, "0x%08x:%s", to, buf);
371 * Do the common path to try and ensure that link is up, we've scanned
372 * the fabric (if we're on a fabric), and that we've synchronized this
373 * all with our own database and done the appropriate logins.
375 * We repeatedly check for firmware state and loop state after each
376 * action because things may have changed while we were doing this.
377 * Any failure or change of state causes us to return a nonzero value.
379 * We assume we enter here with any locks held.
383 isp_fc_runstate(ispsoftc_t *isp, int chan, int tval)
385 fcparam *fcp = FCPARAM(isp, chan);
389 if (fcp->role == ISP_ROLE_NONE)
391 res = isp_control(isp, ISPCTL_FCLINK_TEST, chan, tval);
395 return (fcp->isp_loopstate);
396 res = isp_control(isp, ISPCTL_SCAN_LOOP, chan);
400 return (fcp->isp_loopstate);
401 res = isp_control(isp, ISPCTL_SCAN_FABRIC, chan);
405 return (fcp->isp_loopstate);
406 res = isp_control(isp, ISPCTL_PDB_SYNC, chan);
409 return (fcp->isp_loopstate);
413 * Fibre Channel Support routines
416 isp_dump_portdb(ispsoftc_t *isp, int chan)
418 fcparam *fcp = FCPARAM(isp, chan);
421 for (i = 0; i < MAX_FC_TARG; i++) {
422 char buf1[64], buf2[64];
423 const char *dbs[8] = {
433 fcportdb_t *lp = &fcp->portdb[i];
435 if (lp->state == FC_PORTDB_STATE_NIL) {
438 isp_gen_role_str(buf1, sizeof (buf1), lp->prli_word3);
439 isp_gen_role_str(buf2, sizeof (buf2), lp->new_prli_word3);
440 isp_prt(isp, ISP_LOGALL, "Chan %d [%d]: hdl 0x%x %s al%d %s 0x%06x =>%s 0x%06x; WWNN 0x%08x%08x WWPN 0x%08x%08x",
441 chan, i, lp->handle, dbs[lp->state], lp->autologin, buf1, lp->portid, buf2, lp->new_portid,
442 (uint32_t) (lp->node_wwn >> 32), (uint32_t) (lp->node_wwn), (uint32_t) (lp->port_wwn >> 32), (uint32_t) (lp->port_wwn));
447 isp_gen_role_str(char *buf, size_t len, uint16_t p3)
452 if (p3 & PRLI_WD3_ENHANCED_DISCOVERY) {
454 strlcat(buf, "EDisc", len);
456 if (p3 & PRLI_WD3_REC_SUPPORT) {
458 strlcat(buf, ",", len);
460 strlcat(buf, "REC", len);
462 if (p3 & PRLI_WD3_TASK_RETRY_IDENTIFICATION_REQUESTED) {
464 strlcat(buf, ",", len);
466 strlcat(buf, "RetryID", len);
468 if (p3 & PRLI_WD3_RETRY) {
470 strlcat(buf, ",", len);
472 strlcat(buf, "Retry", len);
474 if (p3 & PRLI_WD3_CONFIRMED_COMPLETION_ALLOWED) {
476 strlcat(buf, ",", len);
478 strlcat(buf, "CNFRM", len);
480 if (p3 & PRLI_WD3_DATA_OVERLAY_ALLOWED) {
482 strlcat(buf, ",", len);
484 strlcat(buf, "DOver", len);
486 if (p3 & PRLI_WD3_INITIATOR_FUNCTION) {
488 strlcat(buf, ",", len);
490 strlcat(buf, "INI", len);
492 if (p3 & PRLI_WD3_TARGET_FUNCTION) {
494 strlcat(buf, ",", len);
496 strlcat(buf, "TGT", len);
498 if (p3 & PRLI_WD3_READ_FCP_XFER_RDY_DISABLED) {
500 strlcat(buf, ",", len);
502 strlcat(buf, "RdXfrDis", len);
504 if (p3 & PRLI_WD3_WRITE_FCP_XFER_RDY_DISABLED) {
506 strlcat(buf, ",", len);
508 strlcat(buf, "XfrDis", len);
510 strlcat(buf, ")", len);
514 isp_fc_fw_statename(int state)
517 case FW_CONFIG_WAIT: return "Config Wait";
518 case FW_WAIT_LINK: return "Wait Link";
519 case FW_WAIT_LOGIN: return "Wait Login";
520 case FW_READY: return "Ready";
521 case FW_LOSS_OF_SYNC: return "Loss Of Sync";
522 case FW_ERROR: return "Error";
523 case FW_REINIT: return "Re-Init";
524 case FW_NON_PART: return "Nonparticipating";
525 default: return "?????";
530 isp_fc_loop_statename(int state)
533 case LOOP_NIL: return "NIL";
534 case LOOP_HAVE_LINK: return "Have Link";
535 case LOOP_TESTING_LINK: return "Testing Link";
536 case LOOP_LTEST_DONE: return "Link Test Done";
537 case LOOP_SCANNING_LOOP: return "Scanning Loop";
538 case LOOP_LSCAN_DONE: return "Loop Scan Done";
539 case LOOP_SCANNING_FABRIC: return "Scanning Fabric";
540 case LOOP_FSCAN_DONE: return "Fabric Scan Done";
541 case LOOP_SYNCING_PDB: return "Syncing PDB";
542 case LOOP_READY: return "Ready";
543 default: return "?????";
548 isp_fc_toponame(fcparam *fcp)
551 if (fcp->isp_loopstate < LOOP_LTEST_DONE) {
552 return "Unavailable";
554 switch (fcp->isp_topo) {
555 case TOPO_NL_PORT: return "Private Loop (NL_Port)";
556 case TOPO_FL_PORT: return "Public Loop (FL_Port)";
557 case TOPO_N_PORT: return "Point-to-Point (N_Port)";
558 case TOPO_F_PORT: return "Fabric (F_Port)";
559 case TOPO_PTP_STUB: return "Point-to-Point (no response)";
560 default: return "?????";
565 isp_clear_commands(ispsoftc_t *isp)
569 #ifdef ISP_TARGET_MODE
573 for (tmp = 0; isp->isp_xflist && tmp < isp->isp_maxcmds; tmp++) {
575 hdp = &isp->isp_xflist[tmp];
576 switch (ISP_H2HT(hdp->handle)) {
577 case ISP_HANDLE_INITIATOR: {
580 ISP_DMAFREE(isp, xs, hdp->handle);
581 XS_SET_RESID(xs, XS_XFRLEN(xs));
585 isp_destroy_handle(isp, hdp->handle);
586 XS_SETERR(xs, HBA_BUSRESET);
590 #ifdef ISP_TARGET_MODE
591 case ISP_HANDLE_TARGET: {
592 uint8_t local[QENTRY_LEN];
593 ISP_DMAFREE(isp, hdp->cmd, hdp->handle);
594 ISP_MEMZERO(local, QENTRY_LEN);
596 ct7_entry_t *ctio = (ct7_entry_t *) local;
597 ctio->ct_syshandle = hdp->handle;
598 ctio->ct_nphdl = CT_HBA_RESET;
599 ctio->ct_header.rqs_entry_type = RQSTYPE_CTIO7;
601 ct2_entry_t *ctio = (ct2_entry_t *) local;
602 ctio->ct_syshandle = hdp->handle;
603 ctio->ct_status = CT_HBA_RESET;
604 ctio->ct_header.rqs_entry_type = RQSTYPE_CTIO2;
606 isp_async(isp, ISPASYNC_TARGET_ACTION, local);
610 case ISP_HANDLE_CTRL:
612 isp_destroy_handle(isp, hdp->handle);
616 #ifdef ISP_TARGET_MODE
617 for (tmp = 0; tmp < isp->isp_nchan; tmp++) {
618 ISP_MEMZERO(¬ify, sizeof (isp_notify_t));
619 notify.nt_ncode = NT_HBA_RESET;
621 notify.nt_wwn = INI_ANY;
622 notify.nt_nphdl = NIL_HANDLE;
623 notify.nt_sid = PORT_ANY;
624 notify.nt_did = PORT_ANY;
625 notify.nt_tgt = TGT_ANY;
626 notify.nt_channel = tmp;
627 notify.nt_lun = LUN_ANY;
628 notify.nt_tagval = TAG_ANY;
629 isp_async(isp, ISPASYNC_TARGET_NOTIFY, ¬ify);
635 isp_shutdown(ispsoftc_t *isp)
639 ISP_WRITE(isp, BIU2400_ICR, 0);
640 ISP_WRITE(isp, BIU2400_HCCR, HCCR_2400_CMD_PAUSE);
642 ISP_WRITE(isp, BIU_ICR, 0);
643 ISP_WRITE(isp, HCCR, HCCR_CMD_PAUSE);
644 ISP_WRITE(isp, BIU2100_CSR, BIU2100_FPM0_REGS);
645 ISP_WRITE(isp, FPM_DIAG_CONFIG, FPM_SOFT_RESET);
646 ISP_WRITE(isp, BIU2100_CSR, BIU2100_FB_REGS);
647 ISP_WRITE(isp, FBM_CMD, FBMCMD_FIFO_RESET_ALL);
648 ISP_WRITE(isp, BIU2100_CSR, BIU2100_RISC_REGS);
651 ISP_WRITE(isp, BIU_ICR, 0);
652 ISP_WRITE(isp, HCCR, HCCR_CMD_PAUSE);
657 * Functions to move stuff to a form that the QLogic RISC engine understands
658 * and functions to move stuff back to a form the processor understands.
660 * Each platform is required to provide the 8, 16 and 32 bit
661 * swizzle and unswizzle macros (ISP_IOX{PUT|GET}_{8,16,32})
663 * The assumption is that swizzling and unswizzling is mostly done 'in place'
664 * (with a few exceptions for efficiency).
667 #define ISP_IS_SBUS(isp) (ISP_SBUS_SUPPORTED && (isp)->isp_bustype == ISP_BT_SBUS)
669 #define ASIZE(x) (sizeof (x) / sizeof (x[0]))
671 * Swizzle/Copy Functions
674 isp_put_hdr(ispsoftc_t *isp, isphdr_t *hpsrc, isphdr_t *hpdst)
676 if (ISP_IS_SBUS(isp)) {
677 ISP_IOXPUT_8(isp, hpsrc->rqs_entry_type, &hpdst->rqs_entry_count);
678 ISP_IOXPUT_8(isp, hpsrc->rqs_entry_count, &hpdst->rqs_entry_type);
679 ISP_IOXPUT_8(isp, hpsrc->rqs_seqno, &hpdst->rqs_flags);
680 ISP_IOXPUT_8(isp, hpsrc->rqs_flags, &hpdst->rqs_seqno);
682 ISP_IOXPUT_8(isp, hpsrc->rqs_entry_type, &hpdst->rqs_entry_type);
683 ISP_IOXPUT_8(isp, hpsrc->rqs_entry_count, &hpdst->rqs_entry_count);
684 ISP_IOXPUT_8(isp, hpsrc->rqs_seqno, &hpdst->rqs_seqno);
685 ISP_IOXPUT_8(isp, hpsrc->rqs_flags, &hpdst->rqs_flags);
690 isp_get_hdr(ispsoftc_t *isp, isphdr_t *hpsrc, isphdr_t *hpdst)
692 if (ISP_IS_SBUS(isp)) {
693 ISP_IOXGET_8(isp, &hpsrc->rqs_entry_type, hpdst->rqs_entry_count);
694 ISP_IOXGET_8(isp, &hpsrc->rqs_entry_count, hpdst->rqs_entry_type);
695 ISP_IOXGET_8(isp, &hpsrc->rqs_seqno, hpdst->rqs_flags);
696 ISP_IOXGET_8(isp, &hpsrc->rqs_flags, hpdst->rqs_seqno);
698 ISP_IOXGET_8(isp, &hpsrc->rqs_entry_type, hpdst->rqs_entry_type);
699 ISP_IOXGET_8(isp, &hpsrc->rqs_entry_count, hpdst->rqs_entry_count);
700 ISP_IOXGET_8(isp, &hpsrc->rqs_seqno, hpdst->rqs_seqno);
701 ISP_IOXGET_8(isp, &hpsrc->rqs_flags, hpdst->rqs_flags);
706 isp_get_response_type(ispsoftc_t *isp, isphdr_t *hp)
709 if (ISP_IS_SBUS(isp)) {
710 ISP_IOXGET_8(isp, &hp->rqs_entry_count, type);
712 ISP_IOXGET_8(isp, &hp->rqs_entry_type, type);
718 isp_put_request(ispsoftc_t *isp, ispreq_t *rqsrc, ispreq_t *rqdst)
721 isp_put_hdr(isp, &rqsrc->req_header, &rqdst->req_header);
722 ISP_IOXPUT_32(isp, rqsrc->req_handle, &rqdst->req_handle);
723 if (ISP_IS_SBUS(isp)) {
724 ISP_IOXPUT_8(isp, rqsrc->req_lun_trn, &rqdst->req_target);
725 ISP_IOXPUT_8(isp, rqsrc->req_target, &rqdst->req_lun_trn);
727 ISP_IOXPUT_8(isp, rqsrc->req_lun_trn, &rqdst->req_lun_trn);
728 ISP_IOXPUT_8(isp, rqsrc->req_target, &rqdst->req_target);
730 ISP_IOXPUT_16(isp, rqsrc->req_cdblen, &rqdst->req_cdblen);
731 ISP_IOXPUT_16(isp, rqsrc->req_flags, &rqdst->req_flags);
732 ISP_IOXPUT_16(isp, rqsrc->req_time, &rqdst->req_time);
733 ISP_IOXPUT_16(isp, rqsrc->req_seg_count, &rqdst->req_seg_count);
734 for (i = 0; i < ASIZE(rqsrc->req_cdb); i++) {
735 ISP_IOXPUT_8(isp, rqsrc->req_cdb[i], &rqdst->req_cdb[i]);
737 for (i = 0; i < ISP_RQDSEG; i++) {
738 ISP_IOXPUT_32(isp, rqsrc->req_dataseg[i].ds_base, &rqdst->req_dataseg[i].ds_base);
739 ISP_IOXPUT_32(isp, rqsrc->req_dataseg[i].ds_count, &rqdst->req_dataseg[i].ds_count);
744 isp_put_marker(ispsoftc_t *isp, isp_marker_t *src, isp_marker_t *dst)
747 isp_put_hdr(isp, &src->mrk_header, &dst->mrk_header);
748 ISP_IOXPUT_32(isp, src->mrk_handle, &dst->mrk_handle);
749 if (ISP_IS_SBUS(isp)) {
750 ISP_IOXPUT_8(isp, src->mrk_reserved0, &dst->mrk_target);
751 ISP_IOXPUT_8(isp, src->mrk_target, &dst->mrk_reserved0);
753 ISP_IOXPUT_8(isp, src->mrk_reserved0, &dst->mrk_reserved0);
754 ISP_IOXPUT_8(isp, src->mrk_target, &dst->mrk_target);
756 ISP_IOXPUT_16(isp, src->mrk_modifier, &dst->mrk_modifier);
757 ISP_IOXPUT_16(isp, src->mrk_flags, &dst->mrk_flags);
758 ISP_IOXPUT_16(isp, src->mrk_lun, &dst->mrk_lun);
759 for (i = 0; i < ASIZE(src->mrk_reserved1); i++) {
760 ISP_IOXPUT_8(isp, src->mrk_reserved1[i], &dst->mrk_reserved1[i]);
765 isp_put_marker_24xx(ispsoftc_t *isp, isp_marker_24xx_t *src, isp_marker_24xx_t *dst)
768 isp_put_hdr(isp, &src->mrk_header, &dst->mrk_header);
769 ISP_IOXPUT_32(isp, src->mrk_handle, &dst->mrk_handle);
770 ISP_IOXPUT_16(isp, src->mrk_nphdl, &dst->mrk_nphdl);
771 ISP_IOXPUT_8(isp, src->mrk_modifier, &dst->mrk_modifier);
772 ISP_IOXPUT_8(isp, src->mrk_reserved0, &dst->mrk_reserved0);
773 ISP_IOXPUT_8(isp, src->mrk_reserved1, &dst->mrk_reserved1);
774 ISP_IOXPUT_8(isp, src->mrk_vphdl, &dst->mrk_vphdl);
775 ISP_IOXPUT_8(isp, src->mrk_reserved2, &dst->mrk_reserved2);
776 for (i = 0; i < ASIZE(src->mrk_lun); i++) {
777 ISP_IOXPUT_8(isp, src->mrk_lun[i], &dst->mrk_lun[i]);
779 for (i = 0; i < ASIZE(src->mrk_reserved3); i++) {
780 ISP_IOXPUT_8(isp, src->mrk_reserved3[i], &dst->mrk_reserved3[i]);
785 isp_put_request_t2(ispsoftc_t *isp, ispreqt2_t *src, ispreqt2_t *dst)
788 isp_put_hdr(isp, &src->req_header, &dst->req_header);
789 ISP_IOXPUT_32(isp, src->req_handle, &dst->req_handle);
790 ISP_IOXPUT_8(isp, src->req_lun_trn, &dst->req_lun_trn);
791 ISP_IOXPUT_8(isp, src->req_target, &dst->req_target);
792 ISP_IOXPUT_16(isp, src->req_scclun, &dst->req_scclun);
793 ISP_IOXPUT_16(isp, src->req_flags, &dst->req_flags);
794 ISP_IOXPUT_8(isp, src->req_crn, &dst->req_crn);
795 ISP_IOXPUT_8(isp, src->req_reserved, &dst->req_reserved);
796 ISP_IOXPUT_16(isp, src->req_time, &dst->req_time);
797 ISP_IOXPUT_16(isp, src->req_seg_count, &dst->req_seg_count);
798 for (i = 0; i < ASIZE(src->req_cdb); i++) {
799 ISP_IOXPUT_8(isp, src->req_cdb[i], &dst->req_cdb[i]);
801 ISP_IOXPUT_32(isp, src->req_totalcnt, &dst->req_totalcnt);
802 for (i = 0; i < ISP_RQDSEG_T2; i++) {
803 ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_base, &dst->req_dataseg[i].ds_base);
804 ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_count, &dst->req_dataseg[i].ds_count);
809 isp_put_request_t2e(ispsoftc_t *isp, ispreqt2e_t *src, ispreqt2e_t *dst)
812 isp_put_hdr(isp, &src->req_header, &dst->req_header);
813 ISP_IOXPUT_32(isp, src->req_handle, &dst->req_handle);
814 ISP_IOXPUT_16(isp, src->req_target, &dst->req_target);
815 ISP_IOXPUT_16(isp, src->req_scclun, &dst->req_scclun);
816 ISP_IOXPUT_16(isp, src->req_flags, &dst->req_flags);
817 ISP_IOXPUT_8(isp, src->req_crn, &dst->req_crn);
818 ISP_IOXPUT_8(isp, src->req_reserved, &dst->req_reserved);
819 ISP_IOXPUT_16(isp, src->req_time, &dst->req_time);
820 ISP_IOXPUT_16(isp, src->req_seg_count, &dst->req_seg_count);
821 for (i = 0; i < ASIZE(src->req_cdb); i++) {
822 ISP_IOXPUT_8(isp, src->req_cdb[i], &dst->req_cdb[i]);
824 ISP_IOXPUT_32(isp, src->req_totalcnt, &dst->req_totalcnt);
825 for (i = 0; i < ISP_RQDSEG_T2; i++) {
826 ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_base, &dst->req_dataseg[i].ds_base);
827 ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_count, &dst->req_dataseg[i].ds_count);
832 isp_put_request_t3(ispsoftc_t *isp, ispreqt3_t *src, ispreqt3_t *dst)
835 isp_put_hdr(isp, &src->req_header, &dst->req_header);
836 ISP_IOXPUT_32(isp, src->req_handle, &dst->req_handle);
837 ISP_IOXPUT_8(isp, src->req_lun_trn, &dst->req_lun_trn);
838 ISP_IOXPUT_8(isp, src->req_target, &dst->req_target);
839 ISP_IOXPUT_16(isp, src->req_scclun, &dst->req_scclun);
840 ISP_IOXPUT_16(isp, src->req_flags, &dst->req_flags);
841 ISP_IOXPUT_8(isp, src->req_crn, &dst->req_crn);
842 ISP_IOXPUT_8(isp, src->req_reserved, &dst->req_reserved);
843 ISP_IOXPUT_16(isp, src->req_time, &dst->req_time);
844 ISP_IOXPUT_16(isp, src->req_seg_count, &dst->req_seg_count);
845 for (i = 0; i < ASIZE(src->req_cdb); i++) {
846 ISP_IOXPUT_8(isp, src->req_cdb[i], &dst->req_cdb[i]);
848 ISP_IOXPUT_32(isp, src->req_totalcnt, &dst->req_totalcnt);
849 for (i = 0; i < ISP_RQDSEG_T3; i++) {
850 ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_base, &dst->req_dataseg[i].ds_base);
851 ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_basehi, &dst->req_dataseg[i].ds_basehi);
852 ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_count, &dst->req_dataseg[i].ds_count);
857 isp_put_request_t3e(ispsoftc_t *isp, ispreqt3e_t *src, ispreqt3e_t *dst)
860 isp_put_hdr(isp, &src->req_header, &dst->req_header);
861 ISP_IOXPUT_32(isp, src->req_handle, &dst->req_handle);
862 ISP_IOXPUT_16(isp, src->req_target, &dst->req_target);
863 ISP_IOXPUT_16(isp, src->req_scclun, &dst->req_scclun);
864 ISP_IOXPUT_16(isp, src->req_flags, &dst->req_flags);
865 ISP_IOXPUT_8(isp, src->req_crn, &dst->req_crn);
866 ISP_IOXPUT_8(isp, src->req_reserved, &dst->req_reserved);
867 ISP_IOXPUT_16(isp, src->req_time, &dst->req_time);
868 ISP_IOXPUT_16(isp, src->req_seg_count, &dst->req_seg_count);
869 for (i = 0; i < ASIZE(src->req_cdb); i++) {
870 ISP_IOXPUT_8(isp, src->req_cdb[i], &dst->req_cdb[i]);
872 ISP_IOXPUT_32(isp, src->req_totalcnt, &dst->req_totalcnt);
873 for (i = 0; i < ISP_RQDSEG_T3; i++) {
874 ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_base, &dst->req_dataseg[i].ds_base);
875 ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_basehi, &dst->req_dataseg[i].ds_basehi);
876 ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_count, &dst->req_dataseg[i].ds_count);
881 isp_put_extended_request(ispsoftc_t *isp, ispextreq_t *src, ispextreq_t *dst)
884 isp_put_hdr(isp, &src->req_header, &dst->req_header);
885 ISP_IOXPUT_32(isp, src->req_handle, &dst->req_handle);
886 if (ISP_IS_SBUS(isp)) {
887 ISP_IOXPUT_8(isp, src->req_lun_trn, &dst->req_target);
888 ISP_IOXPUT_8(isp, src->req_target, &dst->req_lun_trn);
890 ISP_IOXPUT_8(isp, src->req_lun_trn, &dst->req_lun_trn);
891 ISP_IOXPUT_8(isp, src->req_target, &dst->req_target);
893 ISP_IOXPUT_16(isp, src->req_cdblen, &dst->req_cdblen);
894 ISP_IOXPUT_16(isp, src->req_flags, &dst->req_flags);
895 ISP_IOXPUT_16(isp, src->req_time, &dst->req_time);
896 ISP_IOXPUT_16(isp, src->req_seg_count, &dst->req_seg_count);
897 for (i = 0; i < ASIZE(src->req_cdb); i++) {
898 ISP_IOXPUT_8(isp, src->req_cdb[i], &dst->req_cdb[i]);
903 isp_put_request_t7(ispsoftc_t *isp, ispreqt7_t *src, ispreqt7_t *dst)
908 isp_put_hdr(isp, &src->req_header, &dst->req_header);
909 ISP_IOXPUT_32(isp, src->req_handle, &dst->req_handle);
910 ISP_IOXPUT_16(isp, src->req_nphdl, &dst->req_nphdl);
911 ISP_IOXPUT_16(isp, src->req_time, &dst->req_time);
912 ISP_IOXPUT_16(isp, src->req_seg_count, &dst->req_seg_count);
913 ISP_IOXPUT_16(isp, src->req_reserved, &dst->req_reserved);
914 a = (uint32_t *) src->req_lun;
915 b = (uint32_t *) dst->req_lun;
916 for (i = 0; i < (ASIZE(src->req_lun) >> 2); i++ ) {
917 *b++ = ISP_SWAP32(isp, *a++);
919 ISP_IOXPUT_8(isp, src->req_alen_datadir, &dst->req_alen_datadir);
920 ISP_IOXPUT_8(isp, src->req_task_management, &dst->req_task_management);
921 ISP_IOXPUT_8(isp, src->req_task_attribute, &dst->req_task_attribute);
922 ISP_IOXPUT_8(isp, src->req_crn, &dst->req_crn);
923 a = (uint32_t *) src->req_cdb;
924 b = (uint32_t *) dst->req_cdb;
925 for (i = 0; i < (ASIZE(src->req_cdb) >> 2); i++) {
926 *b++ = ISP_SWAP32(isp, *a++);
928 ISP_IOXPUT_32(isp, src->req_dl, &dst->req_dl);
929 ISP_IOXPUT_16(isp, src->req_tidlo, &dst->req_tidlo);
930 ISP_IOXPUT_8(isp, src->req_tidhi, &dst->req_tidhi);
931 ISP_IOXPUT_8(isp, src->req_vpidx, &dst->req_vpidx);
932 ISP_IOXPUT_32(isp, src->req_dataseg.ds_base, &dst->req_dataseg.ds_base);
933 ISP_IOXPUT_32(isp, src->req_dataseg.ds_basehi, &dst->req_dataseg.ds_basehi);
934 ISP_IOXPUT_32(isp, src->req_dataseg.ds_count, &dst->req_dataseg.ds_count);
938 isp_put_24xx_tmf(ispsoftc_t *isp, isp24xx_tmf_t *src, isp24xx_tmf_t *dst)
943 isp_put_hdr(isp, &src->tmf_header, &dst->tmf_header);
944 ISP_IOXPUT_32(isp, src->tmf_handle, &dst->tmf_handle);
945 ISP_IOXPUT_16(isp, src->tmf_nphdl, &dst->tmf_nphdl);
946 ISP_IOXPUT_16(isp, src->tmf_delay, &dst->tmf_delay);
947 ISP_IOXPUT_16(isp, src->tmf_timeout, &dst->tmf_timeout);
948 for (i = 0; i < ASIZE(src->tmf_reserved0); i++) {
949 ISP_IOXPUT_8(isp, src->tmf_reserved0[i], &dst->tmf_reserved0[i]);
951 a = (uint32_t *) src->tmf_lun;
952 b = (uint32_t *) dst->tmf_lun;
953 for (i = 0; i < (ASIZE(src->tmf_lun) >> 2); i++ ) {
954 *b++ = ISP_SWAP32(isp, *a++);
956 ISP_IOXPUT_32(isp, src->tmf_flags, &dst->tmf_flags);
957 for (i = 0; i < ASIZE(src->tmf_reserved1); i++) {
958 ISP_IOXPUT_8(isp, src->tmf_reserved1[i], &dst->tmf_reserved1[i]);
960 ISP_IOXPUT_16(isp, src->tmf_tidlo, &dst->tmf_tidlo);
961 ISP_IOXPUT_8(isp, src->tmf_tidhi, &dst->tmf_tidhi);
962 ISP_IOXPUT_8(isp, src->tmf_vpidx, &dst->tmf_vpidx);
963 for (i = 0; i < ASIZE(src->tmf_reserved2); i++) {
964 ISP_IOXPUT_8(isp, src->tmf_reserved2[i], &dst->tmf_reserved2[i]);
969 isp_put_24xx_abrt(ispsoftc_t *isp, isp24xx_abrt_t *src, isp24xx_abrt_t *dst)
972 isp_put_hdr(isp, &src->abrt_header, &dst->abrt_header);
973 ISP_IOXPUT_32(isp, src->abrt_handle, &dst->abrt_handle);
974 ISP_IOXPUT_16(isp, src->abrt_nphdl, &dst->abrt_nphdl);
975 ISP_IOXPUT_16(isp, src->abrt_options, &dst->abrt_options);
976 ISP_IOXPUT_32(isp, src->abrt_cmd_handle, &dst->abrt_cmd_handle);
977 ISP_IOXPUT_16(isp, src->abrt_queue_number, &dst->abrt_queue_number);
978 for (i = 0; i < ASIZE(src->abrt_reserved); i++) {
979 ISP_IOXPUT_8(isp, src->abrt_reserved[i], &dst->abrt_reserved[i]);
981 ISP_IOXPUT_16(isp, src->abrt_tidlo, &dst->abrt_tidlo);
982 ISP_IOXPUT_8(isp, src->abrt_tidhi, &dst->abrt_tidhi);
983 ISP_IOXPUT_8(isp, src->abrt_vpidx, &dst->abrt_vpidx);
984 for (i = 0; i < ASIZE(src->abrt_reserved1); i++) {
985 ISP_IOXPUT_8(isp, src->abrt_reserved1[i], &dst->abrt_reserved1[i]);
990 isp_put_cont_req(ispsoftc_t *isp, ispcontreq_t *src, ispcontreq_t *dst)
993 isp_put_hdr(isp, &src->req_header, &dst->req_header);
994 for (i = 0; i < ISP_CDSEG; i++) {
995 ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_base, &dst->req_dataseg[i].ds_base);
996 ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_count, &dst->req_dataseg[i].ds_count);
1001 isp_put_cont64_req(ispsoftc_t *isp, ispcontreq64_t *src, ispcontreq64_t *dst)
1004 isp_put_hdr(isp, &src->req_header, &dst->req_header);
1005 for (i = 0; i < ISP_CDSEG64; i++) {
1006 ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_base, &dst->req_dataseg[i].ds_base);
1007 ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_basehi, &dst->req_dataseg[i].ds_basehi);
1008 ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_count, &dst->req_dataseg[i].ds_count);
1013 isp_get_response(ispsoftc_t *isp, ispstatusreq_t *src, ispstatusreq_t *dst)
1016 isp_get_hdr(isp, &src->req_header, &dst->req_header);
1017 ISP_IOXGET_32(isp, &src->req_handle, dst->req_handle);
1018 ISP_IOXGET_16(isp, &src->req_scsi_status, dst->req_scsi_status);
1019 ISP_IOXGET_16(isp, &src->req_completion_status, dst->req_completion_status);
1020 ISP_IOXGET_16(isp, &src->req_state_flags, dst->req_state_flags);
1021 ISP_IOXGET_16(isp, &src->req_status_flags, dst->req_status_flags);
1022 ISP_IOXGET_16(isp, &src->req_time, dst->req_time);
1023 ISP_IOXGET_16(isp, &src->req_sense_len, dst->req_sense_len);
1024 ISP_IOXGET_32(isp, &src->req_resid, dst->req_resid);
1025 for (i = 0; i < sizeof (src->req_response); i++) {
1026 ISP_IOXGET_8(isp, &src->req_response[i], dst->req_response[i]);
1028 for (i = 0; i < sizeof (src->req_sense_data); i++) {
1029 ISP_IOXGET_8(isp, &src->req_sense_data[i], dst->req_sense_data[i]);
1034 isp_get_cont_response(ispsoftc_t *isp, ispstatus_cont_t *src, ispstatus_cont_t *dst)
1037 isp_get_hdr(isp, &src->req_header, &dst->req_header);
1040 a = (uint32_t *) src->req_sense_data;
1041 b = (uint32_t *) dst->req_sense_data;
1042 for (i = 0; i < (sizeof (src->req_sense_data) / sizeof (uint32_t)); i++) {
1043 ISP_IOZGET_32(isp, a++, *b++);
1046 for (i = 0; i < sizeof (src->req_sense_data); i++) {
1047 ISP_IOXGET_8(isp, &src->req_sense_data[i], dst->req_sense_data[i]);
1053 isp_get_24xx_response(ispsoftc_t *isp, isp24xx_statusreq_t *src, isp24xx_statusreq_t *dst)
1058 isp_get_hdr(isp, &src->req_header, &dst->req_header);
1059 ISP_IOXGET_32(isp, &src->req_handle, dst->req_handle);
1060 ISP_IOXGET_16(isp, &src->req_completion_status, dst->req_completion_status);
1061 ISP_IOXGET_16(isp, &src->req_oxid, dst->req_oxid);
1062 ISP_IOXGET_32(isp, &src->req_resid, dst->req_resid);
1063 ISP_IOXGET_16(isp, &src->req_reserved0, dst->req_reserved0);
1064 ISP_IOXGET_16(isp, &src->req_state_flags, dst->req_state_flags);
1065 ISP_IOXGET_16(isp, &src->req_retry_delay, dst->req_retry_delay);
1066 ISP_IOXGET_16(isp, &src->req_scsi_status, dst->req_scsi_status);
1067 ISP_IOXGET_32(isp, &src->req_fcp_residual, dst->req_fcp_residual);
1068 ISP_IOXGET_32(isp, &src->req_sense_len, dst->req_sense_len);
1069 ISP_IOXGET_32(isp, &src->req_response_len, dst->req_response_len);
1070 s = (uint32_t *)src->req_rsp_sense;
1071 d = (uint32_t *)dst->req_rsp_sense;
1072 for (i = 0; i < (ASIZE(src->req_rsp_sense) >> 2); i++) {
1073 d[i] = ISP_SWAP32(isp, s[i]);
1078 isp_get_24xx_abrt(ispsoftc_t *isp, isp24xx_abrt_t *src, isp24xx_abrt_t *dst)
1081 isp_get_hdr(isp, &src->abrt_header, &dst->abrt_header);
1082 ISP_IOXGET_32(isp, &src->abrt_handle, dst->abrt_handle);
1083 ISP_IOXGET_16(isp, &src->abrt_nphdl, dst->abrt_nphdl);
1084 ISP_IOXGET_16(isp, &src->abrt_options, dst->abrt_options);
1085 ISP_IOXGET_32(isp, &src->abrt_cmd_handle, dst->abrt_cmd_handle);
1086 ISP_IOXGET_16(isp, &src->abrt_queue_number, dst->abrt_queue_number);
1087 for (i = 0; i < ASIZE(src->abrt_reserved); i++) {
1088 ISP_IOXGET_8(isp, &src->abrt_reserved[i], dst->abrt_reserved[i]);
1090 ISP_IOXGET_16(isp, &src->abrt_tidlo, dst->abrt_tidlo);
1091 ISP_IOXGET_8(isp, &src->abrt_tidhi, dst->abrt_tidhi);
1092 ISP_IOXGET_8(isp, &src->abrt_vpidx, dst->abrt_vpidx);
1093 for (i = 0; i < ASIZE(src->abrt_reserved1); i++) {
1094 ISP_IOXGET_8(isp, &src->abrt_reserved1[i], dst->abrt_reserved1[i]);
1100 isp_get_rio1(ispsoftc_t *isp, isp_rio1_t *r1src, isp_rio1_t *r1dst)
1102 const int lim = sizeof (r1dst->req_handles) / sizeof (r1dst->req_handles[0]);
1104 isp_get_hdr(isp, &r1src->req_header, &r1dst->req_header);
1105 if (r1dst->req_header.rqs_seqno > lim) {
1106 r1dst->req_header.rqs_seqno = lim;
1108 for (i = 0; i < r1dst->req_header.rqs_seqno; i++) {
1109 ISP_IOXGET_32(isp, &r1src->req_handles[i], r1dst->req_handles[i]);
1112 r1dst->req_handles[i++] = 0;
1117 isp_get_rio2(ispsoftc_t *isp, isp_rio2_t *r2src, isp_rio2_t *r2dst)
1119 const int lim = sizeof (r2dst->req_handles) / sizeof (r2dst->req_handles[0]);
1122 isp_get_hdr(isp, &r2src->req_header, &r2dst->req_header);
1123 if (r2dst->req_header.rqs_seqno > lim) {
1124 r2dst->req_header.rqs_seqno = lim;
1126 for (i = 0; i < r2dst->req_header.rqs_seqno; i++) {
1127 ISP_IOXGET_16(isp, &r2src->req_handles[i], r2dst->req_handles[i]);
1130 r2dst->req_handles[i++] = 0;
1135 isp_put_icb(ispsoftc_t *isp, isp_icb_t *src, isp_icb_t *dst)
1138 if (ISP_IS_SBUS(isp)) {
1139 ISP_IOXPUT_8(isp, src->icb_version, &dst->icb_reserved0);
1140 ISP_IOXPUT_8(isp, src->icb_reserved0, &dst->icb_version);
1142 ISP_IOXPUT_8(isp, src->icb_version, &dst->icb_version);
1143 ISP_IOXPUT_8(isp, src->icb_reserved0, &dst->icb_reserved0);
1145 ISP_IOXPUT_16(isp, src->icb_fwoptions, &dst->icb_fwoptions);
1146 ISP_IOXPUT_16(isp, src->icb_maxfrmlen, &dst->icb_maxfrmlen);
1147 ISP_IOXPUT_16(isp, src->icb_maxalloc, &dst->icb_maxalloc);
1148 ISP_IOXPUT_16(isp, src->icb_execthrottle, &dst->icb_execthrottle);
1149 if (ISP_IS_SBUS(isp)) {
1150 ISP_IOXPUT_8(isp, src->icb_retry_count, &dst->icb_retry_delay);
1151 ISP_IOXPUT_8(isp, src->icb_retry_delay, &dst->icb_retry_count);
1153 ISP_IOXPUT_8(isp, src->icb_retry_count, &dst->icb_retry_count);
1154 ISP_IOXPUT_8(isp, src->icb_retry_delay, &dst->icb_retry_delay);
1156 for (i = 0; i < 8; i++) {
1157 ISP_IOXPUT_8(isp, src->icb_portname[i], &dst->icb_portname[i]);
1159 ISP_IOXPUT_16(isp, src->icb_hardaddr, &dst->icb_hardaddr);
1160 if (ISP_IS_SBUS(isp)) {
1161 ISP_IOXPUT_8(isp, src->icb_iqdevtype, &dst->icb_logintime);
1162 ISP_IOXPUT_8(isp, src->icb_logintime, &dst->icb_iqdevtype);
1164 ISP_IOXPUT_8(isp, src->icb_iqdevtype, &dst->icb_iqdevtype);
1165 ISP_IOXPUT_8(isp, src->icb_logintime, &dst->icb_logintime);
1167 for (i = 0; i < 8; i++) {
1168 ISP_IOXPUT_8(isp, src->icb_nodename[i], &dst->icb_nodename[i]);
1170 ISP_IOXPUT_16(isp, src->icb_rqstout, &dst->icb_rqstout);
1171 ISP_IOXPUT_16(isp, src->icb_rspnsin, &dst->icb_rspnsin);
1172 ISP_IOXPUT_16(isp, src->icb_rqstqlen, &dst->icb_rqstqlen);
1173 ISP_IOXPUT_16(isp, src->icb_rsltqlen, &dst->icb_rsltqlen);
1174 for (i = 0; i < 4; i++) {
1175 ISP_IOXPUT_16(isp, src->icb_rqstaddr[i], &dst->icb_rqstaddr[i]);
1177 for (i = 0; i < 4; i++) {
1178 ISP_IOXPUT_16(isp, src->icb_respaddr[i], &dst->icb_respaddr[i]);
1180 ISP_IOXPUT_16(isp, src->icb_lunenables, &dst->icb_lunenables);
1181 if (ISP_IS_SBUS(isp)) {
1182 ISP_IOXPUT_8(isp, src->icb_ccnt, &dst->icb_icnt);
1183 ISP_IOXPUT_8(isp, src->icb_icnt, &dst->icb_ccnt);
1185 ISP_IOXPUT_8(isp, src->icb_ccnt, &dst->icb_ccnt);
1186 ISP_IOXPUT_8(isp, src->icb_icnt, &dst->icb_icnt);
1188 ISP_IOXPUT_16(isp, src->icb_lunetimeout, &dst->icb_lunetimeout);
1189 ISP_IOXPUT_16(isp, src->icb_reserved1, &dst->icb_reserved1);
1190 ISP_IOXPUT_16(isp, src->icb_xfwoptions, &dst->icb_xfwoptions);
1191 if (ISP_IS_SBUS(isp)) {
1192 ISP_IOXPUT_8(isp, src->icb_racctimer, &dst->icb_idelaytimer);
1193 ISP_IOXPUT_8(isp, src->icb_idelaytimer, &dst->icb_racctimer);
1195 ISP_IOXPUT_8(isp, src->icb_racctimer, &dst->icb_racctimer);
1196 ISP_IOXPUT_8(isp, src->icb_idelaytimer, &dst->icb_idelaytimer);
1198 ISP_IOXPUT_16(isp, src->icb_zfwoptions, &dst->icb_zfwoptions);
1202 isp_put_icb_2400(ispsoftc_t *isp, isp_icb_2400_t *src, isp_icb_2400_t *dst)
1205 ISP_IOXPUT_16(isp, src->icb_version, &dst->icb_version);
1206 ISP_IOXPUT_16(isp, src->icb_reserved0, &dst->icb_reserved0);
1207 ISP_IOXPUT_16(isp, src->icb_maxfrmlen, &dst->icb_maxfrmlen);
1208 ISP_IOXPUT_16(isp, src->icb_execthrottle, &dst->icb_execthrottle);
1209 ISP_IOXPUT_16(isp, src->icb_xchgcnt, &dst->icb_xchgcnt);
1210 ISP_IOXPUT_16(isp, src->icb_hardaddr, &dst->icb_hardaddr);
1211 for (i = 0; i < 8; i++) {
1212 ISP_IOXPUT_8(isp, src->icb_portname[i], &dst->icb_portname[i]);
1214 for (i = 0; i < 8; i++) {
1215 ISP_IOXPUT_8(isp, src->icb_nodename[i], &dst->icb_nodename[i]);
1217 ISP_IOXPUT_16(isp, src->icb_rspnsin, &dst->icb_rspnsin);
1218 ISP_IOXPUT_16(isp, src->icb_rqstout, &dst->icb_rqstout);
1219 ISP_IOXPUT_16(isp, src->icb_retry_count, &dst->icb_retry_count);
1220 ISP_IOXPUT_16(isp, src->icb_priout, &dst->icb_priout);
1221 ISP_IOXPUT_16(isp, src->icb_rsltqlen, &dst->icb_rsltqlen);
1222 ISP_IOXPUT_16(isp, src->icb_rqstqlen, &dst->icb_rqstqlen);
1223 ISP_IOXPUT_16(isp, src->icb_ldn_nols, &dst->icb_ldn_nols);
1224 ISP_IOXPUT_16(isp, src->icb_prqstqlen, &dst->icb_prqstqlen);
1225 for (i = 0; i < 4; i++) {
1226 ISP_IOXPUT_16(isp, src->icb_rqstaddr[i], &dst->icb_rqstaddr[i]);
1228 for (i = 0; i < 4; i++) {
1229 ISP_IOXPUT_16(isp, src->icb_respaddr[i], &dst->icb_respaddr[i]);
1231 for (i = 0; i < 4; i++) {
1232 ISP_IOXPUT_16(isp, src->icb_priaddr[i], &dst->icb_priaddr[i]);
1234 ISP_IOXPUT_16(isp, src->icb_msixresp, &dst->icb_msixresp);
1235 ISP_IOXPUT_16(isp, src->icb_msixatio, &dst->icb_msixatio);
1236 for (i = 0; i < 2; i++) {
1237 ISP_IOXPUT_16(isp, src->icb_reserved1[i], &dst->icb_reserved1[i]);
1239 ISP_IOXPUT_16(isp, src->icb_atio_in, &dst->icb_atio_in);
1240 ISP_IOXPUT_16(isp, src->icb_atioqlen, &dst->icb_atioqlen);
1241 for (i = 0; i < 4; i++) {
1242 ISP_IOXPUT_16(isp, src->icb_atioqaddr[i], &dst->icb_atioqaddr[i]);
1244 ISP_IOXPUT_16(isp, src->icb_idelaytimer, &dst->icb_idelaytimer);
1245 ISP_IOXPUT_16(isp, src->icb_logintime, &dst->icb_logintime);
1246 ISP_IOXPUT_32(isp, src->icb_fwoptions1, &dst->icb_fwoptions1);
1247 ISP_IOXPUT_32(isp, src->icb_fwoptions2, &dst->icb_fwoptions2);
1248 ISP_IOXPUT_32(isp, src->icb_fwoptions3, &dst->icb_fwoptions3);
1249 ISP_IOXPUT_16(isp, src->icb_qos, &dst->icb_qos);
1250 for (i = 0; i < 3; i++)
1251 ISP_IOXPUT_16(isp, src->icb_reserved2[i], &dst->icb_reserved2[i]);
1252 for (i = 0; i < 3; i++)
1253 ISP_IOXPUT_16(isp, src->icb_enodemac[i], &dst->icb_enodemac[i]);
1254 ISP_IOXPUT_16(isp, src->icb_disctime, &dst->icb_disctime);
1255 for (i = 0; i < 4; i++)
1256 ISP_IOXPUT_16(isp, src->icb_reserved3[i], &dst->icb_reserved3[i]);
1260 isp_put_icb_2400_vpinfo(ispsoftc_t *isp, isp_icb_2400_vpinfo_t *src, isp_icb_2400_vpinfo_t *dst)
1262 ISP_IOXPUT_16(isp, src->vp_count, &dst->vp_count);
1263 ISP_IOXPUT_16(isp, src->vp_global_options, &dst->vp_global_options);
1267 isp_put_vp_port_info(ispsoftc_t *isp, vp_port_info_t *src, vp_port_info_t *dst)
1270 ISP_IOXPUT_16(isp, src->vp_port_status, &dst->vp_port_status);
1271 ISP_IOXPUT_8(isp, src->vp_port_options, &dst->vp_port_options);
1272 ISP_IOXPUT_8(isp, src->vp_port_loopid, &dst->vp_port_loopid);
1273 for (i = 0; i < 8; i++) {
1274 ISP_IOXPUT_8(isp, src->vp_port_portname[i], &dst->vp_port_portname[i]);
1276 for (i = 0; i < 8; i++) {
1277 ISP_IOXPUT_8(isp, src->vp_port_nodename[i], &dst->vp_port_nodename[i]);
1279 /* we never *put* portid_lo/portid_hi */
1283 isp_get_vp_port_info(ispsoftc_t *isp, vp_port_info_t *src, vp_port_info_t *dst)
1286 ISP_IOXGET_16(isp, &src->vp_port_status, dst->vp_port_status);
1287 ISP_IOXGET_8(isp, &src->vp_port_options, dst->vp_port_options);
1288 ISP_IOXGET_8(isp, &src->vp_port_loopid, dst->vp_port_loopid);
1289 for (i = 0; i < ASIZE(src->vp_port_portname); i++) {
1290 ISP_IOXGET_8(isp, &src->vp_port_portname[i], dst->vp_port_portname[i]);
1292 for (i = 0; i < ASIZE(src->vp_port_nodename); i++) {
1293 ISP_IOXGET_8(isp, &src->vp_port_nodename[i], dst->vp_port_nodename[i]);
1295 ISP_IOXGET_16(isp, &src->vp_port_portid_lo, dst->vp_port_portid_lo);
1296 ISP_IOXGET_16(isp, &src->vp_port_portid_hi, dst->vp_port_portid_hi);
1300 isp_put_vp_ctrl_info(ispsoftc_t *isp, vp_ctrl_info_t *src, vp_ctrl_info_t *dst)
1303 isp_put_hdr(isp, &src->vp_ctrl_hdr, &dst->vp_ctrl_hdr);
1304 ISP_IOXPUT_32(isp, src->vp_ctrl_handle, &dst->vp_ctrl_handle);
1305 ISP_IOXPUT_16(isp, src->vp_ctrl_index_fail, &dst->vp_ctrl_index_fail);
1306 ISP_IOXPUT_16(isp, src->vp_ctrl_status, &dst->vp_ctrl_status);
1307 ISP_IOXPUT_16(isp, src->vp_ctrl_command, &dst->vp_ctrl_command);
1308 ISP_IOXPUT_16(isp, src->vp_ctrl_vp_count, &dst->vp_ctrl_vp_count);
1309 for (i = 0; i < ASIZE(src->vp_ctrl_idmap); i++) {
1310 ISP_IOXPUT_16(isp, src->vp_ctrl_idmap[i], &dst->vp_ctrl_idmap[i]);
1312 for (i = 0; i < ASIZE(src->vp_ctrl_reserved); i++) {
1313 ISP_IOXPUT_16(isp, src->vp_ctrl_reserved[i], &dst->vp_ctrl_reserved[i]);
1315 ISP_IOXPUT_16(isp, src->vp_ctrl_fcf_index, &dst->vp_ctrl_fcf_index);
1319 isp_get_vp_ctrl_info(ispsoftc_t *isp, vp_ctrl_info_t *src, vp_ctrl_info_t *dst)
1322 isp_get_hdr(isp, &src->vp_ctrl_hdr, &dst->vp_ctrl_hdr);
1323 ISP_IOXGET_32(isp, &src->vp_ctrl_handle, dst->vp_ctrl_handle);
1324 ISP_IOXGET_16(isp, &src->vp_ctrl_index_fail, dst->vp_ctrl_index_fail);
1325 ISP_IOXGET_16(isp, &src->vp_ctrl_status, dst->vp_ctrl_status);
1326 ISP_IOXGET_16(isp, &src->vp_ctrl_command, dst->vp_ctrl_command);
1327 ISP_IOXGET_16(isp, &src->vp_ctrl_vp_count, dst->vp_ctrl_vp_count);
1328 for (i = 0; i < ASIZE(src->vp_ctrl_idmap); i++) {
1329 ISP_IOXGET_16(isp, &src->vp_ctrl_idmap[i], dst->vp_ctrl_idmap[i]);
1331 for (i = 0; i < ASIZE(src->vp_ctrl_reserved); i++) {
1332 ISP_IOXGET_16(isp, &src->vp_ctrl_reserved[i], dst->vp_ctrl_reserved[i]);
1334 ISP_IOXGET_16(isp, &src->vp_ctrl_fcf_index, dst->vp_ctrl_fcf_index);
1338 isp_put_vp_modify(ispsoftc_t *isp, vp_modify_t *src, vp_modify_t *dst)
1341 isp_put_hdr(isp, &src->vp_mod_hdr, &dst->vp_mod_hdr);
1342 ISP_IOXPUT_32(isp, src->vp_mod_hdl, &dst->vp_mod_hdl);
1343 ISP_IOXPUT_16(isp, src->vp_mod_reserved0, &dst->vp_mod_reserved0);
1344 ISP_IOXPUT_16(isp, src->vp_mod_status, &dst->vp_mod_status);
1345 ISP_IOXPUT_8(isp, src->vp_mod_cmd, &dst->vp_mod_cmd);
1346 ISP_IOXPUT_8(isp, src->vp_mod_cnt, &dst->vp_mod_cnt);
1347 ISP_IOXPUT_8(isp, src->vp_mod_idx0, &dst->vp_mod_idx0);
1348 ISP_IOXPUT_8(isp, src->vp_mod_idx1, &dst->vp_mod_idx1);
1349 for (i = 0; i < ASIZE(src->vp_mod_ports); i++) {
1350 ISP_IOXPUT_8(isp, src->vp_mod_ports[i].options, &dst->vp_mod_ports[i].options);
1351 ISP_IOXPUT_8(isp, src->vp_mod_ports[i].loopid, &dst->vp_mod_ports[i].loopid);
1352 ISP_IOXPUT_16(isp, src->vp_mod_ports[i].reserved1, &dst->vp_mod_ports[i].reserved1);
1353 for (j = 0; j < ASIZE(src->vp_mod_ports[i].wwpn); j++) {
1354 ISP_IOXPUT_8(isp, src->vp_mod_ports[i].wwpn[j], &dst->vp_mod_ports[i].wwpn[j]);
1356 for (j = 0; j < ASIZE(src->vp_mod_ports[i].wwnn); j++) {
1357 ISP_IOXPUT_8(isp, src->vp_mod_ports[i].wwnn[j], &dst->vp_mod_ports[i].wwnn[j]);
1360 for (i = 0; i < ASIZE(src->vp_mod_reserved2); i++) {
1361 ISP_IOXPUT_8(isp, src->vp_mod_reserved2[i], &dst->vp_mod_reserved2[i]);
1366 isp_get_vp_modify(ispsoftc_t *isp, vp_modify_t *src, vp_modify_t *dst)
1369 isp_get_hdr(isp, &src->vp_mod_hdr, &dst->vp_mod_hdr);
1370 ISP_IOXGET_32(isp, &src->vp_mod_hdl, dst->vp_mod_hdl);
1371 ISP_IOXGET_16(isp, &src->vp_mod_reserved0, dst->vp_mod_reserved0);
1372 ISP_IOXGET_16(isp, &src->vp_mod_status, dst->vp_mod_status);
1373 ISP_IOXGET_8(isp, &src->vp_mod_cmd, dst->vp_mod_cmd);
1374 ISP_IOXGET_8(isp, &src->vp_mod_cnt, dst->vp_mod_cnt);
1375 ISP_IOXGET_8(isp, &src->vp_mod_idx0, dst->vp_mod_idx0);
1376 ISP_IOXGET_8(isp, &src->vp_mod_idx1, dst->vp_mod_idx1);
1377 for (i = 0; i < ASIZE(src->vp_mod_ports); i++) {
1378 ISP_IOXGET_8(isp, &src->vp_mod_ports[i].options, dst->vp_mod_ports[i].options);
1379 ISP_IOXGET_8(isp, &src->vp_mod_ports[i].loopid, dst->vp_mod_ports[i].loopid);
1380 ISP_IOXGET_16(isp, &src->vp_mod_ports[i].reserved1, dst->vp_mod_ports[i].reserved1);
1381 for (j = 0; j < ASIZE(src->vp_mod_ports[i].wwpn); j++) {
1382 ISP_IOXGET_8(isp, &src->vp_mod_ports[i].wwpn[j], dst->vp_mod_ports[i].wwpn[j]);
1384 for (j = 0; j < ASIZE(src->vp_mod_ports[i].wwnn); j++) {
1385 ISP_IOXGET_8(isp, &src->vp_mod_ports[i].wwnn[j], dst->vp_mod_ports[i].wwnn[j]);
1388 for (i = 0; i < ASIZE(src->vp_mod_reserved2); i++) {
1389 ISP_IOXGET_8(isp, &src->vp_mod_reserved2[i], dst->vp_mod_reserved2[i]);
1394 isp_get_pdb_21xx(ispsoftc_t *isp, isp_pdb_21xx_t *src, isp_pdb_21xx_t *dst)
1397 ISP_IOXGET_16(isp, &src->pdb_options, dst->pdb_options);
1398 ISP_IOXGET_8(isp, &src->pdb_mstate, dst->pdb_mstate);
1399 ISP_IOXGET_8(isp, &src->pdb_sstate, dst->pdb_sstate);
1400 for (i = 0; i < 4; i++) {
1401 ISP_IOXGET_8(isp, &src->pdb_hardaddr_bits[i], dst->pdb_hardaddr_bits[i]);
1403 for (i = 0; i < 4; i++) {
1404 ISP_IOXGET_8(isp, &src->pdb_portid_bits[i], dst->pdb_portid_bits[i]);
1406 for (i = 0; i < 8; i++) {
1407 ISP_IOXGET_8(isp, &src->pdb_nodename[i], dst->pdb_nodename[i]);
1409 for (i = 0; i < 8; i++) {
1410 ISP_IOXGET_8(isp, &src->pdb_portname[i], dst->pdb_portname[i]);
1412 ISP_IOXGET_16(isp, &src->pdb_execthrottle, dst->pdb_execthrottle);
1413 ISP_IOXGET_16(isp, &src->pdb_exec_count, dst->pdb_exec_count);
1414 ISP_IOXGET_8(isp, &src->pdb_retry_count, dst->pdb_retry_count);
1415 ISP_IOXGET_8(isp, &src->pdb_retry_delay, dst->pdb_retry_delay);
1416 ISP_IOXGET_16(isp, &src->pdb_resalloc, dst->pdb_resalloc);
1417 ISP_IOXGET_16(isp, &src->pdb_curalloc, dst->pdb_curalloc);
1418 ISP_IOXGET_16(isp, &src->pdb_qhead, dst->pdb_qhead);
1419 ISP_IOXGET_16(isp, &src->pdb_qtail, dst->pdb_qtail);
1420 ISP_IOXGET_16(isp, &src->pdb_tl_next, dst->pdb_tl_next);
1421 ISP_IOXGET_16(isp, &src->pdb_tl_last, dst->pdb_tl_last);
1422 ISP_IOXGET_16(isp, &src->pdb_features, dst->pdb_features);
1423 ISP_IOXGET_16(isp, &src->pdb_pconcurrnt, dst->pdb_pconcurrnt);
1424 ISP_IOXGET_16(isp, &src->pdb_roi, dst->pdb_roi);
1425 ISP_IOXGET_8(isp, &src->pdb_target, dst->pdb_target);
1426 ISP_IOXGET_8(isp, &src->pdb_initiator, dst->pdb_initiator);
1427 ISP_IOXGET_16(isp, &src->pdb_rdsiz, dst->pdb_rdsiz);
1428 ISP_IOXGET_16(isp, &src->pdb_ncseq, dst->pdb_ncseq);
1429 ISP_IOXGET_16(isp, &src->pdb_noseq, dst->pdb_noseq);
1430 ISP_IOXGET_16(isp, &src->pdb_labrtflg, dst->pdb_labrtflg);
1431 ISP_IOXGET_16(isp, &src->pdb_lstopflg, dst->pdb_lstopflg);
1432 ISP_IOXGET_16(isp, &src->pdb_sqhead, dst->pdb_sqhead);
1433 ISP_IOXGET_16(isp, &src->pdb_sqtail, dst->pdb_sqtail);
1434 ISP_IOXGET_16(isp, &src->pdb_ptimer, dst->pdb_ptimer);
1435 ISP_IOXGET_16(isp, &src->pdb_nxt_seqid, dst->pdb_nxt_seqid);
1436 ISP_IOXGET_16(isp, &src->pdb_fcount, dst->pdb_fcount);
1437 ISP_IOXGET_16(isp, &src->pdb_prli_len, dst->pdb_prli_len);
1438 ISP_IOXGET_16(isp, &src->pdb_prli_svc0, dst->pdb_prli_svc0);
1439 ISP_IOXGET_16(isp, &src->pdb_prli_svc3, dst->pdb_prli_svc3);
1440 ISP_IOXGET_16(isp, &src->pdb_loopid, dst->pdb_loopid);
1441 ISP_IOXGET_16(isp, &src->pdb_il_ptr, dst->pdb_il_ptr);
1442 ISP_IOXGET_16(isp, &src->pdb_sl_ptr, dst->pdb_sl_ptr);
1446 isp_get_pdb_24xx(ispsoftc_t *isp, isp_pdb_24xx_t *src, isp_pdb_24xx_t *dst)
1449 ISP_IOXGET_16(isp, &src->pdb_flags, dst->pdb_flags);
1450 ISP_IOXGET_8(isp, &src->pdb_curstate, dst->pdb_curstate);
1451 ISP_IOXGET_8(isp, &src->pdb_laststate, dst->pdb_laststate);
1452 for (i = 0; i < 4; i++) {
1453 ISP_IOXGET_8(isp, &src->pdb_hardaddr_bits[i], dst->pdb_hardaddr_bits[i]);
1455 for (i = 0; i < 4; i++) {
1456 ISP_IOXGET_8(isp, &src->pdb_portid_bits[i], dst->pdb_portid_bits[i]);
1458 ISP_IOXGET_16(isp, &src->pdb_retry_timer, dst->pdb_retry_timer);
1459 ISP_IOXGET_16(isp, &src->pdb_handle, dst->pdb_handle);
1460 ISP_IOXGET_16(isp, &src->pdb_rcv_dsize, dst->pdb_rcv_dsize);
1461 ISP_IOXGET_16(isp, &src->pdb_reserved0, dst->pdb_reserved0);
1462 ISP_IOXGET_16(isp, &src->pdb_prli_svc0, dst->pdb_prli_svc0);
1463 ISP_IOXGET_16(isp, &src->pdb_prli_svc3, dst->pdb_prli_svc3);
1464 for (i = 0; i < 8; i++) {
1465 ISP_IOXGET_8(isp, &src->pdb_nodename[i], dst->pdb_nodename[i]);
1467 for (i = 0; i < 8; i++) {
1468 ISP_IOXGET_8(isp, &src->pdb_portname[i], dst->pdb_portname[i]);
1470 for (i = 0; i < 24; i++) {
1471 ISP_IOXGET_8(isp, &src->pdb_reserved1[i], dst->pdb_reserved1[i]);
1476 isp_get_pnhle_21xx(ispsoftc_t *isp, isp_pnhle_21xx_t *src, isp_pnhle_21xx_t *dst)
1479 ISP_IOXGET_16(isp, &src->pnhle_port_id_lo, dst->pnhle_port_id_lo);
1480 ISP_IOXGET_16(isp, &src->pnhle_port_id_hi_handle, dst->pnhle_port_id_hi_handle);
1484 isp_get_pnhle_23xx(ispsoftc_t *isp, isp_pnhle_23xx_t *src, isp_pnhle_23xx_t *dst)
1487 ISP_IOXGET_16(isp, &src->pnhle_port_id_lo, dst->pnhle_port_id_lo);
1488 ISP_IOXGET_16(isp, &src->pnhle_port_id_hi, dst->pnhle_port_id_hi);
1489 ISP_IOXGET_16(isp, &src->pnhle_handle, dst->pnhle_handle);
1493 isp_get_pnhle_24xx(ispsoftc_t *isp, isp_pnhle_24xx_t *src, isp_pnhle_24xx_t *dst)
1496 ISP_IOXGET_16(isp, &src->pnhle_port_id_lo, dst->pnhle_port_id_lo);
1497 ISP_IOXGET_16(isp, &src->pnhle_port_id_hi, dst->pnhle_port_id_hi);
1498 ISP_IOXGET_16(isp, &src->pnhle_handle, dst->pnhle_handle);
1499 ISP_IOXGET_16(isp, &src->pnhle_reserved, dst->pnhle_reserved);
1503 isp_get_pnnle(ispsoftc_t *isp, isp_pnnle_t *src, isp_pnnle_t *dst)
1507 for (i = 0; i < 8; i++)
1508 ISP_IOXGET_8(isp, &src->pnnle_name[i], dst->pnnle_name[i]);
1509 ISP_IOXGET_16(isp, &src->pnnle_handle, dst->pnnle_handle);
1510 ISP_IOXGET_16(isp, &src->pnnle_reserved, dst->pnnle_reserved);
1514 * PLOGI/LOGO IOCB canonicalization
1518 isp_get_plogx(ispsoftc_t *isp, isp_plogx_t *src, isp_plogx_t *dst)
1521 isp_get_hdr(isp, &src->plogx_header, &dst->plogx_header);
1522 ISP_IOXGET_32(isp, &src->plogx_handle, dst->plogx_handle);
1523 ISP_IOXGET_16(isp, &src->plogx_status, dst->plogx_status);
1524 ISP_IOXGET_16(isp, &src->plogx_nphdl, dst->plogx_nphdl);
1525 ISP_IOXGET_16(isp, &src->plogx_flags, dst->plogx_flags);
1526 ISP_IOXGET_16(isp, &src->plogx_vphdl, dst->plogx_vphdl);
1527 ISP_IOXGET_16(isp, &src->plogx_portlo, dst->plogx_portlo);
1528 ISP_IOXGET_16(isp, &src->plogx_rspsz_porthi, dst->plogx_rspsz_porthi);
1529 for (i = 0; i < 11; i++) {
1530 ISP_IOXGET_16(isp, &src->plogx_ioparm[i].lo16, dst->plogx_ioparm[i].lo16);
1531 ISP_IOXGET_16(isp, &src->plogx_ioparm[i].hi16, dst->plogx_ioparm[i].hi16);
1536 isp_put_plogx(ispsoftc_t *isp, isp_plogx_t *src, isp_plogx_t *dst)
1539 isp_put_hdr(isp, &src->plogx_header, &dst->plogx_header);
1540 ISP_IOXPUT_32(isp, src->plogx_handle, &dst->plogx_handle);
1541 ISP_IOXPUT_16(isp, src->plogx_status, &dst->plogx_status);
1542 ISP_IOXPUT_16(isp, src->plogx_nphdl, &dst->plogx_nphdl);
1543 ISP_IOXPUT_16(isp, src->plogx_flags, &dst->plogx_flags);
1544 ISP_IOXPUT_16(isp, src->plogx_vphdl, &dst->plogx_vphdl);
1545 ISP_IOXPUT_16(isp, src->plogx_portlo, &dst->plogx_portlo);
1546 ISP_IOXPUT_16(isp, src->plogx_rspsz_porthi, &dst->plogx_rspsz_porthi);
1547 for (i = 0; i < 11; i++) {
1548 ISP_IOXPUT_16(isp, src->plogx_ioparm[i].lo16, &dst->plogx_ioparm[i].lo16);
1549 ISP_IOXPUT_16(isp, src->plogx_ioparm[i].hi16, &dst->plogx_ioparm[i].hi16);
1554 * Report ID canonicalization
1557 isp_get_ridacq(ispsoftc_t *isp, isp_ridacq_t *src, isp_ridacq_t *dst)
1560 isp_get_hdr(isp, &src->ridacq_hdr, &dst->ridacq_hdr);
1561 ISP_IOXGET_32(isp, &src->ridacq_handle, dst->ridacq_handle);
1562 ISP_IOXGET_8(isp, &src->ridacq_vp_acquired, dst->ridacq_vp_acquired);
1563 ISP_IOXGET_8(isp, &src->ridacq_vp_setup, dst->ridacq_vp_setup);
1564 ISP_IOXGET_8(isp, &src->ridacq_vp_index, dst->ridacq_vp_index);
1565 ISP_IOXGET_8(isp, &src->ridacq_vp_status, dst->ridacq_vp_status);
1566 ISP_IOXGET_16(isp, &src->ridacq_vp_port_lo, dst->ridacq_vp_port_lo);
1567 ISP_IOXGET_8(isp, &src->ridacq_vp_port_hi, dst->ridacq_vp_port_hi);
1568 ISP_IOXGET_8(isp, &src->ridacq_format, dst->ridacq_format);
1569 for (i = 0; i < sizeof (src->ridacq_map) / sizeof (src->ridacq_map[0]); i++) {
1570 ISP_IOXGET_16(isp, &src->ridacq_map[i], dst->ridacq_map[i]);
1572 for (i = 0; i < sizeof (src->ridacq_reserved1) / sizeof (src->ridacq_reserved1[0]); i++) {
1573 ISP_IOXGET_16(isp, &src->ridacq_reserved1[i], dst->ridacq_reserved1[i]);
1579 * CT Passthru canonicalization
1582 isp_get_ct_pt(ispsoftc_t *isp, isp_ct_pt_t *src, isp_ct_pt_t *dst)
1586 isp_get_hdr(isp, &src->ctp_header, &dst->ctp_header);
1587 ISP_IOXGET_32(isp, &src->ctp_handle, dst->ctp_handle);
1588 ISP_IOXGET_16(isp, &src->ctp_status, dst->ctp_status);
1589 ISP_IOXGET_16(isp, &src->ctp_nphdl, dst->ctp_nphdl);
1590 ISP_IOXGET_16(isp, &src->ctp_cmd_cnt, dst->ctp_cmd_cnt);
1591 ISP_IOXGET_8(isp, &src->ctp_vpidx, dst->ctp_vpidx);
1592 ISP_IOXGET_8(isp, &src->ctp_reserved0, dst->ctp_reserved0);
1593 ISP_IOXGET_16(isp, &src->ctp_time, dst->ctp_time);
1594 ISP_IOXGET_16(isp, &src->ctp_reserved1, dst->ctp_reserved1);
1595 ISP_IOXGET_16(isp, &src->ctp_rsp_cnt, dst->ctp_rsp_cnt);
1596 for (i = 0; i < 5; i++) {
1597 ISP_IOXGET_16(isp, &src->ctp_reserved2[i], dst->ctp_reserved2[i]);
1599 ISP_IOXGET_32(isp, &src->ctp_rsp_bcnt, dst->ctp_rsp_bcnt);
1600 ISP_IOXGET_32(isp, &src->ctp_cmd_bcnt, dst->ctp_cmd_bcnt);
1601 for (i = 0; i < 2; i++) {
1602 ISP_IOXGET_32(isp, &src->ctp_dataseg[i].ds_base, dst->ctp_dataseg[i].ds_base);
1603 ISP_IOXGET_32(isp, &src->ctp_dataseg[i].ds_basehi, dst->ctp_dataseg[i].ds_basehi);
1604 ISP_IOXGET_32(isp, &src->ctp_dataseg[i].ds_count, dst->ctp_dataseg[i].ds_count);
1609 isp_get_ms(ispsoftc_t *isp, isp_ms_t *src, isp_ms_t *dst)
1613 isp_get_hdr(isp, &src->ms_header, &dst->ms_header);
1614 ISP_IOXGET_32(isp, &src->ms_handle, dst->ms_handle);
1615 ISP_IOXGET_16(isp, &src->ms_nphdl, dst->ms_nphdl);
1616 ISP_IOXGET_16(isp, &src->ms_status, dst->ms_status);
1617 ISP_IOXGET_16(isp, &src->ms_flags, dst->ms_flags);
1618 ISP_IOXGET_16(isp, &src->ms_reserved1, dst->ms_reserved1);
1619 ISP_IOXGET_16(isp, &src->ms_time, dst->ms_time);
1620 ISP_IOXGET_16(isp, &src->ms_cmd_cnt, dst->ms_cmd_cnt);
1621 ISP_IOXGET_16(isp, &src->ms_tot_cnt, dst->ms_tot_cnt);
1622 ISP_IOXGET_8(isp, &src->ms_type, dst->ms_type);
1623 ISP_IOXGET_8(isp, &src->ms_r_ctl, dst->ms_r_ctl);
1624 ISP_IOXGET_16(isp, &src->ms_rxid, dst->ms_rxid);
1625 ISP_IOXGET_16(isp, &src->ms_reserved2, dst->ms_reserved2);
1626 ISP_IOXGET_32(isp, &src->ms_rsp_bcnt, dst->ms_rsp_bcnt);
1627 ISP_IOXGET_32(isp, &src->ms_cmd_bcnt, dst->ms_cmd_bcnt);
1628 for (i = 0; i < 2; i++) {
1629 ISP_IOXGET_32(isp, &src->ms_dataseg[i].ds_base, dst->ms_dataseg[i].ds_base);
1630 ISP_IOXGET_32(isp, &src->ms_dataseg[i].ds_basehi, dst->ms_dataseg[i].ds_basehi);
1631 ISP_IOXGET_32(isp, &src->ms_dataseg[i].ds_count, dst->ms_dataseg[i].ds_count);
1636 isp_put_ct_pt(ispsoftc_t *isp, isp_ct_pt_t *src, isp_ct_pt_t *dst)
1640 isp_put_hdr(isp, &src->ctp_header, &dst->ctp_header);
1641 ISP_IOXPUT_32(isp, src->ctp_handle, &dst->ctp_handle);
1642 ISP_IOXPUT_16(isp, src->ctp_status, &dst->ctp_status);
1643 ISP_IOXPUT_16(isp, src->ctp_nphdl, &dst->ctp_nphdl);
1644 ISP_IOXPUT_16(isp, src->ctp_cmd_cnt, &dst->ctp_cmd_cnt);
1645 ISP_IOXPUT_8(isp, src->ctp_vpidx, &dst->ctp_vpidx);
1646 ISP_IOXPUT_8(isp, src->ctp_reserved0, &dst->ctp_reserved0);
1647 ISP_IOXPUT_16(isp, src->ctp_time, &dst->ctp_time);
1648 ISP_IOXPUT_16(isp, src->ctp_reserved1, &dst->ctp_reserved1);
1649 ISP_IOXPUT_16(isp, src->ctp_rsp_cnt, &dst->ctp_rsp_cnt);
1650 for (i = 0; i < 5; i++) {
1651 ISP_IOXPUT_16(isp, src->ctp_reserved2[i], &dst->ctp_reserved2[i]);
1653 ISP_IOXPUT_32(isp, src->ctp_rsp_bcnt, &dst->ctp_rsp_bcnt);
1654 ISP_IOXPUT_32(isp, src->ctp_cmd_bcnt, &dst->ctp_cmd_bcnt);
1655 for (i = 0; i < 2; i++) {
1656 ISP_IOXPUT_32(isp, src->ctp_dataseg[i].ds_base, &dst->ctp_dataseg[i].ds_base);
1657 ISP_IOXPUT_32(isp, src->ctp_dataseg[i].ds_basehi, &dst->ctp_dataseg[i].ds_basehi);
1658 ISP_IOXPUT_32(isp, src->ctp_dataseg[i].ds_count, &dst->ctp_dataseg[i].ds_count);
1663 isp_put_ms(ispsoftc_t *isp, isp_ms_t *src, isp_ms_t *dst)
1667 isp_put_hdr(isp, &src->ms_header, &dst->ms_header);
1668 ISP_IOXPUT_32(isp, src->ms_handle, &dst->ms_handle);
1669 ISP_IOXPUT_16(isp, src->ms_nphdl, &dst->ms_nphdl);
1670 ISP_IOXPUT_16(isp, src->ms_status, &dst->ms_status);
1671 ISP_IOXPUT_16(isp, src->ms_flags, &dst->ms_flags);
1672 ISP_IOXPUT_16(isp, src->ms_reserved1, &dst->ms_reserved1);
1673 ISP_IOXPUT_16(isp, src->ms_time, &dst->ms_time);
1674 ISP_IOXPUT_16(isp, src->ms_cmd_cnt, &dst->ms_cmd_cnt);
1675 ISP_IOXPUT_16(isp, src->ms_tot_cnt, &dst->ms_tot_cnt);
1676 ISP_IOXPUT_8(isp, src->ms_type, &dst->ms_type);
1677 ISP_IOXPUT_8(isp, src->ms_r_ctl, &dst->ms_r_ctl);
1678 ISP_IOXPUT_16(isp, src->ms_rxid, &dst->ms_rxid);
1679 ISP_IOXPUT_16(isp, src->ms_reserved2, &dst->ms_reserved2);
1680 ISP_IOXPUT_32(isp, src->ms_rsp_bcnt, &dst->ms_rsp_bcnt);
1681 ISP_IOXPUT_32(isp, src->ms_cmd_bcnt, &dst->ms_cmd_bcnt);
1682 for (i = 0; i < 2; i++) {
1683 ISP_IOXPUT_32(isp, src->ms_dataseg[i].ds_base, &dst->ms_dataseg[i].ds_base);
1684 ISP_IOXPUT_32(isp, src->ms_dataseg[i].ds_basehi, &dst->ms_dataseg[i].ds_basehi);
1685 ISP_IOXPUT_32(isp, src->ms_dataseg[i].ds_count, &dst->ms_dataseg[i].ds_count);
1690 * Generic SNS request - not particularly useful since the per-command data
1691 * isn't always 16 bit words.
1694 isp_put_sns_request(ispsoftc_t *isp, sns_screq_t *src, sns_screq_t *dst)
1696 int i, nw = (int) src->snscb_sblen;
1697 ISP_IOXPUT_16(isp, src->snscb_rblen, &dst->snscb_rblen);
1698 for (i = 0; i < 4; i++) {
1699 ISP_IOXPUT_16(isp, src->snscb_addr[i], &dst->snscb_addr[i]);
1701 ISP_IOXPUT_16(isp, src->snscb_sblen, &dst->snscb_sblen);
1702 for (i = 0; i < nw; i++) {
1703 ISP_IOXPUT_16(isp, src->snscb_data[i], &dst->snscb_data[i]);
1708 isp_put_gid_ft_request(ispsoftc_t *isp, sns_gid_ft_req_t *src, sns_gid_ft_req_t *dst)
1710 ISP_IOXPUT_16(isp, src->snscb_rblen, &dst->snscb_rblen);
1711 ISP_IOXPUT_16(isp, src->snscb_reserved0, &dst->snscb_reserved0);
1712 ISP_IOXPUT_16(isp, src->snscb_addr[0], &dst->snscb_addr[0]);
1713 ISP_IOXPUT_16(isp, src->snscb_addr[1], &dst->snscb_addr[1]);
1714 ISP_IOXPUT_16(isp, src->snscb_addr[2], &dst->snscb_addr[2]);
1715 ISP_IOXPUT_16(isp, src->snscb_addr[3], &dst->snscb_addr[3]);
1716 ISP_IOXPUT_16(isp, src->snscb_sblen, &dst->snscb_sblen);
1717 ISP_IOXPUT_16(isp, src->snscb_reserved1, &dst->snscb_reserved1);
1718 ISP_IOXPUT_16(isp, src->snscb_cmd, &dst->snscb_cmd);
1719 ISP_IOXPUT_16(isp, src->snscb_mword_div_2, &dst->snscb_mword_div_2);
1720 ISP_IOXPUT_32(isp, src->snscb_reserved3, &dst->snscb_reserved3);
1721 ISP_IOXPUT_32(isp, src->snscb_fc4_type, &dst->snscb_fc4_type);
1725 isp_put_gxn_id_request(ispsoftc_t *isp, sns_gxn_id_req_t *src, sns_gxn_id_req_t *dst)
1727 ISP_IOXPUT_16(isp, src->snscb_rblen, &dst->snscb_rblen);
1728 ISP_IOXPUT_16(isp, src->snscb_reserved0, &dst->snscb_reserved0);
1729 ISP_IOXPUT_16(isp, src->snscb_addr[0], &dst->snscb_addr[0]);
1730 ISP_IOXPUT_16(isp, src->snscb_addr[1], &dst->snscb_addr[1]);
1731 ISP_IOXPUT_16(isp, src->snscb_addr[2], &dst->snscb_addr[2]);
1732 ISP_IOXPUT_16(isp, src->snscb_addr[3], &dst->snscb_addr[3]);
1733 ISP_IOXPUT_16(isp, src->snscb_sblen, &dst->snscb_sblen);
1734 ISP_IOXPUT_16(isp, src->snscb_reserved1, &dst->snscb_reserved1);
1735 ISP_IOXPUT_16(isp, src->snscb_cmd, &dst->snscb_cmd);
1736 ISP_IOXPUT_16(isp, src->snscb_reserved2, &dst->snscb_reserved2);
1737 ISP_IOXPUT_32(isp, src->snscb_reserved3, &dst->snscb_reserved3);
1738 ISP_IOXPUT_32(isp, src->snscb_portid, &dst->snscb_portid);
1742 * Generic SNS response - not particularly useful since the per-command data
1743 * isn't always 16 bit words.
1746 isp_get_sns_response(ispsoftc_t *isp, sns_scrsp_t *src, sns_scrsp_t *dst, int nwords)
1749 isp_get_ct_hdr(isp, &src->snscb_cthdr, &dst->snscb_cthdr);
1750 ISP_IOXGET_8(isp, &src->snscb_port_type, dst->snscb_port_type);
1751 for (i = 0; i < 3; i++) {
1752 ISP_IOXGET_8(isp, &src->snscb_port_id[i],
1753 dst->snscb_port_id[i]);
1755 for (i = 0; i < 8; i++) {
1756 ISP_IOXGET_8(isp, &src->snscb_portname[i],
1757 dst->snscb_portname[i]);
1759 for (i = 0; i < nwords; i++) {
1760 ISP_IOXGET_16(isp, &src->snscb_data[i], dst->snscb_data[i]);
1765 isp_get_gid_ft_response(ispsoftc_t *isp, sns_gid_ft_rsp_t *src, sns_gid_ft_rsp_t *dst, int nwords)
1768 isp_get_ct_hdr(isp, &src->snscb_cthdr, &dst->snscb_cthdr);
1769 for (i = 0; i < nwords; i++) {
1771 ISP_IOXGET_8(isp, &src->snscb_ports[i].control, dst->snscb_ports[i].control);
1772 for (j = 0; j < 3; j++) {
1773 ISP_IOXGET_8(isp, &src->snscb_ports[i].portid[j], dst->snscb_ports[i].portid[j]);
1775 if (dst->snscb_ports[i].control & 0x80) {
1782 isp_get_gxn_id_response(ispsoftc_t *isp, sns_gxn_id_rsp_t *src, sns_gxn_id_rsp_t *dst)
1785 isp_get_ct_hdr(isp, &src->snscb_cthdr, &dst->snscb_cthdr);
1786 for (i = 0; i < 8; i++) {
1787 ISP_IOXGET_8(isp, &src->snscb_wwn[i], dst->snscb_wwn[i]);
1792 isp_get_gff_id_response(ispsoftc_t *isp, sns_gff_id_rsp_t *src, sns_gff_id_rsp_t *dst)
1795 isp_get_ct_hdr(isp, &src->snscb_cthdr, &dst->snscb_cthdr);
1796 for (i = 0; i < 32; i++) {
1797 ISP_IOXGET_32(isp, &src->snscb_fc4_features[i], dst->snscb_fc4_features[i]);
1802 isp_get_ga_nxt_response(ispsoftc_t *isp, sns_ga_nxt_rsp_t *src, sns_ga_nxt_rsp_t *dst)
1805 isp_get_ct_hdr(isp, &src->snscb_cthdr, &dst->snscb_cthdr);
1806 ISP_IOXGET_8(isp, &src->snscb_port_type, dst->snscb_port_type);
1807 for (i = 0; i < 3; i++) {
1808 ISP_IOXGET_8(isp, &src->snscb_port_id[i], dst->snscb_port_id[i]);
1810 for (i = 0; i < 8; i++) {
1811 ISP_IOXGET_8(isp, &src->snscb_portname[i], dst->snscb_portname[i]);
1813 ISP_IOXGET_8(isp, &src->snscb_pnlen, dst->snscb_pnlen);
1814 for (i = 0; i < 255; i++) {
1815 ISP_IOXGET_8(isp, &src->snscb_pname[i], dst->snscb_pname[i]);
1817 for (i = 0; i < 8; i++) {
1818 ISP_IOXGET_8(isp, &src->snscb_nodename[i], dst->snscb_nodename[i]);
1820 ISP_IOXGET_8(isp, &src->snscb_nnlen, dst->snscb_nnlen);
1821 for (i = 0; i < 255; i++) {
1822 ISP_IOXGET_8(isp, &src->snscb_nname[i], dst->snscb_nname[i]);
1824 for (i = 0; i < 8; i++) {
1825 ISP_IOXGET_8(isp, &src->snscb_ipassoc[i], dst->snscb_ipassoc[i]);
1827 for (i = 0; i < 16; i++) {
1828 ISP_IOXGET_8(isp, &src->snscb_ipaddr[i], dst->snscb_ipaddr[i]);
1830 for (i = 0; i < 4; i++) {
1831 ISP_IOXGET_8(isp, &src->snscb_svc_class[i], dst->snscb_svc_class[i]);
1833 for (i = 0; i < 32; i++) {
1834 ISP_IOXGET_8(isp, &src->snscb_fc4_types[i], dst->snscb_fc4_types[i]);
1836 for (i = 0; i < 8; i++) {
1837 ISP_IOXGET_8(isp, &src->snscb_fpname[i], dst->snscb_fpname[i]);
1839 ISP_IOXGET_8(isp, &src->snscb_reserved, dst->snscb_reserved);
1840 for (i = 0; i < 3; i++) {
1841 ISP_IOXGET_8(isp, &src->snscb_hardaddr[i], dst->snscb_hardaddr[i]);
1846 isp_get_els(ispsoftc_t *isp, els_t *src, els_t *dst)
1850 isp_get_hdr(isp, &src->els_hdr, &dst->els_hdr);
1851 ISP_IOXGET_32(isp, &src->els_handle, dst->els_handle);
1852 ISP_IOXGET_16(isp, &src->els_status, dst->els_status);
1853 ISP_IOXGET_16(isp, &src->els_nphdl, dst->els_nphdl);
1854 ISP_IOXGET_16(isp, &src->els_xmit_dsd_count, dst->els_xmit_dsd_count);
1855 ISP_IOXGET_8(isp, &src->els_vphdl, dst->els_vphdl);
1856 ISP_IOXGET_8(isp, &src->els_sof, dst->els_sof);
1857 ISP_IOXGET_32(isp, &src->els_rxid, dst->els_rxid);
1858 ISP_IOXGET_16(isp, &src->els_recv_dsd_count, dst->els_recv_dsd_count);
1859 ISP_IOXGET_8(isp, &src->els_opcode, dst->els_opcode);
1860 ISP_IOXGET_8(isp, &src->els_reserved2, dst->els_reserved1);
1861 ISP_IOXGET_8(isp, &src->els_did_lo, dst->els_did_lo);
1862 ISP_IOXGET_8(isp, &src->els_did_mid, dst->els_did_mid);
1863 ISP_IOXGET_8(isp, &src->els_did_hi, dst->els_did_hi);
1864 ISP_IOXGET_8(isp, &src->els_reserved2, dst->els_reserved2);
1865 ISP_IOXGET_16(isp, &src->els_reserved3, dst->els_reserved3);
1866 ISP_IOXGET_16(isp, &src->els_ctl_flags, dst->els_ctl_flags);
1867 ISP_IOXGET_32(isp, &src->els_bytecnt, dst->els_bytecnt);
1868 ISP_IOXGET_32(isp, &src->els_subcode1, dst->els_subcode1);
1869 ISP_IOXGET_32(isp, &src->els_subcode2, dst->els_subcode2);
1870 for (i = 0; i < 20; i++) {
1871 ISP_IOXGET_8(isp, &src->els_reserved4[i], dst->els_reserved4[i]);
1876 isp_put_els(ispsoftc_t *isp, els_t *src, els_t *dst)
1878 isp_put_hdr(isp, &src->els_hdr, &dst->els_hdr);
1879 ISP_IOXPUT_32(isp, src->els_handle, &dst->els_handle);
1880 ISP_IOXPUT_16(isp, src->els_status, &dst->els_status);
1881 ISP_IOXPUT_16(isp, src->els_nphdl, &dst->els_nphdl);
1882 ISP_IOXPUT_16(isp, src->els_xmit_dsd_count, &dst->els_xmit_dsd_count);
1883 ISP_IOXPUT_8(isp, src->els_vphdl, &dst->els_vphdl);
1884 ISP_IOXPUT_8(isp, src->els_sof, &dst->els_sof);
1885 ISP_IOXPUT_32(isp, src->els_rxid, &dst->els_rxid);
1886 ISP_IOXPUT_16(isp, src->els_recv_dsd_count, &dst->els_recv_dsd_count);
1887 ISP_IOXPUT_8(isp, src->els_opcode, &dst->els_opcode);
1888 ISP_IOXPUT_8(isp, src->els_reserved2, &dst->els_reserved1);
1889 ISP_IOXPUT_8(isp, src->els_did_lo, &dst->els_did_lo);
1890 ISP_IOXPUT_8(isp, src->els_did_mid, &dst->els_did_mid);
1891 ISP_IOXPUT_8(isp, src->els_did_hi, &dst->els_did_hi);
1892 ISP_IOXPUT_8(isp, src->els_reserved2, &dst->els_reserved2);
1893 ISP_IOXPUT_16(isp, src->els_reserved3, &dst->els_reserved3);
1894 ISP_IOXPUT_16(isp, src->els_ctl_flags, &dst->els_ctl_flags);
1895 ISP_IOXPUT_32(isp, src->els_recv_bytecnt, &dst->els_recv_bytecnt);
1896 ISP_IOXPUT_32(isp, src->els_xmit_bytecnt, &dst->els_xmit_bytecnt);
1897 ISP_IOXPUT_32(isp, src->els_xmit_dsd_length, &dst->els_xmit_dsd_length);
1898 ISP_IOXPUT_16(isp, src->els_xmit_dsd_a1500, &dst->els_xmit_dsd_a1500);
1899 ISP_IOXPUT_16(isp, src->els_xmit_dsd_a3116, &dst->els_xmit_dsd_a3116);
1900 ISP_IOXPUT_16(isp, src->els_xmit_dsd_a4732, &dst->els_xmit_dsd_a4732);
1901 ISP_IOXPUT_16(isp, src->els_xmit_dsd_a6348, &dst->els_xmit_dsd_a6348);
1902 ISP_IOXPUT_32(isp, src->els_recv_dsd_length, &dst->els_recv_dsd_length);
1903 ISP_IOXPUT_16(isp, src->els_recv_dsd_a1500, &dst->els_recv_dsd_a1500);
1904 ISP_IOXPUT_16(isp, src->els_recv_dsd_a3116, &dst->els_recv_dsd_a3116);
1905 ISP_IOXPUT_16(isp, src->els_recv_dsd_a4732, &dst->els_recv_dsd_a4732);
1906 ISP_IOXPUT_16(isp, src->els_recv_dsd_a6348, &dst->els_recv_dsd_a6348);
1910 * FC Structure Canonicalization
1914 isp_get_fc_hdr(ispsoftc_t *isp, fc_hdr_t *src, fc_hdr_t *dst)
1916 ISP_IOZGET_8(isp, &src->r_ctl, dst->r_ctl);
1917 ISP_IOZGET_8(isp, &src->d_id[0], dst->d_id[0]);
1918 ISP_IOZGET_8(isp, &src->d_id[1], dst->d_id[1]);
1919 ISP_IOZGET_8(isp, &src->d_id[2], dst->d_id[2]);
1920 ISP_IOZGET_8(isp, &src->cs_ctl, dst->cs_ctl);
1921 ISP_IOZGET_8(isp, &src->s_id[0], dst->s_id[0]);
1922 ISP_IOZGET_8(isp, &src->s_id[1], dst->s_id[1]);
1923 ISP_IOZGET_8(isp, &src->s_id[2], dst->s_id[2]);
1924 ISP_IOZGET_8(isp, &src->type, dst->type);
1925 ISP_IOZGET_8(isp, &src->f_ctl[0], dst->f_ctl[0]);
1926 ISP_IOZGET_8(isp, &src->f_ctl[1], dst->f_ctl[1]);
1927 ISP_IOZGET_8(isp, &src->f_ctl[2], dst->f_ctl[2]);
1928 ISP_IOZGET_8(isp, &src->seq_id, dst->seq_id);
1929 ISP_IOZGET_8(isp, &src->df_ctl, dst->df_ctl);
1930 ISP_IOZGET_16(isp, &src->seq_cnt, dst->seq_cnt);
1931 ISP_IOZGET_16(isp, &src->ox_id, dst->ox_id);
1932 ISP_IOZGET_16(isp, &src->rx_id, dst->rx_id);
1933 ISP_IOZGET_32(isp, &src->parameter, dst->parameter);
1937 isp_put_fc_hdr(ispsoftc_t *isp, fc_hdr_t *src, fc_hdr_t *dst)
1939 ISP_IOZPUT_8(isp, src->r_ctl, &dst->r_ctl);
1940 ISP_IOZPUT_8(isp, src->d_id[0], &dst->d_id[0]);
1941 ISP_IOZPUT_8(isp, src->d_id[1], &dst->d_id[1]);
1942 ISP_IOZPUT_8(isp, src->d_id[2], &dst->d_id[2]);
1943 ISP_IOZPUT_8(isp, src->cs_ctl, &dst->cs_ctl);
1944 ISP_IOZPUT_8(isp, src->s_id[0], &dst->s_id[0]);
1945 ISP_IOZPUT_8(isp, src->s_id[1], &dst->s_id[1]);
1946 ISP_IOZPUT_8(isp, src->s_id[2], &dst->s_id[2]);
1947 ISP_IOZPUT_8(isp, src->type, &dst->type);
1948 ISP_IOZPUT_8(isp, src->f_ctl[0], &dst->f_ctl[0]);
1949 ISP_IOZPUT_8(isp, src->f_ctl[1], &dst->f_ctl[1]);
1950 ISP_IOZPUT_8(isp, src->f_ctl[2], &dst->f_ctl[2]);
1951 ISP_IOZPUT_8(isp, src->seq_id, &dst->seq_id);
1952 ISP_IOZPUT_8(isp, src->df_ctl, &dst->df_ctl);
1953 ISP_IOZPUT_16(isp, src->seq_cnt, &dst->seq_cnt);
1954 ISP_IOZPUT_16(isp, src->ox_id, &dst->ox_id);
1955 ISP_IOZPUT_16(isp, src->rx_id, &dst->rx_id);
1956 ISP_IOZPUT_32(isp, src->parameter, &dst->parameter);
1960 isp_get_fcp_cmnd_iu(ispsoftc_t *isp, fcp_cmnd_iu_t *src, fcp_cmnd_iu_t *dst)
1964 for (i = 0; i < 8; i++) {
1965 ISP_IOZGET_8(isp, &src->fcp_cmnd_lun[i], dst->fcp_cmnd_lun[i]);
1967 ISP_IOZGET_8(isp, &src->fcp_cmnd_crn, dst->fcp_cmnd_crn);
1968 ISP_IOZGET_8(isp, &src->fcp_cmnd_task_attribute, dst->fcp_cmnd_task_attribute);
1969 ISP_IOZGET_8(isp, &src->fcp_cmnd_task_management, dst->fcp_cmnd_task_management);
1970 ISP_IOZGET_8(isp, &src->fcp_cmnd_alen_datadir, dst->fcp_cmnd_alen_datadir);
1971 for (i = 0; i < 16; i++) {
1972 ISP_IOZGET_8(isp, &src->cdb_dl.sf.fcp_cmnd_cdb[i], dst->cdb_dl.sf.fcp_cmnd_cdb[i]);
1974 ISP_IOZGET_32(isp, &src->cdb_dl.sf.fcp_cmnd_dl, dst->cdb_dl.sf.fcp_cmnd_dl);
1978 isp_put_rft_id(ispsoftc_t *isp, rft_id_t *src, rft_id_t *dst)
1981 isp_put_ct_hdr(isp, &src->rftid_hdr, &dst->rftid_hdr);
1982 ISP_IOZPUT_8(isp, src->rftid_reserved, &dst->rftid_reserved);
1983 for (i = 0; i < 3; i++) {
1984 ISP_IOZPUT_8(isp, src->rftid_portid[i], &dst->rftid_portid[i]);
1986 for (i = 0; i < 8; i++) {
1987 ISP_IOZPUT_32(isp, src->rftid_fc4types[i], &dst->rftid_fc4types[i]);
1992 isp_put_rspn_id(ispsoftc_t *isp, rspn_id_t *src, rspn_id_t *dst)
1995 isp_put_ct_hdr(isp, &src->rspnid_hdr, &dst->rspnid_hdr);
1996 ISP_IOZPUT_8(isp, src->rspnid_reserved, &dst->rspnid_reserved);
1997 ISP_IOZPUT_8(isp, src->rspnid_length, &dst->rspnid_length);
1998 /* for (i = 0; i < src->rspnid_length; i++)
1999 ISP_IOZPUT_8(isp, src->rspnid_name[i], &dst->rspnid_name[i]);*/
2003 isp_put_rff_id(ispsoftc_t *isp, rff_id_t *src, rff_id_t *dst)
2007 isp_put_ct_hdr(isp, &src->rffid_hdr, &dst->rffid_hdr);
2008 ISP_IOZPUT_8(isp, src->rffid_reserved, &dst->rffid_reserved);
2009 for (i = 0; i < 3; i++)
2010 ISP_IOZPUT_8(isp, src->rffid_portid[i], &dst->rffid_portid[i]);
2011 ISP_IOZPUT_16(isp, src->rffid_reserved2, &dst->rffid_reserved2);
2012 ISP_IOZPUT_8(isp, src->rffid_fc4features, &dst->rffid_fc4features);
2013 ISP_IOZPUT_8(isp, src->rffid_fc4type, &dst->rffid_fc4type);
2017 isp_put_rsnn_nn(ispsoftc_t *isp, rsnn_nn_t *src, rsnn_nn_t *dst)
2020 isp_put_ct_hdr(isp, &src->rsnnnn_hdr, &dst->rsnnnn_hdr);
2021 for (i = 0; i < 8; i++)
2022 ISP_IOZPUT_8(isp, src->rsnnnn_nodename[i], &dst->rsnnnn_nodename[i]);
2023 ISP_IOZPUT_8(isp, src->rsnnnn_length, &dst->rsnnnn_length);
2024 /* for (i = 0; i < src->rsnnnn_length; i++)
2025 ISP_IOZPUT_8(isp, src->rsnnnn_name[i], &dst->rsnnnn_name[i]);*/
2029 isp_get_ct_hdr(ispsoftc_t *isp, ct_hdr_t *src, ct_hdr_t *dst)
2031 ISP_IOZGET_8(isp, &src->ct_revision, dst->ct_revision);
2032 ISP_IOZGET_8(isp, &src->ct_in_id[0], dst->ct_in_id[0]);
2033 ISP_IOZGET_8(isp, &src->ct_in_id[1], dst->ct_in_id[1]);
2034 ISP_IOZGET_8(isp, &src->ct_in_id[2], dst->ct_in_id[2]);
2035 ISP_IOZGET_8(isp, &src->ct_fcs_type, dst->ct_fcs_type);
2036 ISP_IOZGET_8(isp, &src->ct_fcs_subtype, dst->ct_fcs_subtype);
2037 ISP_IOZGET_8(isp, &src->ct_options, dst->ct_options);
2038 ISP_IOZGET_8(isp, &src->ct_reserved0, dst->ct_reserved0);
2039 ISP_IOZGET_16(isp, &src->ct_cmd_resp, dst->ct_cmd_resp);
2040 ISP_IOZGET_16(isp, &src->ct_bcnt_resid, dst->ct_bcnt_resid);
2041 ISP_IOZGET_8(isp, &src->ct_reserved1, dst->ct_reserved1);
2042 ISP_IOZGET_8(isp, &src->ct_reason, dst->ct_reason);
2043 ISP_IOZGET_8(isp, &src->ct_explanation, dst->ct_explanation);
2044 ISP_IOZGET_8(isp, &src->ct_vunique, dst->ct_vunique);
2048 isp_put_ct_hdr(ispsoftc_t *isp, ct_hdr_t *src, ct_hdr_t *dst)
2050 ISP_IOZPUT_8(isp, src->ct_revision, &dst->ct_revision);
2051 ISP_IOZPUT_8(isp, src->ct_in_id[0], &dst->ct_in_id[0]);
2052 ISP_IOZPUT_8(isp, src->ct_in_id[1], &dst->ct_in_id[1]);
2053 ISP_IOZPUT_8(isp, src->ct_in_id[2], &dst->ct_in_id[2]);
2054 ISP_IOZPUT_8(isp, src->ct_fcs_type, &dst->ct_fcs_type);
2055 ISP_IOZPUT_8(isp, src->ct_fcs_subtype, &dst->ct_fcs_subtype);
2056 ISP_IOZPUT_8(isp, src->ct_options, &dst->ct_options);
2057 ISP_IOZPUT_8(isp, src->ct_reserved0, &dst->ct_reserved0);
2058 ISP_IOZPUT_16(isp, src->ct_cmd_resp, &dst->ct_cmd_resp);
2059 ISP_IOZPUT_16(isp, src->ct_bcnt_resid, &dst->ct_bcnt_resid);
2060 ISP_IOZPUT_8(isp, src->ct_reserved1, &dst->ct_reserved1);
2061 ISP_IOZPUT_8(isp, src->ct_reason, &dst->ct_reason);
2062 ISP_IOZPUT_8(isp, src->ct_explanation, &dst->ct_explanation);
2063 ISP_IOZPUT_8(isp, src->ct_vunique, &dst->ct_vunique);
2067 isp_put_fcp_rsp_iu(ispsoftc_t *isp, fcp_rsp_iu_t *src, fcp_rsp_iu_t *dst)
2070 for (i = 0; i < ((sizeof (src->fcp_rsp_reserved))/(sizeof (src->fcp_rsp_reserved[0]))); i++) {
2071 ISP_IOZPUT_8(isp, src->fcp_rsp_reserved[i], &dst->fcp_rsp_reserved[i]);
2073 ISP_IOZPUT_16(isp, src->fcp_rsp_status_qualifier, &dst->fcp_rsp_status_qualifier);
2074 ISP_IOZPUT_8(isp, src->fcp_rsp_bits, &dst->fcp_rsp_bits);
2075 ISP_IOZPUT_8(isp, src->fcp_rsp_scsi_status, &dst->fcp_rsp_scsi_status);
2076 ISP_IOZPUT_32(isp, src->fcp_rsp_resid, &dst->fcp_rsp_resid);
2077 ISP_IOZPUT_32(isp, src->fcp_rsp_snslen, &dst->fcp_rsp_snslen);
2078 ISP_IOZPUT_32(isp, src->fcp_rsp_rsplen, &dst->fcp_rsp_rsplen);
2081 #ifdef ISP_TARGET_MODE
2084 * Command shipping- finish off first queue entry and do dma mapping and
2085 * additional segments as needed.
2087 * Called with the first queue entry mostly filled out.
2088 * Our job here is to finish that and add additional data
2089 * segments if needed.
2091 * We used to do synthetic entries to split data and status
2092 * at this level, but that started getting too tricky.
2095 isp_send_tgt_cmd(ispsoftc_t *isp, void *fqe, void *segp, uint32_t nsegs, uint32_t totalcnt, isp_ddir_t ddir, void *snsptr, uint32_t snslen)
2097 uint8_t storage[QENTRY_LEN];
2099 uint32_t seg, curseg, seglim, nxt, nxtnxt;
2100 ispds_t *dsp = NULL;
2101 ispds64_t *dsp64 = NULL;
2104 qe0 = isp_getrqentry(isp);
2106 return (CMD_EAGAIN);
2108 nxt = ISP_NXT_QENTRY(isp->isp_reqidx, RQUEST_QUEUE_LEN(isp));
2110 type = ((isphdr_t *)fqe)->rqs_entry_type;
2115 * If we have data to transmit, figure out how many segments can fit into the first entry.
2117 if (ddir != ISP_NOXFR) {
2119 * First, figure out how many pieces of data to transfer and what kind and how many we can put into the first queue entry.
2123 dsp = ((ct2_entry_t *)fqe)->rsp.m0.u.ct_dataseg;
2124 seglim = ISP_RQDSEG_T2;
2127 dsp64 = ((ct2_entry_t *)fqe)->rsp.m0.u.ct_dataseg64;
2128 seglim = ISP_RQDSEG_T3;
2131 dsp64 = &((ct7_entry_t *)fqe)->rsp.m0.ds;
2135 return (CMD_COMPLETE);
2140 * First, fill out any of the data transfer stuff that fits
2141 * in the first queue entry.
2143 if (seglim > nsegs) {
2147 for (seg = curseg = 0; curseg < seglim; curseg++) {
2149 XS_GET_DMA64_SEG(dsp64++, segp, seg++);
2151 XS_GET_DMA_SEG(dsp++, segp, seg++);
2156 * Second, start building additional continuation segments as needed.
2158 while (seg < nsegs) {
2159 nxtnxt = ISP_NXT_QENTRY(nxt, RQUEST_QUEUE_LEN(isp));
2160 if (nxtnxt == isp->isp_reqodx) {
2161 isp->isp_reqodx = ISP_READ(isp, isp->isp_rqstoutrp);
2162 if (nxtnxt == isp->isp_reqodx)
2163 return (CMD_EAGAIN);
2165 ISP_MEMZERO(storage, QENTRY_LEN);
2166 qe1 = ISP_QUEUE_ENTRY(isp->isp_rquest, nxt);
2169 ispcontreq64_t *crq = (ispcontreq64_t *) storage;
2170 seglim = ISP_CDSEG64;
2171 crq->req_header.rqs_entry_type = RQSTYPE_A64_CONT;
2172 crq->req_header.rqs_entry_count = 1;
2173 dsp64 = crq->req_dataseg;
2175 ispcontreq_t *crq = (ispcontreq_t *) storage;
2177 crq->req_header.rqs_entry_type = RQSTYPE_DATASEG;
2178 crq->req_header.rqs_entry_count = 1;
2179 dsp = crq->req_dataseg;
2181 if (seg + seglim > nsegs) {
2182 seglim = nsegs - seg;
2184 for (curseg = 0; curseg < seglim; curseg++) {
2186 XS_GET_DMA64_SEG(dsp64++, segp, seg++);
2188 XS_GET_DMA_SEG(dsp++, segp, seg++);
2192 isp_put_cont64_req(isp, (ispcontreq64_t *)storage, qe1);
2194 isp_put_cont_req(isp, (ispcontreq_t *)storage, qe1);
2196 if (isp->isp_dblev & ISP_LOGTDEBUG1) {
2197 isp_print_bytes(isp, "additional queue entry",
2204 * Third, not patch up the first queue entry with the number of segments
2205 * we actually are going to be transmitting. At the same time, handle
2206 * any mode 2 requests.
2208 ((isphdr_t *)fqe)->rqs_entry_count = nqe;
2212 if (((ct2_entry_t *)fqe)->ct_flags & CT2_FLAG_MODE2) {
2213 ((ct2_entry_t *)fqe)->ct_seg_count = 1;
2215 ((ct2_entry_t *)fqe)->ct_seg_count = nsegs;
2217 if (ISP_CAP_2KLOGIN(isp)) {
2218 isp_put_ctio2e(isp, fqe, qe0);
2220 isp_put_ctio2(isp, fqe, qe0);
2224 if (((ct7_entry_t *)fqe)->ct_flags & CT7_FLAG_MODE2) {
2225 ((ct7_entry_t *)fqe)->ct_seg_count = 1;
2227 ((ct7_entry_t *)fqe)->ct_seg_count = nsegs;
2229 isp_put_ctio7(isp, fqe, qe0);
2232 return (CMD_COMPLETE);
2234 if (isp->isp_dblev & ISP_LOGTDEBUG1) {
2235 isp_print_bytes(isp, "first queue entry", QENTRY_LEN, qe0);
2237 ISP_ADD_REQUEST(isp, nxt);
2238 return (CMD_QUEUED);
2244 * Find port database entries
2247 isp_find_pdb_empty(ispsoftc_t *isp, int chan, fcportdb_t **lptr)
2249 fcparam *fcp = FCPARAM(isp, chan);
2252 for (i = 0; i < MAX_FC_TARG; i++) {
2253 fcportdb_t *lp = &fcp->portdb[i];
2255 if (lp->state == FC_PORTDB_STATE_NIL) {
2264 isp_find_pdb_by_wwpn(ispsoftc_t *isp, int chan, uint64_t wwpn, fcportdb_t **lptr)
2266 fcparam *fcp = FCPARAM(isp, chan);
2269 for (i = 0; i < MAX_FC_TARG; i++) {
2270 fcportdb_t *lp = &fcp->portdb[i];
2272 if (lp->state == FC_PORTDB_STATE_NIL)
2274 if (lp->port_wwn == wwpn) {
2283 isp_find_pdb_by_handle(ispsoftc_t *isp, int chan, uint16_t handle,
2286 fcparam *fcp = FCPARAM(isp, chan);
2289 for (i = 0; i < MAX_FC_TARG; i++) {
2290 fcportdb_t *lp = &fcp->portdb[i];
2292 if (lp->state == FC_PORTDB_STATE_NIL)
2294 if (lp->handle == handle) {
2303 isp_find_pdb_by_portid(ispsoftc_t *isp, int chan, uint32_t portid,
2306 fcparam *fcp = FCPARAM(isp, chan);
2309 for (i = 0; i < MAX_FC_TARG; i++) {
2310 fcportdb_t *lp = &fcp->portdb[i];
2312 if (lp->state == FC_PORTDB_STATE_NIL)
2314 if (lp->portid == portid) {
2322 #ifdef ISP_TARGET_MODE
2324 isp_find_chan_by_did(ispsoftc_t *isp, uint32_t did, uint16_t *cp)
2329 for (chan = 0; chan < isp->isp_nchan; chan++) {
2330 fcparam *fcp = FCPARAM(isp, chan);
2331 if ((fcp->role & ISP_ROLE_TARGET) == 0 ||
2332 fcp->isp_loopstate < LOOP_LTEST_DONE) {
2335 if (fcp->isp_portid == did) {
2343 * Add an initiator device to the port database
2346 isp_add_wwn_entry(ispsoftc_t *isp, int chan, uint64_t wwpn, uint64_t wwnn,
2347 uint16_t nphdl, uint32_t s_id, uint16_t prli_params)
2354 fcp = FCPARAM(isp, chan);
2355 if (nphdl >= MAX_NPORT_HANDLE) {
2356 isp_prt(isp, ISP_LOGTINFO|ISP_LOGWARN, "Chan %d WWPN 0x%016llx "
2357 "PortID 0x%06x handle 0x%x -- bad handle",
2358 chan, (unsigned long long) wwpn, s_id, nphdl);
2363 * If valid record for requested handle already exists, update it
2364 * with new parameters. Some cases of update can be suspicious,
2365 * so log them verbosely and dump the whole port database.
2367 if ((VALID_INI(wwpn) && isp_find_pdb_by_wwpn(isp, chan, wwpn, &lp)) ||
2368 (VALID_PORT(s_id) && isp_find_pdb_by_portid(isp, chan, s_id, &lp))) {
2370 lp->new_portid = lp->portid;
2371 lp->new_prli_word3 = lp->prli_word3;
2372 if (VALID_PORT(s_id) && lp->portid != s_id) {
2373 if (!VALID_PORT(lp->portid)) {
2374 isp_prt(isp, ISP_LOGTINFO,
2375 "Chan %d WWPN 0x%016llx handle 0x%x "
2376 "gets PortID 0x%06x",
2377 chan, (unsigned long long) lp->port_wwn,
2380 isp_prt(isp, ISP_LOGTINFO|ISP_LOGWARN,
2381 "Chan %d WWPN 0x%016llx handle 0x%x "
2382 "changes PortID 0x%06x to 0x%06x",
2383 chan, (unsigned long long) lp->port_wwn,
2384 nphdl, lp->portid, s_id);
2385 if (isp->isp_dblev & (ISP_LOGTINFO|ISP_LOGWARN))
2386 isp_dump_portdb(isp, chan);
2388 lp->new_portid = s_id;
2391 if (VALID_INI(wwpn) && lp->port_wwn != wwpn) {
2392 if (!VALID_INI(lp->port_wwn)) {
2393 isp_prt(isp, ISP_LOGTINFO,
2394 "Chan %d PortID 0x%06x handle 0x%x "
2395 "gets WWPN 0x%016llxx",
2396 chan, lp->portid, nphdl,
2397 (unsigned long long) wwpn);
2398 } else if (lp->port_wwn != wwpn) {
2399 isp_prt(isp, ISP_LOGTINFO|ISP_LOGWARN,
2400 "Chan %d PortID 0x%06x handle 0x%x "
2401 "changes WWPN 0x%016llx to 0x%016llx",
2402 chan, lp->portid, nphdl,
2403 (unsigned long long) lp->port_wwn,
2404 (unsigned long long) wwpn);
2405 if (isp->isp_dblev & (ISP_LOGTINFO|ISP_LOGWARN))
2406 isp_dump_portdb(isp, chan);
2408 lp->port_wwn = wwpn;
2411 if (VALID_INI(wwnn) && lp->node_wwn != wwnn) {
2412 if (!VALID_INI(lp->node_wwn)) {
2413 isp_prt(isp, ISP_LOGTINFO,
2414 "Chan %d PortID 0x%06x handle 0x%x "
2415 "gets WWNN 0x%016llxx",
2416 chan, lp->portid, nphdl,
2417 (unsigned long long) wwnn);
2418 } else if (lp->port_wwn != wwnn) {
2419 isp_prt(isp, ISP_LOGTINFO,
2420 "Chan %d PortID 0x%06x handle 0x%x "
2421 "changes WWNN 0x%016llx to 0x%016llx",
2422 chan, lp->portid, nphdl,
2423 (unsigned long long) lp->node_wwn,
2424 (unsigned long long) wwnn);
2426 lp->node_wwn = wwnn;
2429 if (prli_params != 0 && lp->prli_word3 != prli_params) {
2430 isp_gen_role_str(buf, sizeof (buf), prli_params);
2431 isp_prt(isp, ISP_LOGTINFO|ISP_LOGCONFIG,
2432 "Chan %d WWPN 0x%016llx PortID 0x%06x "
2433 "handle 0x%x changes PRLI Word 3 %s",
2434 chan, (unsigned long long) lp->port_wwn,
2435 lp->portid, lp->handle, buf);
2436 lp->new_prli_word3 = prli_params;
2439 if (lp->handle != nphdl) {
2440 isp_prt(isp, ISP_LOGTINFO|ISP_LOGCONFIG,
2441 "Chan %d WWPN 0x%016llx PortID 0x%06x "
2442 "changes handle 0x%x to 0x%x",
2443 chan, (unsigned long long) lp->port_wwn,
2444 lp->portid, lp->handle, nphdl);
2448 lp->state = FC_PORTDB_STATE_VALID;
2450 isp_async(isp, ISPASYNC_DEV_CHANGED, chan, lp);
2451 lp->portid = lp->new_portid;
2452 lp->prli_word3 = lp->new_prli_word3;
2454 isp_prt(isp, ISP_LOGTINFO,
2455 "Chan %d WWPN 0x%016llx PortID 0x%06x "
2456 "handle 0x%x reentered",
2457 chan, (unsigned long long) lp->port_wwn,
2458 lp->portid, lp->handle);
2459 isp_async(isp, ISPASYNC_DEV_STAYED, chan, lp);
2464 /* Search for room to insert new record. */
2465 for (i = 0; i < MAX_FC_TARG; i++) {
2466 if (fcp->portdb[i].state == FC_PORTDB_STATE_NIL)
2469 if (i >= MAX_FC_TARG) {
2470 isp_prt(isp, ISP_LOGTINFO|ISP_LOGWARN,
2471 "Chan %d WWPN 0x%016llx PortID 0x%06x handle 0x%x "
2472 "-- no room in port database",
2473 chan, (unsigned long long) wwpn, s_id, nphdl);
2474 if (isp->isp_dblev & (ISP_LOGTINFO|ISP_LOGWARN))
2475 isp_dump_portdb(isp, chan);
2479 /* Insert new record and mark it valid. */
2480 lp = &fcp->portdb[i];
2481 ISP_MEMZERO(lp, sizeof (fcportdb_t));
2484 lp->port_wwn = wwpn;
2485 lp->node_wwn = wwnn;
2486 lp->prli_word3 = (prli_params != 0) ? prli_params : PRLI_WD3_INITIATOR_FUNCTION;
2487 lp->state = FC_PORTDB_STATE_VALID;
2489 isp_gen_role_str(buf, sizeof (buf), lp->prli_word3);
2490 isp_prt(isp, ISP_LOGTINFO, "Chan %d WWPN 0x%016llx "
2491 "PortID 0x%06x handle 0x%x vtgt %d %s added", chan,
2492 (unsigned long long) wwpn, s_id, nphdl, i, buf);
2494 /* Notify above levels about new port arrival. */
2495 isp_async(isp, ISPASYNC_DEV_ARRIVED, chan, lp);
2499 * Remove a target device to the port database
2502 isp_del_wwn_entry(ispsoftc_t *isp, int chan, uint64_t wwpn, uint16_t nphdl, uint32_t s_id)
2507 if (nphdl >= MAX_NPORT_HANDLE) {
2508 isp_prt(isp, ISP_LOGWARN, "Chan %d WWPN 0x%016llx PortID 0x%06x bad handle 0x%x",
2509 chan, (unsigned long long) wwpn, s_id, nphdl);
2513 fcp = FCPARAM(isp, chan);
2514 if (isp_find_pdb_by_handle(isp, chan, nphdl, &lp) == 0) {
2515 isp_prt(isp, ISP_LOGWARN, "Chan %d WWPN 0x%016llx PortID 0x%06x handle 0x%x cannot be found to be deleted",
2516 chan, (unsigned long long) wwpn, s_id, nphdl);
2517 isp_dump_portdb(isp, chan);
2520 isp_prt(isp, ISP_LOGTINFO, "Chan %d WWPN 0x%016llx PortID 0x%06x handle 0x%x vtgt %d deleted",
2521 chan, (unsigned long long) lp->port_wwn, lp->portid, nphdl, FC_PORTDB_TGT(isp, chan, lp));
2522 lp->state = FC_PORTDB_STATE_NIL;
2524 /* Notify above levels about gone port. */
2525 isp_async(isp, ISPASYNC_DEV_GONE, chan, lp);
2529 isp_del_all_wwn_entries(ispsoftc_t *isp, int chan)
2539 * Handle iterations over all channels via recursion
2541 if (chan == ISP_NOCHAN) {
2542 for (chan = 0; chan < isp->isp_nchan; chan++) {
2543 isp_del_all_wwn_entries(isp, chan);
2548 if (chan > isp->isp_nchan) {
2552 fcp = FCPARAM(isp, chan);
2556 for (i = 0; i < MAX_FC_TARG; i++) {
2557 fcportdb_t *lp = &fcp->portdb[i];
2559 if (lp->state != FC_PORTDB_STATE_NIL)
2560 isp_del_wwn_entry(isp, chan, lp->port_wwn, lp->handle, lp->portid);
2565 isp_del_wwn_entries(ispsoftc_t *isp, isp_notify_t *mp)
2570 * Handle iterations over all channels via recursion
2572 if (mp->nt_channel == ISP_NOCHAN) {
2573 for (mp->nt_channel = 0; mp->nt_channel < isp->isp_nchan; mp->nt_channel++) {
2574 isp_del_wwn_entries(isp, mp);
2576 mp->nt_channel = ISP_NOCHAN;
2581 * We have an entry which is only partially identified.
2583 * It's only known by WWN, N-Port handle, or Port ID.
2584 * We need to find the actual entry so we can delete it.
2586 if (mp->nt_nphdl != NIL_HANDLE) {
2587 if (isp_find_pdb_by_handle(isp, mp->nt_channel, mp->nt_nphdl, &lp)) {
2588 isp_del_wwn_entry(isp, mp->nt_channel, lp->port_wwn, lp->handle, lp->portid);
2592 if (VALID_INI(mp->nt_wwn)) {
2593 if (isp_find_pdb_by_wwpn(isp, mp->nt_channel, mp->nt_wwn, &lp)) {
2594 isp_del_wwn_entry(isp, mp->nt_channel, lp->port_wwn, lp->handle, lp->portid);
2598 if (VALID_PORT(mp->nt_sid)) {
2599 if (isp_find_pdb_by_portid(isp, mp->nt_channel, mp->nt_sid, &lp)) {
2600 isp_del_wwn_entry(isp, mp->nt_channel, lp->port_wwn, lp->handle, lp->portid);
2604 isp_prt(isp, ISP_LOGWARN, "Chan %d unable to find entry to delete WWPN 0x%016jx PortID 0x%06x handle 0x%x",
2605 mp->nt_channel, mp->nt_wwn, mp->nt_sid, mp->nt_nphdl);
2609 isp_put_atio2(ispsoftc_t *isp, at2_entry_t *src, at2_entry_t *dst)
2612 isp_put_hdr(isp, &src->at_header, &dst->at_header);
2613 ISP_IOXPUT_32(isp, src->at_reserved, &dst->at_reserved);
2614 ISP_IOXPUT_8(isp, src->at_lun, &dst->at_lun);
2615 ISP_IOXPUT_8(isp, src->at_iid, &dst->at_iid);
2616 ISP_IOXPUT_16(isp, src->at_rxid, &dst->at_rxid);
2617 ISP_IOXPUT_16(isp, src->at_flags, &dst->at_flags);
2618 ISP_IOXPUT_16(isp, src->at_status, &dst->at_status);
2619 ISP_IOXPUT_8(isp, src->at_crn, &dst->at_crn);
2620 ISP_IOXPUT_8(isp, src->at_taskcodes, &dst->at_taskcodes);
2621 ISP_IOXPUT_8(isp, src->at_taskflags, &dst->at_taskflags);
2622 ISP_IOXPUT_8(isp, src->at_execodes, &dst->at_execodes);
2623 for (i = 0; i < ATIO2_CDBLEN; i++) {
2624 ISP_IOXPUT_8(isp, src->at_cdb[i], &dst->at_cdb[i]);
2626 ISP_IOXPUT_32(isp, src->at_datalen, &dst->at_datalen);
2627 ISP_IOXPUT_16(isp, src->at_scclun, &dst->at_scclun);
2628 for (i = 0; i < 4; i++) {
2629 ISP_IOXPUT_16(isp, src->at_wwpn[i], &dst->at_wwpn[i]);
2631 for (i = 0; i < 6; i++) {
2632 ISP_IOXPUT_16(isp, src->at_reserved2[i], &dst->at_reserved2[i]);
2634 ISP_IOXPUT_16(isp, src->at_oxid, &dst->at_oxid);
2638 isp_put_atio2e(ispsoftc_t *isp, at2e_entry_t *src, at2e_entry_t *dst)
2641 isp_put_hdr(isp, &src->at_header, &dst->at_header);
2642 ISP_IOXPUT_32(isp, src->at_reserved, &dst->at_reserved);
2643 ISP_IOXPUT_16(isp, src->at_iid, &dst->at_iid);
2644 ISP_IOXPUT_16(isp, src->at_rxid, &dst->at_rxid);
2645 ISP_IOXPUT_16(isp, src->at_flags, &dst->at_flags);
2646 ISP_IOXPUT_16(isp, src->at_status, &dst->at_status);
2647 ISP_IOXPUT_8(isp, src->at_crn, &dst->at_crn);
2648 ISP_IOXPUT_8(isp, src->at_taskcodes, &dst->at_taskcodes);
2649 ISP_IOXPUT_8(isp, src->at_taskflags, &dst->at_taskflags);
2650 ISP_IOXPUT_8(isp, src->at_execodes, &dst->at_execodes);
2651 for (i = 0; i < ATIO2_CDBLEN; i++) {
2652 ISP_IOXPUT_8(isp, src->at_cdb[i], &dst->at_cdb[i]);
2654 ISP_IOXPUT_32(isp, src->at_datalen, &dst->at_datalen);
2655 ISP_IOXPUT_16(isp, src->at_scclun, &dst->at_scclun);
2656 for (i = 0; i < 4; i++) {
2657 ISP_IOXPUT_16(isp, src->at_wwpn[i], &dst->at_wwpn[i]);
2659 for (i = 0; i < 6; i++) {
2660 ISP_IOXPUT_16(isp, src->at_reserved2[i], &dst->at_reserved2[i]);
2662 ISP_IOXPUT_16(isp, src->at_oxid, &dst->at_oxid);
2666 isp_get_atio2(ispsoftc_t *isp, at2_entry_t *src, at2_entry_t *dst)
2669 isp_get_hdr(isp, &src->at_header, &dst->at_header);
2670 ISP_IOXGET_32(isp, &src->at_reserved, dst->at_reserved);
2671 ISP_IOXGET_8(isp, &src->at_lun, dst->at_lun);
2672 ISP_IOXGET_8(isp, &src->at_iid, dst->at_iid);
2673 ISP_IOXGET_16(isp, &src->at_rxid, dst->at_rxid);
2674 ISP_IOXGET_16(isp, &src->at_flags, dst->at_flags);
2675 ISP_IOXGET_16(isp, &src->at_status, dst->at_status);
2676 ISP_IOXGET_8(isp, &src->at_crn, dst->at_crn);
2677 ISP_IOXGET_8(isp, &src->at_taskcodes, dst->at_taskcodes);
2678 ISP_IOXGET_8(isp, &src->at_taskflags, dst->at_taskflags);
2679 ISP_IOXGET_8(isp, &src->at_execodes, dst->at_execodes);
2680 for (i = 0; i < ATIO2_CDBLEN; i++) {
2681 ISP_IOXGET_8(isp, &src->at_cdb[i], dst->at_cdb[i]);
2683 ISP_IOXGET_32(isp, &src->at_datalen, dst->at_datalen);
2684 ISP_IOXGET_16(isp, &src->at_scclun, dst->at_scclun);
2685 for (i = 0; i < 4; i++) {
2686 ISP_IOXGET_16(isp, &src->at_wwpn[i], dst->at_wwpn[i]);
2688 for (i = 0; i < 6; i++) {
2689 ISP_IOXGET_16(isp, &src->at_reserved2[i], dst->at_reserved2[i]);
2691 ISP_IOXGET_16(isp, &src->at_oxid, dst->at_oxid);
2695 isp_get_atio2e(ispsoftc_t *isp, at2e_entry_t *src, at2e_entry_t *dst)
2698 isp_get_hdr(isp, &src->at_header, &dst->at_header);
2699 ISP_IOXGET_32(isp, &src->at_reserved, dst->at_reserved);
2700 ISP_IOXGET_16(isp, &src->at_iid, dst->at_iid);
2701 ISP_IOXGET_16(isp, &src->at_rxid, dst->at_rxid);
2702 ISP_IOXGET_16(isp, &src->at_flags, dst->at_flags);
2703 ISP_IOXGET_16(isp, &src->at_status, dst->at_status);
2704 ISP_IOXGET_8(isp, &src->at_crn, dst->at_crn);
2705 ISP_IOXGET_8(isp, &src->at_taskcodes, dst->at_taskcodes);
2706 ISP_IOXGET_8(isp, &src->at_taskflags, dst->at_taskflags);
2707 ISP_IOXGET_8(isp, &src->at_execodes, dst->at_execodes);
2708 for (i = 0; i < ATIO2_CDBLEN; i++) {
2709 ISP_IOXGET_8(isp, &src->at_cdb[i], dst->at_cdb[i]);
2711 ISP_IOXGET_32(isp, &src->at_datalen, dst->at_datalen);
2712 ISP_IOXGET_16(isp, &src->at_scclun, dst->at_scclun);
2713 for (i = 0; i < 4; i++) {
2714 ISP_IOXGET_16(isp, &src->at_wwpn[i], dst->at_wwpn[i]);
2716 for (i = 0; i < 6; i++) {
2717 ISP_IOXGET_16(isp, &src->at_reserved2[i], dst->at_reserved2[i]);
2719 ISP_IOXGET_16(isp, &src->at_oxid, dst->at_oxid);
2723 isp_get_atio7(ispsoftc_t *isp, at7_entry_t *src, at7_entry_t *dst)
2725 ISP_IOXGET_8(isp, &src->at_type, dst->at_type);
2726 ISP_IOXGET_8(isp, &src->at_count, dst->at_count);
2727 ISP_IOXGET_16(isp, &src->at_ta_len, dst->at_ta_len);
2728 ISP_IOXGET_32(isp, &src->at_rxid, dst->at_rxid);
2729 isp_get_fc_hdr(isp, &src->at_hdr, &dst->at_hdr);
2730 isp_get_fcp_cmnd_iu(isp, &src->at_cmnd, &dst->at_cmnd);
2734 isp_put_ctio2(ispsoftc_t *isp, ct2_entry_t *src, ct2_entry_t *dst)
2737 isp_put_hdr(isp, &src->ct_header, &dst->ct_header);
2738 ISP_IOXPUT_32(isp, src->ct_syshandle, &dst->ct_syshandle);
2739 ISP_IOXPUT_8(isp, src->ct_lun, &dst->ct_lun);
2740 ISP_IOXPUT_8(isp, src->ct_iid, &dst->ct_iid);
2741 ISP_IOXPUT_16(isp, src->ct_rxid, &dst->ct_rxid);
2742 ISP_IOXPUT_16(isp, src->ct_flags, &dst->ct_flags);
2743 ISP_IOXPUT_16(isp, src->ct_timeout, &dst->ct_timeout);
2744 ISP_IOXPUT_16(isp, src->ct_seg_count, &dst->ct_seg_count);
2745 ISP_IOXPUT_32(isp, src->ct_resid, &dst->ct_resid);
2746 ISP_IOXPUT_32(isp, src->ct_reloff, &dst->ct_reloff);
2747 if ((src->ct_flags & CT2_FLAG_MMASK) == CT2_FLAG_MODE0) {
2748 ISP_IOXPUT_32(isp, src->rsp.m0._reserved, &dst->rsp.m0._reserved);
2749 ISP_IOXPUT_16(isp, src->rsp.m0._reserved2, &dst->rsp.m0._reserved2);
2750 ISP_IOXPUT_16(isp, src->rsp.m0.ct_scsi_status, &dst->rsp.m0.ct_scsi_status);
2751 ISP_IOXPUT_32(isp, src->rsp.m0.ct_xfrlen, &dst->rsp.m0.ct_xfrlen);
2752 if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO2) {
2753 for (i = 0; i < ISP_RQDSEG_T2; i++) {
2754 ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dataseg[i].ds_base, &dst->rsp.m0.u.ct_dataseg[i].ds_base);
2755 ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dataseg[i].ds_count, &dst->rsp.m0.u.ct_dataseg[i].ds_count);
2757 } else if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO3) {
2758 for (i = 0; i < ISP_RQDSEG_T3; i++) {
2759 ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dataseg64[i].ds_base, &dst->rsp.m0.u.ct_dataseg64[i].ds_base);
2760 ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dataseg64[i].ds_basehi, &dst->rsp.m0.u.ct_dataseg64[i].ds_basehi);
2761 ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dataseg64[i].ds_count, &dst->rsp.m0.u.ct_dataseg64[i].ds_count);
2763 } else if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO4) {
2764 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,
2765 &dst->rsp.m0.u.ct_dslist.ds_segment);
2766 ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dslist.ds_base, &dst->rsp.m0.u.ct_dslist.ds_base);
2768 } else if ((src->ct_flags & CT2_FLAG_MMASK) == CT2_FLAG_MODE1) {
2769 ISP_IOXPUT_16(isp, src->rsp.m1._reserved, &dst->rsp.m1._reserved);
2770 ISP_IOXPUT_16(isp, src->rsp.m1._reserved2, &dst->rsp.m1._reserved2);
2771 ISP_IOXPUT_16(isp, src->rsp.m1.ct_senselen, &dst->rsp.m1.ct_senselen);
2772 ISP_IOXPUT_16(isp, src->rsp.m1.ct_scsi_status, &dst->rsp.m1.ct_scsi_status);
2773 ISP_IOXPUT_16(isp, src->rsp.m1.ct_resplen, &dst->rsp.m1.ct_resplen);
2774 for (i = 0; i < MAXRESPLEN; i++) {
2775 ISP_IOXPUT_8(isp, src->rsp.m1.ct_resp[i], &dst->rsp.m1.ct_resp[i]);
2778 ISP_IOXPUT_32(isp, src->rsp.m2._reserved, &dst->rsp.m2._reserved);
2779 ISP_IOXPUT_16(isp, src->rsp.m2._reserved2, &dst->rsp.m2._reserved2);
2780 ISP_IOXPUT_16(isp, src->rsp.m2._reserved3, &dst->rsp.m2._reserved3);
2781 ISP_IOXPUT_32(isp, src->rsp.m2.ct_datalen, &dst->rsp.m2.ct_datalen);
2782 if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO2) {
2783 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);
2784 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);
2786 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);
2787 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);
2788 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);
2794 isp_put_ctio2e(ispsoftc_t *isp, ct2e_entry_t *src, ct2e_entry_t *dst)
2797 isp_put_hdr(isp, &src->ct_header, &dst->ct_header);
2798 ISP_IOXPUT_32(isp, src->ct_syshandle, &dst->ct_syshandle);
2799 ISP_IOXPUT_16(isp, src->ct_iid, &dst->ct_iid);
2800 ISP_IOXPUT_16(isp, src->ct_rxid, &dst->ct_rxid);
2801 ISP_IOXPUT_16(isp, src->ct_flags, &dst->ct_flags);
2802 ISP_IOXPUT_16(isp, src->ct_timeout, &dst->ct_timeout);
2803 ISP_IOXPUT_16(isp, src->ct_seg_count, &dst->ct_seg_count);
2804 ISP_IOXPUT_32(isp, src->ct_resid, &dst->ct_resid);
2805 ISP_IOXPUT_32(isp, src->ct_reloff, &dst->ct_reloff);
2806 if ((src->ct_flags & CT2_FLAG_MMASK) == CT2_FLAG_MODE0) {
2807 ISP_IOXPUT_32(isp, src->rsp.m0._reserved, &dst->rsp.m0._reserved);
2808 ISP_IOXPUT_16(isp, src->rsp.m0._reserved2, &dst->rsp.m0._reserved2);
2809 ISP_IOXPUT_16(isp, src->rsp.m0.ct_scsi_status, &dst->rsp.m0.ct_scsi_status);
2810 ISP_IOXPUT_32(isp, src->rsp.m0.ct_xfrlen, &dst->rsp.m0.ct_xfrlen);
2811 if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO2) {
2812 for (i = 0; i < ISP_RQDSEG_T2; i++) {
2813 ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dataseg[i].ds_base, &dst->rsp.m0.u.ct_dataseg[i].ds_base);
2814 ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dataseg[i].ds_count, &dst->rsp.m0.u.ct_dataseg[i].ds_count);
2816 } else if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO3) {
2817 for (i = 0; i < ISP_RQDSEG_T3; i++) {
2818 ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dataseg64[i].ds_base, &dst->rsp.m0.u.ct_dataseg64[i].ds_base);
2819 ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dataseg64[i].ds_basehi, &dst->rsp.m0.u.ct_dataseg64[i].ds_basehi);
2820 ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dataseg64[i].ds_count, &dst->rsp.m0.u.ct_dataseg64[i].ds_count);
2822 } else if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO4) {
2823 ISP_IOXPUT_16(isp, src->rsp.m0.u.ct_dslist.ds_type, &dst->rsp.m0.u.ct_dslist.ds_type);
2824 ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dslist.ds_segment, &dst->rsp.m0.u.ct_dslist.ds_segment);
2825 ISP_IOXPUT_32(isp, src->rsp.m0.u.ct_dslist.ds_base, &dst->rsp.m0.u.ct_dslist.ds_base);
2827 } else if ((src->ct_flags & CT2_FLAG_MMASK) == CT2_FLAG_MODE1) {
2828 ISP_IOXPUT_16(isp, src->rsp.m1._reserved, &dst->rsp.m1._reserved);
2829 ISP_IOXPUT_16(isp, src->rsp.m1._reserved2, &dst->rsp.m1._reserved2);
2830 ISP_IOXPUT_16(isp, src->rsp.m1.ct_senselen, &dst->rsp.m1.ct_senselen);
2831 ISP_IOXPUT_16(isp, src->rsp.m1.ct_scsi_status, &dst->rsp.m1.ct_scsi_status);
2832 ISP_IOXPUT_16(isp, src->rsp.m1.ct_resplen, &dst->rsp.m1.ct_resplen);
2833 for (i = 0; i < MAXRESPLEN; i++) {
2834 ISP_IOXPUT_8(isp, src->rsp.m1.ct_resp[i], &dst->rsp.m1.ct_resp[i]);
2837 ISP_IOXPUT_32(isp, src->rsp.m2._reserved, &dst->rsp.m2._reserved);
2838 ISP_IOXPUT_16(isp, src->rsp.m2._reserved2, &dst->rsp.m2._reserved2);
2839 ISP_IOXPUT_16(isp, src->rsp.m2._reserved3, &dst->rsp.m2._reserved3);
2840 ISP_IOXPUT_32(isp, src->rsp.m2.ct_datalen, &dst->rsp.m2.ct_datalen);
2841 if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO2) {
2842 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);
2843 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);
2845 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);
2846 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);
2847 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);
2853 isp_put_ctio7(ispsoftc_t *isp, ct7_entry_t *src, ct7_entry_t *dst)
2857 isp_put_hdr(isp, &src->ct_header, &dst->ct_header);
2858 ISP_IOXPUT_32(isp, src->ct_syshandle, &dst->ct_syshandle);
2859 ISP_IOXPUT_16(isp, src->ct_nphdl, &dst->ct_nphdl);
2860 ISP_IOXPUT_16(isp, src->ct_timeout, &dst->ct_timeout);
2861 ISP_IOXPUT_16(isp, src->ct_seg_count, &dst->ct_seg_count);
2862 ISP_IOXPUT_8(isp, src->ct_vpidx, &dst->ct_vpidx);
2863 ISP_IOXPUT_8(isp, src->ct_xflags, &dst->ct_xflags);
2864 ISP_IOXPUT_16(isp, src->ct_iid_lo, &dst->ct_iid_lo);
2865 ISP_IOXPUT_8(isp, src->ct_iid_hi, &dst->ct_iid_hi);
2866 ISP_IOXPUT_8(isp, src->ct_reserved, &dst->ct_reserved);
2867 ISP_IOXPUT_32(isp, src->ct_rxid, &dst->ct_rxid);
2868 ISP_IOXPUT_16(isp, src->ct_senselen, &dst->ct_senselen);
2869 ISP_IOXPUT_16(isp, src->ct_flags, &dst->ct_flags);
2870 ISP_IOXPUT_32(isp, src->ct_resid, &dst->ct_resid);
2871 ISP_IOXPUT_16(isp, src->ct_oxid, &dst->ct_oxid);
2872 ISP_IOXPUT_16(isp, src->ct_scsi_status, &dst->ct_scsi_status);
2873 if ((dst->ct_flags & CT7_FLAG_MMASK) == CT7_FLAG_MODE0) {
2874 ISP_IOXPUT_32(isp, src->rsp.m0.reloff, &dst->rsp.m0.reloff);
2875 ISP_IOXPUT_32(isp, src->rsp.m0.reserved0, &dst->rsp.m0.reserved0);
2876 ISP_IOXPUT_32(isp, src->rsp.m0.ct_xfrlen, &dst->rsp.m0.ct_xfrlen);
2877 ISP_IOXPUT_32(isp, src->rsp.m0.reserved1, &dst->rsp.m0.reserved1);
2878 ISP_IOXPUT_32(isp, src->rsp.m0.ds.ds_base, &dst->rsp.m0.ds.ds_base);
2879 ISP_IOXPUT_32(isp, src->rsp.m0.ds.ds_basehi, &dst->rsp.m0.ds.ds_basehi);
2880 ISP_IOXPUT_32(isp, src->rsp.m0.ds.ds_count, &dst->rsp.m0.ds.ds_count);
2881 } else if ((dst->ct_flags & CT7_FLAG_MMASK) == CT7_FLAG_MODE1) {
2884 ISP_IOXPUT_16(isp, src->rsp.m1.ct_resplen, &dst->rsp.m1.ct_resplen);
2885 ISP_IOXPUT_16(isp, src->rsp.m1.reserved, &dst->rsp.m1.reserved);
2886 a = (uint32_t *) src->rsp.m1.ct_resp;
2887 b = (uint32_t *) dst->rsp.m1.ct_resp;
2888 for (i = 0; i < (ASIZE(src->rsp.m1.ct_resp) >> 2); i++) {
2889 *b++ = ISP_SWAP32(isp, *a++);
2892 ISP_IOXPUT_32(isp, src->rsp.m2.reserved0, &dst->rsp.m2.reserved0);
2893 ISP_IOXPUT_32(isp, src->rsp.m2.reserved1, &dst->rsp.m2.reserved1);
2894 ISP_IOXPUT_32(isp, src->rsp.m2.ct_datalen, &dst->rsp.m2.ct_datalen);
2895 ISP_IOXPUT_32(isp, src->rsp.m2.reserved2, &dst->rsp.m2.reserved2);
2896 ISP_IOXPUT_32(isp, src->rsp.m2.ct_fcp_rsp_iudata.ds_base, &dst->rsp.m2.ct_fcp_rsp_iudata.ds_base);
2897 ISP_IOXPUT_32(isp, src->rsp.m2.ct_fcp_rsp_iudata.ds_basehi, &dst->rsp.m2.ct_fcp_rsp_iudata.ds_basehi);
2898 ISP_IOXPUT_32(isp, src->rsp.m2.ct_fcp_rsp_iudata.ds_count, &dst->rsp.m2.ct_fcp_rsp_iudata.ds_count);
2904 isp_get_ctio2(ispsoftc_t *isp, ct2_entry_t *src, ct2_entry_t *dst)
2908 isp_get_hdr(isp, &src->ct_header, &dst->ct_header);
2909 ISP_IOXGET_32(isp, &src->ct_syshandle, dst->ct_syshandle);
2910 ISP_IOXGET_8(isp, &src->ct_lun, dst->ct_lun);
2911 ISP_IOXGET_8(isp, &src->ct_iid, dst->ct_iid);
2912 ISP_IOXGET_16(isp, &src->ct_rxid, dst->ct_rxid);
2913 ISP_IOXGET_16(isp, &src->ct_flags, dst->ct_flags);
2914 ISP_IOXGET_16(isp, &src->ct_status, dst->ct_status);
2915 ISP_IOXGET_16(isp, &src->ct_timeout, dst->ct_timeout);
2916 ISP_IOXGET_16(isp, &src->ct_seg_count, dst->ct_seg_count);
2917 ISP_IOXGET_32(isp, &src->ct_reloff, dst->ct_reloff);
2918 ISP_IOXGET_32(isp, &src->ct_resid, dst->ct_resid);
2919 if ((dst->ct_flags & CT2_FLAG_MMASK) == CT2_FLAG_MODE0) {
2920 ISP_IOXGET_32(isp, &src->rsp.m0._reserved, dst->rsp.m0._reserved);
2921 ISP_IOXGET_16(isp, &src->rsp.m0._reserved2, dst->rsp.m0._reserved2);
2922 ISP_IOXGET_16(isp, &src->rsp.m0.ct_scsi_status, dst->rsp.m0.ct_scsi_status);
2923 ISP_IOXGET_32(isp, &src->rsp.m0.ct_xfrlen, dst->rsp.m0.ct_xfrlen);
2924 if (dst->ct_header.rqs_entry_type == RQSTYPE_CTIO2) {
2925 for (i = 0; i < ISP_RQDSEG_T2; i++) {
2926 ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dataseg[i].ds_base, dst->rsp.m0.u.ct_dataseg[i].ds_base);
2927 ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dataseg[i].ds_count, dst->rsp.m0.u.ct_dataseg[i].ds_count);
2929 } else if (dst->ct_header.rqs_entry_type == RQSTYPE_CTIO3) {
2930 for (i = 0; i < ISP_RQDSEG_T3; i++) {
2931 ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dataseg64[i].ds_base, dst->rsp.m0.u.ct_dataseg64[i].ds_base);
2932 ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dataseg64[i].ds_basehi, dst->rsp.m0.u.ct_dataseg64[i].ds_basehi);
2933 ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dataseg64[i].ds_count, dst->rsp.m0.u.ct_dataseg64[i].ds_count);
2935 } else if (dst->ct_header.rqs_entry_type == RQSTYPE_CTIO4) {
2936 ISP_IOXGET_16(isp, &src->rsp.m0.u.ct_dslist.ds_type, dst->rsp.m0.u.ct_dslist.ds_type);
2937 ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dslist.ds_segment, dst->rsp.m0.u.ct_dslist.ds_segment);
2938 ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dslist.ds_base, dst->rsp.m0.u.ct_dslist.ds_base);
2940 } else if ((dst->ct_flags & CT2_FLAG_MMASK) == CT2_FLAG_MODE1) {
2941 ISP_IOXGET_16(isp, &src->rsp.m1._reserved, dst->rsp.m1._reserved);
2942 ISP_IOXGET_16(isp, &src->rsp.m1._reserved2, dst->rsp.m1._reserved2);
2943 ISP_IOXGET_16(isp, &src->rsp.m1.ct_senselen, dst->rsp.m1.ct_senselen);
2944 ISP_IOXGET_16(isp, &src->rsp.m1.ct_scsi_status, dst->rsp.m1.ct_scsi_status);
2945 ISP_IOXGET_16(isp, &src->rsp.m1.ct_resplen, dst->rsp.m1.ct_resplen);
2946 for (i = 0; i < MAXRESPLEN; i++) {
2947 ISP_IOXGET_8(isp, &src->rsp.m1.ct_resp[i], dst->rsp.m1.ct_resp[i]);
2950 ISP_IOXGET_32(isp, &src->rsp.m2._reserved, dst->rsp.m2._reserved);
2951 ISP_IOXGET_16(isp, &src->rsp.m2._reserved2, dst->rsp.m2._reserved2);
2952 ISP_IOXGET_16(isp, &src->rsp.m2._reserved3, dst->rsp.m2._reserved3);
2953 ISP_IOXGET_32(isp, &src->rsp.m2.ct_datalen, dst->rsp.m2.ct_datalen);
2954 if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO2) {
2955 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);
2956 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);
2958 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);
2959 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);
2960 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);
2966 isp_get_ctio2e(ispsoftc_t *isp, ct2e_entry_t *src, ct2e_entry_t *dst)
2970 isp_get_hdr(isp, &src->ct_header, &dst->ct_header);
2971 ISP_IOXGET_32(isp, &src->ct_syshandle, dst->ct_syshandle);
2972 ISP_IOXGET_16(isp, &src->ct_iid, dst->ct_iid);
2973 ISP_IOXGET_16(isp, &src->ct_rxid, dst->ct_rxid);
2974 ISP_IOXGET_16(isp, &src->ct_flags, dst->ct_flags);
2975 ISP_IOXGET_16(isp, &src->ct_status, dst->ct_status);
2976 ISP_IOXGET_16(isp, &src->ct_timeout, dst->ct_timeout);
2977 ISP_IOXGET_16(isp, &src->ct_seg_count, dst->ct_seg_count);
2978 ISP_IOXGET_32(isp, &src->ct_reloff, dst->ct_reloff);
2979 ISP_IOXGET_32(isp, &src->ct_resid, dst->ct_resid);
2980 if ((dst->ct_flags & CT2_FLAG_MMASK) == CT2_FLAG_MODE0) {
2981 ISP_IOXGET_32(isp, &src->rsp.m0._reserved, dst->rsp.m0._reserved);
2982 ISP_IOXGET_16(isp, &src->rsp.m0._reserved2, dst->rsp.m0._reserved2);
2983 ISP_IOXGET_16(isp, &src->rsp.m0.ct_scsi_status, dst->rsp.m0.ct_scsi_status);
2984 ISP_IOXGET_32(isp, &src->rsp.m0.ct_xfrlen, dst->rsp.m0.ct_xfrlen);
2985 if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO2) {
2986 for (i = 0; i < ISP_RQDSEG_T2; i++) {
2987 ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dataseg[i].ds_base, dst->rsp.m0.u.ct_dataseg[i].ds_base);
2988 ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dataseg[i].ds_count, dst->rsp.m0.u.ct_dataseg[i].ds_count);
2990 } else if (dst->ct_header.rqs_entry_type == RQSTYPE_CTIO3) {
2991 for (i = 0; i < ISP_RQDSEG_T3; i++) {
2992 ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dataseg64[i].ds_base, dst->rsp.m0.u.ct_dataseg64[i].ds_base);
2993 ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dataseg64[i].ds_basehi, dst->rsp.m0.u.ct_dataseg64[i].ds_basehi);
2994 ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dataseg64[i].ds_count, dst->rsp.m0.u.ct_dataseg64[i].ds_count);
2996 } else if (dst->ct_header.rqs_entry_type == RQSTYPE_CTIO4) {
2997 ISP_IOXGET_16(isp, &src->rsp.m0.u.ct_dslist.ds_type, dst->rsp.m0.u.ct_dslist.ds_type);
2998 ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dslist.ds_segment, dst->rsp.m0.u.ct_dslist.ds_segment);
2999 ISP_IOXGET_32(isp, &src->rsp.m0.u.ct_dslist.ds_base, dst->rsp.m0.u.ct_dslist.ds_base);
3001 } else if ((dst->ct_flags & CT2_FLAG_MMASK) == CT2_FLAG_MODE1) {
3002 ISP_IOXGET_16(isp, &src->rsp.m1._reserved, dst->rsp.m1._reserved);
3003 ISP_IOXGET_16(isp, &src->rsp.m1._reserved2, dst->rsp.m1._reserved2);
3004 ISP_IOXGET_16(isp, &src->rsp.m1.ct_senselen, dst->rsp.m1.ct_senselen);
3005 ISP_IOXGET_16(isp, &src->rsp.m1.ct_scsi_status, dst->rsp.m1.ct_scsi_status);
3006 ISP_IOXGET_16(isp, &src->rsp.m1.ct_resplen, dst->rsp.m1.ct_resplen);
3007 for (i = 0; i < MAXRESPLEN; i++) {
3008 ISP_IOXGET_8(isp, &src->rsp.m1.ct_resp[i], dst->rsp.m1.ct_resp[i]);
3011 ISP_IOXGET_32(isp, &src->rsp.m2._reserved, dst->rsp.m2._reserved);
3012 ISP_IOXGET_16(isp, &src->rsp.m2._reserved2, dst->rsp.m2._reserved2);
3013 ISP_IOXGET_16(isp, &src->rsp.m2._reserved3, dst->rsp.m2._reserved3);
3014 ISP_IOXGET_32(isp, &src->rsp.m2.ct_datalen, dst->rsp.m2.ct_datalen);
3015 if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO2) {
3016 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);
3017 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);
3019 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);
3020 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);
3021 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);
3027 isp_get_ctio7(ispsoftc_t *isp, ct7_entry_t *src, ct7_entry_t *dst)
3031 isp_get_hdr(isp, &src->ct_header, &dst->ct_header);
3032 ISP_IOXGET_32(isp, &src->ct_syshandle, dst->ct_syshandle);
3033 ISP_IOXGET_16(isp, &src->ct_nphdl, dst->ct_nphdl);
3034 ISP_IOXGET_16(isp, &src->ct_timeout, dst->ct_timeout);
3035 ISP_IOXGET_16(isp, &src->ct_seg_count, dst->ct_seg_count);
3036 ISP_IOXGET_8(isp, &src->ct_vpidx, dst->ct_vpidx);
3037 ISP_IOXGET_8(isp, &src->ct_xflags, dst->ct_xflags);
3038 ISP_IOXGET_16(isp, &src->ct_iid_lo, dst->ct_iid_lo);
3039 ISP_IOXGET_8(isp, &src->ct_iid_hi, dst->ct_iid_hi);
3040 ISP_IOXGET_8(isp, &src->ct_reserved, dst->ct_reserved);
3041 ISP_IOXGET_32(isp, &src->ct_rxid, dst->ct_rxid);
3042 ISP_IOXGET_16(isp, &src->ct_senselen, dst->ct_senselen);
3043 ISP_IOXGET_16(isp, &src->ct_flags, dst->ct_flags);
3044 ISP_IOXGET_32(isp, &src->ct_resid, dst->ct_resid);
3045 ISP_IOXGET_16(isp, &src->ct_oxid, dst->ct_oxid);
3046 ISP_IOXGET_16(isp, &src->ct_scsi_status, dst->ct_scsi_status);
3047 if ((dst->ct_flags & CT7_FLAG_MMASK) == CT7_FLAG_MODE0) {
3048 ISP_IOXGET_32(isp, &src->rsp.m0.reloff, dst->rsp.m0.reloff);
3049 ISP_IOXGET_32(isp, &src->rsp.m0.reserved0, dst->rsp.m0.reserved0);
3050 ISP_IOXGET_32(isp, &src->rsp.m0.ct_xfrlen, dst->rsp.m0.ct_xfrlen);
3051 ISP_IOXGET_32(isp, &src->rsp.m0.reserved1, dst->rsp.m0.reserved1);
3052 ISP_IOXGET_32(isp, &src->rsp.m0.ds.ds_base, dst->rsp.m0.ds.ds_base);
3053 ISP_IOXGET_32(isp, &src->rsp.m0.ds.ds_basehi, dst->rsp.m0.ds.ds_basehi);
3054 ISP_IOXGET_32(isp, &src->rsp.m0.ds.ds_count, dst->rsp.m0.ds.ds_count);
3055 } else if ((dst->ct_flags & CT7_FLAG_MMASK) == CT7_FLAG_MODE1) {
3058 ISP_IOXGET_16(isp, &src->rsp.m1.ct_resplen, dst->rsp.m1.ct_resplen);
3059 ISP_IOXGET_16(isp, &src->rsp.m1.reserved, dst->rsp.m1.reserved);
3060 a = (uint32_t *) src->rsp.m1.ct_resp;
3061 b = (uint32_t *) dst->rsp.m1.ct_resp;
3062 for (i = 0; i < MAXRESPLEN_24XX; i++) {
3063 ISP_IOXGET_8(isp, &src->rsp.m1.ct_resp[i], dst->rsp.m1.ct_resp[i]);
3065 for (i = 0; i < (ASIZE(src->rsp.m1.ct_resp) >> 2); i++) {
3066 *b++ = ISP_SWAP32(isp, *a++);
3069 ISP_IOXGET_32(isp, &src->rsp.m2.reserved0, dst->rsp.m2.reserved0);
3070 ISP_IOXGET_32(isp, &src->rsp.m2.ct_datalen, dst->rsp.m2.ct_datalen);
3071 ISP_IOXGET_32(isp, &src->rsp.m2.reserved1, dst->rsp.m2.reserved1);
3072 ISP_IOXGET_32(isp, &src->rsp.m2.ct_fcp_rsp_iudata.ds_base, dst->rsp.m2.ct_fcp_rsp_iudata.ds_base);
3073 ISP_IOXGET_32(isp, &src->rsp.m2.ct_fcp_rsp_iudata.ds_basehi, dst->rsp.m2.ct_fcp_rsp_iudata.ds_basehi);
3074 ISP_IOXGET_32(isp, &src->rsp.m2.ct_fcp_rsp_iudata.ds_count, dst->rsp.m2.ct_fcp_rsp_iudata.ds_count);
3079 isp_put_enable_lun(ispsoftc_t *isp, lun_entry_t *lesrc, lun_entry_t *ledst)
3082 isp_put_hdr(isp, &lesrc->le_header, &ledst->le_header);
3083 ISP_IOXPUT_32(isp, lesrc->le_reserved, &ledst->le_reserved);
3084 if (ISP_IS_SBUS(isp)) {
3085 ISP_IOXPUT_8(isp, lesrc->le_lun, &ledst->le_rsvd);
3086 ISP_IOXPUT_8(isp, lesrc->le_rsvd, &ledst->le_lun);
3087 ISP_IOXPUT_8(isp, lesrc->le_ops, &ledst->le_tgt);
3088 ISP_IOXPUT_8(isp, lesrc->le_tgt, &ledst->le_ops);
3089 ISP_IOXPUT_8(isp, lesrc->le_status, &ledst->le_reserved2);
3090 ISP_IOXPUT_8(isp, lesrc->le_reserved2, &ledst->le_status);
3091 ISP_IOXPUT_8(isp, lesrc->le_cmd_count, &ledst->le_in_count);
3092 ISP_IOXPUT_8(isp, lesrc->le_in_count, &ledst->le_cmd_count);
3093 ISP_IOXPUT_8(isp, lesrc->le_cdb6len, &ledst->le_cdb7len);
3094 ISP_IOXPUT_8(isp, lesrc->le_cdb7len, &ledst->le_cdb6len);
3096 ISP_IOXPUT_8(isp, lesrc->le_lun, &ledst->le_lun);
3097 ISP_IOXPUT_8(isp, lesrc->le_rsvd, &ledst->le_rsvd);
3098 ISP_IOXPUT_8(isp, lesrc->le_ops, &ledst->le_ops);
3099 ISP_IOXPUT_8(isp, lesrc->le_tgt, &ledst->le_tgt);
3100 ISP_IOXPUT_8(isp, lesrc->le_status, &ledst->le_status);
3101 ISP_IOXPUT_8(isp, lesrc->le_reserved2, &ledst->le_reserved2);
3102 ISP_IOXPUT_8(isp, lesrc->le_cmd_count, &ledst->le_cmd_count);
3103 ISP_IOXPUT_8(isp, lesrc->le_in_count, &ledst->le_in_count);
3104 ISP_IOXPUT_8(isp, lesrc->le_cdb6len, &ledst->le_cdb6len);
3105 ISP_IOXPUT_8(isp, lesrc->le_cdb7len, &ledst->le_cdb7len);
3107 ISP_IOXPUT_32(isp, lesrc->le_flags, &ledst->le_flags);
3108 ISP_IOXPUT_16(isp, lesrc->le_timeout, &ledst->le_timeout);
3109 for (i = 0; i < 20; i++) {
3110 ISP_IOXPUT_8(isp, lesrc->le_reserved3[i], &ledst->le_reserved3[i]);
3115 isp_get_enable_lun(ispsoftc_t *isp, lun_entry_t *lesrc, lun_entry_t *ledst)
3118 isp_get_hdr(isp, &lesrc->le_header, &ledst->le_header);
3119 ISP_IOXGET_32(isp, &lesrc->le_reserved, ledst->le_reserved);
3120 if (ISP_IS_SBUS(isp)) {
3121 ISP_IOXGET_8(isp, &lesrc->le_lun, ledst->le_rsvd);
3122 ISP_IOXGET_8(isp, &lesrc->le_rsvd, ledst->le_lun);
3123 ISP_IOXGET_8(isp, &lesrc->le_ops, ledst->le_tgt);
3124 ISP_IOXGET_8(isp, &lesrc->le_tgt, ledst->le_ops);
3125 ISP_IOXGET_8(isp, &lesrc->le_status, ledst->le_reserved2);
3126 ISP_IOXGET_8(isp, &lesrc->le_reserved2, ledst->le_status);
3127 ISP_IOXGET_8(isp, &lesrc->le_cmd_count, ledst->le_in_count);
3128 ISP_IOXGET_8(isp, &lesrc->le_in_count, ledst->le_cmd_count);
3129 ISP_IOXGET_8(isp, &lesrc->le_cdb6len, ledst->le_cdb7len);
3130 ISP_IOXGET_8(isp, &lesrc->le_cdb7len, ledst->le_cdb6len);
3132 ISP_IOXGET_8(isp, &lesrc->le_lun, ledst->le_lun);
3133 ISP_IOXGET_8(isp, &lesrc->le_rsvd, ledst->le_rsvd);
3134 ISP_IOXGET_8(isp, &lesrc->le_ops, ledst->le_ops);
3135 ISP_IOXGET_8(isp, &lesrc->le_tgt, ledst->le_tgt);
3136 ISP_IOXGET_8(isp, &lesrc->le_status, ledst->le_status);
3137 ISP_IOXGET_8(isp, &lesrc->le_reserved2, ledst->le_reserved2);
3138 ISP_IOXGET_8(isp, &lesrc->le_cmd_count, ledst->le_cmd_count);
3139 ISP_IOXGET_8(isp, &lesrc->le_in_count, ledst->le_in_count);
3140 ISP_IOXGET_8(isp, &lesrc->le_cdb6len, ledst->le_cdb6len);
3141 ISP_IOXGET_8(isp, &lesrc->le_cdb7len, ledst->le_cdb7len);
3143 ISP_IOXGET_32(isp, &lesrc->le_flags, ledst->le_flags);
3144 ISP_IOXGET_16(isp, &lesrc->le_timeout, ledst->le_timeout);
3145 for (i = 0; i < 20; i++) {
3146 ISP_IOXGET_8(isp, &lesrc->le_reserved3[i], ledst->le_reserved3[i]);
3151 isp_put_notify_fc(ispsoftc_t *isp, in_fcentry_t *src, in_fcentry_t *dst)
3153 isp_put_hdr(isp, &src->in_header, &dst->in_header);
3154 ISP_IOXPUT_32(isp, src->in_reserved, &dst->in_reserved);
3155 ISP_IOXPUT_8(isp, src->in_lun, &dst->in_lun);
3156 ISP_IOXPUT_8(isp, src->in_iid, &dst->in_iid);
3157 ISP_IOXPUT_16(isp, src->in_scclun, &dst->in_scclun);
3158 ISP_IOXPUT_32(isp, src->in_reserved2, &dst->in_reserved2);
3159 ISP_IOXPUT_16(isp, src->in_status, &dst->in_status);
3160 ISP_IOXPUT_16(isp, src->in_task_flags, &dst->in_task_flags);
3161 ISP_IOXPUT_16(isp, src->in_seqid, &dst->in_seqid);
3165 isp_put_notify_fc_e(ispsoftc_t *isp, in_fcentry_e_t *src, in_fcentry_e_t *dst)
3167 isp_put_hdr(isp, &src->in_header, &dst->in_header);
3168 ISP_IOXPUT_32(isp, src->in_reserved, &dst->in_reserved);
3169 ISP_IOXPUT_16(isp, src->in_iid, &dst->in_iid);
3170 ISP_IOXPUT_16(isp, src->in_scclun, &dst->in_scclun);
3171 ISP_IOXPUT_32(isp, src->in_reserved2, &dst->in_reserved2);
3172 ISP_IOXPUT_16(isp, src->in_status, &dst->in_status);
3173 ISP_IOXPUT_16(isp, src->in_task_flags, &dst->in_task_flags);
3174 ISP_IOXPUT_16(isp, src->in_seqid, &dst->in_seqid);
3178 isp_put_notify_24xx(ispsoftc_t *isp, in_fcentry_24xx_t *src, in_fcentry_24xx_t *dst)
3182 isp_put_hdr(isp, &src->in_header, &dst->in_header);
3183 ISP_IOXPUT_32(isp, src->in_reserved, &dst->in_reserved);
3184 ISP_IOXPUT_16(isp, src->in_nphdl, &dst->in_nphdl);
3185 ISP_IOXPUT_16(isp, src->in_reserved1, &dst->in_reserved1);
3186 ISP_IOXPUT_16(isp, src->in_flags, &dst->in_flags);
3187 ISP_IOXPUT_16(isp, src->in_srr_rxid, &dst->in_srr_rxid);
3188 ISP_IOXPUT_16(isp, src->in_status, &dst->in_status);
3189 ISP_IOXPUT_8(isp, src->in_status_subcode, &dst->in_status_subcode);
3190 ISP_IOXPUT_8(isp, src->in_fwhandle, &dst->in_fwhandle);
3191 ISP_IOXPUT_32(isp, src->in_rxid, &dst->in_rxid);
3192 ISP_IOXPUT_16(isp, src->in_srr_reloff_hi, &dst->in_srr_reloff_hi);
3193 ISP_IOXPUT_16(isp, src->in_srr_reloff_lo, &dst->in_srr_reloff_lo);
3194 ISP_IOXPUT_16(isp, src->in_srr_iu, &dst->in_srr_iu);
3195 ISP_IOXPUT_16(isp, src->in_srr_oxid, &dst->in_srr_oxid);
3196 ISP_IOXPUT_16(isp, src->in_nport_id_hi, &dst->in_nport_id_hi);
3197 ISP_IOXPUT_8(isp, src->in_nport_id_lo, &dst->in_nport_id_lo);
3198 ISP_IOXPUT_8(isp, src->in_reserved3, &dst->in_reserved3);
3199 ISP_IOXPUT_16(isp, src->in_np_handle, &dst->in_np_handle);
3200 for (i = 0; i < ASIZE(src->in_reserved4); i++) {
3201 ISP_IOXPUT_8(isp, src->in_reserved4[i], &dst->in_reserved4[i]);
3203 ISP_IOXPUT_8(isp, src->in_reserved5, &dst->in_reserved5);
3204 ISP_IOXPUT_8(isp, src->in_vpidx, &dst->in_vpidx);
3205 ISP_IOXPUT_32(isp, src->in_reserved6, &dst->in_reserved6);
3206 ISP_IOXPUT_16(isp, src->in_portid_lo, &dst->in_portid_lo);
3207 ISP_IOXPUT_8(isp, src->in_portid_hi, &dst->in_portid_hi);
3208 ISP_IOXPUT_8(isp, src->in_reserved7, &dst->in_reserved7);
3209 ISP_IOXPUT_16(isp, src->in_reserved8, &dst->in_reserved8);
3210 ISP_IOXPUT_16(isp, src->in_oxid, &dst->in_oxid);
3214 isp_get_notify_fc(ispsoftc_t *isp, in_fcentry_t *src, in_fcentry_t *dst)
3216 isp_get_hdr(isp, &src->in_header, &dst->in_header);
3217 ISP_IOXGET_32(isp, &src->in_reserved, dst->in_reserved);
3218 ISP_IOXGET_8(isp, &src->in_lun, dst->in_lun);
3219 ISP_IOXGET_8(isp, &src->in_iid, dst->in_iid);
3220 ISP_IOXGET_16(isp, &src->in_scclun, dst->in_scclun);
3221 ISP_IOXGET_32(isp, &src->in_reserved2, dst->in_reserved2);
3222 ISP_IOXGET_16(isp, &src->in_status, dst->in_status);
3223 ISP_IOXGET_16(isp, &src->in_task_flags, dst->in_task_flags);
3224 ISP_IOXGET_16(isp, &src->in_seqid, dst->in_seqid);
3228 isp_get_notify_fc_e(ispsoftc_t *isp, in_fcentry_e_t *src, in_fcentry_e_t *dst)
3230 isp_get_hdr(isp, &src->in_header, &dst->in_header);
3231 ISP_IOXGET_32(isp, &src->in_reserved, dst->in_reserved);
3232 ISP_IOXGET_16(isp, &src->in_iid, dst->in_iid);
3233 ISP_IOXGET_16(isp, &src->in_scclun, dst->in_scclun);
3234 ISP_IOXGET_32(isp, &src->in_reserved2, dst->in_reserved2);
3235 ISP_IOXGET_16(isp, &src->in_status, dst->in_status);
3236 ISP_IOXGET_16(isp, &src->in_task_flags, dst->in_task_flags);
3237 ISP_IOXGET_16(isp, &src->in_seqid, dst->in_seqid);
3241 isp_get_notify_24xx(ispsoftc_t *isp, in_fcentry_24xx_t *src, in_fcentry_24xx_t *dst)
3245 isp_get_hdr(isp, &src->in_header, &dst->in_header);
3246 ISP_IOXGET_32(isp, &src->in_reserved, dst->in_reserved);
3247 ISP_IOXGET_16(isp, &src->in_nphdl, dst->in_nphdl);
3248 ISP_IOXGET_16(isp, &src->in_reserved1, dst->in_reserved1);
3249 ISP_IOXGET_16(isp, &src->in_flags, dst->in_flags);
3250 ISP_IOXGET_16(isp, &src->in_srr_rxid, dst->in_srr_rxid);
3251 ISP_IOXGET_16(isp, &src->in_status, dst->in_status);
3252 ISP_IOXGET_8(isp, &src->in_status_subcode, dst->in_status_subcode);
3253 ISP_IOXGET_8(isp, &src->in_fwhandle, dst->in_fwhandle);
3254 ISP_IOXGET_32(isp, &src->in_rxid, dst->in_rxid);
3255 ISP_IOXGET_16(isp, &src->in_srr_reloff_hi, dst->in_srr_reloff_hi);
3256 ISP_IOXGET_16(isp, &src->in_srr_reloff_lo, dst->in_srr_reloff_lo);
3257 ISP_IOXGET_16(isp, &src->in_srr_iu, dst->in_srr_iu);
3258 ISP_IOXGET_16(isp, &src->in_srr_oxid, dst->in_srr_oxid);
3259 ISP_IOXGET_16(isp, &src->in_nport_id_hi, dst->in_nport_id_hi);
3260 ISP_IOXGET_8(isp, &src->in_nport_id_lo, dst->in_nport_id_lo);
3261 ISP_IOXGET_8(isp, &src->in_reserved3, dst->in_reserved3);
3262 ISP_IOXGET_16(isp, &src->in_np_handle, dst->in_np_handle);
3263 for (i = 0; i < ASIZE(src->in_reserved4); i++) {
3264 ISP_IOXGET_8(isp, &src->in_reserved4[i], dst->in_reserved4[i]);
3266 ISP_IOXGET_8(isp, &src->in_reserved5, dst->in_reserved5);
3267 ISP_IOXGET_8(isp, &src->in_vpidx, dst->in_vpidx);
3268 ISP_IOXGET_32(isp, &src->in_reserved6, dst->in_reserved6);
3269 ISP_IOXGET_16(isp, &src->in_portid_lo, dst->in_portid_lo);
3270 ISP_IOXGET_8(isp, &src->in_portid_hi, dst->in_portid_hi);
3271 ISP_IOXGET_8(isp, &src->in_reserved7, dst->in_reserved7);
3272 ISP_IOXGET_16(isp, &src->in_reserved8, dst->in_reserved8);
3273 ISP_IOXGET_16(isp, &src->in_oxid, dst->in_oxid);
3277 isp_put_notify_ack_fc(ispsoftc_t *isp, na_fcentry_t *src, na_fcentry_t *dst)
3280 isp_put_hdr(isp, &src->na_header, &dst->na_header);
3281 ISP_IOXPUT_32(isp, src->na_reserved, &dst->na_reserved);
3282 ISP_IOXPUT_8(isp, src->na_reserved1, &dst->na_reserved1);
3283 ISP_IOXPUT_8(isp, src->na_iid, &dst->na_iid);
3284 ISP_IOXPUT_16(isp, src->na_response, &dst->na_response);
3285 ISP_IOXPUT_16(isp, src->na_flags, &dst->na_flags);
3286 ISP_IOXPUT_16(isp, src->na_reserved2, &dst->na_reserved2);
3287 ISP_IOXPUT_16(isp, src->na_status, &dst->na_status);
3288 ISP_IOXPUT_16(isp, src->na_task_flags, &dst->na_task_flags);
3289 ISP_IOXPUT_16(isp, src->na_seqid, &dst->na_seqid);
3290 for (i = 0; i < NA2_RSVDLEN; i++) {
3291 ISP_IOXPUT_16(isp, src->na_reserved3[i], &dst->na_reserved3[i]);
3296 isp_put_notify_ack_fc_e(ispsoftc_t *isp, na_fcentry_e_t *src, na_fcentry_e_t *dst)
3299 isp_put_hdr(isp, &src->na_header, &dst->na_header);
3300 ISP_IOXPUT_32(isp, src->na_reserved, &dst->na_reserved);
3301 ISP_IOXPUT_16(isp, src->na_iid, &dst->na_iid);
3302 ISP_IOXPUT_16(isp, src->na_response, &dst->na_response);
3303 ISP_IOXPUT_16(isp, src->na_flags, &dst->na_flags);
3304 ISP_IOXPUT_16(isp, src->na_reserved2, &dst->na_reserved2);
3305 ISP_IOXPUT_16(isp, src->na_status, &dst->na_status);
3306 ISP_IOXPUT_16(isp, src->na_task_flags, &dst->na_task_flags);
3307 ISP_IOXPUT_16(isp, src->na_seqid, &dst->na_seqid);
3308 for (i = 0; i < NA2_RSVDLEN; i++) {
3309 ISP_IOXPUT_16(isp, src->na_reserved3[i], &dst->na_reserved3[i]);
3314 isp_put_notify_24xx_ack(ispsoftc_t *isp, na_fcentry_24xx_t *src, na_fcentry_24xx_t *dst)
3318 isp_put_hdr(isp, &src->na_header, &dst->na_header);
3319 ISP_IOXPUT_32(isp, src->na_handle, &dst->na_handle);
3320 ISP_IOXPUT_16(isp, src->na_nphdl, &dst->na_nphdl);
3321 ISP_IOXPUT_16(isp, src->na_reserved1, &dst->na_reserved1);
3322 ISP_IOXPUT_16(isp, src->na_flags, &dst->na_flags);
3323 ISP_IOXPUT_16(isp, src->na_srr_rxid, &dst->na_srr_rxid);
3324 ISP_IOXPUT_16(isp, src->na_status, &dst->na_status);
3325 ISP_IOXPUT_8(isp, src->na_status_subcode, &dst->na_status_subcode);
3326 ISP_IOXPUT_8(isp, src->na_fwhandle, &dst->na_fwhandle);
3327 ISP_IOXPUT_32(isp, src->na_rxid, &dst->na_rxid);
3328 ISP_IOXPUT_16(isp, src->na_srr_reloff_hi, &dst->na_srr_reloff_hi);
3329 ISP_IOXPUT_16(isp, src->na_srr_reloff_lo, &dst->na_srr_reloff_lo);
3330 ISP_IOXPUT_16(isp, src->na_srr_iu, &dst->na_srr_iu);
3331 ISP_IOXPUT_16(isp, src->na_srr_flags, &dst->na_srr_flags);
3332 for (i = 0; i < 18; i++) {
3333 ISP_IOXPUT_8(isp, src->na_reserved3[i], &dst->na_reserved3[i]);
3335 ISP_IOXPUT_8(isp, src->na_reserved4, &dst->na_reserved4);
3336 ISP_IOXPUT_8(isp, src->na_vpidx, &dst->na_vpidx);
3337 ISP_IOXPUT_8(isp, src->na_srr_reject_vunique, &dst->na_srr_reject_vunique);
3338 ISP_IOXPUT_8(isp, src->na_srr_reject_explanation, &dst->na_srr_reject_explanation);
3339 ISP_IOXPUT_8(isp, src->na_srr_reject_code, &dst->na_srr_reject_code);
3340 ISP_IOXPUT_8(isp, src->na_reserved5, &dst->na_reserved5);
3341 for (i = 0; i < 6; i++) {
3342 ISP_IOXPUT_8(isp, src->na_reserved6[i], &dst->na_reserved6[i]);
3344 ISP_IOXPUT_16(isp, src->na_oxid, &dst->na_oxid);
3348 isp_get_notify_ack_fc(ispsoftc_t *isp, na_fcentry_t *src, na_fcentry_t *dst)
3351 isp_get_hdr(isp, &src->na_header, &dst->na_header);
3352 ISP_IOXGET_32(isp, &src->na_reserved, dst->na_reserved);
3353 ISP_IOXGET_8(isp, &src->na_reserved1, dst->na_reserved1);
3354 ISP_IOXGET_8(isp, &src->na_iid, dst->na_iid);
3355 ISP_IOXGET_16(isp, &src->na_response, dst->na_response);
3356 ISP_IOXGET_16(isp, &src->na_flags, dst->na_flags);
3357 ISP_IOXGET_16(isp, &src->na_reserved2, dst->na_reserved2);
3358 ISP_IOXGET_16(isp, &src->na_status, dst->na_status);
3359 ISP_IOXGET_16(isp, &src->na_task_flags, dst->na_task_flags);
3360 ISP_IOXGET_16(isp, &src->na_seqid, dst->na_seqid);
3361 for (i = 0; i < NA2_RSVDLEN; i++) {
3362 ISP_IOXGET_16(isp, &src->na_reserved3[i], dst->na_reserved3[i]);
3367 isp_get_notify_ack_fc_e(ispsoftc_t *isp, na_fcentry_e_t *src, na_fcentry_e_t *dst)
3370 isp_get_hdr(isp, &src->na_header, &dst->na_header);
3371 ISP_IOXGET_32(isp, &src->na_reserved, dst->na_reserved);
3372 ISP_IOXGET_16(isp, &src->na_iid, dst->na_iid);
3373 ISP_IOXGET_16(isp, &src->na_response, dst->na_response);
3374 ISP_IOXGET_16(isp, &src->na_flags, dst->na_flags);
3375 ISP_IOXGET_16(isp, &src->na_reserved2, dst->na_reserved2);
3376 ISP_IOXGET_16(isp, &src->na_status, dst->na_status);
3377 ISP_IOXGET_16(isp, &src->na_task_flags, dst->na_task_flags);
3378 ISP_IOXGET_16(isp, &src->na_seqid, dst->na_seqid);
3379 for (i = 0; i < NA2_RSVDLEN; i++) {
3380 ISP_IOXGET_16(isp, &src->na_reserved3[i], dst->na_reserved3[i]);
3385 isp_get_notify_ack_24xx(ispsoftc_t *isp, na_fcentry_24xx_t *src, na_fcentry_24xx_t *dst)
3389 isp_get_hdr(isp, &src->na_header, &dst->na_header);
3390 ISP_IOXGET_32(isp, &src->na_handle, dst->na_handle);
3391 ISP_IOXGET_16(isp, &src->na_nphdl, dst->na_nphdl);
3392 ISP_IOXGET_16(isp, &src->na_reserved1, dst->na_reserved1);
3393 ISP_IOXGET_16(isp, &src->na_flags, dst->na_flags);
3394 ISP_IOXGET_16(isp, &src->na_srr_rxid, dst->na_srr_rxid);
3395 ISP_IOXGET_16(isp, &src->na_status, dst->na_status);
3396 ISP_IOXGET_8(isp, &src->na_status_subcode, dst->na_status_subcode);
3397 ISP_IOXGET_8(isp, &src->na_fwhandle, dst->na_fwhandle);
3398 ISP_IOXGET_32(isp, &src->na_rxid, dst->na_rxid);
3399 ISP_IOXGET_16(isp, &src->na_srr_reloff_hi, dst->na_srr_reloff_hi);
3400 ISP_IOXGET_16(isp, &src->na_srr_reloff_lo, dst->na_srr_reloff_lo);
3401 ISP_IOXGET_16(isp, &src->na_srr_iu, dst->na_srr_iu);
3402 ISP_IOXGET_16(isp, &src->na_srr_flags, dst->na_srr_flags);
3403 for (i = 0; i < 18; i++) {
3404 ISP_IOXGET_8(isp, &src->na_reserved3[i], dst->na_reserved3[i]);
3406 ISP_IOXGET_8(isp, &src->na_reserved4, dst->na_reserved4);
3407 ISP_IOXGET_8(isp, &src->na_vpidx, dst->na_vpidx);
3408 ISP_IOXGET_8(isp, &src->na_srr_reject_vunique, dst->na_srr_reject_vunique);
3409 ISP_IOXGET_8(isp, &src->na_srr_reject_explanation, dst->na_srr_reject_explanation);
3410 ISP_IOXGET_8(isp, &src->na_srr_reject_code, dst->na_srr_reject_code);
3411 ISP_IOXGET_8(isp, &src->na_reserved5, dst->na_reserved5);
3412 for (i = 0; i < 6; i++) {
3413 ISP_IOXGET_8(isp, &src->na_reserved6[i], dst->na_reserved6[i]);
3415 ISP_IOXGET_16(isp, &src->na_oxid, dst->na_oxid);
3419 isp_get_abts(ispsoftc_t *isp, abts_t *src, abts_t *dst)
3423 isp_get_hdr(isp, &src->abts_header, &dst->abts_header);
3424 for (i = 0; i < 6; i++) {
3425 ISP_IOXGET_8(isp, &src->abts_reserved0[i], dst->abts_reserved0[i]);
3427 ISP_IOXGET_16(isp, &src->abts_nphdl, dst->abts_nphdl);
3428 ISP_IOXGET_16(isp, &src->abts_reserved1, dst->abts_reserved1);
3429 ISP_IOXGET_16(isp, &src->abts_sof, dst->abts_sof);
3430 ISP_IOXGET_32(isp, &src->abts_rxid_abts, dst->abts_rxid_abts);
3431 ISP_IOXGET_16(isp, &src->abts_did_lo, dst->abts_did_lo);
3432 ISP_IOXGET_8(isp, &src->abts_did_hi, dst->abts_did_hi);
3433 ISP_IOXGET_8(isp, &src->abts_r_ctl, dst->abts_r_ctl);
3434 ISP_IOXGET_16(isp, &src->abts_sid_lo, dst->abts_sid_lo);
3435 ISP_IOXGET_8(isp, &src->abts_sid_hi, dst->abts_sid_hi);
3436 ISP_IOXGET_8(isp, &src->abts_cs_ctl, dst->abts_cs_ctl);
3437 ISP_IOXGET_16(isp, &src->abts_fs_ctl, dst->abts_fs_ctl);
3438 ISP_IOXGET_8(isp, &src->abts_f_ctl, dst->abts_f_ctl);
3439 ISP_IOXGET_8(isp, &src->abts_type, dst->abts_type);
3440 ISP_IOXGET_16(isp, &src->abts_seq_cnt, dst->abts_seq_cnt);
3441 ISP_IOXGET_8(isp, &src->abts_df_ctl, dst->abts_df_ctl);
3442 ISP_IOXGET_8(isp, &src->abts_seq_id, dst->abts_seq_id);
3443 ISP_IOXGET_16(isp, &src->abts_rx_id, dst->abts_rx_id);
3444 ISP_IOXGET_16(isp, &src->abts_ox_id, dst->abts_ox_id);
3445 ISP_IOXGET_32(isp, &src->abts_param, dst->abts_param);
3446 for (i = 0; i < 16; i++) {
3447 ISP_IOXGET_8(isp, &src->abts_reserved2[i], dst->abts_reserved2[i]);
3449 ISP_IOXGET_32(isp, &src->abts_rxid_task, dst->abts_rxid_task);
3453 isp_put_abts_rsp(ispsoftc_t *isp, abts_rsp_t *src, abts_rsp_t *dst)
3457 isp_put_hdr(isp, &src->abts_rsp_header, &dst->abts_rsp_header);
3458 ISP_IOXPUT_32(isp, src->abts_rsp_handle, &dst->abts_rsp_handle);
3459 ISP_IOXPUT_16(isp, src->abts_rsp_status, &dst->abts_rsp_status);
3460 ISP_IOXPUT_16(isp, src->abts_rsp_nphdl, &dst->abts_rsp_nphdl);
3461 ISP_IOXPUT_16(isp, src->abts_rsp_ctl_flags, &dst->abts_rsp_ctl_flags);
3462 ISP_IOXPUT_16(isp, src->abts_rsp_sof, &dst->abts_rsp_sof);
3463 ISP_IOXPUT_32(isp, src->abts_rsp_rxid_abts, &dst->abts_rsp_rxid_abts);
3464 ISP_IOXPUT_16(isp, src->abts_rsp_did_lo, &dst->abts_rsp_did_lo);
3465 ISP_IOXPUT_8(isp, src->abts_rsp_did_hi, &dst->abts_rsp_did_hi);
3466 ISP_IOXPUT_8(isp, src->abts_rsp_r_ctl, &dst->abts_rsp_r_ctl);
3467 ISP_IOXPUT_16(isp, src->abts_rsp_sid_lo, &dst->abts_rsp_sid_lo);
3468 ISP_IOXPUT_8(isp, src->abts_rsp_sid_hi, &dst->abts_rsp_sid_hi);
3469 ISP_IOXPUT_8(isp, src->abts_rsp_cs_ctl, &dst->abts_rsp_cs_ctl);
3470 ISP_IOXPUT_16(isp, src->abts_rsp_f_ctl_lo, &dst->abts_rsp_f_ctl_lo);
3471 ISP_IOXPUT_8(isp, src->abts_rsp_f_ctl_hi, &dst->abts_rsp_f_ctl_hi);
3472 ISP_IOXPUT_8(isp, src->abts_rsp_type, &dst->abts_rsp_type);
3473 ISP_IOXPUT_16(isp, src->abts_rsp_seq_cnt, &dst->abts_rsp_seq_cnt);
3474 ISP_IOXPUT_8(isp, src->abts_rsp_df_ctl, &dst->abts_rsp_df_ctl);
3475 ISP_IOXPUT_8(isp, src->abts_rsp_seq_id, &dst->abts_rsp_seq_id);
3476 ISP_IOXPUT_16(isp, src->abts_rsp_rx_id, &dst->abts_rsp_rx_id);
3477 ISP_IOXPUT_16(isp, src->abts_rsp_ox_id, &dst->abts_rsp_ox_id);
3478 ISP_IOXPUT_32(isp, src->abts_rsp_param, &dst->abts_rsp_param);
3479 if (src->abts_rsp_r_ctl == BA_ACC) {
3480 ISP_IOXPUT_16(isp, src->abts_rsp_payload.ba_acc.reserved, &dst->abts_rsp_payload.ba_acc.reserved);
3481 ISP_IOXPUT_8(isp, src->abts_rsp_payload.ba_acc.last_seq_id, &dst->abts_rsp_payload.ba_acc.last_seq_id);
3482 ISP_IOXPUT_8(isp, src->abts_rsp_payload.ba_acc.seq_id_valid, &dst->abts_rsp_payload.ba_acc.seq_id_valid);
3483 ISP_IOXPUT_16(isp, src->abts_rsp_payload.ba_acc.aborted_rx_id, &dst->abts_rsp_payload.ba_acc.aborted_rx_id);
3484 ISP_IOXPUT_16(isp, src->abts_rsp_payload.ba_acc.aborted_ox_id, &dst->abts_rsp_payload.ba_acc.aborted_ox_id);
3485 ISP_IOXPUT_16(isp, src->abts_rsp_payload.ba_acc.high_seq_cnt, &dst->abts_rsp_payload.ba_acc.high_seq_cnt);
3486 ISP_IOXPUT_16(isp, src->abts_rsp_payload.ba_acc.low_seq_cnt, &dst->abts_rsp_payload.ba_acc.low_seq_cnt);
3487 for (i = 0; i < 4; i++) {
3488 ISP_IOXPUT_16(isp, src->abts_rsp_payload.ba_acc.reserved2[i], &dst->abts_rsp_payload.ba_acc.reserved2[i]);
3490 } else if (src->abts_rsp_r_ctl == BA_RJT) {
3491 ISP_IOXPUT_8(isp, src->abts_rsp_payload.ba_rjt.vendor_unique, &dst->abts_rsp_payload.ba_rjt.vendor_unique);
3492 ISP_IOXPUT_8(isp, src->abts_rsp_payload.ba_rjt.explanation, &dst->abts_rsp_payload.ba_rjt.explanation);
3493 ISP_IOXPUT_8(isp, src->abts_rsp_payload.ba_rjt.reason, &dst->abts_rsp_payload.ba_rjt.reason);
3494 ISP_IOXPUT_8(isp, src->abts_rsp_payload.ba_rjt.reserved, &dst->abts_rsp_payload.ba_rjt.reserved);
3495 for (i = 0; i < 12; i++) {
3496 ISP_IOXPUT_16(isp, src->abts_rsp_payload.ba_rjt.reserved2[i], &dst->abts_rsp_payload.ba_rjt.reserved2[i]);
3499 for (i = 0; i < 16; i++) {
3500 ISP_IOXPUT_8(isp, src->abts_rsp_payload.reserved[i], &dst->abts_rsp_payload.reserved[i]);
3503 ISP_IOXPUT_32(isp, src->abts_rsp_rxid_task, &dst->abts_rsp_rxid_task);
3507 isp_get_abts_rsp(ispsoftc_t *isp, abts_rsp_t *src, abts_rsp_t *dst)
3511 isp_get_hdr(isp, &src->abts_rsp_header, &dst->abts_rsp_header);
3512 ISP_IOXGET_32(isp, &src->abts_rsp_handle, dst->abts_rsp_handle);
3513 ISP_IOXGET_16(isp, &src->abts_rsp_status, dst->abts_rsp_status);
3514 ISP_IOXGET_16(isp, &src->abts_rsp_nphdl, dst->abts_rsp_nphdl);
3515 ISP_IOXGET_16(isp, &src->abts_rsp_ctl_flags, dst->abts_rsp_ctl_flags);
3516 ISP_IOXGET_16(isp, &src->abts_rsp_sof, dst->abts_rsp_sof);
3517 ISP_IOXGET_32(isp, &src->abts_rsp_rxid_abts, dst->abts_rsp_rxid_abts);
3518 ISP_IOXGET_16(isp, &src->abts_rsp_did_lo, dst->abts_rsp_did_lo);
3519 ISP_IOXGET_8(isp, &src->abts_rsp_did_hi, dst->abts_rsp_did_hi);
3520 ISP_IOXGET_8(isp, &src->abts_rsp_r_ctl, dst->abts_rsp_r_ctl);
3521 ISP_IOXGET_16(isp, &src->abts_rsp_sid_lo, dst->abts_rsp_sid_lo);
3522 ISP_IOXGET_8(isp, &src->abts_rsp_sid_hi, dst->abts_rsp_sid_hi);
3523 ISP_IOXGET_8(isp, &src->abts_rsp_cs_ctl, dst->abts_rsp_cs_ctl);
3524 ISP_IOXGET_16(isp, &src->abts_rsp_f_ctl_lo, dst->abts_rsp_f_ctl_lo);
3525 ISP_IOXGET_8(isp, &src->abts_rsp_f_ctl_hi, dst->abts_rsp_f_ctl_hi);
3526 ISP_IOXGET_8(isp, &src->abts_rsp_type, dst->abts_rsp_type);
3527 ISP_IOXGET_16(isp, &src->abts_rsp_seq_cnt, dst->abts_rsp_seq_cnt);
3528 ISP_IOXGET_8(isp, &src->abts_rsp_df_ctl, dst->abts_rsp_df_ctl);
3529 ISP_IOXGET_8(isp, &src->abts_rsp_seq_id, dst->abts_rsp_seq_id);
3530 ISP_IOXGET_16(isp, &src->abts_rsp_rx_id, dst->abts_rsp_rx_id);
3531 ISP_IOXGET_16(isp, &src->abts_rsp_ox_id, dst->abts_rsp_ox_id);
3532 ISP_IOXGET_32(isp, &src->abts_rsp_param, dst->abts_rsp_param);
3533 for (i = 0; i < 8; i++) {
3534 ISP_IOXGET_8(isp, &src->abts_rsp_payload.rsp.reserved[i], dst->abts_rsp_payload.rsp.reserved[i]);
3536 ISP_IOXGET_32(isp, &src->abts_rsp_payload.rsp.subcode1, dst->abts_rsp_payload.rsp.subcode1);
3537 ISP_IOXGET_32(isp, &src->abts_rsp_payload.rsp.subcode2, dst->abts_rsp_payload.rsp.subcode2);
3538 ISP_IOXGET_32(isp, &src->abts_rsp_rxid_task, dst->abts_rsp_rxid_task);
3540 #endif /* ISP_TARGET_MODE */