Annotation of sys/arch/hppa/gsc/fdc_gsc.c, Revision 1.1
1.1 ! nbrk 1: /* $OpenBSD: fdc_gsc.c,v 1.5 2004/04/07 18:24:19 mickey Exp $ */
! 2:
! 3: /*
! 4: * Copyright (c) 1998 Michael Shalayeff
! 5: * All rights reserved.
! 6: *
! 7: * Redistribution and use in source and binary forms, with or without
! 8: * modification, are permitted provided that the following conditions
! 9: * are met:
! 10: * 1. Redistributions of source code must retain the above copyright
! 11: * notice, this list of conditions and the following disclaimer.
! 12: * 2. Redistributions in binary form must reproduce the above copyright
! 13: * notice, this list of conditions and the following disclaimer in the
! 14: * documentation and/or other materials provided with the distribution.
! 15: *
! 16: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
! 17: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
! 18: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
! 19: * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
! 20: * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
! 21: * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
! 22: * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
! 23: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
! 24: * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
! 25: * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
! 26: * THE POSSIBILITY OF SUCH DAMAGE.
! 27: */
! 28:
! 29:
! 30: #include <sys/param.h>
! 31: #include <sys/systm.h>
! 32: #include <sys/device.h>
! 33:
! 34: #include <machine/iomod.h>
! 35: #include <machine/bus.h>
! 36: #include <machine/intr.h>
! 37: #include <machine/autoconf.h>
! 38:
! 39: #include <dev/ic/fdreg.h>
! 40: #include <dev/ic/fdlink.h>
! 41:
! 42: #include <hppa/dev/cpudevs.h>
! 43:
! 44: /* controller driver configuration */
! 45: int fdc_gsc_probe(struct device *, void *, void *);
! 46: void fdc_gsc_attach(struct device *, struct device *, void *);
! 47:
! 48: struct cfattach fdc_gsc_ca = {
! 49: sizeof(struct fdc_softc), fdc_gsc_probe, fdc_gsc_attach
! 50: };
! 51:
! 52: int
! 53: fdc_gsc_probe(parent, match, aux)
! 54: struct device *parent;
! 55: void *match, *aux;
! 56: {
! 57: struct confargs *ca = aux;
! 58: bus_space_handle_t ioh;
! 59: int rv;
! 60:
! 61: if (ca->ca_type.iodc_type != HPPA_TYPE_FIO ||
! 62: ca->ca_type.iodc_sv_model != HPPA_FIO_GPCFD)
! 63: return 0;
! 64:
! 65: /* Map the I/O space. */
! 66: if (bus_space_map(ca->ca_iot, ca->ca_hpa, IOMOD_HPASIZE, 0, &ioh))
! 67: return 0;
! 68:
! 69: rv = fdcprobe1(ca->ca_iot, ioh | IOMOD_DEVOFFSET);
! 70: bus_space_unmap(ca->ca_iot, ioh, IOMOD_HPASIZE);
! 71: return rv;
! 72: }
! 73:
! 74: void
! 75: fdc_gsc_attach(parent, self, aux)
! 76: struct device *parent, *self;
! 77: void *aux;
! 78: {
! 79: struct fdc_softc *sc = (void *)self;
! 80: bus_space_handle_t ioh;
! 81: struct confargs *ca = aux;
! 82:
! 83: /* Re-map the I/O space. */
! 84: if (bus_space_map(ca->ca_iot, ca->ca_hpa, IOMOD_HPASIZE, 0, &ioh))
! 85: panic("fdcattach: couldn't map I/O ports");
! 86:
! 87: ioh |= IOMOD_DEVOFFSET;
! 88: sc->sc_iot = ca->ca_iot;
! 89: sc->sc_ioh = ioh;
! 90: sc->sc_ioh_ctl = ioh + FDCTL_OFFSET;
! 91:
! 92: fdc_attach_subr(sc);
! 93: }
! 94:
! 95:
CVSweb