fwohcivar.h revision 170374
11817Sdg/*-
21817Sdg * Copyright (c) 2003 Hidetoshi SHimokawa
31817Sdg * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi SHimokawa
41817Sdg * All rights reserved.
51817Sdg *
61817Sdg * Redistribution and use in source and binary forms, with or without
71817Sdg * modification, are permitted provided that the following conditions
81817Sdg * are met:
91817Sdg * 1. Redistributions of source code must retain the above copyright
101817Sdg *    notice, this list of conditions and the following disclaimer.
111817Sdg * 2. Redistributions in binary form must reproduce the above copyright
121817Sdg *    notice, this list of conditions and the following disclaimer in the
131817Sdg *    documentation and/or other materials provided with the distribution.
141817Sdg * 3. All advertising materials mentioning features or use of this software
151817Sdg *    must display the acknowledgement as bellow:
161817Sdg *
171817Sdg *    This product includes software developed by K. Kobayashi and H. Shimokawa
181817Sdg *
191817Sdg * 4. The name of the author may not be used to endorse or promote products
201817Sdg *    derived from this software without specific prior written permission.
211817Sdg *
221817Sdg * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
231817Sdg * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
241817Sdg * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
251817Sdg * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
261817Sdg * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
271817Sdg * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
281817Sdg * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2950477Speter * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
301817Sdg * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
311817Sdg * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
322579Sbde * POSSIBILITY OF SUCH DAMAGE.
332579Sbde *
342123Sjkh * $FreeBSD: head/sys/dev/firewire/fwohcivar.h 170374 2007-06-06 14:31:36Z simokawa $
3516029Speter *
362579Sbde */
3718961Sbde
3813107Sbde#include <sys/taskqueue.h>
3925083Sjdp
40163726Sbde#if defined(__DragonFly__) ||  __FreeBSD_version < 700043
4125083Sjdp#define FWOHCI_INTFILT	0
4225083Sjdp#else
43163726Sbde#define FWOHCI_INTFILT	1
4425083Sjdp#endif
4525083Sjdp
4625083Sjdptypedef struct fwohci_softc {
4725083Sjdp	struct firewire_comm fc;
4822636Sbde	bus_space_tag_t bst;
4925083Sjdp	bus_space_handle_t bsh;
5022636Sbde	void *ih;
5125083Sjdp#if defined(__DragonFly__) || __FreeBSD_version < 500000
5222636Sbde	void *ih_cam;
5325083Sjdp	void *ih_bio;
54757Sdg#endif
5525083Sjdp	struct resource *bsr;
5646548Sbde	struct resource *irq_res;
5713107Sbde	struct fwohci_dbch{
5818961Sbde		u_int ndb;
59757Sdg		u_int ndesc;
60171914Sjkoshy		STAILQ_HEAD(, fwohcidb_tr) db_trq;
61171914Sjkoshy		struct fwohcidb_tr *top, *bottom, *pdb_tr;
62757Sdg		struct fw_xferq xferq;
63757Sdg		int flags;
6446548Sbde#define	FWOHCI_DBCH_INIT	(1<<0)
6513107Sbde#define	FWOHCI_DBCH_FULL	(1<<1)
6613107Sbde		/* used only in receive context */
6713107Sbde		int buf_offset;	/* signed */
6813107Sbde#define FWOHCI_DBCH_MAX_PAGES	32
6913107Sbde		/* Context programs buffer */
7013107Sbde		struct fwdma_alloc_multi *am;
7113107Sbde		bus_dma_tag_t dmat;
7213107Sbde	} arrq, arrs, atrq, atrs, it[OHCI_DMA_ITCH], ir[OHCI_DMA_IRCH];
7346548Sbde	u_int maxrec;
7418961Sbde	uint32_t *sid_buf;
7518961Sbde	struct fwdma_alloc sid_dma;
7646548Sbde	struct fwdma_alloc crom_dma;
7718961Sbde	struct fwdma_alloc dummy_dma;
7818961Sbde	uint32_t intmask, irstat, itstat;
7913107Sbde	uint32_t intstat;
8046548Sbde	struct task fwohci_task_busreset;
8146548Sbde	struct task fwohci_task_sid;
8213107Sbde	struct task fwohci_task_dma;
8318961Sbde	int cycle_lost;
8446548Sbde} fwohci_softc_t;
8546548Sbde
8618961Sbdevoid fwohci_intr (void *arg);
8718961Sbdeint fwohci_filt (void *arg);
8813107Sbdeint fwohci_init (struct fwohci_softc *, device_t);
8913107Sbdevoid fwohci_poll (struct firewire_comm *, int, int);
9013107Sbdevoid fwohci_reset (struct fwohci_softc *, device_t);
9113107Sbdeint fwohci_detach (struct fwohci_softc *, device_t);
9213107Sbdeint fwohci_resume (struct fwohci_softc *, device_t);
9313107Sbdeint fwohci_stop (struct fwohci_softc *, device_t dev);
9413107Sbde