Deleted Added
full compact
isp_target.c (157945) isp_target.c (160251)
1/*-
2 * Machine and OS Independent Target Mode Code for the Qlogic SCSI/FC adapters.
3 *
4 * Copyright (c) 1997-2006 by Matthew Jacob
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28#ifdef __FreeBSD__
29#include <sys/cdefs.h>
1/*-
2 * Machine and OS Independent Target Mode Code for the Qlogic SCSI/FC adapters.
3 *
4 * Copyright (c) 1997-2006 by Matthew Jacob
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

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

22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28#ifdef __FreeBSD__
29#include <sys/cdefs.h>
30__FBSDID("$FreeBSD: head/sys/dev/isp/isp_target.c 157945 2006-04-21 18:46:35Z mjacob $");
30__FBSDID("$FreeBSD: head/sys/dev/isp/isp_target.c 160251 2006-07-10 22:40:21Z mjacob $");
31#endif
32
33/*
34 * Bug fixes gratefully acknowledged from:
35 * Oded Kedem <oded@kashya.com>
36 */
37/*
38 * Include header file appropriate for platform we're building on.

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

160 isp_get_atio(isp, atiop, (at_entry_t *) local);
161 isp_handle_atio(isp, (at_entry_t *) local);
162 break;
163 case RQSTYPE_CTIO:
164 isp_get_ctio(isp, ctiop, (ct_entry_t *) local);
165 isp_handle_ctio(isp, (ct_entry_t *) local);
166 break;
167 case RQSTYPE_ATIO2:
31#endif
32
33/*
34 * Bug fixes gratefully acknowledged from:
35 * Oded Kedem <oded@kashya.com>
36 */
37/*
38 * Include header file appropriate for platform we're building on.

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

160 isp_get_atio(isp, atiop, (at_entry_t *) local);
161 isp_handle_atio(isp, (at_entry_t *) local);
162 break;
163 case RQSTYPE_CTIO:
164 isp_get_ctio(isp, ctiop, (ct_entry_t *) local);
165 isp_handle_ctio(isp, (ct_entry_t *) local);
166 break;
167 case RQSTYPE_ATIO2:
168 if (IS_2KLOGIN(isp))
168 if (IS_2KLOGIN(isp)) {
169 isp_get_atio2e(isp, at2eiop, (at2e_entry_t *) local);
169 isp_get_atio2e(isp, at2eiop, (at2e_entry_t *) local);
170 else
170 } else {
171 isp_get_atio2(isp, at2iop, (at2_entry_t *) local);
171 isp_get_atio2(isp, at2iop, (at2_entry_t *) local);
172 }
172 isp_handle_atio2(isp, (at2_entry_t *) local);
173 break;
174 case RQSTYPE_CTIO3:
175 case RQSTYPE_CTIO2:
173 isp_handle_atio2(isp, (at2_entry_t *) local);
174 break;
175 case RQSTYPE_CTIO3:
176 case RQSTYPE_CTIO2:
176 if (IS_2KLOGIN(isp))
177 if (IS_2KLOGIN(isp)) {
177 isp_get_ctio2e(isp, ct2eiop, (ct2e_entry_t *) local);
178 isp_get_ctio2e(isp, ct2eiop, (ct2e_entry_t *) local);
178 else
179 } else {
179 isp_get_ctio2(isp, ct2iop, (ct2_entry_t *) local);
180 isp_get_ctio2(isp, ct2iop, (ct2_entry_t *) local);
181 }
180 isp_handle_ctio2(isp, (ct2_entry_t *) local);
181 break;
182 case RQSTYPE_ENABLE_LUN:
183 case RQSTYPE_MODIFY_LUN:
184 isp_get_enable_lun(isp, lunenp, (lun_entry_t *) local);
185 (void) isp_async(isp, ISPASYNC_TARGET_ACTION, local);
186 break;
187
188 case RQSTYPE_NOTIFY:
189 /*
190 * Either the ISP received a SCSI message it can't
191 * handle, or it's returning an Immed. Notify entry
192 * we sent. We can send Immed. Notify entries to
193 * increment the firmware's resource count for them
194 * (we set this initially in the Enable Lun entry).
195 */
196 bus = 0;
197 if (IS_FC(isp)) {
182 isp_handle_ctio2(isp, (ct2_entry_t *) local);
183 break;
184 case RQSTYPE_ENABLE_LUN:
185 case RQSTYPE_MODIFY_LUN:
186 isp_get_enable_lun(isp, lunenp, (lun_entry_t *) local);
187 (void) isp_async(isp, ISPASYNC_TARGET_ACTION, local);
188 break;
189
190 case RQSTYPE_NOTIFY:
191 /*
192 * Either the ISP received a SCSI message it can't
193 * handle, or it's returning an Immed. Notify entry
194 * we sent. We can send Immed. Notify entries to
195 * increment the firmware's resource count for them
196 * (we set this initially in the Enable Lun entry).
197 */
198 bus = 0;
199 if (IS_FC(isp)) {
198 if (IS_2KLOGIN(isp))
200 if (IS_2KLOGIN(isp)) {
199 isp_get_notify_fc_e(isp, inote_fcp, (in_fcentry_e_t *)local);
201 isp_get_notify_fc_e(isp, inote_fcp, (in_fcentry_e_t *)local);
200 isp_get_notify_fc(isp, inot_fcp, (in_fcentry_t *)local);
202 } else {
203 isp_get_notify_fc(isp, inot_fcp, (in_fcentry_t *)local);
204 }
201 inot_fcp = (in_fcentry_t *) local;
202 status = inot_fcp->in_status;
203 seqid = inot_fcp->in_seqid;
204 } else {
205 isp_get_notify(isp, inotp, (in_entry_t *)local);
206 inotp = (in_entry_t *) local;
207 status = inotp->in_status & 0xff;
208 seqid = inotp->in_seqid;

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

246 break;
247
248 case RQSTYPE_NOTIFY_ACK:
249 /*
250 * The ISP is acknowledging our acknowledgement of an
251 * Immediate Notify entry for some asynchronous event.
252 */
253 if (IS_FC(isp)) {
205 inot_fcp = (in_fcentry_t *) local;
206 status = inot_fcp->in_status;
207 seqid = inot_fcp->in_seqid;
208 } else {
209 isp_get_notify(isp, inotp, (in_entry_t *)local);
210 inotp = (in_entry_t *) local;
211 status = inotp->in_status & 0xff;
212 seqid = inotp->in_seqid;

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

250 break;
251
252 case RQSTYPE_NOTIFY_ACK:
253 /*
254 * The ISP is acknowledging our acknowledgement of an
255 * Immediate Notify entry for some asynchronous event.
256 */
257 if (IS_FC(isp)) {
254 if (IS_2KLOGIN(isp))
258 if (IS_2KLOGIN(isp)) {
255 isp_get_notify_ack_fc_e(isp, nacke_fcp,
256 (na_fcentry_e_t *)local);
259 isp_get_notify_ack_fc_e(isp, nacke_fcp,
260 (na_fcentry_e_t *)local);
257 else
261 } else {
258 isp_get_notify_ack_fc(isp, nack_fcp,
259 (na_fcentry_t *)local);
262 isp_get_notify_ack_fc(isp, nack_fcp,
263 (na_fcentry_t *)local);
264 }
260 nack_fcp = (na_fcentry_t *)local;
261 isp_prt(isp, ISP_LOGTDEBUG1,
262 "Notify Ack status=0x%x seqid 0x%x",
263 nack_fcp->na_status, nack_fcp->na_seqid);
264 } else {
265 isp_get_notify_ack(isp, nackp, (na_entry_t *)local);
266 nackp = (na_entry_t *)local;
267 isp_prt(isp, ISP_LOGTDEBUG1,

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

367 "Request Queue Overflow in isp_target_put_entry");
368 return (-1);
369 }
370 switch (etype) {
371 case RQSTYPE_ATIO:
372 isp_put_atio(isp, (at_entry_t *) ap, (at_entry_t *) outp);
373 break;
374 case RQSTYPE_ATIO2:
265 nack_fcp = (na_fcentry_t *)local;
266 isp_prt(isp, ISP_LOGTDEBUG1,
267 "Notify Ack status=0x%x seqid 0x%x",
268 nack_fcp->na_status, nack_fcp->na_seqid);
269 } else {
270 isp_get_notify_ack(isp, nackp, (na_entry_t *)local);
271 nackp = (na_entry_t *)local;
272 isp_prt(isp, ISP_LOGTDEBUG1,

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

372 "Request Queue Overflow in isp_target_put_entry");
373 return (-1);
374 }
375 switch (etype) {
376 case RQSTYPE_ATIO:
377 isp_put_atio(isp, (at_entry_t *) ap, (at_entry_t *) outp);
378 break;
379 case RQSTYPE_ATIO2:
375 isp_put_atio2(isp, (at2_entry_t *) ap, (at2_entry_t *) outp);
380 if (IS_2KLOGIN(isp)) {
381 isp_put_atio2e(isp, (at2e_entry_t *) ap, (at2e_entry_t *) outp);
382 } else {
383 isp_put_atio2(isp, (at2_entry_t *) ap, (at2_entry_t *) outp);
384 }
376 break;
377 case RQSTYPE_CTIO:
378 isp_put_ctio(isp, (ct_entry_t *) ap, (ct_entry_t *) outp);
379 break;
380 case RQSTYPE_CTIO2:
385 break;
386 case RQSTYPE_CTIO:
387 isp_put_ctio(isp, (ct_entry_t *) ap, (ct_entry_t *) outp);
388 break;
389 case RQSTYPE_CTIO2:
381 isp_put_ctio2(isp, (ct2_entry_t *) ap, (ct2_entry_t *) outp);
390 if (IS_2KLOGIN(isp)) {
391 isp_put_ctio2e(isp, (ct2e_entry_t *) ap, (ct2e_entry_t *) outp);
392 } else {
393 isp_put_ctio2(isp, (ct2_entry_t *) ap, (ct2_entry_t *) outp);
394 }
382 break;
383 default:
384 isp_prt(isp, ISP_LOGERR,
385 "Unknown type 0x%x in isp_put_entry", etype);
386 return (-1);
387 }
388
389 ISP_TDQE(isp, "isp_target_put_entry", (int) optr, ap);

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

567 notify.nt_ncode = NT_TARGET_RESET;
568 (void) isp_async(isp, ISPASYNC_TARGET_NOTIFY, &notify);
569 break;
570 case ASYNC_CTIO_DONE:
571 {
572 uint8_t storage[QENTRY_LEN];
573 memset(storage, 0, QENTRY_LEN);
574 if (IS_FC(isp)) {
395 break;
396 default:
397 isp_prt(isp, ISP_LOGERR,
398 "Unknown type 0x%x in isp_put_entry", etype);
399 return (-1);
400 }
401
402 ISP_TDQE(isp, "isp_target_put_entry", (int) optr, ap);

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

580 notify.nt_ncode = NT_TARGET_RESET;
581 (void) isp_async(isp, ISPASYNC_TARGET_NOTIFY, &notify);
582 break;
583 case ASYNC_CTIO_DONE:
584 {
585 uint8_t storage[QENTRY_LEN];
586 memset(storage, 0, QENTRY_LEN);
587 if (IS_FC(isp)) {
588 /* This should also suffice for 2K login code */
575 ct2_entry_t *ct = (ct2_entry_t *) storage;
576 ct->ct_header.rqs_entry_type = RQSTYPE_CTIO2;
577 ct->ct_status = CT_OK;
578 ct->ct_syshandle = bus;
579 ct->ct_flags = CT2_SENDSTATUS|CT2_FASTPOST;
580 } else {
581 ct_entry_t *ct = (ct_entry_t *) storage;
582 ct->ct_header.rqs_entry_type = RQSTYPE_CTIO;

--- 705 unchanged lines hidden ---
589 ct2_entry_t *ct = (ct2_entry_t *) storage;
590 ct->ct_header.rqs_entry_type = RQSTYPE_CTIO2;
591 ct->ct_status = CT_OK;
592 ct->ct_syshandle = bus;
593 ct->ct_flags = CT2_SENDSTATUS|CT2_FASTPOST;
594 } else {
595 ct_entry_t *ct = (ct_entry_t *) storage;
596 ct->ct_header.rqs_entry_type = RQSTYPE_CTIO;

--- 705 unchanged lines hidden ---