Remove NetBSD compat shims for drivers originally shared with NetBSD/pc98.

NetBSD/pc98 was never merged into the main NetBSD tree and is no longer
developed.  Adding locking to these drivers would have made the compat
shims hard to impossible to maintain, so remove the shims to ease
future changes.

These changes were verified by md5.  Some additional shims can be removed
that do affect the compiled results that I will probably do in another
round.

Approved by:	nyan (tentatively)
This commit is contained in:
jhb 2012-09-06 18:53:33 +00:00
parent 5ceaaf9ef3
commit 56003f21a4
18 changed files with 115 additions and 1053 deletions

View File

@ -14,13 +14,7 @@ __FBSDID("$FreeBSD$");
/* #define SCSI_LOW_QCLEAR_AFTER_CA */
/* #define SCSI_LOW_FLAGS_QUIRKS_OK */
#ifdef __NetBSD__
#define SCSI_LOW_TARGET_OPEN
#endif /* __NetBSD__ */
#ifdef __FreeBSD__
#define SCSI_LOW_FLAGS_QUIRKS_OK
#endif /* __FreeBSD__ */
/*-
* [NetBSD for NEC PC-98 series]
@ -71,41 +65,12 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#ifdef __FreeBSD__
#if __FreeBSD_version >= 500001
#include <sys/bio.h>
#else
#include <machine/clock.h>
#endif
#endif /* __FreeBSD__ */
#include <sys/buf.h>
#include <sys/queue.h>
#include <sys/malloc.h>
#include <sys/errno.h>
#ifdef __NetBSD__
#include <sys/device.h>
#include <vm/vm.h>
#include <machine/bus.h>
#include <machine/intr.h>
#include <machine/dvcfg.h>
#include <dev/cons.h>
#include <dev/scsipi/scsipi_all.h>
#include <dev/scsipi/scsipiconf.h>
#include <dev/scsipi/scsipi_disk.h>
#include <dev/scsipi/scsi_all.h>
#include <dev/scsipi/scsiconf.h>
#include <sys/scsiio.h>
#include <i386/Cbus/dev/scsi_low.h>
#endif /* __NetBSD__ */
#ifdef __FreeBSD__
#include <cam/cam.h>
#include <cam/cam_ccb.h>
#include <cam/cam_sim.h>
@ -119,7 +84,6 @@ __FBSDID("$FreeBSD$");
#include <cam/scsi/scsi_low.h>
#include <sys/cons.h>
#endif /* __FreeBSD__ */
/**************************************************************
* Constants
@ -392,501 +356,6 @@ scsi_low_translate_error_code(cb, tp)
return tp->error_code;
}
#ifdef SCSI_LOW_INTERFACE_XS
/**************************************************************
* SCSI INTERFACE (XS)
**************************************************************/
#define SCSI_LOW_MINPHYS 0x10000
#define SCSI_LOW_MALLOC(size) malloc((size), M_SCSILOW, M_NOWAIT)
#define SCSI_LOW_FREE(pt) free((pt), M_SCSILOW)
#define SCSI_LOW_ALLOC_CCB(flags) scsi_low_get_ccb((flags))
#define SCSI_LOW_XS_POLL_HZ 1000
static int scsi_low_poll_xs(struct scsi_low_softc *, struct slccb *);
static void scsi_low_scsi_minphys_xs(struct buf *);
#ifdef SCSI_LOW_TARGET_OPEN
static int scsi_low_target_open(struct scsipi_link *, struct cfdata *);
#endif /* SCSI_LOW_TARGET_OPEN */
static int scsi_low_scsi_cmd_xs(struct scsipi_xfer *);
static int scsi_low_enable_xs(void *, int);
static int scsi_low_ioctl_xs(struct scsipi_link *, u_long, caddr_t, int, struct proc *);
static int scsi_low_attach_xs(struct scsi_low_softc *);
static int scsi_low_world_start_xs(struct scsi_low_softc *);
static int scsi_low_dettach_xs(struct scsi_low_softc *);
static int scsi_low_ccb_setup_xs(struct scsi_low_softc *, struct slccb *);
static int scsi_low_done_xs(struct scsi_low_softc *, struct slccb *);
static void scsi_low_timeout_xs(struct scsi_low_softc *, int, int);
static u_int scsi_low_translate_quirks_xs(u_int);
static void scsi_low_setup_quirks_xs(struct targ_info *, struct lun_info *, u_int);
struct scsi_low_osdep_funcs scsi_low_osdep_funcs_xs = {
scsi_low_attach_xs,
scsi_low_world_start_xs,
scsi_low_dettach_xs,
scsi_low_ccb_setup_xs,
scsi_low_done_xs,
scsi_low_timeout_xs
};
struct scsipi_device scsi_low_dev = {
NULL, /* Use default error handler */
NULL, /* have a queue, served by this */
NULL, /* have no async handler */
NULL, /* Use default 'done' routine */
};
struct scsi_low_error_code scsi_low_error_code_xs[] = {
{0, XS_NOERROR},
{SENSEIO, XS_SENSE},
{BUSYERR, XS_BUSY },
{SELTIMEOUTIO, XS_SELTIMEOUT},
{TIMEOUTIO, XS_TIMEOUT},
{-1, XS_DRIVER_STUFFUP}
};
static int
scsi_low_ioctl_xs(link, cmd, addr, flag, p)
struct scsipi_link *link;
u_long cmd;
caddr_t addr;
int flag;
struct proc *p;
{
struct scsi_low_softc *slp;
int s, error = ENOTTY;
slp = (struct scsi_low_softc *) link->adapter_softc;
if ((slp->sl_flags & HW_INACTIVE) != 0)
return ENXIO;
if (cmd == SCBUSIORESET)
{
s = SCSI_LOW_SPLSCSI();
scsi_low_restart(slp, SCSI_LOW_RESTART_HARD, NULL);
splx(s);
error = 0;
}
else if (slp->sl_funcs->scsi_low_ioctl != 0)
{
error = (*slp->sl_funcs->scsi_low_ioctl)
(slp, cmd, addr, flag, p);
}
return error;
}
static int
scsi_low_enable_xs(arg, enable)
void *arg;
int enable;
{
struct scsi_low_softc *slp = arg;
if (enable != 0)
{
if ((slp->sl_flags & HW_INACTIVE) != 0)
return ENXIO;
}
else
{
if ((slp->sl_flags & HW_INACTIVE) != 0 ||
(slp->sl_flags & HW_POWERCTRL) == 0)
return 0;
slp->sl_flags |= HW_POWDOWN;
if (slp->sl_funcs->scsi_low_power != NULL)
{
(*slp->sl_funcs->scsi_low_power)
(slp, SCSI_LOW_POWDOWN);
}
}
return 0;
}
static void
scsi_low_scsi_minphys_xs(bp)
struct buf *bp;
{
if (bp->b_bcount > SCSI_LOW_MINPHYS)
bp->b_bcount = SCSI_LOW_MINPHYS;
minphys(bp);
}
static int
scsi_low_poll_xs(slp, cb)
struct scsi_low_softc *slp;
struct slccb *cb;
{
struct scsipi_xfer *xs = cb->osdep;
int tcount;
cb->ccb_flags |= CCB_NOSDONE;
tcount = 0;
while (slp->sl_nio > 0)
{
SCSI_LOW_DELAY((1000 * 1000) / SCSI_LOW_XS_POLL_HZ);
(*slp->sl_funcs->scsi_low_poll) (slp);
if ((slp->sl_flags & (HW_INACTIVE | HW_INITIALIZING)) != 0)
{
cb->ccb_flags |= CCB_NORETRY;
cb->ccb_error |= FATALIO;
(void) scsi_low_revoke_ccb(slp, cb, 1);
printf("%s: hardware inactive in poll mode\n",
slp->sl_xname);
}
if ((xs->flags & ITSDONE) != 0)
break;
if (tcount ++ < SCSI_LOW_XS_POLL_HZ / SCSI_LOW_TIMEOUT_HZ)
continue;
tcount = 0;
scsi_low_timeout_check(slp);
}
xs->flags |= ITSDONE;
scsipi_done(xs);
return COMPLETE;
}
static int
scsi_low_scsi_cmd_xs(xs)
struct scsipi_xfer *xs;
{
struct scsipi_link *splp = xs->sc_link;
struct scsi_low_softc *slp = splp->adapter_softc;
struct targ_info *ti;
struct lun_info *li;
struct slccb *cb;
int s, targ, lun, flags, rv;
if ((cb = SCSI_LOW_ALLOC_CCB(xs->flags & SCSI_NOSLEEP)) == NULL)
return TRY_AGAIN_LATER;
targ = splp->scsipi_scsi.target,
lun = splp->scsipi_scsi.lun;
ti = slp->sl_ti[targ];
cb->osdep = xs;
cb->bp = xs->bp;
if ((xs->flags & SCSI_POLL) == 0)
flags = CCB_AUTOSENSE;
else
flags = CCB_AUTOSENSE | CCB_POLLED;
s = SCSI_LOW_SPLSCSI();
li = scsi_low_alloc_li(ti, lun, 1);
if ((u_int) splp->quirks != li->li_sloi.sloi_quirks)
{
scsi_low_setup_quirks_xs(ti, li, (u_int) splp->quirks);
}
if ((xs->flags & SCSI_RESET) != 0)
{
flags |= CCB_NORETRY | CCB_URGENT;
scsi_low_enqueue(slp, ti, li, cb, flags, SCSI_LOW_MSG_RESET);
}
else
{
if (ti->ti_setup_msg != 0)
{
scsi_low_message_enqueue(slp, ti, li, flags);
}
flags |= CCB_SCSIIO;
scsi_low_enqueue(slp, ti, li, cb, flags, 0);
}
#ifdef SCSI_LOW_DEBUG
if (SCSI_LOW_DEBUG_TEST_GO(SCSI_LOW_ABORT_CHECK, ti->ti_id) != 0)
{
scsi_low_test_abort(slp, ti, li);
}
#endif /* SCSI_LOW_DEBUG */
if ((cb->ccb_flags & CCB_POLLED) != 0)
{
rv = scsi_low_poll_xs(slp, cb);
}
else
{
rv = SUCCESSFULLY_QUEUED;
}
splx(s);
return rv;
}
static int
scsi_low_attach_xs(slp)
struct scsi_low_softc *slp;
{
struct scsipi_adapter *sap;
struct scsipi_link *splp;
strncpy(slp->sl_xname, slp->sl_dev.dv_xname, 16);
sap = SCSI_LOW_MALLOC(sizeof(*sap));
if (sap == NULL)
return ENOMEM;
splp = SCSI_LOW_MALLOC(sizeof(*splp));
if (splp == NULL)
{
SCSI_LOW_FREE(sap);
return ENOMEM;
}
SCSI_LOW_BZERO(sap, sizeof(*sap));
SCSI_LOW_BZERO(splp, sizeof(*splp));
sap->scsipi_cmd = scsi_low_scsi_cmd_xs;
sap->scsipi_minphys = scsi_low_scsi_minphys_xs;
sap->scsipi_enable = scsi_low_enable_xs;
sap->scsipi_ioctl = scsi_low_ioctl_xs;
#ifdef SCSI_LOW_TARGET_OPEN
sap->open_target_lu = scsi_low_target_open;
#endif /* SCSI_LOW_TARGET_OPEN */
splp->adapter_softc = slp;
splp->scsipi_scsi.adapter_target = slp->sl_hostid;
splp->scsipi_scsi.max_target = slp->sl_ntargs - 1;
splp->scsipi_scsi.max_lun = slp->sl_nluns - 1;
splp->scsipi_scsi.channel = SCSI_CHANNEL_ONLY_ONE;
splp->openings = slp->sl_openings;
splp->type = BUS_SCSI;
splp->adapter_softc = slp;
splp->adapter = sap;
splp->device = &scsi_low_dev;
slp->sl_si.si_splp = splp;
slp->sl_show_result = SHOW_ALL_NEG;
return 0;
}
static int
scsi_low_world_start_xs(slp)
struct scsi_low_softc *slp;
{
return 0;
}
static int
scsi_low_dettach_xs(slp)
struct scsi_low_softc *slp;
{
/*
* scsipi does not have dettach bus fucntion.
*
scsipi_dettach_scsibus(slp->sl_si.si_splp);
*/
return 0;
}
static int
scsi_low_ccb_setup_xs(slp, cb)
struct scsi_low_softc *slp;
struct slccb *cb;
{
struct scsipi_xfer *xs = (struct scsipi_xfer *) cb->osdep;
if ((cb->ccb_flags & CCB_SCSIIO) != 0)
{
cb->ccb_scp.scp_cmd = (u_int8_t *) xs->cmd;
cb->ccb_scp.scp_cmdlen = xs->cmdlen;
cb->ccb_scp.scp_data = xs->data;
cb->ccb_scp.scp_datalen = xs->datalen;
cb->ccb_scp.scp_direction = (xs->flags & SCSI_DATA_OUT) ?
SCSI_LOW_WRITE : SCSI_LOW_READ;
cb->ccb_tcmax = xs->timeout / 1000;
}
else
{
scsi_low_unit_ready_cmd(cb);
}
return SCSI_LOW_START_QTAG;
}
static int
scsi_low_done_xs(slp, cb)
struct scsi_low_softc *slp;
struct slccb *cb;
{
struct scsipi_xfer *xs;
xs = (struct scsipi_xfer *) cb->osdep;
if (cb->ccb_error == 0)
{
xs->error = XS_NOERROR;
xs->resid = 0;
}
else
{
if (cb->ccb_rcnt >= slp->sl_max_retry)
cb->ccb_error |= ABORTIO;
if ((cb->ccb_flags & CCB_NORETRY) == 0 &&
(cb->ccb_error & ABORTIO) == 0)
return EJUSTRETURN;
if ((cb->ccb_error & SENSEIO) != 0)
{
xs->sense.scsi_sense = cb->ccb_sense;
}
xs->error = scsi_low_translate_error_code(cb,
&scsi_low_error_code_xs[0]);
#ifdef SCSI_LOW_DIAGNOSTIC
if ((cb->ccb_flags & CCB_SILENT) == 0 &&
cb->ccb_scp.scp_cmdlen > 0 &&
(scsi_low_cmd_flags[cb->ccb_scp.scp_cmd[0]] &
SCSI_LOW_CMD_ABORT_WARNING) != 0)
{
printf("%s: WARNING: scsi_low IO abort\n",
slp->sl_xname);
scsi_low_print(slp, NULL);
}
#endif /* SCSI_LOW_DIAGNOSTIC */
}
if (cb->ccb_scp.scp_status == ST_UNKNOWN)
xs->status = 0; /* XXX */
else
xs->status = cb->ccb_scp.scp_status;
xs->flags |= ITSDONE;
if ((cb->ccb_flags & CCB_NOSDONE) == 0)
scsipi_done(xs);
return 0;
}
static void
scsi_low_timeout_xs(slp, ch, action)
struct scsi_low_softc *slp;
int ch;
int action;
{
switch (ch)
{
case SCSI_LOW_TIMEOUT_CH_IO:
switch (action)
{
case SCSI_LOW_TIMEOUT_START:
timeout(scsi_low_timeout, slp,
hz / SCSI_LOW_TIMEOUT_HZ);
break;
case SCSI_LOW_TIMEOUT_STOP:
untimeout(scsi_low_timeout, slp);
break;
}
break;
case SCSI_LOW_TIMEOUT_CH_ENGAGE:
switch (action)
{
case SCSI_LOW_TIMEOUT_START:
timeout(scsi_low_engage, slp, 1);
break;
case SCSI_LOW_TIMEOUT_STOP:
untimeout(scsi_low_engage, slp);
break;
}
break;
case SCSI_LOW_TIMEOUT_CH_RECOVER:
break;
}
}
u_int
scsi_low_translate_quirks_xs(quirks)
u_int quirks;
{
u_int flags;
flags = SCSI_LOW_DISK_LFLAGS | SCSI_LOW_DISK_TFLAGS;
#ifdef SDEV_NODISC
if (quirks & SDEV_NODISC)
flags &= ~SCSI_LOW_DISK_DISC;
#endif /* SDEV_NODISC */
#ifdef SDEV_NOPARITY
if (quirks & SDEV_NOPARITY)
flags &= ~SCSI_LOW_DISK_PARITY;
#endif /* SDEV_NOPARITY */
#ifdef SDEV_NOCMDLNK
if (quirks & SDEV_NOCMDLNK)
flags &= ~SCSI_LOW_DISK_LINK;
#endif /* SDEV_NOCMDLNK */
#ifdef SDEV_NOTAG
if (quirks & SDEV_NOTAG)
flags &= ~SCSI_LOW_DISK_QTAG;
#endif /* SDEV_NOTAG */
#ifdef SDEV_NOSYNC
if (quirks & SDEV_NOSYNC)
flags &= ~SCSI_LOW_DISK_SYNC;
#endif /* SDEV_NOSYNC */
return flags;
}
static void
scsi_low_setup_quirks_xs(ti, li, flags)
struct targ_info *ti;
struct lun_info *li;
u_int flags;
{
u_int quirks;
li->li_sloi.sloi_quirks = flags;
quirks = scsi_low_translate_quirks_xs(flags);
ti->ti_quirks = quirks & SCSI_LOW_DISK_TFLAGS;
li->li_quirks = quirks & SCSI_LOW_DISK_LFLAGS;
ti->ti_flags_valid |= SCSI_LOW_TARG_FLAGS_QUIRKS_VALID;
li->li_flags_valid |= SCSI_LOW_LUN_FLAGS_QUIRKS_VALID;
scsi_low_calcf_target(ti);
scsi_low_calcf_lun(li);
scsi_low_calcf_show(li);
}
#ifdef SCSI_LOW_TARGET_OPEN
static int
scsi_low_target_open(link, cf)
struct scsipi_link *link;
struct cfdata *cf;
{
u_int target = link->scsipi_scsi.target;
u_int lun = link->scsipi_scsi.lun;
struct scsi_low_softc *slp;
struct targ_info *ti;
struct lun_info *li;
slp = (struct scsi_low_softc *) link->adapter_softc;
ti = slp->sl_ti[target];
li = scsi_low_alloc_li(ti, lun, 0);
if (li == NULL)
return 0;
li->li_cfgflags = cf->cf_flags;
scsi_low_setup_quirks_xs(ti, li, (u_int) link->quirks);
return 0;
}
#endif /* SCSI_LOW_TARGET_OPEN */
#endif /* SCSI_LOW_INTERFACE_XS */
#ifdef SCSI_LOW_INTERFACE_CAM
/**************************************************************
* SCSI INTERFACE (CAM)
**************************************************************/
@ -1001,7 +470,7 @@ scsi_low_scsi_action_cam(sim, ccb)
else
flags = CCB_SCSIIO;
s = SCSI_LOW_SPLSCSI();
s = splcam();
li = scsi_low_alloc_li(ti, lun, 1);
if (ti->ti_setup_msg != 0)
@ -1040,7 +509,7 @@ scsi_low_scsi_action_cam(sim, ccb)
}
#endif /* SCSI_LOW_DIAGNOSTIC */
s = SCSI_LOW_SPLSCSI();
s = splcam();
cb = scsi_low_find_ccb(slp, target, lun, ccb->cab.abort_ccb);
rv = scsi_low_abort_ccb(slp, cb);
splx(s);
@ -1072,7 +541,7 @@ scsi_low_scsi_action_cam(sim, ccb)
if (lun == CAM_LUN_WILDCARD)
lun = 0;
s = SCSI_LOW_SPLSCSI();
s = splcam();
scsi = &cts->proto_specific.scsi;
spi = &cts->xport_specific.spi;
if ((spi->valid & (CTS_SPI_VALID_BUS_WIDTH |
@ -1144,7 +613,7 @@ scsi_low_scsi_action_cam(sim, ccb)
if (lun == CAM_LUN_WILDCARD)
lun = 0;
s = SCSI_LOW_SPLSCSI();
s = splcam();
li = scsi_low_alloc_li(ti, lun, 1);
if (li != NULL && cts->type == CTS_TYPE_CURRENT_SETTINGS) {
struct ccb_trans_settings_scsi *scsi =
@ -1202,7 +671,7 @@ scsi_low_scsi_action_cam(sim, ccb)
}
case XPT_RESET_BUS: /* Reset the specified SCSI bus */
s = SCSI_LOW_SPLSCSI();
s = splcam();
scsi_low_restart(slp, SCSI_LOW_RESTART_HARD, NULL);
splx(s);
ccb->ccb_h.status = CAM_REQ_CMP;
@ -1243,7 +712,7 @@ scsi_low_scsi_action_cam(sim, ccb)
else
flags = CCB_NORETRY | CCB_URGENT;
s = SCSI_LOW_SPLSCSI();
s = splcam();
li = scsi_low_alloc_li(ti, lun, 1);
scsi_low_enqueue(slp, ti, li, cb, flags, msg);
splx(s);
@ -1299,7 +768,7 @@ scsi_low_attach_cam(slp)
int tagged_openings;
sprintf(slp->sl_xname, "%s%d",
DEVPORT_DEVNAME(slp->sl_dev), DEVPORT_DEVUNIT(slp->sl_dev));
device_get_name(slp->sl_dev), device_get_unit(slp->sl_dev));
devq = cam_simq_alloc(SCSI_LOW_NCCB);
if (devq == NULL)
@ -1311,8 +780,8 @@ scsi_low_attach_cam(slp)
tagged_openings = min(slp->sl_openings, SCSI_LOW_MAXNEXUS);
slp->sl_si.sim = cam_sim_alloc(scsi_low_scsi_action_cam,
scsi_low_poll_cam,
DEVPORT_DEVNAME(slp->sl_dev), slp,
DEVPORT_DEVUNIT(slp->sl_dev), &Giant,
device_get_name(slp->sl_dev), slp,
device_get_unit(slp->sl_dev), &Giant,
slp->sl_openings, tagged_openings, devq);
if (slp->sl_si.sim == NULL) {
@ -1479,8 +948,6 @@ scsi_low_timeout_cam(slp, ch, action)
}
}
#endif /* SCSI_LOW_INTERFACE_CAM */
/*=============================================================
* END OF OS switch (All OS depend fucntions should be above)
=============================================================*/
@ -1504,7 +971,7 @@ scsi_low_deactivate(slp)
{
int s;
s = SCSI_LOW_SPLSCSI();
s = splcam();
slp->sl_flags |= HW_INACTIVE;
(*slp->sl_osdep_fp->scsi_low_osdep_timeout)
(slp, SCSI_LOW_TIMEOUT_CH_IO, SCSI_LOW_TIMEOUT_STOP);
@ -1520,7 +987,7 @@ scsi_low_activate(slp)
{
int error, s;
s = SCSI_LOW_SPLSCSI();
s = splcam();
slp->sl_flags &= ~HW_INACTIVE;
if ((error = scsi_low_restart(slp, SCSI_LOW_RESTART_HARD, NULL)) != 0)
{
@ -1600,7 +1067,7 @@ scsi_low_engage(arg)
void *arg;
{
struct scsi_low_softc *slp = arg;
int s = SCSI_LOW_SPLSCSI();
int s = splcam();
switch (slp->sl_rstep)
{
@ -1696,7 +1163,7 @@ scsi_low_alloc_li(ti, lun, alloc)
if (li == NULL)
panic("no lun info mem");
SCSI_LOW_BZERO(li, ti->ti_lunsize);
bzero(li, ti->ti_lunsize);
li->li_lun = lun;
li->li_ti = ti;
@ -1738,7 +1205,7 @@ scsi_low_alloc_ti(slp, targ)
if (ti == NULL)
panic("%s short of memory", slp->sl_xname);
SCSI_LOW_BZERO(ti, slp->sl_targsize);
bzero(ti, slp->sl_targsize);
ti->ti_id = targ;
ti->ti_sc = slp;
@ -1812,7 +1279,7 @@ scsi_low_timeout(arg)
struct scsi_low_softc *slp = arg;
int s;
s = SCSI_LOW_SPLSCSI();
s = splcam();
(void) scsi_low_timeout_check(slp);
(*slp->sl_osdep_fp->scsi_low_osdep_timeout)
(slp, SCSI_LOW_TIMEOUT_CH_IO, SCSI_LOW_TIMEOUT_START);
@ -1995,12 +1462,7 @@ scsi_low_attach(slp, openings, ntargs, nluns, targsize, lunsize)
struct lun_info *li;
int s, i, nccb, rv;
#ifdef SCSI_LOW_INTERFACE_XS
slp->sl_osdep_fp = &scsi_low_osdep_funcs_xs;
#endif /* SCSI_LOW_INTERFACE_XS */
#ifdef SCSI_LOW_INTERFACE_CAM
slp->sl_osdep_fp = &scsi_low_osdep_funcs_cam;
#endif /* SCSI_LOW_INTERFACE_CAM */
if (slp->sl_osdep_fp == NULL)
panic("scsi_low: interface not spcified");
@ -2042,7 +1504,7 @@ scsi_low_attach(slp, openings, ntargs, nluns, targsize, lunsize)
TAILQ_INIT(&slp->sl_start);
/* call os depend attach */
s = SCSI_LOW_SPLSCSI();
s = splcam();
rv = (*slp->sl_osdep_fp->scsi_low_osdep_attach) (slp);
if (rv != 0)
{
@ -2053,7 +1515,7 @@ scsi_low_attach(slp, openings, ntargs, nluns, targsize, lunsize)
}
/* check hardware */
SCSI_LOW_DELAY(1000); /* wait for 1ms */
DELAY(1000); /* wait for 1ms */
if (scsi_low_init(slp, SCSI_LOW_RESTART_HARD) != 0)
{
splx(s);
@ -2088,7 +1550,7 @@ scsi_low_dettach(slp)
{
int s, rv;
s = SCSI_LOW_SPLSCSI();
s = splcam();
if (scsi_low_is_busy(slp) != 0)
{
splx(s);
@ -2208,7 +1670,7 @@ scsi_low_sense_abort_start(slp, ti, li, cb)
{
cb->ccb_scp.scp_cmdlen = 6;
SCSI_LOW_BZERO(cb->ccb_scsi_cmd, cb->ccb_scp.scp_cmdlen);
bzero(cb->ccb_scsi_cmd, cb->ccb_scp.scp_cmdlen);
cb->ccb_scsi_cmd[0] = REQUEST_SENSE;
cb->ccb_scsi_cmd[4] = sizeof(cb->ccb_sense);
cb->ccb_scp.scp_cmd = cb->ccb_scsi_cmd;
@ -2223,7 +1685,7 @@ scsi_low_sense_abort_start(slp, ti, li, cb)
}
else
{
SCSI_LOW_BZERO(&cb->ccb_sense, sizeof(cb->ccb_sense));
bzero(&cb->ccb_sense, sizeof(cb->ccb_sense));
#ifdef SCSI_LOW_NEGOTIATE_BEFORE_SENSE
scsi_low_assert_msg(slp, ti, ti->ti_setup_msg_done, 0);
#endif /* SCSI_LOW_NEGOTIATE_BEFORE_SENSE */
@ -2883,7 +2345,7 @@ scsi_low_twiddle_wait(void)
cnputc('\b');
cnputc(tw_chars[tw_pos++]);
tw_pos %= (sizeof(tw_chars) - 1);
SCSI_LOW_DELAY(TWIDDLEWAIT);
DELAY(TWIDDLEWAIT);
}
void
@ -4632,7 +4094,7 @@ scsi_low_poll(slp, cb)
tcount = 0;
while (slp->sl_nio > 0)
{
SCSI_LOW_DELAY((1000 * 1000) / SCSI_LOW_POLL_HZ);
DELAY((1000 * 1000) / SCSI_LOW_POLL_HZ);
(*slp->sl_funcs->scsi_low_poll) (slp);
if (tcount ++ < SCSI_LOW_POLL_HZ / SCSI_LOW_TIMEOUT_HZ)

View File

@ -48,24 +48,9 @@
* Scsi low OSDEP
* (All os depend structures should be here!)
================================================*/
/******** interface ******************************/
#ifdef __NetBSD__
#define SCSI_LOW_INTERFACE_XS
#endif /* __NetBSD__ */
#ifdef __FreeBSD__
#define SCSI_LOW_INTERFACE_CAM
#define CAM
#endif /* __FreeBSD__ */
/******** includes *******************************/
#ifdef __NetBSD__
#include <i386/Cbus/dev/scsi_dvcfg.h>
#include <dev/isa/ccbque.h>
#endif /* __NetBSD__ */
#ifdef __FreeBSD__
#include <sys/device_port.h>
#include <sys/bus.h>
#include <sys/kdb.h>
#include <cam/cam.h>
#include <cam/cam_ccb.h>
@ -75,47 +60,16 @@
#include <cam/scsi/scsi_dvcfg.h>
#include <i386/isa/ccbque.h>
#endif /* __FreeBSD__ */
/******** functions macro ************************/
#ifdef __NetBSD__
#define SCSI_LOW_DEBUGGER(dev) Debugger()
#define SCSI_LOW_DELAY(mu) delay((mu))
#define SCSI_LOW_SPLSCSI splbio
#define SCSI_LOW_BZERO(pt, size) memset((pt), 0, (size))
#endif /* __NetBSD__ */
#ifdef __FreeBSD__
#undef MSG_IDENTIFY
#define SCSI_LOW_DEBUGGER(dev) kdb_enter(KDB_WHY_CAM, dev)
#define SCSI_LOW_DELAY(mu) DELAY((mu))
#define SCSI_LOW_SPLSCSI splcam
#define SCSI_LOW_BZERO(pt, size) bzero((pt), (size))
#endif /* __FreeBSD__ */
/******** os depend interface structures **********/
#ifdef __NetBSD__
typedef struct scsipi_sense_data scsi_low_osdep_sense_data_t;
struct scsi_low_osdep_interface {
struct device si_dev;
struct scsipi_link *si_splp;
};
struct scsi_low_osdep_targ_interface {
};
struct scsi_low_osdep_lun_interface {
u_int sloi_quirks;
};
#endif /* __NetBSD__ */
#ifdef __FreeBSD__
typedef struct scsi_sense_data scsi_low_osdep_sense_data_t;
struct scsi_low_osdep_interface {
DEVPORT_DEVICE si_dev;
device_t si_dev;
struct cam_sim *sim;
struct cam_path *path;
@ -134,7 +88,6 @@ struct scsi_low_osdep_targ_interface {
struct scsi_low_osdep_lun_interface {
};
#endif /* __FreeBSD__ */
/******** os depend interface functions *************/
struct slccb;

View File

@ -34,99 +34,13 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#ifdef __NetBSD__
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/device.h>
#include <sys/errno.h>
#include <machine/bus.h>
#include <machine/intr.h>
#include <dev/isa/isareg.h>
#include <dev/isa/isavar.h>
#include <dev/isa/pisaif.h>
#include <machine/dvcfg.h>
#include <dev/scsipi/scsi_all.h>
#include <dev/scsipi/scsipi_all.h>
#include <dev/scsipi/scsiconf.h>
#include <dev/scsipi/scsi_disk.h>
#include <i386/Cbus/dev/scsi_low.h>
#include <i386/Cbus/dev/scsi_low_pisa.h>
#define SCSIBUS_RESCAN
int
scsi_low_deactivate_pisa(dh)
pisa_device_handle_t dh;
{
struct scsi_low_softc *sc = PISA_DEV_SOFTC(dh);
if (scsi_low_deactivate(sc) != 0)
return EBUSY;
return 0;
}
int
scsi_low_activate_pisa(dh)
pisa_device_handle_t dh;
{
struct scsi_low_softc *sc = PISA_DEV_SOFTC(dh);
slot_device_res_t dr = PISA_RES_DR(dh);
sc->sl_cfgflags = DVCFG_MKCFG(DVCFG_MAJOR(sc->sl_cfgflags), \
DVCFG_MINOR(PISA_DR_DVCFG(dr)));
sc->sl_irq = PISA_DR_IRQ(dr);
if (scsi_low_activate(sc) != 0)
return EBUSY;
/* rescan the scsi bus */
#ifdef SCSIBUS_RESCAN
if (scsi_low_is_busy(sc) == 0 &&
PISA_RES_EVENT(dh) == PISA_EVENT_INSERT)
scsi_probe_busses((int) sc->sl_si.si_splp->scsipi_scsi.scsibus,
-1, -1);
#endif
return 0;
}
int
scsi_low_notify_pisa(dh, ev)
pisa_device_handle_t dh;
pisa_event_t ev;
{
struct scsi_low_softc *sc = PISA_DEV_SOFTC(dh);
switch(ev)
{
case PISA_EVENT_QUERY_SUSPEND:
if (scsi_low_is_busy(sc) != 0)
return SD_EVENT_STATUS_BUSY;
break;
default:
break;
}
return 0;
}
#endif /* __NetBSD__ */
#ifdef __FreeBSD__
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#if __FreeBSD_version >= 500001
#include <sys/bio.h>
#endif
#include <sys/buf.h>
#include <sys/queue.h>
#include <sys/device_port.h>
#include <sys/bus.h>
#include <sys/module.h>
#include <cam/scsi/scsi_low.h>
@ -165,4 +79,3 @@ static moduledata_t scsi_low_moduledata = {
DECLARE_MODULE(scsi_low, scsi_low_moduledata, SI_SUB_DRIVERS, SI_ORDER_MIDDLE);
MODULE_VERSION(scsi_low, 1);
MODULE_DEPEND(scsi_low, cam, 1, 1, 1);
#endif /* __FreeBSD__ */

View File

@ -34,14 +34,7 @@
#ifndef _SCSI_LOW_PISA_H_
#define _SCSI_LOW_PISA_H_
#ifdef __NetBSD__
int scsi_low_activate_pisa(pisa_device_handle_t);
int scsi_low_deactivate_pisa(pisa_device_handle_t);
int scsi_low_notify_pisa(pisa_device_handle_t, pisa_event_t);
#endif /* __NetBSD__ */
#ifdef __FreeBSD__
int scsi_low_activate_pisa(struct scsi_low_softc *, int);
int scsi_low_deactivate_pisa(struct scsi_low_softc *);
#endif /* __FreeBSD__ */
#endif /* !_SCSI_LOW_PISA_H_ */

View File

@ -41,9 +41,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#if defined(__FreeBSD__) && __FreeBSD_version > 500001
#include <sys/bio.h>
#endif /* __ FreeBSD__ */
#include <sys/buf.h>
#include <sys/queue.h>
#include <sys/malloc.h>
@ -51,35 +49,13 @@ __FBSDID("$FreeBSD$");
#include <vm/vm.h>
#ifdef __NetBSD__
#include <sys/device.h>
#include <machine/bus.h>
#include <machine/intr.h>
#include <dev/scsipi/scsi_all.h>
#include <dev/scsipi/scsipi_all.h>
#include <dev/scsipi/scsiconf.h>
#include <dev/scsipi/scsi_disk.h>
#include <machine/dvcfg.h>
#include <machine/physio_proc.h>
#include <i386/Cbus/dev/scsi_low.h>
#include <dev/ic/wd33c93reg.h>
#include <i386/Cbus/dev/ct/ctvar.h>
#include <i386/Cbus/dev/ct/ct_machdep.h>
#include <i386/Cbus/dev/ct/bshwvar.h>
#endif /* __NetBSD__ */
#ifdef __FreeBSD__
#include <machine/bus.h>
#include <machine/md_var.h>
#include <compat/netbsd/dvcfg.h>
#include <compat/netbsd/physio_proc.h>
#include <sys/module.h> /* XXX: Hack */
#include <cam/scsi/scsi_low.h>
#include <dev/ic/wd33c93reg.h>
@ -88,7 +64,6 @@ __FBSDID("$FreeBSD$");
#include <dev/ct/bshwvar.h>
#include <vm/pmap.h>
#endif /* __FreeBSD__ */
#define BSHW_IO_CONTROL_FLAGS 0
@ -99,14 +74,7 @@ int bshw_data_write_bytes = 4096;
/*********************************************************
* OS dep part
*********************************************************/
#ifdef __NetBSD__
#define BSHW_PAGE_SIZE NBPG
#endif /* __NetBSD__ */
#ifdef __FreeBSD__
#define BSHW_PAGE_SIZE PAGE_SIZE
typedef unsigned long vaddr_t;
#endif /* __FreeBSD__ */
/*********************************************************
* GENERIC MACHDEP FUNCTIONS
@ -169,7 +137,7 @@ bshw_bus_reset(ct)
regv &= ~MBR_IEN;
ct_cr_write_1(chp, wd3s_mbank, regv);
SCSI_LOW_DELAY(500000);
DELAY(500000);
/* reset signal off */
regv &= ~MBR_RST;
@ -465,14 +433,14 @@ bshw_dma_xfer_start(ct)
endva = (vaddr_t) round_page((vaddr_t) sp->scp_data + sp->scp_datalen);
for (va = (vaddr_t) sp->scp_data; ; phys = nphys)
{
if ((va += BSHW_PAGE_SIZE) >= endva)
if ((va += PAGE_SIZE) >= endva)
{
bs->sc_seglen = sp->scp_datalen;
break;
}
nphys = vtophys(va);
if (phys + BSHW_PAGE_SIZE != nphys || nphys >= bs->sc_minphys)
if (phys + PAGE_SIZE != nphys || nphys >= bs->sc_minphys)
{
bs->sc_seglen =
(u_int8_t *) trunc_page(va) - sp->scp_data;

View File

@ -42,36 +42,12 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#if defined(__FreeBSD__) && __FreeBSD_version > 500001
#include <sys/bio.h>
#endif /* __ FreeBSD__ */
#include <sys/buf.h>
#include <sys/queue.h>
#include <sys/malloc.h>
#include <sys/errno.h>
#ifdef __NetBSD__
#include <sys/device.h>
#include <machine/bus.h>
#include <machine/intr.h>
#include <dev/scsipi/scsi_all.h>
#include <dev/scsipi/scsipi_all.h>
#include <dev/scsipi/scsiconf.h>
#include <dev/scsipi/scsi_disk.h>
#include <machine/dvcfg.h>
#include <machine/physio_proc.h>
#include <i386/Cbus/dev/scsi_low.h>
#include <dev/ic/wd33c93reg.h>
#include <i386/Cbus/dev/ct/ctvar.h>
#include <i386/Cbus/dev/ct/ct_machdep.h>
#endif /* __NetBSD__ */
#ifdef __FreeBSD__
#include <machine/bus.h>
#include <compat/netbsd/dvcfg.h>
@ -82,7 +58,6 @@ __FBSDID("$FreeBSD$");
#include <dev/ic/wd33c93reg.h>
#include <dev/ct/ctvar.h>
#include <dev/ct/ct_machdep.h>
#endif /* __FreeBSD__ */
#define CT_NTARGETS 8
#define CT_NLUNS 8
@ -227,7 +202,7 @@ cthw_chip_reset(chp, chiprevp, chipclk, hostid)
/* issue abort cmd */
ct_cr_write_1(chp, wd3s_cmd, WD3S_ABORT);
SCSI_LOW_DELAY(1000); /* 1ms wait */
DELAY(1000); /* 1ms wait */
(void) ct_stat_read_1(chp);
(void) ct_cr_read_1(chp, wd3s_stat);
@ -274,7 +249,7 @@ cthw_chip_reset(chp, chiprevp, chipclk, hostid)
ct_cr_write_1(chp, wd3s_cmd, WD3S_RESET);
}
SCSI_LOW_DELAY(1);
DELAY(1);
}
if (wc == 0)
return ENXIO;
@ -381,7 +356,7 @@ ctprint(aux, name)
if (name != NULL)
printf("%s: scsibus ", name);
return UNCONF;
return 1;
}
void
@ -411,7 +386,7 @@ cthw_attention(ct)
return;
ct_cr_write_1(chp, wd3s_cmd, WD3S_ASSERT_ATN);
SCSI_LOW_DELAY(10);
DELAY(10);
if ((ct_stat_read_1(chp) & STR_LCI) == 0)
ct->sc_atten = 0;
ct_unbusy(ct);
@ -689,7 +664,7 @@ ct_xfer(ct, data, len, direction, statp)
}
else
{
SCSI_LOW_DELAY(1);
DELAY(1);
}
/* check phase miss */
@ -721,7 +696,7 @@ ct_io_xfer(ct)
slp->sl_error |= PDMAERR;
if (slp->sl_scp.scp_direction == SCSI_LOW_WRITE)
SCSI_LOW_BZERO(pbuf, CT_PADDING_BUF_SIZE);
bzero(pbuf, CT_PADDING_BUF_SIZE);
ct_xfer(ct, pbuf, CT_PADDING_BUF_SIZE,
sp->scp_direction, &stat);
}
@ -926,7 +901,7 @@ ct_unbusy(ct)
if (regv == (u_int8_t) -1)
return EIO;
SCSI_LOW_DELAY(CT_DELAY_INTERVAL);
DELAY(CT_DELAY_INTERVAL);
}
printf("%s: unbusy timeout\n", slp->sl_xname);
@ -947,7 +922,7 @@ ct_catch_intr(ct)
if ((regv & (STR_INT | STR_BSY | STR_CIP)) == STR_INT)
return 0;
SCSI_LOW_DELAY(CT_DELAY_INTERVAL);
DELAY(CT_DELAY_INTERVAL);
}
return EJUSTRETURN;
}
@ -1003,7 +978,7 @@ ctintr(arg)
(u_int) scsi_status);
#ifdef KDB
if (ct_debug > 1)
SCSI_LOW_DEBUGGER("ct");
kdb_enter(KDB_WHY_CAM, "ct");
#endif /* KDB */
}
#endif /* CT_DEBUG */

View File

@ -42,36 +42,12 @@ __FBSDID("$FreeBSD$");
#include <sys/buf.h>
#include <sys/queue.h>
#include <sys/malloc.h>
#include <sys/device_port.h>
#include <sys/bus.h>
#include <sys/module.h>
#include <sys/errno.h>
#include <vm/vm.h>
#ifdef __NetBSD__
#include <machine/bus.h>
#include <machine/intr.h>
#include <dev/scsipi/scsi_all.h>
#include <dev/scsipi/scsipi_all.h>
#include <dev/scsipi/scsiconf.h>
#include <dev/scsipi/scsi_disk.h>
#include <dev/isa/isareg.h>
#include <dev/isa/isavar.h>
#include <dev/isa/isadmavar.h>
#include <machine/dvcfg.h>
#include <machine/physio_proc.h>
#include <machine/syspmgr.h>
#include <i386/Cbus/dev/scsi_low.h>
#include <dev/ic/wd33c93reg.h>
#include <i386/Cbus/dev/ct/ctvar.h>
#include <i386/Cbus/dev/ct/bshwvar.h>
#endif /* __NetBSD__ */
#ifdef __FreeBSD__
#include <machine/bus.h>
#include <machine/resource.h>
#include <sys/bus.h>
@ -89,7 +65,6 @@ __FBSDID("$FreeBSD$");
#include <dev/ic/wd33c93reg.h>
#include <dev/ct/ctvar.h>
#include <dev/ct/bshwvar.h>
#endif /* __FreeBSD__ */
#define BSHW_IOSZ 0x08
#define BSHW_IOBASE 0xcc0

View File

@ -66,13 +66,6 @@ struct ct_softc {
struct ct_bus_access_handle sc_ch; /* bus access handle */
#ifdef __NetBSD__
bus_dma_tag_t sc_dmat; /* data DMA tag */
void *sc_ih;
#endif /* __NetBSD__ */
#ifdef __FreeBSD__
struct resource *port_res;
struct resource *mem_res;
struct resource *irq_res;
@ -82,7 +75,6 @@ struct ct_softc {
bus_dmamap_t sc_dmamapt; /* data DMAMAP tag */
void *sc_ih;
#endif /* __FreeBSD__ */
int sc_chiprev; /* chip version */
#define CT_WD33C93 0x00000

View File

@ -42,37 +42,12 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#if defined(__FreeBSD__) && __FreeBSD_version >= 500001
#include <sys/bio.h>
#endif /* __FreeBSD__ */
#include <sys/buf.h>
#include <sys/queue.h>
#include <sys/malloc.h>
#include <sys/errno.h>
#ifdef __NetBSD__
#include <sys/device.h>
#include <machine/bus.h>
#include <machine/intr.h>
#include <dev/scsipi/scsi_all.h>
#include <dev/scsipi/scsipi_all.h>
#include <dev/scsipi/scsiconf.h>
#include <dev/scsipi/scsi_disk.h>
#include <machine/dvcfg.h>
#include <machine/physio_proc.h>
#include <i386/Cbus/dev/scsi_low.h>
#include <i386/Cbus/dev/ncr53c500reg.h>
#include <i386/Cbus/dev/ncr53c500hw.h>
#include <i386/Cbus/dev/ncr53c500var.h>
#include <i386/Cbus/dev/ncr53c500hwtab.h>
#endif /* __NetBSD__ */
#ifdef __FreeBSD__
#include <machine/cpu.h>
#include <machine/bus.h>
@ -86,7 +61,6 @@ __FBSDID("$FreeBSD$");
#include <dev/ncv/ncr53c500var.h>
#include <dev/ncv/ncr53c500hwtab.h>
#endif /* __FreeBSD__ */
#define NCV_MAX_DATA_SIZE (64 * 1024)
#define NCV_DELAY_MAX (2 * 1000 * 1000)
@ -274,12 +248,12 @@ ncvhw_check(iot, ioh, hw)
bus_space_write_1(iot, ioh, cr0_cmd, CMD_FLUSH);
bus_space_write_1(iot, ioh, cr0_cmd, CMD_RSTSCSI);
bus_space_write_1(iot, ioh, cr0_cmd, CMD_NOP | CMD_DMA);
SCSI_LOW_DELAY(100 * 1000);
DELAY(100 * 1000);
/* check response */
bus_space_read_1(iot, ioh, cr0_stat);
stat = bus_space_read_1(iot, ioh, cr0_istat);
SCSI_LOW_DELAY(1000);
DELAY(1000);
if (((stat & INTR_SBR) == 0) ||
(bus_space_read_1(iot, ioh, cr0_istat) & INTR_SBR))
@ -387,7 +361,7 @@ ncvhw_attention(sc)
{
bus_space_write_1(sc->sc_iot, sc->sc_ioh, cr0_cmd, CMD_SETATN);
SCSI_LOW_DELAY(10);
DELAY(10);
}
static void
@ -493,7 +467,7 @@ ncv_world_start(sc, fdone)
ncvhw_select_register_0(iot, ioh, &sc->sc_hw);
bus_space_read_1(sc->sc_iot, sc->sc_ioh, cr0_stat);
stat = bus_space_read_1(sc->sc_iot, sc->sc_ioh, cr0_istat);
SCSI_LOW_DELAY(1000);
DELAY(1000);
if (((stat & INTR_SBR) == 0) ||
(bus_space_read_1(sc->sc_iot, sc->sc_ioh, cr0_istat) & INTR_SBR))
@ -641,7 +615,7 @@ ncvprint(aux, name)
if (name != NULL)
printf("%s: scsibus ", name);
return UNCONF;
return 1;
}
void
@ -782,7 +756,7 @@ ncv_pio_read(sc, buf, reqlen)
if (fstat & FIFO_BRK)
break;
SCSI_LOW_DELAY(1);
DELAY(1);
}
}
@ -799,7 +773,7 @@ ncv_pio_read(sc, buf, reqlen)
if (fstat & FIFO_BRK)
break;
SCSI_LOW_DELAY(1);
DELAY(1);
}
}
@ -845,7 +819,7 @@ ncv_pio_write(sc, buf, reqlen)
}
else
{
SCSI_LOW_DELAY(1);
DELAY(1);
}
}
@ -862,7 +836,7 @@ ncv_pio_write(sc, buf, reqlen)
}
else
{
SCSI_LOW_DELAY(1);
DELAY(1);
}
}
@ -977,7 +951,7 @@ ncv_catch_intr(sc)
if ((status & STAT_INT) != 0)
return 0;
SCSI_LOW_DELAY(NCV_DELAY_INTERVAL);
DELAY(NCV_DELAY_INTERVAL);
}
return EJUSTRETURN;
}
@ -1035,7 +1009,7 @@ ncvintr(arg)
status, ireason);
#ifdef KDB
if (ncv_debug > 1)
SCSI_LOW_DEBUGGER("ncv");
kdb_enter(KDB_WHY_CAM, "ncv");
#endif /* KDB */
}
#endif /* NCV_DEBUG */
@ -1155,7 +1129,7 @@ ncvintr(arg)
{
u_int8_t padding[NCV_PADDING_SIZE];
SCSI_LOW_BZERO(padding, sizeof(padding));
bzero(padding, sizeof(padding));
ncv_pio_write(sc, padding, sizeof(padding));
}
else

View File

@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
#include <sys/errno.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/systm.h>
#include <machine/bus.h>
@ -50,7 +51,7 @@ __FBSDID("$FreeBSD$");
#include <sys/rman.h>
#include <compat/netbsd/dvcfg.h>
#include <sys/device_port.h>
#include <sys/bus.h>
#include <dev/pccard/pccardvar.h>
@ -67,10 +68,10 @@ __FBSDID("$FreeBSD$");
#include "pccarddevs.h"
static int ncvprobe(DEVPORT_PDEVICE devi);
static int ncvattach(DEVPORT_PDEVICE devi);
static int ncvprobe(device_t devi);
static int ncvattach(device_t devi);
static void ncv_card_unload(DEVPORT_PDEVICE);
static void ncv_card_unload(device_t);
static const struct ncv_product {
struct pccard_product prod;
@ -102,7 +103,7 @@ ncv_pccard_intr(void * arg)
}
static void
ncv_release_resource(DEVPORT_PDEVICE dev)
ncv_release_resource(device_t dev)
{
struct ncv_softc *sc = device_get_softc(dev);
@ -132,10 +133,10 @@ ncv_release_resource(DEVPORT_PDEVICE dev)
}
static int
ncv_alloc_resource(DEVPORT_PDEVICE dev)
ncv_alloc_resource(device_t dev)
{
struct ncv_softc *sc = device_get_softc(dev);
u_int32_t flags = DEVPORT_PDEVFLAGS(dev);
u_int32_t flags = device_get_flags(dev);
u_long ioaddr, iosize, maddr, msize;
int error;
bus_addr_t offset = 0;
@ -290,9 +291,9 @@ MODULE_DEPEND(ncv, scsi_low, 1, 1, 1);
DRIVER_MODULE(ncv, pccard, ncv_pccard_driver, ncv_devclass, 0, 0);
static void
ncv_card_unload(DEVPORT_PDEVICE devi)
ncv_card_unload(device_t devi)
{
struct ncv_softc *sc = DEVPORT_PDEVGET_SOFTC(devi);
struct ncv_softc *sc = device_get_softc(devi);
intrmask_t s;
s = splcam();
@ -302,11 +303,11 @@ ncv_card_unload(DEVPORT_PDEVICE devi)
}
static int
ncvprobe(DEVPORT_PDEVICE devi)
ncvprobe(device_t devi)
{
int rv;
struct ncv_softc *sc = device_get_softc(devi);
u_int32_t flags = DEVPORT_PDEVFLAGS(devi);
u_int32_t flags = device_get_flags(devi);
rv = ncvprobesubr(rman_get_bustag(sc->port_res),
rman_get_bushandle(sc->port_res),
@ -316,17 +317,17 @@ ncvprobe(DEVPORT_PDEVICE devi)
}
static int
ncvattach(DEVPORT_PDEVICE devi)
ncvattach(device_t devi)
{
struct ncv_softc *sc;
struct scsi_low_softc *slp;
u_int32_t flags = DEVPORT_PDEVFLAGS(devi);
u_int32_t flags = device_get_flags(devi);
intrmask_t s;
char dvname[16]; /* SCSI_LOW_DVNAME_LEN */
strcpy(dvname, "ncv");
sc = DEVPORT_PDEVALLOC_SOFTC(devi);
sc = device_get_softc(devi);
if (sc == NULL) {
return(0);
}

View File

@ -42,15 +42,6 @@
struct ncv_softc {
struct scsi_low_softc sc_sclow; /* generic data */
#ifdef __NetBSD__
bus_space_tag_t sc_iot;
bus_space_tag_t sc_memt;
bus_space_handle_t sc_ioh;
void *sc_ih;
#endif /* __NetBSD__ */
#ifdef __FreeBSD__
bus_space_tag_t sc_iot;
bus_space_tag_t sc_memt;
bus_space_handle_t sc_ioh;
@ -65,7 +56,6 @@ struct ncv_softc {
struct resource *mem_res;
void *ncv_intrhand;
#endif /* __FreeBSD__ */
int sc_tmaxcnt;
int sc_selstop; /* sel atn stop asserted */

View File

@ -45,33 +45,12 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#if defined(__FreeBSD__) && __FreeBSD_version > 500001
#include <sys/bio.h>
#endif /* __ FreeBSD__ */
#include <sys/buf.h>
#include <sys/queue.h>
#include <sys/malloc.h>
#include <sys/errno.h>
#ifdef __NetBSD__
#include <sys/device.h>
#include <machine/bus.h>
#include <machine/intr.h>
#include <dev/scsipi/scsi_all.h>
#include <dev/scsipi/scsipi_all.h>
#include <dev/scsipi/scsiconf.h>
#include <dev/scsipi/scsi_disk.h>
#include <machine/dvcfg.h>
#include <machine/physio_proc.h>
#include <i386/Cbus/dev/scsi_low.h>
#include <i386/Cbus/dev/nspreg.h>
#include <i386/Cbus/dev/nspvar.h>
#endif /* __NetBSD__ */
#ifdef __FreeBSD__
#include <machine/cpu.h>
#include <machine/bus.h>
@ -81,7 +60,6 @@ __FBSDID("$FreeBSD$");
#include <cam/scsi/scsi_low.h>
#include <dev/nsp/nspreg.h>
#include <dev/nsp/nspvar.h>
#endif /* __FreeBSD__ */
/***************************************************
* USER SETTINGS
@ -248,7 +226,7 @@ nsp_expect_signal(struct nsp_softc *sc, u_int8_t curphase, u_int8_t mask)
if ((ph & mask) != 0 && (ph & SCBUSMON_PHMASK) == curphase)
return 1;
SCSI_LOW_DELAY(NSP_DELAY_INTERVAL);
DELAY(NSP_DELAY_INTERVAL);
}
printf("%s: nsp_expect_signal timeout\n", slp->sl_xname);
@ -312,7 +290,7 @@ nsphw_attention(sc)
cr = nsp_cr_read_1(bst, bsh, NSPR_SCBUSCR)/* & ~SCBUSCR_ACK */;
nsp_cr_write_1(bst, bsh, NSPR_SCBUSCR, cr | SCBUSCR_ATN);
SCSI_LOW_DELAY(10);
DELAY(10);
}
static void
@ -326,7 +304,7 @@ nsphw_bus_reset(sc)
bus_space_write_1(bst, bsh, nsp_irqcr, IRQCR_ALLMASK);
nsp_cr_write_1(bst, bsh, NSPR_SCBUSCR, SCBUSCR_RST);
SCSI_LOW_DELAY(100 * 1000); /* 100ms */
DELAY(100 * 1000); /* 100ms */
nsp_cr_write_1(bst, bsh, NSPR_SCBUSCR, 0);
for (i = 0; i < 5; i ++)
(void) nsp_cr_read_1(bst, bsh, NSPR_IRQPHS);
@ -350,7 +328,7 @@ nsphw_selection_done_and_expect_msgout(sc)
/* deassert sel and assert atten */
sc->sc_seltout = 0;
nsp_cr_write_1(bst, bsh, NSPR_SCBUSCR, sc->sc_busc);
SCSI_LOW_DELAY(1);
DELAY(1);
nsp_cr_write_1(bst, bsh, NSPR_SCBUSCR,
sc->sc_busc | SCBUSCR_ADIR | SCBUSCR_ACKEN);
SCSI_LOW_ASSERT_ATN(slp);
@ -392,7 +370,7 @@ nsphw_start_selection(sc, cb)
{
/* XXX: what a stupid chip! */
arbs = nsp_cr_read_1(bst, bsh, NSPR_ARBITS);
SCSI_LOW_DELAY(1);
DELAY(1);
}
while ((arbs & (ARBITS_WIN | ARBITS_FAIL)) == 0 && wc -- > 0);
@ -410,19 +388,19 @@ nsphw_start_selection(sc, cb)
scsi_low_arbit_win(slp);
s = splhigh();
SCSI_LOW_DELAY(3);
DELAY(3);
nsp_cr_write_1(bst, bsh, NSPR_DATA,
sc->sc_idbit | (1 << ti->ti_id));
nsp_cr_write_1(bst, bsh, NSPR_SCBUSCR,
SCBUSCR_SEL | SCBUSCR_BSY | sc->sc_busc);
SCSI_LOW_DELAY(3);
DELAY(3);
nsp_cr_write_1(bst, bsh, NSPR_SCBUSCR, SCBUSCR_SEL |
SCBUSCR_BSY | SCBUSCR_DOUT | sc->sc_busc);
nsp_cr_write_1(bst, bsh, NSPR_ARBITS, ARBITS_CLR);
SCSI_LOW_DELAY(3);
DELAY(3);
nsp_cr_write_1(bst, bsh, NSPR_SCBUSCR,
SCBUSCR_SEL | SCBUSCR_DOUT | sc->sc_busc);
SCSI_LOW_DELAY(1);
DELAY(1);
if ((nsp_io_control & NSP_WAIT_FOR_SELECT) != 0)
{
@ -436,11 +414,11 @@ nsphw_start_selection(sc, cb)
ph = nsp_cr_read_1(bst, bsh, NSPR_SCBUSMON);
if ((ph & SCBUSMON_BSY) == 0)
{
SCSI_LOW_DELAY(NSP_SEL_CHECK_INTERVAL);
DELAY(NSP_SEL_CHECK_INTERVAL);
continue;
}
SCSI_LOW_DELAY(1);
DELAY(1);
ph = nsp_cr_read_1(bst, bsh, NSPR_SCBUSMON);
if ((ph & SCBUSMON_BSY) != 0)
{
@ -631,7 +609,7 @@ nspprint(aux, name)
if (name != NULL)
printf("%s: scsibus ", name);
return UNCONF;
return 1;
}
void
@ -1023,7 +1001,7 @@ nsp_wait_interrupt(sc)
}
return 1;
}
SCSI_LOW_DELAY(1);
DELAY(1);
}
return 0;
}
@ -1088,7 +1066,7 @@ nsp_pio_read(sc, suspendio)
if ((sc->sc_icr & SCIENR_FIFO) != 0)
break;
SCSI_LOW_DELAY(1);
DELAY(1);
}
if ((-- tout) <= 0)
@ -1200,7 +1178,7 @@ nsp_pio_write(sc, suspendio)
if ((sc->sc_icr & SCIENR_FIFO) != 0)
break;
SCSI_LOW_DELAY(1);
DELAY(1);
}
if ((-- tout) <= 0)
@ -1234,7 +1212,7 @@ nsp_negate_signal(struct nsp_softc *sc, u_int8_t mask, u_char *s)
return -1;
if ((regv & mask) == 0)
return 1;
SCSI_LOW_DELAY(NSP_DELAY_INTERVAL);
DELAY(NSP_DELAY_INTERVAL);
}
printf("%s: %s nsp_negate_signal timeout\n", slp->sl_xname, s);
@ -1519,7 +1497,7 @@ nspintr(arg)
scsi_low_print(slp, NULL);
#ifdef KDB
if (nsp_debug > 1)
SCSI_LOW_DEBUGGER("nsp");
kdb_enter(KDB_WHY_CAM, "nsp");
#endif /* KDB */
}
#endif /* NSP_DEBUG */
@ -1899,7 +1877,7 @@ nsp_timeout(sc)
regv = bus_space_read_1(iot, ioh, nsp_fifosr);
if ((regv & FIFOSR_FULLEMP) == 0)
{
SCSI_LOW_DELAY(1);
DELAY(1);
continue;
}

View File

@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
#include <sys/errno.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/systm.h>
#include <machine/bus.h>
@ -49,7 +50,7 @@ __FBSDID("$FreeBSD$");
#include <sys/rman.h>
#include <compat/netbsd/dvcfg.h>
#include <sys/device_port.h>
#include <sys/bus.h>
#include <dev/pccard/pccardvar.h>
@ -65,10 +66,10 @@ __FBSDID("$FreeBSD$");
#define PIO_MODE 0x100 /* pd_flags */
static int nspprobe(DEVPORT_PDEVICE devi);
static int nspattach(DEVPORT_PDEVICE devi);
static int nspprobe(device_t devi);
static int nspattach(device_t devi);
static void nsp_card_unload (DEVPORT_PDEVICE);
static void nsp_card_unload (device_t);
const struct pccard_product nsp_products[] = {
PCMCIA_CARD(IODATA3, CBSC16),
@ -139,7 +140,7 @@ nsp_alloc_resource(device_t dev)
/* No need to allocate memory if not configured and it's in PIO mode */
if (maddr == 0 || msize == 0) {
if ((DEVPORT_PDEVFLAGS(dev) & PIO_MODE) == 0) {
if ((device_get_flags(dev) & PIO_MODE) == 0) {
printf("Memory window was not configured. Configure or use in PIO mode.");
nsp_release_resource(dev);
return(ENOMEM);
@ -229,9 +230,9 @@ MODULE_DEPEND(nsp, scsi_low, 1, 1, 1);
DRIVER_MODULE(nsp, pccard, nsp_pccard_driver, nsp_devclass, 0, 0);
static void
nsp_card_unload(DEVPORT_PDEVICE devi)
nsp_card_unload(device_t devi)
{
struct nsp_softc *sc = DEVPORT_PDEVGET_SOFTC(devi);
struct nsp_softc *sc = device_get_softc(devi);
intrmask_t s;
s = splcam();
@ -241,25 +242,25 @@ nsp_card_unload(DEVPORT_PDEVICE devi)
}
static int
nspprobe(DEVPORT_PDEVICE devi)
nspprobe(device_t devi)
{
int rv;
struct nsp_softc *sc = device_get_softc(devi);
rv = nspprobesubr(rman_get_bustag(sc->port_res),
rman_get_bushandle(sc->port_res),
DEVPORT_PDEVFLAGS(devi));
device_get_flags(devi));
return rv;
}
static int
nspattach(DEVPORT_PDEVICE devi)
nspattach(device_t devi)
{
struct nsp_softc *sc;
struct scsi_low_softc *slp;
u_int32_t flags = DEVPORT_PDEVFLAGS(devi);
u_int iobase = DEVPORT_PDEVIOBASE(devi);
u_int32_t flags = device_get_flags(devi);
u_int iobase = bus_get_resource_start(devi, SYS_RES_IOPORT, 0);
intrmask_t s;
char dvname[16];
@ -270,7 +271,7 @@ nspattach(DEVPORT_PDEVICE devi)
return (0);
}
sc = DEVPORT_PDEVALLOC_SOFTC(devi);
sc = device_get_softc(devi);
if (sc == NULL)
return (0);

View File

@ -43,16 +43,6 @@
struct nsp_softc {
struct scsi_low_softc sc_sclow; /* generic data */
#ifdef __NetBSD__
bus_space_tag_t sc_iot;
bus_space_handle_t sc_ioh;
bus_space_tag_t sc_memt;
bus_space_handle_t sc_memh;
void *sc_ih;
#endif /* __NetBSD__ */
#ifdef __FreeBSD__
bus_space_tag_t sc_iot;
bus_space_handle_t sc_ioh;
bus_space_tag_t sc_memt;
@ -66,7 +56,6 @@ struct nsp_softc {
struct resource *mem_res;
void *nsp_intrhand;
#endif /* __FreeBSD__ */
int sc_tmaxcnt; /* timeout count */
int sc_seltout; /* selection timeout counter */

View File

@ -44,33 +44,12 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#if defined(__FreeBSD__) && __FreeBSD_version >= 500001
#include <sys/bio.h>
#endif /* __FreeBSD__ */
#include <sys/buf.h>
#include <sys/queue.h>
#include <sys/malloc.h>
#include <sys/errno.h>
#ifdef __NetBSD__
#include <sys/device.h>
#include <machine/bus.h>
#include <machine/intr.h>
#include <dev/scsipi/scsi_all.h>
#include <dev/scsipi/scsipi_all.h>
#include <dev/scsipi/scsiconf.h>
#include <dev/scsipi/scsi_disk.h>
#include <machine/dvcfg.h>
#include <machine/physio_proc.h>
#include <i386/Cbus/dev/scsi_low.h>
#include <i386/Cbus/dev/tmc18c30reg.h>
#include <i386/Cbus/dev/tmc18c30var.h>
#endif /* __NetBSD__ */
#ifdef __FreeBSD__
#include <machine/cpu.h>
#include <machine/bus.h>
@ -80,7 +59,6 @@ __FBSDID("$FreeBSD$");
#include <cam/scsi/scsi_low.h>
#include <dev/stg/tmc18c30reg.h>
#include <dev/stg/tmc18c30var.h>
#endif /* __FreeBSD__ */
/***************************************************
* USER SETTINGS
@ -301,7 +279,7 @@ stghw_attention(sc)
sc->sc_busc |= BCTL_ATN;
sc->sc_busimg |= BCTL_ATN;
bus_space_write_1(sc->sc_iot, sc->sc_ioh, tmc_bctl, sc->sc_busimg);
SCSI_LOW_DELAY(10);
DELAY(10);
}
static void
@ -314,7 +292,7 @@ stghw_bus_reset(sc)
bus_space_write_1(iot, ioh, tmc_ictl, 0);
bus_space_write_1(iot, ioh, tmc_fctl, 0);
stghw_bcr_write_1(sc, BCTL_RST);
SCSI_LOW_DELAY(100000);
DELAY(100000);
stghw_bcr_write_1(sc, BCTL_BUSFREE);
}
@ -454,7 +432,7 @@ stgprint(aux, name)
if (name != NULL)
printf("%s: scsibus ", name);
return UNCONF;
return 1;
}
void
@ -591,7 +569,7 @@ stg_pio_read(sc, ti, thold)
break;
if (sp->scp_datalen <= 0)
break;
SCSI_LOW_DELAY(1);
DELAY(1);
continue;
}
}
@ -691,7 +669,7 @@ stg_pio_write(sc, ti, thold)
res = bus_space_read_2(iot, ioh, tmc_fdcnt);
if (res > sc->sc_maxwsize / 2)
{
SCSI_LOW_DELAY(1);
DELAY(1);
continue;
}
}
@ -736,7 +714,7 @@ stg_negate_signal(struct stg_softc *sc, u_int8_t mask, u_char *s)
if ((regv & mask) == 0)
return 1;
SCSI_LOW_DELAY(STG_DELAY_INTERVAL);
DELAY(STG_DELAY_INTERVAL);
}
printf("%s: %s stg_negate_signal timeout\n", slp->sl_xname, s);
@ -763,7 +741,7 @@ stg_expect_signal(struct stg_softc *sc, u_int8_t phase, u_int8_t mask)
if ((ph & mask) != 0)
return 1;
SCSI_LOW_DELAY(STG_DELAY_INTERVAL);
DELAY(STG_DELAY_INTERVAL);
}
printf("%s: stg_expect_signal timeout\n", slp->sl_xname);
@ -857,13 +835,13 @@ stg_reselected(sc)
if ((regv & (BSTAT_IO | BSTAT_SEL | BSTAT_BSY)) ==
(BSTAT_IO | BSTAT_SEL))
{
SCSI_LOW_DELAY(1);
DELAY(1);
regv = bus_space_read_1(iot, ioh, tmc_bstat);
if ((regv & (BSTAT_IO | BSTAT_SEL | BSTAT_BSY)) ==
(BSTAT_IO | BSTAT_SEL))
goto reselect_start;
}
SCSI_LOW_DELAY(1);
DELAY(1);
}
printf("%s: reselction timeout I\n", slp->sl_xname);
return EJUSTRETURN;
@ -886,7 +864,7 @@ stg_reselected(sc)
regv = bus_space_read_1(iot, ioh, tmc_bstat);
if ((regv & (BSTAT_SEL | BSTAT_BSY)) == BSTAT_BSY)
goto reselected;
SCSI_LOW_DELAY(1);
DELAY(1);
}
printf("%s: reselction timeout II\n", slp->sl_xname);
return EJUSTRETURN;
@ -983,10 +961,10 @@ stghw_select_targ_wait(sc, mu)
{
if ((bus_space_read_1(iot, ioh, tmc_bstat) & BSTAT_BSY) == 0)
{
SCSI_LOW_DELAY(STGHW_SELECT_INTERVAL);
DELAY(STGHW_SELECT_INTERVAL);
continue;
}
SCSI_LOW_DELAY(1);
DELAY(1);
if ((bus_space_read_1(iot, ioh, tmc_bstat) & BSTAT_BSY) != 0)
{
return 0;
@ -1060,7 +1038,7 @@ stgintr(arg)
status, astatus);
#ifdef KDB
if (stg_debug > 1)
SCSI_LOW_DEBUGGER("stg");
kdb_enter(KDB_WHY_CAM, "stg");
#endif /* KDB */
}
#endif /* STG_DEBUG */
@ -1398,7 +1376,7 @@ stg_timeout(sc)
if (bus_space_read_2(iot, ioh, tmc_fdcnt) != 0)
{
SCSI_LOW_DELAY(1);
DELAY(1);
continue;
}

View File

@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$");
#include <machine/bus.h>
#include <compat/netbsd/dvcfg.h>
#include <sys/device_port.h>
#include <sys/bus.h>
#include <dev/pccard/pccardvar.h>

View File

@ -44,15 +44,6 @@
struct stg_softc {
struct scsi_low_softc sc_sclow; /* generic data */
#ifdef __NetBSD__
bus_space_tag_t sc_iot;
bus_space_tag_t sc_memt;
bus_space_handle_t sc_ioh;
void *sc_ih;
#endif /* __NetBSD__ */
#ifdef __FreeBSD__
bus_space_tag_t sc_iot;
bus_space_tag_t sc_memt;
bus_space_handle_t sc_ioh;
@ -65,7 +56,6 @@ struct stg_softc {
struct resource *mem_res;
void *stg_intrhand;
#endif /* __FreeBSD__ */
int sc_tmaxcnt;
u_int sc_chip; /* chip type */

View File

@ -1,70 +0,0 @@
/*-
* Copyright (c) 1999 Mitsuru IWASAKI <iwasaki@FreeBSD.org>
* Copyright (c) 1999 Takanori Watanabe <takawata@jp.FreeBSD.org>
* 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$
*/
#if defined(__NetBSD__)
# include <sys/device.h>
#elif defined(__FreeBSD__)
# include <sys/module.h>
# include <sys/bus.h>
#endif
/*
* Macro's to cope with the differences between operating systems and versions.
*/
#if defined(__NetBSD__)
# define DEVPORT_DEVICE struct device
# define DEVPORT_DEVNAME(dev) (dev).dv_xname
# define DEVPORT_DEVUNIT(dev) (dev).dv_unit
#elif defined(__FreeBSD__)
/*
* FreeBSD (compatibility for struct device)
*/
#define DEVPORT_DEVICE device_t
#define DEVPORT_DEVNAME(dev) device_get_name(dev)
#define DEVPORT_DEVUNIT(dev) device_get_unit(dev)
#define DEVPORT_ALLOC_SOFTC(dev) device_get_softc(dev)
#define DEVPORT_GET_SOFTC(dev) device_get_softc(dev)
#define UNCONF 1 /* print " not configured\n" */
/*
* PC-Card device driver (compatibility for struct pccard_devinfo *)
*/
#define DEVPORT_PDEVICE device_t
#define DEVPORT_PDEVUNIT(pdev) device_get_unit(pdev)
#define DEVPORT_PDEVFLAGS(pdev) device_get_flags(pdev)
#define DEVPORT_PDEVIOBASE(pdev) bus_get_resource_start(pdev, SYS_RES_IOPORT, 0)
#define DEVPORT_PDEVIRQ(pdev) bus_get_resource_start(pdev, SYS_RES_IRQ, 0)
#define DEVPORT_PDEVMADDR(pdev) bus_get_resource_start(pdev, SYS_RES_MEMORY, 0)
#define DEVPORT_PDEVALLOC_SOFTC(pdev) device_get_softc(pdev)
#define DEVPORT_PDEVGET_SOFTC(pdev) device_get_softc(pdev)
#endif /* __FreeBSD__ */