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