diff options
Diffstat (limited to 'sys/dev/ata')
-rw-r--r-- | sys/dev/ata/ata-disk.c | 38 | ||||
-rw-r--r-- | sys/dev/ata/ata-disk.h | 4 | ||||
-rw-r--r-- | sys/dev/ata/atapi-cd.c | 60 | ||||
-rw-r--r-- | sys/dev/ata/atapi-cd.h | 2 | ||||
-rw-r--r-- | sys/dev/ata/atapi-fd.c | 54 | ||||
-rw-r--r-- | sys/dev/ata/atapi-fd.h | 2 | ||||
-rw-r--r-- | sys/dev/ata/atapi-tape.c | 54 | ||||
-rw-r--r-- | sys/dev/ata/atapi-tape.h | 2 |
8 files changed, 110 insertions, 106 deletions
diff --git a/sys/dev/ata/ata-disk.c b/sys/dev/ata/ata-disk.c index b830046..2f0460f 100644 --- a/sys/dev/ata/ata-disk.c +++ b/sys/dev/ata/ata-disk.c @@ -202,7 +202,7 @@ ad_attach(struct ata_softc *scp, int32_t device) dev->si_iosize_max = 256 * DEV_BSIZE; adp->dev2 = dev; - bufq_init(&adp->queue); + bioq_init(&adp->queue); } void @@ -234,20 +234,20 @@ adopen(dev_t dev, int32_t flags, int32_t fmt, struct proc *p) } static void -adstrategy(struct buf *bp) +adstrategy(struct bio *bp) { - struct ad_softc *adp = bp->b_dev->si_drv1; + struct ad_softc *adp = bp->bio_dev->si_drv1; int32_t s; /* if it's a null transfer, return immediatly. */ - if (bp->b_bcount == 0) { - bp->b_resid = 0; + if (bp->bio_bcount == 0) { + bp->bio_resid = 0; biodone(bp); return; } s = splbio(); - bufqdisksort(&adp->queue, bp); + bioqdisksort(&adp->queue, bp); ata_start(adp->controller); splx(s); } @@ -319,7 +319,7 @@ addump(dev_t dev) void ad_start(struct ad_softc *adp) { - struct buf *bp = bufq_first(&adp->queue); + struct bio *bp = bioq_first(&adp->queue); struct ad_request *request; if (!bp) @@ -334,13 +334,13 @@ ad_start(struct ad_softc *adp) bzero(request, sizeof(struct ad_request)); request->device = adp; request->bp = bp; - request->blockaddr = bp->b_pblkno; - request->bytecount = bp->b_bcount; - request->data = bp->b_data; - request->flags = (bp->b_iocmd == BIO_READ) ? ADR_F_READ : 0; + request->blockaddr = bp->bio_pblkno; + request->bytecount = bp->bio_bcount; + request->data = bp->bio_data; + request->flags = (bp->bio_cmd == BIO_READ) ? ADR_F_READ : 0; /* remove from drive queue */ - bufq_remove(&adp->queue, bp); + bioq_remove(&adp->queue, bp); /* link onto controller queue */ TAILQ_INSERT_TAIL(&adp->controller->ata_queue, request, chain); @@ -538,8 +538,8 @@ oops: /* finish up transfer */ if (request->flags & ADR_F_ERROR) { - request->bp->b_error = EIO; - request->bp->b_ioflags |= BIO_ERROR; + request->bp->bio_error = EIO; + request->bp->bio_flags |= BIO_ERROR; } else { request->bytecount -= request->currentsize; @@ -550,8 +550,8 @@ oops: } } - request->bp->b_resid = request->bytecount; - devstat_end_transaction_buf(&adp->stats, request->bp); + request->bp->bio_resid = request->bytecount; + devstat_end_transaction_bio(&adp->stats, request->bp); biodone(request->bp); /* disarm timeout for this transfer */ @@ -598,9 +598,9 @@ ad_timeout(struct ad_request *request) TAILQ_INSERT_HEAD(&adp->controller->ata_queue, request, chain); else { /* retries all used up, return error */ - request->bp->b_error = EIO; - request->bp->b_ioflags |= BIO_ERROR; - devstat_end_transaction_buf(&adp->stats, request->bp); + request->bp->bio_error = EIO; + request->bp->bio_flags |= BIO_ERROR; + devstat_end_transaction_bio(&adp->stats, request->bp); biodone(request->bp); free(request, M_AD); } diff --git a/sys/dev/ata/ata-disk.h b/sys/dev/ata/ata-disk.h index 91e9fad..4a184d9 100644 --- a/sys/dev/ata/ata-disk.h +++ b/sys/dev/ata/ata-disk.h @@ -44,7 +44,7 @@ struct ad_softc { #define AD_F_32B_ENABLED 0x0004 #define AD_F_TAG_ENABLED 0x0008 - struct buf_queue_head queue; /* head of request queue */ + struct bio_queue_head queue; /* head of request queue */ struct devstat stats; /* devstat entry */ struct disk disk; /* disklabel/slice stuff */ dev_t dev1, dev2; /* device place holder */ @@ -65,7 +65,7 @@ struct ad_request { #define ADR_F_FORCE_PIO 0x0008 int8_t *data; /* pointer to data buf */ - struct buf *bp; /* associated buf ptr */ + struct bio *bp; /* associated bio ptr */ u_int8_t tag; /* tag ID of this request */ TAILQ_ENTRY(ad_request) chain; /* list management */ }; diff --git a/sys/dev/ata/atapi-cd.c b/sys/dev/ata/atapi-cd.c index 61c1795..15a6a2b 100644 --- a/sys/dev/ata/atapi-cd.c +++ b/sys/dev/ata/atapi-cd.c @@ -231,7 +231,7 @@ acd_init_lun(struct atapi_softc *atp, struct devstat *stats) if (!(cdp = malloc(sizeof(struct acd_softc), M_ACD, M_NOWAIT))) return NULL; bzero(cdp, sizeof(struct acd_softc)); - bufq_init(&cdp->buf_queue); + bioq_init(&cdp->bio_queue); cdp->atp = atp; cdp->lun = ata_get_lun(&acd_lun_map); cdp->flags &= ~(F_WRITTEN|F_DISK_OPEN|F_TRACK_OPEN); @@ -1085,23 +1085,23 @@ acdioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flags, struct proc *p) } static void -acdstrategy(struct buf *bp) +acdstrategy(struct bio *bp) { - struct acd_softc *cdp = bp->b_dev->si_drv1; + struct acd_softc *cdp = bp->bio_dev->si_drv1; int32_t s; /* if it's a null transfer, return immediatly. */ - if (bp->b_bcount == 0) { - bp->b_resid = 0; + if (bp->bio_bcount == 0) { + bp->bio_resid = 0; biodone(bp); return; } - bp->b_pblkno = bp->b_blkno; - bp->b_resid = bp->b_bcount; + bp->bio_pblkno = bp->bio_blkno; + bp->bio_resid = bp->bio_bcount; s = splbio(); - bufqdisksort(&cdp->buf_queue, bp); + bioqdisksort(&cdp->bio_queue, bp); ata_start(cdp->atp->controller); splx(s); } @@ -1110,7 +1110,7 @@ void acd_start(struct atapi_softc *atp) { struct acd_softc *cdp = atp->driver; - struct buf *bp = bufq_first(&cdp->buf_queue); + struct bio *bp = bioq_first(&cdp->bio_queue); u_int32_t lba, count; int8_t ccb[16]; @@ -1118,13 +1118,13 @@ acd_start(struct atapi_softc *atp) int i; cdp = cdp->driver[cdp->changer_info->current_slot]; - bp = bufq_first(&cdp->buf_queue); + bp = bioq_first(&cdp->bio_queue); /* check for work pending on any other slot */ for (i = 0; i < cdp->changer_info->slots; i++) { if (i == cdp->changer_info->current_slot) continue; - if (bufq_first(&(cdp->driver[i]->buf_queue))) { + if (bioq_first(&(cdp->driver[i]->bio_queue))) { if (!bp || time_second > (cdp->timestamp + 10)) { acd_select_slot(cdp->driver[i]); return; @@ -1134,29 +1134,33 @@ acd_start(struct atapi_softc *atp) } if (!bp) return; - bufq_remove(&cdp->buf_queue, bp); + bioq_remove(&cdp->bio_queue, bp); /* reject all queued entries if media changed */ if (cdp->atp->flags & ATAPI_F_MEDIA_CHANGED) { - bp->b_error = EIO; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = EIO; + bp->bio_flags |= BIO_ERROR; biodone(bp); return; } bzero(ccb, sizeof(ccb)); - count = (bp->b_bcount + (cdp->block_size - 1)) / cdp->block_size; - if (bp->b_flags & B_PHYS) - lba = bp->b_offset / cdp->block_size; + count = (bp->bio_bcount + (cdp->block_size - 1)) / cdp->block_size; + { + /* XXX Hack until b_offset is always initialized */ + struct buf *bup = (struct buf *)bp; + if (bup->b_flags & B_PHYS) + lba = bup->b_offset / cdp->block_size; else - lba = bp->b_blkno / (cdp->block_size / DEV_BSIZE); + lba = bp->bio_blkno / (cdp->block_size / DEV_BSIZE); + } - if (bp->b_iocmd == BIO_READ) { + if (bp->bio_cmd == BIO_READ) { /* if transfer goes beyond EOM adjust it to be within limits */ if (lba + count > cdp->info.volsize) { /* if we are entirely beyond EOM return EOF */ if ((count = cdp->info.volsize - lba) <= 0) { - bp->b_resid = bp->b_bcount; + bp->bio_resid = bp->bio_bcount; biodone(bp); return; } @@ -1181,26 +1185,26 @@ acd_start(struct atapi_softc *atp) devstat_start_transaction(cdp->stats); - atapi_queue_cmd(cdp->atp, ccb, bp->b_data, count * cdp->block_size, - (bp->b_iocmd == BIO_READ)?ATPR_F_READ : 0, 30, acd_done, bp); + atapi_queue_cmd(cdp->atp, ccb, bp->bio_data, count * cdp->block_size, + (bp->bio_cmd == BIO_READ)?ATPR_F_READ : 0, 30, acd_done, bp); } static int32_t acd_done(struct atapi_request *request) { - struct buf *bp = request->driver; + struct bio *bp = request->driver; struct acd_softc *cdp = request->device->driver; if (request->error) { - bp->b_error = request->error; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = request->error; + bp->bio_flags |= BIO_ERROR; } else { - bp->b_resid = bp->b_bcount - request->donecount; - if (bp->b_iocmd == BIO_WRITE) + bp->bio_resid = bp->bio_bcount - request->donecount; + if (bp->bio_cmd == BIO_WRITE) cdp->flags |= F_WRITTEN; } - devstat_end_transaction_buf(cdp->stats, bp); + devstat_end_transaction_bio(cdp->stats, bp); biodone(bp); return 0; } diff --git a/sys/dev/ata/atapi-cd.h b/sys/dev/ata/atapi-cd.h index eed3647..ca65af2 100644 --- a/sys/dev/ata/atapi-cd.h +++ b/sys/dev/ata/atapi-cd.h @@ -316,7 +316,7 @@ struct acd_softc { #define F_DISK_OPEN 0x0004 /* disk open for writing */ #define F_TRACK_OPEN 0x0008 /* track open for writing */ - struct buf_queue_head buf_queue; /* Queue of i/o requests */ + struct bio_queue_head bio_queue; /* Queue of i/o requests */ struct toc toc; /* table of disc contents */ struct { u_int32_t volsize; /* volume size in blocks */ diff --git a/sys/dev/ata/atapi-fd.c b/sys/dev/ata/atapi-fd.c index 1b7e177..b1e2051 100644 --- a/sys/dev/ata/atapi-fd.c +++ b/sys/dev/ata/atapi-fd.c @@ -91,7 +91,7 @@ afdattach(struct atapi_softc *atp) return -1; } bzero(fdp, sizeof(struct afd_softc)); - bufq_init(&fdp->buf_queue); + bioq_init(&fdp->bio_queue); fdp->atp = atp; fdp->lun = ata_get_lun(&afd_lun_map); @@ -274,20 +274,20 @@ afdioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flag, struct proc *p) } static void -afdstrategy(struct buf *bp) +afdstrategy(struct bio *bp) { - struct afd_softc *fdp = bp->b_dev->si_drv1; + struct afd_softc *fdp = bp->bio_dev->si_drv1; int32_t s; /* if it's a null transfer, return immediatly. */ - if (bp->b_bcount == 0) { - bp->b_resid = 0; + if (bp->bio_bcount == 0) { + bp->bio_resid = 0; biodone(bp); return; } s = splbio(); - bufqdisksort(&fdp->buf_queue, bp); + bioqdisksort(&fdp->bio_queue, bp); ata_start(fdp->atp->controller); splx(s); } @@ -296,7 +296,7 @@ void afd_start(struct atapi_softc *atp) { struct afd_softc *fdp = atp->driver; - struct buf *bp = bufq_first(&fdp->buf_queue); + struct bio *bp = bioq_first(&fdp->bio_queue); u_int32_t lba, count; int8_t ccb[16]; int8_t *data_ptr; @@ -304,24 +304,24 @@ afd_start(struct atapi_softc *atp) if (!bp) return; - bufq_remove(&fdp->buf_queue, bp); + bioq_remove(&fdp->bio_queue, bp); /* should reject all queued entries if media have changed. */ if (fdp->atp->flags & ATAPI_F_MEDIA_CHANGED) { - bp->b_error = EIO; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = EIO; + bp->bio_flags |= BIO_ERROR; biodone(bp); return; } - lba = bp->b_pblkno; - count = bp->b_bcount / fdp->cap.sector_size; - data_ptr = bp->b_data; - bp->b_resid = 0; + lba = bp->bio_pblkno; + count = bp->bio_bcount / fdp->cap.sector_size; + data_ptr = bp->bio_data; + bp->bio_resid = 0; bzero(ccb, sizeof(ccb)); - if (bp->b_iocmd == BIO_READ) + if (bp->bio_cmd == BIO_READ) ccb[0] = ATAPI_READ_BIG; else ccb[0] = ATAPI_WRITE_BIG; @@ -338,7 +338,7 @@ afd_start(struct atapi_softc *atp) atapi_queue_cmd(fdp->atp, ccb, data_ptr, fdp->transfersize * fdp->cap.sector_size, - (bp->b_iocmd == BIO_READ) ? ATPR_F_READ : 0, 30, + (bp->bio_cmd == BIO_READ) ? ATPR_F_READ : 0, 30, afd_partial_done, bp); count -= fdp->transfersize; @@ -354,35 +354,35 @@ afd_start(struct atapi_softc *atp) ccb[8] = count; atapi_queue_cmd(fdp->atp, ccb, data_ptr, count * fdp->cap.sector_size, - (bp->b_iocmd == BIO_READ) ? ATPR_F_READ : 0, 30, afd_done, bp); + (bp->bio_cmd == BIO_READ) ? ATPR_F_READ : 0, 30, afd_done, bp); } static int32_t afd_partial_done(struct atapi_request *request) { - struct buf *bp = request->driver; + struct bio *bp = request->driver; if (request->error) { - bp->b_error = request->error; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = request->error; + bp->bio_flags |= BIO_ERROR; } - bp->b_resid += request->bytecount; + bp->bio_resid += request->bytecount; return 0; } static int32_t afd_done(struct atapi_request *request) { - struct buf *bp = request->driver; + struct bio *bp = request->driver; struct afd_softc *fdp = request->device->driver; - if (request->error || (bp->b_ioflags & BIO_ERROR)) { - bp->b_error = request->error; - bp->b_ioflags |= BIO_ERROR; + if (request->error || (bp->bio_flags & BIO_ERROR)) { + bp->bio_error = request->error; + bp->bio_flags |= BIO_ERROR; } else - bp->b_resid += (bp->b_bcount - request->donecount); - devstat_end_transaction_buf(&fdp->stats, bp); + bp->bio_resid += (bp->bio_bcount - request->donecount); + devstat_end_transaction_bio(&fdp->stats, bp); biodone(bp); return 0; } diff --git a/sys/dev/ata/atapi-fd.h b/sys/dev/ata/atapi-fd.h index b141625..d68474a 100644 --- a/sys/dev/ata/atapi-fd.h +++ b/sys/dev/ata/atapi-fd.h @@ -74,7 +74,7 @@ struct afd_softc { struct atapi_softc *atp; /* controller structure */ int32_t lun; /* logical device unit */ int32_t transfersize; /* max size of each transfer */ - struct buf_queue_head buf_queue; /* queue of i/o requests */ + struct bio_queue_head bio_queue; /* queue of i/o requests */ struct afd_header header; /* capabilities page info */ struct afd_cappage cap; /* capabilities page info */ struct disk disk; /* virtual drives */ diff --git a/sys/dev/ata/atapi-tape.c b/sys/dev/ata/atapi-tape.c index ff895d2..092891f 100644 --- a/sys/dev/ata/atapi-tape.c +++ b/sys/dev/ata/atapi-tape.c @@ -102,7 +102,7 @@ astattach(struct atapi_softc *atp) return -1; } bzero(stp, sizeof(struct ast_softc)); - bufq_init(&stp->buf_queue); + bioq_init(&stp->bio_queue); stp->atp = atp; stp->lun = ata_get_lun(&ast_lun_map); if (ast_sense(stp)) { @@ -410,45 +410,45 @@ astioctl(dev_t dev, u_long cmd, caddr_t addr, int32_t flag, struct proc *p) } static void -aststrategy(struct buf *bp) +aststrategy(struct bio *bp) { - struct ast_softc *stp = bp->b_dev->si_drv1; + struct ast_softc *stp = bp->bio_dev->si_drv1; int32_t s; /* if it's a null transfer, return immediatly. */ - if (bp->b_bcount == 0) { - bp->b_resid = 0; + if (bp->bio_bcount == 0) { + bp->bio_resid = 0; biodone(bp); return; } - if (!(bp->b_iocmd == BIO_READ) && stp->flags & F_WRITEPROTECT) { - bp->b_error = EPERM; - bp->b_ioflags |= BIO_ERROR; + if (!(bp->bio_cmd == BIO_READ) && stp->flags & F_WRITEPROTECT) { + bp->bio_error = EPERM; + bp->bio_flags |= BIO_ERROR; biodone(bp); return; } /* check for != blocksize requests */ - if (bp->b_bcount % stp->blksize) { + if (bp->bio_bcount % stp->blksize) { printf("ast%d: bad request, must be multiple of %d\n", stp->lun, stp->blksize); - bp->b_error = EIO; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = EIO; + bp->bio_flags |= BIO_ERROR; biodone(bp); return; } /* warn about transfers bigger than the device suggests */ - if (bp->b_bcount > stp->blksize * stp->cap.ctl) { + if (bp->bio_bcount > stp->blksize * stp->cap.ctl) { if ((stp->flags & F_CTL_WARN) == 0) { printf("ast%d: WARNING: CTL exceeded %ld>%d\n", - stp->lun, bp->b_bcount, stp->blksize * stp->cap.ctl); + stp->lun, bp->bio_bcount, stp->blksize * stp->cap.ctl); stp->flags |= F_CTL_WARN; } } s = splbio(); - bufq_insert_tail(&stp->buf_queue, bp); + bioq_insert_tail(&stp->bio_queue, bp); ata_start(stp->atp->controller); splx(s); } @@ -457,7 +457,7 @@ void ast_start(struct atapi_softc *atp) { struct ast_softc *stp = atp->driver; - struct buf *bp = bufq_first(&stp->buf_queue); + struct bio *bp = bioq_first(&stp->bio_queue); u_int32_t blkcount; int8_t ccb[16]; @@ -466,13 +466,13 @@ ast_start(struct atapi_softc *atp) bzero(ccb, sizeof(ccb)); - if (bp->b_iocmd == BIO_READ) + if (bp->bio_cmd == BIO_READ) ccb[0] = ATAPI_READ; else ccb[0] = ATAPI_WRITE; - bufq_remove(&stp->buf_queue, bp); - blkcount = bp->b_bcount / stp->blksize; + bioq_remove(&stp->bio_queue, bp); + blkcount = bp->bio_bcount / stp->blksize; ccb[1] = 1; ccb[2] = blkcount>>16; @@ -481,27 +481,27 @@ ast_start(struct atapi_softc *atp) devstat_start_transaction(&stp->stats); - atapi_queue_cmd(stp->atp, ccb, bp->b_data, blkcount * stp->blksize, - (bp->b_iocmd == BIO_READ) ? ATPR_F_READ : 0, 60, ast_done, bp); + atapi_queue_cmd(stp->atp, ccb, bp->bio_data, blkcount * stp->blksize, + (bp->bio_cmd == BIO_READ) ? ATPR_F_READ : 0, 60, ast_done, bp); } static int32_t ast_done(struct atapi_request *request) { - struct buf *bp = request->driver; + struct bio *bp = request->driver; struct ast_softc *stp = request->device->driver; if (request->error) { - bp->b_error = request->error; - bp->b_ioflags |= BIO_ERROR; + bp->bio_error = request->error; + bp->bio_flags |= BIO_ERROR; } else { - if (!(bp->b_iocmd == BIO_READ)) + if (!(bp->bio_cmd == BIO_READ)) stp->flags |= F_DATA_WRITTEN; - bp->b_resid = bp->b_bcount - request->donecount; - ast_total += (bp->b_bcount - bp->b_resid); + bp->bio_resid = bp->bio_bcount - request->donecount; + ast_total += (bp->bio_bcount - bp->bio_resid); } - devstat_end_transaction_buf(&stp->stats, bp); + devstat_end_transaction_bio(&stp->stats, bp); biodone(bp); return 0; } diff --git a/sys/dev/ata/atapi-tape.h b/sys/dev/ata/atapi-tape.h index bccd665..1170579 100644 --- a/sys/dev/ata/atapi-tape.h +++ b/sys/dev/ata/atapi-tape.h @@ -154,7 +154,7 @@ struct ast_softc { #define F_ONSTREAM 0x0100 /* OnStream ADR device */ int32_t blksize; /* block size (512 | 1024) */ - struct buf_queue_head buf_queue; /* queue of i/o requests */ + struct bio_queue_head bio_queue; /* queue of i/o requests */ struct atapi_params *param; /* drive parameters table */ struct ast_cappage cap; /* capabilities page info */ struct devstat stats; /* devstat entry */ |