#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <machine/autoconf.h>
int mainbus_match(struct device *, void *, void *);
void mainbus_attach(struct device *, struct device *, void *);
int mainbus_print(void *, const char *);
const struct cfattach mainbus_ca = {
sizeof(struct device), mainbus_match, mainbus_attach
};
struct cfdriver mainbus_cd = {
NULL, "mainbus", DV_DULL
};
int
mainbus_match(struct device *parent, void *cfdata, void *aux)
{
static int mainbus_attached = 0;
if (mainbus_attached != 0)
return 0;
return mainbus_attached = 1;
}
void
mainbus_attach(struct device *parent, struct device *self, void *aux)
{
struct cpu_attach_args caa;
printf(": %s %s\n", sys_platform->vendor, sys_platform->product);
bzero(&caa, sizeof caa);
caa.caa_maa.maa_name = "cpu";
caa.caa_hw = &bootcpu_hwinfo;
config_found(self, &caa, mainbus_print);
#ifdef MULTIPROCESSOR
if (sys_platform->config_secondary_cpus != NULL)
sys_platform->config_secondary_cpus(self, mainbus_print);
#endif
caa.caa_maa.maa_name = "bonito";
config_found(self, &caa.caa_maa, mainbus_print);
caa.caa_maa.maa_name = "htb";
config_found(self, &caa.caa_maa, mainbus_print);
caa.caa_maa.maa_name = "leioc";
config_found(self, &caa.caa_maa, mainbus_print);
if (md_startclock == NULL) {
caa.caa_maa.maa_name = "clock";
config_found(self, &caa.caa_maa, mainbus_print);
}
caa.caa_maa.maa_name = "apm";
config_found(self, &caa.caa_maa, mainbus_print);
}
int
mainbus_print(void *aux, const char *pnp)
{
return pnp != NULL ? QUIET : UNCONF;
}