fwohcivar.h revision 170374
113546Sjulian/*- 213546Sjulian * Copyright (c) 2003 Hidetoshi SHimokawa 313546Sjulian * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi SHimokawa 413546Sjulian * All rights reserved. 513546Sjulian * 613546Sjulian * Redistribution and use in source and binary forms, with or without 713546Sjulian * modification, are permitted provided that the following conditions 813546Sjulian * are met: 913546Sjulian * 1. Redistributions of source code must retain the above copyright 1013546Sjulian * notice, this list of conditions and the following disclaimer. 1113546Sjulian * 2. Redistributions in binary form must reproduce the above copyright 1213546Sjulian * notice, this list of conditions and the following disclaimer in the 13165967Simp * documentation and/or other materials provided with the distribution. 1413546Sjulian * 3. All advertising materials mentioning features or use of this software 1513546Sjulian * must display the acknowledgement as bellow: 1613546Sjulian * 1713546Sjulian * This product includes software developed by K. Kobayashi and H. Shimokawa 1813546Sjulian * 1913546Sjulian * 4. The name of the author may not be used to endorse or promote products 2049439Sdeischen * derived from this software without specific prior written permission. 2113546Sjulian * 2213546Sjulian * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 2313546Sjulian * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 2413546Sjulian * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 2513546Sjulian * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 2613546Sjulian * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 2713546Sjulian * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 2813546Sjulian * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2950476Speter * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 3013546Sjulian * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 3113546Sjulian * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32103388Smini * POSSIBILITY OF SUCH DAMAGE. 3313546Sjulian * 34174112Sdeischen * $FreeBSD: head/sys/dev/firewire/fwohcivar.h 170374 2007-06-06 14:31:36Z simokawa $ 35174112Sdeischen * 3675369Sdeischen */ 3775369Sdeischen 3871581Sdeischen#include <sys/taskqueue.h> 3934224Sjb 4071581Sdeischen#if defined(__DragonFly__) || __FreeBSD_version < 700043 4134224Sjb#define FWOHCI_INTFILT 0 4271581Sdeischen#else 4371581Sdeischen#define FWOHCI_INTFILT 1 44119063Sdavidxu#endif 45117706Sdavidxu 46117706Sdavidxutypedef struct fwohci_softc { 4734224Sjb struct firewire_comm fc; 4871581Sdeischen bus_space_tag_t bst; 4934224Sjb bus_space_handle_t bsh; 5034224Sjb void *ih; 51113658Sdeischen#if defined(__DragonFly__) || __FreeBSD_version < 500000 5234224Sjb void *ih_cam; 5334224Sjb void *ih_bio; 5434224Sjb#endif 5534224Sjb struct resource *bsr; 5634224Sjb struct resource *irq_res; 5713546Sjulian struct fwohci_dbch{ 5871581Sdeischen u_int ndb; 5913546Sjulian u_int ndesc; 6071581Sdeischen STAILQ_HEAD(, fwohcidb_tr) db_trq; 6171581Sdeischen struct fwohcidb_tr *top, *bottom, *pdb_tr; 62119063Sdavidxu struct fw_xferq xferq; 63117706Sdavidxu int flags; 64117706Sdavidxu#define FWOHCI_DBCH_INIT (1<<0) 65117706Sdavidxu#define FWOHCI_DBCH_FULL (1<<1) 66117706Sdavidxu /* used only in receive context */ 6713546Sjulian int buf_offset; /* signed */ 6871581Sdeischen#define FWOHCI_DBCH_MAX_PAGES 32 6913546Sjulian /* Context programs buffer */ 7013546Sjulian struct fwdma_alloc_multi *am; 71113658Sdeischen bus_dma_tag_t dmat; 7213546Sjulian } arrq, arrs, atrq, atrs, it[OHCI_DMA_ITCH], ir[OHCI_DMA_IRCH]; 73 u_int maxrec; 74 uint32_t *sid_buf; 75 struct fwdma_alloc sid_dma; 76 struct fwdma_alloc crom_dma; 77 struct fwdma_alloc dummy_dma; 78 uint32_t intmask, irstat, itstat; 79 uint32_t intstat; 80 struct task fwohci_task_busreset; 81 struct task fwohci_task_sid; 82 struct task fwohci_task_dma; 83 int cycle_lost; 84} fwohci_softc_t; 85 86void fwohci_intr (void *arg); 87int fwohci_filt (void *arg); 88int fwohci_init (struct fwohci_softc *, device_t); 89void fwohci_poll (struct firewire_comm *, int, int); 90void fwohci_reset (struct fwohci_softc *, device_t); 91int fwohci_detach (struct fwohci_softc *, device_t); 92int fwohci_resume (struct fwohci_softc *, device_t); 93int fwohci_stop (struct fwohci_softc *, device_t dev); 94