1*612b7ee5Smatt /* $NetBSD: cpu_ofbus.c,v 1.8 2011/06/05 17:03:18 matt Exp $ */
2ed517291Slukem
3ed517291Slukem #include <sys/cdefs.h>
4*612b7ee5Smatt __KERNEL_RCSID(0, "$NetBSD: cpu_ofbus.c,v 1.8 2011/06/05 17:03:18 matt Exp $");
518c88948Sthorpej
618c88948Sthorpej #include <sys/param.h>
718c88948Sthorpej #include <sys/systm.h>
818c88948Sthorpej #include <sys/device.h>
918c88948Sthorpej
1018c88948Sthorpej #include <machine/cpu.h>
1118c88948Sthorpej
1218c88948Sthorpej #include <dev/ofw/openfirm.h>
1318c88948Sthorpej
1418c88948Sthorpej /*
15*612b7ee5Smatt * int cpu_ofbus_match(device_t parent, cfdata_t cf, void *aux)
1618c88948Sthorpej *
1718c88948Sthorpej * Probe for the main cpu. Currently all this does is return 1 to
1818c88948Sthorpej * indicate that the cpu was found.
1918c88948Sthorpej */
2018c88948Sthorpej
2118c88948Sthorpej static int
cpu_ofbus_match(device_t parent,cfdata_t cf,void * aux)22*612b7ee5Smatt cpu_ofbus_match(device_t parent, cfdata_t cf, void *aux)
2318c88948Sthorpej {
2418c88948Sthorpej struct ofbus_attach_args *aa = aux;
2518c88948Sthorpej char buf[32];
2618c88948Sthorpej
2718c88948Sthorpej if (OF_getprop(aa->oba_phandle, "device_type", buf, sizeof(buf)) < 0)
2818c88948Sthorpej return (0);
2918c88948Sthorpej if (strcmp("cpu", buf))
3018c88948Sthorpej return (0);
3118c88948Sthorpej return(1);
3218c88948Sthorpej }
3318c88948Sthorpej
3418c88948Sthorpej /*
35*612b7ee5Smatt * void cpu_ofbus_attach(device_t parent, device_t dev, void *aux)
3618c88948Sthorpej *
3718c88948Sthorpej * Attach the main cpu
3818c88948Sthorpej */
3918c88948Sthorpej
4018c88948Sthorpej static void
cpu_ofbus_attach(device_t parent,device_t self,void * aux)41*612b7ee5Smatt cpu_ofbus_attach(device_t parent, device_t self, void *aux)
4218c88948Sthorpej {
4318c88948Sthorpej cpu_attach(self);
4418c88948Sthorpej }
4518c88948Sthorpej
46*612b7ee5Smatt CFATTACH_DECL_NEW(cpu_ofbus, 0,
4789bf5a8fSthorpej cpu_ofbus_match, cpu_ofbus_attach, NULL, NULL);
48