fwohcivar.h revision 127468
1271283Semaste/*
2271283Semaste * Copyright (c) 2003 Hidetoshi SHimokawa
3271283Semaste * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi SHimokawa
4271283Semaste * All rights reserved.
5271283Semaste *
6271283Semaste * Redistribution and use in source and binary forms, with or without
7271283Semaste * modification, are permitted provided that the following conditions
8271283Semaste * are met:
9271283Semaste * 1. Redistributions of source code must retain the above copyright
10271283Semaste *    notice, this list of conditions and the following disclaimer.
11271283Semaste * 2. Redistributions in binary form must reproduce the above copyright
12271283Semaste *    notice, this list of conditions and the following disclaimer in the
13271283Semaste *    documentation and/or other materials provided with the distribution.
14271283Semaste * 3. All advertising materials mentioning features or use of this software
15271283Semaste *    must display the acknowledgement as bellow:
16271283Semaste *
17271283Semaste *    This product includes software developed by K. Kobayashi and H. Shimokawa
18271283Semaste *
19271283Semaste * 4. The name of the author may not be used to endorse or promote products
20271283Semaste *    derived from this software without specific prior written permission.
21271283Semaste *
22271283Semaste * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23271283Semaste * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24271283Semaste * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25271283Semaste * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
26271283Semaste * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
27271283Semaste * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28271283Semaste * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29271283Semaste * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
30271283Semaste * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31271283Semaste * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32271283Semaste * POSSIBILITY OF SUCH DAMAGE.
33271283Semaste *
34271283Semaste * $FreeBSD: head/sys/dev/firewire/fwohcivar.h 127468 2004-03-26 23:17:10Z simokawa $
35271283Semaste *
36271283Semaste */
37271283Semaste
38271283Semaste#if defined(__DragonFly__) || __FreeBSD_version < 500000
39271283Semaste#define FWOHCI_TASKQUEUE        0
40271283Semaste#else
41271283Semaste#define FWOHCI_TASKQUEUE        1
42271283Semaste#endif
43271283Semaste#if FWOHCI_TASKQUEUE
44271283Semaste#include <sys/taskqueue.h>
45271283Semaste#endif
46271283Semaste
47271283Semastetypedef struct fwohci_softc {
48271283Semaste	struct firewire_comm fc;
49271283Semaste	bus_space_tag_t bst;
50271283Semaste	bus_space_handle_t bsh;
51271283Semaste	void *ih;
52#if defined(__DragonFly__) || __FreeBSD_version < 500000
53	void *ih_cam;
54	void *ih_bio;
55#endif
56	struct resource *bsr;
57	struct resource *irq_res;
58	struct fwohci_dbch{
59		u_int ndb;
60		u_int ndesc;
61		STAILQ_HEAD(, fwohcidb_tr) db_trq;
62		struct fwohcidb_tr *top, *bottom, *pdb_tr;
63		struct fw_xferq xferq;
64		int flags;
65#define	FWOHCI_DBCH_INIT	(1<<0)
66#define	FWOHCI_DBCH_FULL	(1<<1)
67		/* used only in receive context */
68		int buf_offset;	/* signed */
69#define FWOHCI_DBCH_MAX_PAGES	32
70		/* Context programs buffer */
71		struct fwdma_alloc_multi *am;
72		bus_dma_tag_t dmat;
73	} arrq, arrs, atrq, atrs, it[OHCI_DMA_ITCH], ir[OHCI_DMA_IRCH];
74	u_int maxrec;
75	u_int32_t *sid_buf;
76	struct fwdma_alloc sid_dma;
77	struct fwdma_alloc crom_dma;
78	struct fwdma_alloc dummy_dma;
79	u_int32_t intmask, irstat, itstat;
80#if FWOHCI_TASKQUEUE
81	u_int32_t intstat;
82	struct task fwohci_task_complete;
83#endif
84} fwohci_softc_t;
85
86void fwohci_intr (void *arg);
87int fwohci_init (struct fwohci_softc *, device_t);
88void fwohci_poll (struct firewire_comm *, int, int);
89void fwohci_reset (struct fwohci_softc *, device_t);
90int fwohci_detach (struct fwohci_softc *, device_t);
91int fwohci_resume (struct fwohci_softc *, device_t);
92int fwohci_stop (struct fwohci_softc *, device_t dev);
93