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