Home | History | Annotate | Line # | Download | only in ofw
cpu_ofbus.c revision 1.5
      1 /*	$NetBSD: cpu_ofbus.c,v 1.5 2003/07/15 03:36:02 lukem Exp $	*/
      2 
      3 #include <sys/cdefs.h>
      4 __KERNEL_RCSID(0, "$NetBSD: cpu_ofbus.c,v 1.5 2003/07/15 03:36:02 lukem 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(struct device *parent, struct cfdata *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(parent, cf, aux)
     23 	struct device *parent;
     24 	struct cfdata *cf;
     25 	void *aux;
     26 {
     27 	struct ofbus_attach_args *aa = aux;
     28 	char buf[32];
     29 
     30 	if (OF_getprop(aa->oba_phandle, "device_type", buf, sizeof(buf)) < 0)
     31 		return (0);
     32 	if (strcmp("cpu", buf))
     33 		return (0);
     34 	return(1);
     35 }
     36 
     37 /*
     38  * void cpu_ofbus_attach(struct device *parent, struct device *dev, void *aux)
     39  *
     40  * Attach the main cpu
     41  */
     42 
     43 static void
     44 cpu_ofbus_attach(parent, self, aux)
     45 	struct device *parent;
     46 	struct device *self;
     47 	void *aux;
     48 {
     49 	cpu_attach(self);
     50 }
     51 
     52 CFATTACH_DECL(cpu_ofbus, sizeof(struct device),
     53     cpu_ofbus_match, cpu_ofbus_attach, NULL, NULL);
     54