Sat Aug 8 14:18:51 2009 UTC ()
Use device_xname.


(skrll)
diff -r1.15 -r1.16 src/sys/arch/hp700/gsc/gscbus.c

cvs diff -r1.15 -r1.16 src/sys/arch/hp700/gsc/Attic/gscbus.c (switch to unified diff)

--- src/sys/arch/hp700/gsc/Attic/gscbus.c 2009/05/07 15:34:49 1.15
+++ src/sys/arch/hp700/gsc/Attic/gscbus.c 2009/08/08 14:18:51 1.16
@@ -1,170 +1,170 @@ @@ -1,170 +1,170 @@
1/* $NetBSD: gscbus.c,v 1.15 2009/05/07 15:34:49 skrll Exp $ */ 1/* $NetBSD: gscbus.c,v 1.16 2009/08/08 14:18:51 skrll Exp $ */
2 2
3/* $OpenBSD: gscbus.c,v 1.13 2001/08/01 20:32:04 miod Exp $ */ 3/* $OpenBSD: gscbus.c,v 1.13 2001/08/01 20:32:04 miod Exp $ */
4 4
5/* 5/*
6 * Copyright (c) 1998 Michael Shalayeff 6 * Copyright (c) 1998 Michael Shalayeff
7 * All rights reserved. 7 * All rights reserved.
8 * 8 *
9 * Redistribution and use in source and binary forms, with or without 9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions 10 * modification, are permitted provided that the following conditions
11 * are met: 11 * are met:
12 * 1. Redistributions of source code must retain the above copyright 12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer. 13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright 14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the 15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution. 16 * documentation and/or other materials provided with the distribution.
17 * 3. All advertising materials mentioning features or use of this software 17 * 3. All advertising materials mentioning features or use of this software
18 * must display the following acknowledgement: 18 * must display the following acknowledgement:
19 * This product includes software developed by Michael Shalayeff. 19 * This product includes software developed by Michael Shalayeff.
20 * 4. The name of the author may not be used to endorse or promote products 20 * 4. The name of the author may not be used to endorse or promote products
21 * derived from this software without specific prior written permission. 21 * derived from this software without specific prior written permission.
22 * 22 *
23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 25 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 26 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
28 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */ 33 */
34 34
35/* 35/*
36 * Sample IO layouts: 36 * Sample IO layouts:
37 * 712: 37 * 712:
38 * 38 *
39 * f0100000 -- lasi0 39 * f0100000 -- lasi0
40 * f0102000 -- lpt0 40 * f0102000 -- lpt0
41 * f0104000 -- audio0 41 * f0104000 -- audio0
42 * f0105000 -- com0 42 * f0105000 -- com0
43 * f0106000 -- siop0 43 * f0106000 -- siop0
44 * f0107000 -- ie0 44 * f0107000 -- ie0
45 * f0108000 -- kbd0 45 * f0108000 -- kbd0
46 * f0108100 -- pms0 46 * f0108100 -- pms0
47 * f010a000 -- fdc0 47 * f010a000 -- fdc0
48 * f010c000 -- *lasi0 48 * f010c000 -- *lasi0
49 * f0200000 -- wax0 49 * f0200000 -- wax0
50 * f8000000 -- sti0 50 * f8000000 -- sti0
51 * fffbe000 -- cpu0 51 * fffbe000 -- cpu0
52 * fffbf000 -- mem0 52 * fffbf000 -- mem0
53 * 53 *
54 * 725/50: 54 * 725/50:
55 * 55 *
56 * f0820000 -- dma 56 * f0820000 -- dma
57 * f0821000 -- hil 57 * f0821000 -- hil
58 * f0822000 -- com1 58 * f0822000 -- com1
59 * f0823000 -- com0 59 * f0823000 -- com0
60 * f0824000 -- lpt0 60 * f0824000 -- lpt0
61 * f0825000 -- siop0 61 * f0825000 -- siop0
62 * f0826000 -- ie0 62 * f0826000 -- ie0
63 * f0827000 -- dma reset 63 * f0827000 -- dma reset
64 * f0828000 -- timers 64 * f0828000 -- timers
65 * f0829000 -- domain kbd 65 * f0829000 -- domain kbd
66 * f082f000 -- asp0 66 * f082f000 -- asp0
67 * f1000000 -- audio0 67 * f1000000 -- audio0
68 * fc000000 -- eisa0 68 * fc000000 -- eisa0
69 * fffbe000 -- cpu0 69 * fffbe000 -- cpu0
70 * fffbf000 -- mem0 70 * fffbf000 -- mem0
71 * 71 *
72 */ 72 */
73 73
74#include <sys/cdefs.h> 74#include <sys/cdefs.h>
75__KERNEL_RCSID(0, "$NetBSD: gscbus.c,v 1.15 2009/05/07 15:34:49 skrll Exp $"); 75__KERNEL_RCSID(0, "$NetBSD: gscbus.c,v 1.16 2009/08/08 14:18:51 skrll Exp $");
76 76
77#define GSCDEBUG 77#define GSCDEBUG
78 78
79#include "opt_kgdb.h" 79#include "opt_kgdb.h"
80 80
81#include <sys/param.h> 81#include <sys/param.h>
82#include <sys/systm.h> 82#include <sys/systm.h>
83#include <sys/device.h> 83#include <sys/device.h>
84#include <sys/malloc.h> 84#include <sys/malloc.h>
85#include <sys/user.h> 85#include <sys/user.h>
86#include <sys/mbuf.h> 86#include <sys/mbuf.h>
87#include <sys/reboot.h> 87#include <sys/reboot.h>
88 88
89#include <machine/iomod.h> 89#include <machine/iomod.h>
90#include <machine/autoconf.h> 90#include <machine/autoconf.h>
91#include <machine/cpufunc.h> 91#include <machine/cpufunc.h>
92 92
93#include <hp700/gsc/gscbusvar.h> 93#include <hp700/gsc/gscbusvar.h>
94#include <hp700/hp700/machdep.h> 94#include <hp700/hp700/machdep.h>
95 95
96int gscmatch(device_t, cfdata_t, void *); 96int gscmatch(device_t, cfdata_t, void *);
97void gscattach(device_t, device_t, void *); 97void gscattach(device_t, device_t, void *);
98 98
99struct gsc_softc { 99struct gsc_softc {
100 device_t sc_dev; 100 device_t sc_dev;
101 struct gsc_attach_args sc_ga; 101 struct gsc_attach_args sc_ga;
102 void *sc_ih; 102 void *sc_ih;
103}; 103};
104 104
105CFATTACH_DECL_NEW(gsc, sizeof(struct gsc_softc), 105CFATTACH_DECL_NEW(gsc, sizeof(struct gsc_softc),
106 gscmatch, gscattach, NULL, NULL); 106 gscmatch, gscattach, NULL, NULL);
107 107
108/* 108/*
109 * pdc_scanbus calls this function back with each module 109 * pdc_scanbus calls this function back with each module
110 * it finds on the GSC bus. We call the IC-specific function 110 * it finds on the GSC bus. We call the IC-specific function
111 * to fix up the module's attach arguments, then we match 111 * to fix up the module's attach arguments, then we match
112 * and attach it. 112 * and attach it.
113 */ 113 */
114static void gsc_module_callback(device_t, struct confargs *); 114static void gsc_module_callback(device_t, struct confargs *);
115static void 115static void
116gsc_module_callback(device_t self, struct confargs *ca) 116gsc_module_callback(device_t self, struct confargs *ca)
117{ 117{
118 struct gsc_softc *sc = device_private(self); 118 struct gsc_softc *sc = device_private(self);
119 struct gsc_attach_args ga; 119 struct gsc_attach_args ga;
120 120
121 /* Make the GSC attach args. */ 121 /* Make the GSC attach args. */
122 ga = sc->sc_ga; 122 ga = sc->sc_ga;
123 ga.ga_ca = *ca; 123 ga.ga_ca = *ca;
124 ga.ga_iot = sc->sc_ga.ga_iot; 124 ga.ga_iot = sc->sc_ga.ga_iot;
125 ga.ga_dmatag = sc->sc_ga.ga_dmatag; 125 ga.ga_dmatag = sc->sc_ga.ga_dmatag;
126 (*sc->sc_ga.ga_fix_args)(sc->sc_ga.ga_fix_args_cookie, &ga); 126 (*sc->sc_ga.ga_fix_args)(sc->sc_ga.ga_fix_args_cookie, &ga);
127 127
128 config_found_sm_loc(self, "gsc", NULL, &ga, mbprint, mbsubmatch); 128 config_found_sm_loc(self, "gsc", NULL, &ga, mbprint, mbsubmatch);
129} 129}
130 130
131int 131int
132gscmatch(device_t parent, cfdata_t cf, void *aux) 132gscmatch(device_t parent, cfdata_t cf, void *aux)
133{ 133{
134 struct gsc_attach_args *ga = aux; 134 struct gsc_attach_args *ga = aux;
135 135
136 return !strcmp(ga->ga_name, "gsc"); 136 return !strcmp(ga->ga_name, "gsc");
137} 137}
138 138
139void 139void
140gscattach(device_t parent, device_t self, void *aux) 140gscattach(device_t parent, device_t self, void *aux)
141{ 141{
142 struct gsc_softc *sc = device_private(self); 142 struct gsc_softc *sc = device_private(self);
143 struct gsc_attach_args *ga = aux; 143 struct gsc_attach_args *ga = aux;
144 144
145 sc->sc_dev = self; 145 sc->sc_dev = self;
146 sc->sc_ga = *ga; 146 sc->sc_ga = *ga;
147 147
148#ifdef USELEDS 148#ifdef USELEDS
149 if (machine_ledaddr) 149 if (machine_ledaddr)
150 aprint_normal(": %sleds", machine_ledword? "word" : ""); 150 aprint_normal(": %sleds", machine_ledword? "word" : "");
151#endif 151#endif
152 152
153 aprint_normal("\n"); 153 aprint_normal("\n");
154 154
155 /* Add the I/O subsystem's interrupt register. */ 155 /* Add the I/O subsystem's interrupt register. */
156 ga->ga_int_reg->int_reg_dev = parent->dv_xname; 156 ga->ga_int_reg->int_reg_dev = device_xname(parent);
157 sc->sc_ih = hp700_intr_establish(sc->sc_dev, IPL_NONE, NULL, 157 sc->sc_ih = hp700_intr_establish(sc->sc_dev, IPL_NONE, NULL,
158 ga->ga_int_reg, &int_reg_cpu, ga->ga_irq); 158 ga->ga_int_reg, &int_reg_cpu, ga->ga_irq);
159 159
160 ga->ga_ca.ca_nmodules = MAXMODBUS; 160 ga->ga_ca.ca_nmodules = MAXMODBUS;
161 ga->ga_ca.ca_hpabase = 0; 161 ga->ga_ca.ca_hpabase = 0;
162 pdc_scanbus(self, &ga->ga_ca, gsc_module_callback); 162 pdc_scanbus(self, &ga->ga_ca, gsc_module_callback);
163} 163}
164 164
165int 165int
166gscprint(void *aux, const char *pnp) 166gscprint(void *aux, const char *pnp)
167{ 167{
168 168
169 return (UNCONF); 169 return (UNCONF);
170} 170}