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