aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/mlx/mlxvar.h
diff options
context:
space:
mode:
authorMike Smith <msmith@FreeBSD.org>1999-12-11 00:00:13 +0000
committerMike Smith <msmith@FreeBSD.org>1999-12-11 00:00:13 +0000
commit5792b7fe0b0e753cfe770df4930e2c1d33671c65 (patch)
tree4d2ca0e6f2619ea744cb4adab891b1d756aace17 /sys/dev/mlx/mlxvar.h
parent0f33c9fb91ac329ee730f67fcdd0cfc19b94bfa4 (diff)
Notes
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 ae1d39978d52..04c32467b40f 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);