summaryrefslogtreecommitdiffstats
path: root/sys/dev/amr/amrvar.h
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/amr/amrvar.h')
-rw-r--r--sys/dev/amr/amrvar.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/sys/dev/amr/amrvar.h b/sys/dev/amr/amrvar.h
index 13e0f46..84777b5 100644
--- a/sys/dev/amr/amrvar.h
+++ b/sys/dev/amr/amrvar.h
@@ -38,6 +38,7 @@
#define AMR_SIGNATURE 0x3344
#define AMR_MAXCMD 255 /* ident = 0 not allowed */
+#define AMR_LIMITCMD 120 /* maximum count of outstanding commands */
#define AMR_MAXLD 40
#define AMR_BLKSIZE 512
@@ -75,6 +76,7 @@ struct amr_command
int ac_status;
#define AMR_STATUS_BUSY 0xffff
#define AMR_STATUS_WEDGED 0xdead
+#define AMR_STATUS_LATE 0xdeed
struct amr_mailbox ac_mailbox;
u_int32_t ac_sgphys;
int ac_nsgent;
@@ -131,6 +133,7 @@ struct amr_softc
#define AMR_STATE_SUSPEND (1<<1)
#define AMR_STATE_INTEN (1<<2)
#define AMR_STATE_SHUTDOWN (1<<3)
+ struct callout_handle amr_timeout; /* periodic status check */
/* per-controller queues */
struct buf_queue_head amr_bufq; /* pending I/O */
@@ -141,6 +144,8 @@ struct amr_softc
int amr_workcount;
TAILQ_HEAD(,amr_command) amr_freecmds;
+ int amr_locks; /* reentrancy avoidance */
+
/* controller type-specific support */
int amr_type;
#define AMR_TYPE_STD 0
@@ -151,6 +156,30 @@ struct amr_softc
};
/*
+ * Simple (stupid) locks.
+ *
+ * Note that these are designed to avoid reentrancy, not concurrency, and will
+ * need to be replaced with something better.
+ */
+#define AMR_LOCK_COMPLETING (1<<0)
+#define AMR_LOCK_STARTING (1<<1)
+
+static __inline int
+amr_lock_tas(struct amr_softc *sc, int lock)
+{
+ if ((sc)->amr_locks & (lock))
+ return(1);
+ atomic_set_int(&sc->amr_locks, lock);
+ return(0);
+}
+
+static __inline void
+amr_lock_clr(struct amr_softc *sc, int lock)
+{
+ atomic_clear_int(&sc->amr_locks, lock);
+}
+
+/*
* I/O primitives
*/
/* Quartz */
@@ -196,6 +225,7 @@ extern devclass_t amr_devclass;
struct amrd_softc
{
device_t amrd_dev;
+ dev_t amrd_dev_t;
struct amr_softc *amrd_controller;
struct amr_logdrive *amrd_drive;
struct disk amrd_disk;
@@ -214,3 +244,4 @@ extern int amr_submit_ioctl(struct amr_softc *sc, struct amr_logdrive *drive, u_
caddr_t addr, int32_t flag, struct proc *p);
extern void amrd_intr(void *data);
+extern void amr_report(void);
OpenPOWER on IntegriCloud