Thu Oct 1 15:21:38 2009 UTC ()
children of mainbus, attach (well, one child, iff it happens to be around)


(pooka)
diff -r1.2 -r1.3 src/sys/rump/librump/rumpdev/autoconf.c

cvs diff -r1.2 -r1.3 src/sys/rump/librump/rumpdev/Attic/autoconf.c (expand / switch to unified diff)

--- src/sys/rump/librump/rumpdev/Attic/autoconf.c 2009/09/20 23:16:09 1.2
+++ src/sys/rump/librump/rumpdev/Attic/autoconf.c 2009/10/01 15:21:38 1.3
@@ -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
35int mainbus_match(struct device *, struct cfdata *, void *); 35static int mainbus_match(struct device *, struct cfdata *, void *);
36void mainbus_attach(struct device *, struct device *, void *); 36static void mainbus_attach(struct device *, struct device *, void *);
 37static int mainbus_search(struct device *, struct cfdata *,
 38 const int *, void *);
37 39
38struct mainbus_softc { 40struct mainbus_softc {
39 int mb_nada; 41 int mb_nada;
40}; 42};
41 43
42CFDRIVER_DECL(mainbus, DV_DULL, NULL); 44static const struct cfiattrdata mainbus_iattrdata = {
 45 "mainbus", 0, {
 46 { NULL, NULL, 0 },
 47 }
 48};
 49static const struct cfiattrdata * const mainbus_attrs[] = {
 50 &mainbus_iattrdata,
 51 NULL,
 52};
 53
 54CFDRIVER_DECL(mainbus, DV_DULL, mainbus_attrs);
43CFATTACH_DECL_NEW(mainbus, sizeof(struct mainbus_softc), 55CFATTACH_DECL_NEW(mainbus, sizeof(struct mainbus_softc),
44 mainbus_match, mainbus_attach, NULL, NULL); 56 mainbus_match, mainbus_attach, NULL, NULL);
45 57
46struct cfdriver * const cfdriver_list_initial[] = { 58struct cfdriver * const cfdriver_list_initial[] = {
47 &mainbus_cd, 59 &mainbus_cd,
48 NULL 60 NULL
49}; 61};
50 62
51static struct cfattach * const mainbus_cfattachinit[] = { 63static struct cfattach * const mainbus_cfattachinit[] = {
52 &mainbus_ca, NULL 64 &mainbus_ca, NULL
53}; 65};
54const struct cfattachinit cfattachinit[] = { 66const 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
97int 109int
98mainbus_match(struct device *parent, struct cfdata *match, void *aux) 110mainbus_match(struct device *parent, struct cfdata *match, void *aux)
99{ 111{
100 112
101 return 1; 113 return 1;
102} 114}
103 115
104void 116void
105mainbus_attach(struct device *parent, struct device *self, void *aux) 117mainbus_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
 124static int
 125mainbus_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}