Deleted Added
full compact
isp_library.c (218691) isp_library.c (238869)
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 *

--- 21 unchanged lines hidden (view full) ---

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>
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 *

--- 21 unchanged lines hidden (view full) ---

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: head/sys/dev/isp/isp_library.c 218691 2011-02-14 21:50:51Z marius $");
38__FBSDID("$FreeBSD: head/sys/dev/isp/isp_library.c 238869 2012-07-28 20:06:29Z mjacob $");
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

--- 6 unchanged lines hidden (view full) ---

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 */
60int
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

--- 6 unchanged lines hidden (view full) ---

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 */
60int
61isp_send_cmd(ispsoftc_t *isp, void *fqe, void *segp, uint32_t nsegs, uint32_t totalcnt, isp_ddir_t ddir)
61isp_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;
65 uint32_t seg, curseg, seglim, nxt, nxtnxt, ddf;
66 ispds_t *dsp = NULL;
67 ispds64_t *dsp64 = NULL;
68 void *qe0, *qe1;
69

--- 321 unchanged lines hidden (view full) ---

391 fcparam *fcp;
392
393 fcp = FCPARAM(isp, chan);
394 if (fcp->role == ISP_ROLE_NONE) {
395 return (0);
396 }
397 if (fcp->isp_fwstate < FW_READY || fcp->isp_loopstate < LOOP_PDB_RCVD) {
398 if (isp_control(isp, ISPCTL_FCLINK_TEST, chan, tval) != 0) {
62{
63 uint8_t storage[QENTRY_LEN];
64 uint8_t type, nqe;
65 uint32_t seg, curseg, seglim, nxt, nxtnxt, ddf;
66 ispds_t *dsp = NULL;
67 ispds64_t *dsp64 = NULL;
68 void *qe0, *qe1;
69

--- 321 unchanged lines hidden (view full) ---

391 fcparam *fcp;
392
393 fcp = FCPARAM(isp, chan);
394 if (fcp->role == ISP_ROLE_NONE) {
395 return (0);
396 }
397 if (fcp->isp_fwstate < FW_READY || fcp->isp_loopstate < LOOP_PDB_RCVD) {
398 if (isp_control(isp, ISPCTL_FCLINK_TEST, chan, tval) != 0) {
399 isp_prt(isp, ISP_LOGSANCFG, "isp_fc_runstate: linktest failed for channel %d", chan);
399 isp_prt(isp, ISP_LOG_SANCFG, "isp_fc_runstate: linktest failed for channel %d", chan);
400 return (-1);
401 }
402 if (fcp->isp_fwstate != FW_READY || fcp->isp_loopstate < LOOP_PDB_RCVD) {
400 return (-1);
401 }
402 if (fcp->isp_fwstate != FW_READY || fcp->isp_loopstate < LOOP_PDB_RCVD) {
403 isp_prt(isp, ISP_LOGSANCFG, "isp_fc_runstate: f/w not ready for channel %d", chan);
403 isp_prt(isp, ISP_LOG_SANCFG, "isp_fc_runstate: f/w not ready for channel %d", chan);
404 return (-1);
405 }
406 }
407
408 if ((fcp->role & ISP_ROLE_INITIATOR) == 0) {
409 return (0);
410 }
411
412 if (isp_control(isp, ISPCTL_SCAN_LOOP, chan) != 0) {
404 return (-1);
405 }
406 }
407
408 if ((fcp->role & ISP_ROLE_INITIATOR) == 0) {
409 return (0);
410 }
411
412 if (isp_control(isp, ISPCTL_SCAN_LOOP, chan) != 0) {
413 isp_prt(isp, ISP_LOGSANCFG, "isp_fc_runstate: scan loop fails on channel %d", chan);
413 isp_prt(isp, ISP_LOG_SANCFG, "isp_fc_runstate: scan loop fails on channel %d", chan);
414 return (LOOP_PDB_RCVD);
415 }
416 if (isp_control(isp, ISPCTL_SCAN_FABRIC, chan) != 0) {
414 return (LOOP_PDB_RCVD);
415 }
416 if (isp_control(isp, ISPCTL_SCAN_FABRIC, chan) != 0) {
417 isp_prt(isp, ISP_LOGSANCFG, "isp_fc_runstate: scan fabric fails on channel %d", chan);
417 isp_prt(isp, ISP_LOG_SANCFG, "isp_fc_runstate: scan fabric fails on channel %d", chan);
418 return (LOOP_LSCAN_DONE);
419 }
420 if (isp_control(isp, ISPCTL_PDB_SYNC, chan) != 0) {
418 return (LOOP_LSCAN_DONE);
419 }
420 if (isp_control(isp, ISPCTL_PDB_SYNC, chan) != 0) {
421 isp_prt(isp, ISP_LOGSANCFG, "isp_fc_runstate: pdb_sync fails on channel %d", chan);
421 isp_prt(isp, ISP_LOG_SANCFG, "isp_fc_runstate: pdb_sync fails on channel %d", chan);
422 return (LOOP_FSCAN_DONE);
423 }
424 if (fcp->isp_fwstate != FW_READY || fcp->isp_loopstate != LOOP_READY) {
422 return (LOOP_FSCAN_DONE);
423 }
424 if (fcp->isp_fwstate != FW_READY || fcp->isp_loopstate != LOOP_READY) {
425 isp_prt(isp, ISP_LOGSANCFG, "isp_fc_runstate: f/w not ready again on channel %d", chan);
425 isp_prt(isp, ISP_LOG_SANCFG, "isp_fc_runstate: f/w not ready again on channel %d", chan);
426 return (-1);
427 }
428 return (0);
429}
430
431/*
432 * Fibre Channel Support routines
433 */
434void
435isp_dump_portdb(ispsoftc_t *isp, int chan)
436{
437 fcparam *fcp = FCPARAM(isp, chan);
438 int i;
439
440 for (i = 0; i < MAX_FC_TARG; i++) {
426 return (-1);
427 }
428 return (0);
429}
430
431/*
432 * Fibre Channel Support routines
433 */
434void
435isp_dump_portdb(ispsoftc_t *isp, int chan)
436{
437 fcparam *fcp = FCPARAM(isp, chan);
438 int i;
439
440 for (i = 0; i < MAX_FC_TARG; i++) {
441 char mb[4];
441 char mb[4], buf1[64], buf2[64];
442 const char *dbs[8] = {
443 "NIL ",
444 "PROB",
445 "DEAD",
446 "CHGD",
447 "NEW ",
448 "PVLD",
449 "ZOMB",
450 "VLD "
451 };
442 const char *dbs[8] = {
443 "NIL ",
444 "PROB",
445 "DEAD",
446 "CHGD",
447 "NEW ",
448 "PVLD",
449 "ZOMB",
450 "VLD "
451 };
452 const char *roles[4] = {
453 " UNK", " TGT", " INI", "TINI"
454 };
455 fcportdb_t *lp = &fcp->portdb[i];
456
457 if (lp->state == FC_PORTDB_STATE_NIL && lp->target_mode == 0) {
458 continue;
459 }
460 if (lp->dev_map_idx) {
461 ISP_SNPRINTF(mb, sizeof (mb), "%3d", ((int) lp->dev_map_idx) - 1);
462 } else {
463 ISP_SNPRINTF(mb, sizeof (mb), "---");
464 }
452 fcportdb_t *lp = &fcp->portdb[i];
453
454 if (lp->state == FC_PORTDB_STATE_NIL && lp->target_mode == 0) {
455 continue;
456 }
457 if (lp->dev_map_idx) {
458 ISP_SNPRINTF(mb, sizeof (mb), "%3d", ((int) lp->dev_map_idx) - 1);
459 } else {
460 ISP_SNPRINTF(mb, sizeof (mb), "---");
461 }
462 isp_gen_role_str(buf1, sizeof (buf1), lp->prli_word3);
463 isp_gen_role_str(buf2, sizeof (buf2), lp->new_prli_word3);
465 isp_prt(isp, ISP_LOGALL, "Chan %d [%d]: hdl 0x%x %s al%d tgt %s %s 0x%06x =>%s 0x%06x; WWNN 0x%08x%08x WWPN 0x%08x%08x",
464 isp_prt(isp, ISP_LOGALL, "Chan %d [%d]: hdl 0x%x %s al%d tgt %s %s 0x%06x =>%s 0x%06x; WWNN 0x%08x%08x WWPN 0x%08x%08x",
466 chan, i, lp->handle, dbs[lp->state], lp->autologin, mb, roles[lp->roles], lp->portid, roles[lp->new_roles], lp->new_portid,
465 chan, i, lp->handle, dbs[lp->state], lp->autologin, mb, buf1, lp->portid, buf2, lp->new_portid,
467 (uint32_t) (lp->node_wwn >> 32), (uint32_t) (lp->node_wwn), (uint32_t) (lp->port_wwn >> 32), (uint32_t) (lp->port_wwn));
468 }
469}
470
466 (uint32_t) (lp->node_wwn >> 32), (uint32_t) (lp->node_wwn), (uint32_t) (lp->port_wwn >> 32), (uint32_t) (lp->port_wwn));
467 }
468}
469
470void
471isp_gen_role_str(char *buf, size_t len, uint16_t p3)
472{
473 int nd = 0;
474 buf[0] = '(';
475 buf[1] = 0;
476 if (p3 & PRLI_WD3_ENHANCED_DISCOVERY) {
477 nd++;
478 strlcat(buf, "EDisc", len);
479 }
480 if (p3 & PRLI_WD3_REC_SUPPORT) {
481 if (nd++) {
482 strlcat(buf, ",", len);
483 }
484 strlcat(buf, "REC", len);
485 }
486 if (p3 & PRLI_WD3_TASK_RETRY_IDENTIFICATION_REQUESTED) {
487 if (nd++) {
488 strlcat(buf, ",", len);
489 }
490 strlcat(buf, "RetryID", len);
491 }
492 if (p3 & PRLI_WD3_RETRY) {
493 if (nd++) {
494 strlcat(buf, ",", len);
495 }
496 strlcat(buf, "Retry", len);
497 }
498 if (p3 & PRLI_WD3_CONFIRMED_COMPLETION_ALLOWED) {
499 if (nd++) {
500 strlcat(buf, ",", len);
501 }
502 strlcat(buf, "CNFRM", len);
503 }
504 if (p3 & PRLI_WD3_DATA_OVERLAY_ALLOWED) {
505 if (nd++) {
506 strlcat(buf, ",", len);
507 }
508 strlcat(buf, "DOver", len);
509 }
510 if (p3 & PRLI_WD3_INITIATOR_FUNCTION) {
511 if (nd++) {
512 strlcat(buf, ",", len);
513 }
514 strlcat(buf, "INI", len);
515 }
516 if (p3 & PRLI_WD3_TARGET_FUNCTION) {
517 if (nd++) {
518 strlcat(buf, ",", len);
519 }
520 strlcat(buf, "TGT", len);
521 }
522 if (p3 & PRLI_WD3_READ_FCP_XFER_RDY_DISABLED) {
523 if (nd++) {
524 strlcat(buf, ",", len);
525 }
526 strlcat(buf, "RdXfrDis", len);
527 }
528 if (p3 & PRLI_WD3_WRITE_FCP_XFER_RDY_DISABLED) {
529 if (nd++) {
530 strlcat(buf, ",", len);
531 }
532 strlcat(buf, "XfrDis", len);
533 }
534 strlcat(buf, ")", len);
535}
536
471const char *
472isp_fc_fw_statename(int state)
473{
474 switch (state) {
475 case FW_CONFIG_WAIT: return "Config Wait";
476 case FW_WAIT_AL_PA: return "Waiting for AL_PA";
477 case FW_WAIT_LOGIN: return "Wait Login";
478 case FW_READY: return "Ready";

--- 51 unchanged lines hidden (view full) ---

530 isp_prt(isp, ISP_LOGWARN, "%s: bad channel %d", __func__, chan);
531 return (ENXIO);
532 }
533 if (chan == 0) {
534#ifdef ISP_TARGET_MODE
535 isp_del_all_wwn_entries(isp, chan);
536#endif
537 isp_clear_commands(isp);
537const char *
538isp_fc_fw_statename(int state)
539{
540 switch (state) {
541 case FW_CONFIG_WAIT: return "Config Wait";
542 case FW_WAIT_AL_PA: return "Waiting for AL_PA";
543 case FW_WAIT_LOGIN: return "Wait Login";
544 case FW_READY: return "Ready";

--- 51 unchanged lines hidden (view full) ---

596 isp_prt(isp, ISP_LOGWARN, "%s: bad channel %d", __func__, chan);
597 return (ENXIO);
598 }
599 if (chan == 0) {
600#ifdef ISP_TARGET_MODE
601 isp_del_all_wwn_entries(isp, chan);
602#endif
603 isp_clear_commands(isp);
538
539 isp_reset(isp, 0);
540 if (isp->isp_state != ISP_RESETSTATE) {
541 isp_prt(isp, ISP_LOGERR, "%s: cannot reset card", __func__);
542 return (EIO);
543 }
544 fcp->role = new_role;
545 isp_init(isp);
546 if (isp->isp_state != ISP_INITSTATE) {

--- 344 unchanged lines hidden (view full) ---

891{
892 int i;
893 isp_put_hdr(isp, &src->req_header, &dst->req_header);
894 ISP_IOXPUT_32(isp, src->req_handle, &dst->req_handle);
895 ISP_IOXPUT_8(isp, src->req_lun_trn, &dst->req_lun_trn);
896 ISP_IOXPUT_8(isp, src->req_target, &dst->req_target);
897 ISP_IOXPUT_16(isp, src->req_scclun, &dst->req_scclun);
898 ISP_IOXPUT_16(isp, src->req_flags, &dst->req_flags);
604 isp_reset(isp, 0);
605 if (isp->isp_state != ISP_RESETSTATE) {
606 isp_prt(isp, ISP_LOGERR, "%s: cannot reset card", __func__);
607 return (EIO);
608 }
609 fcp->role = new_role;
610 isp_init(isp);
611 if (isp->isp_state != ISP_INITSTATE) {

--- 344 unchanged lines hidden (view full) ---

956{
957 int i;
958 isp_put_hdr(isp, &src->req_header, &dst->req_header);
959 ISP_IOXPUT_32(isp, src->req_handle, &dst->req_handle);
960 ISP_IOXPUT_8(isp, src->req_lun_trn, &dst->req_lun_trn);
961 ISP_IOXPUT_8(isp, src->req_target, &dst->req_target);
962 ISP_IOXPUT_16(isp, src->req_scclun, &dst->req_scclun);
963 ISP_IOXPUT_16(isp, src->req_flags, &dst->req_flags);
899 ISP_IOXPUT_16(isp, src->req_reserved, &dst->req_reserved);
964 ISP_IOXPUT_8(isp, src->req_crn, &dst->req_crn);
965 ISP_IOXPUT_8(isp, src->req_reserved, &dst->req_reserved);
900 ISP_IOXPUT_16(isp, src->req_time, &dst->req_time);
901 ISP_IOXPUT_16(isp, src->req_seg_count, &dst->req_seg_count);
902 for (i = 0; i < ASIZE(src->req_cdb); i++) {
903 ISP_IOXPUT_8(isp, src->req_cdb[i], &dst->req_cdb[i]);
904 }
905 ISP_IOXPUT_32(isp, src->req_totalcnt, &dst->req_totalcnt);
906 for (i = 0; i < ISP_RQDSEG_T3; i++) {
907 ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_base, &dst->req_dataseg[i].ds_base);

--- 6 unchanged lines hidden (view full) ---

914isp_put_request_t3e(ispsoftc_t *isp, ispreqt3e_t *src, ispreqt3e_t *dst)
915{
916 int i;
917 isp_put_hdr(isp, &src->req_header, &dst->req_header);
918 ISP_IOXPUT_32(isp, src->req_handle, &dst->req_handle);
919 ISP_IOXPUT_16(isp, src->req_target, &dst->req_target);
920 ISP_IOXPUT_16(isp, src->req_scclun, &dst->req_scclun);
921 ISP_IOXPUT_16(isp, src->req_flags, &dst->req_flags);
966 ISP_IOXPUT_16(isp, src->req_time, &dst->req_time);
967 ISP_IOXPUT_16(isp, src->req_seg_count, &dst->req_seg_count);
968 for (i = 0; i < ASIZE(src->req_cdb); i++) {
969 ISP_IOXPUT_8(isp, src->req_cdb[i], &dst->req_cdb[i]);
970 }
971 ISP_IOXPUT_32(isp, src->req_totalcnt, &dst->req_totalcnt);
972 for (i = 0; i < ISP_RQDSEG_T3; i++) {
973 ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_base, &dst->req_dataseg[i].ds_base);

--- 6 unchanged lines hidden (view full) ---

980isp_put_request_t3e(ispsoftc_t *isp, ispreqt3e_t *src, ispreqt3e_t *dst)
981{
982 int i;
983 isp_put_hdr(isp, &src->req_header, &dst->req_header);
984 ISP_IOXPUT_32(isp, src->req_handle, &dst->req_handle);
985 ISP_IOXPUT_16(isp, src->req_target, &dst->req_target);
986 ISP_IOXPUT_16(isp, src->req_scclun, &dst->req_scclun);
987 ISP_IOXPUT_16(isp, src->req_flags, &dst->req_flags);
922 ISP_IOXPUT_16(isp, src->req_reserved, &dst->req_reserved);
988 ISP_IOXPUT_8(isp, src->req_crn, &dst->req_crn);
989 ISP_IOXPUT_8(isp, src->req_reserved, &dst->req_reserved);
923 ISP_IOXPUT_16(isp, src->req_time, &dst->req_time);
924 ISP_IOXPUT_16(isp, src->req_seg_count, &dst->req_seg_count);
925 for (i = 0; i < ASIZE(src->req_cdb); i++) {
926 ISP_IOXPUT_8(isp, src->req_cdb[i], &dst->req_cdb[i]);
927 }
928 ISP_IOXPUT_32(isp, src->req_totalcnt, &dst->req_totalcnt);
929 for (i = 0; i < ISP_RQDSEG_T3; i++) {
930 ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_base, &dst->req_dataseg[i].ds_base);

--- 141 unchanged lines hidden (view full) ---

1072 ISP_IOXGET_32(isp, &src->req_handle, dst->req_handle);
1073 ISP_IOXGET_16(isp, &src->req_scsi_status, dst->req_scsi_status);
1074 ISP_IOXGET_16(isp, &src->req_completion_status, dst->req_completion_status);
1075 ISP_IOXGET_16(isp, &src->req_state_flags, dst->req_state_flags);
1076 ISP_IOXGET_16(isp, &src->req_status_flags, dst->req_status_flags);
1077 ISP_IOXGET_16(isp, &src->req_time, dst->req_time);
1078 ISP_IOXGET_16(isp, &src->req_sense_len, dst->req_sense_len);
1079 ISP_IOXGET_32(isp, &src->req_resid, dst->req_resid);
990 ISP_IOXPUT_16(isp, src->req_time, &dst->req_time);
991 ISP_IOXPUT_16(isp, src->req_seg_count, &dst->req_seg_count);
992 for (i = 0; i < ASIZE(src->req_cdb); i++) {
993 ISP_IOXPUT_8(isp, src->req_cdb[i], &dst->req_cdb[i]);
994 }
995 ISP_IOXPUT_32(isp, src->req_totalcnt, &dst->req_totalcnt);
996 for (i = 0; i < ISP_RQDSEG_T3; i++) {
997 ISP_IOXPUT_32(isp, src->req_dataseg[i].ds_base, &dst->req_dataseg[i].ds_base);

--- 141 unchanged lines hidden (view full) ---

1139 ISP_IOXGET_32(isp, &src->req_handle, dst->req_handle);
1140 ISP_IOXGET_16(isp, &src->req_scsi_status, dst->req_scsi_status);
1141 ISP_IOXGET_16(isp, &src->req_completion_status, dst->req_completion_status);
1142 ISP_IOXGET_16(isp, &src->req_state_flags, dst->req_state_flags);
1143 ISP_IOXGET_16(isp, &src->req_status_flags, dst->req_status_flags);
1144 ISP_IOXGET_16(isp, &src->req_time, dst->req_time);
1145 ISP_IOXGET_16(isp, &src->req_sense_len, dst->req_sense_len);
1146 ISP_IOXGET_32(isp, &src->req_resid, dst->req_resid);
1080 for (i = 0; i < 8; i++) {
1147 for (i = 0; i < sizeof (src->req_response); i++) {
1081 ISP_IOXGET_8(isp, &src->req_response[i], dst->req_response[i]);
1082 }
1148 ISP_IOXGET_8(isp, &src->req_response[i], dst->req_response[i]);
1149 }
1083 for (i = 0; i < 32; i++) {
1150 for (i = 0; i < sizeof (src->req_sense_data); i++) {
1084 ISP_IOXGET_8(isp, &src->req_sense_data[i], dst->req_sense_data[i]);
1085 }
1086}
1087
1088void
1151 ISP_IOXGET_8(isp, &src->req_sense_data[i], dst->req_sense_data[i]);
1152 }
1153}
1154
1155void
1156isp_get_cont_response(ispsoftc_t *isp, ispstatus_cont_t *src, ispstatus_cont_t *dst)
1157{
1158 int i;
1159 isp_get_hdr(isp, &src->req_header, &dst->req_header);
1160 if (IS_24XX(isp)) {
1161 uint32_t *a, *b;
1162 a = (uint32_t *) src->req_sense_data;
1163 b = (uint32_t *) dst->req_sense_data;
1164 for (i = 0; i < (sizeof (src->req_sense_data) / sizeof (uint32_t)); i++) {
1165 ISP_IOZGET_32(isp, a++, *b++);
1166 }
1167 } else {
1168 for (i = 0; i < sizeof (src->req_sense_data); i++) {
1169 ISP_IOXGET_8(isp, &src->req_sense_data[i], dst->req_sense_data[i]);
1170 }
1171 }
1172}
1173
1174void
1089isp_get_24xx_response(ispsoftc_t *isp, isp24xx_statusreq_t *src, isp24xx_statusreq_t *dst)
1090{
1091 int i;
1092 uint32_t *s, *d;
1093
1094 isp_get_hdr(isp, &src->req_header, &dst->req_header);
1095 ISP_IOXGET_32(isp, &src->req_handle, dst->req_handle);
1096 ISP_IOXGET_16(isp, &src->req_completion_status, dst->req_completion_status);

--- 827 unchanged lines hidden (view full) ---

1924 ISP_IOZGET_8(isp, &src->df_ctl, dst->df_ctl);
1925 ISP_IOZGET_16(isp, &src->seq_cnt, dst->seq_cnt);
1926 ISP_IOZGET_16(isp, &src->ox_id, dst->ox_id);
1927 ISP_IOZGET_16(isp, &src->rx_id, dst->rx_id);
1928 ISP_IOZGET_32(isp, &src->parameter, dst->parameter);
1929}
1930
1931void
1175isp_get_24xx_response(ispsoftc_t *isp, isp24xx_statusreq_t *src, isp24xx_statusreq_t *dst)
1176{
1177 int i;
1178 uint32_t *s, *d;
1179
1180 isp_get_hdr(isp, &src->req_header, &dst->req_header);
1181 ISP_IOXGET_32(isp, &src->req_handle, dst->req_handle);
1182 ISP_IOXGET_16(isp, &src->req_completion_status, dst->req_completion_status);

--- 827 unchanged lines hidden (view full) ---

2010 ISP_IOZGET_8(isp, &src->df_ctl, dst->df_ctl);
2011 ISP_IOZGET_16(isp, &src->seq_cnt, dst->seq_cnt);
2012 ISP_IOZGET_16(isp, &src->ox_id, dst->ox_id);
2013 ISP_IOZGET_16(isp, &src->rx_id, dst->rx_id);
2014 ISP_IOZGET_32(isp, &src->parameter, dst->parameter);
2015}
2016
2017void
2018isp_put_fc_hdr(ispsoftc_t *isp, fc_hdr_t *src, fc_hdr_t *dst)
2019{
2020 ISP_IOZPUT_8(isp, src->r_ctl, &dst->r_ctl);
2021 ISP_IOZPUT_8(isp, src->d_id[0], &dst->d_id[0]);
2022 ISP_IOZPUT_8(isp, src->d_id[1], &dst->d_id[1]);
2023 ISP_IOZPUT_8(isp, src->d_id[2], &dst->d_id[2]);
2024 ISP_IOZPUT_8(isp, src->cs_ctl, &dst->cs_ctl);
2025 ISP_IOZPUT_8(isp, src->s_id[0], &dst->s_id[0]);
2026 ISP_IOZPUT_8(isp, src->s_id[1], &dst->s_id[1]);
2027 ISP_IOZPUT_8(isp, src->s_id[2], &dst->s_id[2]);
2028 ISP_IOZPUT_8(isp, src->type, &dst->type);
2029 ISP_IOZPUT_8(isp, src->f_ctl[0], &dst->f_ctl[0]);
2030 ISP_IOZPUT_8(isp, src->f_ctl[1], &dst->f_ctl[1]);
2031 ISP_IOZPUT_8(isp, src->f_ctl[2], &dst->f_ctl[2]);
2032 ISP_IOZPUT_8(isp, src->seq_id, &dst->seq_id);
2033 ISP_IOZPUT_8(isp, src->df_ctl, &dst->df_ctl);
2034 ISP_IOZPUT_16(isp, src->seq_cnt, &dst->seq_cnt);
2035 ISP_IOZPUT_16(isp, src->ox_id, &dst->ox_id);
2036 ISP_IOZPUT_16(isp, src->rx_id, &dst->rx_id);
2037 ISP_IOZPUT_32(isp, src->parameter, &dst->parameter);
2038}
2039
2040void
1932isp_get_fcp_cmnd_iu(ispsoftc_t *isp, fcp_cmnd_iu_t *src, fcp_cmnd_iu_t *dst)
1933{
1934 int i;
1935
1936 for (i = 0; i < 8; i++) {
1937 ISP_IOZGET_8(isp, &src->fcp_cmnd_lun[i], dst->fcp_cmnd_lun[i]);
1938 }
1939 ISP_IOZGET_8(isp, &src->fcp_cmnd_crn, dst->fcp_cmnd_crn);

--- 53 unchanged lines hidden (view full) ---

1993 ISP_IOZPUT_16(isp, src->ct_cmd_resp, &dst->ct_cmd_resp);
1994 ISP_IOZPUT_16(isp, src->ct_bcnt_resid, &dst->ct_bcnt_resid);
1995 ISP_IOZPUT_8(isp, src->ct_reserved1, &dst->ct_reserved1);
1996 ISP_IOZPUT_8(isp, src->ct_reason, &dst->ct_reason);
1997 ISP_IOZPUT_8(isp, src->ct_explanation, &dst->ct_explanation);
1998 ISP_IOZPUT_8(isp, src->ct_vunique, &dst->ct_vunique);
1999}
2000
2041isp_get_fcp_cmnd_iu(ispsoftc_t *isp, fcp_cmnd_iu_t *src, fcp_cmnd_iu_t *dst)
2042{
2043 int i;
2044
2045 for (i = 0; i < 8; i++) {
2046 ISP_IOZGET_8(isp, &src->fcp_cmnd_lun[i], dst->fcp_cmnd_lun[i]);
2047 }
2048 ISP_IOZGET_8(isp, &src->fcp_cmnd_crn, dst->fcp_cmnd_crn);

--- 53 unchanged lines hidden (view full) ---

2102 ISP_IOZPUT_16(isp, src->ct_cmd_resp, &dst->ct_cmd_resp);
2103 ISP_IOZPUT_16(isp, src->ct_bcnt_resid, &dst->ct_bcnt_resid);
2104 ISP_IOZPUT_8(isp, src->ct_reserved1, &dst->ct_reserved1);
2105 ISP_IOZPUT_8(isp, src->ct_reason, &dst->ct_reason);
2106 ISP_IOZPUT_8(isp, src->ct_explanation, &dst->ct_explanation);
2107 ISP_IOZPUT_8(isp, src->ct_vunique, &dst->ct_vunique);
2108}
2109
2110void
2111isp_put_fcp_rsp_iu(ispsoftc_t *isp, fcp_rsp_iu_t *src, fcp_rsp_iu_t *dst)
2112{
2113 int i;
2114 for (i = 0; i < ((sizeof (src->fcp_rsp_reserved))/(sizeof (src->fcp_rsp_reserved[0]))); i++) {
2115 ISP_IOZPUT_8(isp, src->fcp_rsp_reserved[i], &dst->fcp_rsp_reserved[i]);
2116 }
2117 ISP_IOZPUT_16(isp, src->fcp_rsp_status_qualifier, &dst->fcp_rsp_status_qualifier);
2118 ISP_IOZPUT_8(isp, src->fcp_rsp_bits, &dst->fcp_rsp_bits);
2119 ISP_IOZPUT_8(isp, src->fcp_rsp_scsi_status, &dst->fcp_rsp_scsi_status);
2120 ISP_IOZPUT_32(isp, src->fcp_rsp_resid, &dst->fcp_rsp_resid);
2121 ISP_IOZPUT_32(isp, src->fcp_rsp_snslen, &dst->fcp_rsp_snslen);
2122 ISP_IOZPUT_32(isp, src->fcp_rsp_rsplen, &dst->fcp_rsp_rsplen);
2123}
2124
2001#ifdef ISP_TARGET_MODE
2002
2003/*
2004 * Command shipping- finish off first queue entry and do dma mapping and
2005 * additional segments as needed.
2006 *
2125#ifdef ISP_TARGET_MODE
2126
2127/*
2128 * Command shipping- finish off first queue entry and do dma mapping and
2129 * additional segments as needed.
2130 *
2007 * Called with the first queue entry at least partially filled out.
2131 * Called with the first queue entry mostly filled out.
2132 * Our job here is to finish that and add additional data
2133 * segments if needed.
2134 *
2135 * We used to do synthetic entries to split data and status
2136 * at this level, but that started getting too tricky.
2008 */
2009int
2010isp_send_tgt_cmd(ispsoftc_t *isp, void *fqe, void *segp, uint32_t nsegs, uint32_t totalcnt, isp_ddir_t ddir, void *snsptr, uint32_t snslen)
2011{
2137 */
2138int
2139isp_send_tgt_cmd(ispsoftc_t *isp, void *fqe, void *segp, uint32_t nsegs, uint32_t totalcnt, isp_ddir_t ddir, void *snsptr, uint32_t snslen)
2140{
2012 uint8_t storage[QENTRY_LEN], storage2[QENTRY_LEN];
2141 uint8_t storage[QENTRY_LEN];
2013 uint8_t type, nqe;
2014 uint32_t seg, curseg, seglim, nxt, nxtnxt;
2015 ispds_t *dsp = NULL;
2016 ispds64_t *dsp64 = NULL;
2142 uint8_t type, nqe;
2143 uint32_t seg, curseg, seglim, nxt, nxtnxt;
2144 ispds_t *dsp = NULL;
2145 ispds64_t *dsp64 = NULL;
2017 void *qe0, *qe1, *sqe = NULL;
2146 void *qe0, *qe1;
2018
2019 qe0 = isp_getrqentry(isp);
2020 if (qe0 == NULL) {
2021 return (CMD_EAGAIN);
2022 }
2023 nxt = ISP_NXT_QENTRY(isp->isp_reqidx, RQUEST_QUEUE_LEN(isp));
2024
2025 type = ((isphdr_t *)fqe)->rqs_entry_type;
2026 nqe = 1;
2027 seglim = 0;
2028
2029 /*
2147
2148 qe0 = isp_getrqentry(isp);
2149 if (qe0 == NULL) {
2150 return (CMD_EAGAIN);
2151 }
2152 nxt = ISP_NXT_QENTRY(isp->isp_reqidx, RQUEST_QUEUE_LEN(isp));
2153
2154 type = ((isphdr_t *)fqe)->rqs_entry_type;
2155 nqe = 1;
2156 seglim = 0;
2157
2158 /*
2030 * If we have no data to transmit, just copy the first IOCB and start it up.
2159 * If we have data to transmit, figure out how many segments can fit into the first entry.
2031 */
2032 if (ddir != ISP_NOXFR) {
2033 /*
2034 * First, figure out how many pieces of data to transfer and what kind and how many we can put into the first queue entry.
2035 */
2036 switch (type) {
2037 case RQSTYPE_CTIO:
2038 dsp = ((ct_entry_t *)fqe)->ct_dataseg;
2039 seglim = ISP_RQDSEG;
2040 break;
2041 case RQSTYPE_CTIO2:
2160 */
2161 if (ddir != ISP_NOXFR) {
2162 /*
2163 * First, figure out how many pieces of data to transfer and what kind and how many we can put into the first queue entry.
2164 */
2165 switch (type) {
2166 case RQSTYPE_CTIO:
2167 dsp = ((ct_entry_t *)fqe)->ct_dataseg;
2168 seglim = ISP_RQDSEG;
2169 break;
2170 case RQSTYPE_CTIO2:
2171 dsp = ((ct2_entry_t *)fqe)->rsp.m0.u.ct_dataseg;
2172 seglim = ISP_RQDSEG_T2;
2173 break;
2042 case RQSTYPE_CTIO3:
2174 case RQSTYPE_CTIO3:
2043 {
2044 ct2_entry_t *ct = fqe, *ct2 = (ct2_entry_t *) storage2;
2045 uint16_t swd = ct->rsp.m0.ct_scsi_status & 0xff;
2046
2047 if ((ct->ct_flags & CT2_SENDSTATUS) && (swd || ct->ct_resid)) {
2048 memcpy(ct2, ct, QENTRY_LEN);
2049 /*
2050 * Clear fields from first CTIO2 that now need to be cleared
2051 */
2052 ct->ct_header.rqs_seqno = 0;
2053 ct->ct_flags &= ~(CT2_SENDSTATUS|CT2_CCINCR|CT2_FASTPOST);
2054 ct->ct_resid = 0;
2055 ct->ct_syshandle = 0;
2056 ct->rsp.m0.ct_scsi_status = 0;
2057
2058 /*
2059 * Reset fields in the second CTIO2 as appropriate.
2060 */
2061 ct2->ct_flags &= ~(CT2_FLAG_MMASK|CT2_DATAMASK|CT2_FASTPOST);
2062 ct2->ct_flags |= CT2_NO_DATA|CT2_FLAG_MODE1;
2063 ct2->ct_seg_count = 0;
2064 ct2->ct_reloff = 0;
2065 memset(&ct2->rsp, 0, sizeof (ct2->rsp));
2066 if (swd == SCSI_CHECK && snsptr && snslen) {
2067 ct2->rsp.m1.ct_senselen = min(snslen, MAXRESPLEN);
2068 memcpy(ct2->rsp.m1.ct_resp, snsptr, ct2->rsp.m1.ct_senselen);
2069 swd |= CT2_SNSLEN_VALID;
2070 }
2071 if (ct2->ct_resid > 0) {
2072 swd |= CT2_DATA_UNDER;
2073 } else if (ct2->ct_resid < 0) {
2074 swd |= CT2_DATA_OVER;
2075 }
2076 ct2->rsp.m1.ct_scsi_status = swd;
2077 sqe = storage2;
2078 }
2079 if (type == RQSTYPE_CTIO2) {
2080 dsp = ct->rsp.m0.u.ct_dataseg;
2081 seglim = ISP_RQDSEG_T2;
2082 } else {
2083 dsp64 = ct->rsp.m0.u.ct_dataseg64;
2084 seglim = ISP_RQDSEG_T3;
2085 }
2175 dsp64 = ((ct2_entry_t *)fqe)->rsp.m0.u.ct_dataseg64;
2176 seglim = ISP_RQDSEG_T3;
2086 break;
2177 break;
2087 }
2088 case RQSTYPE_CTIO7:
2178 case RQSTYPE_CTIO7:
2089 {
2090 ct7_entry_t *ct = fqe, *ct2 = (ct7_entry_t *)storage2;
2091 uint16_t swd = ct->ct_scsi_status & 0xff;
2092
2093 dsp64 = &ct->rsp.m0.ds;
2179 dsp64 = &((ct7_entry_t *)fqe)->rsp.m0.ds;
2094 seglim = 1;
2180 seglim = 1;
2095 if ((ct->ct_flags & CT7_SENDSTATUS) && (swd || ct->ct_resid)) {
2096 memcpy(ct2, ct, sizeof (ct7_entry_t));
2097
2098 /*
2099 * Clear fields from first CTIO7 that now need to be cleared
2100 */
2101 ct->ct_header.rqs_seqno = 0;
2102 ct->ct_flags &= ~CT7_SENDSTATUS;
2103 ct->ct_resid = 0;
2104 ct->ct_syshandle = 0;
2105 ct->ct_scsi_status = 0;
2106
2107 /*
2108 * Reset fields in the second CTIO7 as appropriate.
2109 */
2110 ct2->ct_flags &= ~(CT7_FLAG_MMASK|CT7_DATAMASK);
2111 ct2->ct_flags |= CT7_NO_DATA|CT7_NO_DATA|CT7_FLAG_MODE1;
2112 ct2->ct_seg_count = 0;
2113 memset(&ct2->rsp, 0, sizeof (ct2->rsp));
2114 if (swd == SCSI_CHECK && snsptr && snslen) {
2115 ct2->rsp.m1.ct_resplen = min(snslen, MAXRESPLEN_24XX);
2116 memcpy(ct2->rsp.m1.ct_resp, snsptr, ct2->rsp.m1.ct_resplen);
2117 swd |= (FCP_SNSLEN_VALID << 8);
2118 }
2119 if (ct2->ct_resid < 0) {
2120 swd |= (FCP_RESID_OVERFLOW << 8);
2121 } else if (ct2->ct_resid > 0) {
2122 swd |= (FCP_RESID_UNDERFLOW << 8);
2123 }
2124 ct2->ct_scsi_status = swd;
2125 sqe = storage2;
2126 }
2127 break;
2181 break;
2128 }
2129 default:
2130 return (CMD_COMPLETE);
2131 }
2132 }
2133
2134 /*
2182 default:
2183 return (CMD_COMPLETE);
2184 }
2185 }
2186
2187 /*
2135 * Fill out the data transfer stuff in the first queue entry
2188 * First, fill out any of the data transfer stuff that fits
2189 * in the first queue entry.
2136 */
2137 if (seglim > nsegs) {
2138 seglim = nsegs;
2139 }
2140
2141 for (seg = curseg = 0; curseg < seglim; curseg++) {
2142 if (dsp64) {
2143 XS_GET_DMA64_SEG(dsp64++, segp, seg++);
2144 } else {
2145 XS_GET_DMA_SEG(dsp++, segp, seg++);
2146 }
2147 }
2148
2149 /*
2190 */
2191 if (seglim > nsegs) {
2192 seglim = nsegs;
2193 }
2194
2195 for (seg = curseg = 0; curseg < seglim; curseg++) {
2196 if (dsp64) {
2197 XS_GET_DMA64_SEG(dsp64++, segp, seg++);
2198 } else {
2199 XS_GET_DMA_SEG(dsp++, segp, seg++);
2200 }
2201 }
2202
2203 /*
2150 * First, if we are sending status with data and we have a non-zero
2151 * status or non-zero residual, we have to make a synthetic extra CTIO
2152 * that contains the status that we'll ship separately (FC cards only).
2153 */
2154
2155 /*
2156 * Second, start building additional continuation segments as needed.
2157 */
2158 while (seg < nsegs) {
2159 nxtnxt = ISP_NXT_QENTRY(nxt, RQUEST_QUEUE_LEN(isp));
2160 if (nxtnxt == isp->isp_reqodx) {
2161 return (CMD_EAGAIN);
2162 }
2163 ISP_MEMZERO(storage, QENTRY_LEN);

--- 29 unchanged lines hidden (view full) ---

2193 }
2194 if (isp->isp_dblev & ISP_LOGTDEBUG1) {
2195 isp_print_bytes(isp, "additional queue entry", QENTRY_LEN, storage);
2196 }
2197 nqe++;
2198 }
2199
2200 /*
2204 * Second, start building additional continuation segments as needed.
2205 */
2206 while (seg < nsegs) {
2207 nxtnxt = ISP_NXT_QENTRY(nxt, RQUEST_QUEUE_LEN(isp));
2208 if (nxtnxt == isp->isp_reqodx) {
2209 return (CMD_EAGAIN);
2210 }
2211 ISP_MEMZERO(storage, QENTRY_LEN);

--- 29 unchanged lines hidden (view full) ---

2241 }
2242 if (isp->isp_dblev & ISP_LOGTDEBUG1) {
2243 isp_print_bytes(isp, "additional queue entry", QENTRY_LEN, storage);
2244 }
2245 nqe++;
2246 }
2247
2248 /*
2201 * If we have a synthetic queue entry to complete things, do it here.
2249 * Third, not patch up the first queue entry with the number of segments
2250 * we actually are going to be transmitting. At the same time, handle
2251 * any mode 2 requests.
2202 */
2252 */
2203 if (sqe) {
2204 nxtnxt = ISP_NXT_QENTRY(nxt, RQUEST_QUEUE_LEN(isp));
2205 if (nxtnxt == isp->isp_reqodx) {
2206 return (CMD_EAGAIN);
2207 }
2208 qe1 = ISP_QUEUE_ENTRY(isp->isp_rquest, nxt);
2209 nxt = nxtnxt;
2210 if (type == RQSTYPE_CTIO7) {
2211 isp_put_ctio7(isp, sqe, qe1);
2212 } else {
2213 isp_put_ctio2(isp, sqe, qe1);
2214 }
2215 if (isp->isp_dblev & ISP_LOGTDEBUG1) {
2216 isp_print_bytes(isp, "synthetic final queue entry", QENTRY_LEN, storage2);
2217 }
2218 }
2219
2220 ((isphdr_t *)fqe)->rqs_entry_count = nqe;
2221 switch (type) {
2222 case RQSTYPE_CTIO:
2223 ((ct_entry_t *)fqe)->ct_seg_count = nsegs;
2224 isp_put_ctio(isp, fqe, qe0);
2225 break;
2226 case RQSTYPE_CTIO2:
2227 case RQSTYPE_CTIO3:
2253 ((isphdr_t *)fqe)->rqs_entry_count = nqe;
2254 switch (type) {
2255 case RQSTYPE_CTIO:
2256 ((ct_entry_t *)fqe)->ct_seg_count = nsegs;
2257 isp_put_ctio(isp, fqe, qe0);
2258 break;
2259 case RQSTYPE_CTIO2:
2260 case RQSTYPE_CTIO3:
2228 ((ct2_entry_t *)fqe)->ct_seg_count = nsegs;
2261 if (((ct2_entry_t *)fqe)->ct_flags & CT2_FLAG_MODE2) {
2262 ((ct2_entry_t *)fqe)->ct_seg_count = 1;
2263 } else {
2264 ((ct2_entry_t *)fqe)->ct_seg_count = nsegs;
2265 }
2229 if (ISP_CAP_2KLOGIN(isp)) {
2230 isp_put_ctio2e(isp, fqe, qe0);
2231 } else {
2232 isp_put_ctio2(isp, fqe, qe0);
2233 }
2234 break;
2235 case RQSTYPE_CTIO7:
2266 if (ISP_CAP_2KLOGIN(isp)) {
2267 isp_put_ctio2e(isp, fqe, qe0);
2268 } else {
2269 isp_put_ctio2(isp, fqe, qe0);
2270 }
2271 break;
2272 case RQSTYPE_CTIO7:
2236 ((ct7_entry_t *)fqe)->ct_seg_count = nsegs;
2273 if (((ct7_entry_t *)fqe)->ct_flags & CT7_FLAG_MODE2) {
2274 ((ct7_entry_t *)fqe)->ct_seg_count = 1;
2275 } else {
2276 ((ct7_entry_t *)fqe)->ct_seg_count = nsegs;
2277 }
2237 isp_put_ctio7(isp, fqe, qe0);
2238 break;
2239 default:
2240 return (CMD_COMPLETE);
2241 }
2242 if (isp->isp_dblev & ISP_LOGTDEBUG1) {
2243 isp_print_bytes(isp, "first queue entry", QENTRY_LEN, fqe);
2244 }

--- 155 unchanged lines hidden (view full) ---

2400 }
2401 }
2402}
2403
2404/*
2405 * Add an initiator device to the port database
2406 */
2407void
2278 isp_put_ctio7(isp, fqe, qe0);
2279 break;
2280 default:
2281 return (CMD_COMPLETE);
2282 }
2283 if (isp->isp_dblev & ISP_LOGTDEBUG1) {
2284 isp_print_bytes(isp, "first queue entry", QENTRY_LEN, fqe);
2285 }

--- 155 unchanged lines hidden (view full) ---

2441 }
2442 }
2443}
2444
2445/*
2446 * Add an initiator device to the port database
2447 */
2448void
2408isp_add_wwn_entry(ispsoftc_t *isp, int chan, uint64_t ini, uint16_t nphdl, uint32_t s_id)
2449isp_add_wwn_entry(ispsoftc_t *isp, int chan, uint64_t ini, uint16_t nphdl, uint32_t s_id, uint16_t prli_params)
2409{
2450{
2451 char buf[64];
2410 fcparam *fcp;
2411 fcportdb_t *lp;
2412 isp_notify_t nt;
2413 int i;
2414
2415 fcp = FCPARAM(isp, chan);
2416
2417 if (nphdl >= MAX_NPORT_HANDLE) {
2452 fcparam *fcp;
2453 fcportdb_t *lp;
2454 isp_notify_t nt;
2455 int i;
2456
2457 fcp = FCPARAM(isp, chan);
2458
2459 if (nphdl >= MAX_NPORT_HANDLE) {
2418 isp_prt(isp, ISP_LOGWARN, "%s: Chan %d IID 0x%016llx bad N-Port handle 0x%04x Port ID 0x%06x",
2419 __func__, chan, (unsigned long long) ini, nphdl, s_id);
2460 isp_prt(isp, ISP_LOGWARN, "Chan %d IID 0x%016llx bad N-Port handle 0x%04x Port ID 0x%06x",
2461 chan, (unsigned long long) ini, nphdl, s_id);
2420 return;
2421 }
2422
2423 lp = NULL;
2424 if (fcp->isp_tgt_map[nphdl]) {
2425 lp = &fcp->portdb[fcp->isp_tgt_map[nphdl] - 1];
2426 } else {
2427 /*

--- 18 unchanged lines hidden (view full) ---

2446 lp = NULL;
2447 }
2448
2449 }
2450
2451 if (lp) {
2452 int something = 0;
2453 if (lp->handle != nphdl) {
2462 return;
2463 }
2464
2465 lp = NULL;
2466 if (fcp->isp_tgt_map[nphdl]) {
2467 lp = &fcp->portdb[fcp->isp_tgt_map[nphdl] - 1];
2468 } else {
2469 /*

--- 18 unchanged lines hidden (view full) ---

2488 lp = NULL;
2489 }
2490
2491 }
2492
2493 if (lp) {
2494 int something = 0;
2495 if (lp->handle != nphdl) {
2454 isp_prt(isp, ISP_LOGWARN, "%s: Chan %d attempt to re-enter N-port handle 0x%04x IID 0x%016llx Port ID 0x%06x finds IID 0x%016llx N-Port Handle 0x%04x Port ID 0x%06x",
2455 __func__, chan, nphdl, (unsigned long long)ini, s_id, (unsigned long long) lp->port_wwn, lp->handle, lp->portid);
2496 isp_prt(isp, ISP_LOGWARN, "Chan %d attempt to re-enter N-port handle 0x%04x IID 0x%016llx Port ID 0x%06x finds IID 0x%016llx N-Port Handle 0x%04x Port ID 0x%06x",
2497 chan, nphdl, (unsigned long long)ini, s_id, (unsigned long long) lp->port_wwn, lp->handle, lp->portid);
2456 isp_dump_portdb(isp, chan);
2457 return;
2458 }
2459 if (s_id != PORT_NONE) {
2460 if (lp->portid == PORT_NONE) {
2461 lp->portid = s_id;
2498 isp_dump_portdb(isp, chan);
2499 return;
2500 }
2501 if (s_id != PORT_NONE) {
2502 if (lp->portid == PORT_NONE) {
2503 lp->portid = s_id;
2462 isp_prt(isp, ISP_LOGTINFO, "%s: Chan %d N-port handle 0x%04x gets Port ID 0x%06x", __func__, chan, nphdl, s_id);
2504 isp_prt(isp, ISP_LOGTINFO, "Chan %d N-port handle 0x%04x gets Port ID 0x%06x", chan, nphdl, s_id);
2463 something++;
2464 } else if (lp->portid != s_id) {
2505 something++;
2506 } else if (lp->portid != s_id) {
2465 isp_prt(isp, ISP_LOGTINFO, "%s: Chan %d N-port handle 0x%04x tries to change Port ID 0x%06x to 0x%06x", __func__, chan, nphdl,
2466 lp->portid, s_id);
2507 isp_prt(isp, ISP_LOGTINFO, "Chan %d N-port handle 0x%04x tries to change Port ID 0x%06x to 0x%06x", chan, nphdl, lp->portid, s_id);
2467 isp_dump_portdb(isp, chan);
2468 return;
2469 }
2470 }
2471 if (VALID_INI(ini)) {
2472 if (!VALID_INI(lp->port_wwn)) {
2473 lp->port_wwn = ini;
2508 isp_dump_portdb(isp, chan);
2509 return;
2510 }
2511 }
2512 if (VALID_INI(ini)) {
2513 if (!VALID_INI(lp->port_wwn)) {
2514 lp->port_wwn = ini;
2474 isp_prt(isp, ISP_LOGTINFO, "%s: Chan %d N-port handle 0x%04x gets WWN 0x%016llxx", __func__, chan, nphdl, (unsigned long long) ini);
2515 isp_prt(isp, ISP_LOGTINFO, "Chan %d N-port handle 0x%04x gets WWN 0x%016llxx", chan, nphdl, (unsigned long long) ini);
2475 something++;
2476 } else if (lp->port_wwn != ini) {
2516 something++;
2517 } else if (lp->port_wwn != ini) {
2477 isp_prt(isp, ISP_LOGWARN, "%s: Chan %d N-port handle 0x%04x tries to change WWN 0x%016llx to 0x%016llx", __func__, chan, nphdl,
2518 isp_prt(isp, ISP_LOGWARN, "Chan %d N-port handle 0x%04x tries to change WWN 0x%016llx to 0x%016llx", chan, nphdl,
2478 (unsigned long long) lp->port_wwn, (unsigned long long) ini);
2479 isp_dump_portdb(isp, chan);
2480 return;
2481 }
2482 }
2519 (unsigned long long) lp->port_wwn, (unsigned long long) ini);
2520 isp_dump_portdb(isp, chan);
2521 return;
2522 }
2523 }
2483
2524 if (prli_params != lp->prli_word3) {
2525 lp->prli_word3 = prli_params;
2526 isp_gen_role_str(buf, sizeof (buf), lp->prli_word3);
2527 isp_prt(isp, ISP_LOGTINFO|ISP_LOGCONFIG, "Chan %d IID 0x%016llx N-Port Handle 0x%04x Port ID 0x%06x new PRLI Word 3 params %s", chan,
2528 (unsigned long long) lp->port_wwn, lp->handle, lp->portid, buf);
2529 something++;
2530 }
2484 if (!something) {
2531 if (!something) {
2485 isp_prt(isp, ISP_LOGWARN, "%s: Chan %d IID 0x%016llx N-Port Handle 0x%04x Port ID 0x%06x reentered", __func__, chan,
2532 isp_prt(isp, ISP_LOGWARN, "Chan %d IID 0x%016llx N-Port Handle 0x%04x Port ID 0x%06x reentered", chan,
2486 (unsigned long long) lp->port_wwn, lp->handle, lp->portid);
2487 }
2488 return;
2489 }
2490
2491 /*
2492 * Find a new spot
2493 */
2494 for (i = MAX_FC_TARG - 1; i >= 0; i--) {
2495 if (fcp->portdb[i].target_mode == 1) {
2496 continue;
2497 }
2498 if (fcp->portdb[i].state == FC_PORTDB_STATE_NIL) {
2499 break;
2500 }
2501 }
2502 if (i < 0) {
2533 (unsigned long long) lp->port_wwn, lp->handle, lp->portid);
2534 }
2535 return;
2536 }
2537
2538 /*
2539 * Find a new spot
2540 */
2541 for (i = MAX_FC_TARG - 1; i >= 0; i--) {
2542 if (fcp->portdb[i].target_mode == 1) {
2543 continue;
2544 }
2545 if (fcp->portdb[i].state == FC_PORTDB_STATE_NIL) {
2546 break;
2547 }
2548 }
2549 if (i < 0) {
2503 isp_prt(isp, ISP_LOGWARN, "%s: Chan %d IID 0x%016llx N-Port Handle 0x%04x Port ID 0x%06x- no room in port database",
2504 __func__, chan, (unsigned long long) ini, nphdl, s_id);
2550 isp_prt(isp, ISP_LOGWARN, "Chan %d IID 0x%016llx N-Port Handle 0x%04x Port ID 0x%06x- no room in port database",
2551 chan, (unsigned long long) ini, nphdl, s_id);
2505 return;
2506 }
2507
2508 lp = &fcp->portdb[i];
2509 ISP_MEMZERO(lp, sizeof (fcportdb_t));
2510 lp->target_mode = 1;
2511 lp->handle = nphdl;
2512 lp->portid = s_id;
2513 lp->port_wwn = ini;
2552 return;
2553 }
2554
2555 lp = &fcp->portdb[i];
2556 ISP_MEMZERO(lp, sizeof (fcportdb_t));
2557 lp->target_mode = 1;
2558 lp->handle = nphdl;
2559 lp->portid = s_id;
2560 lp->port_wwn = ini;
2561 lp->prli_word3 = prli_params;
2562 isp_gen_role_str(buf, sizeof (buf), lp->prli_word3);
2514 fcp->isp_tgt_map[nphdl] = i + 1;
2515
2563 fcp->isp_tgt_map[nphdl] = i + 1;
2564
2516 isp_prt(isp, ISP_LOGTINFO, "%s: Chan %d IID 0x%016llx N-Port Handle 0x%04x Port ID 0x%06x vtgt %d added", __func__, chan, (unsigned long long) ini, nphdl, s_id, fcp->isp_tgt_map[nphdl] - 1);
2565 isp_prt(isp, ISP_LOGTINFO, "Chan %d IID 0x%016llx N-Port Handle 0x%04x Port ID 0x%06x vtgt %d %s added", chan,
2566 (unsigned long long) ini, nphdl, s_id, fcp->isp_tgt_map[nphdl] - 1, buf);
2517
2518 ISP_MEMZERO(&nt, sizeof (nt));
2519 nt.nt_hba = isp;
2520 nt.nt_wwn = ini;
2521 nt.nt_tgt = FCPARAM(isp, chan)->isp_wwpn;
2522 nt.nt_sid = s_id;
2523 nt.nt_did = FCPARAM(isp, chan)->isp_portid;
2524 nt.nt_nphdl = nphdl;

--- 8 unchanged lines hidden (view full) ---

2533void
2534isp_del_wwn_entry(ispsoftc_t *isp, int chan, uint64_t ini, uint16_t nphdl, uint32_t s_id)
2535{
2536 fcparam *fcp;
2537 isp_notify_t nt;
2538 fcportdb_t *lp;
2539
2540 if (nphdl >= MAX_NPORT_HANDLE) {
2567
2568 ISP_MEMZERO(&nt, sizeof (nt));
2569 nt.nt_hba = isp;
2570 nt.nt_wwn = ini;
2571 nt.nt_tgt = FCPARAM(isp, chan)->isp_wwpn;
2572 nt.nt_sid = s_id;
2573 nt.nt_did = FCPARAM(isp, chan)->isp_portid;
2574 nt.nt_nphdl = nphdl;

--- 8 unchanged lines hidden (view full) ---

2583void
2584isp_del_wwn_entry(ispsoftc_t *isp, int chan, uint64_t ini, uint16_t nphdl, uint32_t s_id)
2585{
2586 fcparam *fcp;
2587 isp_notify_t nt;
2588 fcportdb_t *lp;
2589
2590 if (nphdl >= MAX_NPORT_HANDLE) {
2541 isp_prt(isp, ISP_LOGWARN, "%s: Chan %d IID 0x%016llx bad N-Port handle 0x%04x Port ID 0x%06x",
2542 __func__, chan, (unsigned long long) ini, nphdl, s_id);
2591 isp_prt(isp, ISP_LOGWARN, "Chan %d IID 0x%016llx bad N-Port handle 0x%04x Port ID 0x%06x",
2592 chan, (unsigned long long) ini, nphdl, s_id);
2543 return;
2544 }
2545
2546 fcp = FCPARAM(isp, chan);
2547 if (fcp->isp_tgt_map[nphdl] == 0) {
2548 lp = NULL;
2549 } else {
2550 lp = &fcp->portdb[fcp->isp_tgt_map[nphdl] - 1];
2551 if (lp->target_mode == 0) {
2552 lp = NULL;
2553 }
2554 }
2555 if (lp == NULL) {
2593 return;
2594 }
2595
2596 fcp = FCPARAM(isp, chan);
2597 if (fcp->isp_tgt_map[nphdl] == 0) {
2598 lp = NULL;
2599 } else {
2600 lp = &fcp->portdb[fcp->isp_tgt_map[nphdl] - 1];
2601 if (lp->target_mode == 0) {
2602 lp = NULL;
2603 }
2604 }
2605 if (lp == NULL) {
2556 isp_prt(isp, ISP_LOGWARN, "%s: Chan %d IID 0x%016llx N-Port Handle 0x%04x Port ID 0x%06x cannot be found to be cleared",
2557 __func__, chan, (unsigned long long) ini, nphdl, s_id);
2606 isp_prt(isp, ISP_LOGWARN, "Chan %d IID 0x%016llx N-Port Handle 0x%04x Port ID 0x%06x cannot be found to be cleared",
2607 chan, (unsigned long long) ini, nphdl, s_id);
2558 isp_dump_portdb(isp, chan);
2559 return;
2560 }
2608 isp_dump_portdb(isp, chan);
2609 return;
2610 }
2561 isp_prt(isp, ISP_LOGTINFO, "%s: Chan %d IID 0x%016llx N-Port Handle 0x%04x Port ID 0x%06x vtgt %d cleared",
2562 __func__, chan, (unsigned long long) lp->port_wwn, nphdl, lp->portid, fcp->isp_tgt_map[nphdl] - 1);
2611 isp_prt(isp, ISP_LOGTINFO, "Chan %d IID 0x%016llx N-Port Handle 0x%04x Port ID 0x%06x vtgt %d cleared",
2612 chan, (unsigned long long) lp->port_wwn, nphdl, lp->portid, fcp->isp_tgt_map[nphdl] - 1);
2563 fcp->isp_tgt_map[nphdl] = 0;
2564
2565 ISP_MEMZERO(&nt, sizeof (nt));
2566 nt.nt_hba = isp;
2567 nt.nt_wwn = lp->port_wwn;
2568 nt.nt_tgt = FCPARAM(isp, chan)->isp_wwpn;
2569 nt.nt_sid = lp->portid;
2570 nt.nt_did = FCPARAM(isp, chan)->isp_portid;

--- 74 unchanged lines hidden (view full) ---

2645 }
2646 }
2647 if (mp->nt_sid != PORT_ANY && mp->nt_sid != PORT_NONE) {
2648 if (isp_find_pdb_by_sid(isp, mp->nt_channel, mp->nt_sid, &lp)) {
2649 isp_del_wwn_entry(isp, mp->nt_channel, lp->port_wwn, lp->handle, lp->portid);
2650 return;
2651 }
2652 }
2613 fcp->isp_tgt_map[nphdl] = 0;
2614
2615 ISP_MEMZERO(&nt, sizeof (nt));
2616 nt.nt_hba = isp;
2617 nt.nt_wwn = lp->port_wwn;
2618 nt.nt_tgt = FCPARAM(isp, chan)->isp_wwpn;
2619 nt.nt_sid = lp->portid;
2620 nt.nt_did = FCPARAM(isp, chan)->isp_portid;

--- 74 unchanged lines hidden (view full) ---

2695 }
2696 }
2697 if (mp->nt_sid != PORT_ANY && mp->nt_sid != PORT_NONE) {
2698 if (isp_find_pdb_by_sid(isp, mp->nt_channel, mp->nt_sid, &lp)) {
2699 isp_del_wwn_entry(isp, mp->nt_channel, lp->port_wwn, lp->handle, lp->portid);
2700 return;
2701 }
2702 }
2653 isp_prt(isp, ISP_LOGWARN, "%s: Chan %d unable to find entry to delete N-port handle 0x%04x initiator WWN 0x%016llx Port ID 0x%06x", __func__,
2703 isp_prt(isp, ISP_LOGWARN, "Chan %d unable to find entry to delete N-port handle 0x%04x initiator WWN 0x%016llx Port ID 0x%06x",
2654 mp->nt_channel, mp->nt_nphdl, (unsigned long long) mp->nt_wwn, mp->nt_sid);
2655}
2656
2657void
2658isp_put_atio(ispsoftc_t *isp, at_entry_t *src, at_entry_t *dst)
2659{
2660 int i;
2661 isp_put_hdr(isp, &src->at_header, &dst->at_header);

--- 306 unchanged lines hidden (view full) ---

2968 for (i = 0; i < MAXRESPLEN; i++) {
2969 ISP_IOXPUT_8(isp, src->rsp.m1.ct_resp[i], &dst->rsp.m1.ct_resp[i]);
2970 }
2971 } else {
2972 ISP_IOXPUT_32(isp, src->rsp.m2._reserved, &dst->rsp.m2._reserved);
2973 ISP_IOXPUT_16(isp, src->rsp.m2._reserved2, &dst->rsp.m2._reserved2);
2974 ISP_IOXPUT_16(isp, src->rsp.m2._reserved3, &dst->rsp.m2._reserved3);
2975 ISP_IOXPUT_32(isp, src->rsp.m2.ct_datalen, &dst->rsp.m2.ct_datalen);
2704 mp->nt_channel, mp->nt_nphdl, (unsigned long long) mp->nt_wwn, mp->nt_sid);
2705}
2706
2707void
2708isp_put_atio(ispsoftc_t *isp, at_entry_t *src, at_entry_t *dst)
2709{
2710 int i;
2711 isp_put_hdr(isp, &src->at_header, &dst->at_header);

--- 306 unchanged lines hidden (view full) ---

3018 for (i = 0; i < MAXRESPLEN; i++) {
3019 ISP_IOXPUT_8(isp, src->rsp.m1.ct_resp[i], &dst->rsp.m1.ct_resp[i]);
3020 }
3021 } else {
3022 ISP_IOXPUT_32(isp, src->rsp.m2._reserved, &dst->rsp.m2._reserved);
3023 ISP_IOXPUT_16(isp, src->rsp.m2._reserved2, &dst->rsp.m2._reserved2);
3024 ISP_IOXPUT_16(isp, src->rsp.m2._reserved3, &dst->rsp.m2._reserved3);
3025 ISP_IOXPUT_32(isp, src->rsp.m2.ct_datalen, &dst->rsp.m2.ct_datalen);
2976 ISP_IOXPUT_32(isp, src->rsp.m2.ct_fcp_rsp_iudata.ds_base, &dst->rsp.m2.ct_fcp_rsp_iudata.ds_base);
2977 ISP_IOXPUT_32(isp, src->rsp.m2.ct_fcp_rsp_iudata.ds_count, &dst->rsp.m2.ct_fcp_rsp_iudata.ds_count);
3026 if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO2) {
3027 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);
3028 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);
3029 } else {
3030 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);
3031 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);
3032 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);
3033 }
2978 }
2979}
2980
2981void
2982isp_put_ctio2e(ispsoftc_t *isp, ct2e_entry_t *src, ct2e_entry_t *dst)
2983{
2984 int i;
2985 isp_put_hdr(isp, &src->ct_header, &dst->ct_header);

--- 35 unchanged lines hidden (view full) ---

3021 for (i = 0; i < MAXRESPLEN; i++) {
3022 ISP_IOXPUT_8(isp, src->rsp.m1.ct_resp[i], &dst->rsp.m1.ct_resp[i]);
3023 }
3024 } else {
3025 ISP_IOXPUT_32(isp, src->rsp.m2._reserved, &dst->rsp.m2._reserved);
3026 ISP_IOXPUT_16(isp, src->rsp.m2._reserved2, &dst->rsp.m2._reserved2);
3027 ISP_IOXPUT_16(isp, src->rsp.m2._reserved3, &dst->rsp.m2._reserved3);
3028 ISP_IOXPUT_32(isp, src->rsp.m2.ct_datalen, &dst->rsp.m2.ct_datalen);
3034 }
3035}
3036
3037void
3038isp_put_ctio2e(ispsoftc_t *isp, ct2e_entry_t *src, ct2e_entry_t *dst)
3039{
3040 int i;
3041 isp_put_hdr(isp, &src->ct_header, &dst->ct_header);

--- 35 unchanged lines hidden (view full) ---

3077 for (i = 0; i < MAXRESPLEN; i++) {
3078 ISP_IOXPUT_8(isp, src->rsp.m1.ct_resp[i], &dst->rsp.m1.ct_resp[i]);
3079 }
3080 } else {
3081 ISP_IOXPUT_32(isp, src->rsp.m2._reserved, &dst->rsp.m2._reserved);
3082 ISP_IOXPUT_16(isp, src->rsp.m2._reserved2, &dst->rsp.m2._reserved2);
3083 ISP_IOXPUT_16(isp, src->rsp.m2._reserved3, &dst->rsp.m2._reserved3);
3084 ISP_IOXPUT_32(isp, src->rsp.m2.ct_datalen, &dst->rsp.m2.ct_datalen);
3029 ISP_IOXPUT_32(isp, src->rsp.m2.ct_fcp_rsp_iudata.ds_base, &dst->rsp.m2.ct_fcp_rsp_iudata.ds_base);
3030 ISP_IOXPUT_32(isp, src->rsp.m2.ct_fcp_rsp_iudata.ds_count, &dst->rsp.m2.ct_fcp_rsp_iudata.ds_count);
3085 if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO2) {
3086 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);
3087 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);
3088 } else {
3089 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);
3090 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);
3091 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);
3092 }
3031 }
3032}
3033
3034void
3035isp_put_ctio7(ispsoftc_t *isp, ct7_entry_t *src, ct7_entry_t *dst)
3036{
3037 int i;
3038

--- 28 unchanged lines hidden (view full) ---

3067 ISP_IOXPUT_16(isp, src->rsp.m1.reserved, &dst->rsp.m1.reserved);
3068 a = (uint32_t *) src->rsp.m1.ct_resp;
3069 b = (uint32_t *) dst->rsp.m1.ct_resp;
3070 for (i = 0; i < (ASIZE(src->rsp.m1.ct_resp) >> 2); i++) {
3071 *b++ = ISP_SWAP32(isp, *a++);
3072 }
3073 } else {
3074 ISP_IOXPUT_32(isp, src->rsp.m2.reserved0, &dst->rsp.m2.reserved0);
3093 }
3094}
3095
3096void
3097isp_put_ctio7(ispsoftc_t *isp, ct7_entry_t *src, ct7_entry_t *dst)
3098{
3099 int i;
3100

--- 28 unchanged lines hidden (view full) ---

3129 ISP_IOXPUT_16(isp, src->rsp.m1.reserved, &dst->rsp.m1.reserved);
3130 a = (uint32_t *) src->rsp.m1.ct_resp;
3131 b = (uint32_t *) dst->rsp.m1.ct_resp;
3132 for (i = 0; i < (ASIZE(src->rsp.m1.ct_resp) >> 2); i++) {
3133 *b++ = ISP_SWAP32(isp, *a++);
3134 }
3135 } else {
3136 ISP_IOXPUT_32(isp, src->rsp.m2.reserved0, &dst->rsp.m2.reserved0);
3075 ISP_IOXPUT_32(isp, src->rsp.m2.ct_datalen, &dst->rsp.m2.ct_datalen);
3076 ISP_IOXPUT_32(isp, src->rsp.m2.reserved1, &dst->rsp.m2.reserved1);
3137 ISP_IOXPUT_32(isp, src->rsp.m2.reserved1, &dst->rsp.m2.reserved1);
3138 ISP_IOXPUT_32(isp, src->rsp.m2.ct_datalen, &dst->rsp.m2.ct_datalen);
3139 ISP_IOXPUT_32(isp, src->rsp.m2.reserved2, &dst->rsp.m2.reserved2);
3077 ISP_IOXPUT_32(isp, src->rsp.m2.ct_fcp_rsp_iudata.ds_base, &dst->rsp.m2.ct_fcp_rsp_iudata.ds_base);
3078 ISP_IOXPUT_32(isp, src->rsp.m2.ct_fcp_rsp_iudata.ds_basehi, &dst->rsp.m2.ct_fcp_rsp_iudata.ds_basehi);
3079 ISP_IOXPUT_32(isp, src->rsp.m2.ct_fcp_rsp_iudata.ds_count, &dst->rsp.m2.ct_fcp_rsp_iudata.ds_count);
3080 }
3081}
3082
3083
3084void

--- 42 unchanged lines hidden (view full) ---

3127 for (i = 0; i < MAXRESPLEN; i++) {
3128 ISP_IOXGET_8(isp, &src->rsp.m1.ct_resp[i], dst->rsp.m1.ct_resp[i]);
3129 }
3130 } else {
3131 ISP_IOXGET_32(isp, &src->rsp.m2._reserved, dst->rsp.m2._reserved);
3132 ISP_IOXGET_16(isp, &src->rsp.m2._reserved2, dst->rsp.m2._reserved2);
3133 ISP_IOXGET_16(isp, &src->rsp.m2._reserved3, dst->rsp.m2._reserved3);
3134 ISP_IOXGET_32(isp, &src->rsp.m2.ct_datalen, dst->rsp.m2.ct_datalen);
3140 ISP_IOXPUT_32(isp, src->rsp.m2.ct_fcp_rsp_iudata.ds_base, &dst->rsp.m2.ct_fcp_rsp_iudata.ds_base);
3141 ISP_IOXPUT_32(isp, src->rsp.m2.ct_fcp_rsp_iudata.ds_basehi, &dst->rsp.m2.ct_fcp_rsp_iudata.ds_basehi);
3142 ISP_IOXPUT_32(isp, src->rsp.m2.ct_fcp_rsp_iudata.ds_count, &dst->rsp.m2.ct_fcp_rsp_iudata.ds_count);
3143 }
3144}
3145
3146
3147void

--- 42 unchanged lines hidden (view full) ---

3190 for (i = 0; i < MAXRESPLEN; i++) {
3191 ISP_IOXGET_8(isp, &src->rsp.m1.ct_resp[i], dst->rsp.m1.ct_resp[i]);
3192 }
3193 } else {
3194 ISP_IOXGET_32(isp, &src->rsp.m2._reserved, dst->rsp.m2._reserved);
3195 ISP_IOXGET_16(isp, &src->rsp.m2._reserved2, dst->rsp.m2._reserved2);
3196 ISP_IOXGET_16(isp, &src->rsp.m2._reserved3, dst->rsp.m2._reserved3);
3197 ISP_IOXGET_32(isp, &src->rsp.m2.ct_datalen, dst->rsp.m2.ct_datalen);
3135 ISP_IOXGET_32(isp, &src->rsp.m2.ct_fcp_rsp_iudata.ds_base, dst->rsp.m2.ct_fcp_rsp_iudata.ds_base);
3136 ISP_IOXGET_32(isp, &src->rsp.m2.ct_fcp_rsp_iudata.ds_count, dst->rsp.m2.ct_fcp_rsp_iudata.ds_count);
3198 if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO2) {
3199 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);
3200 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);
3201 } else {
3202 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);
3203 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);
3204 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);
3205 }
3137 }
3138}
3139
3140void
3141isp_get_ctio2e(ispsoftc_t *isp, ct2e_entry_t *src, ct2e_entry_t *dst)
3142{
3143 int i;
3144

--- 37 unchanged lines hidden (view full) ---

3182 for (i = 0; i < MAXRESPLEN; i++) {
3183 ISP_IOXGET_8(isp, &src->rsp.m1.ct_resp[i], dst->rsp.m1.ct_resp[i]);
3184 }
3185 } else {
3186 ISP_IOXGET_32(isp, &src->rsp.m2._reserved, dst->rsp.m2._reserved);
3187 ISP_IOXGET_16(isp, &src->rsp.m2._reserved2, dst->rsp.m2._reserved2);
3188 ISP_IOXGET_16(isp, &src->rsp.m2._reserved3, dst->rsp.m2._reserved3);
3189 ISP_IOXGET_32(isp, &src->rsp.m2.ct_datalen, dst->rsp.m2.ct_datalen);
3206 }
3207}
3208
3209void
3210isp_get_ctio2e(ispsoftc_t *isp, ct2e_entry_t *src, ct2e_entry_t *dst)
3211{
3212 int i;
3213

--- 37 unchanged lines hidden (view full) ---

3251 for (i = 0; i < MAXRESPLEN; i++) {
3252 ISP_IOXGET_8(isp, &src->rsp.m1.ct_resp[i], dst->rsp.m1.ct_resp[i]);
3253 }
3254 } else {
3255 ISP_IOXGET_32(isp, &src->rsp.m2._reserved, dst->rsp.m2._reserved);
3256 ISP_IOXGET_16(isp, &src->rsp.m2._reserved2, dst->rsp.m2._reserved2);
3257 ISP_IOXGET_16(isp, &src->rsp.m2._reserved3, dst->rsp.m2._reserved3);
3258 ISP_IOXGET_32(isp, &src->rsp.m2.ct_datalen, dst->rsp.m2.ct_datalen);
3190 ISP_IOXGET_32(isp, &src->rsp.m2.ct_fcp_rsp_iudata.ds_base, dst->rsp.m2.ct_fcp_rsp_iudata.ds_base);
3191 ISP_IOXGET_32(isp, &src->rsp.m2.ct_fcp_rsp_iudata.ds_count, dst->rsp.m2.ct_fcp_rsp_iudata.ds_count);
3259 if (src->ct_header.rqs_entry_type == RQSTYPE_CTIO2) {
3260 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);
3261 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);
3262 } else {
3263 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);
3264 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);
3265 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);
3266 }
3192 }
3193}
3194
3195void
3196isp_get_ctio7(ispsoftc_t *isp, ct7_entry_t *src, ct7_entry_t *dst)
3197{
3198 int i;
3199

--- 635 unchanged lines hidden ---
3267 }
3268}
3269
3270void
3271isp_get_ctio7(ispsoftc_t *isp, ct7_entry_t *src, ct7_entry_t *dst)
3272{
3273 int i;
3274

--- 635 unchanged lines hidden ---