1 /* $NetBSD: zs_pcc.c,v 1.1 2001/05/14 18:23:07 drochner Exp $ */ 2 3 /* 4 * Copyright (c) 1997, 1999 5 * Matthias Drochner. 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 BE LIABLE FOR ANY DIRECT, INDIRECT, 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 * 27 */ 28 29 #include <sys/param.h> 30 #include <sys/systm.h> 31 #include <sys/proc.h> 32 #include <sys/device.h> 33 #include <sys/conf.h> 34 #include <sys/file.h> 35 #include <sys/ioctl.h> 36 #include <sys/tty.h> 37 #include <sys/time.h> 38 #include <sys/kernel.h> 39 #include <sys/syslog.h> 40 41 #include <dev/cons.h> 42 #include <dev/ic/z8530reg.h> 43 #include <machine/z8530var.h> 44 45 #include <machine/cpu.h> 46 #include <machine/autoconf.h> 47 48 #include <cesfic/cesfic/isr.h> 49 50 #include <cesfic/dev/zsvar.h> 51 52 extern void sic_enable_int __P((int, int, int, int, int)); 53 54 static int zsc_pcc_match __P((struct device *, struct cfdata *, void *)); 55 static void zsc_pcc_attach __P((struct device *, struct device *, void *)); 56 57 static char *zsbase; 58 59 struct cfattach zsc_pcc_ca = { 60 sizeof(struct zsc_softc), zsc_pcc_match, zsc_pcc_attach 61 }; 62 63 static int 64 zsc_pcc_match(parent, cf, aux) 65 struct device *parent; 66 struct cfdata *cf; 67 void *aux; 68 { 69 return (1); 70 } 71 72 static void 73 zsc_pcc_attach(parent, self, aux) 74 struct device *parent; 75 struct device *self; 76 void *aux; 77 { 78 struct zsc_softc *zsc = (void *) self; 79 static int didintr; 80 81 if (!zsbase) 82 mainbus_map(0x58000000, 0x10000, 0, (void **)&zsbase); 83 84 /* Do common parts of SCC configuration. */ 85 zs_config(zsc, zsbase); 86 87 /* 88 * Now safe to install interrupt handlers. Note the arguments 89 * to the interrupt handlers aren't used. Note, we only do this 90 * once since both SCCs interrupt at the same level and vector. 91 */ 92 if (didintr == 0) { 93 didintr = 1; 94 (void) isrlink(zshard, zsc, 4, ISRPRI_TTY); 95 sic_enable_int(19, 0, 4, 4, 0); 96 } 97 98 zs_write_reg(zsc->zsc_cs[0], 2, 0x18 + ZSHARD_PRI); 99 zs_write_reg(zsc->zsc_cs[0], 9, ZSWR9_MASTER_IE); 100 } 101 102 void 103 zs_cnattach(base) 104 void *base; 105 { 106 zsbase = base; 107 108 zs_cninit(zsbase); 109 } 110