This source file includes following definitions.
- mainbus_match
- mainbus_attach
- mainbus_print
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 #include <sys/param.h>
35 #include <sys/systm.h>
36 #include <sys/device.h>
37
38 #include <machine/bus.h>
39
40 #include <dev/isa/isavar.h>
41 #include <dev/eisa/eisavar.h>
42 #include <dev/pci/pcivar.h>
43
44 #include <dev/isa/isareg.h>
45 #include <i386/isa/isa_machdep.h>
46
47 #include "pci.h"
48 #include "eisa.h"
49 #include "isa.h"
50 #include "apm.h"
51 #include "bios.h"
52 #include "mpbios.h"
53 #include "acpi.h"
54 #include "ipmi.h"
55 #include "esm.h"
56 #include "vesabios.h"
57
58 #include <machine/cpuvar.h>
59 #include <machine/i82093var.h>
60 #include <machine/mpbiosvar.h>
61
62 #if NBIOS > 0
63 #include <machine/biosvar.h>
64 #endif
65
66 #if NACPI > 0
67 #include <dev/acpi/acpireg.h>
68 #include <dev/acpi/acpivar.h>
69 #endif
70
71 #if NIPMI > 0
72 #include <dev/ipmivar.h>
73 #endif
74
75 #if NESM > 0
76 #include <arch/i386/i386/esmvar.h>
77 #endif
78
79 #if NVESABIOS > 0
80 #include <dev/vesa/vesabiosvar.h>
81 #endif
82
83 #if 0
84 #ifdef SMP
85 #include <machine/mp.h>
86 #endif
87 #endif
88
89 int mainbus_match(struct device *, void *, void *);
90 void mainbus_attach(struct device *, struct device *, void *);
91
92 struct cfattach mainbus_ca = {
93 sizeof(struct device), mainbus_match, mainbus_attach
94 };
95
96 struct cfdriver mainbus_cd = {
97 NULL, "mainbus", DV_DULL
98 };
99
100 int mainbus_print(void *, const char *);
101
102 union mainbus_attach_args {
103 const char *mba_busname;
104 struct pcibus_attach_args mba_pba;
105 struct eisabus_attach_args mba_eba;
106 struct isabus_attach_args mba_iba;
107 #if NBIOS > 0
108 struct bios_attach_args mba_bios;
109 #endif
110 struct cpu_attach_args mba_caa;
111 struct apic_attach_args aaa_caa;
112 #if NACPI > 0
113 struct acpi_attach_args mba_aaa;
114 #endif
115 #if NIPMI > 0
116 struct ipmi_attach_args mba_iaa;
117 #endif
118 #if NESM > 0
119 struct esm_attach_args mba_eaa;
120 #endif
121 };
122
123
124
125
126
127 int isa_has_been_seen;
128
129
130
131
132 int
133 mainbus_match(struct device *parent, void *match, void *aux)
134 {
135 return (1);
136 }
137
138
139
140
141 void
142 mainbus_attach(struct device *parent, struct device *self, void *aux)
143 {
144 union mainbus_attach_args mba;
145 extern void (*setperf_setup)(struct cpu_info *);
146 extern void (*cpusensors_setup)(struct cpu_info *);
147
148 printf("\n");
149
150 #if NBIOS > 0
151 {
152 mba.mba_bios.bios_dev = "bios";
153 mba.mba_bios.bios_iot = I386_BUS_SPACE_IO;
154 mba.mba_bios.bios_memt = I386_BUS_SPACE_MEM;
155 config_found(self, &mba.mba_bios, mainbus_print);
156 }
157 #endif
158 #if NACPI > 0
159 #if NPCI > 0
160 if (pci_mode_detect() != 0)
161 #endif
162 {
163 memset(&mba.mba_aaa, 0, sizeof(mba.mba_aaa));
164 mba.mba_aaa.aaa_name = "acpi";
165 mba.mba_aaa.aaa_iot = I386_BUS_SPACE_IO;
166 mba.mba_aaa.aaa_memt = I386_BUS_SPACE_MEM;
167
168 if (acpi_probe(self, aux, &mba.mba_aaa))
169 config_found(self, &mba.mba_aaa, mainbus_print);
170 }
171 #endif
172
173 #if NIPMI > 0
174 {
175 memset(&mba.mba_iaa, 0, sizeof(mba.mba_iaa));
176 mba.mba_iaa.iaa_name = "ipmi";
177 mba.mba_iaa.iaa_iot = I386_BUS_SPACE_IO;
178 mba.mba_iaa.iaa_memt = I386_BUS_SPACE_MEM;
179 if (ipmi_probe(&mba.mba_iaa))
180 config_found(self, &mba.mba_iaa, mainbus_print);
181 }
182 #endif
183
184 #if NMPBIOS > 0
185 if (mpbios_probe(self))
186 mpbios_scan(self);
187 #endif
188
189 if ((cpu_info_primary.ci_flags & CPUF_PRESENT) == 0) {
190 struct cpu_attach_args caa;
191
192 memset(&caa, 0, sizeof(caa));
193 caa.caa_name = "cpu";
194 caa.cpu_number = 0;
195 caa.cpu_role = CPU_ROLE_SP;
196 caa.cpu_func = 0;
197 caa.cpu_signature = cpu_id;
198 caa.feature_flags = cpu_feature;
199
200 config_found(self, &caa, mainbus_print);
201 }
202
203 #if NACPI > 0
204 if (!acpi_hasprocfvs)
205 #endif
206 {
207 if (setperf_setup != NULL)
208 setperf_setup(&cpu_info_primary);
209 }
210
211 #ifdef MULTIPROCESSOR
212 mp_setperf_init();
213 #endif
214
215 if (cpusensors_setup != NULL)
216 cpusensors_setup(&cpu_info_primary);
217
218 #if NVESABIOS > 0
219 if (vbeprobe()) {
220 mba.mba_busname = "vesabios";
221 config_found(self, &mba.mba_busname, NULL);
222 }
223 #endif
224
225 #if 0
226 #ifdef SMP
227 if (bios_smpinfo != NULL) {
228 struct mp_float *mp = bios_smpinfo;
229
230 printf("%s: MP 1.%d configuration %d\n", self->dv_xname,
231 mp->revision, mp->feature1);
232 }
233 #ifdef CPU_DEBUG
234 else
235 printf ("%s: No MP configuration found.", self->dv_xname);
236 #endif
237 #endif
238 #endif
239
240 #if NESM > 0
241 {
242 memset(&mba.mba_eaa, 0, sizeof(mba.mba_eaa));
243 mba.mba_eaa.eaa_name = "esm";
244 mba.mba_eaa.eaa_iot = I386_BUS_SPACE_IO;
245 mba.mba_eaa.eaa_memt = I386_BUS_SPACE_MEM;
246 if (esm_probe(&mba.mba_eaa))
247 config_found(self, &mba.mba_eaa, mainbus_print);
248 }
249 #endif
250
251
252
253
254
255
256
257 #if NPCI > 0
258 if (pci_mode_detect() != 0) {
259 mba.mba_pba.pba_busname = "pci";
260 mba.mba_pba.pba_iot = I386_BUS_SPACE_IO;
261 mba.mba_pba.pba_memt = I386_BUS_SPACE_MEM;
262 mba.mba_pba.pba_dmat = &pci_bus_dma_tag;
263 mba.mba_pba.pba_domain = pci_ndomains++;
264 mba.mba_pba.pba_bus = 0;
265 mba.mba_pba.pba_bridgetag = NULL;
266 config_found(self, &mba.mba_pba, mainbus_print);
267 }
268 #endif
269
270 if (!bcmp(ISA_HOLE_VADDR(EISA_ID_PADDR), EISA_ID, EISA_ID_LEN)) {
271 mba.mba_eba.eba_busname = "eisa";
272 mba.mba_eba.eba_iot = I386_BUS_SPACE_IO;
273 mba.mba_eba.eba_memt = I386_BUS_SPACE_MEM;
274 #if NEISA > 0
275 mba.mba_eba.eba_dmat = &eisa_bus_dma_tag;
276 #endif
277 config_found(self, &mba.mba_eba, mainbus_print);
278 }
279
280 if (isa_has_been_seen == 0) {
281 mba.mba_iba.iba_busname = "isa";
282 mba.mba_iba.iba_iot = I386_BUS_SPACE_IO;
283 mba.mba_iba.iba_memt = I386_BUS_SPACE_MEM;
284 #if NISADMA > 0
285 mba.mba_iba.iba_dmat = &isa_bus_dma_tag;
286 #endif
287 config_found(self, &mba.mba_iba, mainbus_print);
288 }
289 }
290
291 int
292 mainbus_print(void *aux, const char *pnp)
293 {
294 union mainbus_attach_args *mba = aux;
295
296 if (pnp)
297 printf("%s at %s", mba->mba_busname, pnp);
298 if (!strcmp(mba->mba_busname, "pci"))
299 printf(" bus %d", mba->mba_pba.pba_bus);
300
301 return (UNCONF);
302 }