fwohcivar.h revision 167628
1234285Sdim/*-
2234285Sdim * Copyright (c) 2003 Hidetoshi SHimokawa
3234285Sdim * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi SHimokawa
4234285Sdim * All rights reserved.
5234285Sdim *
6234285Sdim * Redistribution and use in source and binary forms, with or without
7234285Sdim * modification, are permitted provided that the following conditions
8234285Sdim * are met:
9234285Sdim * 1. Redistributions of source code must retain the above copyright
10234285Sdim *    notice, this list of conditions and the following disclaimer.
11234285Sdim * 2. Redistributions in binary form must reproduce the above copyright
12234285Sdim *    notice, this list of conditions and the following disclaimer in the
13234285Sdim *    documentation and/or other materials provided with the distribution.
14234285Sdim * 3. All advertising materials mentioning features or use of this software
15234285Sdim *    must display the acknowledgement as bellow:
16234285Sdim *
17234285Sdim *    This product includes software developed by K. Kobayashi and H. Shimokawa
18234285Sdim *
19234285Sdim * 4. The name of the author may not be used to endorse or promote products
20234285Sdim *    derived from this software without specific prior written permission.
21234285Sdim *
22234285Sdim * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23234285Sdim * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24234285Sdim * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25234285Sdim * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
26234285Sdim * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
27234285Sdim * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28234285Sdim * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29234285Sdim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
30234285Sdim * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31234285Sdim * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32234285Sdim * POSSIBILITY OF SUCH DAMAGE.
33234285Sdim *
34234285Sdim * $FreeBSD: head/sys/dev/firewire/fwohcivar.h 167628 2007-03-16 04:25:02Z simokawa $
35234285Sdim *
36234285Sdim */
37234285Sdim
38234285Sdim#if defined(__DragonFly__) || __FreeBSD_version < 500000
39234285Sdim#define FWOHCI_TASKQUEUE        0
40234285Sdim#else
41234285Sdim#define FWOHCI_TASKQUEUE        1
42234285Sdim#endif
43234285Sdim#if FWOHCI_TASKQUEUE
44234285Sdim#include <sys/taskqueue.h>
45234285Sdim#endif
46234285Sdim
47234285Sdimtypedef struct fwohci_softc {
48234285Sdim	struct firewire_comm fc;
49234285Sdim	bus_space_tag_t bst;
50234285Sdim	bus_space_handle_t bsh;
51234285Sdim	void *ih;
52234285Sdim#if defined(__DragonFly__) || __FreeBSD_version < 500000
53234285Sdim	void *ih_cam;
54234285Sdim	void *ih_bio;
55234285Sdim#endif
56234285Sdim	struct resource *bsr;
57234285Sdim	struct resource *irq_res;
58234285Sdim	struct fwohci_dbch{
59234285Sdim		u_int ndb;
60234285Sdim		u_int ndesc;
61234285Sdim		STAILQ_HEAD(, fwohcidb_tr) db_trq;
62234285Sdim		struct fwohcidb_tr *top, *bottom, *pdb_tr;
63234285Sdim		struct fw_xferq xferq;
64234285Sdim		int flags;
65234285Sdim#define	FWOHCI_DBCH_INIT	(1<<0)
66234285Sdim#define	FWOHCI_DBCH_FULL	(1<<1)
67234285Sdim		/* used only in receive context */
68234285Sdim		int buf_offset;	/* signed */
69234285Sdim#define FWOHCI_DBCH_MAX_PAGES	32
70234285Sdim		/* Context programs buffer */
71234285Sdim		struct fwdma_alloc_multi *am;
72234285Sdim		bus_dma_tag_t dmat;
73234285Sdim	} arrq, arrs, atrq, atrs, it[OHCI_DMA_ITCH], ir[OHCI_DMA_IRCH];
74234285Sdim	u_int maxrec;
75234285Sdim	uint32_t *sid_buf;
76234285Sdim	struct fwdma_alloc sid_dma;
77234285Sdim	struct fwdma_alloc crom_dma;
78234285Sdim	struct fwdma_alloc dummy_dma;
79234285Sdim	uint32_t intmask, irstat, itstat;
80234285Sdim#if FWOHCI_TASKQUEUE
81234285Sdim	uint32_t intstat;
82234285Sdim	struct task fwohci_task_complete;
83234285Sdim#endif
84234285Sdim	int cycle_lost;
85234285Sdim} fwohci_softc_t;
86234285Sdim
87234285Sdimvoid fwohci_intr (void *arg);
88234285Sdimint fwohci_init (struct fwohci_softc *, device_t);
89234285Sdimvoid fwohci_poll (struct firewire_comm *, int, int);
90234285Sdimvoid fwohci_reset (struct fwohci_softc *, device_t);
91234285Sdimint fwohci_detach (struct fwohci_softc *, device_t);
92234285Sdimint fwohci_resume (struct fwohci_softc *, device_t);
93234285Sdimint fwohci_stop (struct fwohci_softc *, device_t dev);
94234285Sdim