fwohcivar.h revision 113584
1103285Sikob/* 2113584Ssimokawa * Copyright (c) 2003 Hidetoshi SHimokawa 3103285Sikob * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi SHimokawa 4103285Sikob * All rights reserved. 5103285Sikob * 6103285Sikob * Redistribution and use in source and binary forms, with or without 7103285Sikob * modification, are permitted provided that the following conditions 8103285Sikob * are met: 9103285Sikob * 1. Redistributions of source code must retain the above copyright 10103285Sikob * notice, this list of conditions and the following disclaimer. 11103285Sikob * 2. Redistributions in binary form must reproduce the above copyright 12103285Sikob * notice, this list of conditions and the following disclaimer in the 13103285Sikob * documentation and/or other materials provided with the distribution. 14103285Sikob * 3. All advertising materials mentioning features or use of this software 15103285Sikob * must display the acknowledgement as bellow: 16103285Sikob * 17103285Sikob * This product includes software developed by K. Kobayashi and H. Shimokawa 18103285Sikob * 19103285Sikob * 4. The name of the author may not be used to endorse or promote products 20103285Sikob * derived from this software without specific prior written permission. 21103285Sikob * 22103285Sikob * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 23103285Sikob * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24103285Sikob * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 25103285Sikob * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 26103285Sikob * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 27103285Sikob * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 28103285Sikob * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29103285Sikob * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 30103285Sikob * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 31103285Sikob * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 32103285Sikob * POSSIBILITY OF SUCH DAMAGE. 33103285Sikob * 34103285Sikob * $FreeBSD: head/sys/dev/firewire/fwohcivar.h 113584 2003-04-17 03:38:03Z simokawa $ 35103285Sikob * 36103285Sikob */ 37113584Ssimokawa 38113584Ssimokawa#if __FreeBSD_version >= 500000 39113584Ssimokawa#define FWOHCI_TASKQUEUE 1 40113584Ssimokawa#else 41113584Ssimokawa#define FWOHCI_TASKQUEUE 0 42113584Ssimokawa#endif 43113584Ssimokawa#if FWOHCI_TASKQUEUE 44113584Ssimokawa#include <sys/taskqueue.h> 45113584Ssimokawa#endif 46113584Ssimokawa 47103285Sikobtypedef struct fwohci_softc { 48103285Sikob struct firewire_comm fc; 49103285Sikob bus_space_tag_t bst; 50103285Sikob bus_space_handle_t bsh; 51103285Sikob void *ih; 52103285Sikob#if __FreeBSD_version < 500000 53103285Sikob void *ih_cam; 54103285Sikob#endif 55103285Sikob struct resource *bsr; 56103285Sikob struct resource *irq_res; 57103285Sikob struct fwohci_dbch{ 58103285Sikob u_int ndb; 59103285Sikob u_int ndesc; 60103285Sikob STAILQ_HEAD(, fwohcidb_tr) db_trq; 61103285Sikob struct fwohcidb_tr *top, *bottom, *pdb_tr; 62103285Sikob struct fw_xferq xferq; 63103285Sikob int flags; 64108527Ssimokawa#define FWOHCI_DBCH_INIT (1<<0) 65103285Sikob#define FWOHCI_DBCH_FULL (1<<1) 66113584Ssimokawa /* used only in receive context */ 67113584Ssimokawa int buf_offset; /* signed */ 68109379Ssimokawa#define FWOHCI_DBCH_MAX_PAGES 32 69113584Ssimokawa /* Context programs buffer */ 70113584Ssimokawa struct fwdma_alloc_multi *am; 71113584Ssimokawa bus_dma_tag_t dmat; 72108276Ssimokawa } arrq, arrs, atrq, atrs, it[OHCI_DMA_ITCH], ir[OHCI_DMA_IRCH]; 73103285Sikob u_int maxrec; 74113584Ssimokawa u_int32_t *sid_buf; 75113584Ssimokawa struct fwdma_alloc sid_dma; 76113584Ssimokawa struct fwdma_alloc crom_dma; 77113584Ssimokawa struct fwdma_alloc dummy_dma; 78113584Ssimokawa u_int32_t intmask, irstat, itstat; 79113584Ssimokawa#if FWOHCI_TASKQUEUE 80113584Ssimokawa u_int32_t intstat; 81113584Ssimokawa struct task fwohci_task_complete; 82113584Ssimokawa#endif 83103285Sikob} fwohci_softc_t; 84113584Ssimokawa 85103285Sikobvoid fwohci_intr __P((void *arg)); 86103285Sikobint fwohci_init __P((struct fwohci_softc *, device_t)); 87108530Ssimokawavoid fwohci_reset __P((struct fwohci_softc *, device_t)); 88108527Ssimokawaint fwohci_detach __P((struct fwohci_softc *, device_t)); 89108642Ssimokawaint fwohci_resume __P((struct fwohci_softc *, device_t)); 90110146Ssimokawaint fwohci_stop __P((struct fwohci_softc *, device_t dev)); 91