The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/ic/isp_library.c

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

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

Cache object: 45134c04692ad8d43597a97645b588ba


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.