Home | History | Annotate | Line # | Download | only in ofw
cpu_ofbus.c revision 1.6.88.1
      1  1.6.88.1    skrll /*	$NetBSD: cpu_ofbus.c,v 1.6.88.1 2009/04/28 07:34:40 skrll Exp $	*/
      2       1.5    lukem 
      3       1.5    lukem #include <sys/cdefs.h>
      4  1.6.88.1    skrll __KERNEL_RCSID(0, "$NetBSD: cpu_ofbus.c,v 1.6.88.1 2009/04/28 07:34:40 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.6.88.1    skrll cpu_ofbus_match(struct device *parent, struct cfdata *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.1  thorpej  * void cpu_ofbus_attach(struct device *parent, struct device *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.6.88.1    skrll cpu_ofbus_attach(struct device *parent, struct device *self, void *aux)
     42       1.1  thorpej {
     43       1.1  thorpej 	cpu_attach(self);
     44       1.1  thorpej }
     45       1.1  thorpej 
     46       1.3  thorpej CFATTACH_DECL(cpu_ofbus, sizeof(struct device),
     47       1.4  thorpej     cpu_ofbus_match, cpu_ofbus_attach, NULL, NULL);
     48