Deleted Added
full compact
1d0
< /* $FreeBSD: head/sys/dev/isp/isp_target.c 140651 2005-01-23 06:28:08Z mjacob $ */
5c4
< * Copyright (c) 1999, 2000, 2001 by Matthew Jacob
---
> * Copyright (c) 1997-2006 by Matthew Jacob
7d5
< * mjacob@feral.com
42a41,43
> #include <sys/cdefs.h>
> __FBSDID("$FreeBSD: head/sys/dev/isp/isp_target.c 154704 2006-01-23 06:23:37Z mjacob $");
>
60,62c61,62
< static void isp_got_msg(struct ispsoftc *, int, in_entry_t *);
< static void isp_got_msg_fc(struct ispsoftc *, int, in_fcentry_t *);
< static void isp_notify_ack(struct ispsoftc *, void *);
---
> static void isp_got_msg(struct ispsoftc *, in_entry_t *);
> static void isp_got_msg_fc(struct ispsoftc *, in_fcentry_t *);
120a121
> at2e_entry_t *at2eiop;
122a124
> ct2e_entry_t *ct2eiop;
125a128
> in_fcentry_e_t *inote_fcp;
127a131
> na_fcentry_e_t *nacke_fcp;
131a136
> #define at2eiop unp.at2eiop
133a139
> #define ct2eiop unp.ct2eiop
136a143
> #define inote_fcp unp.inote_fcp
138a146
> #define nacke_fcp unp.nacke_fcp
159c167,170
< isp_get_atio2(isp, at2iop, (at2_entry_t *) local);
---
> if (IS_2KLOGIN(isp))
> isp_get_atio2e(isp, at2eiop, (at2e_entry_t *) local);
> else
> isp_get_atio2(isp, at2iop, (at2_entry_t *) local);
164c175,178
< isp_get_ctio2(isp, ct2iop, (ct2_entry_t *) local);
---
> if (IS_2KLOGIN(isp))
> isp_get_ctio2e(isp, ct2eiop, (ct2e_entry_t *) local);
> else
> isp_get_ctio2(isp, ct2iop, (ct2_entry_t *) local);
183c197,199
< isp_get_notify_fc(isp, inot_fcp, (in_fcentry_t *)local);
---
> if (IS_2KLOGIN(isp))
> isp_get_notify_fc_e(isp, inote_fcp, (in_fcentry_e_t *)local);
> isp_get_notify_fc(isp, inot_fcp, (in_fcentry_t *)local);
201,204d216
< /*
< * ACK it right away.
< */
< isp_notify_ack(isp, (status == IN_RESET)? NULL : local);
206,208d217
< case IN_RESET:
< (void) isp_async(isp, ISPASYNC_BUS_RESET, &bus);
< break;
212c221
< isp_got_msg_fc(isp, bus, (in_fcentry_t *)local);
---
> isp_got_msg_fc(isp, (in_fcentry_t *)local);
214c223
< isp_got_msg(isp, bus, (in_entry_t *)local);
---
> isp_got_msg(isp, (in_entry_t *)local);
218a228
> isp_notify_ack(isp, local);
219a230,232
> case IN_RESET:
> isp_target_async(isp, 0, ASYNC_BUS_RESET);
> break;
228a242
> isp_notify_ack(isp, local);
239,240c253,258
< isp_get_notify_ack_fc(isp, nack_fcp,
< (na_fcentry_t *)local);
---
> if (IS_2KLOGIN(isp))
> isp_get_notify_ack_fc_e(isp, nacke_fcp,
> (na_fcentry_e_t *)local);
> else
> isp_get_notify_ack_fc(isp, nack_fcp,
> (na_fcentry_t *)local);
260a279
> #undef at2eiop
262a282
> #undef ct2eiop
265a286
> #undef inote_fcp
267a289
> #undef nacke_fcp
377a400
> at2e_entry_t _atio2e;
390c413,417
< atun._atio2.at_iid = aep->at_iid;
---
> if (IS_2KLOGIN(isp)) {
> atun._atio2e.at_iid = ((at2e_entry_t *)aep)->at_iid;
> } else {
> atun._atio2.at_iid = aep->at_iid;
> }
433a461
> ct2e_entry_t _ctio2e;
445d472
< cto->ct_iid = aep->at_iid;
448a476,480
> if (IS_2KLOGIN(isp)) {
> un._ctio2e.ct_iid = ((at2e_entry_t *)aep)->at_iid;
> } else {
> cto->ct_iid = aep->at_iid;
> }
497,498c529
< tmd_event_t evt;
< tmd_msg_t msg;
---
> tmd_notify_t notify;
499a531,542
> MEMZERO(&notify, sizeof (tmd_notify_t));
> notify.nt_hba = isp;
> /* nt_str set in outer layers */
> notify.nt_iid = INI_ANY;
> /* nt_tgt set in outer layers */
> notify.nt_lun = LUN_ANY;
> notify.nt_tagval = TAG_ANY;
>
> if (IS_SCSI(isp)) {
> TAG_INSERT_BUS(notify.nt_tagval, bus);
> }
>
501,507d543
< /*
< * These three we handle here to propagate an effective bus reset
< * upstream, but these do not require any immediate notify actions
< * so we return when done.
< */
< case ASYNC_LIP_F8:
< case ASYNC_LIP_OCCURRED:
508a545,548
> case ASYNC_PTPMODE:
> notify.nt_ncode = NT_LINK_UP;
> (void) isp_async(isp, ISPASYNC_TARGET_NOTIFY, &notify);
> break;
509a550,554
> notify.nt_ncode = NT_LINK_DOWN;
> (void) isp_async(isp, ISPASYNC_TARGET_NOTIFY, &notify);
> break;
> case ASYNC_LIP_F8:
> case ASYNC_LIP_OCCURRED:
511,518c556,558
< case ASYNC_PTPMODE:
< /*
< * These don't require any immediate notify actions. We used
< * treat them like SCSI Bus Resets, but that was just plain
< * wrong. Let the normal CTIO completion report what occurred.
< */
< return (0);
<
---
> notify.nt_ncode = NT_LIP_RESET;
> (void) isp_async(isp, ISPASYNC_TARGET_NOTIFY, &notify);
> break;
520,526c560,562
< case ASYNC_TIMEOUT_RESET:
< if (IS_FC(isp)) {
< return (0); /* we'll be getting an inotify instead */
< }
< evt.ev_bus = bus;
< evt.ev_event = event;
< (void) isp_async(isp, ISPASYNC_TARGET_EVENT, &evt);
---
> case ASYNC_TIMEOUT_RESET: /* XXX: where does this come from ? */
> notify.nt_ncode = NT_BUS_RESET;
> (void) isp_async(isp, ISPASYNC_TARGET_NOTIFY, &notify);
529,533c565,571
< /*
< * Bus Device Reset resets a specific target, so
< * we pass this as a synthesized message.
< */
< MEMZERO(&msg, sizeof msg);
---
> notify.nt_ncode = NT_TARGET_RESET;
> (void) isp_async(isp, ISPASYNC_TARGET_NOTIFY, &notify);
> break;
> case ASYNC_CTIO_DONE:
> {
> uint8_t storage[QENTRY_LEN];
> memset(storage, 0, QENTRY_LEN);
535c573,577
< msg.nt_iid = FCPARAM(isp)->isp_loopid;
---
> ct2_entry_t *ct = (ct2_entry_t *) storage;
> ct->ct_header.rqs_entry_type = RQSTYPE_CTIO2;
> ct->ct_status = CT_OK;
> ct->ct_syshandle = bus;
> ct->ct_flags = CT2_SENDSTATUS|CT2_FASTPOST;
537c579,583
< msg.nt_iid = SDPARAM(isp)->isp_initiator_id;
---
> ct_entry_t *ct = (ct_entry_t *) storage;
> ct->ct_header.rqs_entry_type = RQSTYPE_CTIO;
> ct->ct_status = CT_OK;
> ct->ct_fwhandle = bus;
> ct->ct_flags = CT_SENDSTATUS;
539,546c585
< msg.nt_bus = bus;
< msg.nt_msg[0] = MSG_BUS_DEV_RESET;
< (void) isp_async(isp, ISPASYNC_TARGET_MESSAGE, &msg);
< break;
< case ASYNC_CTIO_DONE:
< evt.ev_bus = bus;
< evt.ev_event = event;
< (void) isp_async(isp, ISPASYNC_TARGET_EVENT, &evt);
---
> (void) isp_async(isp, ISPASYNC_TARGET_ACTION, storage);
547a587
> }
550a591,593
> if (isp->isp_state == ISP_RUNSTATE) {
> isp_notify_ack(isp, NULL);
> }
553,555c596
< if (isp->isp_state == ISP_RUNSTATE)
< isp_notify_ack(isp, NULL);
< return(0);
---
> return (0);
568c609
< isp_got_msg(struct ispsoftc *isp, int bus, in_entry_t *inp)
---
> isp_got_msg(struct ispsoftc *isp, in_entry_t *inp)
569a611
> tmd_notify_t nt;
572,573c614,621
< if (status == IN_IDE_RECEIVED || status == IN_MSG_RECEIVED) {
< tmd_msg_t msg;
---
> MEMZERO(&nt, sizeof (nt));
> nt.nt_hba = isp;
> /* nt_str set in outer layers */
> nt.nt_iid = GET_IID_VAL(inp->in_iid);
> nt.nt_tgt = inp->in_tgt;
> nt.nt_lun = inp->in_lun;
> IN_MAKE_TAGID(nt.nt_tagval, 0, inp);
> nt.nt_lreserved = inp;
575,583c623,652
< MEMZERO(&msg, sizeof (msg));
< msg.nt_bus = bus;
< msg.nt_iid = inp->in_iid;
< msg.nt_tgt = inp->in_tgt;
< msg.nt_lun = inp->in_lun;
< msg.nt_tagtype = inp->in_tag_type;
< IN_MAKE_TAGID(msg.nt_tagval, 0, inp);
< MEMCPY(msg.nt_msg, inp->in_msg, IN_MSGLEN);
< (void) isp_async(isp, ISPASYNC_TARGET_MESSAGE, &msg);
---
> if (status == IN_IDE_RECEIVED || status == IN_MSG_RECEIVED) {
> switch (inp->in_msg[0]) {
> case MSG_ABORT:
> nt.nt_ncode = NT_ABORT_TASK_SET;
> break;
> case MSG_BUS_DEV_RESET:
> nt.nt_ncode = NT_TARGET_RESET;
> break;
> case MSG_ABORT_TAG:
> nt.nt_ncode = NT_ABORT_TASK;
> break;
> case MSG_CLEAR_QUEUE:
> nt.nt_ncode = NT_CLEAR_TASK_SET;
> break;
> case MSG_REL_RECOVERY:
> nt.nt_ncode = NT_CLEAR_ACA;
> break;
> case MSG_TERM_IO_PROC:
> nt.nt_ncode = NT_ABORT_TASK;
> break;
> case MSG_LUN_RESET:
> nt.nt_ncode = NT_LUN_RESET;
> break;
> default:
> isp_prt(isp, ISP_LOGERR,
> "unhandled message 0x%x", inp->in_msg[0]);
> isp_notify_ack(isp, inp);
> return;
> }
> (void) isp_async(isp, ISPASYNC_TARGET_NOTIFY, &nt);
586a656
> isp_notify_ack(isp, inp);
594c664
< isp_got_msg_fc(struct ispsoftc *isp, int bus, in_fcentry_t *inp)
---
> isp_got_msg_fc(struct ispsoftc *isp, in_fcentry_t *inp)
596,597c666,667
< int lun;
< static const char f1[] = "%s from iid %d lun %d seq 0x%x";
---
> tmd_notify_t nt;
> static const char f1[] = "%s from iid 0x%08x%08x lun %d seq 0x%x";
599c669
< "unknown %s 0x%x lun %d iid %d task flags 0x%x seq 0x%x\n";
---
> "unknown %s 0x%x lun %d iid 0x%08x%08x task flags 0x%x seq 0x%x\n";
600a671,681
> MEMZERO(&nt, sizeof (tmd_notify_t));
> nt.nt_hba = isp;
> /*
> * XXX: LOOK UP TRANSLATION IN CURRENT LPORTDB
> */
> if (IS_2KLOGIN(isp)) {
> nt.nt_iid = ((in_fcentry_e_t *)inp)->in_iid;
> } else {
> nt.nt_iid = inp->in_iid; /* possibly reset in outer layer */
> }
> /* nt_tgt set in outer layers */
602c683
< lun = inp->in_scclun;
---
> nt.nt_lun = inp->in_scclun;
604c685
< lun = inp->in_lun;
---
> nt.nt_lun = inp->in_lun;
605a687,688
> IN_FC_MAKE_TAGID(nt.nt_tagval, 0, inp);
> nt.nt_lreserved = inp;
609c692
< inp->in_status, lun, inp->in_iid,
---
> inp->in_status, nt.nt_lun, (u_int32_t) (nt.nt_iid >> 32), (u_int32_t) nt.nt_iid,
611,612c694,696
< } else {
< tmd_msg_t msg;
---
> isp_notify_ack(isp, inp);
> return;
> }
614,647c698,723
< MEMZERO(&msg, sizeof (msg));
< msg.nt_bus = bus;
< msg.nt_iid = inp->in_iid;
< IN_FC_MAKE_TAGID(msg.nt_tagval, 0, inp);
< msg.nt_lun = lun;
<
< if (inp->in_task_flags & TASK_FLAGS_ABORT_TASK_SET) {
< isp_prt(isp, ISP_LOGINFO, f1, "ABORT TASK SET",
< inp->in_iid, lun, inp->in_seqid);
< msg.nt_msg[0] = MSG_ABORT;
< } else if (inp->in_task_flags & TASK_FLAGS_CLEAR_TASK_SET) {
< isp_prt(isp, ISP_LOGINFO, f1, "CLEAR TASK SET",
< inp->in_iid, lun, inp->in_seqid);
< msg.nt_msg[0] = MSG_CLEAR_QUEUE;
< } else if (inp->in_task_flags & TASK_FLAGS_LUN_RESET) {
< isp_prt(isp, ISP_LOGINFO, f1, "LUN RESET",
< inp->in_iid, lun, inp->in_seqid);
< msg.nt_msg[0] = MSG_LUN_RESET;
< } else if (inp->in_task_flags & TASK_FLAGS_TARGET_RESET) {
< isp_prt(isp, ISP_LOGINFO, f1, "TARGET RESET",
< inp->in_iid, lun, inp->in_seqid);
< msg.nt_msg[0] = MSG_BUS_DEV_RESET;
< } else if (inp->in_task_flags & TASK_FLAGS_CLEAR_ACA) {
< isp_prt(isp, ISP_LOGINFO, f1, "CLEAR ACA",
< inp->in_iid, lun, inp->in_seqid);
< msg.nt_msg[0] = MSG_REL_RECOVERY;
< } else {
< isp_prt(isp, ISP_LOGWARN, f2, "task flag",
< inp->in_status, lun, inp->in_iid,
< inp->in_task_flags, inp->in_seqid);
< }
< if (msg.nt_msg[0]) {
< (void) isp_async(isp, ISPASYNC_TARGET_MESSAGE, &msg);
< }
---
> if (inp->in_task_flags & TASK_FLAGS_ABORT_TASK_SET) {
> isp_prt(isp, ISP_LOGINFO, f1, "ABORT TASK SET",
> (u_int32_t) (nt.nt_iid >> 32), (u_int32_t) nt.nt_iid, nt.nt_lun, inp->in_seqid);
> nt.nt_ncode = NT_ABORT_TASK_SET;
> } else if (inp->in_task_flags & TASK_FLAGS_CLEAR_TASK_SET) {
> isp_prt(isp, ISP_LOGINFO, f1, "CLEAR TASK SET",
> (u_int32_t) (nt.nt_iid >> 32), (u_int32_t) nt.nt_iid, nt.nt_lun, inp->in_seqid);
> nt.nt_ncode = NT_CLEAR_TASK_SET;
> } else if (inp->in_task_flags & TASK_FLAGS_LUN_RESET) {
> isp_prt(isp, ISP_LOGINFO, f1, "LUN RESET",
> (u_int32_t) (nt.nt_iid >> 32), (u_int32_t) nt.nt_iid, nt.nt_lun, inp->in_seqid);
> nt.nt_ncode = NT_LUN_RESET;
> } else if (inp->in_task_flags & TASK_FLAGS_TARGET_RESET) {
> isp_prt(isp, ISP_LOGINFO, f1, "TARGET RESET",
> (u_int32_t) (nt.nt_iid >> 32), (u_int32_t) nt.nt_iid, nt.nt_lun, inp->in_seqid);
> nt.nt_ncode = NT_TARGET_RESET;
> } else if (inp->in_task_flags & TASK_FLAGS_CLEAR_ACA) {
> isp_prt(isp, ISP_LOGINFO, f1, "CLEAR ACA",
> (u_int32_t) (nt.nt_iid >> 32), (u_int32_t) nt.nt_iid, nt.nt_lun, inp->in_seqid);
> nt.nt_ncode = NT_CLEAR_ACA;
> } else {
> isp_prt(isp, ISP_LOGWARN, f2, "task flag",
> inp->in_status, nt.nt_lun, (u_int32_t) (nt.nt_iid >> 32), (u_int32_t) nt.nt_iid,
> inp->in_task_flags, inp->in_seqid);
> isp_notify_ack(isp, inp);
> return;
648a725
> (void) isp_async(isp, ISPASYNC_TARGET_NOTIFY, &nt);
651c728
< static void
---
> void
671c748,752
< na->na_iid = inp->in_iid;
---
> if (IS_2KLOGIN(isp)) {
> ((na_fcentry_e_t *)na)->na_iid = ((in_fcentry_e_t *)inp)->in_iid;
> } else {
> na->na_iid = inp->in_iid;
> }
689c770,774
< isp_put_notify_ack_fc(isp, na, (na_fcentry_t *)outp);
---
> if (IS_2KLOGIN(isp)) {
> isp_put_notify_ack_fc_e(isp, (na_fcentry_e_t *) na, (na_fcentry_e_t *)outp);
> } else {
> isp_put_notify_ack_fc(isp, na, (na_fcentry_t *)outp);
> }
797c882
< int lun;
---
> int lun, iid;
804a890,895
> if (IS_2KLOGIN(isp)) {
> iid = ((at2e_entry_t *)aep)->at_iid;
> } else {
> iid = aep->at_iid;
> }
>
864c955
< isp_prt(isp, ISP_LOGERR, atior, lun, aep->at_iid, 0);
---
> isp_prt(isp, ISP_LOGERR, atior, lun, iid, 0);
871c962
< aep->at_status, aep->at_iid, lun);
---
> aep->at_status, iid, lun);