cpu_ofbus.c revision 1.1.2.2 1 1.1.2.2 nathanw /* $NetBSD: cpu_ofbus.c,v 1.1.2.2 2002/02/28 04:11:54 nathanw Exp $ */
2 1.1.2.2 nathanw
3 1.1.2.2 nathanw #include <sys/param.h>
4 1.1.2.2 nathanw #include <sys/systm.h>
5 1.1.2.2 nathanw #include <sys/device.h>
6 1.1.2.2 nathanw
7 1.1.2.2 nathanw #include <machine/cpu.h>
8 1.1.2.2 nathanw
9 1.1.2.2 nathanw #include <dev/ofw/openfirm.h>
10 1.1.2.2 nathanw
11 1.1.2.2 nathanw /*
12 1.1.2.2 nathanw * int cpu_ofbus_match(struct device *parent, struct cfdata *cf, void *aux)
13 1.1.2.2 nathanw *
14 1.1.2.2 nathanw * Probe for the main cpu. Currently all this does is return 1 to
15 1.1.2.2 nathanw * indicate that the cpu was found.
16 1.1.2.2 nathanw */
17 1.1.2.2 nathanw
18 1.1.2.2 nathanw static int
19 1.1.2.2 nathanw cpu_ofbus_match(parent, cf, aux)
20 1.1.2.2 nathanw struct device *parent;
21 1.1.2.2 nathanw struct cfdata *cf;
22 1.1.2.2 nathanw void *aux;
23 1.1.2.2 nathanw {
24 1.1.2.2 nathanw struct ofbus_attach_args *aa = aux;
25 1.1.2.2 nathanw char buf[32];
26 1.1.2.2 nathanw
27 1.1.2.2 nathanw if (OF_getprop(aa->oba_phandle, "device_type", buf, sizeof(buf)) < 0)
28 1.1.2.2 nathanw return (0);
29 1.1.2.2 nathanw if (strcmp("cpu", buf))
30 1.1.2.2 nathanw return (0);
31 1.1.2.2 nathanw return(1);
32 1.1.2.2 nathanw }
33 1.1.2.2 nathanw
34 1.1.2.2 nathanw /*
35 1.1.2.2 nathanw * void cpu_ofbus_attach(struct device *parent, struct device *dev, void *aux)
36 1.1.2.2 nathanw *
37 1.1.2.2 nathanw * Attach the main cpu
38 1.1.2.2 nathanw */
39 1.1.2.2 nathanw
40 1.1.2.2 nathanw static void
41 1.1.2.2 nathanw cpu_ofbus_attach(parent, self, aux)
42 1.1.2.2 nathanw struct device *parent;
43 1.1.2.2 nathanw struct device *self;
44 1.1.2.2 nathanw void *aux;
45 1.1.2.2 nathanw {
46 1.1.2.2 nathanw cpu_attach(self);
47 1.1.2.2 nathanw }
48 1.1.2.2 nathanw
49 1.1.2.2 nathanw struct cfattach cpu_ofbus_ca = {
50 1.1.2.2 nathanw sizeof(struct device), cpu_ofbus_match, cpu_ofbus_attach
51 1.1.2.2 nathanw };
52