diff options
author | msmith <msmith@FreeBSD.org> | 2001-06-25 04:32:31 +0000 |
---|---|---|
committer | msmith <msmith@FreeBSD.org> | 2001-06-25 04:32:31 +0000 |
commit | eb1ff0cc22d9a440d73dd6f14c49440b0f8fa972 (patch) | |
tree | ca600fd401a31faa563da2676c1e9bddd7d08294 /sys/dev/mlx/mlx.c | |
parent | 9c03640f8131fa266b0dbeb2a532794b18cee818 (diff) | |
download | FreeBSD-src-eb1ff0cc22d9a440d73dd6f14c49440b0f8fa972.zip FreeBSD-src-eb1ff0cc22d9a440d73dd6f14c49440b0f8fa972.tar.gz |
Driver modifications consistent with my other drivers to facilitate
the use of a single set of sources across 4.x and 5.x branches.
No significant code changes.
Diffstat (limited to 'sys/dev/mlx/mlx.c')
-rw-r--r-- | sys/dev/mlx/mlx.c | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/sys/dev/mlx/mlx.c b/sys/dev/mlx/mlx.c index fe2dc31..189b787 100644 --- a/sys/dev/mlx/mlx.c +++ b/sys/dev/mlx/mlx.c @@ -35,7 +35,6 @@ #include <sys/malloc.h> #include <sys/kernel.h> -#include <sys/bio.h> #include <sys/bus.h> #include <sys/conf.h> #include <sys/devicestat.h> @@ -49,6 +48,7 @@ #include <machine/clock.h> #include <sys/rman.h> +#include <dev/mlx/mlx_compat.h> #include <dev/mlx/mlxio.h> #include <dev/mlx/mlxvar.h> #include <dev/mlx/mlxreg.h> @@ -296,7 +296,7 @@ mlx_attach(struct mlx_softc *sc) */ TAILQ_INIT(&sc->mlx_work); TAILQ_INIT(&sc->mlx_freecmds); - bioq_init(&sc->mlx_bioq); + MLX_BIO_QINIT(sc->mlx_bioq); /* * Select accessor methods based on controller interface type. @@ -696,14 +696,14 @@ mlx_intr(void *arg) * disk resource, then poke the disk resource to start as much work as it can. */ int -mlx_submit_buf(struct mlx_softc *sc, struct bio *bp) +mlx_submit_buf(struct mlx_softc *sc, mlx_bio *bp) { int s; debug_called(1); s = splbio(); - bioq_insert_tail(&sc->mlx_bioq, bp); + MLX_BIO_QINSERT(sc->mlx_bioq, bp); sc->mlx_waitbufs++; splx(s); mlx_startio(sc); @@ -1725,7 +1725,7 @@ mlx_startio(struct mlx_softc *sc) { struct mlx_command *mc; struct mlxd_softc *mlxd; - struct bio *bp; + mlx_bio *bp; int blkcount; int driveno; int cmd; @@ -1740,7 +1740,7 @@ mlx_startio(struct mlx_softc *sc) for (;;) { /* see if there's work to be done */ - if ((bp = bioq_first(&sc->mlx_bioq)) == NULL) + if ((bp = MLX_BIO_QFIRST(sc->mlx_bioq)) == NULL) break; /* get a command */ if ((mc = mlx_alloccmd(sc)) == NULL) @@ -1751,16 +1751,16 @@ mlx_startio(struct mlx_softc *sc) break; } /* get the buf containing our work */ - bioq_remove(&sc->mlx_bioq, bp); + MLX_BIO_QREMOVE(sc->mlx_bioq, bp); sc->mlx_waitbufs--; splx(s); /* connect the buf to the command */ mc->mc_complete = mlx_completeio; mc->mc_private = bp; - mc->mc_data = bp->bio_data; - mc->mc_length = bp->bio_bcount; - if (bp->bio_cmd == BIO_READ) { + mc->mc_data = MLX_BIO_DATA(bp); + mc->mc_length = MLX_BIO_LENGTH(bp); + if (MLX_BIO_IS_READ(bp)) { mc->mc_flags |= MLX_CMD_DATAIN; cmd = MLX_CMD_READSG; } else { @@ -1772,13 +1772,13 @@ mlx_startio(struct mlx_softc *sc) mlx_mapcmd(mc); /* build a suitable I/O command (assumes 512-byte rounded transfers) */ - mlxd = (struct mlxd_softc *)bp->bio_dev->si_drv1; + mlxd = (struct mlxd_softc *)MLX_BIO_SOFTC(bp); driveno = mlxd->mlxd_drive - sc->mlx_sysdrive; - blkcount = (bp->bio_bcount + MLX_BLKSIZE - 1) / MLX_BLKSIZE; + blkcount = (MLX_BIO_LENGTH(bp) + MLX_BLKSIZE - 1) / MLX_BLKSIZE; - if ((bp->bio_pblkno + blkcount) > sc->mlx_sysdrive[driveno].ms_size) + if ((MLX_BIO_LBA(bp) + blkcount) > sc->mlx_sysdrive[driveno].ms_size) device_printf(sc->mlx_dev, "I/O beyond end of unit (%u,%d > %u)\n", - bp->bio_pblkno, blkcount, sc->mlx_sysdrive[driveno].ms_size); + MLX_BIO_LBA(bp), blkcount, sc->mlx_sysdrive[driveno].ms_size); /* * Build the I/O command. Note that the SG list type bits are set to zero, @@ -1787,7 +1787,7 @@ mlx_startio(struct mlx_softc *sc) if (sc->mlx_iftype == MLX_IFTYPE_2) { mlx_make_type1(mc, (cmd == MLX_CMD_WRITESG) ? MLX_CMD_WRITESG_OLD : MLX_CMD_READSG_OLD, blkcount & 0xff, /* xfer length low byte */ - bp->bio_pblkno, /* physical block number */ + MLX_BIO_LBA(bp), /* physical block number */ driveno, /* target drive number */ mc->mc_sgphys, /* location of SG list */ mc->mc_nsgent & 0x3f); /* size of SG list (top 3 bits clear) */ @@ -1795,7 +1795,7 @@ mlx_startio(struct mlx_softc *sc) mlx_make_type5(mc, cmd, blkcount & 0xff, /* xfer length low byte */ (driveno << 3) | ((blkcount >> 8) & 0x07), /* target and length high 3 bits */ - bp->bio_pblkno, /* physical block number */ + MLX_BIO_LBA(bp), /* physical block number */ mc->mc_sgphys, /* location of SG list */ mc->mc_nsgent & 0x3f); /* size of SG list (top 3 bits clear) */ } @@ -1819,12 +1819,11 @@ static void mlx_completeio(struct mlx_command *mc) { struct mlx_softc *sc = mc->mc_sc; - struct bio *bp = (struct bio *)mc->mc_private; - struct mlxd_softc *mlxd = (struct mlxd_softc *)bp->bio_dev->si_drv1; + mlx_bio *bp = (mlx_bio *)mc->mc_private; + struct mlxd_softc *mlxd = (struct mlxd_softc *)MLX_BIO_SOFTC(bp); if (mc->mc_status != MLX_STATUS_OK) { /* could be more verbose here? */ - bp->bio_error = EIO; - bp->bio_flags |= BIO_ERROR; + MLX_BIO_SET_ERROR(bp, EIO); switch(mc->mc_status) { case MLX_STATUS_RDWROFFLINE: /* system drive has gone offline */ @@ -1837,7 +1836,7 @@ mlx_completeio(struct mlx_command *mc) device_printf(sc->mlx_dev, "I/O error - %s\n", mlx_diagnose_command(mc)); #if 0 device_printf(sc->mlx_dev, " b_bcount %ld blkcount %ld b_pblkno %d\n", - bp->bio_bcount, bp->bio_bcount / MLX_BLKSIZE, bp->bio_pblkno); + MLX_BIO_LENGTH(bp), MLX_BIO_LENGTH(bp) / MLX_BLKSIZE, MLX_BIO_LBA(bp)); device_printf(sc->mlx_dev, " %13D\n", mc->mc_mailbox, " "); #endif break; |