xref: /haiku/src/add-ons/kernel/bus_managers/firewire/fwohcivar.h (revision e81a954787e50e56a7f06f72705b7859b6ab06d1)
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: src/sys/dev/firewire/fwohcivar.h,v 1.16 2007/06/06 14:31:36 simokawa Exp $
35  *
36  */
37 
38 
39 typedef struct fwohci_softc {
40 	struct firewire_comm fc;
41 	uint8 irq;
42 	void *regAddr;
43 	area_id regArea;
44 	struct fwohci_dbch{
45 		u_int ndb;
46 		u_int ndesc;
47 		STAILQ_HEAD(, fwohcidb_tr) db_trq;
48 		struct fwohcidb_tr *top, *bottom, *pdb_tr;
49 		struct fw_xferq xferq;
50 		int flags;
51 #define	FWOHCI_DBCH_INIT	(1<<0)
52 #define	FWOHCI_DBCH_FULL	(1<<1)
53 		/* used only in receive context */
54 		int buf_offset;	/* signed */
55 #define FWOHCI_DBCH_MAX_PAGES	32
56 		/* Context programs buffer */
57 		struct fwdma_alloc_multi *am;
58 #ifndef __HAIKU__
59 		bus_dma_tag_t dmat;
60 #else
61 		area_id Area;
62 #endif
63 	} arrq, arrs, atrq, atrs, it[OHCI_DMA_ITCH], ir[OHCI_DMA_IRCH];
64 	u_int maxrec;
65 	uint32_t *sid_buf;
66 	struct fwdma_alloc sid_dma;
67 	struct fwdma_alloc crom_dma;
68 	struct fwdma_alloc dummy_dma;
69 	uint32_t intmask, irstat, itstat;
70 	uint32_t intstat;
71 #ifndef __HAIKU__
72 	struct task fwohci_task_busreset;
73 	struct task fwohci_task_sid;
74 	struct task fwohci_task_dma;
75 #endif
76 	int cycle_lost;
77 } fwohci_softc_t;
78 
79 #ifdef __HAIKU__
80 int32 fwohci_intr (void *arg);
81 int fwohci_init (struct fwohci_softc *);
82 void fwohci_poll (struct firewire_comm *, int, int);
83 void fwohci_reset (struct fwohci_softc *);
84 int fwohci_detach (struct fwohci_softc *);
85 int fwohci_stop (struct fwohci_softc *);
86 #else
87 void fwohci_intr (void *arg);
88 int fwohci_init (struct fwohci_softc *, device_t);
89 void fwohci_poll (struct firewire_comm *, int, int);
90 void fwohci_reset (struct fwohci_softc *, device_t);
91 int fwohci_detach (struct fwohci_softc *, device_t);
92 int fwohci_resume (struct fwohci_softc *, device_t);
93 int fwohci_stop (struct fwohci_softc *, device_t dev);
94 #endif
95