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