fwohcivar.h revision 116897
1/*
2 * Copyright (c) 2003 Hidetoshi SHimokawa
3 * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi SHimokawa
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:
9 * 1. Redistributions of source code must retain the above copyright
10 *    notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 *    notice, this list of conditions and the following disclaimer in the
13 *    documentation and/or other materials provided with the distribution.
14 * 3. All advertising materials mentioning features or use of this software
15 *    must display the acknowledgement as bellow:
16 *
17 *    This product includes software developed by K. Kobayashi and H. Shimokawa
18 *
19 * 4. The name of the author may not be used to endorse or promote products
20 *    derived from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25 * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
26 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
27 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
30 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 *
34 * $FreeBSD: head/sys/dev/firewire/fwohcivar.h 116897 2003-06-27 00:27:33Z simokawa $
35 *
36 */
37
38#if __FreeBSD_version >= 500000
39#define FWOHCI_TASKQUEUE        1
40#else
41#define FWOHCI_TASKQUEUE        0
42#endif
43#if FWOHCI_TASKQUEUE
44#include <sys/taskqueue.h>
45#endif
46
47typedef struct fwohci_softc {
48	struct firewire_comm fc;
49	bus_space_tag_t bst;
50	bus_space_handle_t bsh;
51	void *ih;
52#if __FreeBSD_version < 500000
53	void *ih_cam;
54#endif
55	struct resource *bsr;
56	struct resource *irq_res;
57	struct fwohci_dbch{
58		u_int ndb;
59		u_int ndesc;
60		STAILQ_HEAD(, fwohcidb_tr) db_trq;
61		struct fwohcidb_tr *top, *bottom, *pdb_tr;
62		struct fw_xferq xferq;
63		int flags;
64#define	FWOHCI_DBCH_INIT	(1<<0)
65#define	FWOHCI_DBCH_FULL	(1<<1)
66		/* used only in receive context */
67		int buf_offset;	/* signed */
68#define FWOHCI_DBCH_MAX_PAGES	32
69		/* Context programs buffer */
70		struct fwdma_alloc_multi *am;
71		bus_dma_tag_t dmat;
72	} arrq, arrs, atrq, atrs, it[OHCI_DMA_ITCH], ir[OHCI_DMA_IRCH];
73	u_int maxrec;
74	u_int32_t *sid_buf;
75	struct fwdma_alloc sid_dma;
76	struct fwdma_alloc crom_dma;
77	struct fwdma_alloc dummy_dma;
78	u_int32_t intmask, irstat, itstat;
79#if FWOHCI_TASKQUEUE
80	u_int32_t intstat;
81	struct task fwohci_task_complete;
82#endif
83} fwohci_softc_t;
84
85void fwohci_intr __P((void *arg));
86int fwohci_init __P((struct fwohci_softc *, device_t));
87void fwohci_poll __P((struct firewire_comm *, int, int));
88void fwohci_reset __P((struct fwohci_softc *, device_t));
89int fwohci_detach __P((struct fwohci_softc *, device_t));
90int fwohci_resume __P((struct fwohci_softc *, device_t));
91int fwohci_stop __P((struct fwohci_softc *, device_t dev));
92