Home | History | Annotate | Line # | Download | only in ofw
      1 /*	$NetBSD: cpu_ofbus.c,v 1.8 2011/06/05 17:03:18 matt Exp $	*/
      2 
      3 #include <sys/cdefs.h>
      4 __KERNEL_RCSID(0, "$NetBSD: cpu_ofbus.c,v 1.8 2011/06/05 17:03:18 matt Exp $");
      5 
      6 #include <sys/param.h>
      7 #include <sys/systm.h>
      8 #include <sys/device.h>
      9 
     10 #include <machine/cpu.h>
     11 
     12 #include <dev/ofw/openfirm.h>
     13 
     14 /*
     15  * int cpu_ofbus_match(device_t parent, cfdata_t cf, void *aux)
     16  *
     17  * Probe for the main cpu. Currently all this does is return 1 to
     18  * indicate that the cpu was found.
     19  */
     20 
     21 static int
     22 cpu_ofbus_match(device_t parent, cfdata_t cf, 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(device_t parent, device_t dev, void *aux)
     36  *
     37  * Attach the main cpu
     38  */
     39 
     40 static void
     41 cpu_ofbus_attach(device_t parent, device_t self, void *aux)
     42 {
     43 	cpu_attach(self);
     44 }
     45 
     46 CFATTACH_DECL_NEW(cpu_ofbus, 0,
     47     cpu_ofbus_match, cpu_ofbus_attach, NULL, NULL);
     48