isp_freebsd.c (292918) | isp_freebsd.c (292921) |
---|---|
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 * 1. Redistributions of source code must retain the above copyright --- 14 unchanged lines hidden (view full) --- 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27/* 28 * Platform (FreeBSD) dependent common attachment code for Qlogic adapters. 29 */ 30#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 * 1. Redistributions of source code must retain the above copyright --- 14 unchanged lines hidden (view full) --- 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27/* 28 * Platform (FreeBSD) dependent common attachment code for Qlogic adapters. 29 */ 30#include <sys/cdefs.h> |
31__FBSDID("$FreeBSD: stable/10/sys/dev/isp/isp_freebsd.c 292918 2015-12-30 11:48:17Z mav $"); | 31__FBSDID("$FreeBSD: stable/10/sys/dev/isp/isp_freebsd.c 292921 2015-12-30 11:49:48Z mav $"); |
32 33#include <dev/isp/isp_freebsd.h> 34#include <sys/unistd.h> 35#include <sys/kthread.h> 36#include <sys/conf.h> 37#include <sys/module.h> 38#include <sys/ioccom.h> 39#include <dev/isp/isp_ioctl.h> --- 1649 unchanged lines hidden (view full) --- 1689 ATPD_GET_SEQNO(cto), ATPD_GET_NCAM(cto), atp->cdb0, cso->scsi_status, cto->ct_flags, cto->ct_resid, cso->dxfer_len, atp->bytes_xfered); 1690 } 1691 1692 if (isp_get_pcmd(isp, ccb)) { 1693 ISP_PATH_PRT(isp, ISP_LOGWARN, ccb->ccb_h.path, "out of PCMDs\n"); 1694 TAILQ_INSERT_HEAD(&tptr->waitq, &ccb->ccb_h, periph_links.tqe); 1695 break; 1696 } | 32 33#include <dev/isp/isp_freebsd.h> 34#include <sys/unistd.h> 35#include <sys/kthread.h> 36#include <sys/conf.h> 37#include <sys/module.h> 38#include <sys/ioccom.h> 39#include <dev/isp/isp_ioctl.h> --- 1649 unchanged lines hidden (view full) --- 1689 ATPD_GET_SEQNO(cto), ATPD_GET_NCAM(cto), atp->cdb0, cso->scsi_status, cto->ct_flags, cto->ct_resid, cso->dxfer_len, atp->bytes_xfered); 1690 } 1691 1692 if (isp_get_pcmd(isp, ccb)) { 1693 ISP_PATH_PRT(isp, ISP_LOGWARN, ccb->ccb_h.path, "out of PCMDs\n"); 1694 TAILQ_INSERT_HEAD(&tptr->waitq, &ccb->ccb_h, periph_links.tqe); 1695 break; 1696 } |
1697 if (isp_allocate_xs_tgt(isp, ccb, &handle)) { | 1697 handle = isp_allocate_handle(isp, ccb, ISP_HANDLE_TARGET); 1698 if (handle == 0) { |
1698 ISP_PATH_PRT(isp, ISP_LOGWARN, ccb->ccb_h.path, "No XFLIST pointers for %s\n", __func__); 1699 TAILQ_INSERT_HEAD(&tptr->waitq, &ccb->ccb_h, periph_links.tqe); 1700 isp_free_pcmd(isp, ccb); 1701 break; 1702 } 1703 atp->bytes_in_transit += xfrlen; 1704 PISP_PCMD(ccb)->datalen = xfrlen; 1705 --- 12 unchanged lines hidden (view full) --- 1718 cto->ct_syshandle = handle; 1719 } else { 1720 ct2_entry_t *cto = (ct2_entry_t *) local; 1721 cto->ct_syshandle = handle; 1722 } 1723 1724 dmaresult = ISP_DMASETUP(isp, cso, (ispreq_t *) local); 1725 if (dmaresult != CMD_QUEUED) { | 1699 ISP_PATH_PRT(isp, ISP_LOGWARN, ccb->ccb_h.path, "No XFLIST pointers for %s\n", __func__); 1700 TAILQ_INSERT_HEAD(&tptr->waitq, &ccb->ccb_h, periph_links.tqe); 1701 isp_free_pcmd(isp, ccb); 1702 break; 1703 } 1704 atp->bytes_in_transit += xfrlen; 1705 PISP_PCMD(ccb)->datalen = xfrlen; 1706 --- 12 unchanged lines hidden (view full) --- 1719 cto->ct_syshandle = handle; 1720 } else { 1721 ct2_entry_t *cto = (ct2_entry_t *) local; 1722 cto->ct_syshandle = handle; 1723 } 1724 1725 dmaresult = ISP_DMASETUP(isp, cso, (ispreq_t *) local); 1726 if (dmaresult != CMD_QUEUED) { |
1726 isp_destroy_tgt_handle(isp, handle); | 1727 isp_destroy_handle(isp, handle); |
1727 isp_free_pcmd(isp, ccb); 1728 if (dmaresult == CMD_EAGAIN) { 1729 TAILQ_INSERT_HEAD(&tptr->waitq, &ccb->ccb_h, periph_links.tqe); 1730 break; 1731 } 1732 ccb->ccb_h.status = CAM_REQ_CMP_ERR; 1733 xpt_done(ccb); 1734 continue; --- 640 unchanged lines hidden (view full) --- 2375 union ccb *ccb; 2376 int sentstatus = 0, ok = 0, notify_cam = 0, resid = 0, failure = 0; 2377 tstate_t *tptr = NULL; 2378 atio_private_data_t *atp = NULL; 2379 int bus; 2380 uint32_t handle, moved_data = 0, data_requested; 2381 2382 handle = ((ct2_entry_t *)arg)->ct_syshandle; | 1728 isp_free_pcmd(isp, ccb); 1729 if (dmaresult == CMD_EAGAIN) { 1730 TAILQ_INSERT_HEAD(&tptr->waitq, &ccb->ccb_h, periph_links.tqe); 1731 break; 1732 } 1733 ccb->ccb_h.status = CAM_REQ_CMP_ERR; 1734 xpt_done(ccb); 1735 continue; --- 640 unchanged lines hidden (view full) --- 2376 union ccb *ccb; 2377 int sentstatus = 0, ok = 0, notify_cam = 0, resid = 0, failure = 0; 2378 tstate_t *tptr = NULL; 2379 atio_private_data_t *atp = NULL; 2380 int bus; 2381 uint32_t handle, moved_data = 0, data_requested; 2382 2383 handle = ((ct2_entry_t *)arg)->ct_syshandle; |
2383 ccb = isp_find_xs_tgt(isp, handle); | 2384 ccb = isp_find_xs(isp, handle); |
2384 if (ccb == NULL) { 2385 isp_print_bytes(isp, "null ccb in isp_handle_platform_ctio", QENTRY_LEN, arg); 2386 return; 2387 } | 2385 if (ccb == NULL) { 2386 isp_print_bytes(isp, "null ccb in isp_handle_platform_ctio", QENTRY_LEN, arg); 2387 return; 2388 } |
2388 isp_destroy_tgt_handle(isp, handle); | 2389 isp_destroy_handle(isp, handle); |
2389 data_requested = PISP_PCMD(ccb)->datalen; 2390 isp_free_pcmd(isp, ccb); 2391 if (isp->isp_nactive) { 2392 isp->isp_nactive--; 2393 } 2394 2395 bus = XS_CHANNEL(ccb); 2396 tptr = get_lun_statep(isp, bus, XS_LUN(ccb)); --- 919 unchanged lines hidden (view full) --- 3316 continue; 3317 3318 /* 3319 * XXX: CLEAN UP AND COMPLETE ANY PENDING COMMANDS FIRST! 3320 */ 3321 for (i = 0; i < isp->isp_maxcmds; i++) { 3322 struct ccb_scsiio *xs; 3323 | 2390 data_requested = PISP_PCMD(ccb)->datalen; 2391 isp_free_pcmd(isp, ccb); 2392 if (isp->isp_nactive) { 2393 isp->isp_nactive--; 2394 } 2395 2396 bus = XS_CHANNEL(ccb); 2397 tptr = get_lun_statep(isp, bus, XS_LUN(ccb)); --- 919 unchanged lines hidden (view full) --- 3317 continue; 3318 3319 /* 3320 * XXX: CLEAN UP AND COMPLETE ANY PENDING COMMANDS FIRST! 3321 */ 3322 for (i = 0; i < isp->isp_maxcmds; i++) { 3323 struct ccb_scsiio *xs; 3324 |
3324 if (!ISP_VALID_HANDLE(isp, isp->isp_xflist[i].handle)) { | 3325 if (ISP_H2HT(isp->isp_xflist[i].handle) != ISP_HANDLE_INITIATOR) { |
3325 continue; 3326 } 3327 if ((xs = isp->isp_xflist[i].cmd) == NULL) { 3328 continue; 3329 } 3330 if (dbidx != XS_TGT(xs)) { 3331 continue; 3332 } --- 1551 unchanged lines hidden --- | 3326 continue; 3327 } 3328 if ((xs = isp->isp_xflist[i].cmd) == NULL) { 3329 continue; 3330 } 3331 if (dbidx != XS_TGT(xs)) { 3332 continue; 3333 } --- 1551 unchanged lines hidden --- |