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