Annotation of sys/arch/hppa/gsc/hil_gsc.c, Revision 1.1
1.1 ! nbrk 1: /* $OpenBSD: hil_gsc.c,v 1.5 2005/12/22 07:09:52 miod Exp $ */
! 2: /*
! 3: * Copyright (c) 2003, Miodrag Vallat.
! 4: * All rights reserved.
! 5: *
! 6: * Redistribution and use in source and binary forms, with or without
! 7: * modification, are permitted provided that the following conditions
! 8: * are met:
! 9: * 1. Redistributions of source code must retain the above copyright
! 10: * notice, this list of conditions and the following disclaimer.
! 11: * 2. Redistributions in binary form must reproduce the above copyright
! 12: * notice, this list of conditions and the following disclaimer in the
! 13: * documentation and/or other materials provided with the distribution.
! 14: *
! 15: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
! 16: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
! 17: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
! 18: * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
! 19: * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
! 20: * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
! 21: * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
! 22: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
! 23: * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
! 24: * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! 25: * POSSIBILITY OF SUCH DAMAGE.
! 26: *
! 27: */
! 28:
! 29: #include <sys/param.h>
! 30: #include <sys/systm.h>
! 31: #include <sys/device.h>
! 32:
! 33: #include <machine/cpu.h>
! 34: #include <machine/intr.h>
! 35: #include <machine/iomod.h>
! 36: #include <machine/autoconf.h>
! 37: #include <machine/bus.h>
! 38:
! 39: #include <hppa/dev/cpudevs.h>
! 40: #include <hppa/gsc/gscbusvar.h>
! 41:
! 42: #include <machine/hil_machdep.h>
! 43:
! 44: #include <dev/hil/hilvar.h>
! 45:
! 46: int hil_gsc_match(struct device *, void *, void *);
! 47: void hil_gsc_attach(struct device *, struct device *, void *);
! 48:
! 49: struct hil_gsc_softc {
! 50: struct hil_softc sc_hs;
! 51: int sc_hil_console;
! 52: };
! 53:
! 54: struct cfattach hil_gsc_ca = {
! 55: sizeof(struct hil_gsc_softc), hil_gsc_match, hil_gsc_attach
! 56: };
! 57:
! 58: int
! 59: hil_gsc_match(struct device *parent, void *match, void *aux)
! 60: {
! 61: struct gsc_attach_args *ga = aux;
! 62:
! 63: if (ga->ga_type.iodc_type != HPPA_TYPE_FIO ||
! 64: ga->ga_type.iodc_sv_model != HPPA_FIO_HIL)
! 65: return (0);
! 66:
! 67: return (1);
! 68: }
! 69:
! 70: void
! 71: hil_gsc_attach(struct device *parent, struct device *self, void *aux)
! 72: {
! 73: struct hil_gsc_softc *gsc = (void *)self;
! 74: struct hil_softc *sc = &gsc->sc_hs;
! 75: struct gsc_attach_args *ga = aux;
! 76:
! 77: sc->sc_bst = ga->ga_iot;
! 78: if (bus_space_map(ga->ga_iot, ga->ga_hpa,
! 79: HILMAPSIZE, 0, &sc->sc_bsh)) {
! 80: printf(": couldn't map hil controller\n");
! 81: return;
! 82: }
! 83:
! 84: gsc->sc_hil_console = ga->ga_dp.dp_mod == PAGE0->mem_kbd.pz_dp.dp_mod &&
! 85: bcmp(ga->ga_dp.dp_bc, PAGE0->mem_kbd.pz_dp.dp_bc, 6) == 0;
! 86:
! 87: hil_attach(sc, &gsc->sc_hil_console);
! 88:
! 89: gsc_intr_establish((struct gsc_softc *)parent, ga->ga_irq, IPL_TTY,
! 90: hil_intr, sc, sc->sc_dev.dv_xname);
! 91:
! 92: startuphook_establish(hil_attach_deferred, sc);
! 93: }
CVSweb