cpu_ofbus.c revision 1.1 1 1.1 thorpej /* $NetBSD: cpu_ofbus.c,v 1.1 2002/02/10 07:07:08 thorpej Exp $ */
2 1.1 thorpej
3 1.1 thorpej #include <sys/param.h>
4 1.1 thorpej #include <sys/systm.h>
5 1.1 thorpej #include <sys/device.h>
6 1.1 thorpej
7 1.1 thorpej #include <machine/cpu.h>
8 1.1 thorpej
9 1.1 thorpej #include <dev/ofw/openfirm.h>
10 1.1 thorpej
11 1.1 thorpej /*
12 1.1 thorpej * int cpu_ofbus_match(struct device *parent, struct cfdata *cf, void *aux)
13 1.1 thorpej *
14 1.1 thorpej * Probe for the main cpu. Currently all this does is return 1 to
15 1.1 thorpej * indicate that the cpu was found.
16 1.1 thorpej */
17 1.1 thorpej
18 1.1 thorpej static int
19 1.1 thorpej cpu_ofbus_match(parent, cf, aux)
20 1.1 thorpej struct device *parent;
21 1.1 thorpej struct cfdata *cf;
22 1.1 thorpej 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.1 thorpej cpu_ofbus_attach(parent, self, aux)
42 1.1 thorpej struct device *parent;
43 1.1 thorpej struct device *self;
44 1.1 thorpej void *aux;
45 1.1 thorpej {
46 1.1 thorpej cpu_attach(self);
47 1.1 thorpej }
48 1.1 thorpej
49 1.1 thorpej struct cfattach cpu_ofbus_ca = {
50 1.1 thorpej sizeof(struct device), cpu_ofbus_match, cpu_ofbus_attach
51 1.1 thorpej };
52