1 /* $NetBSD: fdc_gsc.c,v 1.7 2008/03/16 00:58:56 cube Exp $ */
3 /* $OpenBSD: fdc_gsc.c,v 1.1 1998/09/30 04:45:46 mickey 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.
31 #include <sys/cdefs.h>
32 __KERNEL_RCSID(0, "$NetBSD: fdc_gsc.c,v 1.7 2008/03/16 00:58:56 cube Exp $");
34 #include <sys/param.h>
35 #include <sys/systm.h>
36 #include <sys/device.h>
38 #include <machine/iomod.h>
39 #include <machine/bus.h>
40 #include <machine/intr.h>
41 #include <machine/autoconf.h>
43 #include <dev/ic/fdreg.h>
44 #include <dev/ic/fdlink.h>
46 #include <hp700/dev/cpudevs.h>
48 /* controller driver configuration */
49 int fdc_gsc_probe(device_t
, cfdata_t
, void *);
50 void fdc_gsc_attach(device_t
, device_t
, void *);
52 CFATTACH_DECL(fdc_gsc
, sizeof(struct fdc_softc
),
53 fdc_gsc_probe
, fdc_gsc_attach
, NULL
, NULL
);
56 fdc_gsc_probe(device_t parent
, cfdata_t match
, void *aux
)
58 struct confargs
*ca
= aux
;
59 bus_space_handle_t ioh
;
62 if (ca
->ca_type
.iodc_type
!= HPPA_TYPE_FIO
||
63 ca
->ca_type
.iodc_sv_model
!= HPPA_FIO_GPCFD
)
66 /* Map the i/o space. */
67 if (bus_space_map(ca
->ca_iot
, ca
->ca_hpa
, IOMOD_HPASIZE
, 0, &ioh
))
70 rv
= fdcprobe1(ca
->ca_iot
, ioh
| IOMOD_DEVOFFSET
);
71 bus_space_unmap(ca
->ca_iot
, ioh
, IOMOD_HPASIZE
);
76 fdc_gsc_attach(device_t parent
, device_t self
, void *aux
)
78 struct fdc_softc
*sc
= device_private(self
);
79 bus_space_handle_t ioh
;
80 struct confargs
*ca
= aux
;
84 /* Re-map the I/O space. */
85 if (bus_space_map(ca
->ca_iot
, ca
->ca_hpa
, IOMOD_HPASIZE
, 0, &ioh
))
86 panic("fdcattach: couldn't map I/O ports");
88 ioh
|= IOMOD_DEVOFFSET
;
89 sc
->sc_iot
= ca
->ca_iot
;
91 sc
->sc_ioh_ctl
= ioh
+ FDCTL_OFFSET
;