Deleted Added
full compact
scsi_da.c (163101) scsi_da.c (163834)
1/*-
2 * Implementation of SCSI Direct Access Peripheral driver for CAM.
3 *
4 * Copyright (c) 1997 Justin T. Gibbs.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 13 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>
1/*-
2 * Implementation of SCSI Direct Access Peripheral driver for CAM.
3 *
4 * Copyright (c) 1997 Justin T. Gibbs.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 13 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>
30__FBSDID("$FreeBSD: head/sys/cam/scsi/scsi_da.c 163101 2006-10-07 19:04:23Z flz $");
30__FBSDID("$FreeBSD: head/sys/cam/scsi/scsi_da.c 163834 2006-10-31 21:19:25Z pjd $");
31
32#include <sys/param.h>
33
34#ifdef _KERNEL
35#include <sys/systm.h>
36#include <sys/kernel.h>
37#include <sys/bio.h>
38#include <sys/sysctl.h>

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

1174 softc->disk->d_close = daclose;
1175 softc->disk->d_strategy = dastrategy;
1176 softc->disk->d_dump = dadump;
1177 softc->disk->d_name = "da";
1178 softc->disk->d_drv1 = periph;
1179 softc->disk->d_maxsize = DFLTPHYS; /* XXX: probably not arbitrary */
1180 softc->disk->d_unit = periph->unit_number;
1181 softc->disk->d_flags = DISKFLAG_NEEDSGIANT;
31
32#include <sys/param.h>
33
34#ifdef _KERNEL
35#include <sys/systm.h>
36#include <sys/kernel.h>
37#include <sys/bio.h>
38#include <sys/sysctl.h>

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

1174 softc->disk->d_close = daclose;
1175 softc->disk->d_strategy = dastrategy;
1176 softc->disk->d_dump = dadump;
1177 softc->disk->d_name = "da";
1178 softc->disk->d_drv1 = periph;
1179 softc->disk->d_maxsize = DFLTPHYS; /* XXX: probably not arbitrary */
1180 softc->disk->d_unit = periph->unit_number;
1181 softc->disk->d_flags = DISKFLAG_NEEDSGIANT;
1182 if ((softc->quirks & DA_Q_NO_SYNC_CACHE) == 0)
1183 softc->disk->d_flags |= DISKFLAG_CANFLUSHCACHE;
1182 disk_create(softc->disk, DISK_VERSION);
1183
1184 /*
1185 * Add async callbacks for bus reset and
1186 * bus device reset calls. I don't bother
1187 * checking if this fails as, in most cases,
1188 * the system will function just fine without
1189 * them and the only alternative would be to

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

1245
1246 if ((softc->flags & DA_FLAG_NEED_OTAG) != 0) {
1247 softc->flags &= ~DA_FLAG_NEED_OTAG;
1248 softc->ordered_tag_count++;
1249 tag_code = MSG_ORDERED_Q_TAG;
1250 } else {
1251 tag_code = MSG_SIMPLE_Q_TAG;
1252 }
1184 disk_create(softc->disk, DISK_VERSION);
1185
1186 /*
1187 * Add async callbacks for bus reset and
1188 * bus device reset calls. I don't bother
1189 * checking if this fails as, in most cases,
1190 * the system will function just fine without
1191 * them and the only alternative would be to

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

1247
1248 if ((softc->flags & DA_FLAG_NEED_OTAG) != 0) {
1249 softc->flags &= ~DA_FLAG_NEED_OTAG;
1250 softc->ordered_tag_count++;
1251 tag_code = MSG_ORDERED_Q_TAG;
1252 } else {
1253 tag_code = MSG_SIMPLE_Q_TAG;
1254 }
1253 scsi_read_write(&start_ccb->csio,
1254 /*retries*/da_retry_count,
1255 /*cbfcnp*/dadone,
1256 /*tag_action*/tag_code,
1257 /*read_op*/bp->bio_cmd == BIO_READ,
1258 /*byte2*/0,
1259 softc->minimum_cmd_size,
1260 /*lba*/bp->bio_pblkno,
1261 /*block_count*/bp->bio_bcount /
1262 softc->params.secsize,
1263 /*data_ptr*/ bp->bio_data,
1264 /*dxfer_len*/ bp->bio_bcount,
1265 /*sense_len*/SSD_FULL_SIZE,
1266 /*timeout*/da_default_timeout*1000);
1255 switch (bp->bio_cmd) {
1256 case BIO_READ:
1257 case BIO_WRITE:
1258 scsi_read_write(&start_ccb->csio,
1259 /*retries*/da_retry_count,
1260 /*cbfcnp*/dadone,
1261 /*tag_action*/tag_code,
1262 /*read_op*/bp->bio_cmd == BIO_READ,
1263 /*byte2*/0,
1264 softc->minimum_cmd_size,
1265 /*lba*/bp->bio_pblkno,
1266 /*block_count*/bp->bio_bcount /
1267 softc->params.secsize,
1268 /*data_ptr*/ bp->bio_data,
1269 /*dxfer_len*/ bp->bio_bcount,
1270 /*sense_len*/SSD_FULL_SIZE,
1271 /*timeout*/da_default_timeout*1000);
1272 break;
1273 case BIO_FLUSH:
1274 scsi_synchronize_cache(&start_ccb->csio,
1275 /*retries*/1,
1276 /*cbfcnp*/dadone,
1277 MSG_SIMPLE_Q_TAG,
1278 /*begin_lba*/0,/* Cover the whole disk */
1279 /*lb_count*/0,
1280 SSD_FULL_SIZE,
1281 /*timeout*/da_default_timeout*1000);
1282 break;
1283 }
1267 start_ccb->ccb_h.ccb_state = DA_CCB_BUFFER_IO;
1268
1269 /*
1270 * Block out any asyncronous callbacks
1271 * while we touch the pending ccb list.
1272 */
1273 oldspl = splcam();
1274 LIST_INSERT_HEAD(&softc->pending_ccbs,

--- 769 unchanged lines hidden ---
1284 start_ccb->ccb_h.ccb_state = DA_CCB_BUFFER_IO;
1285
1286 /*
1287 * Block out any asyncronous callbacks
1288 * while we touch the pending ccb list.
1289 */
1290 oldspl = splcam();
1291 LIST_INSERT_HEAD(&softc->pending_ccbs,

--- 769 unchanged lines hidden ---