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 $ */
6 * Copyright (c) 1998 Michael Shalayeff
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
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.
59 * f0827000 -- dma reset
61 * f0829000 -- domain kbd
70 #include <sys/cdefs.h>
71 __KERNEL_RCSID(0, "$NetBSD: gscbus.c,v 1.18 2009/11/03 05:07:25 snj Exp $");
77 #include <sys/param.h>
78 #include <sys/systm.h>
79 #include <sys/device.h>
80 #include <sys/malloc.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 *);
96 struct gsc_attach_args sc_ga
;
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
109 static void gsc_module_callback(device_t
, struct confargs
*);
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. */
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");
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
;
145 aprint_normal(": %sleds", machine_ledword
? "word" : "");
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
)