Deleted Added
full compact
mlxvar.h (52544) mlxvar.h (54419)
1/*-
2 * Copyright (c) 1999 Michael Smith
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 1999 Michael Smith
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/sys/dev/mlx/mlxvar.h 52544 1999-10-26 23:20:43Z msmith $
26 * $FreeBSD: head/sys/dev/mlx/mlxvar.h 54419 1999-12-11 00:00:13Z msmith $
27 */
28
29/*
30 * We could actually use all 33 segments, but using only 32 means that
31 * each scatter/gather map is 256 bytes in size, and thus we don't have to worry about
32 * maps crossing page boundaries.
33 */
34#define MLX_NSEG 32 /* max scatter/gather segments we use */

--- 25 unchanged lines hidden (view full) ---

60 */
61struct mlx_command
62{
63 TAILQ_ENTRY(mlx_command) mc_link; /* list linkage */
64
65 struct mlx_softc *mc_sc; /* controller that owns us */
66 u_int8_t mc_slot; /* command slot we occupy */
67 u_int16_t mc_status; /* command completion status */
27 */
28
29/*
30 * We could actually use all 33 segments, but using only 32 means that
31 * each scatter/gather map is 256 bytes in size, and thus we don't have to worry about
32 * maps crossing page boundaries.
33 */
34#define MLX_NSEG 32 /* max scatter/gather segments we use */

--- 25 unchanged lines hidden (view full) ---

60 */
61struct mlx_command
62{
63 TAILQ_ENTRY(mlx_command) mc_link; /* list linkage */
64
65 struct mlx_softc *mc_sc; /* controller that owns us */
66 u_int8_t mc_slot; /* command slot we occupy */
67 u_int16_t mc_status; /* command completion status */
68 time_t mc_timeout; /* when this command expires */
68 u_int8_t mc_mailbox[16]; /* command mailbox */
69 u_int32_t mc_sgphys; /* physical address of s/g array in controller space */
70 int mc_nsgent; /* number of entries in s/g map */
71 int mc_flags;
72#define MLX_CMD_DATAIN (1<<0)
73#define MLX_CMD_DATAOUT (1<<1)
74#define MLX_CMD_PRIORITY (1<<2) /* high-priority command */
75

--- 63 unchanged lines hidden (view full) ---

139 u_int16_t mlx_lastevent; /* sequence number of the last event we recorded */
140 u_int16_t mlx_currevent; /* sequence number last time we looked */
141 int mlx_polling; /* if > 0, polling operations still running */
142 int mlx_rebuild; /* if >= 0, drive is being rebuilt */
143 u_int32_t mlx_rebuildstat;/* blocks left to rebuild if active */
144 int mlx_check; /* if >= 0, drive is being checked */
145 struct mlx_pause mlx_pause; /* pending pause operation details */
146
69 u_int8_t mc_mailbox[16]; /* command mailbox */
70 u_int32_t mc_sgphys; /* physical address of s/g array in controller space */
71 int mc_nsgent; /* number of entries in s/g map */
72 int mc_flags;
73#define MLX_CMD_DATAIN (1<<0)
74#define MLX_CMD_DATAOUT (1<<1)
75#define MLX_CMD_PRIORITY (1<<2) /* high-priority command */
76

--- 63 unchanged lines hidden (view full) ---

140 u_int16_t mlx_lastevent; /* sequence number of the last event we recorded */
141 u_int16_t mlx_currevent; /* sequence number last time we looked */
142 int mlx_polling; /* if > 0, polling operations still running */
143 int mlx_rebuild; /* if >= 0, drive is being rebuilt */
144 u_int32_t mlx_rebuildstat;/* blocks left to rebuild if active */
145 int mlx_check; /* if >= 0, drive is being checked */
146 struct mlx_pause mlx_pause; /* pending pause operation details */
147
148 int mlx_locks; /* reentrancy avoidance */
149
147 /* interface-specific accessor functions */
148 int mlx_iftype; /* interface protocol */
149#define MLX_IFTYPE_3 3
150#define MLX_IFTYPE_4 4
151#define MLX_IFTYPE_5 5
152 int (* mlx_tryqueue)(struct mlx_softc *sc, struct mlx_command *mc);
153 int (* mlx_findcomplete)(struct mlx_softc *sc, u_int8_t *slot, u_int16_t *status);
154 void (* mlx_intaction)(struct mlx_softc *sc, int action);
155#define MLX_INTACTION_DISABLE 0
156#define MLX_INTACTION_ENABLE 1
157};
158
159/*
150 /* interface-specific accessor functions */
151 int mlx_iftype; /* interface protocol */
152#define MLX_IFTYPE_3 3
153#define MLX_IFTYPE_4 4
154#define MLX_IFTYPE_5 5
155 int (* mlx_tryqueue)(struct mlx_softc *sc, struct mlx_command *mc);
156 int (* mlx_findcomplete)(struct mlx_softc *sc, u_int8_t *slot, u_int16_t *status);
157 void (* mlx_intaction)(struct mlx_softc *sc, int action);
158#define MLX_INTACTION_DISABLE 0
159#define MLX_INTACTION_ENABLE 1
160};
161
162/*
163 * Simple (stupid) locks.
164 *
165 * Note that these are designed to avoid reentrancy, not concurrency, and will
166 * need to be replaced with something better.
167 */
168#define MLX_LOCK_COMPLETING (1<<0)
169#define MLX_LOCK_STARTING (1<<1)
170
171static __inline int
172mlx_lock_tas(struct mlx_softc *sc, int lock)
173{
174 if ((sc)->mlx_locks & (lock))
175 return(1);
176 atomic_set_int(&sc->mlx_locks, lock);
177 return(0);
178}
179
180static __inline void
181mlx_lock_clr(struct mlx_softc *sc, int lock)
182{
183 atomic_clear_int(&sc->mlx_locks, lock);
184}
185
186/*
160 * Interface between bus connections and driver core.
161 */
162extern void mlx_free(struct mlx_softc *sc);
163extern int mlx_attach(struct mlx_softc *sc);
164extern void mlx_startup(struct mlx_softc *sc);
165extern void mlx_intr(void *data);
166extern int mlx_detach(device_t dev);
167extern int mlx_shutdown(device_t dev);

--- 33 unchanged lines hidden ---
187 * Interface between bus connections and driver core.
188 */
189extern void mlx_free(struct mlx_softc *sc);
190extern int mlx_attach(struct mlx_softc *sc);
191extern void mlx_startup(struct mlx_softc *sc);
192extern void mlx_intr(void *data);
193extern int mlx_detach(device_t dev);
194extern int mlx_shutdown(device_t dev);

--- 33 unchanged lines hidden ---