Deleted Added
sdiff udiff text old ( 151834 ) new ( 154704 )
full compact
1/*-
2 * Platform (FreeBSD) dependent common attachment code for Qlogic adapters.
3 *
4 * Copyright (c) 1997, 1998, 1999, 2000, 2001 by Matthew Jacob
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice immediately at the beginning of the file, without modification,
11 * this list of conditions, and the following disclaimer.
12 * 2. The name of the author may not be used to endorse or promote products

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

21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 */
27
28#include <sys/cdefs.h>
29__FBSDID("$FreeBSD: head/sys/dev/isp/isp_freebsd.c 151834 2005-10-29 02:46:59Z mjacob $");
30
31#include <dev/isp/isp_freebsd.h>
32#include <sys/unistd.h>
33#include <sys/kthread.h>
34#include <machine/stdarg.h> /* for use by isp_prt below */
35#include <sys/conf.h>
36#include <sys/module.h>
37#include <sys/ioccom.h>

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

502 }
503 retval = EINVAL;
504 break;
505 }
506 case ISP_TSK_MGMT:
507 {
508 int needmarker;
509 struct isp_fc_tsk_mgmt *fct = (struct isp_fc_tsk_mgmt *) addr;
510 mbreg_t mbs;
511
512 if (IS_SCSI(isp)) {
513 retval = EINVAL;
514 break;
515 }
516
517 memset(&mbs, 0, sizeof (mbs));
518 needmarker = retval = 0;
519
520 switch (fct->action) {
521 case CLEAR_ACA:
522 mbs.param[0] = MBOX_CLEAR_ACA;
523 mbs.param[1] = fct->loopid << 8;
524 mbs.param[2] = fct->lun;
525 break;
526 case TARGET_RESET:
527 mbs.param[0] = MBOX_TARGET_RESET;
528 mbs.param[1] = fct->loopid << 8;
529 needmarker = 1;
530 break;
531 case LUN_RESET:
532 mbs.param[0] = MBOX_LUN_RESET;
533 mbs.param[1] = fct->loopid << 8;
534 mbs.param[2] = fct->lun;
535 needmarker = 1;
536 break;
537 case CLEAR_TASK_SET:
538 mbs.param[0] = MBOX_CLEAR_TASK_SET;
539 mbs.param[1] = fct->loopid << 8;
540 mbs.param[2] = fct->lun;
541 needmarker = 1;
542 break;
543 case ABORT_TASK_SET:
544 mbs.param[0] = MBOX_ABORT_TASK_SET;
545 mbs.param[1] = fct->loopid << 8;
546 mbs.param[2] = fct->lun;
547 needmarker = 1;
548 break;
549 default:
550 retval = EINVAL;
551 break;
552 }
553 if (retval == 0) {

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

601static cam_status isp_abort_tgt_ccb(struct ispsoftc *, union ccb *);
602static timeout_t isp_refire_putback_atio;
603static void isp_complete_ctio(union ccb *);
604static void isp_target_putback_atio(union ccb *);
605static cam_status isp_target_start_ctio(struct ispsoftc *, union ccb *);
606static int isp_handle_platform_atio(struct ispsoftc *, at_entry_t *);
607static int isp_handle_platform_atio2(struct ispsoftc *, at2_entry_t *);
608static int isp_handle_platform_ctio(struct ispsoftc *, void *);
609static void isp_handle_platform_ctio_fastpost(struct ispsoftc *, u_int32_t);
610static int isp_handle_platform_notify_scsi(struct ispsoftc *, in_entry_t *);
611static int isp_handle_platform_notify_fc(struct ispsoftc *, in_fcentry_t *);
612
613static INLINE int
614is_lun_enabled(struct ispsoftc *isp, int bus, lun_id_t lun)
615{
616 tstate_t *tptr;
617 tptr = isp->isp_osinfo.lun_hash[LUN_HASH_FUNC(isp, bus, lun)];

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

1791 isp_target_putback_atio(ccb);
1792 } else {
1793 isp_complete_ctio(ccb);
1794
1795 }
1796 return (0);
1797}
1798
1799static void
1800isp_handle_platform_ctio_fastpost(struct ispsoftc *isp, u_int32_t token)
1801{
1802 union ccb *ccb;
1803 ccb = isp_find_xs_tgt(isp, token & 0xffff);
1804 KASSERT((ccb != NULL),
1805 ("null ccb in isp_handle_platform_ctio_fastpost"));
1806 isp_destroy_tgt_handle(isp, token & 0xffff);
1807 isp_prt(isp, ISP_LOGTDEBUG1, "CTIOx[%x] fastpost complete",
1808 token & 0xffff);
1809 isp_complete_ctio(ccb);
1810}
1811
1812static int
1813isp_handle_platform_notify_scsi(struct ispsoftc *isp, in_entry_t *inp)
1814{
1815 return (0); /* XXXX */
1816}
1817
1818static int
1819isp_handle_platform_notify_fc(struct ispsoftc *isp, in_fcentry_t *inp)

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

3076 lp->fc4_type = clp->fc4_type;
3077 lp->node_wwn = clp->node_wwn;
3078 lp->port_wwn = clp->port_wwn;
3079 lp->portid = clp->portid;
3080 lp->fabric_dev = 1;
3081 break;
3082 }
3083#ifdef ISP_TARGET_MODE
3084 case ISPASYNC_TARGET_MESSAGE:
3085 {
3086 tmd_msg_t *mp = arg;
3087 isp_prt(isp, ISP_LOGALL,
3088 "bus %d iid %d tgt %d lun %d ttype %x tval %x msg[0]=%x",
3089 mp->nt_bus, (int) mp->nt_iid, (int) mp->nt_tgt,
3090 (int) mp->nt_lun, mp->nt_tagtype, mp->nt_tagval,
3091 mp->nt_msg[0]);
3092 break;
3093 }
3094 case ISPASYNC_TARGET_EVENT:
3095 {
3096 tmd_event_t *ep = arg;
3097 if (ep->ev_event == ASYNC_CTIO_DONE) {
3098 /*
3099 * ACK the interrupt first
3100 */
3101 ISP_WRITE(isp, BIU_SEMA, 0);
3102 ISP_WRITE(isp, HCCR, HCCR_CMD_CLEAR_RISC_INT);
3103 isp_handle_platform_ctio_fastpost(isp, ep->ev_bus);
3104 break;
3105 }
3106 isp_prt(isp, ISP_LOGALL,
3107 "bus %d event code 0x%x", ep->ev_bus, ep->ev_event);
3108 break;
3109 }
3110 case ISPASYNC_TARGET_ACTION:
3111 switch (((isphdr_t *)arg)->rqs_entry_type) {
3112 default:
3113 isp_prt(isp, ISP_LOGWARN,
3114 "event 0x%x for unhandled target action",
3115 ((isphdr_t *)arg)->rqs_entry_type);
3116 break;
3117 case RQSTYPE_NOTIFY:

--- 85 unchanged lines hidden ---