xref: /netbsd/sys/dev/eisa/eisavar.h (revision e11817c5)
1 /*	$NetBSD: eisavar.h,v 1.25 2021/01/27 04:31:36 thorpej Exp $	*/
2 
3 /*-
4  * Copyright (c) 2000 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Jason R. Thorpe.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29  * POSSIBILITY OF SUCH DAMAGE.
30  */
31 
32 /*
33  * Copyright (c) 1995, 1996 Christopher G. Demetriou
34  * All rights reserved.
35  *
36  * Redistribution and use in source and binary forms, with or without
37  * modification, are permitted provided that the following conditions
38  * are met:
39  * 1. Redistributions of source code must retain the above copyright
40  *    notice, this list of conditions and the following disclaimer.
41  * 2. Redistributions in binary form must reproduce the above copyright
42  *    notice, this list of conditions and the following disclaimer in the
43  *    documentation and/or other materials provided with the distribution.
44  * 3. All advertising materials mentioning features or use of this software
45  *    must display the following acknowledgement:
46  *      This product includes software developed by Christopher G. Demetriou
47  *      for the NetBSD Project.
48  * 4. The name of the author may not be used to endorse or promote products
49  *    derived from this software without specific prior written permission
50  *
51  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
52  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
53  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
54  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
55  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
56  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
57  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
58  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
59  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
60  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
61  */
62 
63 #ifndef _DEV_EISA_EISAVAR_H_
64 #define	_DEV_EISA_EISAVAR_H_
65 
66 /*
67  * Definitions for EISA autoconfiguration.
68  *
69  * This file describes types and functions which are used for EISA
70  * configuration.  Some of this information is machine-specific, and is
71  * separated into eisa_machdep.h.
72  */
73 
74 struct eisa_cfg_mem;
75 struct eisa_cfg_irq;
76 struct eisa_cfg_dma;
77 struct eisa_cfg_io;
78 
79 #include <sys/bus.h>
80 #include <dev/eisa/eisareg.h>		/* For ID register & string info. */
81 
82 /*
83  * Structures and definitions needed by the machine-dependent header.
84  */
85 struct eisabus_attach_args;
86 
87 /*
88  * Machine-dependent definitions.
89  */
90 #include <machine/eisa_machdep.h>
91 
92 typedef int	eisa_slot_t;		/* really only needs to be 4 bits */
93 
94 /*
95  * EISA bus attach arguments.
96  */
97 struct eisabus_attach_args {
98 	const char *_eba_busname;	/* XXX placeholder */
99 	bus_space_tag_t eba_iot;	/* eisa i/o space tag */
100 	bus_space_tag_t eba_memt;	/* eisa mem space tag */
101 	bus_dma_tag_t eba_dmat;		/* DMA tag */
102 	eisa_chipset_tag_t eba_ec;
103 };
104 
105 /*
106  * EISA device attach arguments.
107  */
108 struct eisa_attach_args {
109 	bus_space_tag_t ea_iot;		/* eisa i/o space tag */
110 	bus_space_tag_t ea_memt;	/* eisa mem space tag */
111 	bus_dma_tag_t ea_dmat;		/* DMA tag */
112 	eisa_chipset_tag_t ea_ec;
113 
114 	eisa_slot_t	ea_slot;
115 	u_int8_t	ea_vid[EISA_NVIDREGS];
116 	u_int8_t	ea_pid[EISA_NPIDREGS];
117 	char		ea_idstring[EISA_IDSTRINGLEN];
118 };
119 
120 int	eisabusprint(void *, const char *);
121 
122 /*
123  * EISA Configuration entries, set up by an EISA Configuration Utility.
124  */
125 
126 struct eisa_cfg_mem {
127 	bus_addr_t ecm_addr;
128 	bus_size_t ecm_size;
129 	int ecm_isram;
130 	int ecm_decode;
131 	int ecm_unitsize;
132 };
133 
134 struct eisa_cfg_irq {
135 	int eci_irq;
136 	int eci_ist;
137 	int eci_shared;
138 };
139 
140 struct eisa_cfg_dma {
141 	int ecd_drq;
142 	int ecd_shared;
143 	int ecd_size;
144 #define	ECD_SIZE_8BIT		0
145 #define	ECD_SIZE_16BIT		1
146 #define	ECD_SIZE_32BIT		2
147 #define	ECD_SIZE_RESERVED	3
148 	int ecd_timing;
149 #define	ECD_TIMING_ISA		0
150 #define	ECD_TIMING_TYPEA	1
151 #define	ECD_TIMING_TYPEB	2
152 #define	ECD_TIMING_TYPEC	3
153 };
154 
155 struct eisa_cfg_io {
156 	bus_addr_t ecio_addr;
157 	bus_size_t ecio_size;
158 	int ecio_shared;
159 };
160 
161 #ifdef _KERNEL
162 int	eisa_compatible_match(const struct eisa_attach_args *,
163 	    const struct device_compatible_entry *);
164 const struct device_compatible_entry *
165 	eisa_compatible_lookup(const struct eisa_attach_args *,
166 	    const struct device_compatible_entry *);
167 #endif /* _KERNEL */
168 
169 #endif /* _DEV_EISA_EISAVAR_H_ */
170