scsi_cd.c (76322) | scsi_cd.c (76362) |
---|---|
1/* 2 * Copyright (c) 1997 Justin T. Gibbs. 3 * Copyright (c) 1997, 1998, 1999, 2000, 2001 Kenneth D. Merry. 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 * 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) 1997 Justin T. Gibbs. 3 * Copyright (c) 1997, 1998, 1999, 2000, 2001 Kenneth D. Merry. 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 * 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/cam/scsi/scsi_cd.c 76322 2001-05-06 20:00:03Z phk $ | 27 * $FreeBSD: head/sys/cam/scsi/scsi_cd.c 76362 2001-05-08 08:30:48Z phk $ |
28 */ 29/* 30 * Portions of this driver taken from the original FreeBSD cd driver. 31 * Written by Julian Elischer (julian@tfs.com) 32 * for TRW Financial Systems for use under the MACH(2.5) operating system. 33 * 34 * TRW Financial Systems, in accordance with their agreement with Carnegie 35 * Mellon University, makes this software available to CMU to distribute --- 1325 unchanged lines hidden (view full) --- 1361 struct cd_softc *softc; 1362 u_int unit, part; 1363 int s; 1364 1365 unit = dkunit(bp->bio_dev); 1366 part = dkpart(bp->bio_dev); 1367 periph = cam_extend_get(cdperiphs, unit); 1368 if (periph == NULL) { | 28 */ 29/* 30 * Portions of this driver taken from the original FreeBSD cd driver. 31 * Written by Julian Elischer (julian@tfs.com) 32 * for TRW Financial Systems for use under the MACH(2.5) operating system. 33 * 34 * TRW Financial Systems, in accordance with their agreement with Carnegie 35 * Mellon University, makes this software available to CMU to distribute --- 1325 unchanged lines hidden (view full) --- 1361 struct cd_softc *softc; 1362 u_int unit, part; 1363 int s; 1364 1365 unit = dkunit(bp->bio_dev); 1366 part = dkpart(bp->bio_dev); 1367 periph = cam_extend_get(cdperiphs, unit); 1368 if (periph == NULL) { |
1369 bp->bio_error = ENXIO; 1370 goto bad; | 1369 biofinish(bp, NULL, ENXIO); 1370 return; |
1371 } 1372 1373 CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("entering cdstrategy\n")); 1374 1375 softc = (struct cd_softc *)periph->softc; 1376 1377 /* 1378 * Mask interrupts so that the pack cannot be invalidated until 1379 * after we are in the queue. Otherwise, we might not properly 1380 * clean up one of the buffers. 1381 */ 1382 s = splbio(); 1383 1384 /* 1385 * If the device has been made invalid, error out 1386 */ 1387 if ((softc->flags & CD_FLAG_INVALID)) { 1388 splx(s); | 1371 } 1372 1373 CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("entering cdstrategy\n")); 1374 1375 softc = (struct cd_softc *)periph->softc; 1376 1377 /* 1378 * Mask interrupts so that the pack cannot be invalidated until 1379 * after we are in the queue. Otherwise, we might not properly 1380 * clean up one of the buffers. 1381 */ 1382 s = splbio(); 1383 1384 /* 1385 * If the device has been made invalid, error out 1386 */ 1387 if ((softc->flags & CD_FLAG_INVALID)) { 1388 splx(s); |
1389 bp->bio_error = ENXIO; 1390 goto bad; | 1389 biofinish(bp, NULL, ENXIO); 1390 return; |
1391 } 1392 1393 /* 1394 * Place it in the queue of disk activities for this disk 1395 */ 1396 bioqdisksort(&softc->bio_queue, bp); 1397 1398 splx(s); 1399 1400 /* 1401 * Schedule ourselves for performing the work. We do things 1402 * differently for changers. 1403 */ 1404 if ((softc->flags & CD_FLAG_CHANGER) == 0) 1405 xpt_schedule(periph, /* XXX priority */1); 1406 else 1407 cdschedule(periph, /* priority */ 1); 1408 1409 return; | 1391 } 1392 1393 /* 1394 * Place it in the queue of disk activities for this disk 1395 */ 1396 bioqdisksort(&softc->bio_queue, bp); 1397 1398 splx(s); 1399 1400 /* 1401 * Schedule ourselves for performing the work. We do things 1402 * differently for changers. 1403 */ 1404 if ((softc->flags & CD_FLAG_CHANGER) == 0) 1405 xpt_schedule(periph, /* XXX priority */1); 1406 else 1407 cdschedule(periph, /* priority */ 1); 1408 1409 return; |
1410bad: 1411 bp->bio_flags |= BIO_ERROR; 1412 /* 1413 * Correctly set the buf to indicate a completed xfer 1414 */ 1415 bp->bio_resid = bp->bio_bcount; 1416 biodone(bp); 1417 return; | |
1418} 1419 1420static void 1421cdstart(struct cam_periph *periph, union ccb *start_ccb) 1422{ 1423 struct cd_softc *softc; 1424 struct bio *bp; 1425 struct ccb_scsiio *csio; --- 2199 unchanged lines hidden --- | 1410} 1411 1412static void 1413cdstart(struct cam_periph *periph, union ccb *start_ccb) 1414{ 1415 struct cd_softc *softc; 1416 struct bio *bp; 1417 struct ccb_scsiio *csio; --- 2199 unchanged lines hidden --- |