diff options
author | sos <sos@FreeBSD.org> | 2002-06-19 12:41:05 +0000 |
---|---|---|
committer | sos <sos@FreeBSD.org> | 2002-06-19 12:41:05 +0000 |
commit | d4bc2d8833fec7c40ecb0fefa9227d915f437352 (patch) | |
tree | 121e0a00102dcd42b3ffc58f37a98b68aff712ba /sys/dev/ata/atapi-fd.c | |
parent | 15dd5289b1d0f6a9a64672aa299b596b48546eeb (diff) | |
download | FreeBSD-src-d4bc2d8833fec7c40ecb0fefa9227d915f437352.zip FreeBSD-src-d4bc2d8833fec7c40ecb0fefa9227d915f437352.tar.gz |
Use si_iosize_max to tell the upper layers not to use more
than 32K chunks on ZIP drives instead of deblocking it in
the driver.
Diffstat (limited to 'sys/dev/ata/atapi-fd.c')
-rw-r--r-- | sys/dev/ata/atapi-fd.c | 61 |
1 files changed, 18 insertions, 43 deletions
diff --git a/sys/dev/ata/atapi-fd.c b/sys/dev/ata/atapi-fd.c index 688a8e1..875a4c6 100644 --- a/sys/dev/ata/atapi-fd.c +++ b/sys/dev/ata/atapi-fd.c @@ -69,7 +69,6 @@ static struct cdevsw afddisk_cdevsw; /* prototypes */ static int afd_sense(struct afd_softc *); static void afd_describe(struct afd_softc *); -static int afd_partial_done(struct atapi_request *); static int afd_done(struct atapi_request *); static int afd_eject(struct afd_softc *, int); static int afd_start_stop(struct afd_softc *, int); @@ -101,17 +100,20 @@ afdattach(struct ata_device *atadev) return 0; } - if (!strncmp(atadev->param->model, "IOMEGA ZIP", 10)) - fdp->transfersize = 64; - devstat_add_entry(&fdp->stats, "afd", fdp->lun, DEV_BSIZE, DEVSTAT_NO_ORDERED_TAGS, DEVSTAT_TYPE_DIRECT | DEVSTAT_TYPE_IF_IDE, DEVSTAT_PRIORITY_WFD); dev = disk_create(fdp->lun, &fdp->disk, 0, &afd_cdevsw, &afddisk_cdevsw); dev->si_drv1 = fdp; - dev->si_iosize_max = 252 * DEV_BSIZE; fdp->dev = dev; + + if (!strncmp(atadev->param->model, "IOMEGA ZIP", 10) || + !strncmp(atadev->param->model, "IOMEGA Clik!", 12)) + fdp->dev->si_iosize_max = 64 * DEV_BSIZE; + else + fdp->dev->si_iosize_max = 252 * DEV_BSIZE; + afd_describe(fdp); atadev->flags |= ATA_D_MEDIA_CHANGED; atadev->driver = fdp; @@ -147,7 +149,6 @@ afd_sense(struct afd_softc *fdp) /* The IOMEGA Clik! doesn't support reading the cap page, fake it */ if (!strncmp(fdp->device->param->model, "IOMEGA Clik!", 12)) { - fdp->transfersize = 64; fdp->cap.transfer_rate = 500; fdp->cap.heads = 1; fdp->cap.sectors = 2; @@ -189,8 +190,6 @@ afd_describe(struct afd_softc *fdp) fdp->cap.cylinders, fdp->cap.heads, fdp->cap.sectors, fdp->cap.sector_size); ata_prtdev(fdp->device, "%dKB/s,", fdp->cap.transfer_rate / 8); - if (fdp->transfersize) - printf(" transfer limit %d blks,", fdp->transfersize); printf(" %s\n", ata_mode2str(fdp->device->mode)); if (fdp->cap.medium_type) { ata_prtdev(fdp->device, "Medium: "); @@ -294,6 +293,13 @@ afdstrategy(struct bio *bp) return; } + /* if it's a null transfer, return immediatly. */ + if (bp->bio_bcount == 0) { + bp->bio_resid = 0; + biodone(bp); + return; + } + s = splbio(); bioqdisksort(&fdp->queue, bp); splx(s); @@ -324,7 +330,7 @@ afd_start(struct ata_device *atadev) lba = bp->bio_pblkno; count = bp->bio_bcount / fdp->cap.sector_size; data_ptr = bp->bio_data; - bp->bio_resid = 0; + bp->bio_resid = bp->bio_bcount; bzero(ccb, sizeof(ccb)); @@ -333,26 +339,6 @@ afd_start(struct ata_device *atadev) else ccb[0] = ATAPI_WRITE_BIG; - devstat_start_transaction(&fdp->stats); - - while (fdp->transfersize && (count > fdp->transfersize)) { - ccb[2] = lba>>24; - ccb[3] = lba>>16; - ccb[4] = lba>>8; - ccb[5] = lba; - ccb[7] = fdp->transfersize>>8; - ccb[8] = fdp->transfersize; - - atapi_queue_cmd(fdp->device, ccb, data_ptr, - fdp->transfersize * fdp->cap.sector_size, - (bp->bio_cmd == BIO_READ) ? ATPR_F_READ : 0, 30, - afd_partial_done, bp); - - count -= fdp->transfersize; - lba += fdp->transfersize; - data_ptr += fdp->transfersize * fdp->cap.sector_size; - } - ccb[2] = lba>>24; ccb[3] = lba>>16; ccb[4] = lba>>8; @@ -360,25 +346,14 @@ afd_start(struct ata_device *atadev) ccb[7] = count>>8; ccb[8] = count; + devstat_start_transaction(&fdp->stats); + atapi_queue_cmd(fdp->device, ccb, data_ptr, count * fdp->cap.sector_size, (bp->bio_cmd == BIO_READ) ? ATPR_F_READ : 0, 30, afd_done, bp); } static int -afd_partial_done(struct atapi_request *request) -{ - struct bio *bp = request->driver; - - if (request->error) { - bp->bio_error = request->error; - bp->bio_flags |= BIO_ERROR; - } - bp->bio_resid += request->bytecount; - return 0; -} - -static int afd_done(struct atapi_request *request) { struct bio *bp = request->driver; @@ -389,7 +364,7 @@ afd_done(struct atapi_request *request) bp->bio_flags |= BIO_ERROR; } else - bp->bio_resid += (bp->bio_bcount - request->donecount); + bp->bio_resid = bp->bio_bcount - request->donecount; biofinish(bp, &fdp->stats, 0); return 0; } |