eisavar.h revision 1.26 1 /* $NetBSD: eisavar.h,v 1.26 2025/10/19 20:34:04 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 int eisabusprint(void *, const char *);
106
107 static inline device_t
108 eisabus_attach(device_t dev, struct eisabus_attach_args *iba)
109 {
110 return config_found(dev, &iba, eisabusprint,
111 CFARGS(.iattr = "eisabus",
112 .devhandle = device_handle(dev)));
113 }
114
115 /*
116 * EISA device attach arguments.
117 */
118 struct eisa_attach_args {
119 bus_space_tag_t ea_iot; /* eisa i/o space tag */
120 bus_space_tag_t ea_memt; /* eisa mem space tag */
121 bus_dma_tag_t ea_dmat; /* DMA tag */
122 eisa_chipset_tag_t ea_ec;
123
124 eisa_slot_t ea_slot;
125 u_int8_t ea_vid[EISA_NVIDREGS];
126 u_int8_t ea_pid[EISA_NPIDREGS];
127 char ea_idstring[EISA_IDSTRINGLEN];
128 };
129
130 /*
131 * EISA Configuration entries, set up by an EISA Configuration Utility.
132 */
133
134 struct eisa_cfg_mem {
135 bus_addr_t ecm_addr;
136 bus_size_t ecm_size;
137 int ecm_isram;
138 int ecm_decode;
139 int ecm_unitsize;
140 };
141
142 struct eisa_cfg_irq {
143 int eci_irq;
144 int eci_ist;
145 int eci_shared;
146 };
147
148 struct eisa_cfg_dma {
149 int ecd_drq;
150 int ecd_shared;
151 int ecd_size;
152 #define ECD_SIZE_8BIT 0
153 #define ECD_SIZE_16BIT 1
154 #define ECD_SIZE_32BIT 2
155 #define ECD_SIZE_RESERVED 3
156 int ecd_timing;
157 #define ECD_TIMING_ISA 0
158 #define ECD_TIMING_TYPEA 1
159 #define ECD_TIMING_TYPEB 2
160 #define ECD_TIMING_TYPEC 3
161 };
162
163 struct eisa_cfg_io {
164 bus_addr_t ecio_addr;
165 bus_size_t ecio_size;
166 int ecio_shared;
167 };
168
169 #ifdef _KERNEL
170 int eisa_compatible_match(const struct eisa_attach_args *,
171 const struct device_compatible_entry *);
172 const struct device_compatible_entry *
173 eisa_compatible_lookup(const struct eisa_attach_args *,
174 const struct device_compatible_entry *);
175 #endif /* _KERNEL */
176
177 #endif /* _DEV_EISA_EISAVAR_H_ */
178