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