Remove FreeBSD 4.x compat shims. Verified by md5.
This commit is contained in:
parent
7f6194d6a6
commit
b04e4c122b
@ -32,6 +32,7 @@
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/bio.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/mutex.h>
|
||||
@ -49,7 +50,6 @@
|
||||
|
||||
#include <geom/geom_disk.h>
|
||||
|
||||
#include <dev/mlx/mlx_compat.h>
|
||||
#include <dev/mlx/mlxio.h>
|
||||
#include <dev/mlx/mlxvar.h>
|
||||
#include <dev/mlx/mlxreg.h>
|
||||
@ -307,7 +307,7 @@ mlx_attach(struct mlx_softc *sc)
|
||||
*/
|
||||
TAILQ_INIT(&sc->mlx_work);
|
||||
TAILQ_INIT(&sc->mlx_freecmds);
|
||||
MLX_BIO_QINIT(sc->mlx_bioq);
|
||||
bioq_init(&sc->mlx_bioq);
|
||||
|
||||
/*
|
||||
* Select accessor methods based on controller interface type.
|
||||
@ -731,13 +731,13 @@ 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, mlx_bio *bp)
|
||||
mlx_submit_buf(struct mlx_softc *sc, struct bio *bp)
|
||||
{
|
||||
|
||||
debug_called(1);
|
||||
|
||||
MLX_IO_ASSERT_LOCKED(sc);
|
||||
MLX_BIO_QINSERT(sc->mlx_bioq, bp);
|
||||
bioq_insert_tail(&sc->mlx_bioq, bp);
|
||||
sc->mlx_waitbufs++;
|
||||
mlx_startio(sc);
|
||||
return(0);
|
||||
@ -1838,7 +1838,7 @@ mlx_startio_cb(void *arg, bus_dma_segment_t *segs, int nsegments, int error)
|
||||
struct mlx_command *mc;
|
||||
struct mlxd_softc *mlxd;
|
||||
struct mlx_softc *sc;
|
||||
mlx_bio *bp;
|
||||
struct bio *bp;
|
||||
int blkcount;
|
||||
int driveno;
|
||||
int cmd;
|
||||
@ -1849,7 +1849,7 @@ mlx_startio_cb(void *arg, bus_dma_segment_t *segs, int nsegments, int error)
|
||||
sc = mc->mc_sc;
|
||||
bp = mc->mc_private;
|
||||
|
||||
if (MLX_BIO_IS_READ(bp)) {
|
||||
if (bp->bio_cmd == BIO_READ) {
|
||||
mc->mc_flags |= MLX_CMD_DATAIN;
|
||||
cmd = MLX_CMD_READSG;
|
||||
} else {
|
||||
@ -1858,14 +1858,14 @@ mlx_startio_cb(void *arg, bus_dma_segment_t *segs, int nsegments, int error)
|
||||
}
|
||||
|
||||
/* build a suitable I/O command (assumes 512-byte rounded transfers) */
|
||||
mlxd = (struct mlxd_softc *)MLX_BIO_SOFTC(bp);
|
||||
mlxd = bp->bio_disk->d_drv1;
|
||||
driveno = mlxd->mlxd_drive - sc->mlx_sysdrive;
|
||||
blkcount = (MLX_BIO_LENGTH(bp) + MLX_BLKSIZE - 1) / MLX_BLKSIZE;
|
||||
blkcount = (bp->bio_bcount + MLX_BLKSIZE - 1) / MLX_BLKSIZE;
|
||||
|
||||
if ((MLX_BIO_LBA(bp) + blkcount) > sc->mlx_sysdrive[driveno].ms_size)
|
||||
if ((bp->bio_pblkno + blkcount) > sc->mlx_sysdrive[driveno].ms_size)
|
||||
device_printf(sc->mlx_dev,
|
||||
"I/O beyond end of unit (%lld,%d > %lu)\n",
|
||||
(long long)MLX_BIO_LBA(bp), blkcount,
|
||||
(long long)bp->bio_pblkno, blkcount,
|
||||
(u_long)sc->mlx_sysdrive[driveno].ms_size);
|
||||
|
||||
/*
|
||||
@ -1876,7 +1876,7 @@ mlx_startio_cb(void *arg, bus_dma_segment_t *segs, int nsegments, int error)
|
||||
mlx_make_type1(mc, (cmd == MLX_CMD_WRITESG) ? MLX_CMD_WRITESG_OLD :
|
||||
MLX_CMD_READSG_OLD,
|
||||
blkcount & 0xff, /* xfer length low byte */
|
||||
MLX_BIO_LBA(bp), /* physical block number */
|
||||
bp->bio_pblkno, /* physical block number */
|
||||
driveno, /* target drive number */
|
||||
mc->mc_sgphys, /* location of SG list */
|
||||
mc->mc_nsgent & 0x3f); /* size of SG list */
|
||||
@ -1885,7 +1885,7 @@ mlx_startio_cb(void *arg, bus_dma_segment_t *segs, int nsegments, int error)
|
||||
blkcount & 0xff, /* xfer length low byte */
|
||||
(driveno << 3) | ((blkcount >> 8) & 0x07),
|
||||
/* target+length high 3 bits */
|
||||
MLX_BIO_LBA(bp), /* physical block number */
|
||||
bp->bio_pblkno, /* physical block number */
|
||||
mc->mc_sgphys, /* location of SG list */
|
||||
mc->mc_nsgent & 0x3f); /* size of SG list */
|
||||
}
|
||||
@ -1908,7 +1908,7 @@ static void
|
||||
mlx_startio(struct mlx_softc *sc)
|
||||
{
|
||||
struct mlx_command *mc;
|
||||
mlx_bio *bp;
|
||||
struct bio *bp;
|
||||
int error;
|
||||
|
||||
MLX_IO_ASSERT_LOCKED(sc);
|
||||
@ -1919,7 +1919,7 @@ mlx_startio(struct mlx_softc *sc)
|
||||
break;
|
||||
|
||||
/* see if there's work to be done */
|
||||
if ((bp = MLX_BIO_QFIRST(sc->mlx_bioq)) == NULL)
|
||||
if ((bp = bioq_first(&sc->mlx_bioq)) == NULL)
|
||||
break;
|
||||
/* get a command */
|
||||
if ((mc = mlx_alloccmd(sc)) == NULL)
|
||||
@ -1930,14 +1930,14 @@ mlx_startio(struct mlx_softc *sc)
|
||||
break;
|
||||
}
|
||||
/* get the buf containing our work */
|
||||
MLX_BIO_QREMOVE(sc->mlx_bioq, bp);
|
||||
bioq_remove(&sc->mlx_bioq, bp);
|
||||
sc->mlx_waitbufs--;
|
||||
|
||||
/* connect the buf to the command */
|
||||
mc->mc_complete = mlx_completeio;
|
||||
mc->mc_private = bp;
|
||||
mc->mc_data = MLX_BIO_DATA(bp);
|
||||
mc->mc_length = MLX_BIO_LENGTH(bp);
|
||||
mc->mc_data = bp->bio_data;
|
||||
mc->mc_length = bp->bio_bcount;
|
||||
|
||||
/* map the command so the controller can work with it */
|
||||
error = bus_dmamap_load(sc->mlx_buffer_dmat, mc->mc_dmamap, mc->mc_data,
|
||||
@ -1956,12 +1956,13 @@ static void
|
||||
mlx_completeio(struct mlx_command *mc)
|
||||
{
|
||||
struct mlx_softc *sc = mc->mc_sc;
|
||||
mlx_bio *bp = (mlx_bio *)mc->mc_private;
|
||||
struct mlxd_softc *mlxd = (struct mlxd_softc *)MLX_BIO_SOFTC(bp);
|
||||
struct bio *bp = mc->mc_private;
|
||||
struct mlxd_softc *mlxd = bp->bio_disk->d_drv1;
|
||||
|
||||
MLX_IO_ASSERT_LOCKED(sc);
|
||||
if (mc->mc_status != MLX_STATUS_OK) { /* could be more verbose here? */
|
||||
MLX_BIO_SET_ERROR(bp, EIO);
|
||||
bp->bio_error = EIO;
|
||||
bp->bio_flags |= BIO_ERROR;
|
||||
|
||||
switch(mc->mc_status) {
|
||||
case MLX_STATUS_RDWROFFLINE: /* system drive has gone offline */
|
||||
@ -1974,7 +1975,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",
|
||||
MLX_BIO_LENGTH(bp), MLX_BIO_LENGTH(bp) / MLX_BLKSIZE, MLX_BIO_LBA(bp));
|
||||
bp->bio_bcount, bp->bio_bcount / MLX_BLKSIZE, bp->bio_pblkno);
|
||||
device_printf(sc->mlx_dev, " %13D\n", mc->mc_mailbox, " ");
|
||||
#endif
|
||||
break;
|
||||
|
@ -1,77 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 2000, 2001 Michael Smith
|
||||
* Copyright (c) 2000 BSDi
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
/*
|
||||
* Portability and compatibility interfaces.
|
||||
*/
|
||||
|
||||
#if __FreeBSD_version < 500003
|
||||
# include <machine/clock.h>
|
||||
# define INTR_ENTROPY 0
|
||||
|
||||
# include <sys/buf.h> /* old buf style */
|
||||
typedef struct buf mlx_bio;
|
||||
typedef struct buf_queue_head mlx_bioq;
|
||||
# define MLX_BIO_QINIT(bq) bufq_init(&bq);
|
||||
# define MLX_BIO_QINSERT(bq, bp) bufq_insert_tail(&bq, bp)
|
||||
# define MLX_BIO_QFIRST(bq) bufq_first(&bq)
|
||||
# define MLX_BIO_QREMOVE(bq, bp) bufq_remove(&bq, bp)
|
||||
# define MLX_BIO_IS_READ(bp) ((bp)->b_flags & B_READ)
|
||||
# define MLX_BIO_DATA(bp) (bp)->b_data
|
||||
# define MLX_BIO_LENGTH(bp) (bp)->b_bcount
|
||||
# define MLX_BIO_LBA(bp) (bp)->b_pblkno
|
||||
# define MLX_BIO_SOFTC(bp) (bp)->b_dev->si_drv1
|
||||
# define MLX_BIO_UNIT(bp) *(int *)((bp)->b_dev->si_drv2)
|
||||
# define MLX_BIO_SET_ERROR(bp, err) do { (bp)->b_error = err; (bp)->b_flags |= B_ERROR;} while(0)
|
||||
# define MLX_BIO_HAS_ERROR(bp) ((bp)->b_flags & B_ERROR)
|
||||
# define MLX_BIO_RESID(bp) (bp)->b_resid
|
||||
# define MLX_BIO_DONE(bp) biodone(bp)
|
||||
# define MLX_BIO_STATS_START(bp) devstat_start_transaction(&((struct mlxd_softc *)MLX_BIO_SOFTC(bp))->mlxd_stats)
|
||||
# define MLX_BIO_STATS_END(bp) devstat_end_transaction_buf(&((struct mlxd_softc *)MLX_BIO_SOFTC(bp))->mlxd_stats, bp)
|
||||
#else
|
||||
# include <sys/bio.h>
|
||||
typedef struct bio mlx_bio;
|
||||
typedef struct bio_queue_head mlx_bioq;
|
||||
# define MLX_BIO_QINIT(bq) bioq_init(&bq);
|
||||
# define MLX_BIO_QINSERT(bq, bp) bioq_insert_tail(&bq, bp)
|
||||
# define MLX_BIO_QFIRST(bq) bioq_first(&bq)
|
||||
# define MLX_BIO_QREMOVE(bq, bp) bioq_remove(&bq, bp)
|
||||
# define MLX_BIO_IS_READ(bp) ((bp)->bio_cmd == BIO_READ)
|
||||
# define MLX_BIO_DATA(bp) (bp)->bio_data
|
||||
# define MLX_BIO_LENGTH(bp) (bp)->bio_bcount
|
||||
# define MLX_BIO_LBA(bp) (bp)->bio_pblkno
|
||||
# define MLX_BIO_SOFTC(bp) (bp)->bio_disk->d_drv1
|
||||
# define MLX_BIO_UNIT(bp) (bp)->bio_disk->d_unit
|
||||
# define MLX_BIO_SET_ERROR(bp, err) do { (bp)->bio_error = err; (bp)->bio_flags |= BIO_ERROR;} while(0)
|
||||
# define MLX_BIO_HAS_ERROR(bp) ((bp)->bio_flags & BIO_ERROR)
|
||||
# define MLX_BIO_RESID(bp) (bp)->bio_resid
|
||||
# define MLX_BIO_DONE(bp) biodone(bp) /* XXX nice to integrate bio_finish here */
|
||||
# define MLX_BIO_STATS_START(bp)
|
||||
# define MLX_BIO_STATS_END(bp)
|
||||
#endif
|
||||
|
@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/bio.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/module.h>
|
||||
@ -48,7 +49,6 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include <geom/geom_disk.h>
|
||||
|
||||
#include <dev/mlx/mlx_compat.h>
|
||||
#include <dev/mlx/mlxio.h>
|
||||
#include <dev/mlx/mlxvar.h>
|
||||
#include <dev/mlx/mlxreg.h>
|
||||
@ -142,15 +142,16 @@ mlxd_ioctl(struct disk *dp, u_long cmd, void *addr, int flag, struct thread *td)
|
||||
* be a multiple of a sector in length.
|
||||
*/
|
||||
static void
|
||||
mlxd_strategy(mlx_bio *bp)
|
||||
mlxd_strategy(struct bio *bp)
|
||||
{
|
||||
struct mlxd_softc *sc = (struct mlxd_softc *)MLX_BIO_SOFTC(bp);
|
||||
struct mlxd_softc *sc = bp->bio_disk->d_drv1;
|
||||
|
||||
debug_called(1);
|
||||
|
||||
/* bogus disk? */
|
||||
if (sc == NULL) {
|
||||
MLX_BIO_SET_ERROR(bp, EINVAL);
|
||||
bp->bio_error = EINVAL;
|
||||
bp->bio_flags |= BIO_ERROR;
|
||||
goto bad;
|
||||
}
|
||||
|
||||
@ -158,11 +159,11 @@ mlxd_strategy(mlx_bio *bp)
|
||||
MLX_IO_LOCK(sc->mlxd_controller);
|
||||
if (sc->mlxd_drive->ms_state == MLX_SYSD_OFFLINE) {
|
||||
MLX_IO_UNLOCK(sc->mlxd_controller);
|
||||
MLX_BIO_SET_ERROR(bp, ENXIO);
|
||||
bp->bio_error = ENXIO;
|
||||
bp->bio_flags |= BIO_ERROR;
|
||||
goto bad;
|
||||
}
|
||||
|
||||
MLX_BIO_STATS_START(bp);
|
||||
mlx_submit_buf(sc->mlxd_controller, bp);
|
||||
MLX_IO_UNLOCK(sc->mlxd_controller);
|
||||
return;
|
||||
@ -171,25 +172,23 @@ mlxd_strategy(mlx_bio *bp)
|
||||
/*
|
||||
* Correctly set the bio to indicate a failed tranfer.
|
||||
*/
|
||||
MLX_BIO_RESID(bp) = MLX_BIO_LENGTH(bp);
|
||||
MLX_BIO_DONE(bp);
|
||||
bp->bio_resid = bp->bio_bcount;
|
||||
biodone(bp);
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
mlxd_intr(void *data)
|
||||
mlxd_intr(struct bio *bp)
|
||||
{
|
||||
mlx_bio *bp = (mlx_bio *)data;
|
||||
|
||||
debug_called(1);
|
||||
|
||||
if (MLX_BIO_HAS_ERROR(bp))
|
||||
MLX_BIO_SET_ERROR(bp, EIO);
|
||||
if (bp->bio_flags & BIO_ERROR)
|
||||
bp->bio_error = EIO;
|
||||
else
|
||||
MLX_BIO_RESID(bp) = 0;
|
||||
bp->bio_resid = 0;
|
||||
|
||||
MLX_BIO_STATS_END(bp);
|
||||
MLX_BIO_DONE(bp);
|
||||
biodone(bp);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -29,6 +29,7 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/bio.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/module.h>
|
||||
@ -47,7 +48,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include <dev/pci/pcireg.h>
|
||||
#include <dev/pci/pcivar.h>
|
||||
|
||||
#include <dev/mlx/mlx_compat.h>
|
||||
#include <dev/mlx/mlxio.h>
|
||||
#include <dev/mlx/mlxvar.h>
|
||||
#include <dev/mlx/mlxreg.h>
|
||||
|
@ -135,7 +135,7 @@ struct mlx_softc
|
||||
struct mlx_command *mlx_busycmd[MLX_NSLOTS]; /* busy commands */
|
||||
int mlx_busycmds; /* count of busy commands */
|
||||
struct mlx_sysdrive mlx_sysdrive[MLX_MAXDRIVES]; /* system drives */
|
||||
mlx_bioq mlx_bioq; /* outstanding I/O operations */
|
||||
struct bio_queue_head mlx_bioq; /* outstanding I/O operations */
|
||||
int mlx_waitbufs; /* number of bufs awaiting commands */
|
||||
|
||||
/* controller status */
|
||||
@ -221,10 +221,10 @@ struct mlxd_softc
|
||||
/*
|
||||
* Interface between driver core and disk driver (should be using a bus?)
|
||||
*/
|
||||
extern int mlx_submit_buf(struct mlx_softc *sc, mlx_bio *bp);
|
||||
extern int mlx_submit_buf(struct mlx_softc *sc, struct bio *bp);
|
||||
extern int mlx_submit_ioctl(struct mlx_softc *sc,
|
||||
struct mlx_sysdrive *drive, u_long cmd,
|
||||
caddr_t addr, int32_t flag, struct thread *td);
|
||||
extern void mlxd_intr(void *data);
|
||||
extern void mlxd_intr(struct bio *bp);
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user