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