Deleted Added
full compact
aacvar.h (222951) aacvar.h (247570)
1/*-
2 * Copyright (c) 2000 Michael Smith
3 * Copyright (c) 2001 Scott Long
4 * Copyright (c) 2000 BSDi
5 * Copyright (c) 2001 Adaptec, Inc.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

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

21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
1/*-
2 * Copyright (c) 2000 Michael Smith
3 * Copyright (c) 2001 Scott Long
4 * Copyright (c) 2000 BSDi
5 * Copyright (c) 2001 Adaptec, Inc.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

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

21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * $FreeBSD: head/sys/dev/aac/aacvar.h 222951 2011-06-10 20:23:56Z attilio $
29 * $FreeBSD: head/sys/dev/aac/aacvar.h 247570 2013-03-01 19:55:10Z marius $
30 */
31
32#include <sys/bio.h>
33#include <sys/callout.h>
34#include <sys/lock.h>
35#include <sys/mutex.h>
30 */
31
32#include <sys/bio.h>
33#include <sys/callout.h>
34#include <sys/lock.h>
35#include <sys/mutex.h>
36#include <sys/taskqueue.h>
37#include <sys/selinfo.h>
36#include <sys/selinfo.h>
37#include <sys/sysctl.h>
38#include <sys/taskqueue.h>
38#include <geom/geom_disk.h>
39
39#include <geom/geom_disk.h>
40
41SYSCTL_DECL(_hw_aac);
42
40#define AAC_TYPE_DEVO 1
41#define AAC_TYPE_ALPHA 2
42#define AAC_TYPE_BETA 3
43#define AAC_TYPE_RELEASE 4
44
45#define AAC_DRIVER_MAJOR_VERSION 2
46#define AAC_DRIVER_MINOR_VERSION 1
47#define AAC_DRIVER_BUGFIX_LEVEL 9

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

237 u_int32_t arg0, u_int32_t arg1,
238 u_int32_t arg2, u_int32_t arg3);
239 int (*aif_get_mailbox)(struct aac_softc *sc, int mb);
240 void (*aif_set_interrupts)(struct aac_softc *sc, int enable);
241 int (*aif_send_command)(struct aac_softc *sc, struct aac_command *cm);
242 int (*aif_get_outb_queue)(struct aac_softc *sc);
243 void (*aif_set_outb_queue)(struct aac_softc *sc, int index);
244};
43#define AAC_TYPE_DEVO 1
44#define AAC_TYPE_ALPHA 2
45#define AAC_TYPE_BETA 3
46#define AAC_TYPE_RELEASE 4
47
48#define AAC_DRIVER_MAJOR_VERSION 2
49#define AAC_DRIVER_MINOR_VERSION 1
50#define AAC_DRIVER_BUGFIX_LEVEL 9

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

240 u_int32_t arg0, u_int32_t arg1,
241 u_int32_t arg2, u_int32_t arg3);
242 int (*aif_get_mailbox)(struct aac_softc *sc, int mb);
243 void (*aif_set_interrupts)(struct aac_softc *sc, int enable);
244 int (*aif_send_command)(struct aac_softc *sc, struct aac_command *cm);
245 int (*aif_get_outb_queue)(struct aac_softc *sc);
246 void (*aif_set_outb_queue)(struct aac_softc *sc, int index);
247};
245extern struct aac_interface aac_rx_interface;
246extern struct aac_interface aac_sa_interface;
247extern struct aac_interface aac_fa_interface;
248extern struct aac_interface aac_rkt_interface;
248extern const struct aac_interface aac_rx_interface;
249extern const struct aac_interface aac_sa_interface;
250extern const struct aac_interface aac_fa_interface;
251extern const struct aac_interface aac_rkt_interface;
249
252
250#define AAC_GET_FWSTATUS(sc) ((sc)->aac_if.aif_get_fwstatus((sc)))
251#define AAC_QNOTIFY(sc, qbit) ((sc)->aac_if.aif_qnotify((sc), (qbit)))
252#define AAC_GET_ISTATUS(sc) ((sc)->aac_if.aif_get_istatus((sc)))
253#define AAC_CLEAR_ISTATUS(sc, mask) ((sc)->aac_if.aif_clr_istatus((sc), \
253#define AAC_GET_FWSTATUS(sc) ((sc)->aac_if->aif_get_fwstatus((sc)))
254#define AAC_QNOTIFY(sc, qbit) ((sc)->aac_if->aif_qnotify((sc), (qbit)))
255#define AAC_GET_ISTATUS(sc) ((sc)->aac_if->aif_get_istatus((sc)))
256#define AAC_CLEAR_ISTATUS(sc, mask) ((sc)->aac_if->aif_clr_istatus((sc), \
254 (mask)))
255#define AAC_SET_MAILBOX(sc, command, arg0, arg1, arg2, arg3) \
257 (mask)))
258#define AAC_SET_MAILBOX(sc, command, arg0, arg1, arg2, arg3) \
256 ((sc)->aac_if.aif_set_mailbox((sc), (command), (arg0), (arg1), (arg2), \
259 ((sc)->aac_if->aif_set_mailbox((sc), (command), (arg0), (arg1), (arg2), \
257 (arg3)))
260 (arg3)))
258#define AAC_GET_MAILBOX(sc, mb) ((sc)->aac_if.aif_get_mailbox((sc), \
261#define AAC_GET_MAILBOX(sc, mb) ((sc)->aac_if->aif_get_mailbox((sc), \
259 (mb)))
262 (mb)))
260#define AAC_MASK_INTERRUPTS(sc) ((sc)->aac_if.aif_set_interrupts((sc), \
263#define AAC_MASK_INTERRUPTS(sc) ((sc)->aac_if->aif_set_interrupts((sc), \
261 0))
264 0))
262#define AAC_UNMASK_INTERRUPTS(sc) ((sc)->aac_if.aif_set_interrupts((sc), \
265#define AAC_UNMASK_INTERRUPTS(sc) ((sc)->aac_if->aif_set_interrupts((sc), \
263 1))
266 1))
264#define AAC_SEND_COMMAND(sc, cm) ((sc)->aac_if.aif_send_command((sc), (cm)))
265#define AAC_GET_OUTB_QUEUE(sc) ((sc)->aac_if.aif_get_outb_queue((sc)))
266#define AAC_SET_OUTB_QUEUE(sc, idx) ((sc)->aac_if.aif_set_outb_queue((sc), (idx)))
267#define AAC_SEND_COMMAND(sc, cm) ((sc)->aac_if->aif_send_command((sc), (cm)))
268#define AAC_GET_OUTB_QUEUE(sc) ((sc)->aac_if->aif_get_outb_queue((sc)))
269#define AAC_SET_OUTB_QUEUE(sc, idx) ((sc)->aac_if->aif_set_outb_queue((sc), (idx)))
267
268#define AAC_MEM0_SETREG4(sc, reg, val) bus_space_write_4(sc->aac_btag0, \
269 sc->aac_bhandle0, reg, val)
270#define AAC_MEM0_GETREG4(sc, reg) bus_space_read_4(sc->aac_btag0, \
271 sc->aac_bhandle0, reg)
272#define AAC_MEM0_SETREG2(sc, reg, val) bus_space_write_2(sc->aac_btag0, \
273 sc->aac_bhandle0, reg, val)
274#define AAC_MEM0_GETREG2(sc, reg) bus_space_read_2(sc->aac_btag0, \

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

302/*
303 * Per-controller structure.
304 */
305struct aac_softc
306{
307 /* bus connections */
308 device_t aac_dev;
309 struct resource *aac_regs_res0, *aac_regs_res1; /* reg. if. window */
270
271#define AAC_MEM0_SETREG4(sc, reg, val) bus_space_write_4(sc->aac_btag0, \
272 sc->aac_bhandle0, reg, val)
273#define AAC_MEM0_GETREG4(sc, reg) bus_space_read_4(sc->aac_btag0, \
274 sc->aac_bhandle0, reg)
275#define AAC_MEM0_SETREG2(sc, reg, val) bus_space_write_2(sc->aac_btag0, \
276 sc->aac_bhandle0, reg, val)
277#define AAC_MEM0_GETREG2(sc, reg) bus_space_read_2(sc->aac_btag0, \

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

305/*
306 * Per-controller structure.
307 */
308struct aac_softc
309{
310 /* bus connections */
311 device_t aac_dev;
312 struct resource *aac_regs_res0, *aac_regs_res1; /* reg. if. window */
310 int aac_regs_rid0, aac_regs_rid1; /* resource ID */
311 bus_space_handle_t aac_bhandle0, aac_bhandle1; /* bus space handle */
312 bus_space_tag_t aac_btag0, aac_btag1; /* bus space tag */
313 bus_dma_tag_t aac_parent_dmat; /* parent DMA tag */
314 bus_dma_tag_t aac_buffer_dmat; /* data buffer/command
315 * DMA tag */
316 struct resource *aac_irq; /* interrupt */
313 bus_space_handle_t aac_bhandle0, aac_bhandle1; /* bus space handle */
314 bus_space_tag_t aac_btag0, aac_btag1; /* bus space tag */
315 bus_dma_tag_t aac_parent_dmat; /* parent DMA tag */
316 bus_dma_tag_t aac_buffer_dmat; /* data buffer/command
317 * DMA tag */
318 struct resource *aac_irq; /* interrupt */
317 int aac_irq_rid;
318 void *aac_intr; /* interrupt handle */
319 eventhandler_tag eh;
320
321 /* controller features, limits and status */
322 int aac_state;
323#define AAC_STATE_SUSPEND (1<<0)
324#define AAC_STATE_UNUSED0 (1<<1)
325#define AAC_STATE_INTERRUPTS_ON (1<<2)

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

334#define AAC_HWIF_NARK 4
335#define AAC_HWIF_UNKNOWN -1
336 bus_dma_tag_t aac_common_dmat; /* common structure
337 * DMA tag */
338 bus_dmamap_t aac_common_dmamap; /* common structure
339 * DMA map */
340 struct aac_common *aac_common;
341 u_int32_t aac_common_busaddr;
319 void *aac_intr; /* interrupt handle */
320 eventhandler_tag eh;
321
322 /* controller features, limits and status */
323 int aac_state;
324#define AAC_STATE_SUSPEND (1<<0)
325#define AAC_STATE_UNUSED0 (1<<1)
326#define AAC_STATE_INTERRUPTS_ON (1<<2)

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

335#define AAC_HWIF_NARK 4
336#define AAC_HWIF_UNKNOWN -1
337 bus_dma_tag_t aac_common_dmat; /* common structure
338 * DMA tag */
339 bus_dmamap_t aac_common_dmamap; /* common structure
340 * DMA map */
341 struct aac_common *aac_common;
342 u_int32_t aac_common_busaddr;
342 struct aac_interface aac_if;
343 const struct aac_interface *aac_if;
343
344 /* command/fib resources */
345 bus_dma_tag_t aac_fib_dmat; /* DMA tag for allocing FIBs */
346 TAILQ_HEAD(,aac_fibmap) aac_fibmap_tqh;
347 u_int total_fibs;
348 struct aac_command *aac_commands;
349
350 /* command management */

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

494# define aac_print_queues(sc)
495# define aac_panic(sc, reason)
496
497# define AAC_PRINT_FIB(sc, fib)
498# define aac_print_aif(sc, aac_aif_command)
499#endif
500
501struct aac_code_lookup {
344
345 /* command/fib resources */
346 bus_dma_tag_t aac_fib_dmat; /* DMA tag for allocing FIBs */
347 TAILQ_HEAD(,aac_fibmap) aac_fibmap_tqh;
348 u_int total_fibs;
349 struct aac_command *aac_commands;
350
351 /* command management */

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

495# define aac_print_queues(sc)
496# define aac_panic(sc, reason)
497
498# define AAC_PRINT_FIB(sc, fib)
499# define aac_print_aif(sc, aac_aif_command)
500#endif
501
502struct aac_code_lookup {
502 char *string;
503 const char *string;
503 u_int32_t code;
504};
505
506/*
507 * Queue primitives for driver queues.
508 */
509#define AACQ_ADD(sc, qname) \
510 do { \

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

576 if ((cm->cm_flags & AAC_ON_ ## index) == 0) { \
577 panic("aac: command %p not in queue, flags = %#x, bit = %#x", \
578 cm, cm->cm_flags, AAC_ON_ ## index); \
579 } \
580 TAILQ_REMOVE(&cm->cm_sc->aac_ ## name, cm, cm_link); \
581 cm->cm_flags &= ~AAC_ON_ ## index; \
582 AACQ_REMOVE(cm->cm_sc, index); \
583} \
504 u_int32_t code;
505};
506
507/*
508 * Queue primitives for driver queues.
509 */
510#define AACQ_ADD(sc, qname) \
511 do { \

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

577 if ((cm->cm_flags & AAC_ON_ ## index) == 0) { \
578 panic("aac: command %p not in queue, flags = %#x, bit = %#x", \
579 cm, cm->cm_flags, AAC_ON_ ## index); \
580 } \
581 TAILQ_REMOVE(&cm->cm_sc->aac_ ## name, cm, cm_link); \
582 cm->cm_flags &= ~AAC_ON_ ## index; \
583 AACQ_REMOVE(cm->cm_sc, index); \
584} \
584struct hack
585
586AACQ_COMMAND_QUEUE(free, AACQ_FREE);
587AACQ_COMMAND_QUEUE(ready, AACQ_READY);
588AACQ_COMMAND_QUEUE(busy, AACQ_BUSY);
589
590/*
591 * outstanding bio queue
592 */

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

639}
640
641static __inline void
642aac_release_sync_fib(struct aac_softc *sc)
643{
644
645 mtx_assert(&sc->aac_io_lock, MA_OWNED);
646}
585
586AACQ_COMMAND_QUEUE(free, AACQ_FREE);
587AACQ_COMMAND_QUEUE(ready, AACQ_READY);
588AACQ_COMMAND_QUEUE(busy, AACQ_BUSY);
589
590/*
591 * outstanding bio queue
592 */

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

639}
640
641static __inline void
642aac_release_sync_fib(struct aac_softc *sc)
643{
644
645 mtx_assert(&sc->aac_io_lock, MA_OWNED);
646}
647