aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/ncv
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2012-09-06 18:53:33 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2012-09-06 18:53:33 +0000
commitb9b256e49a1595b83c37af4e2bcdf2059934e5a3 (patch)
tree3e2de6663190f36cb5077901703212f5c7d3e8bb /sys/dev/ncv
parent2a6ce61ae1ec1618376df8246b1688e8bb7c660d (diff)
Notes
Diffstat (limited to 'sys/dev/ncv')
-rw-r--r--sys/dev/ncv/ncr53c500.c50
-rw-r--r--sys/dev/ncv/ncr53c500_pccard.c29
-rw-r--r--sys/dev/ncv/ncr53c500var.h10
3 files changed, 27 insertions, 62 deletions
diff --git a/sys/dev/ncv/ncr53c500.c b/sys/dev/ncv/ncr53c500.c
index c56820bbf895..06987076c8a4 100644
--- a/sys/dev/ncv/ncr53c500.c
+++ b/sys/dev/ncv/ncr53c500.c
@@ -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 @@ again:
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 @@ again:
{
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
diff --git a/sys/dev/ncv/ncr53c500_pccard.c b/sys/dev/ncv/ncr53c500_pccard.c
index e6021b9693c6..ae110673b3fe 100644
--- a/sys/dev/ncv/ncr53c500_pccard.c
+++ b/sys/dev/ncv/ncr53c500_pccard.c
@@ -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);
}
diff --git a/sys/dev/ncv/ncr53c500var.h b/sys/dev/ncv/ncr53c500var.h
index b3aff4660f0d..e465c853a51b 100644
--- a/sys/dev/ncv/ncr53c500var.h
+++ b/sys/dev/ncv/ncr53c500var.h
@@ -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 */