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