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