Deleted Added
full compact
ciss.c (203524) ciss.c (204648)
1/*-
2 * Copyright (c) 2001 Michael Smith
3 * Copyright (c) 2004 Paul Saab
4 * 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:

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

19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
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 *
1/*-
2 * Copyright (c) 2001 Michael Smith
3 * Copyright (c) 2004 Paul Saab
4 * 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:

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

19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
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 * $FreeBSD: head/sys/dev/ciss/ciss.c 203524 2010-02-05 12:40:18Z mav $
27 * $FreeBSD: head/sys/dev/ciss/ciss.c 204648 2010-03-03 17:58:41Z mav $
28 */
29
30/*
31 * Common Interface for SCSI-3 Support driver.
32 *
33 * CISS claims to provide a common interface between a generic SCSI
34 * transport and an intelligent host adapter.
35 *

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

1348 CISS_MAX_LOGICAL);
1349 if (cll == NULL) {
1350 error = ENXIO;
1351 goto out;
1352 }
1353
1354 /* sanity-check reply */
1355 ndrives = (ntohl(cll->list_size) / sizeof(union ciss_device_address));
28 */
29
30/*
31 * Common Interface for SCSI-3 Support driver.
32 *
33 * CISS claims to provide a common interface between a generic SCSI
34 * transport and an intelligent host adapter.
35 *

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

1348 CISS_MAX_LOGICAL);
1349 if (cll == NULL) {
1350 error = ENXIO;
1351 goto out;
1352 }
1353
1354 /* sanity-check reply */
1355 ndrives = (ntohl(cll->list_size) / sizeof(union ciss_device_address));
1356 if ((ndrives < 0) || (ndrives >= CISS_MAX_LOGICAL)) {
1356 if ((ndrives < 0) || (ndrives > CISS_MAX_LOGICAL)) {
1357 ciss_printf(sc, "adapter claims to report absurd number of logical drives (%d > %d)\n",
1358 ndrives, CISS_MAX_LOGICAL);
1359 error = ENXIO;
1360 goto out;
1361 }
1362
1363 /*
1364 * Save logical drive information.

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

2786 int i, maxbus;
2787
2788 debug_called(1);
2789
2790 /*
2791 * Allocate a devq. We can reuse this for the masked physical
2792 * devices if we decide to export these as well.
2793 */
1357 ciss_printf(sc, "adapter claims to report absurd number of logical drives (%d > %d)\n",
1358 ndrives, CISS_MAX_LOGICAL);
1359 error = ENXIO;
1360 goto out;
1361 }
1362
1363 /*
1364 * Save logical drive information.

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

2786 int i, maxbus;
2787
2788 debug_called(1);
2789
2790 /*
2791 * Allocate a devq. We can reuse this for the masked physical
2792 * devices if we decide to export these as well.
2793 */
2794 if ((sc->ciss_cam_devq = cam_simq_alloc(sc->ciss_max_requests)) == NULL) {
2794 if ((sc->ciss_cam_devq = cam_simq_alloc(sc->ciss_max_requests - 2)) == NULL) {
2795 ciss_printf(sc, "can't allocate CAM SIM queue\n");
2796 return(ENOMEM);
2797 }
2798
2799 /*
2800 * Create a SIM.
2801 *
2802 * This naturally wastes a bit of memory. The alternative is to allocate

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

3060
3061 /*
3062 * Get a request to manage this command. If we can't, return the
3063 * ccb, freeze the queue and flag so that we unfreeze it when a
3064 * request completes.
3065 */
3066 if ((error = ciss_get_request(sc, &cr)) != 0) {
3067 xpt_freeze_simq(sim, 1);
2795 ciss_printf(sc, "can't allocate CAM SIM queue\n");
2796 return(ENOMEM);
2797 }
2798
2799 /*
2800 * Create a SIM.
2801 *
2802 * This naturally wastes a bit of memory. The alternative is to allocate

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

3060
3061 /*
3062 * Get a request to manage this command. If we can't, return the
3063 * ccb, freeze the queue and flag so that we unfreeze it when a
3064 * request completes.
3065 */
3066 if ((error = ciss_get_request(sc, &cr)) != 0) {
3067 xpt_freeze_simq(sim, 1);
3068 csio->ccb_h.status |= CAM_RELEASE_SIMQ;
3068 sc->ciss_flags |= CISS_FLAG_BUSY;
3069 csio->ccb_h.status |= CAM_REQUEUE_REQ;
3070 return(error);
3071 }
3072
3073 /*
3074 * Build the command.
3075 */
3076 cc = cr->cr_cc;

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

3270 csio->ccb_h.status |= CAM_REQ_CMP_ERR;
3271 break;
3272 }
3273
3274 /* handle post-command fixup */
3275 ciss_cam_complete_fixup(sc, csio);
3276
3277 ciss_release_request(cr);
3069 csio->ccb_h.status |= CAM_REQUEUE_REQ;
3070 return(error);
3071 }
3072
3073 /*
3074 * Build the command.
3075 */
3076 cc = cr->cr_cc;

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

3270 csio->ccb_h.status |= CAM_REQ_CMP_ERR;
3271 break;
3272 }
3273
3274 /* handle post-command fixup */
3275 ciss_cam_complete_fixup(sc, csio);
3276
3277 ciss_release_request(cr);
3278 if (sc->ciss_flags & CISS_FLAG_BUSY) {
3279 sc->ciss_flags &= ~CISS_FLAG_BUSY;
3280 if (csio->ccb_h.status & CAM_RELEASE_SIMQ)
3281 xpt_release_simq(xpt_path_sim(csio->ccb_h.path), 0);
3282 else
3283 csio->ccb_h.status |= CAM_RELEASE_SIMQ;
3284 }
3278 xpt_done((union ccb *)csio);
3279}
3280
3281/********************************************************************************
3282 * Fix up the result of some commands here.
3283 */
3284static void
3285ciss_cam_complete_fixup(struct ciss_softc *sc, struct ccb_scsiio *csio)

--- 1354 unchanged lines hidden ---
3285 xpt_done((union ccb *)csio);
3286}
3287
3288/********************************************************************************
3289 * Fix up the result of some commands here.
3290 */
3291static void
3292ciss_cam_complete_fixup(struct ciss_softc *sc, struct ccb_scsiio *csio)

--- 1354 unchanged lines hidden ---