Deleted Added
full compact
isp_target.c (204397) isp_target.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 *

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

36 * Include header file appropriate for platform we're building on.
37 */
38
39#ifdef __NetBSD__
40#include <dev/ic/isp_netbsd.h>
41#endif
42#ifdef __FreeBSD__
43#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 *

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

36 * Include header file appropriate for platform we're building on.
37 */
38
39#ifdef __NetBSD__
40#include <dev/ic/isp_netbsd.h>
41#endif
42#ifdef __FreeBSD__
43#include <sys/cdefs.h>
44__FBSDID("$FreeBSD: head/sys/dev/isp/isp_target.c 204397 2010-02-27 05:41:23Z mjacob $");
44__FBSDID("$FreeBSD: head/sys/dev/isp/isp_target.c 238869 2012-07-28 20:06:29Z mjacob $");
45#include <dev/isp/isp_freebsd.h>
46#endif
47#ifdef __OpenBSD__
48#include <dev/ic/isp_openbsd.h>
49#endif
50#ifdef __linux__
51#include "isp_linux.h"
52#endif

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

286 if (IS_FC(isp)) {
287 isp_got_msg_fc(isp, (in_fcentry_t *)local);
288 } else {
289 isp_got_msg(isp, (in_entry_t *)local);
290 }
291 break;
292 case IN_RSRC_UNAVAIL:
293 isp_prt(isp, ISP_LOGINFO, "Firmware out of ATIOs");
45#include <dev/isp/isp_freebsd.h>
46#endif
47#ifdef __OpenBSD__
48#include <dev/ic/isp_openbsd.h>
49#endif
50#ifdef __linux__
51#include "isp_linux.h"
52#endif

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

286 if (IS_FC(isp)) {
287 isp_got_msg_fc(isp, (in_fcentry_t *)local);
288 } else {
289 isp_got_msg(isp, (in_entry_t *)local);
290 }
291 break;
292 case IN_RSRC_UNAVAIL:
293 isp_prt(isp, ISP_LOGINFO, "Firmware out of ATIOs");
294 (void) isp_notify_ack(isp, local);
294 isp_async(isp, ISPASYNC_TARGET_NOTIFY_ACK, local);
295 break;
296
297 case IN_RESET:
298 ISP_MEMZERO(&notify, sizeof (isp_notify_t));
299 notify.nt_hba = isp;
300 notify.nt_wwn = INI_ANY;
301 notify.nt_tgt = TGT_ANY;
302 notify.nt_nphdl = iid;

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

341 isp_prt(isp, ISP_LOGTINFO, "%s: all ports logged out", __func__);
342 ISP_MEMZERO(&notify, sizeof (isp_notify_t));
343 notify.nt_hba = isp;
344 notify.nt_wwn = INI_ANY;
345 notify.nt_nphdl = NIL_HANDLE;
346 notify.nt_sid = PORT_ANY;
347 notify.nt_did = PORT_ANY;
348 notify.nt_ncode = NT_GLOBAL_LOGOUT;
295 break;
296
297 case IN_RESET:
298 ISP_MEMZERO(&notify, sizeof (isp_notify_t));
299 notify.nt_hba = isp;
300 notify.nt_wwn = INI_ANY;
301 notify.nt_tgt = TGT_ANY;
302 notify.nt_nphdl = iid;

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

341 isp_prt(isp, ISP_LOGTINFO, "%s: all ports logged out", __func__);
342 ISP_MEMZERO(&notify, sizeof (isp_notify_t));
343 notify.nt_hba = isp;
344 notify.nt_wwn = INI_ANY;
345 notify.nt_nphdl = NIL_HANDLE;
346 notify.nt_sid = PORT_ANY;
347 notify.nt_did = PORT_ANY;
348 notify.nt_ncode = NT_GLOBAL_LOGOUT;
349 notify.nt_need_ack = 1;
350 notify.nt_lreserved = local;
349 isp_async(isp, ISPASYNC_TARGET_NOTIFY, &notify);
351 isp_async(isp, ISPASYNC_TARGET_NOTIFY, &notify);
350 (void) isp_notify_ack(isp, local);
351 break;
352
353 case IN_PORT_CHANGED:
354 isp_prt(isp, ISP_LOGTINFO, "%s: port changed", __func__);
352 break;
353
354 case IN_PORT_CHANGED:
355 isp_prt(isp, ISP_LOGTINFO, "%s: port changed", __func__);
355 (void) isp_notify_ack(isp, local);
356 ISP_MEMZERO(&notify, sizeof (isp_notify_t));
357 notify.nt_hba = isp;
358 notify.nt_wwn = INI_ANY;
359 notify.nt_nphdl = NIL_HANDLE;
360 notify.nt_sid = PORT_ANY;
361 notify.nt_did = PORT_ANY;
362 notify.nt_ncode = NT_CHANGED;
363 notify.nt_need_ack = 1;
364 notify.nt_lreserved = local;
365 isp_async(isp, ISPASYNC_TARGET_NOTIFY, &notify);
356 break;
357
358 default:
359 ISP_SNPRINTF(local, sizeof local, "%s: unknown status to RQSTYPE_NOTIFY (0x%x)", __func__, status);
360 isp_print_bytes(isp, local, QENTRY_LEN, vptr);
366 break;
367
368 default:
369 ISP_SNPRINTF(local, sizeof local, "%s: unknown status to RQSTYPE_NOTIFY (0x%x)", __func__, status);
370 isp_print_bytes(isp, local, QENTRY_LEN, vptr);
361 (void) isp_notify_ack(isp, local);
371 isp_async(isp, ISPASYNC_TARGET_NOTIFY_ACK, local);
362 break;
363 }
364 break;
365
366 case RQSTYPE_NOTIFY_ACK:
367 /*
368 * The ISP is acknowledging our acknowledgement of an
369 * Immediate Notify entry for some asynchronous event.

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

461{
462 lun_entry_t el;
463 void *outp;
464
465 ISP_MEMZERO(&el, sizeof (el));
466 if (IS_DUALBUS(isp)) {
467 el.le_rsvd = (bus & 0x1) << 7;
468 }
372 break;
373 }
374 break;
375
376 case RQSTYPE_NOTIFY_ACK:
377 /*
378 * The ISP is acknowledging our acknowledgement of an
379 * Immediate Notify entry for some asynchronous event.

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

471{
472 lun_entry_t el;
473 void *outp;
474
475 ISP_MEMZERO(&el, sizeof (el));
476 if (IS_DUALBUS(isp)) {
477 el.le_rsvd = (bus & 0x1) << 7;
478 }
469 el.le_cmd_count = cmd_cnt;
470 el.le_in_count = inot_cnt;
479 el.le_cmd_count = (cmd_cnt < 0)? -cmd_cnt : cmd_cnt;
480 el.le_in_count = (inot_cnt < 0)? -inot_cnt : inot_cnt;
471 if (cmd == RQSTYPE_ENABLE_LUN) {
472 if (IS_SCSI(isp)) {
473 el.le_flags = LUN_TQAE|LUN_DISAD;
474 el.le_cdb6len = 12;
475 el.le_cdb7len = 12;
476 }
481 if (cmd == RQSTYPE_ENABLE_LUN) {
482 if (IS_SCSI(isp)) {
483 el.le_flags = LUN_TQAE|LUN_DISAD;
484 el.le_cdb6len = 12;
485 el.le_cdb7len = 12;
486 }
477 } else if (cmd == -RQSTYPE_ENABLE_LUN) {
478 cmd = RQSTYPE_ENABLE_LUN;
479 el.le_cmd_count = 0;
480 el.le_in_count = 0;
481 } else if (cmd == -RQSTYPE_MODIFY_LUN) {
482 cmd = RQSTYPE_MODIFY_LUN;
483 el.le_ops = LUN_CCDECR | LUN_INDECR;
487 } else if (cmd == RQSTYPE_MODIFY_LUN) {
488 if (cmd_cnt == 0 && inot_cnt == 0) {
489 isp_prt(isp, ISP_LOGWARN, "makes no sense to modify a lun with both command and immediate notify counts as zero");
490 return (0);
491 }
492 if (cmd_cnt < 0)
493 el.le_ops |= LUN_CCDECR;
494 else
495 el.le_ops |= LUN_CCINCR;
496 if (inot_cnt < 0)
497 el.le_ops |= LUN_INDECR;
498 else
499 el.le_ops |= LUN_ININCR;
484 } else {
500 } else {
485 el.le_ops = LUN_CCINCR | LUN_ININCR;
501 isp_prt(isp, ISP_LOGWARN, "unknown cmd (0x%x) in %s", cmd, __func__);
502 return (-1);
486 }
487 el.le_header.rqs_entry_type = cmd;
488 el.le_header.rqs_entry_count = 1;
489 if (IS_SCSI(isp)) {
490 el.le_tgt = SDPARAM(isp, bus)->isp_initiator_id;
491 el.le_lun = lun;
492 } else if (ISP_CAP_SCCFW(isp) == 0) {
493 el.le_lun = lun;

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

657 } else if (code & ECMD_SVALID) {
658 cto->ct_flags |= CT7_FLAG_MODE1 | CT7_SENDSTATUS;
659 cto->ct_scsi_status |= (FCP_SNSLEN_VALID << 8);
660 cto->rsp.m1.ct_resplen = cto->ct_senselen = min(16, MAXRESPLEN_24XX);
661 ISP_MEMZERO(cto->rsp.m1.ct_resp, sizeof (cto->rsp.m1.ct_resp));
662 cto->rsp.m1.ct_resp[0] = 0xf0;
663 cto->rsp.m1.ct_resp[2] = (code >> 12) & 0xf;
664 cto->rsp.m1.ct_resp[7] = 8;
503 }
504 el.le_header.rqs_entry_type = cmd;
505 el.le_header.rqs_entry_count = 1;
506 if (IS_SCSI(isp)) {
507 el.le_tgt = SDPARAM(isp, bus)->isp_initiator_id;
508 el.le_lun = lun;
509 } else if (ISP_CAP_SCCFW(isp) == 0) {
510 el.le_lun = lun;

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

674 } else if (code & ECMD_SVALID) {
675 cto->ct_flags |= CT7_FLAG_MODE1 | CT7_SENDSTATUS;
676 cto->ct_scsi_status |= (FCP_SNSLEN_VALID << 8);
677 cto->rsp.m1.ct_resplen = cto->ct_senselen = min(16, MAXRESPLEN_24XX);
678 ISP_MEMZERO(cto->rsp.m1.ct_resp, sizeof (cto->rsp.m1.ct_resp));
679 cto->rsp.m1.ct_resp[0] = 0xf0;
680 cto->rsp.m1.ct_resp[2] = (code >> 12) & 0xf;
681 cto->rsp.m1.ct_resp[7] = 8;
665 cto->rsp.m1.ct_resp[12] = (code >> 24) & 0xff;
666 cto->rsp.m1.ct_resp[13] = (code >> 16) & 0xff;
682 cto->rsp.m1.ct_resp[12] = (code >> 16) & 0xff;
683 cto->rsp.m1.ct_resp[13] = (code >> 24) & 0xff;
667 } else {
668 cto->ct_flags |= CT7_FLAG_MODE1 | CT7_SENDSTATUS;
669 }
670 if (aep->at_cmnd.cdb_dl.sf.fcp_cmnd_dl) {
671 cto->ct_resid = aep->at_cmnd.cdb_dl.sf.fcp_cmnd_dl;
672 if (cto->ct_resid < 0) {
673 cto->ct_scsi_status |= (FCP_RESID_OVERFLOW << 8);
674 } else if (cto->ct_resid > 0) {

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

832 ct->ct_flags = CT_SENDSTATUS;
833 }
834 isp_async(isp, ISPASYNC_TARGET_ACTION, storage);
835 break;
836 }
837 default:
838 isp_prt(isp, ISP_LOGERR, "%s: unknown event 0x%x", __func__, event);
839 if (isp->isp_state == ISP_RUNSTATE) {
684 } else {
685 cto->ct_flags |= CT7_FLAG_MODE1 | CT7_SENDSTATUS;
686 }
687 if (aep->at_cmnd.cdb_dl.sf.fcp_cmnd_dl) {
688 cto->ct_resid = aep->at_cmnd.cdb_dl.sf.fcp_cmnd_dl;
689 if (cto->ct_resid < 0) {
690 cto->ct_scsi_status |= (FCP_RESID_OVERFLOW << 8);
691 } else if (cto->ct_resid > 0) {

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

849 ct->ct_flags = CT_SENDSTATUS;
850 }
851 isp_async(isp, ISPASYNC_TARGET_ACTION, storage);
852 break;
853 }
854 default:
855 isp_prt(isp, ISP_LOGERR, "%s: unknown event 0x%x", __func__, event);
856 if (isp->isp_state == ISP_RUNSTATE) {
840 (void) isp_notify_ack(isp, NULL);
857 isp_async(isp, ISPASYNC_TARGET_NOTIFY_ACK, NULL);
841 }
842 break;
843 }
844 return (0);
845}
846
847
848/*

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

892 case MSG_TERM_IO_PROC:
893 notify.nt_ncode = NT_ABORT_TASK;
894 break;
895 case MSG_LUN_RESET:
896 notify.nt_ncode = NT_LUN_RESET;
897 break;
898 default:
899 isp_prt(isp, ISP_LOGERR, "%s: unhandled message 0x%x", __func__, inp->in_msg[0]);
858 }
859 break;
860 }
861 return (0);
862}
863
864
865/*

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

909 case MSG_TERM_IO_PROC:
910 notify.nt_ncode = NT_ABORT_TASK;
911 break;
912 case MSG_LUN_RESET:
913 notify.nt_ncode = NT_LUN_RESET;
914 break;
915 default:
916 isp_prt(isp, ISP_LOGERR, "%s: unhandled message 0x%x", __func__, inp->in_msg[0]);
900 (void) isp_notify_ack(isp, inp);
917 isp_async(isp, ISPASYNC_TARGET_NOTIFY_ACK, inp);
901 return;
902 }
903 isp_async(isp, ISPASYNC_TARGET_NOTIFY, &notify);
904 } else {
905 isp_prt(isp, ISP_LOGERR, "%s: unknown immediate notify status 0x%x", __func__, inp->in_status);
918 return;
919 }
920 isp_async(isp, ISPASYNC_TARGET_NOTIFY, &notify);
921 } else {
922 isp_prt(isp, ISP_LOGERR, "%s: unknown immediate notify status 0x%x", __func__, inp->in_status);
906 (void) isp_notify_ack(isp, inp);
923 isp_async(isp, ISPASYNC_TARGET_NOTIFY_ACK, inp);
907 }
908}
909
910/*
911 * Synthesize a message from the task management flags in a FCP_CMND_IU.
912 */
913static void
914isp_got_msg_fc(ispsoftc_t *isp, in_fcentry_t *inp)

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

941 }
942 notify.nt_tagval = seqid;
943 notify.nt_tagval |= (((uint64_t)(isp->isp_serno++)) << 32);
944 notify.nt_need_ack = 1;
945 notify.nt_lreserved = inp;
946
947 if (inp->in_status != IN_MSG_RECEIVED) {
948 isp_prt(isp, ISP_LOGINFO, f2, "immediate notify status", inp->in_status, notify.nt_lun, loopid, inp->in_task_flags, inp->in_seqid);
924 }
925}
926
927/*
928 * Synthesize a message from the task management flags in a FCP_CMND_IU.
929 */
930static void
931isp_got_msg_fc(ispsoftc_t *isp, in_fcentry_t *inp)

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

958 }
959 notify.nt_tagval = seqid;
960 notify.nt_tagval |= (((uint64_t)(isp->isp_serno++)) << 32);
961 notify.nt_need_ack = 1;
962 notify.nt_lreserved = inp;
963
964 if (inp->in_status != IN_MSG_RECEIVED) {
965 isp_prt(isp, ISP_LOGINFO, f2, "immediate notify status", inp->in_status, notify.nt_lun, loopid, inp->in_task_flags, inp->in_seqid);
949 (void) isp_notify_ack(isp, inp);
966 isp_async(isp, ISPASYNC_TARGET_NOTIFY_ACK, inp);
950 return;
951 }
952
953 if (inp->in_task_flags & TASK_FLAGS_ABORT_TASK_SET) {
954 isp_prt(isp, ISP_LOGINFO, f1, "ABORT TASK SET", loopid, notify.nt_lun, inp->in_seqid);
955 notify.nt_ncode = NT_ABORT_TASK_SET;
956 } else if (inp->in_task_flags & TASK_FLAGS_CLEAR_TASK_SET) {
957 isp_prt(isp, ISP_LOGINFO, f1, "CLEAR TASK SET", loopid, notify.nt_lun, inp->in_seqid);

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

962 } else if (inp->in_task_flags & TASK_FLAGS_TARGET_RESET) {
963 isp_prt(isp, ISP_LOGINFO, f1, "TARGET RESET", loopid, notify.nt_lun, inp->in_seqid);
964 notify.nt_ncode = NT_TARGET_RESET;
965 } else if (inp->in_task_flags & TASK_FLAGS_CLEAR_ACA) {
966 isp_prt(isp, ISP_LOGINFO, f1, "CLEAR ACA", loopid, notify.nt_lun, inp->in_seqid);
967 notify.nt_ncode = NT_CLEAR_ACA;
968 } else {
969 isp_prt(isp, ISP_LOGWARN, f2, "task flag", inp->in_status, notify.nt_lun, loopid, inp->in_task_flags, inp->in_seqid);
967 return;
968 }
969
970 if (inp->in_task_flags & TASK_FLAGS_ABORT_TASK_SET) {
971 isp_prt(isp, ISP_LOGINFO, f1, "ABORT TASK SET", loopid, notify.nt_lun, inp->in_seqid);
972 notify.nt_ncode = NT_ABORT_TASK_SET;
973 } else if (inp->in_task_flags & TASK_FLAGS_CLEAR_TASK_SET) {
974 isp_prt(isp, ISP_LOGINFO, f1, "CLEAR TASK SET", loopid, notify.nt_lun, inp->in_seqid);

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

979 } else if (inp->in_task_flags & TASK_FLAGS_TARGET_RESET) {
980 isp_prt(isp, ISP_LOGINFO, f1, "TARGET RESET", loopid, notify.nt_lun, inp->in_seqid);
981 notify.nt_ncode = NT_TARGET_RESET;
982 } else if (inp->in_task_flags & TASK_FLAGS_CLEAR_ACA) {
983 isp_prt(isp, ISP_LOGINFO, f1, "CLEAR ACA", loopid, notify.nt_lun, inp->in_seqid);
984 notify.nt_ncode = NT_CLEAR_ACA;
985 } else {
986 isp_prt(isp, ISP_LOGWARN, f2, "task flag", inp->in_status, notify.nt_lun, loopid, inp->in_task_flags, inp->in_seqid);
970 (void) isp_notify_ack(isp, inp);
987 isp_async(isp, ISPASYNC_TARGET_NOTIFY_ACK, inp);
971 return;
972 }
973 isp_async(isp, ISPASYNC_TARGET_NOTIFY, &notify);
974}
975
976static void
977isp_got_tmf_24xx(ispsoftc_t *isp, at7_entry_t *aep)
978{

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

1049 isp_prt(isp, ISP_LOGWARN, rqo, __func__);
1050 return (1);
1051 }
1052
1053 ISP_MEMZERO(storage, QENTRY_LEN);
1054
1055 if (IS_24XX(isp)) {
1056 na_fcentry_24xx_t *na = (na_fcentry_24xx_t *) storage;
988 return;
989 }
990 isp_async(isp, ISPASYNC_TARGET_NOTIFY, &notify);
991}
992
993static void
994isp_got_tmf_24xx(ispsoftc_t *isp, at7_entry_t *aep)
995{

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

1066 isp_prt(isp, ISP_LOGWARN, rqo, __func__);
1067 return (1);
1068 }
1069
1070 ISP_MEMZERO(storage, QENTRY_LEN);
1071
1072 if (IS_24XX(isp)) {
1073 na_fcentry_24xx_t *na = (na_fcentry_24xx_t *) storage;
1074 na->na_header.rqs_entry_type = RQSTYPE_NOTIFY_ACK;
1075 na->na_header.rqs_entry_count = 1;
1057 if (arg) {
1058 in_fcentry_24xx_t *in = arg;
1059 na->na_nphdl = in->in_nphdl;
1076 if (arg) {
1077 in_fcentry_24xx_t *in = arg;
1078 na->na_nphdl = in->in_nphdl;
1060 na->na_flags = in->in_flags & IN24XX_FLAG_PUREX_IOCB;
1079 na->na_flags = in->in_flags;
1061 na->na_status = in->in_status;
1062 na->na_status_subcode = in->in_status_subcode;
1063 na->na_rxid = in->in_rxid;
1064 na->na_oxid = in->in_oxid;
1065 na->na_vpidx = in->in_vpidx;
1066 if (in->in_status == IN24XX_SRR_RCVD) {
1067 na->na_srr_rxid = in->in_srr_rxid;
1068 na->na_srr_reloff_hi = in->in_srr_reloff_hi;
1069 na->na_srr_reloff_lo = in->in_srr_reloff_lo;
1070 na->na_srr_iu = in->in_srr_iu;
1080 na->na_status = in->in_status;
1081 na->na_status_subcode = in->in_status_subcode;
1082 na->na_rxid = in->in_rxid;
1083 na->na_oxid = in->in_oxid;
1084 na->na_vpidx = in->in_vpidx;
1085 if (in->in_status == IN24XX_SRR_RCVD) {
1086 na->na_srr_rxid = in->in_srr_rxid;
1087 na->na_srr_reloff_hi = in->in_srr_reloff_hi;
1088 na->na_srr_reloff_lo = in->in_srr_reloff_lo;
1089 na->na_srr_iu = in->in_srr_iu;
1071 na->na_srr_flags = 1;
1072 na->na_srr_reject_vunique = 0;
1073 na->na_srr_reject_explanation = 1;
1074 na->na_srr_reject_code = 1;
1090 /*
1091 * Whether we're accepting the SRR or rejecting
1092 * it is determined by looking at the in_reserved
1093 * field in the original notify structure.
1094 */
1095 if (in->in_reserved) {
1096 na->na_srr_flags = 1;
1097 na->na_srr_reject_vunique = 0;
1098 na->na_srr_reject_code = 9; /* unable to perform this command at this time */
1099 na->na_srr_reject_explanation = 0x2a; /* unable to supply the requested data */
1100 }
1075 }
1076 }
1101 }
1102 }
1077 na->na_header.rqs_entry_type = RQSTYPE_NOTIFY_ACK;
1078 na->na_header.rqs_entry_count = 1;
1079 isp_put_notify_24xx_ack(isp, na, (na_fcentry_24xx_t *)outp);
1080 } else if (IS_FC(isp)) {
1081 na_fcentry_t *na = (na_fcentry_t *) storage;
1082 int iid = 0;
1083
1084 if (arg) {
1085 in_fcentry_t *inp = arg;
1086 ISP_MEMCPY(storage, arg, sizeof (isphdr_t));
1087 if (ISP_CAP_2KLOGIN(isp)) {
1088 ((na_fcentry_e_t *)na)->na_iid = ((in_fcentry_e_t *)inp)->in_iid;
1089 iid = ((na_fcentry_e_t *)na)->na_iid;
1090 } else {
1091 na->na_iid = inp->in_iid;
1092 iid = na->na_iid;
1093 }
1094 na->na_task_flags = inp->in_task_flags & TASK_FLAGS_RESERVED_MASK;
1095 na->na_seqid = inp->in_seqid;
1103 isp_put_notify_24xx_ack(isp, na, (na_fcentry_24xx_t *)outp);
1104 } else if (IS_FC(isp)) {
1105 na_fcentry_t *na = (na_fcentry_t *) storage;
1106 int iid = 0;
1107
1108 if (arg) {
1109 in_fcentry_t *inp = arg;
1110 ISP_MEMCPY(storage, arg, sizeof (isphdr_t));
1111 if (ISP_CAP_2KLOGIN(isp)) {
1112 ((na_fcentry_e_t *)na)->na_iid = ((in_fcentry_e_t *)inp)->in_iid;
1113 iid = ((na_fcentry_e_t *)na)->na_iid;
1114 } else {
1115 na->na_iid = inp->in_iid;
1116 iid = na->na_iid;
1117 }
1118 na->na_task_flags = inp->in_task_flags & TASK_FLAGS_RESERVED_MASK;
1119 na->na_seqid = inp->in_seqid;
1096 na->na_flags = NAFC_RCOUNT;
1097 na->na_status = inp->in_status;
1120 na->na_status = inp->in_status;
1121 na->na_flags = NAFC_RCOUNT;
1098 if (inp->in_status == IN_RESET) {
1122 if (inp->in_status == IN_RESET) {
1099 na->na_flags |= NAFC_RST_CLRD;
1123 na->na_flags = NAFC_RST_CLRD; /* We do not modify resource counts for LIP resets */
1100 }
1101 if (inp->in_status == IN_MSG_RECEIVED) {
1102 na->na_flags |= NAFC_TVALID;
1103 na->na_response = 0; /* XXX SUCCEEDED XXX */
1104 }
1105 } else {
1106 na->na_flags = NAFC_RST_CLRD;
1107 }

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

1195 isp_prt(isp, ISP_LOGTINFO, "[0x%x] ABTS of 0x%x being BA_ACC'd", rsp->abts_rsp_rxid_abts, rsp->abts_rsp_rxid_task);
1196 rsp->abts_rsp_payload.ba_acc.aborted_rx_id = rx_id;
1197 rsp->abts_rsp_payload.ba_acc.aborted_ox_id = ox_id;
1198 rsp->abts_rsp_payload.ba_acc.high_seq_cnt = 0xffff;
1199 } else {
1200 ISP_MEMZERO(&rsp->abts_rsp_payload.ba_rjt, sizeof (rsp->abts_rsp_payload.ba_acc));
1201 switch (errno) {
1202 case ENOMEM:
1124 }
1125 if (inp->in_status == IN_MSG_RECEIVED) {
1126 na->na_flags |= NAFC_TVALID;
1127 na->na_response = 0; /* XXX SUCCEEDED XXX */
1128 }
1129 } else {
1130 na->na_flags = NAFC_RST_CLRD;
1131 }

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

1219 isp_prt(isp, ISP_LOGTINFO, "[0x%x] ABTS of 0x%x being BA_ACC'd", rsp->abts_rsp_rxid_abts, rsp->abts_rsp_rxid_task);
1220 rsp->abts_rsp_payload.ba_acc.aborted_rx_id = rx_id;
1221 rsp->abts_rsp_payload.ba_acc.aborted_ox_id = ox_id;
1222 rsp->abts_rsp_payload.ba_acc.high_seq_cnt = 0xffff;
1223 } else {
1224 ISP_MEMZERO(&rsp->abts_rsp_payload.ba_rjt, sizeof (rsp->abts_rsp_payload.ba_acc));
1225 switch (errno) {
1226 case ENOMEM:
1203 rsp->abts_rsp_payload.ba_rjt.reason = 5; /* Logical Busy */
1227 rsp->abts_rsp_payload.ba_rjt.reason = 5; /* Logical Unit Busy */
1204 break;
1205 default:
1206 rsp->abts_rsp_payload.ba_rjt.reason = 9; /* Unable to perform command request */
1207 break;
1208 }
1209 }
1210
1211 /*

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

1766 isp_prt(isp, ISP_LOGWARN, "CTIO7 completed with Invalid RX_ID 0x%x", ct->ct_rxid);
1767 break;
1768
1769 case CT7_REASSY_ERR:
1770 isp_prt(isp, ISP_LOGWARN, "reassembly error");
1771 break;
1772
1773 case CT7_SRR:
1228 break;
1229 default:
1230 rsp->abts_rsp_payload.ba_rjt.reason = 9; /* Unable to perform command request */
1231 break;
1232 }
1233 }
1234
1235 /*

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

1790 isp_prt(isp, ISP_LOGWARN, "CTIO7 completed with Invalid RX_ID 0x%x", ct->ct_rxid);
1791 break;
1792
1793 case CT7_REASSY_ERR:
1794 isp_prt(isp, ISP_LOGWARN, "reassembly error");
1795 break;
1796
1797 case CT7_SRR:
1774 isp_prt(isp, ISP_LOGWARN, "SRR received");
1798 isp_prt(isp, ISP_LOGTDEBUG0, "SRR received");
1775 break;
1776
1777 default:
1778 isp_prt(isp, ISP_LOGERR, "Unknown CTIO7 status 0x%x", ct->ct_nphdl);
1779 break;
1780 }
1781
1782 if (xs == NULL) {
1783 /*
1784 * There may be more than one CTIO for a data transfer,
1785 * or this may be a status CTIO we're not monitoring.
1786 *
1787 * The assumption is that they'll all be returned in the
1788 * order we got them.
1789 */
1790 if (ct->ct_syshandle == 0) {
1791 if (ct->ct_flags & CT7_TERMINATE) {
1799 break;
1800
1801 default:
1802 isp_prt(isp, ISP_LOGERR, "Unknown CTIO7 status 0x%x", ct->ct_nphdl);
1803 break;
1804 }
1805
1806 if (xs == NULL) {
1807 /*
1808 * There may be more than one CTIO for a data transfer,
1809 * or this may be a status CTIO we're not monitoring.
1810 *
1811 * The assumption is that they'll all be returned in the
1812 * order we got them.
1813 */
1814 if (ct->ct_syshandle == 0) {
1815 if (ct->ct_flags & CT7_TERMINATE) {
1792 isp_prt(isp, ISP_LOGINFO, "termination of 0x%x complete", ct->ct_rxid);
1816 isp_prt(isp, ISP_LOGINFO, "termination of [RX_ID 0x%x] complete", ct->ct_rxid);
1793 } else if ((ct->ct_flags & CT7_SENDSTATUS) == 0) {
1794 isp_prt(isp, pl, "intermediate CTIO completed ok");
1795 } else {
1796 isp_prt(isp, pl, "unmonitored CTIO completed ok");
1797 }
1798 } else {
1799 isp_prt(isp, pl, "NO xs for CTIO (handle 0x%x) status 0x%x", ct->ct_syshandle, ct->ct_nphdl);
1800 }

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

1839 if (chan == 0xff) {
1840 lochan = 0;
1841 hichan = isp->isp_nchan;
1842 } else {
1843 if (chan >= isp->isp_nchan) {
1844 char buf[64];
1845 ISP_SNPRINTF(buf, sizeof buf, "%s: bad channel %d for status 0x%x", __func__, chan, inot_24xx->in_status);
1846 isp_print_bytes(isp, buf, QENTRY_LEN, inot_24xx);
1817 } else if ((ct->ct_flags & CT7_SENDSTATUS) == 0) {
1818 isp_prt(isp, pl, "intermediate CTIO completed ok");
1819 } else {
1820 isp_prt(isp, pl, "unmonitored CTIO completed ok");
1821 }
1822 } else {
1823 isp_prt(isp, pl, "NO xs for CTIO (handle 0x%x) status 0x%x", ct->ct_syshandle, ct->ct_nphdl);
1824 }

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

1863 if (chan == 0xff) {
1864 lochan = 0;
1865 hichan = isp->isp_nchan;
1866 } else {
1867 if (chan >= isp->isp_nchan) {
1868 char buf[64];
1869 ISP_SNPRINTF(buf, sizeof buf, "%s: bad channel %d for status 0x%x", __func__, chan, inot_24xx->in_status);
1870 isp_print_bytes(isp, buf, QENTRY_LEN, inot_24xx);
1847 (void) isp_notify_ack(isp, inot_24xx);
1871 isp_async(isp, ISPASYNC_TARGET_NOTIFY_ACK, inot_24xx);
1848 return;
1849 }
1850 lochan = chan;
1851 hichan = chan + 1;
1852 }
1853 isp_prt(isp, ISP_LOGTDEBUG1, "%s: Immediate Notify Channels %d..%d status=0x%x seqid=0x%x", __func__, lochan, hichan-1, inot_24xx->in_status, inot_24xx->in_rxid);
1854 for (chan = lochan; chan < hichan; chan++) {
1855 switch (inot_24xx->in_status) {
1856 case IN24XX_LIP_RESET:
1857 case IN24XX_LINK_RESET:
1858 case IN24XX_PORT_LOGOUT:
1859 case IN24XX_PORT_CHANGED:
1860 case IN24XX_LINK_FAILED:
1861 case IN24XX_SRR_RCVD:
1862 case IN24XX_ELS_RCVD:
1872 return;
1873 }
1874 lochan = chan;
1875 hichan = chan + 1;
1876 }
1877 isp_prt(isp, ISP_LOGTDEBUG1, "%s: Immediate Notify Channels %d..%d status=0x%x seqid=0x%x", __func__, lochan, hichan-1, inot_24xx->in_status, inot_24xx->in_rxid);
1878 for (chan = lochan; chan < hichan; chan++) {
1879 switch (inot_24xx->in_status) {
1880 case IN24XX_LIP_RESET:
1881 case IN24XX_LINK_RESET:
1882 case IN24XX_PORT_LOGOUT:
1883 case IN24XX_PORT_CHANGED:
1884 case IN24XX_LINK_FAILED:
1885 case IN24XX_SRR_RCVD:
1886 case IN24XX_ELS_RCVD:
1887 inot_24xx->in_reserved = 0; /* clear this for later usage */
1863 inot_24xx->in_vpidx = chan;
1864 isp_async(isp, ISPASYNC_TARGET_ACTION, inot_24xx);
1865 break;
1866 default:
1867 isp_prt(isp, ISP_LOGINFO, "%s: unhandled status (0x%x) for chan %d", __func__, inot_24xx->in_status, chan);
1888 inot_24xx->in_vpidx = chan;
1889 isp_async(isp, ISPASYNC_TARGET_ACTION, inot_24xx);
1890 break;
1891 default:
1892 isp_prt(isp, ISP_LOGINFO, "%s: unhandled status (0x%x) for chan %d", __func__, inot_24xx->in_status, chan);
1868 (void) isp_notify_ack(isp, inot_24xx);
1893 isp_async(isp, ISPASYNC_TARGET_NOTIFY_ACK, inot_24xx);
1869 break;
1870 }
1871 }
1872 inot_24xx->in_vpidx = ochan;
1873}
1874#endif
1894 break;
1895 }
1896 }
1897 inot_24xx->in_vpidx = ochan;
1898}
1899#endif