Home | History | Annotate | Line # | Download | only in ofw
cpu_ofbus.c revision 1.7.10.1
      1  1.7.10.1   cherry /*	$NetBSD: cpu_ofbus.c,v 1.7.10.1 2011/06/23 14:19:39 cherry Exp $	*/
      2       1.5    lukem 
      3       1.5    lukem #include <sys/cdefs.h>
      4  1.7.10.1   cherry __KERNEL_RCSID(0, "$NetBSD: cpu_ofbus.c,v 1.7.10.1 2011/06/23 14:19:39 cherry 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.7.10.1   cherry  * int cpu_ofbus_match(device_t parent, cfdata_t 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.7.10.1   cherry cpu_ofbus_match(device_t parent, cfdata_t 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.7.10.1   cherry  * void cpu_ofbus_attach(device_t parent, device_t 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.7.10.1   cherry cpu_ofbus_attach(device_t parent, device_t self, void *aux)
     42       1.1  thorpej {
     43       1.1  thorpej 	cpu_attach(self);
     44       1.1  thorpej }
     45       1.1  thorpej 
     46  1.7.10.1   cherry CFATTACH_DECL_NEW(cpu_ofbus, 0,
     47       1.4  thorpej     cpu_ofbus_match, cpu_ofbus_attach, NULL, NULL);
     48