aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/amr/amrvar.h
diff options
context:
space:
mode:
authorMike Smith <msmith@FreeBSD.org>2000-04-01 00:35:15 +0000
committerMike Smith <msmith@FreeBSD.org>2000-04-01 00:35:15 +0000
commit78601fc5f8a03d8f8bbd486c75975f58d5a0dbc2 (patch)
tree1e084e4f845630137bf7717c58dc0fe7aa450849 /sys/dev/amr/amrvar.h
parent599c73a35f18196e52d73522dae58399e5d779d4 (diff)
downloadsrc-78601fc5f8a03d8f8bbd486c75975f58d5a0dbc2.tar.gz
src-78601fc5f8a03d8f8bbd486c75975f58d5a0dbc2.zip
Update to latest working version.
- Add periodic status monitoring routine. Currently just detects lost commands, further functionality pending data from AMI. Add some new commands states; WEDGED (never coming back) and LATE (for when a command that wasmarked as WEDGED comes bacj, - Remove a number of redundant efforts to poll the card for completed commands. This is what interrupt handlers are for. - Limit the maximum number of outstanding I/O transactions. It seems that some controllers report more than they can really handle, and exceding this limit can cause the controller to lock up. - Don't use 'wait' mode for anything where the controller might not be able to generate interrupts. (Keep the 'wait' mode though sa it will become useful when we start taking userspace commands. - Use a similar atomic locking trategy to the Mylex driver to prevent some reentrancy problems. - Correctly calculate the block count for non-whoile-bloch transfers (actually illegal). - Use the dsik device's si_drv1 field instead of b_driver1 in the buf struct to pass the driver identifier arond. - Rewrite amr_start and amr_done() along the lines of the Mylex driver in order to improve robustnes. - Always force the PCI busmaster bit on.
Notes
Notes: svn path=/head/; revision=58883
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 13e0f46e7036..84777b5c27aa 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);