isp_freebsd.c (151834) | isp_freebsd.c (154704) |
---|---|
1/*- 2 * Platform (FreeBSD) dependent common attachment code for Qlogic adapters. 3 * | 1/*- 2 * Platform (FreeBSD) dependent common attachment code for Qlogic adapters. 3 * |
4 * Copyright (c) 1997, 1998, 1999, 2000, 2001 by Matthew Jacob | 4 * Copyright (c) 1997-2006 by Matthew Jacob 5 * All rights reserved. |
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> | 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice immediately at the beginning of the file, without modification, 12 * this list of conditions, and the following disclaimer. 13 * 2. The name of the author may not be used to endorse or promote products --- 8 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 29#include <sys/cdefs.h> |
29__FBSDID("$FreeBSD: head/sys/dev/isp/isp_freebsd.c 151834 2005-10-29 02:46:59Z mjacob $"); | 30__FBSDID("$FreeBSD: head/sys/dev/isp/isp_freebsd.c 154704 2006-01-23 06:23:37Z 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; | 31 32#include <dev/isp/isp_freebsd.h> 33#include <sys/unistd.h> 34#include <sys/kthread.h> 35#include <machine/stdarg.h> /* for use by isp_prt below */ 36#include <sys/conf.h> 37#include <sys/module.h> 38#include <sys/ioccom.h> --- 464 unchanged lines hidden (view full) --- 503 } 504 retval = EINVAL; 505 break; 506 } 507 case ISP_TSK_MGMT: 508 { 509 int needmarker; 510 struct isp_fc_tsk_mgmt *fct = (struct isp_fc_tsk_mgmt *) addr; |
511 u_int16_t loopid; |
|
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; | 512 mbreg_t mbs; 513 514 if (IS_SCSI(isp)) { 515 retval = EINVAL; 516 break; 517 } 518 519 memset(&mbs, 0, sizeof (mbs)); 520 needmarker = retval = 0; |
519 | 521 loopid = fct->loopid; 522 if (IS_2KLOGIN(isp) == 0) { 523 loopid <<= 8; 524 } |
520 switch (fct->action) { 521 case CLEAR_ACA: 522 mbs.param[0] = MBOX_CLEAR_ACA; | 525 switch (fct->action) { 526 case CLEAR_ACA: 527 mbs.param[0] = MBOX_CLEAR_ACA; |
523 mbs.param[1] = fct->loopid << 8; | 528 mbs.param[1] = loopid; |
524 mbs.param[2] = fct->lun; 525 break; 526 case TARGET_RESET: 527 mbs.param[0] = MBOX_TARGET_RESET; | 529 mbs.param[2] = fct->lun; 530 break; 531 case TARGET_RESET: 532 mbs.param[0] = MBOX_TARGET_RESET; |
528 mbs.param[1] = fct->loopid << 8; | 533 mbs.param[1] = loopid; |
529 needmarker = 1; 530 break; 531 case LUN_RESET: 532 mbs.param[0] = MBOX_LUN_RESET; | 534 needmarker = 1; 535 break; 536 case LUN_RESET: 537 mbs.param[0] = MBOX_LUN_RESET; |
533 mbs.param[1] = fct->loopid << 8; | 538 mbs.param[1] = loopid; |
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[2] = fct->lun; 540 needmarker = 1; 541 break; 542 case CLEAR_TASK_SET: 543 mbs.param[0] = MBOX_CLEAR_TASK_SET; |
539 mbs.param[1] = fct->loopid << 8; | 544 mbs.param[1] = loopid; |
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[2] = fct->lun; 546 needmarker = 1; 547 break; 548 case ABORT_TASK_SET: 549 mbs.param[0] = MBOX_ABORT_TASK_SET; |
545 mbs.param[1] = fct->loopid << 8; | 550 mbs.param[1] = loopid; |
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 *); | 551 mbs.param[2] = fct->lun; 552 needmarker = 1; 553 break; 554 default: 555 retval = EINVAL; 556 break; 557 } 558 if (retval == 0) { --- 47 unchanged lines hidden (view full) --- 606static cam_status isp_abort_tgt_ccb(struct ispsoftc *, union ccb *); 607static timeout_t isp_refire_putback_atio; 608static void isp_complete_ctio(union ccb *); 609static void isp_target_putback_atio(union ccb *); 610static cam_status isp_target_start_ctio(struct ispsoftc *, union ccb *); 611static int isp_handle_platform_atio(struct ispsoftc *, at_entry_t *); 612static int isp_handle_platform_atio2(struct ispsoftc *, at2_entry_t *); 613static 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 | 614static int isp_handle_platform_notify_scsi(struct ispsoftc *, in_entry_t *); 615static int isp_handle_platform_notify_fc(struct ispsoftc *, in_fcentry_t *); 616 617static INLINE int 618is_lun_enabled(struct ispsoftc *isp, int bus, lun_id_t lun) 619{ 620 tstate_t *tptr; 621 tptr = isp->isp_osinfo.lun_hash[LUN_HASH_FUNC(isp, bus, lun)]; --- 1173 unchanged lines hidden (view full) --- 1795 isp_target_putback_atio(ccb); 1796 } else { 1797 isp_complete_ctio(ccb); 1798 1799 } 1800 return (0); 1801} 1802 |
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 | 1803static int 1804isp_handle_platform_notify_scsi(struct ispsoftc *isp, in_entry_t *inp) 1805{ 1806 return (0); /* XXXX */ 1807} 1808 1809static int 1810isp_handle_platform_notify_fc(struct ispsoftc *isp, in_fcentry_t *inp) --- 1256 unchanged lines hidden (view full) --- 3067 lp->fc4_type = clp->fc4_type; 3068 lp->node_wwn = clp->node_wwn; 3069 lp->port_wwn = clp->port_wwn; 3070 lp->portid = clp->portid; 3071 lp->fabric_dev = 1; 3072 break; 3073 } 3074#ifdef ISP_TARGET_MODE |
3084 case ISPASYNC_TARGET_MESSAGE: | 3075 case ISPASYNC_TARGET_NOTIFY: |
3085 { | 3076 { |
3086 tmd_msg_t *mp = arg; | 3077 tmd_notify_t *nt = arg; |
3087 isp_prt(isp, ISP_LOGALL, | 3078 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]); | 3079 "target notify code 0x%x", nt->nt_ncode); |
3092 break; 3093 } | 3080 break; 3081 } |
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 --- | 3082 case ISPASYNC_TARGET_ACTION: 3083 switch (((isphdr_t *)arg)->rqs_entry_type) { 3084 default: 3085 isp_prt(isp, ISP_LOGWARN, 3086 "event 0x%x for unhandled target action", 3087 ((isphdr_t *)arg)->rqs_entry_type); 3088 break; 3089 case RQSTYPE_NOTIFY: --- 85 unchanged lines hidden --- |