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