fwohcivar.h revision 167628
190075Sobrien/*- 290075Sobrien * Copyright (c) 2003 Hidetoshi SHimokawa 3132718Skan * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi SHimokawa 490075Sobrien * All rights reserved. 590075Sobrien * 690075Sobrien * Redistribution and use in source and binary forms, with or without 790075Sobrien * modification, are permitted provided that the following conditions 890075Sobrien * are met: 990075Sobrien * 1. Redistributions of source code must retain the above copyright 1090075Sobrien * notice, this list of conditions and the following disclaimer. 1190075Sobrien * 2. Redistributions in binary form must reproduce the above copyright 1290075Sobrien * notice, this list of conditions and the following disclaimer in the 1390075Sobrien * documentation and/or other materials provided with the distribution. 1490075Sobrien * 3. All advertising materials mentioning features or use of this software 1590075Sobrien * must display the acknowledgement as bellow: 1690075Sobrien * 1790075Sobrien * This product includes software developed by K. Kobayashi and H. Shimokawa 1890075Sobrien * 1990075Sobrien * 4. The name of the author may not be used to endorse or promote products 2090075Sobrien * derived from this software without specific prior written permission. 2190075Sobrien * 2290075Sobrien * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 2390075Sobrien * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 2490075Sobrien * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 25132718Skan * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 26132718Skan * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 2790075Sobrien * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 28117395Skan * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2990075Sobrien * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 3090075Sobrien * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 3190075Sobrien * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 3290075Sobrien * POSSIBILITY OF SUCH DAMAGE. 3390075Sobrien * 3490075Sobrien * $FreeBSD: head/sys/dev/firewire/fwohcivar.h 167628 2007-03-16 04:25:02Z simokawa $ 3590075Sobrien * 3690075Sobrien */ 3790075Sobrien 3890075Sobrien#if defined(__DragonFly__) || __FreeBSD_version < 500000 3990075Sobrien#define FWOHCI_TASKQUEUE 0 4090075Sobrien#else 41132718Skan#define FWOHCI_TASKQUEUE 1 4290075Sobrien#endif 4390075Sobrien#if FWOHCI_TASKQUEUE 4490075Sobrien#include <sys/taskqueue.h> 4590075Sobrien#endif 4690075Sobrien 4790075Sobrientypedef struct fwohci_softc { 4890075Sobrien struct firewire_comm fc; 4990075Sobrien bus_space_tag_t bst; 5090075Sobrien bus_space_handle_t bsh; 5190075Sobrien void *ih; 52132718Skan#if defined(__DragonFly__) || __FreeBSD_version < 500000 53132718Skan void *ih_cam; 54132718Skan void *ih_bio; 55132718Skan#endif 56132718Skan struct resource *bsr; 57132718Skan struct resource *irq_res; 58132718Skan struct fwohci_dbch{ 59132718Skan u_int ndb; 60132718Skan u_int ndesc; 6190075Sobrien STAILQ_HEAD(, fwohcidb_tr) db_trq; 6290075Sobrien struct fwohcidb_tr *top, *bottom, *pdb_tr; 6390075Sobrien struct fw_xferq xferq; 6490075Sobrien int flags; 65132718Skan#define FWOHCI_DBCH_INIT (1<<0) 6690075Sobrien#define FWOHCI_DBCH_FULL (1<<1) 67117395Skan /* used only in receive context */ 6890075Sobrien int buf_offset; /* signed */ 6990075Sobrien#define FWOHCI_DBCH_MAX_PAGES 32 7090075Sobrien /* Context programs buffer */ 71117395Skan struct fwdma_alloc_multi *am; 7290075Sobrien bus_dma_tag_t dmat; 7390075Sobrien } arrq, arrs, atrq, atrs, it[OHCI_DMA_ITCH], ir[OHCI_DMA_IRCH]; 7490075Sobrien u_int maxrec; 75132718Skan uint32_t *sid_buf; 76132718Skan struct fwdma_alloc sid_dma; 7790075Sobrien struct fwdma_alloc crom_dma; 7890075Sobrien struct fwdma_alloc dummy_dma; 7990075Sobrien uint32_t intmask, irstat, itstat; 8090075Sobrien#if FWOHCI_TASKQUEUE 8190075Sobrien uint32_t intstat; 8290075Sobrien struct task fwohci_task_complete; 8390075Sobrien#endif 8490075Sobrien int cycle_lost; 8590075Sobrien} fwohci_softc_t; 8690075Sobrien 8790075Sobrienvoid fwohci_intr (void *arg); 8890075Sobrienint fwohci_init (struct fwohci_softc *, device_t); 8990075Sobrienvoid fwohci_poll (struct firewire_comm *, int, int); 9096263Sobrienvoid fwohci_reset (struct fwohci_softc *, device_t); 9196263Sobrienint fwohci_detach (struct fwohci_softc *, device_t); 9290075Sobrienint fwohci_resume (struct fwohci_softc *, device_t); 9396263Sobrienint fwohci_stop (struct fwohci_softc *, device_t dev); 9490075Sobrien