isp_pci.c (167821) | isp_pci.c (168240) |
---|---|
1/*- 2 * Copyright (c) 1997-2006 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 * PCI specific probe and attach routines for Qlogic ISP SCSI adapters. 28 * FreeBSD Version. 29 */ 30#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1997-2006 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 * PCI specific probe and attach routines for Qlogic ISP SCSI adapters. 28 * FreeBSD Version. 29 */ 30#include <sys/cdefs.h> |
31__FBSDID("$FreeBSD: head/sys/dev/isp/isp_pci.c 167821 2007-03-22 23:38:32Z mjacob $"); | 31__FBSDID("$FreeBSD: head/sys/dev/isp/isp_pci.c 168240 2007-04-02 01:04:20Z mjacob $"); |
32 33#include <sys/param.h> 34#include <sys/systm.h> 35#include <sys/kernel.h> 36#include <sys/module.h> 37#if __FreeBSD_version >= 700000 38#include <sys/linker.h> 39#include <sys/firmware.h> --- 1949 unchanged lines hidden (view full) --- 1989 } else { 1990 sflags = scsi_status = resid = 0; 1991 } 1992 1993 cto->ct_resid = 0; 1994 cto->ct_scsi_status = 0; 1995 1996 pcs = (struct isp_pcisoftc *)isp; | 32 33#include <sys/param.h> 34#include <sys/systm.h> 35#include <sys/kernel.h> 36#include <sys/module.h> 37#if __FreeBSD_version >= 700000 38#include <sys/linker.h> 39#include <sys/firmware.h> --- 1949 unchanged lines hidden (view full) --- 1989 } else { 1990 sflags = scsi_status = resid = 0; 1991 } 1992 1993 cto->ct_resid = 0; 1994 cto->ct_scsi_status = 0; 1995 1996 pcs = (struct isp_pcisoftc *)isp; |
1997 dp = &pcs->dmaps[isp_handle_index(handle)]; | 1997 dp = &pcs->dmaps[isp_handle_index(handle & ISP_HANDLE_MASK)]; |
1998 if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { 1999 bus_dmamap_sync(pcs->dmat, *dp, BUS_DMASYNC_PREREAD); 2000 } else { 2001 bus_dmamap_sync(pcs->dmat, *dp, BUS_DMASYNC_PREWRITE); 2002 } 2003 2004 nxti = *mp->nxtip; 2005 --- 377 unchanged lines hidden (view full) --- 2383 mp->error = EFAULT; 2384 return; 2385 } 2386 2387 csio = mp->cmd_token; 2388 isp = mp->isp; 2389 rq = mp->rq; 2390 pcs = (struct isp_pcisoftc *)mp->isp; | 1998 if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { 1999 bus_dmamap_sync(pcs->dmat, *dp, BUS_DMASYNC_PREREAD); 2000 } else { 2001 bus_dmamap_sync(pcs->dmat, *dp, BUS_DMASYNC_PREWRITE); 2002 } 2003 2004 nxti = *mp->nxtip; 2005 --- 377 unchanged lines hidden (view full) --- 2383 mp->error = EFAULT; 2384 return; 2385 } 2386 2387 csio = mp->cmd_token; 2388 isp = mp->isp; 2389 rq = mp->rq; 2390 pcs = (struct isp_pcisoftc *)mp->isp; |
2391 dp = &pcs->dmaps[isp_handle_index(rq->req_handle)]; | 2391 dp = &pcs->dmaps[isp_handle_index(rq->req_handle & ISP_HANDLE_MASK)]; |
2392 nxti = *mp->nxtip; 2393 2394 if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { 2395 bus_dmamap_sync(pcs->dmat, *dp, BUS_DMASYNC_PREREAD); 2396 } else { 2397 bus_dmamap_sync(pcs->dmat, *dp, BUS_DMASYNC_PREWRITE); 2398 } 2399 datalen = XS_XFRLEN(csio); --- 89 unchanged lines hidden (view full) --- 2489 isp_prt(mp->isp, ISP_LOGERR, "bad segment count (%d)", nseg); 2490 mp->error = EFAULT; 2491 return; 2492 } 2493 csio = mp->cmd_token; 2494 isp = mp->isp; 2495 rq = mp->rq; 2496 pcs = (struct isp_pcisoftc *)mp->isp; | 2392 nxti = *mp->nxtip; 2393 2394 if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { 2395 bus_dmamap_sync(pcs->dmat, *dp, BUS_DMASYNC_PREREAD); 2396 } else { 2397 bus_dmamap_sync(pcs->dmat, *dp, BUS_DMASYNC_PREWRITE); 2398 } 2399 datalen = XS_XFRLEN(csio); --- 89 unchanged lines hidden (view full) --- 2489 isp_prt(mp->isp, ISP_LOGERR, "bad segment count (%d)", nseg); 2490 mp->error = EFAULT; 2491 return; 2492 } 2493 csio = mp->cmd_token; 2494 isp = mp->isp; 2495 rq = mp->rq; 2496 pcs = (struct isp_pcisoftc *)mp->isp; |
2497 dp = &pcs->dmaps[isp_handle_index(rq->req_handle)]; | 2497 dp = &pcs->dmaps[isp_handle_index(rq->req_handle & ISP_HANDLE_MASK)]; |
2498 nxti = *mp->nxtip; 2499 2500 if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { 2501 bus_dmamap_sync(pcs->dmat, *dp, BUS_DMASYNC_PREREAD); 2502 } else { 2503 bus_dmamap_sync(pcs->dmat, *dp, BUS_DMASYNC_PREWRITE); 2504 } 2505 datalen = XS_XFRLEN(csio); --- 117 unchanged lines hidden (view full) --- 2623 isp_prt(mp->isp, ISP_LOGERR, "bad segment count (%d)", nseg); 2624 mp->error = EFAULT; 2625 return; 2626 } 2627 csio = mp->cmd_token; 2628 isp = mp->isp; 2629 rq = mp->rq; 2630 pcs = (struct isp_pcisoftc *)mp->isp; | 2498 nxti = *mp->nxtip; 2499 2500 if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { 2501 bus_dmamap_sync(pcs->dmat, *dp, BUS_DMASYNC_PREREAD); 2502 } else { 2503 bus_dmamap_sync(pcs->dmat, *dp, BUS_DMASYNC_PREWRITE); 2504 } 2505 datalen = XS_XFRLEN(csio); --- 117 unchanged lines hidden (view full) --- 2623 isp_prt(mp->isp, ISP_LOGERR, "bad segment count (%d)", nseg); 2624 mp->error = EFAULT; 2625 return; 2626 } 2627 csio = mp->cmd_token; 2628 isp = mp->isp; 2629 rq = mp->rq; 2630 pcs = (struct isp_pcisoftc *)mp->isp; |
2631 dp = &pcs->dmaps[isp_handle_index(rq->req_handle)]; | 2631 dp = &pcs->dmaps[isp_handle_index(rq->req_handle & ISP_HANDLE_MASK)]; |
2632 nxti = *mp->nxtip; 2633 2634 if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { 2635 bus_dmamap_sync(pcs->dmat, *dp, BUS_DMASYNC_PREREAD); 2636 } else { 2637 bus_dmamap_sync(pcs->dmat, *dp, BUS_DMASYNC_PREWRITE); 2638 } 2639 --- 150 unchanged lines hidden (view full) --- 2790 mp->nxtip = nxtip; 2791 mp->optr = optr; 2792 mp->error = 0; 2793 2794 ISPLOCK_2_CAMLOCK(isp); 2795 if ((csio->ccb_h.flags & CAM_SCATTER_VALID) == 0) { 2796 if ((csio->ccb_h.flags & CAM_DATA_PHYS) == 0) { 2797 int error, s; | 2632 nxti = *mp->nxtip; 2633 2634 if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { 2635 bus_dmamap_sync(pcs->dmat, *dp, BUS_DMASYNC_PREREAD); 2636 } else { 2637 bus_dmamap_sync(pcs->dmat, *dp, BUS_DMASYNC_PREWRITE); 2638 } 2639 --- 150 unchanged lines hidden (view full) --- 2790 mp->nxtip = nxtip; 2791 mp->optr = optr; 2792 mp->error = 0; 2793 2794 ISPLOCK_2_CAMLOCK(isp); 2795 if ((csio->ccb_h.flags & CAM_SCATTER_VALID) == 0) { 2796 if ((csio->ccb_h.flags & CAM_DATA_PHYS) == 0) { 2797 int error, s; |
2798 dp = &pcs->dmaps[isp_handle_index(rq->req_handle)]; | 2798 dp = &pcs->dmaps[isp_handle_index( 2799 rq->req_handle & ISP_HANDLE_MASK)]; |
2799 s = splsoftvm(); 2800 error = bus_dmamap_load(pcs->dmat, *dp, 2801 csio->data_ptr, csio->dxfer_len, eptr, mp, 0); 2802 if (error == EINPROGRESS) { 2803 bus_dmamap_unload(pcs->dmat, *dp); 2804 mp->error = EINVAL; 2805 isp_prt(isp, ISP_LOGERR, 2806 "deferred dma allocation not supported"); --- 68 unchanged lines hidden (view full) --- 2875 } 2876 return (CMD_QUEUED); 2877} 2878 2879static void 2880isp_pci_dmateardown(ispsoftc_t *isp, XS_T *xs, uint32_t handle) 2881{ 2882 struct isp_pcisoftc *pcs = (struct isp_pcisoftc *)isp; | 2800 s = splsoftvm(); 2801 error = bus_dmamap_load(pcs->dmat, *dp, 2802 csio->data_ptr, csio->dxfer_len, eptr, mp, 0); 2803 if (error == EINPROGRESS) { 2804 bus_dmamap_unload(pcs->dmat, *dp); 2805 mp->error = EINVAL; 2806 isp_prt(isp, ISP_LOGERR, 2807 "deferred dma allocation not supported"); --- 68 unchanged lines hidden (view full) --- 2876 } 2877 return (CMD_QUEUED); 2878} 2879 2880static void 2881isp_pci_dmateardown(ispsoftc_t *isp, XS_T *xs, uint32_t handle) 2882{ 2883 struct isp_pcisoftc *pcs = (struct isp_pcisoftc *)isp; |
2883 bus_dmamap_t *dp = &pcs->dmaps[isp_handle_index(handle)]; | 2884 bus_dmamap_t *dp; 2885 dp = &pcs->dmaps[isp_handle_index(handle & ISP_HANDLE_MASK)]; |
2884 if ((xs->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { 2885 bus_dmamap_sync(pcs->dmat, *dp, BUS_DMASYNC_POSTREAD); 2886 } else { 2887 bus_dmamap_sync(pcs->dmat, *dp, BUS_DMASYNC_POSTWRITE); 2888 } 2889 bus_dmamap_unload(pcs->dmat, *dp); 2890} 2891 --- 56 unchanged lines hidden --- | 2886 if ((xs->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { 2887 bus_dmamap_sync(pcs->dmat, *dp, BUS_DMASYNC_POSTREAD); 2888 } else { 2889 bus_dmamap_sync(pcs->dmat, *dp, BUS_DMASYNC_POSTWRITE); 2890 } 2891 bus_dmamap_unload(pcs->dmat, *dp); 2892} 2893 --- 56 unchanged lines hidden --- |