summaryrefslogtreecommitdiffstats
path: root/sys/pc98
diff options
context:
space:
mode:
Diffstat (limited to 'sys/pc98')
-rw-r--r--sys/pc98/cbus/fdc.c151
-rw-r--r--sys/pc98/i386/machdep.c36
-rw-r--r--sys/pc98/pc98/diskslice_machdep.c2
-rw-r--r--sys/pc98/pc98/fd.c151
-rw-r--r--sys/pc98/pc98/machdep.c36
-rw-r--r--sys/pc98/pc98/wd.c142
-rw-r--r--sys/pc98/pc98/wd_cd.c68
-rw-r--r--sys/pc98/pc98/wd_cd.h2
8 files changed, 291 insertions, 297 deletions
diff --git a/sys/pc98/cbus/fdc.c b/sys/pc98/cbus/fdc.c
index aed6c6f..daec257c 100644
--- a/sys/pc98/cbus/fdc.c
+++ b/sys/pc98/cbus/fdc.c
@@ -91,9 +91,6 @@
#include <isa/rtc.h>
#endif
-/* misuse a flag to identify format operation */
-#define B_FORMAT B_XXX
-
/* configuration flags */
#define FDC_PRETEND_D0 (1 << 0) /* pretend drive 0 to be there */
#define FDC_NO_FIFO (1 << 2) /* do not enable FIFO */
@@ -1072,7 +1069,7 @@ fdc_attach(device_t dev)
/* reset controller, turn motor off, clear fdout mirror reg */
fdout_wr(fdc, ((fdc->fdout = 0)));
#endif
- bufq_init(&fdc->head);
+ bioq_init(&fdc->head);
/*
* Probe and attach any children. We should probably detect
@@ -1774,7 +1771,7 @@ fdclose(dev_t dev, int flags, int mode, struct proc *p)
/* fdstrategy */
/****************************************************************************/
void
-fdstrategy(struct buf *bp)
+fdstrategy(struct bio *bp)
{
unsigned nblocks, blknum, cando;
int s;
@@ -1783,31 +1780,31 @@ fdstrategy(struct buf *bp)
fd_p fd;
size_t fdblk;
- fdu = FDUNIT(minor(bp->b_dev));
+ fdu = FDUNIT(minor(bp->bio_dev));
fd = devclass_get_softc(fd_devclass, fdu);
if (fd == 0)
panic("fdstrategy: buf for nonexistent device (%#lx, %#lx)",
- (u_long)major(bp->b_dev), (u_long)minor(bp->b_dev));
+ (u_long)major(bp->bio_dev), (u_long)minor(bp->bio_dev));
fdc = fd->fdc;
if (fd->type == NO_TYPE) {
- bp->b_error = ENXIO;
- bp->b_ioflags |= BIO_ERROR;
+ bp->bio_error = ENXIO;
+ bp->bio_flags |= BIO_ERROR;
goto bad;
};
fdblk = 128 << (fd->ft->secsize);
- if (!(bp->b_flags & B_FORMAT)) {
- if (bp->b_blkno < 0) {
+ if (!(bp->bio_cmd & BIO_FORMAT)) {
+ if (bp->bio_blkno < 0) {
printf(
"fd%d: fdstrat: bad request blkno = %lu, bcount = %ld\n",
- fdu, (u_long)bp->b_blkno, bp->b_bcount);
- bp->b_error = EINVAL;
- bp->b_ioflags |= BIO_ERROR;
+ fdu, (u_long)bp->bio_blkno, bp->bio_bcount);
+ bp->bio_error = EINVAL;
+ bp->bio_flags |= BIO_ERROR;
goto bad;
}
- if ((bp->b_bcount % fdblk) != 0) {
- bp->b_error = EINVAL;
- bp->b_ioflags |= BIO_ERROR;
+ if ((bp->bio_bcount % fdblk) != 0) {
+ bp->bio_error = EINVAL;
+ bp->bio_flags |= BIO_ERROR;
goto bad;
}
}
@@ -1815,33 +1812,33 @@ fdstrategy(struct buf *bp)
/*
* Set up block calculations.
*/
- if (bp->b_blkno > 20000000) {
+ if (bp->bio_blkno > 20000000) {
/*
* Reject unreasonably high block number, prevent the
* multiplication below from overflowing.
*/
- bp->b_error = EINVAL;
- bp->b_ioflags |= BIO_ERROR;
+ bp->bio_error = EINVAL;
+ bp->bio_flags |= BIO_ERROR;
goto bad;
}
- blknum = (unsigned) bp->b_blkno * DEV_BSIZE/fdblk;
+ blknum = (unsigned) bp->bio_blkno * DEV_BSIZE/fdblk;
nblocks = fd->ft->size;
- bp->b_resid = 0;
- if (blknum + (bp->b_bcount / fdblk) > nblocks) {
+ bp->bio_resid = 0;
+ if (blknum + (bp->bio_bcount / fdblk) > nblocks) {
if (blknum <= nblocks) {
cando = (nblocks - blknum) * fdblk;
- bp->b_resid = bp->b_bcount - cando;
+ bp->bio_resid = bp->bio_bcount - cando;
if (cando == 0)
goto bad; /* not actually bad but EOF */
} else {
- bp->b_error = EINVAL;
- bp->b_ioflags |= BIO_ERROR;
+ bp->bio_error = EINVAL;
+ bp->bio_flags |= BIO_ERROR;
goto bad;
}
}
- bp->b_pblkno = bp->b_blkno;
+ bp->bio_pblkno = bp->bio_blkno;
s = splbio();
- bufqdisksort(&fdc->head, bp);
+ bioqdisksort(&fdc->head, bp);
untimeout(fd_turnoff, fd, fd->toffhandle); /* a good idea */
/* Tell devstat we are starting on the transaction */
@@ -1974,15 +1971,15 @@ fdstate(fdc_p fdc)
unsigned blknum = 0, b_cylinder = 0;
fdu_t fdu = fdc->fdu;
fd_p fd;
- register struct buf *bp;
+ register struct bio *bp;
struct fd_formb *finfo = NULL;
size_t fdblk;
bp = fdc->bp;
if (bp == NULL) {
- bp = bufq_first(&fdc->head);
+ bp = bioq_first(&fdc->head);
if (bp != NULL) {
- bufq_remove(&fdc->head, bp);
+ bioq_remove(&fdc->head, bp);
fdc->bp = bp;
}
}
@@ -2001,24 +1998,24 @@ fdstate(fdc_p fdc)
TRACE1("[fdc%d IDLE]", fdc->fdcu);
return (0);
}
- fdu = FDUNIT(minor(bp->b_dev));
+ fdu = FDUNIT(minor(bp->bio_dev));
fd = devclass_get_softc(fd_devclass, fdu);
fdblk = 128 << fd->ft->secsize;
if (fdc->fd && (fd != fdc->fd))
device_printf(fd->dev, "confused fd pointers\n");
- read = bp->b_iocmd == BIO_READ;
+ read = bp->bio_cmd == BIO_READ;
if (read)
idf = ISADMA_READ;
else
idf = ISADMA_WRITE;
- format = bp->b_flags & B_FORMAT;
+ format = bp->bio_cmd & BIO_FORMAT;
if (format) {
- finfo = (struct fd_formb *)bp->b_data;
+ finfo = (struct fd_formb *)bp->bio_data;
fd->skip = (char *)&(finfo->fd_formb_cylno(0))
- (char *)finfo;
}
if (fdc->state == DOSEEK || fdc->state == SEEKCOMPLETE) {
- blknum = (unsigned) bp->b_pblkno * DEV_BSIZE/fdblk +
+ blknum = (unsigned) bp->bio_pblkno * DEV_BSIZE/fdblk +
fd->skip/fdblk;
b_cylinder = blknum / (fd->ft->sectrac * fd->ft->heads);
}
@@ -2205,8 +2202,8 @@ fdstate(fdc_p fdc)
if (fdu != nrdu) {
#endif /* EPSON_NRDISK */
if (!(fdc->flags & FDC_NODMA))
- isa_dmastart(idf, bp->b_data+fd->skip,
- format ? bp->b_bcount : fdblk, fdc->dmachan);
+ isa_dmastart(idf, bp->bio_data+fd->skip,
+ format ? bp->bio_bcount : fdblk, fdc->dmachan);
sectrac = fd->ft->sectrac;
sec = blknum % (sectrac * fd->ft->heads);
head = sec / sectrac;
@@ -2221,8 +2218,8 @@ fdstate(fdc_p fdc)
/* stuck controller? */
if (!(fdc->flags & FDC_NODMA))
isa_dmadone(idf,
- bp->b_data + fd->skip,
- format ? bp->b_bcount : fdblk,
+ bp->bio_data + fd->skip,
+ format ? bp->bio_bcount : fdblk,
fdc->dmachan);
fdc->retry = 6; /* reset the beast */
return (retrier(fdc));
@@ -2262,11 +2259,11 @@ fdstate(fdc_p fdc)
*
* Umpf.
*/
- SET_BCDR(fdc, 1, bp->b_bcount, 0);
+ SET_BCDR(fdc, 1, bp->bio_bcount, 0);
- (void)fdcpio(fdc,bp->b_iocmd,
- bp->b_data+fd->skip,
- bp->b_bcount);
+ (void)fdcpio(fdc,bp->bio_cmd,
+ bp->bio_data+fd->skip,
+ bp->bio_bcount);
}
/* formatting */
@@ -2278,8 +2275,8 @@ fdstate(fdc_p fdc)
/* controller fell over */
if (!(fdc->flags & FDC_NODMA))
isa_dmadone(idf,
- bp->b_data + fd->skip,
- format ? bp->b_bcount : fdblk,
+ bp->bio_data + fd->skip,
+ format ? bp->bio_bcount : fdblk,
fdc->dmachan);
fdc->retry = 6;
return (retrier(fdc));
@@ -2297,8 +2294,8 @@ fdstate(fdc_p fdc)
* the WRITE command is sent
*/
if (!read)
- (void)fdcpio(fdc,bp->b_iocmd,
- bp->b_data+fd->skip,
+ (void)fdcpio(fdc,bp->bio_cmd,
+ bp->bio_data+fd->skip,
fdblk);
}
if (fd_cmd(fdc, 9,
@@ -2315,8 +2312,8 @@ fdstate(fdc_p fdc)
/* the beast is sleeping again */
if (!(fdc->flags & FDC_NODMA))
isa_dmadone(idf,
- bp->b_data + fd->skip,
- format ? bp->b_bcount : fdblk,
+ bp->bio_data + fd->skip,
+ format ? bp->bio_bcount : fdblk,
fdc->dmachan);
fdc->retry = 6;
return (retrier(fdc));
@@ -2327,8 +2324,8 @@ fdstate(fdc_p fdc)
* if this is a read, then simply await interrupt
* before performing PIO
*/
- if (read && !fdcpio(fdc,bp->b_iocmd,
- bp->b_data+fd->skip,fdblk)) {
+ if (read && !fdcpio(fdc,bp->bio_cmd,
+ bp->bio_data+fd->skip,fdblk)) {
fd->tohandle = timeout(fd_iotimeout, fdc, hz);
return(0); /* will return later */
};
@@ -2349,11 +2346,11 @@ fdstate(fdc_p fdc)
nrd_addrset(fdblk * nrdblkn);
while (!nrd_check_ready()) DELAY(1);
if (read) epson_insw(P_NRD_DATA,
- bp->b_data + fd->skip,
+ bp->bio_data + fd->skip,
fdblk / sizeof(short));
else epson_outsw(P_NRD_DATA,
- bp->b_data + fd->skip,
- (format ? bp->b_bcount : fdblk)
+ bp->bio_data + fd->skip,
+ (format ? bp->bio_bcount : fdblk)
/ sizeof(short));
blknum = (unsigned long)bp->b_blkno*DEV_BSIZE/fdblk
@@ -2375,7 +2372,7 @@ fdstate(fdc_p fdc)
* actually perform the PIO read. The IOCOMPLETE case
* removes the timeout for us.
*/
- (void)fdcpio(fdc,bp->b_iocmd,bp->b_data+fd->skip,fdblk);
+ (void)fdcpio(fdc,bp->bio_cmd,bp->bio_data+fd->skip,fdblk);
fdc->state = IOCOMPLETE;
/* FALLTHROUGH */
case IOCOMPLETE: /* IO DONE, post-analyze */
@@ -2388,8 +2385,8 @@ fdstate(fdc_p fdc)
if (fd_read_status(fdc, fd->fdsu)) {
if (!(fdc->flags & FDC_NODMA))
- isa_dmadone(idf, bp->b_data + fd->skip,
- format ? bp->b_bcount : fdblk,
+ isa_dmadone(idf, bp->bio_data + fd->skip,
+ format ? bp->bio_bcount : fdblk,
fdc->dmachan);
if (fdc->retry < 6)
fdc->retry = 6; /* force a reset */
@@ -2405,8 +2402,8 @@ fdstate(fdc_p fdc)
if (fdu != nrdu) {
#endif /* EPSON_NRDISK */
if (!(fdc->flags & FDC_NODMA))
- isa_dmadone(idf, bp->b_data + fd->skip,
- format ? bp->b_bcount : fdblk, fdc->dmachan);
+ isa_dmadone(idf, bp->bio_data + fd->skip,
+ format ? bp->bio_bcount : fdblk, fdc->dmachan);
#ifdef EPSON_NRDISK
}
else nrd_LED_off();
@@ -2435,7 +2432,7 @@ fdstate(fdc_p fdc)
}
/* All OK */
fd->skip += fdblk;
- if (!format && fd->skip < bp->b_bcount - bp->b_resid) {
+ if (!format && fd->skip < bp->bio_bcount - bp->bio_resid) {
/* set up next transfer */
fdc->state = DOSEEK;
} else {
@@ -2443,7 +2440,7 @@ fdstate(fdc_p fdc)
fd->skip = 0;
fdc->bp = NULL;
device_unbusy(fd->dev);
- devstat_end_transaction_buf(&fd->device_stats, bp);
+ devstat_end_transaction_bio(&fd->device_stats, bp);
biodone(bp);
fdc->fd = (fd_p) 0;
fdc->fdu = -1;
@@ -2563,14 +2560,14 @@ fdstate(fdc_p fdc)
static int
retrier(struct fdc_data *fdc)
{
- register struct buf *bp;
+ register struct bio *bp;
struct fd_data *fd;
int fdu;
bp = fdc->bp;
/* XXX shouldn't this be cached somewhere? */
- fdu = FDUNIT(minor(bp->b_dev));
+ fdu = FDUNIT(minor(bp->bio_dev));
fd = devclass_get_softc(fd_devclass, fdu);
if (fd->options & FDOPT_NORETRY)
goto fail;
@@ -2590,14 +2587,14 @@ retrier(struct fdc_data *fdc)
default:
fail:
{
- dev_t sav_b_dev = bp->b_dev;
+ dev_t sav_b_dev = bp->bio_dev;
/* Trick diskerr */
- bp->b_dev = makedev(major(bp->b_dev),
- (FDUNIT(minor(bp->b_dev))<<3)|RAW_PART);
+ bp->bio_dev = makedev(major(bp->bio_dev),
+ (FDUNIT(minor(bp->bio_dev))<<3)|RAW_PART);
diskerr(bp, "hard error", LOG_PRINTF,
fdc->fd->skip / DEV_BSIZE,
(struct disklabel *)NULL);
- bp->b_dev = sav_b_dev;
+ bp->bio_dev = sav_b_dev;
if (fdc->flags & FDC_STAT_VALID)
{
printf(
@@ -2611,13 +2608,13 @@ retrier(struct fdc_data *fdc)
else
printf(" (No status)\n");
}
- bp->b_ioflags |= BIO_ERROR;
- bp->b_error = EIO;
- bp->b_resid += bp->b_bcount - fdc->fd->skip;
+ bp->bio_flags |= BIO_ERROR;
+ bp->bio_error = EIO;
+ bp->bio_resid += bp->bio_bcount - fdc->fd->skip;
fdc->bp = NULL;
fdc->fd->skip = 0;
device_unbusy(fd->dev);
- devstat_end_transaction_buf(&fdc->fd->device_stats, bp);
+ devstat_end_transaction_bio(&fdc->fd->device_stats, bp);
biodone(bp);
fdc->state = FINDWORK;
fdc->flags |= FDC_NEEDS_RESET;
@@ -2647,7 +2644,7 @@ fdformat(dev, finfo, p)
fdblk = 128 << fd->ft->secsize;
/* set up a buffer header for fdstrategy() */
- bp = (struct buf *)malloc(sizeof(struct buf), M_TEMP, M_NOWAIT);
+ bp = (struct buf *)malloc(sizeof(struct bio), M_TEMP, M_NOWAIT);
if(bp == 0)
return ENOBUFS;
/*
@@ -2657,8 +2654,8 @@ fdformat(dev, finfo, p)
bzero((void *)bp, sizeof(struct buf));
BUF_LOCKINIT(bp);
BUF_LOCK(bp, LK_EXCLUSIVE);
- bp->b_flags = B_PHYS | B_FORMAT;
- bp->b_iocmd = BIO_WRITE;
+ bp->b_flags = B_PHYS;
+ bp->b_iocmd = BIO_FORMAT;
/*
* calculate a fake blkno, so fdstrategy() would initiate a
@@ -2687,9 +2684,9 @@ fdformat(dev, finfo, p)
/* timed out */
rv = EIO;
device_unbusy(fd->dev);
- biodone(bp);
+ bufdone(bp);
}
- if (bp->b_ioflags & BIO_ERROR)
+ if (bp->b_flags & BIO_ERROR)
rv = bp->b_error;
/*
* allow the process to be swapped
diff --git a/sys/pc98/i386/machdep.c b/sys/pc98/i386/machdep.c
index 61056d0..8e253bd 100644
--- a/sys/pc98/i386/machdep.c
+++ b/sys/pc98/i386/machdep.c
@@ -2658,54 +2658,54 @@ Debugger(const char *msg)
* if needed, and signal errors or early completion.
*/
int
-bounds_check_with_label(struct buf *bp, struct disklabel *lp, int wlabel)
+bounds_check_with_label(struct bio *bp, struct disklabel *lp, int wlabel)
{
- struct partition *p = lp->d_partitions + dkpart(bp->b_dev);
+ struct partition *p = lp->d_partitions + dkpart(bp->bio_dev);
int labelsect = lp->d_partitions[0].p_offset;
int maxsz = p->p_size,
- sz = (bp->b_bcount + DEV_BSIZE - 1) >> DEV_BSHIFT;
+ sz = (bp->bio_bcount + DEV_BSIZE - 1) >> DEV_BSHIFT;
/* overwriting disk label ? */
/* XXX should also protect bootstrap in first 8K */
- if (bp->b_blkno + p->p_offset <= LABELSECTOR + labelsect &&
+ if (bp->bio_blkno + p->p_offset <= LABELSECTOR + labelsect &&
#if LABELSECTOR != 0
- bp->b_blkno + p->p_offset + sz > LABELSECTOR + labelsect &&
+ bp->bio_blkno + p->p_offset + sz > LABELSECTOR + labelsect &&
#endif
- (bp->b_iocmd == BIO_WRITE) && wlabel == 0) {
- bp->b_error = EROFS;
+ (bp->bio_cmd == BIO_WRITE) && wlabel == 0) {
+ bp->bio_error = EROFS;
goto bad;
}
#if defined(DOSBBSECTOR) && defined(notyet)
/* overwriting master boot record? */
- if (bp->b_blkno + p->p_offset <= DOSBBSECTOR &&
- (bp->b_iocmd == BIO_WRITE) && wlabel == 0) {
- bp->b_error = EROFS;
+ if (bp->bio_blkno + p->p_offset <= DOSBBSECTOR &&
+ (bp->bio_cmd == BIO_WRITE) && wlabel == 0) {
+ bp->bio_error = EROFS;
goto bad;
}
#endif
/* beyond partition? */
- if (bp->b_blkno < 0 || bp->b_blkno + sz > maxsz) {
+ if (bp->bio_blkno < 0 || bp->bio_blkno + sz > maxsz) {
/* if exactly at end of disk, return an EOF */
- if (bp->b_blkno == maxsz) {
- bp->b_resid = bp->b_bcount;
+ if (bp->bio_blkno == maxsz) {
+ bp->bio_resid = bp->bio_bcount;
return(0);
}
/* or truncate if part of it fits */
- sz = maxsz - bp->b_blkno;
+ sz = maxsz - bp->bio_blkno;
if (sz <= 0) {
- bp->b_error = EINVAL;
+ bp->bio_error = EINVAL;
goto bad;
}
- bp->b_bcount = sz << DEV_BSHIFT;
+ bp->bio_bcount = sz << DEV_BSHIFT;
}
- bp->b_pblkno = bp->b_blkno + p->p_offset;
+ bp->bio_pblkno = bp->bio_blkno + p->p_offset;
return(1);
bad:
- bp->b_ioflags |= BIO_ERROR;
+ bp->bio_flags |= BIO_ERROR;
return(-1);
}
diff --git a/sys/pc98/pc98/diskslice_machdep.c b/sys/pc98/pc98/diskslice_machdep.c
index ac66299..a829592 100644
--- a/sys/pc98/pc98/diskslice_machdep.c
+++ b/sys/pc98/pc98/diskslice_machdep.c
@@ -250,7 +250,7 @@ reread_mbr:
#endif
DEV_STRATEGY(bp, 1);
if (biowait(bp) != 0) {
- diskerr(bp, "reading primary partition table: error",
+ diskerr(&bp->b_io, "reading primary partition table: error",
LOG_PRINTF, 0, (struct disklabel *)NULL);
printf("\n");
error = EIO;
diff --git a/sys/pc98/pc98/fd.c b/sys/pc98/pc98/fd.c
index aed6c6f..daec257c 100644
--- a/sys/pc98/pc98/fd.c
+++ b/sys/pc98/pc98/fd.c
@@ -91,9 +91,6 @@
#include <isa/rtc.h>
#endif
-/* misuse a flag to identify format operation */
-#define B_FORMAT B_XXX
-
/* configuration flags */
#define FDC_PRETEND_D0 (1 << 0) /* pretend drive 0 to be there */
#define FDC_NO_FIFO (1 << 2) /* do not enable FIFO */
@@ -1072,7 +1069,7 @@ fdc_attach(device_t dev)
/* reset controller, turn motor off, clear fdout mirror reg */
fdout_wr(fdc, ((fdc->fdout = 0)));
#endif
- bufq_init(&fdc->head);
+ bioq_init(&fdc->head);
/*
* Probe and attach any children. We should probably detect
@@ -1774,7 +1771,7 @@ fdclose(dev_t dev, int flags, int mode, struct proc *p)
/* fdstrategy */
/****************************************************************************/
void
-fdstrategy(struct buf *bp)
+fdstrategy(struct bio *bp)
{
unsigned nblocks, blknum, cando;
int s;
@@ -1783,31 +1780,31 @@ fdstrategy(struct buf *bp)
fd_p fd;
size_t fdblk;
- fdu = FDUNIT(minor(bp->b_dev));
+ fdu = FDUNIT(minor(bp->bio_dev));
fd = devclass_get_softc(fd_devclass, fdu);
if (fd == 0)
panic("fdstrategy: buf for nonexistent device (%#lx, %#lx)",
- (u_long)major(bp->b_dev), (u_long)minor(bp->b_dev));
+ (u_long)major(bp->bio_dev), (u_long)minor(bp->bio_dev));
fdc = fd->fdc;
if (fd->type == NO_TYPE) {
- bp->b_error = ENXIO;
- bp->b_ioflags |= BIO_ERROR;
+ bp->bio_error = ENXIO;
+ bp->bio_flags |= BIO_ERROR;
goto bad;
};
fdblk = 128 << (fd->ft->secsize);
- if (!(bp->b_flags & B_FORMAT)) {
- if (bp->b_blkno < 0) {
+ if (!(bp->bio_cmd & BIO_FORMAT)) {
+ if (bp->bio_blkno < 0) {
printf(
"fd%d: fdstrat: bad request blkno = %lu, bcount = %ld\n",
- fdu, (u_long)bp->b_blkno, bp->b_bcount);
- bp->b_error = EINVAL;
- bp->b_ioflags |= BIO_ERROR;
+ fdu, (u_long)bp->bio_blkno, bp->bio_bcount);
+ bp->bio_error = EINVAL;
+ bp->bio_flags |= BIO_ERROR;
goto bad;
}
- if ((bp->b_bcount % fdblk) != 0) {
- bp->b_error = EINVAL;
- bp->b_ioflags |= BIO_ERROR;
+ if ((bp->bio_bcount % fdblk) != 0) {
+ bp->bio_error = EINVAL;
+ bp->bio_flags |= BIO_ERROR;
goto bad;
}
}
@@ -1815,33 +1812,33 @@ fdstrategy(struct buf *bp)
/*
* Set up block calculations.
*/
- if (bp->b_blkno > 20000000) {
+ if (bp->bio_blkno > 20000000) {
/*
* Reject unreasonably high block number, prevent the
* multiplication below from overflowing.
*/
- bp->b_error = EINVAL;
- bp->b_ioflags |= BIO_ERROR;
+ bp->bio_error = EINVAL;
+ bp->bio_flags |= BIO_ERROR;
goto bad;
}
- blknum = (unsigned) bp->b_blkno * DEV_BSIZE/fdblk;
+ blknum = (unsigned) bp->bio_blkno * DEV_BSIZE/fdblk;
nblocks = fd->ft->size;
- bp->b_resid = 0;
- if (blknum + (bp->b_bcount / fdblk) > nblocks) {
+ bp->bio_resid = 0;
+ if (blknum + (bp->bio_bcount / fdblk) > nblocks) {
if (blknum <= nblocks) {
cando = (nblocks - blknum) * fdblk;
- bp->b_resid = bp->b_bcount - cando;
+ bp->bio_resid = bp->bio_bcount - cando;
if (cando == 0)
goto bad; /* not actually bad but EOF */
} else {
- bp->b_error = EINVAL;
- bp->b_ioflags |= BIO_ERROR;
+ bp->bio_error = EINVAL;
+ bp->bio_flags |= BIO_ERROR;
goto bad;
}
}
- bp->b_pblkno = bp->b_blkno;
+ bp->bio_pblkno = bp->bio_blkno;
s = splbio();
- bufqdisksort(&fdc->head, bp);
+ bioqdisksort(&fdc->head, bp);
untimeout(fd_turnoff, fd, fd->toffhandle); /* a good idea */
/* Tell devstat we are starting on the transaction */
@@ -1974,15 +1971,15 @@ fdstate(fdc_p fdc)
unsigned blknum = 0, b_cylinder = 0;
fdu_t fdu = fdc->fdu;
fd_p fd;
- register struct buf *bp;
+ register struct bio *bp;
struct fd_formb *finfo = NULL;
size_t fdblk;
bp = fdc->bp;
if (bp == NULL) {
- bp = bufq_first(&fdc->head);
+ bp = bioq_first(&fdc->head);
if (bp != NULL) {
- bufq_remove(&fdc->head, bp);
+ bioq_remove(&fdc->head, bp);
fdc->bp = bp;
}
}
@@ -2001,24 +1998,24 @@ fdstate(fdc_p fdc)
TRACE1("[fdc%d IDLE]", fdc->fdcu);
return (0);
}
- fdu = FDUNIT(minor(bp->b_dev));
+ fdu = FDUNIT(minor(bp->bio_dev));
fd = devclass_get_softc(fd_devclass, fdu);
fdblk = 128 << fd->ft->secsize;
if (fdc->fd && (fd != fdc->fd))
device_printf(fd->dev, "confused fd pointers\n");
- read = bp->b_iocmd == BIO_READ;
+ read = bp->bio_cmd == BIO_READ;
if (read)
idf = ISADMA_READ;
else
idf = ISADMA_WRITE;
- format = bp->b_flags & B_FORMAT;
+ format = bp->bio_cmd & BIO_FORMAT;
if (format) {
- finfo = (struct fd_formb *)bp->b_data;
+ finfo = (struct fd_formb *)bp->bio_data;
fd->skip = (char *)&(finfo->fd_formb_cylno(0))
- (char *)finfo;
}
if (fdc->state == DOSEEK || fdc->state == SEEKCOMPLETE) {
- blknum = (unsigned) bp->b_pblkno * DEV_BSIZE/fdblk +
+ blknum = (unsigned) bp->bio_pblkno * DEV_BSIZE/fdblk +
fd->skip/fdblk;
b_cylinder = blknum / (fd->ft->sectrac * fd->ft->heads);
}
@@ -2205,8 +2202,8 @@ fdstate(fdc_p fdc)
if (fdu != nrdu) {
#endif /* EPSON_NRDISK */
if (!(fdc->flags & FDC_NODMA))
- isa_dmastart(idf, bp->b_data+fd->skip,
- format ? bp->b_bcount : fdblk, fdc->dmachan);
+ isa_dmastart(idf, bp->bio_data+fd->skip,
+ format ? bp->bio_bcount : fdblk, fdc->dmachan);
sectrac = fd->ft->sectrac;
sec = blknum % (sectrac * fd->ft->heads);
head = sec / sectrac;
@@ -2221,8 +2218,8 @@ fdstate(fdc_p fdc)
/* stuck controller? */
if (!(fdc->flags & FDC_NODMA))
isa_dmadone(idf,
- bp->b_data + fd->skip,
- format ? bp->b_bcount : fdblk,
+ bp->bio_data + fd->skip,
+ format ? bp->bio_bcount : fdblk,
fdc->dmachan);
fdc->retry = 6; /* reset the beast */
return (retrier(fdc));
@@ -2262,11 +2259,11 @@ fdstate(fdc_p fdc)
*
* Umpf.
*/
- SET_BCDR(fdc, 1, bp->b_bcount, 0);
+ SET_BCDR(fdc, 1, bp->bio_bcount, 0);
- (void)fdcpio(fdc,bp->b_iocmd,
- bp->b_data+fd->skip,
- bp->b_bcount);
+ (void)fdcpio(fdc,bp->bio_cmd,
+ bp->bio_data+fd->skip,
+ bp->bio_bcount);
}
/* formatting */
@@ -2278,8 +2275,8 @@ fdstate(fdc_p fdc)
/* controller fell over */
if (!(fdc->flags & FDC_NODMA))
isa_dmadone(idf,
- bp->b_data + fd->skip,
- format ? bp->b_bcount : fdblk,
+ bp->bio_data + fd->skip,
+ format ? bp->bio_bcount : fdblk,
fdc->dmachan);
fdc->retry = 6;
return (retrier(fdc));
@@ -2297,8 +2294,8 @@ fdstate(fdc_p fdc)
* the WRITE command is sent
*/
if (!read)
- (void)fdcpio(fdc,bp->b_iocmd,
- bp->b_data+fd->skip,
+ (void)fdcpio(fdc,bp->bio_cmd,
+ bp->bio_data+fd->skip,
fdblk);
}
if (fd_cmd(fdc, 9,
@@ -2315,8 +2312,8 @@ fdstate(fdc_p fdc)
/* the beast is sleeping again */
if (!(fdc->flags & FDC_NODMA))
isa_dmadone(idf,
- bp->b_data + fd->skip,
- format ? bp->b_bcount : fdblk,
+ bp->bio_data + fd->skip,
+ format ? bp->bio_bcount : fdblk,
fdc->dmachan);
fdc->retry = 6;
return (retrier(fdc));
@@ -2327,8 +2324,8 @@ fdstate(fdc_p fdc)
* if this is a read, then simply await interrupt
* before performing PIO
*/
- if (read && !fdcpio(fdc,bp->b_iocmd,
- bp->b_data+fd->skip,fdblk)) {
+ if (read && !fdcpio(fdc,bp->bio_cmd,
+ bp->bio_data+fd->skip,fdblk)) {
fd->tohandle = timeout(fd_iotimeout, fdc, hz);
return(0); /* will return later */
};
@@ -2349,11 +2346,11 @@ fdstate(fdc_p fdc)
nrd_addrset(fdblk * nrdblkn);
while (!nrd_check_ready()) DELAY(1);
if (read) epson_insw(P_NRD_DATA,
- bp->b_data + fd->skip,
+ bp->bio_data + fd->skip,
fdblk / sizeof(short));
else epson_outsw(P_NRD_DATA,
- bp->b_data + fd->skip,
- (format ? bp->b_bcount : fdblk)
+ bp->bio_data + fd->skip,
+ (format ? bp->bio_bcount : fdblk)
/ sizeof(short));
blknum = (unsigned long)bp->b_blkno*DEV_BSIZE/fdblk
@@ -2375,7 +2372,7 @@ fdstate(fdc_p fdc)
* actually perform the PIO read. The IOCOMPLETE case
* removes the timeout for us.
*/
- (void)fdcpio(fdc,bp->b_iocmd,bp->b_data+fd->skip,fdblk);
+ (void)fdcpio(fdc,bp->bio_cmd,bp->bio_data+fd->skip,fdblk);
fdc->state = IOCOMPLETE;
/* FALLTHROUGH */
case IOCOMPLETE: /* IO DONE, post-analyze */
@@ -2388,8 +2385,8 @@ fdstate(fdc_p fdc)
if (fd_read_status(fdc, fd->fdsu)) {
if (!(fdc->flags & FDC_NODMA))
- isa_dmadone(idf, bp->b_data + fd->skip,
- format ? bp->b_bcount : fdblk,
+ isa_dmadone(idf, bp->bio_data + fd->skip,
+ format ? bp->bio_bcount : fdblk,
fdc->dmachan);
if (fdc->retry < 6)
fdc->retry = 6; /* force a reset */
@@ -2405,8 +2402,8 @@ fdstate(fdc_p fdc)
if (fdu != nrdu) {
#endif /* EPSON_NRDISK */
if (!(fdc->flags & FDC_NODMA))
- isa_dmadone(idf, bp->b_data + fd->skip,
- format ? bp->b_bcount : fdblk, fdc->dmachan);
+ isa_dmadone(idf, bp->bio_data + fd->skip,
+ format ? bp->bio_bcount : fdblk, fdc->dmachan);
#ifdef EPSON_NRDISK
}
else nrd_LED_off();
@@ -2435,7 +2432,7 @@ fdstate(fdc_p fdc)
}
/* All OK */
fd->skip += fdblk;
- if (!format && fd->skip < bp->b_bcount - bp->b_resid) {
+ if (!format && fd->skip < bp->bio_bcount - bp->bio_resid) {
/* set up next transfer */
fdc->state = DOSEEK;
} else {
@@ -2443,7 +2440,7 @@ fdstate(fdc_p fdc)
fd->skip = 0;
fdc->bp = NULL;
device_unbusy(fd->dev);
- devstat_end_transaction_buf(&fd->device_stats, bp);
+ devstat_end_transaction_bio(&fd->device_stats, bp);
biodone(bp);
fdc->fd = (fd_p) 0;
fdc->fdu = -1;
@@ -2563,14 +2560,14 @@ fdstate(fdc_p fdc)
static int
retrier(struct fdc_data *fdc)
{
- register struct buf *bp;
+ register struct bio *bp;
struct fd_data *fd;
int fdu;
bp = fdc->bp;
/* XXX shouldn't this be cached somewhere? */
- fdu = FDUNIT(minor(bp->b_dev));
+ fdu = FDUNIT(minor(bp->bio_dev));
fd = devclass_get_softc(fd_devclass, fdu);
if (fd->options & FDOPT_NORETRY)
goto fail;
@@ -2590,14 +2587,14 @@ retrier(struct fdc_data *fdc)
default:
fail:
{
- dev_t sav_b_dev = bp->b_dev;
+ dev_t sav_b_dev = bp->bio_dev;
/* Trick diskerr */
- bp->b_dev = makedev(major(bp->b_dev),
- (FDUNIT(minor(bp->b_dev))<<3)|RAW_PART);
+ bp->bio_dev = makedev(major(bp->bio_dev),
+ (FDUNIT(minor(bp->bio_dev))<<3)|RAW_PART);
diskerr(bp, "hard error", LOG_PRINTF,
fdc->fd->skip / DEV_BSIZE,
(struct disklabel *)NULL);
- bp->b_dev = sav_b_dev;
+ bp->bio_dev = sav_b_dev;
if (fdc->flags & FDC_STAT_VALID)
{
printf(
@@ -2611,13 +2608,13 @@ retrier(struct fdc_data *fdc)
else
printf(" (No status)\n");
}
- bp->b_ioflags |= BIO_ERROR;
- bp->b_error = EIO;
- bp->b_resid += bp->b_bcount - fdc->fd->skip;
+ bp->bio_flags |= BIO_ERROR;
+ bp->bio_error = EIO;
+ bp->bio_resid += bp->bio_bcount - fdc->fd->skip;
fdc->bp = NULL;
fdc->fd->skip = 0;
device_unbusy(fd->dev);
- devstat_end_transaction_buf(&fdc->fd->device_stats, bp);
+ devstat_end_transaction_bio(&fdc->fd->device_stats, bp);
biodone(bp);
fdc->state = FINDWORK;
fdc->flags |= FDC_NEEDS_RESET;
@@ -2647,7 +2644,7 @@ fdformat(dev, finfo, p)
fdblk = 128 << fd->ft->secsize;
/* set up a buffer header for fdstrategy() */
- bp = (struct buf *)malloc(sizeof(struct buf), M_TEMP, M_NOWAIT);
+ bp = (struct buf *)malloc(sizeof(struct bio), M_TEMP, M_NOWAIT);
if(bp == 0)
return ENOBUFS;
/*
@@ -2657,8 +2654,8 @@ fdformat(dev, finfo, p)
bzero((void *)bp, sizeof(struct buf));
BUF_LOCKINIT(bp);
BUF_LOCK(bp, LK_EXCLUSIVE);
- bp->b_flags = B_PHYS | B_FORMAT;
- bp->b_iocmd = BIO_WRITE;
+ bp->b_flags = B_PHYS;
+ bp->b_iocmd = BIO_FORMAT;
/*
* calculate a fake blkno, so fdstrategy() would initiate a
@@ -2687,9 +2684,9 @@ fdformat(dev, finfo, p)
/* timed out */
rv = EIO;
device_unbusy(fd->dev);
- biodone(bp);
+ bufdone(bp);
}
- if (bp->b_ioflags & BIO_ERROR)
+ if (bp->b_flags & BIO_ERROR)
rv = bp->b_error;
/*
* allow the process to be swapped
diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c
index 61056d0..8e253bd 100644
--- a/sys/pc98/pc98/machdep.c
+++ b/sys/pc98/pc98/machdep.c
@@ -2658,54 +2658,54 @@ Debugger(const char *msg)
* if needed, and signal errors or early completion.
*/
int
-bounds_check_with_label(struct buf *bp, struct disklabel *lp, int wlabel)
+bounds_check_with_label(struct bio *bp, struct disklabel *lp, int wlabel)
{
- struct partition *p = lp->d_partitions + dkpart(bp->b_dev);
+ struct partition *p = lp->d_partitions + dkpart(bp->bio_dev);
int labelsect = lp->d_partitions[0].p_offset;
int maxsz = p->p_size,
- sz = (bp->b_bcount + DEV_BSIZE - 1) >> DEV_BSHIFT;
+ sz = (bp->bio_bcount + DEV_BSIZE - 1) >> DEV_BSHIFT;
/* overwriting disk label ? */
/* XXX should also protect bootstrap in first 8K */
- if (bp->b_blkno + p->p_offset <= LABELSECTOR + labelsect &&
+ if (bp->bio_blkno + p->p_offset <= LABELSECTOR + labelsect &&
#if LABELSECTOR != 0
- bp->b_blkno + p->p_offset + sz > LABELSECTOR + labelsect &&
+ bp->bio_blkno + p->p_offset + sz > LABELSECTOR + labelsect &&
#endif
- (bp->b_iocmd == BIO_WRITE) && wlabel == 0) {
- bp->b_error = EROFS;
+ (bp->bio_cmd == BIO_WRITE) && wlabel == 0) {
+ bp->bio_error = EROFS;
goto bad;
}
#if defined(DOSBBSECTOR) && defined(notyet)
/* overwriting master boot record? */
- if (bp->b_blkno + p->p_offset <= DOSBBSECTOR &&
- (bp->b_iocmd == BIO_WRITE) && wlabel == 0) {
- bp->b_error = EROFS;
+ if (bp->bio_blkno + p->p_offset <= DOSBBSECTOR &&
+ (bp->bio_cmd == BIO_WRITE) && wlabel == 0) {
+ bp->bio_error = EROFS;
goto bad;
}
#endif
/* beyond partition? */
- if (bp->b_blkno < 0 || bp->b_blkno + sz > maxsz) {
+ if (bp->bio_blkno < 0 || bp->bio_blkno + sz > maxsz) {
/* if exactly at end of disk, return an EOF */
- if (bp->b_blkno == maxsz) {
- bp->b_resid = bp->b_bcount;
+ if (bp->bio_blkno == maxsz) {
+ bp->bio_resid = bp->bio_bcount;
return(0);
}
/* or truncate if part of it fits */
- sz = maxsz - bp->b_blkno;
+ sz = maxsz - bp->bio_blkno;
if (sz <= 0) {
- bp->b_error = EINVAL;
+ bp->bio_error = EINVAL;
goto bad;
}
- bp->b_bcount = sz << DEV_BSHIFT;
+ bp->bio_bcount = sz << DEV_BSHIFT;
}
- bp->b_pblkno = bp->b_blkno + p->p_offset;
+ bp->bio_pblkno = bp->bio_blkno + p->p_offset;
return(1);
bad:
- bp->b_ioflags |= BIO_ERROR;
+ bp->bio_flags |= BIO_ERROR;
return(-1);
}
diff --git a/sys/pc98/pc98/wd.c b/sys/pc98/pc98/wd.c
index 67eb543..fc8728f 100644
--- a/sys/pc98/pc98/wd.c
+++ b/sys/pc98/pc98/wd.c
@@ -194,15 +194,15 @@ struct disk {
static int wdtest = 0;
static struct disk *wddrives[NWD]; /* table of units */
-static struct buf_queue_head drive_queue[NWD]; /* head of queue per drive */
+static struct bio_queue_head drive_queue[NWD]; /* head of queue per drive */
static struct {
int b_active;
} wdutab[NWD];
/*
-static struct buf wdtab[NWDC];
+static struct bio wdtab[NWDC];
*/
static struct {
- struct buf_queue_head controller_queue;
+ struct bio_queue_head controller_queue;
int b_errcnt;
int b_active;
} wdtab[NWDC];
@@ -210,7 +210,7 @@ static struct {
struct wddma wddma[NWDC];
#ifdef notyet
-static struct buf rwdbuf[NWD]; /* buffers for raw IO */
+static struct bio rwdbuf[NWD]; /* buffers for raw IO */
#endif
#ifdef PC98
static short wd_ctlr;
@@ -220,7 +220,7 @@ static int old_epson_note;
static int wdprobe(struct isa_device *dvp);
static int wdattach(struct isa_device *dvp);
static void wdustart(struct disk *du);
-static int wdcontrol(struct buf *bp);
+static int wdcontrol(struct bio *bp);
static int wdcommand(struct disk *du, u_int cylinder, u_int head,
u_int sector, u_int count, u_int command);
static int wdsetctlr(struct disk *du);
@@ -229,7 +229,7 @@ static int wdwsetctlr(struct disk *du);
#endif
static int wdsetmode(int mode, void *wdinfo);
static int wdgetctlr(struct disk *du);
-static void wderror(struct buf *bp, struct disk *du, char *mesg);
+static void wderror(struct bio *bp, struct disk *du, char *mesg);
static void wdflushirq(struct disk *du, int old_ipl);
static int wdreset(struct disk *du);
static void wdsleep(int ctrlr, char *wmesg);
@@ -486,10 +486,10 @@ wdattach(struct isa_device *dvp)
if (eide_quirks & Q_CMD640B) {
if (dvp->id_unit == PRIMARY) {
printf("wdc0: CMD640B workaround enabled\n");
- bufq_init(&wdtab[PRIMARY].controller_queue);
+ bioq_init(&wdtab[PRIMARY].controller_queue);
}
} else
- bufq_init(&wdtab[dvp->id_unit].controller_queue);
+ bioq_init(&wdtab[dvp->id_unit].controller_queue);
sprintf(buf, "wdc%d", dvp->id_unit);
for (i = resource_query_string(-1, "at", buf);
@@ -521,7 +521,7 @@ wdattach(struct isa_device *dvp)
if (wddrives[lunit] != NULL)
panic("drive attached twice");
wddrives[lunit] = du;
- bufq_init(&drive_queue[lunit]);
+ bioq_init(&drive_queue[lunit]);
bzero(du, sizeof *du);
du->dk_ctrlr = dvp->id_unit;
if (eide_quirks & Q_CMD640B) {
@@ -650,18 +650,18 @@ next: ;
* be a multiple of a sector in length.
*/
void
-wdstrategy(register struct buf *bp)
+wdstrategy(register struct bio *bp)
{
struct disk *du;
- int lunit = dkunit(bp->b_dev);
+ int lunit = dkunit(bp->bio_dev);
int s;
/* valid unit, controller, and request? */
- if (lunit >= NWD || bp->b_blkno < 0 || (du = wddrives[lunit]) == NULL
- || bp->b_bcount % DEV_BSIZE != 0) {
+ if (lunit >= NWD || bp->bio_blkno < 0 || (du = wddrives[lunit]) == NULL
+ || bp->bio_bcount % DEV_BSIZE != 0) {
- bp->b_error = EINVAL;
- bp->b_ioflags |= BIO_ERROR;
+ bp->bio_error = EINVAL;
+ bp->bio_flags |= BIO_ERROR;
goto done;
}
@@ -670,7 +670,7 @@ wdstrategy(register struct buf *bp)
#endif
/*
- * Do bounds checking, adjust transfer, and set b_pblkno.
+ * Do bounds checking, adjust transfer, and set bio_pblkno.
*/
if (dscheck(bp, du->dk_slices) <= 0)
goto done;
@@ -684,7 +684,7 @@ wdstrategy(register struct buf *bp)
du->dk_state = WANTOPEN;
}
- bufqdisksort(&drive_queue[lunit], bp);
+ bioqdisksort(&drive_queue[lunit], bp);
if (wdutab[lunit].b_active == 0)
wdustart(du); /* start drive */
@@ -711,7 +711,7 @@ done:
static void
wdustart(register struct disk *du)
{
- register struct buf *bp;
+ register struct bio *bp;
int ctrlr = du->dk_ctrlr_cmd640;
#ifdef PC98
@@ -722,19 +722,19 @@ wdustart(register struct disk *du)
return;
- bp = bufq_first(&drive_queue[du->dk_lunit]);
+ bp = bioq_first(&drive_queue[du->dk_lunit]);
if (bp == NULL) { /* yes, an assign */
return;
}
/*
* store away which device we came from.
*/
- bp->b_driver1 = du;
+ bp->bio_driver1 = du;
- bufq_remove(&drive_queue[du->dk_lunit], bp);
+ bioq_remove(&drive_queue[du->dk_lunit], bp);
/* link onto controller queue */
- bufq_insert_tail(&wdtab[ctrlr].controller_queue, bp);
+ bioq_insert_tail(&wdtab[ctrlr].controller_queue, bp);
/* mark the drive unit as busy */
wdutab[du->dk_lunit].b_active = 1;
@@ -753,7 +753,7 @@ void
wdstart(int ctrlr)
{
register struct disk *du;
- register struct buf *bp;
+ register struct bio *bp;
struct diskgeom *lp; /* XXX sic */
long blknum;
long secpertrk, secpercyl;
@@ -773,7 +773,7 @@ wdstart(int ctrlr)
if (wdtab[ctrlr].b_active)
return;
/* is there a drive for the controller to do a transfer with? */
- bp = bufq_first(&wdtab[ctrlr].controller_queue);
+ bp = bioq_first(&wdtab[ctrlr].controller_queue);
if (bp == NULL) {
if (atapi_start && atapi_start (ctrlr_atapi))
/* mark controller active in ATAPI mode */
@@ -782,7 +782,7 @@ wdstart(int ctrlr)
}
/* obtain controller and drive information */
- lunit = dkunit(bp->b_dev);
+ lunit = dkunit(bp->bio_dev);
du = wddrives[lunit];
#ifdef PC98
@@ -801,12 +801,12 @@ wdstart(int ctrlr)
}
/* calculate transfer details */
- blknum = bp->b_pblkno + du->dk_skip;
+ blknum = bp->bio_pblkno + du->dk_skip;
#ifdef WDDEBUG
if (du->dk_skip == 0)
printf("wd%d: wdstart: %s %d@%d; map ", lunit,
- (bp->b_iocmd == BIO_READ) ? "read" : "write",
- bp->b_bcount, blknum);
+ (bp->bio_cmd == BIO_READ) ? "read" : "write",
+ bp->bio_bcount, blknum);
else {
if (old_epson_note)
printf(" %d)%x", du->dk_skip, epson_inb(du->dk_altport);
@@ -820,7 +820,7 @@ wdstart(int ctrlr)
secpercyl = lp->d_secpercyl;
if (du->dk_skip == 0)
- du->dk_bc = bp->b_bcount;
+ du->dk_bc = bp->bio_bcount;
wdtab[ctrlr].b_active = 1; /* mark controller active */
@@ -843,7 +843,7 @@ wdstart(int ctrlr)
* XXX this looks like an attempt to skip bad sectors
* on write.
*/
- if (wdtab[ctrlr].b_errcnt && (bp->b_iocmd == BIO_WRITE))
+ if (wdtab[ctrlr].b_errcnt && (bp->bio_cmd == BIO_WRITE))
du->dk_bc += DEV_BSIZE;
count1 = howmany( du->dk_bc, DEV_BSIZE);
@@ -851,26 +851,26 @@ wdstart(int ctrlr)
du->dk_flags &= ~DKFL_MULTI;
if (du->dk_flags & DKFL_SINGLE) {
- command = (bp->b_iocmd == BIO_READ)
+ command = (bp->bio_cmd == BIO_READ)
? WDCC_READ : WDCC_WRITE;
count1 = 1;
du->dk_currentiosize = 1;
} else {
if((du->dk_flags & DKFL_USEDMA) &&
wddma[du->dk_interface].wdd_dmaverify(du->dk_dmacookie,
- (void *)((int)bp->b_data +
+ (void *)((int)bp->bio_data +
du->dk_skip * DEV_BSIZE),
du->dk_bc,
- bp->b_iocmd == BIO_READ)) {
+ bp->bio_cmd == BIO_READ)) {
du->dk_flags |= DKFL_DMA;
- if(bp->b_iocmd == BIO_READ)
+ if(bp->bio_cmd == BIO_READ)
command = WDCC_READ_DMA;
else
command = WDCC_WRITE_DMA;
du->dk_currentiosize = count1;
} else if( (count1 > 1) && (du->dk_multi > 1)) {
du->dk_flags |= DKFL_MULTI;
- if(bp->b_iocmd == BIO_READ) {
+ if(bp->bio_cmd == BIO_READ) {
command = WDCC_READ_MULTI;
} else {
command = WDCC_WRITE_MULTI;
@@ -879,7 +879,7 @@ wdstart(int ctrlr)
if( du->dk_currentiosize > count1)
du->dk_currentiosize = count1;
} else {
- if(bp->b_iocmd == BIO_READ) {
+ if(bp->bio_cmd == BIO_READ) {
command = WDCC_READ;
} else {
command = WDCC_WRITE;
@@ -903,10 +903,10 @@ wdstart(int ctrlr)
if ((du->dk_flags & (DKFL_DMA|DKFL_SINGLE)) == DKFL_DMA) {
wddma[du->dk_interface].wdd_dmaprep(du->dk_dmacookie,
- (void *)((int)bp->b_data +
+ (void *)((int)bp->bio_data +
du->dk_skip * DEV_BSIZE),
du->dk_bc,
- bp->b_iocmd == BIO_READ);
+ bp->bio_cmd == BIO_READ);
}
while (wdcommand(du, cylin, head, sector, count1, command)
!= 0) {
@@ -917,7 +917,7 @@ wdstart(int ctrlr)
#ifdef WDDEBUG
printf("cylin %ld head %ld sector %ld addr %x sts ",
cylin, head, sector,
- (int)bp->b_data + du->dk_skip * DEV_BSIZE);
+ (int)bp->bio_data + du->dk_skip * DEV_BSIZE);
if (old_epson_note)
printf("%x\n", epson_inb(du->dk_altport));
else
@@ -954,7 +954,7 @@ wdstart(int ctrlr)
}
/* If this is a read operation, just go away until it's done. */
- if (bp->b_iocmd == BIO_READ)
+ if (bp->bio_cmd == BIO_READ)
return;
/* Ready to send data? */
@@ -983,18 +983,18 @@ wdstart(int ctrlr)
if (!old_epson_note) {
if (du->dk_flags & DKFL_32BIT)
outsl(du->dk_port + wd_data,
- (void *)((int)bp->b_data
+ (void *)((int)bp->bio_data
+ du->dk_skip * DEV_BSIZE),
(count * DEV_BSIZE) / sizeof(long));
else
outsw(du->dk_port + wd_data,
- (void *)((int)bp->b_data
+ (void *)((int)bp->bio_data
+ du->dk_skip * DEV_BSIZE),
(count * DEV_BSIZE) / sizeof(short));
}
else
epson_outsw(du->dk_port + wd_data,
- (void *)((int)bp->b_data + du->dk_skip * DEV_BSIZE),
+ (void *)((int)bp->bio_data + du->dk_skip * DEV_BSIZE),
(count * DEV_BSIZE) / sizeof(short));
du->dk_bc -= DEV_BSIZE * count;
@@ -1010,7 +1010,7 @@ void
wdintr(void *unitnum)
{
register struct disk *du;
- register struct buf *bp;
+ register struct bio *bp;
int dmastat = 0; /* Shut up GCC */
int unit = (int)unitnum;
@@ -1046,8 +1046,8 @@ wdintr(void *unitnum)
wdstart (unit);
return;
}
- bp = bufq_first(&wdtab[unit].controller_queue);
- du = wddrives[dkunit(bp->b_dev)];
+ bp = bioq_first(&wdtab[unit].controller_queue);
+ du = wddrives[dkunit(bp->bio_dev)];
#ifdef PC98
outb(0x432,(du->dk_unit)%2);
@@ -1123,8 +1123,8 @@ oops:
wdtab[unit].b_active = 0;
} else {
wderror(bp, du, "hard error");
- bp->b_error = EIO;
- bp->b_ioflags |= BIO_ERROR; /* flag the error */
+ bp->bio_error = EIO;
+ bp->bio_flags |= BIO_ERROR; /* flag the error */
}
} else if (du->dk_status & WDCS_ECCCOR)
wderror(bp, du, "soft ecc");
@@ -1133,7 +1133,7 @@ oops:
/*
* If this was a successful read operation, fetch the data.
*/
- if (bp->b_iocmd == BIO_READ && !(bp->b_ioflags & BIO_ERROR)
+ if (bp->bio_cmd == BIO_READ && !(bp->bio_flags & BIO_ERROR)
&& !((du->dk_flags & (DKFL_DMA|DKFL_SINGLE)) == DKFL_DMA)
&& wdtab[unit].b_active) {
u_int chk, dummy, multisize;
@@ -1158,11 +1158,11 @@ oops:
/* suck in data */
if( du->dk_flags & DKFL_32BIT)
insl(du->dk_port + wd_data,
- (void *)((int)bp->b_data + du->dk_skip * DEV_BSIZE),
+ (void *)((int)bp->bio_data + du->dk_skip * DEV_BSIZE),
chk / sizeof(long));
else
insw(du->dk_port + wd_data,
- (void *)((int)bp->b_data + du->dk_skip * DEV_BSIZE),
+ (void *)((int)bp->bio_data + du->dk_skip * DEV_BSIZE),
chk / sizeof(short));
du->dk_bc -= chk;
@@ -1175,7 +1175,7 @@ oops:
}
/* final cleanup on DMA */
- if (((bp->b_ioflags & BIO_ERROR) == 0)
+ if (((bp->bio_flags & BIO_ERROR) == 0)
&& ((du->dk_flags & (DKFL_DMA|DKFL_SINGLE)) == DKFL_DMA)
&& wdtab[unit].b_active) {
int iosize;
@@ -1188,7 +1188,7 @@ oops:
outt:
if (wdtab[unit].b_active) {
- if ((bp->b_ioflags & BIO_ERROR) == 0) {
+ if ((bp->bio_flags & BIO_ERROR) == 0) {
du->dk_skip += du->dk_currentiosize;/* add to successful sectors */
if (wdtab[unit].b_errcnt)
wderror(bp, du, "soft error");
@@ -1197,7 +1197,7 @@ outt:
/* see if more to transfer */
if (du->dk_bc > 0 && (du->dk_flags & DKFL_ERROR) == 0) {
if( (du->dk_flags & DKFL_SINGLE) ||
- (bp->b_iocmd == BIO_WRITE)) {
+ (bp->bio_cmd == BIO_WRITE)) {
wdtab[unit].b_active = 0;
wdstart(unit);
} else {
@@ -1218,12 +1218,12 @@ outt:
done: ;
/* done with this transfer, with or without error */
du->dk_flags &= ~(DKFL_SINGLE|DKFL_DMA);
- bufq_remove( &wdtab[unit].controller_queue, bp);
+ bioq_remove( &wdtab[unit].controller_queue, bp);
wdtab[unit].b_errcnt = 0;
- bp->b_resid = bp->b_bcount - du->dk_skip * DEV_BSIZE;
+ bp->bio_resid = bp->bio_bcount - du->dk_skip * DEV_BSIZE;
wdutab[du->dk_lunit].b_active = 0;
du->dk_skip = 0;
- devstat_end_transaction_buf(&du->dk_stats, bp);
+ devstat_end_transaction_bio(&du->dk_stats, bp);
biodone(bp);
}
@@ -1416,12 +1416,12 @@ wdopen(dev_t dev, int flags, int fmt, struct proc *p)
* Returns 0 if operation still in progress, 1 if completed, 2 if error.
*/
static int
-wdcontrol(register struct buf *bp)
+wdcontrol(register struct bio *bp)
{
register struct disk *du;
int ctrlr;
- du = wddrives[dkunit(bp->b_dev)];
+ du = wddrives[dkunit(bp->bio_dev)];
ctrlr = du->dk_ctrlr_cmd640;
#ifdef PC98
@@ -1447,8 +1447,8 @@ maybe_retry:
du->dk_state = WANTOPEN;
if (++wdtab[ctrlr].b_errcnt < RETRIES)
goto tryagainrecal;
- bp->b_error = ENXIO; /* XXX needs translation */
- bp->b_ioflags |= BIO_ERROR;
+ bp->bio_error = ENXIO; /* XXX needs translation */
+ bp->bio_flags |= BIO_ERROR;
return (2);
}
wdtab[ctrlr].b_errcnt = 0;
@@ -1652,7 +1652,7 @@ wdsetctlr(struct disk *du)
if (wdcommand(du, du->dk_dd.d_ncylinders, du->dk_dd.d_ntracks - 1, 0,
du->dk_dd.d_nsectors, WDCC_IDC) != 0
|| wdwait(du, WDCS_READY, TIMEOUT) < 0) {
- wderror((struct buf *)NULL, du, "wdsetctlr failed");
+ wderror((struct bio *)NULL, du, "wdsetctlr failed");
return (1);
}
}
@@ -2121,7 +2121,7 @@ wddump(dev_t dev)
if (wdcommand(du, 0, 0, 0, 0, WDCC_RESTORE | WD_STEP) != 0
|| wdwait(du, WDCS_READY | WDCS_SEEKCMPLT, TIMEOUT) != 0
|| wdsetctlr(du) != 0) {
- wderror((struct buf *)NULL, du, "wddump: recalibrate failed");
+ wderror((struct bio *)NULL, du, "wddump: recalibrate failed");
return (EIO);
}
@@ -2161,7 +2161,7 @@ wddump(dev_t dev)
/* Do the write. */
if (wdcommand(du, cylin, head, sector, blkcnt, WDCC_WRITE)
!= 0) {
- wderror((struct buf *)NULL, du,
+ wderror((struct bio *)NULL, du,
"wddump: timeout waiting to to give command");
return (EIO);
}
@@ -2177,7 +2177,7 @@ wddump(dev_t dev)
DELAY(5); /* ATA spec */
if (wdwait(du, WDCS_READY | WDCS_SEEKCMPLT | WDCS_DRQ, TIMEOUT)
< 0) {
- wderror((struct buf *)NULL, du,
+ wderror((struct bio *)NULL, du,
"wddump: timeout waiting for DRQ");
return (EIO);
}
@@ -2208,7 +2208,7 @@ wddump(dev_t dev)
/* Wait for completion. */
DELAY(5); /* ATA spec XXX NOT */
if (wdwait(du, WDCS_READY | WDCS_SEEKCMPLT, TIMEOUT) < 0) {
- wderror((struct buf *)NULL, du,
+ wderror((struct bio *)NULL, du,
"wddump: timeout waiting for status");
return (EIO);
}
@@ -2217,7 +2217,7 @@ wddump(dev_t dev)
if ((du->dk_status
& (WDCS_READY | WDCS_SEEKCMPLT | WDCS_DRQ | WDCS_ERR))
!= (WDCS_READY | WDCS_SEEKCMPLT)) {
- wderror((struct buf *)NULL, du,
+ wderror((struct bio *)NULL, du,
"wddump: extra DRQ, or error");
return (EIO);
}
@@ -2234,13 +2234,13 @@ wddump(dev_t dev)
}
static void
-wderror(struct buf *bp, struct disk *du, char *mesg)
+wderror(struct bio *bp, struct disk *du, char *mesg)
{
if (bp == NULL)
printf("wd%d: %s", du->dk_lunit, mesg);
else
diskerr(bp, mesg, LOG_PRINTF, du->dk_skip,
- dsgetlabel(bp->b_dev, du->dk_slices));
+ dsgetlabel(bp->bio_dev, du->dk_slices));
printf(" (status %b error %b)\n",
du->dk_status, WDCS_BITS, du->dk_error, WDERR_BITS);
}
@@ -2336,7 +2336,7 @@ wdtimeout(void *cdu)
msg = (timeouts > 5) ?
"Last time I say: interrupt timeout. Probably a portable PC." :
"interrupt timeout";
- wderror((struct buf *)NULL, du, msg);
+ wderror((struct bio *)NULL, du, msg);
if (du->dk_dmacookie)
printf("wd%d: wdtimeout() DMA status %b\n",
du->dk_lunit,
@@ -2386,7 +2386,7 @@ wdunwedge(struct disk *du)
&& wdsetctlr(du) == 0)
return (0);
}
- wderror((struct buf *)NULL, du, "wdunwedge failed");
+ wderror((struct bio *)NULL, du, "wdunwedge failed");
return (1);
}
diff --git a/sys/pc98/pc98/wd_cd.c b/sys/pc98/pc98/wd_cd.c
index fea4ac1..b88cffb 100644
--- a/sys/pc98/pc98/wd_cd.c
+++ b/sys/pc98/pc98/wd_cd.c
@@ -86,7 +86,7 @@ int acdattach(struct atapi *, int, struct atapi_params *, int);
static struct acd *acd_init_lun(struct atapi *, int, struct atapi_params *, int,
struct devstat *);
static void acd_start(struct acd *);
-static void acd_done(struct acd *, struct buf *, int, struct atapires);
+static void acd_done(struct acd *, struct bio *, int, struct atapires);
static int acd_read_toc(struct acd *);
static int acd_request_wait(struct acd *, u_char, u_char, u_char, u_char, u_char, u_char, u_char, u_char, u_char, u_char, char *, int);
static void acd_describe(struct acd *);
@@ -111,7 +111,7 @@ acd_init_lun(struct atapi *ata, int unit, struct atapi_params *ap, int lun,
if (!(ptr = malloc(sizeof(struct acd), M_TEMP, M_NOWAIT)))
return NULL;
bzero(ptr, sizeof(struct acd));
- bufq_init(&ptr->buf_queue);
+ bioq_init(&ptr->bio_queue);
ptr->ata = ata;
ptr->unit = unit;
ptr->lun = lun;
@@ -433,33 +433,33 @@ acdclose(dev_t dev, int flags, int fmt, struct proc *p)
}
void
-acdstrategy(struct buf *bp)
+acdstrategy(struct bio *bp)
{
- int lun = dkunit(bp->b_dev);
+ int lun = dkunit(bp->bio_dev);
struct acd *cdp = acdtab[lun];
int x;
#ifdef NOTYET
/* allow write only on CD-R/RW media */ /* all for now SOS */
- if ((bp->b_iocmd == BIO_WRITE) && !(writeable_media)) {
- bp->b_error = EROFS;
- bp->b_ioflags |= BIO_ERROR;
+ if ((bp->bio_cmd == BIO_WRITE) && !(writeable_media)) {
+ bp->bio_error = EROFS;
+ bp->bio_flags |= BIO_ERROR;
biodone(bp);
return;
}
#endif
- 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;
x = splbio();
- bufqdisksort(&cdp->buf_queue, bp);
+ bioqdisksort(&cdp->bio_queue, bp);
acd_start(cdp);
splx(x);
}
@@ -467,7 +467,7 @@ acdstrategy(struct buf *bp)
static void
acd_start(struct acd *cdp)
{
- struct buf *bp = bufq_first(&cdp->buf_queue);
+ struct bio *bp = bioq_first(&cdp->bio_queue);
u_long lba, blocks;
int cmd;
int count;
@@ -475,24 +475,24 @@ acd_start(struct acd *cdp)
if (!bp)
return;
- bufq_remove(&cdp->buf_queue, bp);
+ bioq_remove(&cdp->bio_queue, bp);
/* Should reject all queued entries if media have changed. */
if (cdp->flags & F_MEDIA_CHANGED) {
- bp->b_error = EIO;
- bp->b_ioflags |= BIO_ERROR;
+ bp->bio_error = EIO;
+ bp->bio_flags |= BIO_ERROR;
biodone(bp);
return;
}
acd_select_slot(cdp);
- if (bp->b_iocmd == BIO_WRITE) {
+ if (bp->bio_cmd == BIO_WRITE) {
if ((cdp->flags & F_TRACK_PREPED) == 0) {
if ((cdp->flags & F_TRACK_PREP) == 0) {
printf("wcd%d: sequence error\n", cdp->lun);
- bp->b_error = EIO;
- bp->b_ioflags |= BIO_ERROR;
+ bp->bio_error = EIO;
+ bp->bio_flags |= BIO_ERROR;
biodone(bp);
return;
} else {
@@ -505,22 +505,22 @@ acd_start(struct acd *cdp)
}
}
- if (bp->b_iocmd == BIO_READ)
+ if (bp->bio_cmd == BIO_READ)
#ifdef NOTYET
- lba = bp->b_offset / cdp->block_size;
+ lba = bp->bio_offset / cdp->block_size;
#else
- lba = bp->b_blkno / (cdp->block_size / DEV_BSIZE);
+ lba = bp->bio_blkno / (cdp->block_size / DEV_BSIZE);
#endif
else
- lba = cdp->next_writeable_lba + (bp->b_offset / cdp->block_size);
- blocks = (bp->b_bcount + (cdp->block_size - 1)) / cdp->block_size;
+ lba = cdp->next_writeable_lba + (bp->bio_offset / cdp->block_size);
+ blocks = (bp->bio_bcount + (cdp->block_size - 1)) / cdp->block_size;
- if (bp->b_iocmd == BIO_WRITE) {
+ if (bp->bio_cmd == BIO_WRITE) {
cmd = ATAPI_WRITE_BIG;
- count = -bp->b_bcount;
+ count = -bp->bio_bcount;
} else {
cmd = ATAPI_READ_BIG;
- count = bp->b_bcount;
+ count = bp->bio_bcount;
}
devstat_start_transaction(cdp->device_stats);
@@ -528,24 +528,24 @@ acd_start(struct acd *cdp)
atapi_request_callback(cdp->ata, cdp->unit, cmd, 0,
lba>>24, lba>>16, lba>>8, lba, 0,
blocks>>8, blocks, 0, 0, 0, 0, 0, 0, 0,
- (u_char *)bp->b_data, count,
+ (u_char *)bp->bio_data, count,
(atapi_callback_t *)acd_done, cdp, bp);
}
static void
-acd_done(struct acd *cdp, struct buf *bp, int resid, struct atapires result)
+acd_done(struct acd *cdp, struct bio *bp, int resid, struct atapires result)
{
if (result.code) {
atapi_error(cdp->ata, cdp->unit, result);
- bp->b_error = EIO;
- bp->b_ioflags |= BIO_ERROR;
+ bp->bio_error = EIO;
+ bp->bio_flags |= BIO_ERROR;
} else {
- bp->b_resid = resid;
- if (bp->b_iocmd == BIO_WRITE)
+ bp->bio_resid = resid;
+ if (bp->bio_cmd == BIO_WRITE)
cdp->flags |= F_WRITTEN;
}
- devstat_end_transaction_buf(cdp->device_stats, bp);
+ devstat_end_transaction_bio(cdp->device_stats, bp);
biodone(bp);
acd_start(cdp);
}
diff --git a/sys/pc98/pc98/wd_cd.h b/sys/pc98/pc98/wd_cd.h
index a666522..8a6001c 100644
--- a/sys/pc98/pc98/wd_cd.h
+++ b/sys/pc98/pc98/wd_cd.h
@@ -317,7 +317,7 @@ struct acd {
int flags; /* Device state flags */
int refcnt; /* The number of raw opens */
struct atapi *ata; /* Controller structure */
- 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 toc toc; /* Table of disc contents */
struct {
OpenPOWER on IntegriCloud