Deleted Added
sdiff udiff text old ( 174544 ) new ( 175622 )
full compact
1/*-
2 * Copyright (c) 1999,2000 Michael Smith
3 * Copyright (c) 2000 BSDi
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

48 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
49 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
50 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
51 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
52 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
53 * SUCH DAMAGE.
54 *
55 *
56 * $FreeBSD: head/sys/dev/amr/amrvar.h 174544 2007-12-12 05:55:03Z scottl $
57 */
58
59#include <geom/geom_disk.h>
60#include <sys/lock.h>
61#include <sys/mutex.h>
62
63#define LSI_DESC_PCI "LSILogic MegaRAID 1.53"
64

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

95 * memory wastage due to allocating lots of these small structures.
96 *
97 * 16k gives us a little under 200 command structures, which should
98 * normally be plenty. We will grab more if we need them.
99 */
100
101#define AMR_CMD_CLUSTERSIZE (16 * 1024)
102
103union amr_ccb {
104 struct amr_passthrough ccb_pthru;
105 struct amr_ext_passthrough ccb_epthru;
106 uint8_t bytes[128];
107};
108
109/*
110 * Per-command control structure.
111 */
112struct amr_command
113{
114 TAILQ_ENTRY(amr_command) ac_link;
115
116 struct amr_softc *ac_sc;
117 u_int8_t ac_slot;
118 int ac_status; /* command completion status */
119 union {
120 struct amr_sgentry *sg32;
121 struct amr_sg64entry *sg64;
122 } ac_sg;

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

129#define AMR_CMD_DATAOUT (1<<1)
130#define AMR_CMD_CCB (1<<2)
131#define AMR_CMD_PRIORITY (1<<4)
132#define AMR_CMD_MAPPED (1<<5)
133#define AMR_CMD_SLEEP (1<<6)
134#define AMR_CMD_BUSY (1<<7)
135#define AMR_CMD_SG64 (1<<8)
136#define AC_IS_SG64(ac) ((ac)->ac_flags & AMR_CMD_SG64)
137
138 struct bio *ac_bio;
139 void (* ac_complete)(struct amr_command *ac);
140 void *ac_private;
141
142 void *ac_data;
143 size_t ac_length;
144 bus_dmamap_t ac_dmamap;

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

214#define AMR_STATE_SHUTDOWN (1<<3)
215#define AMR_STATE_CRASHDUMP (1<<4)
216#define AMR_STATE_QUEUE_FRZN (1<<5)
217#define AMR_STATE_LD_DELETE (1<<6)
218#define AMR_STATE_REMAP_LD (1<<7)
219
220 /* per-controller queues */
221 struct bio_queue_head amr_bioq; /* pending I/O with no commands */
222 TAILQ_HEAD(,amr_command) amr_ready; /* commands ready to be submitted */
223 struct amr_command *amr_busycmd[AMR_MAXCMD];
224 int amr_busyslots;
225 TAILQ_HEAD(,amr_command) amr_completed;
226 TAILQ_HEAD(,amr_command) amr_freecmds;
227 TAILQ_HEAD(,amr_command_cluster) amr_cmd_clusters;
228
229 /* CAM attachments for passthrough */
230 struct cam_sim *amr_cam_sim[AMR_MAX_CHANNELS];
231 TAILQ_HEAD(, ccb_hdr) amr_cam_ccbq;
232 struct cam_devq *amr_cam_devq;
233
234 /* control device */

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

315 struct bio *bio;
316
317 if ((bio = bioq_first(&sc->amr_bioq)) != NULL)
318 bioq_remove(&sc->amr_bioq, bio);
319 return(bio);
320}
321
322static __inline void
323amr_enqueue_ready(struct amr_command *ac)
324{
325
326 TAILQ_INSERT_TAIL(&ac->ac_sc->amr_ready, ac, ac_link);
327}
328
329static __inline void
330amr_requeue_ready(struct amr_command *ac)
331{
332
333 TAILQ_INSERT_HEAD(&ac->ac_sc->amr_ready, ac, ac_link);
334}
335
336static __inline struct amr_command *
337amr_dequeue_ready(struct amr_softc *sc)
338{
339 struct amr_command *ac;
340
341 if ((ac = TAILQ_FIRST(&sc->amr_ready)) != NULL)
342 TAILQ_REMOVE(&sc->amr_ready, ac, ac_link);
343 return(ac);
344}
345
346static __inline void
347amr_enqueue_completed(struct amr_command *ac)
348{
349
350 TAILQ_INSERT_TAIL(&ac->ac_sc->amr_completed, ac, ac_link);
351}
352
353static __inline struct amr_command *
354amr_dequeue_completed(struct amr_softc *sc)
355{
356 struct amr_command *ac;
357
358 if ((ac = TAILQ_FIRST(&sc->amr_completed)) != NULL)
359 TAILQ_REMOVE(&sc->amr_completed, ac, ac_link);
360 return(ac);
361}
362
363static __inline void
364amr_enqueue_free(struct amr_command *ac)
365{
366
367 TAILQ_INSERT_TAIL(&ac->ac_sc->amr_freecmds, ac, ac_link);
368}
369
370static __inline struct amr_command *
371amr_dequeue_free(struct amr_softc *sc)
372{
373 struct amr_command *ac;
374
375 if ((ac = TAILQ_FIRST(&sc->amr_freecmds)) != NULL)
376 TAILQ_REMOVE(&sc->amr_freecmds, ac, ac_link);
377 return(ac);
378}