summaryrefslogtreecommitdiffstats
path: root/sys/dev/mlx/mlxvar.h
diff options
context:
space:
mode:
authormsmith <msmith@FreeBSD.org>1999-12-11 00:00:13 +0000
committermsmith <msmith@FreeBSD.org>1999-12-11 00:00:13 +0000
commit7f4d10be2c9eee66e10cec38c7bb014cb2a957cc (patch)
tree1e89a5e0931480d2f932d56a1d4607adf70f40ec /sys/dev/mlx/mlxvar.h
parent73feefc8af6d4a943bff813f0455b846f4d75978 (diff)
downloadFreeBSD-src-7f4d10be2c9eee66e10cec38c7bb014cb2a957cc.zip
FreeBSD-src-7f4d10be2c9eee66e10cec38c7bb014cb2a957cc.tar.gz
Major update to the Mylex DAC960 driver adding new hardware support
and fixing some major bugs. - Add support for the v5 firmware interface, used by the DAC1164P (tested) and AcceleRAID 352 (untested but should work). We now cover all of the Mylex family's protocols except for v2 (used by EISA and Alpha-compatible cards). - Fix an accounting bug which resulted in endless 'poll still busy' messages. In situations of high controller load the count of poll commands could be incremented without actually successfully launching a command. This totally removes the accounting for status poll commnads; it was its own worst enemy. - Add some simple reentry prevention locks to processing of the waiting and completed command queues to prevent races which could result in I/O being done or completed twice (both are fatal). This highlights a need for simple locking primitives in both the UP and SMP kernels. - Streamline the handling of command completion to reduce the amount of redundant work being done. Remove the code which tests for commands that have gone missing in action; nobody has ever seen one of these and it wouldn't have worked properly anyhow. - Handle disconnection of drives from the controller in the detach, not shutdown method. This avoids problems flushing the cache in a panic when a drive is mounted. - Don't call bus_generic_detach when disconnecting drives; it doesn't actually do anything useful. - Increment the log message index regardless of whether we actually retrieved one or not. If we run into a message that we can't fetch, we don't want to spin endlessly complaining about the fact. - Don't assume that interrupts will work when we're flushing the controller. We may think they are enabled, but in eg. a panic situation the controller may not be able to deliver an interrupt.
Diffstat (limited to 'sys/dev/mlx/mlxvar.h')
-rw-r--r--sys/dev/mlx/mlxvar.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/sys/dev/mlx/mlxvar.h b/sys/dev/mlx/mlxvar.h
index ae1d399..04c3246 100644
--- a/sys/dev/mlx/mlxvar.h
+++ b/sys/dev/mlx/mlxvar.h
@@ -65,6 +65,7 @@ struct mlx_command
struct mlx_softc *mc_sc; /* controller that owns us */
u_int8_t mc_slot; /* command slot we occupy */
u_int16_t mc_status; /* command completion status */
+ time_t mc_timeout; /* when this command expires */
u_int8_t mc_mailbox[16]; /* command mailbox */
u_int32_t mc_sgphys; /* physical address of s/g array in controller space */
int mc_nsgent; /* number of entries in s/g map */
@@ -144,6 +145,8 @@ struct mlx_softc
int mlx_check; /* if >= 0, drive is being checked */
struct mlx_pause mlx_pause; /* pending pause operation details */
+ int mlx_locks; /* reentrancy avoidance */
+
/* interface-specific accessor functions */
int mlx_iftype; /* interface protocol */
#define MLX_IFTYPE_3 3
@@ -157,6 +160,30 @@ struct mlx_softc
};
/*
+ * Simple (stupid) locks.
+ *
+ * Note that these are designed to avoid reentrancy, not concurrency, and will
+ * need to be replaced with something better.
+ */
+#define MLX_LOCK_COMPLETING (1<<0)
+#define MLX_LOCK_STARTING (1<<1)
+
+static __inline int
+mlx_lock_tas(struct mlx_softc *sc, int lock)
+{
+ if ((sc)->mlx_locks & (lock))
+ return(1);
+ atomic_set_int(&sc->mlx_locks, lock);
+ return(0);
+}
+
+static __inline void
+mlx_lock_clr(struct mlx_softc *sc, int lock)
+{
+ atomic_clear_int(&sc->mlx_locks, lock);
+}
+
+/*
* Interface between bus connections and driver core.
*/
extern void mlx_free(struct mlx_softc *sc);
OpenPOWER on IntegriCloud