summaryrefslogtreecommitdiffstats
path: root/sys/dev/nsp
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2012-09-06 18:53:33 +0000
committerjhb <jhb@FreeBSD.org>2012-09-06 18:53:33 +0000
commit56003f21a4a470b330e0125a085391b4dd730493 (patch)
tree3e2de6663190f36cb5077901703212f5c7d3e8bb /sys/dev/nsp
parent5ceaaf9ef3c1a8f034337261b619ca6aa1f7969d (diff)
downloadFreeBSD-src-56003f21a4a470b330e0125a085391b4dd730493.zip
FreeBSD-src-56003f21a4a470b330e0125a085391b4dd730493.tar.gz
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)
Diffstat (limited to 'sys/dev/nsp')
-rw-r--r--sys/dev/nsp/nsp.c58
-rw-r--r--sys/dev/nsp/nsp_pccard.c27
-rw-r--r--sys/dev/nsp/nspvar.h11
3 files changed, 32 insertions, 64 deletions
diff --git a/sys/dev/nsp/nsp.c b/sys/dev/nsp/nsp.c
index f18f68c..b474585 100644
--- a/sys/dev/nsp/nsp.c
+++ b/sys/dev/nsp/nsp.c
@@ -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 @@ ReadLoop:
if ((sc->sc_icr & SCIENR_FIFO) != 0)
break;
- SCSI_LOW_DELAY(1);
+ DELAY(1);
}
if ((-- tout) <= 0)
@@ -1200,7 +1178,7 @@ WriteLoop:
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;
}
diff --git a/sys/dev/nsp/nsp_pccard.c b/sys/dev/nsp/nsp_pccard.c
index 5276ab3..0d2162b 100644
--- a/sys/dev/nsp/nsp_pccard.c
+++ b/sys/dev/nsp/nsp_pccard.c
@@ -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);
diff --git a/sys/dev/nsp/nspvar.h b/sys/dev/nsp/nspvar.h
index 59af783..4aec87c 100644
--- a/sys/dev/nsp/nspvar.h
+++ b/sys/dev/nsp/nspvar.h
@@ -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 */
OpenPOWER on IntegriCloud