xref: /dflybsd-src/sys/dev/misc/puc/pucvar.h (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
186d7f5d3SJohn Marino /*	$NetBSD: pucvar.h,v 1.2 1999/02/06 06:29:54 cgd Exp $	*/
286d7f5d3SJohn Marino /*	$FreeBSD: src/sys/dev/puc/pucvar.h,v 1.1.2.4 2003/04/04 08:42:17 sobomax Exp $ */
386d7f5d3SJohn Marino /*	$DragonFly: src/sys/dev/misc/puc/pucvar.h,v 1.2 2003/06/17 04:28:29 dillon Exp $ */
486d7f5d3SJohn Marino 
586d7f5d3SJohn Marino /*-
686d7f5d3SJohn Marino  * Copyright (c) 2002 JF Hay.  All rights reserved.
786d7f5d3SJohn Marino  * Copyright (c) 2000 M. Warner Losh.  All rights reserved.
886d7f5d3SJohn Marino  *
986d7f5d3SJohn Marino  * Redistribution and use in source and binary forms, with or without
1086d7f5d3SJohn Marino  * modification, are permitted provided that the following conditions
1186d7f5d3SJohn Marino  * are met:
1286d7f5d3SJohn Marino  * 1. Redistributions of source code must retain the above copyright
1386d7f5d3SJohn Marino  *    notice unmodified, this list of conditions, and the following
1486d7f5d3SJohn Marino  *    disclaimer.
1586d7f5d3SJohn Marino  * 2. Redistributions in binary form must reproduce the above copyright
1686d7f5d3SJohn Marino  *    notice, this list of conditions and the following disclaimer in the
1786d7f5d3SJohn Marino  *    documentation and/or other materials provided with the distribution.
1886d7f5d3SJohn Marino  *
1986d7f5d3SJohn Marino  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
2086d7f5d3SJohn Marino  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
2186d7f5d3SJohn Marino  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2286d7f5d3SJohn Marino  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2386d7f5d3SJohn Marino  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2486d7f5d3SJohn Marino  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2586d7f5d3SJohn Marino  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2686d7f5d3SJohn Marino  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2786d7f5d3SJohn Marino  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2886d7f5d3SJohn Marino  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2986d7f5d3SJohn Marino  */
3086d7f5d3SJohn Marino 
3186d7f5d3SJohn Marino /*
3286d7f5d3SJohn Marino  * Copyright (c) 1998, 1999 Christopher G. Demetriou.  All rights reserved.
3386d7f5d3SJohn Marino  *
3486d7f5d3SJohn Marino  * Redistribution and use in source and binary forms, with or without
3586d7f5d3SJohn Marino  * modification, are permitted provided that the following conditions
3686d7f5d3SJohn Marino  * are met:
3786d7f5d3SJohn Marino  * 1. Redistributions of source code must retain the above copyright
3886d7f5d3SJohn Marino  *    notice, this list of conditions and the following disclaimer.
3986d7f5d3SJohn Marino  * 2. Redistributions in binary form must reproduce the above copyright
4086d7f5d3SJohn Marino  *    notice, this list of conditions and the following disclaimer in the
4186d7f5d3SJohn Marino  *    documentation and/or other materials provided with the distribution.
4286d7f5d3SJohn Marino  * 3. All advertising materials mentioning features or use of this software
4386d7f5d3SJohn Marino  *    must display the following acknowledgement:
4486d7f5d3SJohn Marino  *      This product includes software developed by Christopher G. Demetriou
4586d7f5d3SJohn Marino  *	for the NetBSD Project.
4686d7f5d3SJohn Marino  * 4. The name of the author may not be used to endorse or promote products
4786d7f5d3SJohn Marino  *    derived from this software without specific prior written permission
4886d7f5d3SJohn Marino  *
4986d7f5d3SJohn Marino  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
5086d7f5d3SJohn Marino  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
5186d7f5d3SJohn Marino  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
5286d7f5d3SJohn Marino  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
5386d7f5d3SJohn Marino  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
5486d7f5d3SJohn Marino  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
5586d7f5d3SJohn Marino  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
5686d7f5d3SJohn Marino  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
5786d7f5d3SJohn Marino  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
5886d7f5d3SJohn Marino  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5986d7f5d3SJohn Marino  */
6086d7f5d3SJohn Marino 
6186d7f5d3SJohn Marino /*
6286d7f5d3SJohn Marino  * Exported (or conveniently located) PCI "universal" communications card
6386d7f5d3SJohn Marino  * software structures.
6486d7f5d3SJohn Marino  *
6586d7f5d3SJohn Marino  * Author: Christopher G. Demetriou, May 14, 1998.
6686d7f5d3SJohn Marino  */
6786d7f5d3SJohn Marino 
6886d7f5d3SJohn Marino #define	PUC_MAX_PORTS		16
6986d7f5d3SJohn Marino 
7086d7f5d3SJohn Marino struct puc_device_description {
7186d7f5d3SJohn Marino 	const char	*name;
7286d7f5d3SJohn Marino 	uint32_t	rval[4];
7386d7f5d3SJohn Marino 	uint32_t	rmask[4];
7486d7f5d3SJohn Marino 	struct {
7586d7f5d3SJohn Marino 		int	type;
7686d7f5d3SJohn Marino 		int	bar;
7786d7f5d3SJohn Marino 		int	offset;
7886d7f5d3SJohn Marino 		u_int	serialfreq;
7986d7f5d3SJohn Marino 		u_int	flags;
8086d7f5d3SJohn Marino 	} ports[PUC_MAX_PORTS];
8186d7f5d3SJohn Marino 	uint32_t	ilr_type;
8286d7f5d3SJohn Marino 	uint32_t	ilr_offset[2];
8386d7f5d3SJohn Marino };
8486d7f5d3SJohn Marino 
8586d7f5d3SJohn Marino #define	PUC_REG_VEND		0
8686d7f5d3SJohn Marino #define	PUC_REG_PROD		1
8786d7f5d3SJohn Marino #define	PUC_REG_SVEND		2
8886d7f5d3SJohn Marino #define	PUC_REG_SPROD		3
8986d7f5d3SJohn Marino 
9086d7f5d3SJohn Marino #define	PUC_PORT_TYPE_NONE	0
9186d7f5d3SJohn Marino #define	PUC_PORT_TYPE_COM	1
9286d7f5d3SJohn Marino #define	PUC_PORT_TYPE_LPT	2
9386d7f5d3SJohn Marino 
9486d7f5d3SJohn Marino /* Interrupt Latch Register (ILR) types */
9586d7f5d3SJohn Marino #define	PUC_ILR_TYPE_NONE	0
9686d7f5d3SJohn Marino #define	PUC_ILR_TYPE_DIGI	1
9786d7f5d3SJohn Marino 
9886d7f5d3SJohn Marino #define	PUC_PORT_VALID(desc, port) \
9986d7f5d3SJohn Marino   ((port) < PUC_MAX_PORTS && (desc)->ports[(port)].type != PUC_PORT_TYPE_NONE)
10086d7f5d3SJohn Marino #define PUC_PORT_BAR_INDEX(bar)	(((bar) - PCIR_MAPS) / 4)
10186d7f5d3SJohn Marino 
10286d7f5d3SJohn Marino #define PUC_MAX_BAR		6
10386d7f5d3SJohn Marino 
10486d7f5d3SJohn Marino enum puc_device_ivars {
10586d7f5d3SJohn Marino 	PUC_IVAR_FREQ
10686d7f5d3SJohn Marino };
10786d7f5d3SJohn Marino 
10886d7f5d3SJohn Marino extern const struct puc_device_description puc_devices[];
109