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