| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: autoconf.c,v 1.2 2009/09/20 23:16:09 pooka Exp $ */ | | 1 | /* $NetBSD: autoconf.c,v 1.3 2009/10/01 15:21:38 pooka Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2009 Antti Kantee. All Rights Reserved. | | 4 | * Copyright (c) 2009 Antti Kantee. All Rights Reserved. |
5 | * | | 5 | * |
6 | * Redistribution and use in source and binary forms, with or without | | 6 | * Redistribution and use in source and binary forms, with or without |
7 | * modification, are permitted provided that the following conditions | | 7 | * modification, are permitted provided that the following conditions |
8 | * are met: | | 8 | * are met: |
9 | * 1. Redistributions of source code must retain the above copyright | | 9 | * 1. Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. | | 10 | * notice, this list of conditions and the following disclaimer. |
11 | * 2. Redistributions in binary form must reproduce the above copyright | | 11 | * 2. Redistributions in binary form must reproduce the above copyright |
12 | * notice, this list of conditions and the following disclaimer in the | | 12 | * notice, this list of conditions and the following disclaimer in the |
13 | * documentation and/or other materials provided with the distribution. | | 13 | * documentation and/or other materials provided with the distribution. |
14 | * | | 14 | * |
| @@ -16,40 +16,52 @@ | | | @@ -16,40 +16,52 @@ |
16 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | | 16 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | | 17 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
18 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | | 18 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
19 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 19 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
20 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | | 20 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
21 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 21 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
22 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 22 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
23 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 23 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
24 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 24 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
25 | * SUCH DAMAGE. | | 25 | * SUCH DAMAGE. |
26 | */ | | 26 | */ |
27 | | | 27 | |
28 | #include <sys/cdefs.h> | | 28 | #include <sys/cdefs.h> |
29 | __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.2 2009/09/20 23:16:09 pooka Exp $"); | | 29 | __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.3 2009/10/01 15:21:38 pooka Exp $"); |
30 | | | 30 | |
31 | #include <sys/param.h> | | 31 | #include <sys/param.h> |
32 | #include <sys/device.h> | | 32 | #include <sys/device.h> |
33 | #include <sys/kernel.h> | | 33 | #include <sys/kernel.h> |
34 | | | 34 | |
35 | int mainbus_match(struct device *, struct cfdata *, void *); | | 35 | static int mainbus_match(struct device *, struct cfdata *, void *); |
36 | void mainbus_attach(struct device *, struct device *, void *); | | 36 | static void mainbus_attach(struct device *, struct device *, void *); |
| | | 37 | static int mainbus_search(struct device *, struct cfdata *, |
| | | 38 | const int *, void *); |
37 | | | 39 | |
38 | struct mainbus_softc { | | 40 | struct mainbus_softc { |
39 | int mb_nada; | | 41 | int mb_nada; |
40 | }; | | 42 | }; |
41 | | | 43 | |
42 | CFDRIVER_DECL(mainbus, DV_DULL, NULL); | | 44 | static const struct cfiattrdata mainbus_iattrdata = { |
| | | 45 | "mainbus", 0, { |
| | | 46 | { NULL, NULL, 0 }, |
| | | 47 | } |
| | | 48 | }; |
| | | 49 | static const struct cfiattrdata * const mainbus_attrs[] = { |
| | | 50 | &mainbus_iattrdata, |
| | | 51 | NULL, |
| | | 52 | }; |
| | | 53 | |
| | | 54 | CFDRIVER_DECL(mainbus, DV_DULL, mainbus_attrs); |
43 | CFATTACH_DECL_NEW(mainbus, sizeof(struct mainbus_softc), | | 55 | CFATTACH_DECL_NEW(mainbus, sizeof(struct mainbus_softc), |
44 | mainbus_match, mainbus_attach, NULL, NULL); | | 56 | mainbus_match, mainbus_attach, NULL, NULL); |
45 | | | 57 | |
46 | struct cfdriver * const cfdriver_list_initial[] = { | | 58 | struct cfdriver * const cfdriver_list_initial[] = { |
47 | &mainbus_cd, | | 59 | &mainbus_cd, |
48 | NULL | | 60 | NULL |
49 | }; | | 61 | }; |
50 | | | 62 | |
51 | static struct cfattach * const mainbus_cfattachinit[] = { | | 63 | static struct cfattach * const mainbus_cfattachinit[] = { |
52 | &mainbus_ca, NULL | | 64 | &mainbus_ca, NULL |
53 | }; | | 65 | }; |
54 | const struct cfattachinit cfattachinit[] = { | | 66 | const struct cfattachinit cfattachinit[] = { |
55 | { "mainbus", mainbus_cfattachinit }, | | 67 | { "mainbus", mainbus_cfattachinit }, |
| @@ -96,14 +108,26 @@ rump_pdev_finalize() | | | @@ -96,14 +108,26 @@ rump_pdev_finalize() |
96 | | | 108 | |
97 | int | | 109 | int |
98 | mainbus_match(struct device *parent, struct cfdata *match, void *aux) | | 110 | mainbus_match(struct device *parent, struct cfdata *match, void *aux) |
99 | { | | 111 | { |
100 | | | 112 | |
101 | return 1; | | 113 | return 1; |
102 | } | | 114 | } |
103 | | | 115 | |
104 | void | | 116 | void |
105 | mainbus_attach(struct device *parent, struct device *self, void *aux) | | 117 | mainbus_attach(struct device *parent, struct device *self, void *aux) |
106 | { | | 118 | { |
107 | | | 119 | |
108 | aprint_normal("\n"); | | 120 | aprint_normal("\n"); |
| | | 121 | config_search_ia(mainbus_search, self, "mainbus", NULL); |
| | | 122 | } |
| | | 123 | |
| | | 124 | static int |
| | | 125 | mainbus_search(struct device *parent, struct cfdata *cf, |
| | | 126 | const int *ldesc, void *aux) |
| | | 127 | { |
| | | 128 | |
| | | 129 | if (config_match(parent, cf, NULL) > 0) |
| | | 130 | config_attach(parent, cf, NULL, NULL); |
| | | 131 | |
| | | 132 | return 0; |
109 | } | | 133 | } |