summaryrefslogtreecommitdiffstats
path: root/sys/dev
diff options
context:
space:
mode:
authorscottl <scottl@FreeBSD.org>2003-03-01 05:07:19 +0000
committerscottl <scottl@FreeBSD.org>2003-03-01 05:07:19 +0000
commit5944c8ff0f7012b775e938018039317aba06f202 (patch)
tree32e5264dd83ec4ac67736323c0c2b392319f1b27 /sys/dev
parent6350763ff176ecc1355bd659332c3f68ac4226f2 (diff)
downloadFreeBSD-src-5944c8ff0f7012b775e938018039317aba06f202.zip
FreeBSD-src-5944c8ff0f7012b775e938018039317aba06f202.tar.gz
The aac driver has evolved enough over the last few months that it no
longer resembles the 4.x version very much. Garbage collect the legacy bits.
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/aac/aac.c59
-rw-r--r--sys/dev/aac/aac_cam.c1
-rw-r--r--sys/dev/aac/aac_disk.c22
-rw-r--r--sys/dev/aac/aac_pci.c2
-rw-r--r--sys/dev/aac/aacvar.h57
5 files changed, 15 insertions, 126 deletions
diff --git a/sys/dev/aac/aac.c b/sys/dev/aac/aac.c
index a14f79c..619ffd4 100644
--- a/sys/dev/aac/aac.c
+++ b/sys/dev/aac/aac.c
@@ -41,17 +41,8 @@
#include <sys/malloc.h>
#include <sys/kernel.h>
#include <sys/kthread.h>
-#include <sys/lock.h>
-#include <sys/mutex.h>
#include <sys/sysctl.h>
#include <sys/poll.h>
-#if __FreeBSD_version >= 500005
-#include <sys/selinfo.h>
-#else
-#include <sys/select.h>
-#endif
-
-#include <dev/aac/aac_compat.h>
#include <sys/bus.h>
#include <sys/conf.h>
@@ -204,9 +195,6 @@ static struct cdevsw aac_cdevsw = {
nodump, /* dump */
nopsize, /* psize */
0, /* flags */
-#if __FreeBSD_version < 500005
- -1, /* bmaj */
-#endif
};
MALLOC_DEFINE(M_AACBUF, "aacbuf", "Buffers for the AAC driver");
@@ -236,12 +224,10 @@ aac_attach(struct aac_softc *sc)
aac_initq_busy(sc);
aac_initq_bio(sc);
-#if __FreeBSD_version >= 500005
/*
* Initialise command-completion task.
*/
TASK_INIT(&sc->aac_task_complete, 0, aac_complete, sc);
-#endif
/* disable interrupts before we enable anything */
AAC_MASK_INTERRUPTS(sc);
@@ -294,20 +280,13 @@ aac_attach(struct aac_softc *sc)
unit = device_get_unit(sc->aac_dev);
sc->aac_dev_t = make_dev(&aac_cdevsw, unit, UID_ROOT, GID_OPERATOR,
0640, "aac%d", unit);
-#if __FreeBSD_version > 500005
(void)make_dev_alias(sc->aac_dev_t, "afa%d", unit);
(void)make_dev_alias(sc->aac_dev_t, "hpn%d", unit);
-#endif
sc->aac_dev_t->si_drv1 = sc;
/* Create the AIF thread */
-#if __FreeBSD_version > 500005
if (kthread_create((void(*)(void *))aac_command_thread, sc,
&sc->aifthread, 0, 0, "aac%daif", unit))
-#else
- if (kthread_create((void(*)(void *))aac_command_thread, sc,
- &sc->aifthread, "aac%daif", unit))
-#endif
panic("Could not create AIF thread\n");
/* Register the shutdown method to only be called post-dump */
@@ -538,14 +517,11 @@ aac_shutdown(device_t dev)
struct aac_softc *sc;
struct aac_fib *fib;
struct aac_close_command *cc;
- int s;
debug_called(1);
sc = device_get_softc(dev);
- s = splbio();
-
sc->aac_state |= AAC_STATE_SUSPEND;
/*
@@ -586,7 +562,6 @@ aac_shutdown(device_t dev)
AAC_MASK_INTERRUPTS(sc);
- splx(s);
return(0);
}
@@ -597,18 +572,14 @@ int
aac_suspend(device_t dev)
{
struct aac_softc *sc;
- int s;
debug_called(1);
sc = device_get_softc(dev);
- s = splbio();
-
sc->aac_state |= AAC_STATE_SUSPEND;
AAC_MASK_INTERRUPTS(sc);
- splx(s);
return(0);
}
@@ -845,9 +816,7 @@ aac_command_thread(struct aac_softc *sc)
sc->aifflags &= ~AAC_AIFFLAGS_RUNNING;
wakeup(sc->aac_dev);
-#if __FreeBSD_version > 500005
mtx_lock(&Giant);
-#endif
kthread_exit(0);
}
@@ -966,7 +935,7 @@ aac_bio_command(struct aac_softc *sc, struct aac_command **cmp)
/* build the read/write request */
ad = (struct aac_disk *)bp->bio_disk->d_drv1;
- if (BIO_IS_READ(bp)) {
+ if (bp->bio_cmd == BIO_READ) {
br = (struct aac_blockread *)&fib->data[0];
br->Command = VM_CtBlockRead;
br->ContainerId = ad->ad_container->co_mntobj.ObjectId;
@@ -1011,7 +980,7 @@ aac_bio_complete(struct aac_command *cm)
/* fetch relevant status and then release the command */
bp = (struct bio *)cm->cm_private;
- if (BIO_IS_READ(bp)) {
+ if (bp->bio_cmd == BIO_READ) {
brr = (struct aac_blockread_response *)&cm->cm_fib->data[0];
status = brr->Status;
} else {
@@ -1710,7 +1679,7 @@ static int
aac_enqueue_fib(struct aac_softc *sc, int queue, struct aac_command *cm)
{
u_int32_t pi, ci;
- int s, error;
+ int error;
u_int32_t fib_size;
u_int32_t fib_addr;
@@ -1719,8 +1688,6 @@ aac_enqueue_fib(struct aac_softc *sc, int queue, struct aac_command *cm)
fib_size = cm->cm_fib->Header.Size;
fib_addr = cm->cm_fib->Header.ReceiverFibAddress;
- s = splbio();
-
/* get the producer/consumer indices */
pi = sc->aac_queues->qt_qindex[queue][AAC_PRODUCER_INDEX];
ci = sc->aac_queues->qt_qindex[queue][AAC_CONSUMER_INDEX];
@@ -1755,7 +1722,6 @@ aac_enqueue_fib(struct aac_softc *sc, int queue, struct aac_command *cm)
error = 0;
out:
- splx(s);
return(error);
}
@@ -1768,13 +1734,11 @@ aac_dequeue_fib(struct aac_softc *sc, int queue, u_int32_t *fib_size,
struct aac_fib **fib_addr)
{
u_int32_t pi, ci;
- int s, error;
+ int error;
int notify;
debug_called(3);
- s = splbio();
-
/* get the producer/consumer indices */
pi = sc->aac_queues->qt_qindex[queue][AAC_PRODUCER_INDEX];
ci = sc->aac_queues->qt_qindex[queue][AAC_CONSUMER_INDEX];
@@ -1816,7 +1780,6 @@ aac_dequeue_fib(struct aac_softc *sc, int queue, u_int32_t *fib_size,
error = 0;
out:
- splx(s);
return(error);
}
@@ -1827,7 +1790,7 @@ static int
aac_enqueue_response(struct aac_softc *sc, int queue, struct aac_fib *fib)
{
u_int32_t pi, ci;
- int s, error;
+ int error;
u_int32_t fib_size;
u_int32_t fib_addr;
@@ -1838,8 +1801,6 @@ aac_enqueue_response(struct aac_softc *sc, int queue, struct aac_fib *fib)
fib_addr = fib->Header.SenderFibAddress;
fib->Header.ReceiverFibAddress = fib_addr;
- s = splbio();
-
/* get the producer/consumer indices */
pi = sc->aac_queues->qt_qindex[queue][AAC_PRODUCER_INDEX];
ci = sc->aac_queues->qt_qindex[queue][AAC_CONSUMER_INDEX];
@@ -1868,7 +1829,6 @@ aac_enqueue_response(struct aac_softc *sc, int queue, struct aac_fib *fib)
error = 0;
out:
- splx(s);
return(error);
}
@@ -1879,7 +1839,6 @@ out:
static void
aac_timeout(struct aac_softc *sc)
{
- int s;
struct aac_command *cm;
time_t deadline;
@@ -1888,7 +1847,6 @@ aac_timeout(struct aac_softc *sc)
* only.
*/
deadline = time_second - AAC_CMD_TIMEOUT;
- s = splbio();
TAILQ_FOREACH(cm, &sc->aac_busy, cm_link) {
if ((cm->cm_timestamp < deadline)
/* && !(cm->cm_flags & AAC_CMD_TIMEDOUT) */) {
@@ -1899,7 +1857,6 @@ aac_timeout(struct aac_softc *sc)
AAC_PRINT_FIB(sc, cm->cm_fib);
}
}
- splx(s);
return;
}
@@ -2627,7 +2584,7 @@ static int
aac_getnext_aif(struct aac_softc *sc, caddr_t arg)
{
struct get_adapter_fib_ioctl agf;
- int error, s;
+ int error;
debug_called(2);
@@ -2639,10 +2596,7 @@ aac_getnext_aif(struct aac_softc *sc, caddr_t arg)
if (agf.AdapterFibContext != (int)sc->aifthread) {
error = EFAULT;
} else {
-
- s = splbio();
error = aac_return_aif(sc, agf.AifFib);
-
if ((error == EAGAIN) && (agf.Wait)) {
sc->aac_state |= AAC_STATE_AIF_SLEEPER;
while (error == EAGAIN) {
@@ -2654,7 +2608,6 @@ aac_getnext_aif(struct aac_softc *sc, caddr_t arg)
}
sc->aac_state &= ~AAC_STATE_AIF_SLEEPER;
}
- splx(s);
}
}
return(error);
diff --git a/sys/dev/aac/aac_cam.c b/sys/dev/aac/aac_cam.c
index b7e22b1..37b5833 100644
--- a/sys/dev/aac/aac_cam.c
+++ b/sys/dev/aac/aac_cam.c
@@ -46,7 +46,6 @@
#include <cam/scsi/scsi_all.h>
#include <cam/scsi/scsi_message.h>
-#include <dev/aac/aac_compat.h>
#include <sys/bus.h>
#include <sys/conf.h>
#include <sys/devicestat.h>
diff --git a/sys/dev/aac/aac_disk.c b/sys/dev/aac/aac_disk.c
index d178e42..6351175 100644
--- a/sys/dev/aac/aac_disk.c
+++ b/sys/dev/aac/aac_disk.c
@@ -36,7 +36,6 @@
#include <sys/kernel.h>
#include <sys/sysctl.h>
-#include <dev/aac/aac_compat.h>
#include <sys/bus.h>
#include <sys/conf.h>
#include <sys/devicestat.h>
@@ -69,9 +68,6 @@ static disk_strategy_t aac_disk_strategy;
static dumper_t aac_disk_dump;
static devclass_t aac_disk_devclass;
-#ifdef FREEBSD_4
-static int disks_registered = 0;
-#endif
static device_method_t aac_disk_methods[] = {
DEVMETHOD(device_probe, aac_disk_probe),
@@ -287,19 +283,9 @@ aac_biodone(struct bio *bp)
sc = (struct aac_disk *)bp->bio_disk->d_drv1;
devstat_end_transaction_bio(&sc->ad_stats, bp);
- if (bp->bio_flags & BIO_ERROR) {
-#if __FreeBSD_version > 500039
+ if (bp->bio_flags & BIO_ERROR)
disk_err(bp, "hard error", -1, 1);
-#elif __FreeBSD_version > 500005
- int blkno;
- blkno = (sc->ad_label.d_nsectors) ? 0 : -1;
- diskerr(bp, (char *)bp->bio_driver1, blkno, &sc->ad_label);
-#else
- int blkno;
- blkno = (sc->ad_label.d_nsectors) ? 0 : -1;
- diskerr(bp, (char *)bp->bio_driver1, 0, blkno, &sc->ad_label);
-#endif
- }
+
biodone(bp);
}
@@ -394,10 +380,6 @@ aac_disk_detach(device_t dev)
devstat_remove_entry(&sc->ad_stats);
disk_destroy(&sc->ad_disk);
-#ifdef FREEBSD_4
- if (--disks_registered == 0)
- cdevsw_remove(&aac_disk_cdevsw);
-#endif
return(0);
}
diff --git a/sys/dev/aac/aac_pci.c b/sys/dev/aac/aac_pci.c
index 34c1b9a..1a4545f 100644
--- a/sys/dev/aac/aac_pci.c
+++ b/sys/dev/aac/aac_pci.c
@@ -39,7 +39,7 @@
#include <sys/systm.h>
#include <sys/kernel.h>
-#include <dev/aac/aac_compat.h>
+#include <sys/bio.h>
#include <sys/bus.h>
#include <sys/conf.h>
#include <sys/devicestat.h>
diff --git a/sys/dev/aac/aacvar.h b/sys/dev/aac/aacvar.h
index f704ef1..0125ec7 100644
--- a/sys/dev/aac/aacvar.h
+++ b/sys/dev/aac/aacvar.h
@@ -29,6 +29,12 @@
* $FreeBSD$
*/
+#include <sys/bio.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
+#include <sys/taskqueue.h>
+#include <sys/selinfo.h>
+
/*
* Driver Parameter Definitions
*/
@@ -86,19 +92,6 @@
#define AAC_PERIODIC_INTERVAL 20 /* seconds */
/*
- * Character device major numbers.
- */
-#define AAC_DISK_MAJOR 200
-
-/*
- * Driver Variable Definitions
- */
-
-#if __FreeBSD_version >= 500005
-# include <sys/taskqueue.h>
-#endif
-
-/*
* Per-container data structure
*/
struct aac_container
@@ -267,25 +260,11 @@ extern struct aac_interface aac_fa_interface;
sc->aac_bhandle, reg)
/* Define the OS version specific locks */
-#if __FreeBSD_version >= 500005
-#include <sys/lock.h>
-#include <sys/mutex.h>
typedef struct mtx aac_lock_t;
#define AAC_LOCK_INIT(l, s) mtx_init(l, s, NULL, MTX_DEF)
#define AAC_LOCK_ACQUIRE(l) mtx_lock(l)
#define AAC_LOCK_RELEASE(l) mtx_unlock(l)
-#else
-typedef struct simplelock aac_lock_t;
-#define AAC_LOCK_INIT(l, s) simple_lock_init(l)
-#define AAC_LOCK_ACQUIRE(l) simple_lock(l)
-#define AAC_LOCK_RELEASE(l) simple_unlock(l)
-#endif
-#if __FreeBSD_version >= 500005
-#include <sys/selinfo.h>
-#else
-#include <sys/select.h>
-#endif
/*
* Per-controller structure.
@@ -358,10 +337,8 @@ struct aac_softc
aac_lock_t aac_io_lock;
/* delayed activity infrastructure */
-#if __FreeBSD_version >= 500005
struct task aac_task_complete; /* deferred-completion
* task */
-#endif
struct intr_config_hook aac_ich;
/* management interface */
@@ -488,9 +465,6 @@ aac_initq_ ## name (struct aac_softc *sc) \
static __inline void \
aac_enqueue_ ## name (struct aac_command *cm) \
{ \
- int s; \
- \
- s = splbio(); \
if ((cm->cm_flags & AAC_ON_AACQ_MASK) != 0) { \
printf("command %p is on another queue, flags = %#x\n", \
cm, cm->cm_flags); \
@@ -499,14 +473,10 @@ aac_enqueue_ ## name (struct aac_command *cm) \
TAILQ_INSERT_TAIL(&cm->cm_sc->aac_ ## name, cm, cm_link); \
cm->cm_flags |= AAC_ON_ ## index; \
AACQ_ADD(cm->cm_sc, index); \
- splx(s); \
} \
static __inline void \
aac_requeue_ ## name (struct aac_command *cm) \
{ \
- int s; \
- \
- s = splbio(); \
if ((cm->cm_flags & AAC_ON_AACQ_MASK) != 0) { \
printf("command %p is on another queue, flags = %#x\n", \
cm, cm->cm_flags); \
@@ -515,15 +485,12 @@ aac_requeue_ ## name (struct aac_command *cm) \
TAILQ_INSERT_HEAD(&cm->cm_sc->aac_ ## name, cm, cm_link); \
cm->cm_flags |= AAC_ON_ ## index; \
AACQ_ADD(cm->cm_sc, index); \
- splx(s); \
} \
static __inline struct aac_command * \
aac_dequeue_ ## name (struct aac_softc *sc) \
{ \
struct aac_command *cm; \
- int s; \
\
- s = splbio(); \
if ((cm = TAILQ_FIRST(&sc->aac_ ## name)) != NULL) { \
if ((cm->cm_flags & AAC_ON_ ## index) == 0) { \
printf("command %p not in queue, flags = %#x, " \
@@ -535,15 +502,11 @@ aac_dequeue_ ## name (struct aac_softc *sc) \
cm->cm_flags &= ~AAC_ON_ ## index; \
AACQ_REMOVE(sc, index); \
} \
- splx(s); \
return(cm); \
} \
static __inline void \
aac_remove_ ## name (struct aac_command *cm) \
{ \
- int s; \
- \
- s = splbio(); \
if ((cm->cm_flags & AAC_ON_ ## index) == 0) { \
printf("command %p not in queue, flags = %#x, " \
"bit = %#x\n", cm, cm->cm_flags, \
@@ -553,7 +516,6 @@ aac_remove_ ## name (struct aac_command *cm) \
TAILQ_REMOVE(&cm->cm_sc->aac_ ## name, cm, cm_link); \
cm->cm_flags &= ~AAC_ON_ ## index; \
AACQ_REMOVE(cm->cm_sc, index); \
- splx(s); \
} \
struct hack
@@ -574,26 +536,19 @@ aac_initq_bio(struct aac_softc *sc)
static __inline void
aac_enqueue_bio(struct aac_softc *sc, struct bio *bp)
{
- int s;
-
- s = splbio();
bioq_insert_tail(&sc->aac_bioq, bp);
AACQ_ADD(sc, AACQ_BIO);
- splx(s);
}
static __inline struct bio *
aac_dequeue_bio(struct aac_softc *sc)
{
- int s;
struct bio *bp;
- s = splbio();
if ((bp = bioq_first(&sc->aac_bioq)) != NULL) {
bioq_remove(&sc->aac_bioq, bp);
AACQ_REMOVE(sc, AACQ_BIO);
}
- splx(s);
return(bp);
}
OpenPOWER on IntegriCloud