summaryrefslogtreecommitdiff
path: root/sys/arch/mvme68k/dev
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/mvme68k/dev')
-rw-r--r--sys/arch/mvme68k/dev/bug.c4
-rw-r--r--sys/arch/mvme68k/dev/bugtty.c4
-rw-r--r--sys/arch/mvme68k/dev/cl.c5
-rw-r--r--sys/arch/mvme68k/dev/clock.c30
-rw-r--r--sys/arch/mvme68k/dev/clreg.h4
-rw-r--r--sys/arch/mvme68k/dev/dmavar.h4
-rw-r--r--sys/arch/mvme68k/dev/flash.c5
-rw-r--r--sys/arch/mvme68k/dev/flashreg.h5
-rw-r--r--sys/arch/mvme68k/dev/fooip.c5
-rw-r--r--sys/arch/mvme68k/dev/i82586.h5
-rw-r--r--sys/arch/mvme68k/dev/if_ie.c5
-rw-r--r--sys/arch/mvme68k/dev/if_ie.h5
-rw-r--r--sys/arch/mvme68k/dev/if_le.c30
-rw-r--r--sys/arch/mvme68k/dev/if_lereg.h2
-rw-r--r--sys/arch/mvme68k/dev/ipic.c5
-rw-r--r--sys/arch/mvme68k/dev/ipicreg.h5
-rw-r--r--sys/arch/mvme68k/dev/lp.c5
-rw-r--r--sys/arch/mvme68k/dev/mc.c5
-rw-r--r--sys/arch/mvme68k/dev/mcreg.h5
-rw-r--r--sys/arch/mvme68k/dev/memc.c5
-rw-r--r--sys/arch/mvme68k/dev/memcreg.h5
-rw-r--r--sys/arch/mvme68k/dev/memdevs.c5
-rw-r--r--sys/arch/mvme68k/dev/nvram.c34
-rw-r--r--sys/arch/mvme68k/dev/nvramreg.h2
-rw-r--r--sys/arch/mvme68k/dev/pcc.c224
-rw-r--r--sys/arch/mvme68k/dev/pccreg.h154
-rw-r--r--sys/arch/mvme68k/dev/pcctwo.c5
-rw-r--r--sys/arch/mvme68k/dev/pcctworeg.h5
-rw-r--r--sys/arch/mvme68k/dev/sbic.c2
-rw-r--r--sys/arch/mvme68k/dev/sbicdma.c7
-rw-r--r--sys/arch/mvme68k/dev/sbicreg.h2
-rw-r--r--sys/arch/mvme68k/dev/sbicvar.h2
-rw-r--r--sys/arch/mvme68k/dev/scc.h60
-rw-r--r--sys/arch/mvme68k/dev/siop.c2
-rw-r--r--sys/arch/mvme68k/dev/siop_script.ss2
-rw-r--r--sys/arch/mvme68k/dev/siopdma.c2
-rw-r--r--sys/arch/mvme68k/dev/siopreg.h3
-rw-r--r--sys/arch/mvme68k/dev/siopvar.h3
-rw-r--r--sys/arch/mvme68k/dev/sram.c5
-rw-r--r--sys/arch/mvme68k/dev/vme.c5
-rw-r--r--sys/arch/mvme68k/dev/vme.h5
-rw-r--r--sys/arch/mvme68k/dev/vmel.c5
-rw-r--r--sys/arch/mvme68k/dev/vmes.c5
-rw-r--r--sys/arch/mvme68k/dev/zs.c582
44 files changed, 799 insertions, 470 deletions
diff --git a/sys/arch/mvme68k/dev/bug.c b/sys/arch/mvme68k/dev/bug.c
index 808cf6d4413..c074f013fde 100644
--- a/sys/arch/mvme68k/dev/bug.c
+++ b/sys/arch/mvme68k/dev/bug.c
@@ -1,4 +1,4 @@
-/* $NetBSD$ */
+/* $Id: bug.c,v 1.2 1995/11/07 08:48:49 deraadt Exp $ */
/*
* Copyright (c) 1995 Dale Rahn.
@@ -14,7 +14,7 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by Dale Rahn.
+ * This product includes software developed by Dale Rahn.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
diff --git a/sys/arch/mvme68k/dev/bugtty.c b/sys/arch/mvme68k/dev/bugtty.c
index 367db8f804b..5b3bb9d96b7 100644
--- a/sys/arch/mvme68k/dev/bugtty.c
+++ b/sys/arch/mvme68k/dev/bugtty.c
@@ -1,4 +1,4 @@
-/* $NetBSD$ */
+/* $Id: bugtty.c,v 1.2 1995/11/07 08:48:51 deraadt Exp $ */
/*
* Copyright (c) 1995 Dale Rahn.
@@ -14,7 +14,7 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by Dale Rahn.
+ * This product includes software developed by Dale Rahn.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
diff --git a/sys/arch/mvme68k/dev/cl.c b/sys/arch/mvme68k/dev/cl.c
index 738d7d25daa..ae43b4f5851 100644
--- a/sys/arch/mvme68k/dev/cl.c
+++ b/sys/arch/mvme68k/dev/cl.c
@@ -1,4 +1,5 @@
-/* $NetBSD$ */
+/* $Id: cl.c,v 1.3 1995/11/07 08:48:52 deraadt Exp $ */
+
/*
* Copyright (c) 1995 Dale Rahn. All rights reserved.
*
@@ -13,7 +14,7 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by Dale Rahn.
+ * This product includes software developed by Dale Rahn.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
diff --git a/sys/arch/mvme68k/dev/clock.c b/sys/arch/mvme68k/dev/clock.c
index e4871cc2db3..69cea3a74a2 100644
--- a/sys/arch/mvme68k/dev/clock.c
+++ b/sys/arch/mvme68k/dev/clock.c
@@ -1,7 +1,35 @@
-/* $NetBSD$ */
+/* $Id: clock.c,v 1.2 1995/11/07 08:48:53 deraadt Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed under OpenBSD by
+ * Theo de Raadt for Willowglen Singapore.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
diff --git a/sys/arch/mvme68k/dev/clreg.h b/sys/arch/mvme68k/dev/clreg.h
index 4656c7c0007..b54c83fe920 100644
--- a/sys/arch/mvme68k/dev/clreg.h
+++ b/sys/arch/mvme68k/dev/clreg.h
@@ -1,3 +1,5 @@
+/* $Id: clreg.h,v 1.2 1995/11/07 08:48:54 deraadt Exp $ */
+
/*
* Copyright (c) 1995 Dale Rahn. All rights reserved.
*
@@ -11,7 +13,7 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by Dale Rahn.
+ * This product includes software developed by Dale Rahn.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
diff --git a/sys/arch/mvme68k/dev/dmavar.h b/sys/arch/mvme68k/dev/dmavar.h
index 99da32b62c1..a47d161eab7 100644
--- a/sys/arch/mvme68k/dev/dmavar.h
+++ b/sys/arch/mvme68k/dev/dmavar.h
@@ -1,3 +1,5 @@
+/* $Id: dmavar.h,v 1.2 1995/11/07 08:48:54 deraadt Exp $ */
+
/*
* Copyright (c) 1982, 1990 The Regents of the University of California.
* All rights reserved.
@@ -31,7 +33,7 @@
* SUCH DAMAGE.
*
* @(#)dmavar.h 7.2 (Berkeley) 11/4/90
- * $Id: dmavar.h,v 1.1 1995/10/18 10:43:06 deraadt Exp $
+ * $Id: dmavar.h,v 1.2 1995/11/07 08:48:54 deraadt Exp $
*/
/* dmago flags */
diff --git a/sys/arch/mvme68k/dev/flash.c b/sys/arch/mvme68k/dev/flash.c
index 933b2a199a6..13eca110f72 100644
--- a/sys/arch/mvme68k/dev/flash.c
+++ b/sys/arch/mvme68k/dev/flash.c
@@ -1,4 +1,4 @@
-/* $NetBSD$ */
+/* $Id: flash.c,v 1.2 1995/11/07 08:48:55 deraadt Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -14,7 +14,8 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by Theo de Raadt
+ * This product includes software developed under OpenBSD by
+ * Theo de Raadt for Willowglen Singapore.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
diff --git a/sys/arch/mvme68k/dev/flashreg.h b/sys/arch/mvme68k/dev/flashreg.h
index d9d82c5e492..327719c6b7a 100644
--- a/sys/arch/mvme68k/dev/flashreg.h
+++ b/sys/arch/mvme68k/dev/flashreg.h
@@ -1,4 +1,4 @@
-/* $NetBSD$ */
+/* $Id: flashreg.h,v 1.2 1995/11/07 08:48:56 deraadt Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -14,7 +14,8 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by Theo de Raadt
+ * This product includes software developed under OpenBSD by
+ * Theo de Raadt for Willowglen Singapore.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
diff --git a/sys/arch/mvme68k/dev/fooip.c b/sys/arch/mvme68k/dev/fooip.c
index f0217ba369a..810cdbfde00 100644
--- a/sys/arch/mvme68k/dev/fooip.c
+++ b/sys/arch/mvme68k/dev/fooip.c
@@ -1,4 +1,4 @@
-/* $NetBSD$ */
+/* $Id: fooip.c,v 1.2 1995/11/07 08:48:57 deraadt Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -14,7 +14,8 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by Theo de Raadt
+ * This product includes software developed under OpenBSD by
+ * Theo de Raadt for Willowglen Singapore.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
diff --git a/sys/arch/mvme68k/dev/i82586.h b/sys/arch/mvme68k/dev/i82586.h
index cb40672da90..79c72133fed 100644
--- a/sys/arch/mvme68k/dev/i82586.h
+++ b/sys/arch/mvme68k/dev/i82586.h
@@ -1,4 +1,4 @@
-/* $NetBSD: i82586.h,v 1.3 1995/01/27 09:49:55 pk Exp $ */
+/* $Id: i82586.h,v 1.2 1995/11/07 08:48:58 deraadt Exp $ */
/*-
* Copyright (c) 1995 Theo de Raadt
@@ -18,6 +18,9 @@
* must display the following acknowledgement:
* This product includes software developed by the University of
* Vermont and State Agricultural College and Garrett A. Wollman.
+ * and
+ * This product includes software developed under OpenBSD by
+ * Theo de Raadt for Willowglen Singapore.
* 4. Neither the name of the University nor the name of the author
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
diff --git a/sys/arch/mvme68k/dev/if_ie.c b/sys/arch/mvme68k/dev/if_ie.c
index e24a121d0e9..f39b56090ff 100644
--- a/sys/arch/mvme68k/dev/if_ie.c
+++ b/sys/arch/mvme68k/dev/if_ie.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_ie.c,v 1.15 1995/04/11 09:18:09 pk Exp $ */
+/* $Id: if_ie.c,v 1.2 1995/11/07 08:49:00 deraadt Exp $ */
/*-
* Copyright (c) 1995 Theo de Raadt
@@ -28,6 +28,9 @@
* University of Vermont and State Agricultural College and Garrett A.
* Wollman, by William F. Jolitz, and by the University of California,
* Berkeley, Lawrence Berkeley Laboratory, and its contributors.
+ * and
+ * This product includes software developed under OpenBSD by
+ * Theo de Raadt for Willowglen Singapore.
* 4. Neither the names of the Universities nor the names of the authors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
diff --git a/sys/arch/mvme68k/dev/if_ie.h b/sys/arch/mvme68k/dev/if_ie.h
index a17de666905..5ee10e33646 100644
--- a/sys/arch/mvme68k/dev/if_ie.h
+++ b/sys/arch/mvme68k/dev/if_ie.h
@@ -1,4 +1,4 @@
-/* $NetBSD$ */
+/* $Id: if_ie.h,v 1.2 1995/11/07 08:49:01 deraadt Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -14,7 +14,8 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by Theo de Raadt
+ * This product includes software developed under OpenBSD by
+ * Theo de Raadt for Willowglen Singapore.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
diff --git a/sys/arch/mvme68k/dev/if_le.c b/sys/arch/mvme68k/dev/if_le.c
index cd7fe440304..159be94d94e 100644
--- a/sys/arch/mvme68k/dev/if_le.c
+++ b/sys/arch/mvme68k/dev/if_le.c
@@ -1,4 +1,4 @@
-/* $NetBSD: if_le.c,v 1.1.1.1 1995/07/25 23:12:09 chuck Exp $ */
+/* $Id: if_le.c,v 1.2 1995/11/07 08:49:02 deraadt Exp $ */
/*-
* Copyright (c) 1982, 1992, 1993
@@ -81,9 +81,9 @@
#endif
#include <machine/cpu.h>
+#include <machine/autoconf.h>
#include <machine/pmap.h>
-#include <mvme68k/dev/iio.h>
#include <mvme68k/dev/if_lereg.h>
#include <mvme68k/dev/pccreg.h>
@@ -118,6 +118,7 @@ struct le_softc {
struct device sc_dev; /* base device */
struct evcnt sc_intrcnt; /* # of interrupts, per le */
struct evcnt sc_errcnt; /* # of errors, per le */
+ struct intrhand sc_ih;
struct arpcom sc_ac; /* common Ethernet structures */
#define sc_if sc_ac.ac_if /* network-visible interface */
@@ -166,7 +167,7 @@ void leerror(struct le_softc *, int);
void lererror(struct le_softc *, char *);
void lexerror(struct le_softc *);
-void *ledatabuf; /* XXXCDC hack from pmap bootstrap */
+extern void *etherbuf;
int
lematch(parent, vcf, args)
@@ -174,9 +175,9 @@ lematch(parent, vcf, args)
void *vcf, *args;
{
struct cfdata *cf = vcf;
- struct iioargs *ia = args;
+ struct confargs *ca = args;
- return !badbaddr((caddr_t) IIO_CFLOC_ADDR(cf));
+ return (!badvaddr(ca->ca_vaddr, 2));
}
/*
@@ -193,24 +194,25 @@ leattach(parent, self, args)
register struct le_softc *sc = (struct le_softc *)self;
register struct lereg2 *ler2;
struct ifnet *ifp = &sc->sc_if;
+ struct confargs *ca = args;
register int a;
- int pri = IIO_CFLOC_LEVEL(self->dv_cfdata);
+ int pri = ca->ca_ipl;
/* XXX the following declarations should be elsewhere */
extern void myetheraddr(u_char *);
- iio_print(self->dv_cfdata);
-
/* connect the interrupt */
- pccintr_establish(PCCV_LE, leintr, pri, sc);
-
- sc->sc_r1 = (struct lereg1 *) IIO_CFLOC_ADDR(self->dv_cfdata);
+ sc->sc_ih.ih_fn = leintr;
+ sc->sc_ih.ih_arg = sc;
+ sc->sc_ih.ih_ipl = pri;
+ pccintr_establish(PCCV_LE, &sc->sc_ih);
+ sc->sc_r1 = (struct lereg1 *)ca->ca_vaddr;
- ler2 = sc->sc_r2 = (struct lereg2 *) ledatabuf;
+ ler2 = sc->sc_r2 = (struct lereg2 *) etherbuf;
myetheraddr(sc->sc_addr);
- printf(" ler2 0x%x address %s\n", ler2, ether_sprintf(sc->sc_addr));
+ printf(": address %s\n", ether_sprintf(sc->sc_addr));
/*
* Setup for transmit/receive
@@ -253,8 +255,8 @@ leattach(parent, self, args)
#endif
if_attach(ifp);
ether_ifattach(ifp);
- sys_pcc->le_int = pri | PCC_IENABLE;
+ ((struct pccreg *)ca->ca_master)->pcc_leirq = pri | PCC_IRQ_IEN;
}
/*
diff --git a/sys/arch/mvme68k/dev/if_lereg.h b/sys/arch/mvme68k/dev/if_lereg.h
index 6e802470966..621738369cd 100644
--- a/sys/arch/mvme68k/dev/if_lereg.h
+++ b/sys/arch/mvme68k/dev/if_lereg.h
@@ -1,4 +1,4 @@
-/* $NetBSD: if_lereg.h,v 1.1.1.1 1995/07/25 23:12:10 chuck Exp $ */
+/* $Id: if_lereg.h,v 1.2 1995/11/07 08:49:03 deraadt Exp $ */
/*-
* Copyright (c) 1982, 1992, 1993
diff --git a/sys/arch/mvme68k/dev/ipic.c b/sys/arch/mvme68k/dev/ipic.c
index 400f57b25ba..92b718872ea 100644
--- a/sys/arch/mvme68k/dev/ipic.c
+++ b/sys/arch/mvme68k/dev/ipic.c
@@ -1,4 +1,4 @@
-/* $NetBSD$ */
+/* $Id: ipic.c,v 1.2 1995/11/07 08:49:04 deraadt Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -14,7 +14,8 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by Theo de Raadt
+ * This product includes software developed under OpenBSD by
+ * Theo de Raadt for Willowglen Singapore.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
diff --git a/sys/arch/mvme68k/dev/ipicreg.h b/sys/arch/mvme68k/dev/ipicreg.h
index b329a7342f9..b6272429333 100644
--- a/sys/arch/mvme68k/dev/ipicreg.h
+++ b/sys/arch/mvme68k/dev/ipicreg.h
@@ -1,4 +1,4 @@
-/* $NetBSD$ */
+/* $Id: ipicreg.h,v 1.2 1995/11/07 08:49:06 deraadt Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -14,7 +14,8 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by Theo de Raadt
+ * This product includes software developed under OpenBSD by
+ * Theo de Raadt for Willowglen Singapore.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
diff --git a/sys/arch/mvme68k/dev/lp.c b/sys/arch/mvme68k/dev/lp.c
index 77f02834c2a..29a3f15ef59 100644
--- a/sys/arch/mvme68k/dev/lp.c
+++ b/sys/arch/mvme68k/dev/lp.c
@@ -1,4 +1,4 @@
-/* $NetBSD$ */
+/* $Id: lp.c,v 1.2 1995/11/07 08:49:08 deraadt Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -14,7 +14,8 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by Theo de Raadt
+ * This product includes software developed under OpenBSD by
+ * Theo de Raadt for Willowglen Singapore.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
diff --git a/sys/arch/mvme68k/dev/mc.c b/sys/arch/mvme68k/dev/mc.c
index 1c7dc2889d1..d4d2c358c07 100644
--- a/sys/arch/mvme68k/dev/mc.c
+++ b/sys/arch/mvme68k/dev/mc.c
@@ -1,4 +1,4 @@
-/* $NetBSD$ */
+/* $Id: mc.c,v 1.2 1995/11/07 08:49:09 deraadt Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -14,7 +14,8 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by Theo de Raadt
+ * This product includes software developed under OpenBSD by
+ * Theo de Raadt for Willowglen Singapore.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
diff --git a/sys/arch/mvme68k/dev/mcreg.h b/sys/arch/mvme68k/dev/mcreg.h
index ead6d812d0f..dc5b95f6681 100644
--- a/sys/arch/mvme68k/dev/mcreg.h
+++ b/sys/arch/mvme68k/dev/mcreg.h
@@ -1,4 +1,4 @@
-/* $NetBSD$ */
+/* $Id: mcreg.h,v 1.2 1995/11/07 08:49:10 deraadt Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -14,7 +14,8 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by Theo de Raadt
+ * This product includes software developed under OpenBSD by
+ * Theo de Raadt for Willowglen Singapore.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
diff --git a/sys/arch/mvme68k/dev/memc.c b/sys/arch/mvme68k/dev/memc.c
index 9a16dd2a393..044da4a2963 100644
--- a/sys/arch/mvme68k/dev/memc.c
+++ b/sys/arch/mvme68k/dev/memc.c
@@ -1,4 +1,4 @@
-/* $NetBSD$ */
+/* $Id: memc.c,v 1.2 1995/11/07 08:49:12 deraadt Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -14,7 +14,8 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by Theo de Raadt
+ * This product includes software developed under OpenBSD by
+ * Theo de Raadt for Willowglen Singapore.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
diff --git a/sys/arch/mvme68k/dev/memcreg.h b/sys/arch/mvme68k/dev/memcreg.h
index 6bb7b901dec..ed9ab3a6bcb 100644
--- a/sys/arch/mvme68k/dev/memcreg.h
+++ b/sys/arch/mvme68k/dev/memcreg.h
@@ -1,4 +1,4 @@
-/* $NetBSD$ */
+/* $Id: memcreg.h,v 1.2 1995/11/07 08:49:14 deraadt Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -14,7 +14,8 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by Theo de Raadt
+ * This product includes software developed under OpenBSD by
+ * Theo de Raadt for Willowglen Singapore.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
diff --git a/sys/arch/mvme68k/dev/memdevs.c b/sys/arch/mvme68k/dev/memdevs.c
index a966b8778cc..3bb3a26bfc1 100644
--- a/sys/arch/mvme68k/dev/memdevs.c
+++ b/sys/arch/mvme68k/dev/memdevs.c
@@ -1,4 +1,4 @@
-/* $NetBSD$ */
+/* $Id: memdevs.c,v 1.2 1995/11/07 08:49:16 deraadt Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -14,7 +14,8 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by Theo de Raadt
+ * This product includes software developed under OpenBSD by
+ * Theo de Raadt for Willowglen Singapore.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
diff --git a/sys/arch/mvme68k/dev/nvram.c b/sys/arch/mvme68k/dev/nvram.c
index 93f484542a6..e383ae32d8e 100644
--- a/sys/arch/mvme68k/dev/nvram.c
+++ b/sys/arch/mvme68k/dev/nvram.c
@@ -1,19 +1,8 @@
-/* $NetBSD$ */
+/* $Id: nvram.c,v 1.2 1995/11/07 08:49:17 deraadt Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
- * Copyright (c) 1992, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This software was developed by the Computer Systems Engineering group
- * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
- * contributed to Berkeley.
- *
- * All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Lawrence Berkeley Laboratory.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -24,17 +13,16 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
+ * This product includes software developed under OpenBSD by
+ * Theo de Raadt for Willowglen Singapore.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
*
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
diff --git a/sys/arch/mvme68k/dev/nvramreg.h b/sys/arch/mvme68k/dev/nvramreg.h
index ec804e1e049..281d44102dc 100644
--- a/sys/arch/mvme68k/dev/nvramreg.h
+++ b/sys/arch/mvme68k/dev/nvramreg.h
@@ -1,4 +1,4 @@
-/* $NetBSD: clockreg.h,v 1.5 1994/11/20 20:54:07 deraadt Exp $ */
+/* $Id: nvramreg.h,v 1.2 1995/11/07 08:49:19 deraadt Exp $ */
/*
* Copyright (c) 1992, 1993
diff --git a/sys/arch/mvme68k/dev/pcc.c b/sys/arch/mvme68k/dev/pcc.c
index 8ea641b7501..b01f60a301e 100644
--- a/sys/arch/mvme68k/dev/pcc.c
+++ b/sys/arch/mvme68k/dev/pcc.c
@@ -1,8 +1,7 @@
-/* $Id: pcc.c,v 1.1 1995/10/18 08:51:10 deraadt Exp $ */
+/* $Id: pcc.c,v 1.2 1995/11/07 08:49:20 deraadt Exp $ */
/*
- *
- * Copyright (c) 1995 Charles D. Cranor
+ * Copyright (c) 1995 Theo de Raadt
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -15,7 +14,8 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by Charles D. Cranor.
+ * This product includes software developed under OpenBSD by
+ * Theo de Raadt for Willowglen Singapore.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
@@ -32,9 +32,8 @@
*/
/*
- * peripheral channel controller
+ * VME147 peripheral channel controller
*/
-
#include <sys/param.h>
#include <sys/conf.h>
#include <sys/ioctl.h>
@@ -49,40 +48,29 @@
#include <sys/fcntl.h>
#include <sys/device.h>
#include <machine/cpu.h>
+#include <machine/autoconf.h>
#include <dev/cons.h>
-#include <mvme68k/mvme68k/isr.h>
-#include <mvme68k/dev/iio.h>
-#include <mvme68k/dev/pccreg.h>
-/*
- * Autoconfiguration stuff.
- */
+#include <mvme68k/dev/pccreg.h>
struct pccsoftc {
struct device sc_dev;
- struct pcc *sc_pcc;
+ caddr_t sc_vaddr;
+ caddr_t sc_paddr;
+ struct pccreg *sc_pcc;
+ struct intrhand sc_nmiih;
};
-
void pccattach __P((struct device *, struct device *, void *));
int pccmatch __P((struct device *, void *, void *));
+int pccabort __P((struct frame *));
struct cfdriver pcccd = {
NULL, "pcc", pccmatch, pccattach,
DV_DULL, sizeof(struct pccsoftc), 0
};
-/*
- * globals
- */
-
-struct pcc *sys_pcc = NULL;
-
-struct {
- int (*pcc_fn)();
- void *arg;
- int lvl;
-} pcc_vecs[PCC_NVEC];
+struct pccreg *sys_pcc = NULL;
int
pccmatch(parent, vcf, args)
@@ -90,8 +78,60 @@ pccmatch(parent, vcf, args)
void *vcf, *args;
{
struct cfdata *cf = vcf;
+ struct confargs *ca = args;
- return !badbaddr((caddr_t) IIO_CFLOC_ADDR(cf));
+ /* the pcc only exist on vme147's */
+ if (cputyp != CPU_147)
+ return (0);
+ return (!badvaddr(IIOV(ca->ca_paddr) + PCCSPACE_PCCCHIP_OFF, 1));
+}
+
+int
+pcc_print(args, bus)
+ void *args;
+ char *bus;
+{
+ struct confargs *ca = args;
+
+ if (ca->ca_offset != -1)
+ printf(" offset 0x%x", ca->ca_offset);
+ if (ca->ca_ipl > 0)
+ printf(" ipl %d", ca->ca_ipl);
+ return (UNCONF);
+}
+
+int
+pcc_scan(parent, child, args)
+ struct device *parent;
+ void *child, *args;
+{
+ struct cfdata *cf = child;
+ struct pccsoftc *sc = (struct pccsoftc *)parent;
+ struct confargs *ca = args;
+ struct confargs oca;
+
+ if (parent->dv_cfdata->cf_driver->cd_indirect) {
+ printf(" indirect devices not supported\n");
+ return 0;
+ }
+
+ bzero(&oca, sizeof oca);
+ oca.ca_offset = cf->cf_loc[0];
+ oca.ca_ipl = cf->cf_loc[1];
+ if (oca.ca_offset != -1) {
+ oca.ca_vaddr = sc->sc_vaddr + oca.ca_offset;
+ oca.ca_paddr = sc->sc_paddr + oca.ca_offset;
+ } else {
+ oca.ca_vaddr = (caddr_t)-1;
+ oca.ca_paddr = (caddr_t)-1;
+ }
+ oca.ca_bustype = BUS_PCC;
+ oca.ca_master = (void *)sc->sc_pcc;
+ oca.ca_name = cf->cf_driver->cd_name;
+ if ((*cf->cf_driver->cd_match)(parent, cf, &oca) == 0)
+ return (0);
+ config_attach(parent, cf, &oca, pcc_print);
+ return (1);
}
void
@@ -99,73 +139,111 @@ pccattach(parent, self, args)
struct device *parent, *self;
void *args;
{
- struct pccsoftc *pccsc;
+ struct confargs *ca = args;
+ struct pccsoftc *sc = (struct pccsoftc *)self;
+ int i;
if (sys_pcc)
panic("pcc already attached!");
- iio_print(self->dv_cfdata);
-
/*
- * link into softc and set up interrupt vector base
+ * since we know ourself to land in intiobase land,
+ * we must adjust our address
*/
- pccsc = (struct pccsoftc *) self;
- sys_pcc = pccsc->sc_pcc = (struct pcc *)IIO_CFLOC_ADDR(self->dv_cfdata);
- pccsc->sc_pcc->int_vectr = PCC_VECBASE;
- bzero(pcc_vecs, sizeof(pcc_vecs));
+ sc->sc_paddr = ca->ca_paddr;
+ sc->sc_vaddr = (caddr_t)IIOV(sc->sc_paddr);
+ sc->sc_pcc = (struct pccreg *)(sc->sc_vaddr + PCCSPACE_PCCCHIP_OFF);
+ sys_pcc = sc->sc_pcc;
- printf(" rev %d intbvr 0x%x\n", pccsc->sc_pcc->pcc_rev,
- pccsc->sc_pcc->int_vectr);
-}
+ printf(": rev %d\n", sc->sc_pcc->pcc_chiprev);
+ sc->sc_nmiih.ih_fn = pccabort;
+ sc->sc_nmiih.ih_arg = 0;
+ sc->sc_nmiih.ih_ipl = 7;
+ sc->sc_nmiih.ih_wantframe = 1;
+ pccintr_establish(PCCV_ABORT, &sc->sc_nmiih);
-/*
- * pccintr: called from locore with the PC and evec from the trap frame.
- */
-int
-pccintr(pc, evec, frame)
- int pc;
- int evec;
- void *frame;
-{
- int vec = (evec & 0xfff) >> 2; /* XXX should be m68k macro? */
- extern u_long intrcnt[]; /* XXX from locore */
-
- vec = vec & 0xf; /* XXX mask out */
- if (vec >= PCC_NVEC || pcc_vecs[vec].pcc_fn == NULL)
- return(straytrap(pc, evec));
-
- cnt.v_intr++;
- intrcnt[pcc_vecs[vec].lvl]++;
-
- /* arg override? only timer1 gets access to frame */
- if (vec != PCCV_TIMER1)
- frame = pcc_vecs[vec].arg;
- return((*pcc_vecs[vec].pcc_fn)(frame));
-}
+ sc->sc_pcc->pcc_vecbase = PCC_VECBASE;
+ sc->sc_pcc->pcc_abortirq = PCC_ABORT_IEN | PCC_ABORT_ACK;
+ sc->sc_pcc->pcc_genctl |= PCC_GENCTL_IEN;
+ /* XXX further init of PCC chip? */
+
+ config_search(pcc_scan, self, args);
+}
/*
- * pccintr_establish: establish pcc interrupt
+ * PCC interrupts land in a PCC_NVEC sized hole starting at PCC_VECBASE
*/
int
-pccintr_establish(vec, hand, lvl, arg)
- u_long vec;
- int (*hand)(), lvl;
- void *arg;
+pccintr_establish(vec, ih)
+ int vec;
+ struct intrhand *ih;
{
if (vec >= PCC_NVEC) {
printf("pcc: illegal vector: 0x%x\n", vec);
panic("pccintr_establish");
}
+ return (intr_establish(PCC_VECBASE+vec, ih));
+}
- if (pcc_vecs[vec].pcc_fn) {
- printf("pcc: vector 0x%x in use: (0x%x,0x%x) (0x%x,0x%x)\n",
- hand, arg, pcc_vecs[vec].pcc_fn, pcc_vecs[vec].arg);
- panic("pccintr_establish");
+int
+pccabort(frame)
+ struct frame *frame;
+{
+#if 0
+ /* XXX wait for it to debounce -- there is something wrong here */
+ while (sys_pcc->pcc_abortirq & PCC_ABORT_ABS)
+ ;
+ delay(2);
+#endif
+ sys_pcc->pcc_abortirq = PCC_ABORT_IEN | PCC_ABORT_ACK;
+ nmihand(frame);
+ return (1);
+}
+
+int
+pccspeed(pcc)
+ struct pccreg *pcc;
+{
+ volatile u_short lim = pcc_timer_us2lim(400);
+ volatile u_short tmp;
+ volatile int cnt;
+ int speed;
+
+ /*printf("counting...lim = %d\n", lim);*/
+
+ pcc->pcc_t1irq = 0; /* just in case */
+ pcc->pcc_t1pload = 0;
+ pcc->pcc_t1ctl = PCC_TIMERCLEAR;
+ pcc->pcc_t1ctl = PCC_TIMERSTART;
+
+ cnt = 0;
+ while (1) {
+ tmp = pcc->pcc_t1count;
+ if (tmp > lim)
+ break;
+ tmp = lim;
+ cnt++;
}
- pcc_vecs[vec].pcc_fn = hand;
- pcc_vecs[vec].lvl = lvl;
- pcc_vecs[vec].arg = arg;
+ pcc->pcc_t1ctl = PCC_TIMERCLEAR;
+ printf("pccspeed cnt=%d\n", cnt);
+
+ /*
+ * Imperically determined. Unfortunately, because of various
+ * memory board effects and such, it is rather unlikely that
+ * we will find a nice formula.
+ */
+ if (cnt > 230000)
+ speed = 50;
+ else if (cnt > 210000)
+ speed = 33;
+ else if (cnt > 190000)
+ speed = 25;
+ else if (cnt > 170000) /* 171163, 170335 */
+ speed = 20;
+ else
+ speed = 16;
+ return (speed);
}
diff --git a/sys/arch/mvme68k/dev/pccreg.h b/sys/arch/mvme68k/dev/pccreg.h
index 114d42a7dab..58d29508152 100644
--- a/sys/arch/mvme68k/dev/pccreg.h
+++ b/sys/arch/mvme68k/dev/pccreg.h
@@ -1,8 +1,7 @@
-/* $Id: pccreg.h,v 1.1 1995/10/18 08:51:10 deraadt Exp $ */
+/* $Id: pccreg.h,v 1.2 1995/11/07 08:49:21 deraadt Exp $ */
/*
- *
- * Copyright (c) 1995 Charles D. Cranor
+ * Copyright (c) 1995 Theo de Raadt
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -15,7 +14,8 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by Charles D. Cranor.
+ * This product includes software developed under OpenBSD by
+ * Theo de Raadt for Willowglen Singapore.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
@@ -32,99 +32,127 @@
*/
/*
- * peripheral channel controller (at pa fffe1000)
+ * MVME147 PCC chip
*/
-
-struct pcc {
- volatile u_long dma_taddr; /* dma table address */
- volatile u_long dma_daddr; /* dma data address */
- volatile u_long dma_bcnt; /* dma byte count */
- volatile u_long dma_hold; /* dma data hold register */
- volatile u_short t1_pload; /* timer1 preload */
- volatile u_short t1_count; /* timer1 count */
- volatile u_short t2_pload; /* timer2 preload */
- volatile u_short t2_count; /* timer2 count */
- volatile u_char t1_int; /* timer1 interrupt ctrl */
- volatile u_char t1_cr; /* timer1 ctrl reg */
- volatile u_char t2_int; /* timer2 interrupt ctrl */
- volatile u_char t2_cr; /* timer2 ctrl reg */
- volatile u_char acf_int; /* acfail intr reg */
- volatile u_char dog_int; /* watchdog intr reg */
- volatile u_char pr_int; /* printer intr reg */
- volatile u_char pr_cr; /* printer ctrl */
- volatile u_char dma_int; /* dma interrupt control */
- volatile u_char dma_csr; /* dma csr */
- volatile u_char bus_int; /* bus error interrupt */
- volatile u_char dma_sr; /* dma status register */
- volatile u_char abrt_int; /* abort interrupt control reg */
- volatile u_char ta_fcr; /* table address function code reg */
- volatile u_char zs_int; /* serial interrupt reg */
- volatile u_char gen_cr; /* general control register */
- volatile u_char le_int; /* ethernet interrupt */
- volatile u_char gen_sr; /* general status */
- volatile u_char scsi_int; /* scsi interrupt reg */
- volatile u_char slave_ba; /* slave base addr reg */
- volatile u_char sw1_int; /* software interrupt #1 cr */
- volatile u_char int_vectr; /* interrupt base vector register */
- volatile u_char sw2_int; /* software interrupt #2 cr */
- volatile u_char pcc_rev; /* revision level */
+struct pccreg {
+ volatile u_long pcc_dmataddr; /* dma table address */
+ volatile u_long pcc_dmadaddr; /* dma data address */
+ volatile u_long pcc_dmabcnt; /* dma byte count */
+ volatile u_long pcc_dmahold; /* dma data hold register */
+ volatile u_short pcc_t1pload; /* timer1 preload */
+ volatile u_short pcc_t1count; /* timer1 count */
+ volatile u_short pcc_t2pload; /* timer2 preload */
+ volatile u_short pcc_t2count; /* timer2 count */
+ volatile u_char pcc_t1irq; /* timer1 interrupt ctrl */
+ volatile u_char pcc_t1ctl; /* timer1 ctrl reg */
+ volatile u_char pcc_t2irq; /* timer2 interrupt ctrl */
+ volatile u_char pcc_t2ctl; /* timer2 ctrl reg */
+ volatile u_char pcc_acfirq; /* acfail intr reg */
+ volatile u_char pcc_dogirq; /* watchdog intr reg */
+ volatile u_char pcc_lpirq; /* printer intr reg */
+ volatile u_char pcc_lpctl; /* printer ctrl */
+ volatile u_char pcc_dmairq; /* dma interrupt control */
+ volatile u_char pcc_dmacsr; /* dma csr */
+ volatile u_char pcc_busirq; /* bus error interrupt */
+ volatile u_char pcc_dmasr; /* dma status register */
+ volatile u_char pcc_abortirq; /* abort interrupt control reg */
+ volatile u_char pcc_tafcr; /* table address function code reg */
+ volatile u_char pcc_zsirq; /* serial interrupt reg */
+ volatile u_char pcc_genctl; /* general control register */
+ volatile u_char pcc_leirq; /* ethernet interrupt */
+ volatile u_char pcc_gensr; /* general status */
+ volatile u_char pcc_sbicirq; /* sbic interrupt reg */
+ volatile u_char pcc_slavebase; /* slave base addr reg */
+ volatile u_char pcc_sw1inq; /* software interrupt #1 cr */
+ volatile u_char pcc_vecbase; /* interrupt base vector register */
+ volatile u_char pcc_sw2irq; /* software interrupt #2 cr */
+ volatile u_char pcc_chiprev; /* revision level */
};
-
+#define PCCSPACE_PCCCHIP_OFF 0x1000
/*
- * points to system's PCC
+ * points to system's PCC. This is not active until the pcc0 device
+ * has been attached.
*/
-
-extern struct pcc *sys_pcc;
+extern struct pccreg *sys_pcc;
/*
- * we lock off our interrupt vector at 0x40. if this is changed
- * we'll need to change vector.s
+ * We lock off our interrupt vector at 0x40.
*/
-
-#define PCC_VECBASE 0x40
-#define PCC_NVEC 12
+#define PCC_VECBASE 0x40
+#define PCC_NVEC 12
/*
- * vectors we use
+ * Vectors we use
*/
-
#define PCCV_ACFAIL 0
#define PCCV_BERR 1
#define PCCV_ABORT 2
#define PCCV_ZS 3
#define PCCV_LE 4
-#define PCCV_SCSIP 5
-#define PCCV_SCSID 6
+#define PCCV_SBIC 5
+#define PCCV_DMA 6
#define PCCV_PRINTER 7
#define PCCV_TIMER1 8
#define PCCV_TIMER2 9
#define PCCV_SOFT1 10
#define PCCV_SOFT2 11
-/*
- * enable interrupt
- */
+#define PCC_DMABCNT_MAKEFC(fcn) ((fcn) << 24)
+#define PCC_DMABCNT_FCMASK 0x07000000
+#define PCC_DMABCNT_L 0x80000000
+#define PCC_DMABCNT_CNTMASK 0x00ffffff
-#define PCC_IENABLE 0x08
+#define PCC_DMACSR_DONE 0x80
+#define PCC_DMACSR_ERR8BIT 0x40
+#define PCC_DMACSR_TNOT32 0x20
+#define PCC_DMACSR_DMAERRDATA 0x10
+#define PCC_DMACSR_DMAERRTABLE 0x08
+#define PCC_DMACSR_TOSCSI 0x04
+#define PCC_DMACSR_USETABLE 0x02
+#define PCC_DMACSR_DEN 0x01
+
+#define PCC_SBIC_RESETIRQ 0x40
+#define PCC_SBIC_RESETABS 0x20
/*
- * interrupt mask
+ * Fairly standard irq register bits.
*/
+#define PCC_IRQ_IPL 0x07
+#define PCC_IRQ_IEN 0x08
+#define PCC_IRQ_INT 0x80
-#define PCC_IMASK 0x7
+#define PCC_LPIRQ_ACK 0x20
/*
* clock/timer
*/
+#define PCC_TIMERACK 0x80 /* ack intr */
+#define PCC_TIMERCLEAR 0x00 /* reset and clear timer */
+#define PCC_TIMERSTART 0x03 /* start timer */
-#define PCC_TIMERACK 0x80 /* ack intr */
-#define PCC_TIMER100HZ 63936 /* load value for 100Hz */
-#define PCC_TIMERCLEAR 0x0 /* reset and clear timer */
-#define PCC_TIMERSTART 0x3 /* start timer */
+#define pcc_timer_hz2lim(hz) (65536 - (160000/(hz)))
+#define pcc_timer_us2lim(us) (65536 - (160000/(1000000/(us))))
/*
* serial control
*/
+#define PCC_ZS_PCCVEC 0x10 /* let PCC supply vector */
+
+/*
+ * abort switch
+ */
+#define PCC_ABORT_IEN 0x08 /* enable interrupt */
+#define PCC_ABORT_ABS 0x40 /* current state of switch */
+#define PCC_ABORT_ACK 0x80 /* intr active; or write to ack */
+
+/*
+ * for the console we need zs phys addr
+ */
+#define ZS0_PHYS_147 (INTIOBASE_147 + 0x3000)
+#define ZS1_PHYS_147 (INTIOBASE_147 + 0x3800)
+
+/* XXX */
+int pccintr_establish __P((int vec, struct intrhand *ih));
-#define PCC_ZSEXTERN 0x10 /* let PCC supply vector */
+#define PCC_GENCTL_IEN 0x10
diff --git a/sys/arch/mvme68k/dev/pcctwo.c b/sys/arch/mvme68k/dev/pcctwo.c
index 6b694606f3b..c85903a9332 100644
--- a/sys/arch/mvme68k/dev/pcctwo.c
+++ b/sys/arch/mvme68k/dev/pcctwo.c
@@ -1,4 +1,4 @@
-/* $NetBSD$ */
+/* $Id: pcctwo.c,v 1.2 1995/11/07 08:49:22 deraadt Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -14,7 +14,8 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by Theo de Raadt
+ * This product includes software developed under OpenBSD by
+ * Theo de Raadt for Willowglen Singapore.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
diff --git a/sys/arch/mvme68k/dev/pcctworeg.h b/sys/arch/mvme68k/dev/pcctworeg.h
index 4c02c246797..99ae019edcd 100644
--- a/sys/arch/mvme68k/dev/pcctworeg.h
+++ b/sys/arch/mvme68k/dev/pcctworeg.h
@@ -1,4 +1,4 @@
-/* $NetBSD$ */
+/* $Id: pcctworeg.h,v 1.2 1995/11/07 08:49:23 deraadt Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -14,7 +14,8 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by Theo de Raadt
+ * This product includes software developed under OpenBSD by
+ * Theo de Raadt for Willowglen Singapore.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
diff --git a/sys/arch/mvme68k/dev/sbic.c b/sys/arch/mvme68k/dev/sbic.c
index b871cdd95a2..79849f180f9 100644
--- a/sys/arch/mvme68k/dev/sbic.c
+++ b/sys/arch/mvme68k/dev/sbic.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sbic.c,v 1.14 1995/08/18 15:28:03 chopps Exp $ */
+/* $Id: sbic.c,v 1.2 1995/11/07 08:49:24 deraadt Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
diff --git a/sys/arch/mvme68k/dev/sbicdma.c b/sys/arch/mvme68k/dev/sbicdma.c
index 193cc674efa..c8a9e36ff73 100644
--- a/sys/arch/mvme68k/dev/sbicdma.c
+++ b/sys/arch/mvme68k/dev/sbicdma.c
@@ -1,4 +1,4 @@
-/* $NetBSD$ */
+/* $Id: sbicdma.c,v 1.2 1995/11/07 08:49:26 deraadt Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -14,7 +14,10 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by Dale Rahn.
+ * This product includes software developed by Dale Rahn.
+ * and
+ * This product includes software developed under OpenBSD by
+ * Theo de Raadt for Willowglen Singapore.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
diff --git a/sys/arch/mvme68k/dev/sbicreg.h b/sys/arch/mvme68k/dev/sbicreg.h
index f3844dcd246..1d645cfbaa4 100644
--- a/sys/arch/mvme68k/dev/sbicreg.h
+++ b/sys/arch/mvme68k/dev/sbicreg.h
@@ -1,4 +1,4 @@
-/* $NetBSD: sbicreg.h,v 1.2 1994/10/26 02:04:40 cgd Exp $ */
+/* $Id: sbicreg.h,v 1.2 1995/11/07 08:49:27 deraadt Exp $ */
/*
* Copyright (c) 1990 The Regents of the University of California.
diff --git a/sys/arch/mvme68k/dev/sbicvar.h b/sys/arch/mvme68k/dev/sbicvar.h
index 339d5f73c39..c198db322a3 100644
--- a/sys/arch/mvme68k/dev/sbicvar.h
+++ b/sys/arch/mvme68k/dev/sbicvar.h
@@ -1,4 +1,4 @@
-/* $NetBSD: sbicvar.h,v 1.8 1995/08/18 15:28:05 chopps Exp $ */
+/* $Id: sbicvar.h,v 1.2 1995/11/07 08:49:28 deraadt Exp $ */
/*
* Copyright (c) 1990 The Regents of the University of California.
diff --git a/sys/arch/mvme68k/dev/scc.h b/sys/arch/mvme68k/dev/scc.h
index 4d94f6c3fde..2b626de4d8b 100644
--- a/sys/arch/mvme68k/dev/scc.h
+++ b/sys/arch/mvme68k/dev/scc.h
@@ -1,6 +1,7 @@
-/* $NetBSD: scc.h,v 1.1.1.1 1995/07/25 23:12:07 chuck Exp $ */
+/* $Id: scc.h,v 1.2 1995/11/07 08:49:29 deraadt Exp $ */
/*
+ * Copyright (c) 1995 Theo de Raadt
* Copyright (c) 1993 Paul Mackerras.
* All rights reserved.
*
@@ -12,8 +13,12 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software withough specific prior written permission
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed under OpenBSD by
+ * Theo de Raadt for Willowglen Singapore.
+ * 4. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@@ -30,25 +35,50 @@
* SCC I/O register definitions
*/
-#define PCLK_FREQ 8333333 /* XXX */
+#define PCLK_FREQ_147 5000000
+#define PCLK_FREQ_162 10000000
-struct scc {
- unsigned char cr;
- unsigned char dr;
+/*
+ * physical layout in memory of the SCC chips on the MVME147
+ */
+struct scc_147 {
+ u_char cr;
+ u_char dr;
+};
+
+/*
+ * physical layout in memory of the SCC chips on the MVME162
+ * (and possibly the MVME172 as well?)
+ */
+struct scc_162 {
+ u_char xx1;
+ u_char cr;
+ u_char xx2;
+ u_char dr;
};
struct sccregs {
- volatile struct scc *s_adr;
- unsigned char s_val[16];
+ volatile u_char *s_cr;
+ volatile u_char *s_dr;
+ u_char s_val[16];
};
-#define ZREAD0(scc) ((scc)->s_adr->cr)
-#define ZREAD(scc, n) ((scc)->s_adr->cr = n, (scc)->s_adr->cr)
-#define ZREADD(scc) ((scc)->s_adr->dr)
+#define ZREAD0(scc) ((*((scc)->s_cr)))
+#define ZREAD(scc, n) ((*((scc)->s_cr)) = n, (*((scc)->s_cr)))
+#if 1
+#define ZREADD(scc) (ZWRITE0((scc), 8), ZREAD0((scc)))
+#else
+#define ZREADD(scc) ((*((scc)->s_dr)))
+#endif
-#define ZWRITE0(scc, v) ((scc)->s_adr->cr = v)
-#define ZWRITE(scc, n, v) (ZWRITE0(scc, n), ZWRITE0(scc, (scc)->s_val[n] = v))
-#define ZWRITED(scc, v) ((scc)->s_adr->dr = v)
+#define ZWRITE0(scc, v) ((*((scc)->s_cr)) = (u_char)(v))
+#define ZWRITE(scc, n, v) (ZWRITE0(scc, (u_char)n), \
+ ZWRITE0(scc, (scc)->s_val[n] = (u_char)(v)))
+#if 1
+#define ZWRITED(scc, v) (ZWRITE0((scc), 8), ZWRITE0((scc), (u_char)(v)))
+#else
+#define ZWRITED(scc, v) ((*((scc)->s_dr)) = (u_char)(v))
+#endif
#define ZBIS(scc, n, v) (ZWRITE(scc, n, (scc)->s_val[n] | (v)))
#define ZBIC(scc, n, v) (ZWRITE(scc, n, (scc)->s_val[n] & ~(v)))
diff --git a/sys/arch/mvme68k/dev/siop.c b/sys/arch/mvme68k/dev/siop.c
index be0b8b32d9f..ae301b515e6 100644
--- a/sys/arch/mvme68k/dev/siop.c
+++ b/sys/arch/mvme68k/dev/siop.c
@@ -1,4 +1,4 @@
-/* $NetBSD: siop.c,v 1.23 1995/08/18 15:28:08 chopps Exp $ */
+/* $Id: siop.c,v 1.2 1995/11/07 08:49:31 deraadt Exp $ */
/*
* Copyright (c) 1994 Michael L. Hitch
diff --git a/sys/arch/mvme68k/dev/siop_script.ss b/sys/arch/mvme68k/dev/siop_script.ss
index f43c74bfe10..fa9c5f1301b 100644
--- a/sys/arch/mvme68k/dev/siop_script.ss
+++ b/sys/arch/mvme68k/dev/siop_script.ss
@@ -1,4 +1,4 @@
-; $NetBSD: siop_script.ss,v 1.3 1995/08/18 15:28:11 chopps Exp $
+; $Id: siop_script.ss,v 1.2 1995/11/07 08:49:32 deraadt Exp $
;
; Copyright (c) 1995 Michael L. Hitch
diff --git a/sys/arch/mvme68k/dev/siopdma.c b/sys/arch/mvme68k/dev/siopdma.c
index 439c4a9d3ea..be86ae23008 100644
--- a/sys/arch/mvme68k/dev/siopdma.c
+++ b/sys/arch/mvme68k/dev/siopdma.c
@@ -1,4 +1,4 @@
-/* $NetBSD: afsc.c,v 1.6 1995/02/12 19:19:00 chopps Exp $ */
+/* $Id: siopdma.c,v 1.2 1995/11/07 08:49:32 deraadt Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
diff --git a/sys/arch/mvme68k/dev/siopreg.h b/sys/arch/mvme68k/dev/siopreg.h
index 0fce258fbc5..f83f4ec40b6 100644
--- a/sys/arch/mvme68k/dev/siopreg.h
+++ b/sys/arch/mvme68k/dev/siopreg.h
@@ -1,6 +1,7 @@
-/* $NetBSD: siopreg.h,v 1.7 1995/08/18 15:28:13 chopps Exp $ */
+/* $Id: siopreg.h,v 1.2 1995/11/07 08:49:33 deraadt Exp $ */
/*
+ * Copyright (c) 1995 Theo de Raadt
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
diff --git a/sys/arch/mvme68k/dev/siopvar.h b/sys/arch/mvme68k/dev/siopvar.h
index af0b3c2fc22..f028eb65e74 100644
--- a/sys/arch/mvme68k/dev/siopvar.h
+++ b/sys/arch/mvme68k/dev/siopvar.h
@@ -1,6 +1,7 @@
-/* $NetBSD: siopvar.h,v 1.11 1995/08/18 15:28:14 chopps Exp $ */
+/* $Id: siopvar.h,v 1.2 1995/11/07 08:49:34 deraadt Exp $ */
/*
+ * Copyright (c) 1995 Theo de Raadt
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
*
diff --git a/sys/arch/mvme68k/dev/sram.c b/sys/arch/mvme68k/dev/sram.c
index 77299175e89..5eec35bf854 100644
--- a/sys/arch/mvme68k/dev/sram.c
+++ b/sys/arch/mvme68k/dev/sram.c
@@ -1,4 +1,4 @@
-/* $NetBSD$ */
+/* $Id: sram.c,v 1.2 1995/11/07 08:49:35 deraadt Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -14,7 +14,8 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by Theo de Raadt
+ * This product includes software developed under OpenBSD by
+ * Theo de Raadt for Willowglen Singapore.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
diff --git a/sys/arch/mvme68k/dev/vme.c b/sys/arch/mvme68k/dev/vme.c
index ddd4099dd63..36d7d974b0d 100644
--- a/sys/arch/mvme68k/dev/vme.c
+++ b/sys/arch/mvme68k/dev/vme.c
@@ -1,4 +1,4 @@
-/* $NetBSD$ */
+/* $Id: vme.c,v 1.2 1995/11/07 08:49:36 deraadt Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -14,7 +14,8 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by Theo de Raadt
+ * This product includes software developed under OpenBSD by
+ * Theo de Raadt for Willowglen Singapore.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
diff --git a/sys/arch/mvme68k/dev/vme.h b/sys/arch/mvme68k/dev/vme.h
index b49918247aa..3ec33970e38 100644
--- a/sys/arch/mvme68k/dev/vme.h
+++ b/sys/arch/mvme68k/dev/vme.h
@@ -1,4 +1,4 @@
-/* $NetBSD$ */
+/* $Id: vme.h,v 1.2 1995/11/07 08:49:37 deraadt Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -14,7 +14,8 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by Theo de Raadt
+ * This product includes software developed under OpenBSD by
+ * Theo de Raadt for Willowglen Singapore.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
diff --git a/sys/arch/mvme68k/dev/vmel.c b/sys/arch/mvme68k/dev/vmel.c
index 68fdb1cf7f2..dabe78930ef 100644
--- a/sys/arch/mvme68k/dev/vmel.c
+++ b/sys/arch/mvme68k/dev/vmel.c
@@ -1,4 +1,4 @@
-/* $NetBSD$ */
+/* $Id: vmel.c,v 1.2 1995/11/07 08:49:37 deraadt Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -14,7 +14,8 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by Theo de Raadt
+ * This product includes software developed under OpenBSD by
+ * Theo de Raadt for Willowglen Singapore.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
diff --git a/sys/arch/mvme68k/dev/vmes.c b/sys/arch/mvme68k/dev/vmes.c
index b4d6ac87725..23818bdad2d 100644
--- a/sys/arch/mvme68k/dev/vmes.c
+++ b/sys/arch/mvme68k/dev/vmes.c
@@ -1,4 +1,4 @@
-/* $NetBSD$ */
+/* $Id: vmes.c,v 1.2 1995/11/07 08:49:38 deraadt Exp $ */
/*
* Copyright (c) 1995 Theo de Raadt
@@ -14,7 +14,8 @@
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
- * This product includes software developed by Theo de Raadt
+ * This product includes software developed under OpenBSD by
+ * Theo de Raadt for Willowglen Singapore.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
diff --git a/sys/arch/mvme68k/dev/zs.c b/sys/arch/mvme68k/dev/zs.c
index 9a52dbd8f9c..dfc23c6b0a6 100644
--- a/sys/arch/mvme68k/dev/zs.c
+++ b/sys/arch/mvme68k/dev/zs.c
@@ -1,6 +1,7 @@
-/* $NetBSD: zs.c,v 1.1.1.1 1995/07/25 23:12:07 chuck Exp $ */
+/* $Id: zs.c,v 1.2 1995/11/07 08:49:39 deraadt Exp $ */
/*
+ * Copyright (c) 1995 Theo de Raadt
* Copyright (c) 1993 Paul Mackerras.
* All rights reserved.
*
@@ -12,7 +13,11 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed under OpenBSD by
+ * Theo de Raadt for Willowglen Singapore.
+ * 4. The name of the author may not be used to endorse or promote products
* derived from this software withough specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
@@ -43,17 +48,22 @@
#include <sys/fcntl.h>
#include <sys/device.h>
#include <machine/cpu.h>
+#include <machine/autoconf.h>
#include <dev/cons.h>
-#include <mvme68k/dev/iio.h>
#include <mvme68k/dev/scc.h>
+
+#include "pcc.h"
+#include "mc.h"
+
+#if NPCC > 0
#include <mvme68k/dev/pccreg.h>
+#endif
+#if NMC > 0
+#include <mvme68k/dev/mcreg.h>
+#endif
#include "zs.h"
-#if NZS > 0
-/*#define PCLK_FREQ 8333333*/
-#undef PCLK_FREQ /* XXXCDC */
-#define PCLK_FREQ 5000000
#define NZSLINE (NZS*2)
#define RECV_BUF 512
@@ -64,26 +74,24 @@
#define splzs() spl4()
struct zs {
- short flags; /* see below */
- char rr0; /* holds previous CTS, DCD state */
- unsigned char imask; /* mask for input chars */
- int nzs_open; /* # opens as /dev/zsn */
- int nkbd_open; /* # opens as a keyboard */
- int gsp_unit; /* unit to send kbd chars to */
- struct tty *tty; /* link to tty structure */
- struct sccregs scc; /* SCC shadow registers */
- u_char *rcv_get;
- u_char *rcv_put;
- u_char *rcv_end;
- volatile int rcv_count;
- int rcv_len;
- char *send_ptr;
- int send_count;
- int sent_count;
- volatile char modem_state;
- volatile char modem_change;
- volatile short hflags;
- char rcv_buf[RECV_BUF];
+ short flags; /* see below */
+ char rr0; /* holds previous CTS, DCD state */
+ u_char imask; /* mask for input chars */
+ int nzs_open; /* # opens as /dev/zsn */
+ struct tty *tty; /* link to tty structure */
+ struct sccregs scc; /* SCC shadow registers */
+ u_char *rcv_get;
+ u_char *rcv_put;
+ u_char *rcv_end;
+ volatile int rcv_count;
+ int rcv_len;
+ char *send_ptr;
+ int send_count;
+ int sent_count;
+ volatile char modem_state;
+ volatile char modem_change;
+ volatile short hflags;
+ char rcv_buf[RECV_BUF];
};
/* Bits in flags */
@@ -100,25 +108,37 @@ struct zs {
#define ZH_RXOVF 8 /* receiver buffer overflow */
struct zssoftc {
- struct device dev;
- struct zs zs[2];
+ struct device sc_dev;
+ struct zs sc_zs[2];
+ struct evcnt sc_intrcnt;
+ struct intrhand sc_ih;
+#if NPCC > 0
+ struct pccreg *sc_pcc;
+#endif
+#if NMC > 0
+ struct mcreg *sc_mc;
+#endif
+ int sc_flags;
};
+#define ZSSF_85230 1
struct tty *zs_tty[NZSLINE];
-struct termios zs_cons_termios;
-int zs_cons_unit = 0;
-int zs_is_console = 0;
-struct sccregs *zs_cons_scc;
+struct termios zs_cons_termios;
+int zs_cons_unit = 0;
+int zs_is_console = 0;
+struct sccregs *zs_cons_scc;
-int zsopen __P((dev_t, int, int, struct proc *));
-void zsstart __P((struct tty *));
-int zsparam __P((struct tty *, struct termios *));
-int zsirq __P((int unit));
-void zs_softint __P((void));
+int zsopen __P((dev_t, int, int, struct proc *));
+void zsstart __P((struct tty *));
+int zsparam __P((struct tty *, struct termios *));
+int zsirq __P((int unit));
+int zsregs __P((caddr_t va, int unit, volatile u_char **crp,
+ volatile u_char **drp));
+int zspclk __P((void));
-unsigned long sir_zs;
-void zs_softint();
+u_long sir_zs;
+void zs_softint __P((void));
#define zsunit(dev) (minor(dev) >> 1)
#define zsside(dev) (minor(dev) & 1)
@@ -126,8 +146,8 @@ void zs_softint();
/*
* Autoconfiguration stuff.
*/
-void zsattach __P((struct device *, struct device *, void *));
-int zsmatch __P((struct device *, void *, void *));
+void zsattach __P((struct device *, struct device *, void *));
+int zsmatch __P((struct device *, void *, void *));
struct cfdriver zscd = {
NULL, "zs", zsmatch, zsattach, DV_TTY, sizeof(struct zssoftc), 0
@@ -136,33 +156,59 @@ struct cfdriver zscd = {
int
zsmatch(parent, vcf, args)
struct device *parent;
- void *vcf, *args;
+ void *vcf, *args;
{
struct cfdata *cf = vcf;
+ struct confargs *ca = args;
- return !badbaddr((caddr_t) IIO_CFLOC_ADDR(cf));
+ return (!badvaddr(ca->ca_vaddr, 1));
}
void
zsattach(parent, self, args)
struct device *parent, *self;
- void *args;
+ void *args;
{
- struct zssoftc *dv;
+ struct zssoftc *sc;
struct zs *zp, *zc;
u_char ir;
volatile struct scc *scc;
- int zs_level = IIO_CFLOC_LEVEL(self->dv_cfdata);
-
- iio_print(self->dv_cfdata);
+ volatile u_char *scc_cr, *scc_dr;
+ struct confargs *ca = args;
+ int zs_level = ca->ca_ipl;
+ int size;
+ static int initirq = 0;
/* connect the interrupt */
- dv = (struct zssoftc *) self;
- pccintr_establish(PCCV_ZS, zsirq, zs_level, self->dv_unit);
- /* XXXCDC: needs some work to handle zs1 */
+ sc = (struct zssoftc *) self;
+
+ sc->sc_ih.ih_fn = zsirq;
+ sc->sc_ih.ih_arg = (void *)self->dv_unit;
+ sc->sc_ih.ih_ipl = zs_level;
+ switch (ca->ca_bustype) {
+#if NPCC > 0
+ case BUS_PCC:
+ pccintr_establish(PCCV_ZS, &sc->sc_ih);
+ sc->sc_pcc = (struct pccreg *)ca->ca_master;
+ break;
+#endif
+#if NMC > 0
+ case BUS_MC:
+ mcintr_establish(MCV_ZS, &sc->sc_ih);
+ sc->sc_mc = (struct mcreg *)ca->ca_master;
+ break;
+#endif
+ }
+
+ zp = &sc->sc_zs[0];
+ scc = (volatile struct scc *)ca->ca_vaddr;
- zp = &dv->zs[0];
- scc = (volatile struct scc *) IIO_CFLOC_ADDR(self->dv_cfdata);
+ /*
+ * the locations of the control and data register move around
+ * on different MVME models, so we generate independent pointers
+ * to them.
+ */
+ size = zsregs(ca->ca_vaddr, 0, &scc_cr, &scc_dr);
if (zs_is_console && self->dv_unit == zsunit(zs_cons_unit)) {
/* SCC is the console - it's already reset */
@@ -172,31 +218,65 @@ zsattach(parent, self, args)
zc->flags |= ZS_CONSOLE;
} else {
/* reset the SCC */
- scc->cr = 0;
- scc->cr = 9;
- scc->cr = 0xC0; /* hardware reset of SCC, both sides */
+ *(scc_cr + size) = 0;
+ *(scc_cr + size) = 9;
+ *(scc_cr + size) = 0xC0; /* hardware reset of SCC, both sides */
}
/* side A */
- zp->scc.s_adr = scc + 1;
+ zp->scc.s_cr = scc_cr + size;
+ zp->scc.s_dr = scc_dr + size;
zp->flags |= ZS_SIDEA | ZS_RESET;
/* side B */
++zp;
- zp->scc.s_adr = scc;
+ zp->scc.s_cr = scc_cr;
+ zp->scc.s_dr = scc_dr;
zp->flags |= ZS_RESET;
if (sir_zs == 0)
sir_zs = allocate_sir(zs_softint, 0);
+
printf("\n");
- ir = sys_pcc->zs_int;
- if ((ir & PCC_IMASK) != 0 && (ir & PCC_IMASK) != zs_level)
- panic("zs configured at different IPLs");
- sys_pcc->zs_int = zs_level | PCC_IENABLE | PCC_ZSEXTERN;
+ /*
+ * XXX we end up doing this twice... once for
+ * each ZS chip. We should really not turn interrupts on until
+ * we have initialized the last of the two chips. But then we
+ * will need to search the config system to see if we will be
+ * called for the 2nd chip... otherwise, a config without a zs1
+ * would never enable interrupts!
+ */
+ switch (ca->ca_bustype) {
+#if NPCC > 0
+ case BUS_PCC:
+ ir = sc->sc_pcc->pcc_zsirq;
+ if ((ir & PCC_IRQ_IPL) != 0 && (ir & PCC_IRQ_IPL) != zs_level)
+ panic("zs configured at different IPLs");
+ if (initirq)
+ break;
+ sc->sc_pcc->pcc_zsirq = zs_level | PCC_IRQ_IEN | PCC_ZS_PCCVEC;
+ break;
+#endif
+#if NMC > 0
+ case BUS_MC:
+ ir = sc->sc_mc->mc_zsirq;
+ if ((ir & MC_IRQ_IPL) != 0 && (ir & MC_IRQ_IPL) != zs_level)
+ panic("zs configured at different IPLs");
+ if (initirq)
+ break;
+ sc->sc_mc->mc_zsirq = zs_level | MC_IRQ_IEN;
+ break;
+#endif
+ }
+ initirq = 1;
+
+ evcnt_attach(&sc->sc_dev, "intr", &sc->sc_intrcnt);
}
-zs_ttydef(struct zs *zp)
+void
+zs_ttydef(zp)
+ struct zs *zp;
{
struct tty *tp = zp->tty;
@@ -223,26 +303,28 @@ struct tty *
zstty(dev)
dev_t dev;
{
-
if (minor(dev) < NZSLINE)
return (zs_tty[minor(dev)]);
-
return (NULL);
}
/* ARGSUSED */
-zsopen(dev_t dev, int flag, int mode, struct proc * p)
+int
+zsopen(dev, flag, mode, p)
+ dev_t dev;
+ int flag, mode;
+ struct proc *p;
{
register struct tty *tp;
int error;
struct zs *zp;
- struct zssoftc *dv;
+ struct zssoftc *sc;
- if (zsunit(dev) > zscd.cd_ndevs
- || (dv = (struct zssoftc *) zscd.cd_devs[zsunit(dev)]) == NULL)
- return ENODEV;
+ if (zsunit(dev) >= zscd.cd_ndevs ||
+ (sc = (struct zssoftc *) zscd.cd_devs[zsunit(dev)]) == NULL)
+ return (ENODEV);
- zp = &dv->zs[zsside(dev)];
+ zp = &sc->sc_zs[zsside(dev)];
if (zp->tty == NULL) {
zp->tty = ttymalloc();
zs_ttydef(zp);
@@ -257,15 +339,14 @@ zsopen(dev_t dev, int flag, int mode, struct proc * p)
zs_init(zp);
if ((zp->modem_state & SCC_DCD) != 0)
tp->t_state |= TS_CARR_ON;
- } else
- if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0)
- return (EBUSY);
+ } else if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0)
+ return (EBUSY);
error = ((*linesw[tp->t_line].l_open) (dev, tp));
if (error == 0)
++zp->nzs_open;
- return error;
+ return (error);
}
int
@@ -276,62 +357,63 @@ zsclose(dev, flag, mode, p)
{
struct zs *zp;
struct tty *tp;
- struct zssoftc *dv;
- int s;
+ struct zssoftc *sc;
+ int s;
- if (zsunit(dev) > zscd.cd_ndevs
- || (dv = (struct zssoftc *) zscd.cd_devs[zsunit(dev)]) == NULL)
- return ENODEV;
- zp = &dv->zs[zsside(dev)];
+ if (zsunit(dev) > zscd.cd_ndevs ||
+ (sc = (struct zssoftc *) zscd.cd_devs[zsunit(dev)]) == NULL)
+ return (ENODEV);
+ zp = &sc->sc_zs[zsside(dev)];
tp = zp->tty;
- if (zp->nkbd_open == 0) {
- (*linesw[tp->t_line].l_close) (tp, flag);
- s = splzs();
- if ((zp->flags & ZS_CONSOLE) == 0 && (tp->t_cflag & HUPCL) != 0)
- ZBIC(&zp->scc, 5, 0x82); /* drop DTR, RTS */
- ZBIC(&zp->scc, 3, 1); /* disable receiver */
- splx(s);
- ttyclose(tp);
- }
+ (*linesw[tp->t_line].l_close) (tp, flag);
+ s = splzs();
+ if ((zp->flags & ZS_CONSOLE) == 0 && (tp->t_cflag & HUPCL) != 0)
+ ZBIC(&zp->scc, 5, 0x82); /* drop DTR, RTS */
+ ZBIC(&zp->scc, 3, 1); /* disable receiver */
+ splx(s);
+ ttyclose(tp);
zp->nzs_open = 0;
return (0);
}
/*ARGSUSED*/
+int
zsread(dev, uio, flag)
- dev_t dev;
+ dev_t dev;
struct uio *uio;
- int flag;
+ int flag;
{
- struct zssoftc *dv = (struct zssoftc *) zscd.cd_devs[zsunit(dev)];
- struct zs *zp = &dv->zs[zsside(dev)];
+ struct zssoftc *sc = (struct zssoftc *) zscd.cd_devs[zsunit(dev)];
+ struct zs *zp = &sc->sc_zs[zsside(dev)];
struct tty *tp = zp->tty;
return ((*linesw[tp->t_line].l_read) (tp, uio, flag));
}
/*ARGSUSED*/
+int
zswrite(dev, uio, flag)
dev_t dev;
struct uio *uio;
int flag;
{
- struct zssoftc *dv = (struct zssoftc *) zscd.cd_devs[zsunit(dev)];
- struct zs *zp = &dv->zs[zsside(dev)];
+ struct zssoftc *sc = (struct zssoftc *) zscd.cd_devs[zsunit(dev)];
+ struct zs *zp = &sc->sc_zs[zsside(dev)];
struct tty *tp = zp->tty;
return ((*linesw[tp->t_line].l_write) (tp, uio, flag));
}
+int
zsioctl(dev, cmd, data, flag, p)
dev_t dev;
caddr_t data;
int cmd, flag;
struct proc *p;
{
- struct zssoftc *dv = (struct zssoftc *) zscd.cd_devs[zsunit(dev)];
- struct zs *zp = &dv->zs[zsside(dev)];
+ struct zssoftc *sc = (struct zssoftc *) zscd.cd_devs[zsunit(dev)];
+ struct zs *zp = &sc->sc_zs[zsside(dev)];
struct tty *tp = zp->tty;
register struct sccregs *scc = &zp->scc;
register int error, s;
@@ -379,15 +461,16 @@ zsioctl(dev, cmd, data, flag, p)
error = ENOTTY;
}
splx(s);
- return error;
+ return (error);
}
+int
zsparam(tp, t)
struct tty *tp;
struct termios *t;
{
- struct zssoftc *dv = (struct zssoftc *) zscd.cd_devs[zsunit(tp->t_dev)];
- struct zs *zp = &dv->zs[zsside(tp->t_dev)];
+ struct zssoftc *sc = (struct zssoftc *) zscd.cd_devs[zsunit(tp->t_dev)];
+ struct zs *zp = &sc->sc_zs[zsside(tp->t_dev)];
register int s;
zs_drain(zp);
@@ -398,21 +481,20 @@ zsparam(tp, t)
tp->t_cflag = t->c_cflag;
if ((tp->t_cflag & CCTS_OFLOW) == 0)
zp->hflags &= ~ZH_OBLOCK;
- else
- if ((zp->modem_state & 0x20) == 0)
- zp->hflags |= ZH_OBLOCK;
+ else if ((zp->modem_state & 0x20) == 0)
+ zp->hflags |= ZH_OBLOCK;
spltty();
zs_unblock(tp);
splx(s);
- return 0;
+ return (0);
}
void
zsstart(tp)
struct tty *tp;
{
- struct zssoftc *dv = (struct zssoftc *) zscd.cd_devs[zsunit(tp->t_dev)];
- struct zs *zp = &dv->zs[zsside(tp->t_dev)];
+ struct zssoftc *sc = (struct zssoftc *) zscd.cd_devs[zsunit(tp->t_dev)];
+ struct zs *zp = &sc->sc_zs[zsside(tp->t_dev)];
register int s, n;
s = spltty();
@@ -432,10 +514,12 @@ zsstart(tp)
splx(s);
}
-zsstop(struct tty * tp, int flag)
+zsstop(tp, flag)
+ struct tty *tp;
+ int flag;
{
- struct zssoftc *dv = (struct zssoftc *) zscd.cd_devs[zsunit(tp->t_dev)];
- struct zs *zp = &dv->zs[zsside(tp->t_dev)];
+ struct zssoftc *sc = (struct zssoftc *) zscd.cd_devs[zsunit(tp->t_dev)];
+ struct zs *zp = &sc->sc_zs[zsside(tp->t_dev)];
int s, n;
s = splzs();
@@ -478,7 +562,10 @@ zscc_init(zp, par)
struct sccregs *scc;
scc = &zp->scc;
- ZWRITE(scc, 2, 0);
+#ifdef MVME162
+ if (cputyp == CPU_162)
+ ZWRITE(scc, 2, MC_VECBASE+MCV_ZS);
+#endif
ZWRITE(scc, 10, 0);
ZWRITE(scc, 11, 0x50); /* rx & tx clock = brgen */
ZWRITE(scc, 14, 3); /* brgen enabled, from pclk */
@@ -500,11 +587,11 @@ zscc_params(scc, par)
/* disconnect - drop DTR & RTS, disable receiver */
ZBIC(scc, 5, 0x82);
ZBIC(scc, 3, 1);
- return 0xFF;
+ return (0xFF);
}
if ((par->c_cflag & CREAD) == 0)
ZBIC(scc, 3, 1);/* disable receiver */
- divisor = (PCLK_FREQ / 32 + (speed >> 1)) / speed - 2;
+ divisor = (zspclk() / 32 + (speed >> 1)) / speed - 2;
ZWRITE(scc, 12, divisor);
ZWRITE(scc, 13, divisor >> 8);
switch (par->c_cflag & CSIZE) {
@@ -537,11 +624,22 @@ zscc_params(scc, par)
ints |= SCC_DCD;
if ((par->c_cflag & CCTS_OFLOW) != 0)
ints |= SCC_CTS;
+#if 0
+ if (cputyp == CPU_162) {
+ ZWRITE(scc, 15, ints | 1);
+ /*
+ * now.. register 7 has become register 7': disable all
+ * 82530-only features for now
+ */
+ ZWRITE(scc, 7, 0x20);
+ }
+#endif
ZWRITE(scc, 15, ints);
- return imask;
+ return (imask);
}
-zscc_mget(register struct sccregs * scc)
+zscc_mget(scc)
+ register struct sccregs *scc;
{
int bits = 0, rr0;
@@ -556,10 +654,12 @@ zscc_mget(register struct sccregs * scc)
bits |= TIOCM_CTS;
if ((rr0 & SCC_DCD) != 0)
bits |= TIOCM_CAR;
- return bits;
+ return (bits);
}
-zscc_mset(register struct sccregs * scc, int bits)
+zscc_mset(scc, bits)
+ register struct sccregs *scc;
+ int bits;
{
if ((bits & TIOCM_LE) != 0)
ZBIS(scc, 3, SCC_RCVEN);
@@ -569,7 +669,9 @@ zscc_mset(register struct sccregs * scc, int bits)
ZBIS(scc, 5, SCC_RTS);
}
-zscc_mclr(register struct sccregs * scc, int bits)
+zscc_mclr(scc, bits)
+ register struct sccregs *scc;
+ int bits;
{
if ((bits & TIOCM_LE) != 0)
ZBIC(scc, 3, SCC_RCVEN);
@@ -579,15 +681,16 @@ zscc_mclr(register struct sccregs * scc, int bits)
ZBIC(scc, 5, SCC_RTS);
}
-zs_drain(register struct zs * zp)
+zs_drain(zp)
+ register struct zs *zp;
{
register int s;
zp->tty->t_state |= TS_DRAIN;
/* wait for Tx buffer empty and All sent bits to be set */
s = splzs();
- while ((ZREAD0(&zp->scc) & SCC_TXRDY) == 0
- || (ZREAD(&zp->scc, 1) & 1) == 0) {
+ while ((ZREAD0(&zp->scc) & SCC_TXRDY) == 0 ||
+ (ZREAD(&zp->scc, 1) & 1) == 0) {
splx(s);
DELAY(100);
s = splzs();
@@ -595,7 +698,8 @@ zs_drain(register struct zs * zp)
splx(s);
}
-zs_unblock(register struct tty * tp)
+zs_unblock(tp)
+ register struct tty *tp;
{
tp->t_state &= ~TS_DRAIN;
if (tp->t_outq.c_cc != 0)
@@ -606,36 +710,37 @@ zs_unblock(register struct tty * tp)
* Hardware interrupt from an SCC.
*/
int
-zsirq(int unit)
+zsirq(unit)
+ int unit;
{
- struct zssoftc *dv = (struct zssoftc *) zscd.cd_devs[unit];
- register struct zs *zp = &dv->zs[0];
+ struct zssoftc *sc = (struct zssoftc *) zscd.cd_devs[unit];
+ register struct zs *zp = &sc->sc_zs[0];
register int ipend, x;
- register volatile struct scc *scc;
- x = splzs();
- scc = zp->scc.s_adr;
- scc->cr = 3; /* read int pending from A side */
- DELAY(5);
- ipend = scc->cr;
+ ipend = ZREAD(&zp->scc, 3); /* read int pending from A side */
+ if (ipend == 0)
+ return (0);
if ((ipend & 0x20) != 0)
zs_rxint(zp);
if ((ipend & 0x10) != 0)
zs_txint(zp);
if ((ipend & 0x8) != 0)
zs_extint(zp);
- ++zp; /* now look for B side ints */
+ ++zp; /* now look for B side ints */
if ((ipend & 0x4) != 0)
zs_rxint(zp);
if ((ipend & 0x2) != 0)
zs_txint(zp);
if ((ipend & 0x1) != 0)
zs_extint(zp);
- splx(x);
- return ipend != 0;
+ ZWRITE0(&zp->scc, 0x38); /* reset highest IUS */
+
+ sc->sc_intrcnt.ev_count++;
+ return (1);
}
-zs_txint(register struct zs * zp)
+zs_txint(zp)
+ register struct zs *zp;
{
struct tty *tp = zp->tty;
struct sccregs *scc;
@@ -661,7 +766,8 @@ zs_txint(register struct zs * zp)
}
}
-zs_rxint(register struct zs * zp)
+zs_rxint(zp)
+ register struct zs *zp;
{
register int stat, c, n, extra;
u_char *put;
@@ -707,7 +813,8 @@ zs_rxint(register struct zs * zp)
}
/* Ext/status interrupt */
-zs_extint(register struct zs * zp)
+zs_extint(zp)
+ register struct zs *zp;
{
int rr0;
struct tty *tp = zp->tty;
@@ -742,7 +849,7 @@ zs_softint()
for (unit = 0; unit < zscd.cd_ndevs; ++unit) {
if (zscd.cd_devs[unit] == NULL)
continue;
- zp = &((struct zssoftc *) zscd.cd_devs[unit])->zs[0];
+ zp = &((struct zssoftc *) zscd.cd_devs[unit])->sc_zs[0];
for (side = 0; side < 2; ++side, ++zp) {
if ((zp->hflags & ZH_SIRQ) == 0)
continue;
@@ -791,10 +898,6 @@ zs_softint()
if (tp == NULL || (tp->t_state & TS_ISOPEN) == 0)
continue;
if (zp->nzs_open == 0) {
-#ifdef notdef
- if (stat == 0)
- kbd_newchar(zp->gsp_unit, c);
-#endif
} else {
if ((stat & 0x10) != 0)
c |= TTY_PE;
@@ -832,49 +935,6 @@ zs_softint()
}
/*
- * Routines to divert an SCC channel to the input side of /dev/gsp
- * for the keyboard.
- */
-int
-zs_kbdopen(int unit, int gsp_unit, struct termios * tiop, struct proc * p)
-{
- struct zssoftc *dv = (struct zssoftc *) zscd.cd_devs[zsunit(unit)];
- struct zs *zp = &dv->zs[zsside(unit)];
- int error;
-
- error = zsopen(unit, 0, 0, p);
- if (error != 0)
- return error;
- ++zp->nkbd_open;
- --zp->nzs_open;
- zsparam(zp->tty, tiop);
- zp->gsp_unit = gsp_unit;
- return 0;
-}
-
-void
-zs_kbdclose(int unit)
-{
- struct zssoftc *dv = (struct zssoftc *) zscd.cd_devs[zsunit(unit)];
- struct zs *zp = &dv->zs[zsside(unit)];
-
- zp->nkbd_open = 0;
- if (zp->nzs_open == 0)
- zsclose(unit, 0, 0, 0);
-}
-
-void
-zs_kbdput(int unit, int c)
-{
- struct zssoftc *dv = (struct zssoftc *) zscd.cd_devs[zsunit(unit)];
- struct zs *zp = &dv->zs[zsside(unit)];
- struct tty *tp = zp->tty;
-
- putc(c, &tp->t_outq);
- zsstart(tp);
-}
-
-/*
* Routines for using side A of the first SCC as a console.
*/
@@ -882,9 +942,16 @@ zs_kbdput(int unit, int c)
zscnprobe(cp)
struct consdev *cp;
{
- int maj;
- char *prom_cons;
- extern char *prom_getvar();
+ int maj;
+
+ switch (cputyp) {
+ case CPU_147:
+ case CPU_162:
+ break;
+ default:
+ cp->cn_pri = CN_DEAD;
+ return (0);
+ }
/* locate the major number */
for (maj = 0; maj < nchrdev; maj++)
@@ -893,16 +960,16 @@ zscnprobe(cp)
/* initialize required fields */
cp->cn_dev = makedev(maj, 0);
- cp->cn_pri = CN_NORMAL;
+ cp->cn_pri = CN_INTERNAL; /* better than PROM console */
- return 1;
+ return (1);
}
/* initialize the keyboard for use as the console */
struct termios zscn_termios = {
TTYDEF_IFLAG,
TTYDEF_OFLAG,
- TTYDEF_CFLAG,
+ (CREAD | CS8 | HUPCL),
TTYDEF_LFLAG,
{0},
TTYDEF_SPEED,
@@ -912,9 +979,6 @@ struct termios zscn_termios = {
struct sccregs zs_cons_sccregs;
int zs_cons_imask;
-unsigned zs_cons_addrs[] = {ZS0_PHYS, ZS1_PHYS};
-
-
zscninit()
{
zs_cnsetup(0, &zscn_termios);
@@ -922,12 +986,13 @@ zscninit()
/* Polling routine for console input from a serial port. */
int
-zscngetc(dev_t dev)
+zscngetc(dev)
+ dev_t dev;
{
register struct sccregs *scc = zs_cons_scc;
int c, s, stat;
- s = splzs();
+ s = splhigh(); /* XXX was splzs() */
for (;;) {
while ((ZREAD0(scc) & SCC_RXFULL) == 0) /* wait for Rx full */
;
@@ -939,39 +1004,56 @@ zscngetc(dev_t dev)
ZWRITE0(scc, 0x30); /* reset error */
}
splx(s);
- return c;
+ return (c);
}
-zscnputc(dev_t dev, int c)
+zscnputc(dev, c)
+ dev_t dev;
+ int c;
{
register struct sccregs *scc = zs_cons_scc;
int s;
- s = splzs();
- while ((ZREAD0(scc) & SCC_TXRDY) == 0);
+ s = splhigh(); /* XXX was splzs() */
+ while ((ZREAD0(scc) & SCC_TXRDY) == 0)
+ ;
ZWRITED(scc, c);
splx(s);
}
-zs_cnsetup(int unit, struct termios * tiop)
+zs_cnsetup(unit, tiop)
+ int unit;
+ struct termios *tiop;
{
- register volatile struct scc *scc_adr;
- register struct sccregs *scc;
+ volatile u_char *scc_cr, *scc_dr;
+ struct sccregs *scc;
+ int size;
zs_cons_unit = unit;
zs_is_console = 1;
zs_cons_scc = scc = &zs_cons_sccregs;
- scc_adr = (volatile struct scc *) IIOV(zs_cons_addrs[zsunit(unit)]);
-
- scc_adr[1].cr = 0;
- scc_adr[1].cr = 9;
- scc_adr[1].cr = 0xC0; /* hardware reset of SCC, both sides */
- if (!zsside(unit))
- ++scc_adr;
+ /*
+ * the locations of the control and data register move around
+ * on different MVME models, so we generate independent pointers
+ * to them.
+ */
+ size = zsregs(NULL, unit, &scc_cr, &scc_dr);
+
+ *(scc_cr + size) = 0;
+ *(scc_cr + size) = 9;
+ *(scc_cr + size) = 0xC0; /* hardware reset of SCC, both sides */
+ if (!zsside(unit)) {
+ scc_cr += size;
+ scc_dr += size;
+ }
- scc->s_adr = scc_adr;
- ZWRITE(scc, 2, 0);
+ scc->s_cr = scc_cr;
+ scc->s_dr = scc_dr;
+#ifdef MVME162
+ if (cputyp == CPU_162)
+ ZWRITE(scc, 2, MC_VECBASE+MCV_ZS);
+#endif
ZWRITE(scc, 10, 0);
ZWRITE(scc, 11, 0x50); /* rx & tx clock = brgen */
ZWRITE(scc, 14, 3); /* brgen enabled, from pclk */
@@ -981,16 +1063,74 @@ zs_cnsetup(int unit, struct termios * tiop)
zs_cons_termios = *tiop;/* save for later */
}
+#ifdef MVME147
+u_long zs_cons_addrs_147[] = { ZS0_PHYS_147, ZS1_PHYS_147 };
+#endif
+#ifdef MVME162
+u_long zs_cons_addrs_162[] = { ZS0_PHYS_162, ZS1_PHYS_162 };
+#endif
+
/*
- * Routines for using the keyboard SCC as the input side of
- * the 'gsp' console device.
+ * fills in pointers to the registers and returns how far apart
+ * the two halves of the chip are.
+ *
+ * it vaddr == NULL, it tries to determine the hardware address in
+ * an intelligent fashion from the unit number.
*/
+int
+zsregs(va, unit, crp, drp)
+ caddr_t va;
+ int unit;
+ volatile u_char **crp, **drp;
+{
+#ifdef MVME147
+ volatile struct scc_147 *scc_adr_147;
+#endif
+#ifdef MVME162
+ volatile struct scc_162 *scc_adr_162;
+#endif
+ volatile u_char *scc_cr, *scc_dr;
+ int size;
+
+ switch (cputyp) {
+#ifdef MVME147
+ case CPU_147:
+ if (!va)
+ va = (caddr_t)IIOV(zs_cons_addrs_147[zsunit(unit)]);
+ scc_adr_147 = (volatile struct scc_147 *)va;
+ scc_cr = &scc_adr_147->cr;
+ scc_dr = &scc_adr_147->dr;
+ size = sizeof(struct scc_147);
+ break;
+#endif
+#ifdef MVME162
+ case CPU_162:
+ if (!va)
+ va = (caddr_t)IIOV(zs_cons_addrs_162[zsunit(unit)]);
+ scc_adr_162 = (volatile struct scc_162 *)va;
+ scc_cr = &scc_adr_162->cr;
+ scc_dr = &scc_adr_162->dr;
+ size = sizeof(struct scc_162);
+ break;
+#endif
+ }
-/* probe for the keyboard; should check hardware */
-zs_kbdcnprobe(cp, unit)
- struct consdev *cp;
- int unit;
+ *crp = scc_cr;
+ *drp = scc_dr;
+ return (size);
+}
+
+int
+zspclk()
{
- return (unsigned) unit < NZSLINE;
+ switch (cputyp) {
+#ifdef MVME147
+ case CPU_147:
+ return (PCLK_FREQ_147);
+#endif
+#ifdef MVME162
+ case CPU_162:
+ return (PCLK_FREQ_162);
+#endif
+ }
}
-#endif /* NZS */