1 1.8 matt /* $NetBSD: cpu_ofbus.c,v 1.8 2011/06/05 17:03:18 matt Exp $ */ 2 1.5 lukem 3 1.5 lukem #include <sys/cdefs.h> 4 1.8 matt __KERNEL_RCSID(0, "$NetBSD: cpu_ofbus.c,v 1.8 2011/06/05 17:03:18 matt Exp $"); 5 1.1 thorpej 6 1.1 thorpej #include <sys/param.h> 7 1.1 thorpej #include <sys/systm.h> 8 1.1 thorpej #include <sys/device.h> 9 1.1 thorpej 10 1.1 thorpej #include <machine/cpu.h> 11 1.1 thorpej 12 1.1 thorpej #include <dev/ofw/openfirm.h> 13 1.1 thorpej 14 1.1 thorpej /* 15 1.8 matt * int cpu_ofbus_match(device_t parent, cfdata_t cf, void *aux) 16 1.1 thorpej * 17 1.1 thorpej * Probe for the main cpu. Currently all this does is return 1 to 18 1.1 thorpej * indicate that the cpu was found. 19 1.1 thorpej */ 20 1.1 thorpej 21 1.1 thorpej static int 22 1.8 matt cpu_ofbus_match(device_t parent, cfdata_t cf, void *aux) 23 1.1 thorpej { 24 1.1 thorpej struct ofbus_attach_args *aa = aux; 25 1.1 thorpej char buf[32]; 26 1.1 thorpej 27 1.1 thorpej if (OF_getprop(aa->oba_phandle, "device_type", buf, sizeof(buf)) < 0) 28 1.1 thorpej return (0); 29 1.1 thorpej if (strcmp("cpu", buf)) 30 1.1 thorpej return (0); 31 1.1 thorpej return(1); 32 1.1 thorpej } 33 1.1 thorpej 34 1.1 thorpej /* 35 1.8 matt * void cpu_ofbus_attach(device_t parent, device_t dev, void *aux) 36 1.1 thorpej * 37 1.1 thorpej * Attach the main cpu 38 1.1 thorpej */ 39 1.1 thorpej 40 1.1 thorpej static void 41 1.8 matt cpu_ofbus_attach(device_t parent, device_t self, void *aux) 42 1.1 thorpej { 43 1.1 thorpej cpu_attach(self); 44 1.1 thorpej } 45 1.1 thorpej 46 1.8 matt CFATTACH_DECL_NEW(cpu_ofbus, 0, 47 1.4 thorpej cpu_ofbus_match, cpu_ofbus_attach, NULL, NULL); 48