cpu_ofbus.c revision 1.6.88.1 1 /* $NetBSD: cpu_ofbus.c,v 1.6.88.1 2009/04/28 07:34:40 skrll Exp $ */
2
3 #include <sys/cdefs.h>
4 __KERNEL_RCSID(0, "$NetBSD: cpu_ofbus.c,v 1.6.88.1 2009/04/28 07:34:40 skrll 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(struct device *parent, struct cfdata *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(struct device *parent, struct device *dev, void *aux)
36 *
37 * Attach the main cpu
38 */
39
40 static void
41 cpu_ofbus_attach(struct device *parent, struct device *self, void *aux)
42 {
43 cpu_attach(self);
44 }
45
46 CFATTACH_DECL(cpu_ofbus, sizeof(struct device),
47 cpu_ofbus_match, cpu_ofbus_attach, NULL, NULL);
48