Annotation of sys/arch/luna88k/dev/sio.c, Revision 1.1
1.1 ! nbrk 1: /* $OpenBSD: sio.c,v 1.3 2006/05/08 14:36:08 miod Exp $ */
! 2: /* $NetBSD: sio.c,v 1.1 2000/01/05 08:48:55 nisimura Exp $ */
! 3:
! 4: /*-
! 5: * Copyright (c) 2000 The NetBSD Foundation, Inc.
! 6: * All rights reserved.
! 7: *
! 8: * This code is derived from software contributed to The NetBSD Foundation
! 9: * by Tohru Nishimura.
! 10: *
! 11: * Redistribution and use in source and binary forms, with or without
! 12: * modification, are permitted provided that the following conditions
! 13: * are met:
! 14: * 1. Redistributions of source code must retain the above copyright
! 15: * notice, this list of conditions and the following disclaimer.
! 16: * 2. Redistributions in binary form must reproduce the above copyright
! 17: * notice, this list of conditions and the following disclaimer in the
! 18: * documentation and/or other materials provided with the distribution.
! 19: * 3. All advertising materials mentioning features or use of this software
! 20: * must display the following acknowledgement:
! 21: * This product includes software developed by the NetBSD
! 22: * Foundation, Inc. and its contributors.
! 23: * 4. Neither the name of The NetBSD Foundation nor the names of its
! 24: * contributors may be used to endorse or promote products derived
! 25: * from this software without specific prior written permission.
! 26: *
! 27: * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
! 28: * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
! 29: * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
! 30: * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
! 31: * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
! 32: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
! 33: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
! 34: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
! 35: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
! 36: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
! 37: * POSSIBILITY OF SUCH DAMAGE.
! 38: */
! 39:
! 40: /* from NetBSD/luna68k dev/sio.c */
! 41:
! 42: #include <sys/param.h>
! 43: #include <sys/systm.h>
! 44: #include <sys/device.h>
! 45:
! 46: #include <machine/cpu.h>
! 47: #include <machine/autoconf.h>
! 48:
! 49: #include <luna88k/luna88k/isr.h>
! 50: #include <luna88k/dev/siovar.h>
! 51:
! 52: int sio_match(struct device *, void *, void *);
! 53: void sio_attach(struct device *, struct device *, void *);
! 54: int sio_print(void *, const char *);
! 55:
! 56: const struct cfattach sio_ca = {
! 57: sizeof(struct sio_softc), sio_match, sio_attach
! 58: };
! 59:
! 60: struct cfdriver sio_cd = {
! 61: NULL, "sio", DV_DULL, 0
! 62: };
! 63:
! 64: void nullintr(int);
! 65: int xsiointr(void *);
! 66:
! 67: int
! 68: sio_match(parent, cf, aux)
! 69: struct device *parent;
! 70: void *cf, *aux;
! 71: {
! 72: struct mainbus_attach_args *ma = aux;
! 73:
! 74: if (strcmp(ma->ma_name, sio_cd.cd_name))
! 75: return 0;
! 76: if (badaddr((vaddr_t)ma->ma_addr, 4))
! 77: return 0;
! 78: return 1;
! 79: }
! 80:
! 81: void
! 82: sio_attach(parent, self, aux)
! 83: struct device *parent, *self;
! 84: void *aux;
! 85: {
! 86: struct sio_softc *sc = (void *)self;
! 87: struct mainbus_attach_args *ma = aux;
! 88: struct sio_attach_args sio_args;
! 89: int channel;
! 90: extern int sysconsole; /* console: 0 for ttya, 1 for desktop */
! 91:
! 92: printf(": 7201a\n");
! 93:
! 94: sc->scp_ctl = (caddr_t)ma->ma_addr;
! 95: sc->scp_intr[0] = sc->scp_intr[1] = nullintr;
! 96: for (channel = 0; channel < 2; channel++) {
! 97: sio_args.channel = channel;
! 98: sio_args.hwflags = (channel == sysconsole);
! 99: config_found(self, (void *)&sio_args, sio_print);
! 100: }
! 101:
! 102: isrlink_autovec(xsiointr, sc, ma->ma_ilvl, ISRPRI_TTYNOBUF,
! 103: self->dv_xname);
! 104: }
! 105:
! 106: int
! 107: sio_print(aux, name)
! 108: void *aux;
! 109: const char *name;
! 110: {
! 111: struct sio_attach_args *args = aux;
! 112:
! 113: if (name != NULL)
! 114: printf("%s: ", name);
! 115:
! 116: if (args->channel != -1)
! 117: printf(" channel %d", args->channel);
! 118:
! 119: return UNCONF;
! 120: }
! 121:
! 122: int
! 123: xsiointr(arg)
! 124: void *arg;
! 125: {
! 126: struct sio_softc *sc = arg;
! 127:
! 128: (*sc->scp_intr[0])(0); /* 0: ttya system serial port */
! 129: (*sc->scp_intr[1])(1); /* 1: keyboard and mouse */
! 130: return 1;
! 131: }
! 132:
! 133: void nullintr(v)
! 134: int v;
! 135: {
! 136: }
CVSweb