Sun Dec 18 14:29:00 2011 UTC ()
Replaced conf_args by mainbus_attach_args.


(phx)
diff -r1.5 -r1.6 src/sys/arch/sandpoint/sandpoint/eumb.c
diff -r1.25 -r1.26 src/sys/arch/sandpoint/sandpoint/mainbus.c

cvs diff -r1.5 -r1.6 src/sys/arch/sandpoint/sandpoint/eumb.c (expand / switch to unified diff)

--- src/sys/arch/sandpoint/sandpoint/eumb.c 2011/07/01 19:16:06 1.5
+++ src/sys/arch/sandpoint/sandpoint/eumb.c 2011/12/18 14:28:59 1.6
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: eumb.c,v 1.5 2011/07/01 19:16:06 dyoung Exp $ */ 1/* $NetBSD: eumb.c,v 1.6 2011/12/18 14:28:59 phx Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2007 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Tohru Nishimura. 8 * by Tohru Nishimura.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -20,79 +20,81 @@ @@ -20,79 +20,81 @@
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE. 29 * POSSIBILITY OF SUCH DAMAGE.
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: eumb.c,v 1.5 2011/07/01 19:16:06 dyoung Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: eumb.c,v 1.6 2011/12/18 14:28:59 phx Exp $");
34 34
35#include <sys/param.h> 35#include <sys/param.h>
36#include <sys/device.h> 36#include <sys/device.h>
37#include <sys/tty.h> 37#include <sys/tty.h>
38#include <sys/systm.h> 38#include <sys/systm.h>
39 39
40#include <sys/bus.h> 40#include <machine/autoconf.h>
41#include <machine/intr.h> 41#include <machine/intr.h>
42 42
43#include <sandpoint/sandpoint/eumbvar.h> 43#include <sandpoint/sandpoint/eumbvar.h>
44#include "locators.h" 44#include "locators.h"
45 45
46static int eumb_match(device_t, cfdata_t, void *); 46static int eumb_match(device_t, cfdata_t, void *);
47static void eumb_attach(device_t, device_t, void *); 47static void eumb_attach(device_t, device_t, void *);
48static int eumb_print(void *, const char *); 48static int eumb_print(void *, const char *);
49static int eumb_search(device_t, cfdata_t, const int *, void *); 49static int eumb_search(device_t, cfdata_t, const int *, void *);
50 50
51CFATTACH_DECL_NEW(eumb, 0, 51CFATTACH_DECL_NEW(eumb, 0,
52 eumb_match, eumb_attach, NULL, NULL); 52 eumb_match, eumb_attach, NULL, NULL);
53 53
54extern struct cfdriver eumb_cd; 54extern struct cfdriver eumb_cd;
55 55
56static int 56static int
57eumb_match(device_t parent, cfdata_t cf, void *aux) 57eumb_match(device_t parent, cfdata_t cf, void *aux)
58{ 58{
59 const char **ca_name = aux; /* XXX */ 59 struct mainbus_attach_args *ma = aux;
60 60
61 if (strcmp(*ca_name, eumb_cd.cd_name) != 0) 61 if (strcmp(ma->ma_name, eumb_cd.cd_name) != 0)
62 return (0); 62 return 0;
63 return (1); 63 return 1;
64} 64}
65 65
66static void 66static void
67eumb_attach(device_t parent, device_t self, void *aux) 67eumb_attach(device_t parent, device_t self, void *aux)
68{ 68{
69 69
70 printf("\n"); 70 aprint_naive("\n");
71 config_search_ia(eumb_search, self, "eumb", NULL); 71 aprint_normal("\n");
 72 config_search_ia(eumb_search, self, "eumb", aux);
72} 73}
73 74
74static int 75static int
75eumb_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux) 76eumb_search(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
76{ 77{
 78 struct mainbus_attach_args *ma = aux;
77 struct eumb_attach_args eaa; 79 struct eumb_attach_args eaa;
78 80
79 eaa.eumb_name = cf->cf_name; 81 eaa.eumb_name = cf->cf_name;
80 eaa.eumb_bt = &sandpoint_eumb_space_tag; 82 eaa.eumb_bt = ma->ma_bst;
81 eaa.eumb_unit = cf->cf_loc[EUMBCF_UNIT]; 83 eaa.eumb_unit = cf->cf_loc[EUMBCF_UNIT];
82 if (config_match(parent, cf, &eaa) > 0) 84 if (config_match(parent, cf, &eaa) > 0)
83 config_attach(parent, cf, &eaa, eumb_print); 85 config_attach(parent, cf, &eaa, eumb_print);
84 86
85 return (0); 87 return 0;
86} 88}
87 89
88static int 90static int
89eumb_print(void *aux, const char *pnp) 91eumb_print(void *aux, const char *pnp)
90{ 92{
91 struct eumb_attach_args *eaa = aux; 93 struct eumb_attach_args *eaa = aux;
92 94
93 if (pnp) 95 if (pnp)
94 printf("%s at %s", eaa->eumb_name, pnp); 96 printf("%s at %s", eaa->eumb_name, pnp);
95 if (eaa->eumb_unit != EUMBCF_UNIT_DEFAULT) 97 if (eaa->eumb_unit != EUMBCF_UNIT_DEFAULT)
96 printf(" unit %d", eaa->eumb_unit); 98 printf(" unit %d", eaa->eumb_unit);
97 return (UNCONF); 99 return UNCONF;
98} 100}

cvs diff -r1.25 -r1.26 src/sys/arch/sandpoint/sandpoint/mainbus.c (expand / switch to unified diff)

--- src/sys/arch/sandpoint/sandpoint/mainbus.c 2011/12/17 20:20:38 1.25
+++ src/sys/arch/sandpoint/sandpoint/mainbus.c 2011/12/18 14:28:59 1.26
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: mainbus.c,v 1.25 2011/12/17 20:20:38 phx Exp $ */ 1/* $NetBSD: mainbus.c,v 1.26 2011/12/18 14:28:59 phx Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. 4 * Copyright (c) 1996 Christopher G. Demetriou. 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 * 3. All advertising materials mentioning features or use of this software 14 * 3. All advertising materials mentioning features or use of this software
@@ -21,87 +21,83 @@ @@ -21,87 +21,83 @@
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */ 31 */
32 32
33#include <sys/cdefs.h> 33#include <sys/cdefs.h>
34__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.25 2011/12/17 20:20:38 phx Exp $"); 34__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.26 2011/12/18 14:28:59 phx Exp $");
35 35
36#include "opt_pci.h" 36#include "opt_pci.h"
37#include "pci.h" 37#include "pci.h"
38 38
39#include <sys/param.h> 39#include <sys/param.h>
40#include <sys/extent.h> 40#include <sys/extent.h>
41#include <sys/device.h> 41#include <sys/device.h>
42#include <sys/malloc.h> 42#include <sys/malloc.h>
43#include <sys/systm.h> 43#include <sys/systm.h>
44 44
45#include <machine/autoconf.h> 45#include <machine/autoconf.h>
46#include <machine/isa_machdep.h> 46#include <machine/isa_machdep.h>
47 47
48#include <dev/pci/pcivar.h> 48#include <dev/pci/pcivar.h>
49#include <dev/pci/pciconf.h> 49#include <dev/pci/pciconf.h>
50 50
51/* XXX go away! */ 
52struct conf_args { 
53 const char *ca_name; 
54}; 
55 
56int mainbus_match(device_t, cfdata_t, void *); 51int mainbus_match(device_t, cfdata_t, void *);
57void mainbus_attach(device_t, device_t, void *); 52void mainbus_attach(device_t, device_t, void *);
58int mainbus_print(void *, const char *); 53int mainbus_print(void *, const char *);
59 54
60CFATTACH_DECL_NEW(mainbus, 0, 55CFATTACH_DECL_NEW(mainbus, 0,
61 mainbus_match, mainbus_attach, NULL, NULL); 56 mainbus_match, mainbus_attach, NULL, NULL);
62 57
63struct powerpc_isa_chipset genppc_ict; 58struct powerpc_isa_chipset genppc_ict;
64 59
65/* 60/*
66 * Probe for the mainbus; always succeeds. 61 * Probe for the mainbus; always succeeds.
67 */ 62 */
68int 63int
69mainbus_match(device_t parent, cfdata_t match, void *aux) 64mainbus_match(device_t parent, cfdata_t match, void *aux)
70{ 65{
71 66
72 return 1; 67 return 1;
73} 68}
74 69
75/* 70/*
76 * Attach the mainbus. 71 * Attach the mainbus.
77 */ 72 */
78void 73void
79mainbus_attach(device_t parent, device_t self, void *aux) 74mainbus_attach(device_t parent, device_t self, void *aux)
80{ 75{
81 struct conf_args ca; 
82 struct mainbus_attach_args mba; 76 struct mainbus_attach_args mba;
83 struct pcibus_attach_args pba; 77 struct pcibus_attach_args pba;
84#if defined(PCI_NETBSD_CONFIGURE) 78#if defined(PCI_NETBSD_CONFIGURE)
85 struct extent *ioext, *memext; 79 struct extent *ioext, *memext;
86#endif 80#endif
87 81
88 aprint_naive("\n"); 82 aprint_naive("\n");
89 aprint_normal("\n"); 83 aprint_normal("\n");
90 84
91 ca.ca_name = "cpu"; 85 mba.ma_name = "cpu";
92 config_found_ia(self, "mainbus", &ca, mainbus_print); 86 config_found_ia(self, "mainbus", &mba, mainbus_print);
93 ca.ca_name = "eumb"; 87
94 config_found_ia(self, "mainbus", &ca, mainbus_print); 88 mba.ma_name = "eumb";
 89 mba.ma_bst = &sandpoint_eumb_space_tag;
 90 config_found_ia(self, "mainbus", &mba, mainbus_print);
95 91
96 mba.ma_name = "cfi"; 92 mba.ma_name = "cfi";
97 mba.ma_bst = &sandpoint_flash_space_tag; 93 mba.ma_bst = &sandpoint_flash_space_tag;
98 mba.ma_addr = 0xffe00000; /* smallest flash is 2 MiB */ 94 mba.ma_addr = 0xffe00000; /* smallest flash is 2 MiB */
99 config_found_ia(self, "mainbus", &mba, mainbus_print); 95 config_found_ia(self, "mainbus", &mba, mainbus_print);
100 96
101 /* 97 /*
102 * XXX Note also that the presence of a PCI bus should 98 * XXX Note also that the presence of a PCI bus should
103 * XXX _always_ be checked, and if present the bus should be 99 * XXX _always_ be checked, and if present the bus should be
104 * XXX 'found'. However, because of the structure of the code, 100 * XXX 'found'. However, because of the structure of the code,
105 * XXX that's not currently possible. 101 * XXX that's not currently possible.
106 */ 102 */
107#if NPCI > 0 103#if NPCI > 0
@@ -130,39 +126,39 @@ mainbus_attach(device_t parent, device_t @@ -130,39 +126,39 @@ mainbus_attach(device_t parent, device_t
130#endif 126#endif
131} 127}
132 128
133static int cpu_match(device_t, cfdata_t, void *); 129static int cpu_match(device_t, cfdata_t, void *);
134static void cpu_attach(device_t, device_t, void *); 130static void cpu_attach(device_t, device_t, void *);
135 131
136CFATTACH_DECL_NEW(cpu, 0, cpu_match, cpu_attach, NULL, NULL); 132CFATTACH_DECL_NEW(cpu, 0, cpu_match, cpu_attach, NULL, NULL);
137 133
138extern struct cfdriver cpu_cd; 134extern struct cfdriver cpu_cd;
139 135
140int 136int
141cpu_match(device_t parent, cfdata_t cf, void *aux) 137cpu_match(device_t parent, cfdata_t cf, void *aux)
142{ 138{
143 struct conf_args *ca = aux; 139 struct mainbus_attach_args *mba = aux;
144 140
145 if (strcmp(ca->ca_name, cpu_cd.cd_name) != 0) 141 if (strcmp(mba->ma_name, cpu_cd.cd_name) != 0)
146 return 0; 142 return 0;
147 if (cpu_info[0].ci_dev != NULL) 143 if (cpu_info[0].ci_dev != NULL)
148 return 0; 144 return 0;
149 145
150 return 1; 146 return 1;
151} 147}
152 148
153void 149void
154cpu_attach(device_t parent, device_t self, void *aux) 150cpu_attach(device_t parent, device_t self, void *aux)
155{ 151{
156 152
157 (void) cpu_attach_common(self, 0); 153 (void)cpu_attach_common(self, 0);
158} 154}
159 155
160int 156int
161mainbus_print(void *aux, const char *pnp) 157mainbus_print(void *aux, const char *pnp)
162{ 158{
163 struct conf_args *ca = aux; 159 struct mainbus_attach_args *mba = aux;
164 160
165 if (pnp) 161 if (pnp)
166 aprint_normal("%s at %s", ca->ca_name, pnp); 162 aprint_normal("%s at %s", mba->ma_name, pnp);
167 return (UNCONF); 163 return UNCONF;
168} 164}