xref: /netbsd-src/sys/dev/bi/bivar.h (revision dfba816635b288ffc525cb86146857ef1a9333c3)
1*dfba8166Smatt /*	$NetBSD: bivar.h,v 1.13 2008/03/11 05:34:01 matt Exp $ */
2fa113488Sragge /*
31aa825aeSragge  * Copyright (c) 1996, 1999 Ludd, University of Lule}, Sweden.
4fa113488Sragge  * All rights reserved.
5fa113488Sragge  *
6fa113488Sragge  * Redistribution and use in source and binary forms, with or without
7fa113488Sragge  * modification, are permitted provided that the following conditions
8fa113488Sragge  * are met:
9fa113488Sragge  * 1. Redistributions of source code must retain the above copyright
10fa113488Sragge  *    notice, this list of conditions and the following disclaimer.
11fa113488Sragge  * 2. Redistributions in binary form must reproduce the above copyright
12fa113488Sragge  *    notice, this list of conditions and the following disclaimer in the
13fa113488Sragge  *    documentation and/or other materials provided with the distribution.
14fa113488Sragge  * 3. All advertising materials mentioning features or use of this software
15fa113488Sragge  *    must display the following acknowledgement:
16fa113488Sragge  *	This product includes software developed at Ludd, University of
17fa113488Sragge  *	Lule}, Sweden and its contributors.
18fa113488Sragge  * 4. The name of the author may not be used to endorse or promote products
19fa113488Sragge  *    derived from this software without specific prior written permission
20fa113488Sragge  *
21fa113488Sragge  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22fa113488Sragge  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23fa113488Sragge  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24fa113488Sragge  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25fa113488Sragge  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26fa113488Sragge  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27fa113488Sragge  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28fa113488Sragge  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29fa113488Sragge  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30fa113488Sragge  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31fa113488Sragge  */
325d09a845Smatt #ifndef _DEV_BI_BIVAR_H_
335d09a845Smatt #define _DEV_BI_BIVAR_H_
34fa113488Sragge 
35fa113488Sragge 
36fa113488Sragge /*
37fa113488Sragge  * per-BI-adapter state.
38fa113488Sragge  */
39fa113488Sragge struct bi_softc {
40*dfba8166Smatt 	device_t sc_dev;
411aa825aeSragge 	bus_space_tag_t sc_iot;		/* Space tag for the BI bus */
421aa825aeSragge 	bus_dma_tag_t sc_dmat;
431aa825aeSragge 	bus_addr_t sc_addr;		/* Address base address for this bus */
441aa825aeSragge 	int sc_busnr;			/* (Physical) number of this bus */
451aa825aeSragge 	int sc_lastiv;			/* last available interrupt vector */
4630819cb8Sragge 	int sc_intcpu;
47fa113488Sragge };
48fa113488Sragge 
49fa113488Sragge /*
50fa113488Sragge  * Struct used for autoconfiguration; attaching of BI nodes.
51fa113488Sragge  */
52fa113488Sragge struct bi_attach_args {
531aa825aeSragge 	bus_space_tag_t ba_iot;
541aa825aeSragge 	bus_space_handle_t ba_ioh;	/* Base address for this node */
551aa825aeSragge 	bus_dma_tag_t ba_dmat;
56fa113488Sragge 	int ba_busnr;
57fa113488Sragge 	int ba_nodenr;
58fa113488Sragge 	int ba_intcpu;	/* Mask of which cpus to interrupt */
591aa825aeSragge 	int ba_ivec;	/* Interrupt vector to use */
6030819cb8Sragge 	void *ba_icookie;
61fa113488Sragge };
62fa113488Sragge 
63fa113488Sragge /*
64fa113488Sragge  * BI node list.
65fa113488Sragge  */
66fa113488Sragge struct bi_list {
67fa113488Sragge 	u_short bl_nr;		/* Unit ID# */
681aa825aeSragge 	u_short bl_havedriver;	/* Have device driver (informal) */
69a4a700a7Sragge 	const char *bl_name;		/* DEC name */
70fa113488Sragge };
711aa825aeSragge 
72acb96154Sragge /* bl_havedriver field meaning */
73acb96154Sragge #define	DT_UNSUPP	0	/* pseudo define */
74acb96154Sragge #define	DT_HAVDRV	1	/* device have driver */
75acb96154Sragge #define	DT_ADAPT	2	/* is an adapter */
76acb96154Sragge #define	DT_QUIET	4	/* don't complain when not conf'ed */
77acb96154Sragge #define	DT_VEC		8	/* uses a interrupt vector */
78acb96154Sragge 
791aa825aeSragge /* Prototype */
8011ab56a3Smatt void bi_attach (struct bi_softc *);
810bd304e5Smatt void bi_intr_establish (void *, int, void (*)(void *), void *, struct evcnt *);
825d09a845Smatt 
835d09a845Smatt #endif /* _DEV_BI_BIVAR_H_ */
84