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