Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/nathanw_sa]: src/sys/arch/vax Add a VAXANY type. Eventually to used in ...
details: https://anonhg.NetBSD.org/src/rev/9b3b990000bd
branches: nathanw_sa
changeset: 504672:9b3b990000bd
user: matt <matt%NetBSD.org@localhost>
date: Wed May 16 05:36:56 2001 +0000
description:
Add a VAXANY type. Eventually to used in INSTALL / GENERIC to easily
include support for all VAX platforms
diffstat:
sys/arch/vax/include/ioa.h | 119 ++++++++++++++++
sys/arch/vax/vax/clock.c | 328 +++++++++++++++++++++++++++++++++++++++++++++
sys/arch/vax/vsa/leds.c | 156 +++++++++++++++++++++
3 files changed, 603 insertions(+), 0 deletions(-)
diffs (truncated from 615 to 300 lines):
diff -r 42c95bf9eb6e -r 9b3b990000bd sys/arch/vax/include/ioa.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/vax/include/ioa.h Wed May 16 05:36:56 2001 +0000
@@ -0,0 +1,119 @@
+/* $NetBSD: ioa.h,v 1.8.8.2 2001/05/16 05:36:58 matt Exp $ */
+/*-
+ * Copyright (c) 1982, 1986 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * 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 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 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
+ * 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.
+ *
+ * @(#)ioa.h 7.3 (Berkeley) 5/9/91
+ */
+
+/****************************************************************
+ * *
+ * Licensed from Digital Equipment Corporation *
+ * Copyright (c) *
+ * Digital Equipment Corporation *
+ * Maynard, Massachusetts *
+ * 1985, 1986 *
+ * All rights reserved. *
+ * *
+ * The Information in this software is subject to change *
+ * without notice and should not be construed as a commitment *
+ * by Digital Equipment Corporation. Digital makes no *
+ * representations about the suitability of this software for *
+ * any purpose. It is supplied "As Is" without expressed or *
+ * implied warranty. *
+ * *
+ * If the Regents of the University of California or its *
+ * licensees modify the software in a manner creating *
+ * derivative copyright rights, appropriate copyright *
+ * legends may be placed on the derivative work in addition *
+ * to that set forth above. *
+ * *
+ ****************************************************************/
+
+#include "opt_cputype.h"
+#if VAX8600 || VAXANY
+#define MAXNIOA 4
+#define NIOA8600 2
+#define IOASIZE 0x2000000
+#define IOAMAPSIZ 512 /* Map one page to get at SBIA regs */
+#define IOA8600(i) ((caddr_t)(0x20080000+IOASIZE*i))
+
+struct sbia_regs
+{
+ int sbi_cfg;
+ int sbi_csr;
+ int sbi_errsum;
+ int sbi_dctl;
+ int sbi_dmaica;
+ int sbi_dmaiid;
+ int sbi_dmaaca;
+ int sbi_dmaaid;
+ int sbi_dmabcs;
+ int sbi_dmabid;
+ int sbi_dmaccs;
+ int sbi_dmacid;
+ int sbi_silo;
+ int sbi_error;
+ int sbi_timo;
+ int sbi_fltsts;
+ int sbi_silcmp;
+ int sbi_maint;
+ int sbi_unjam;
+ int sbi_qclr;
+ int sbi_unused[12];
+ int sbi_iv10;
+ int sbi_iv11;
+ int sbi_iv12;
+ int sbi_iv13;
+ int sbi_iv14;
+ int sbi_iv15;
+ int sbi_iv16;
+ int sbi_iv17;
+ int sbi_iv18;
+ int sbi_iv19;
+ int sbi_iv1a;
+ int sbi_iv1b;
+ int sbi_iv1c;
+ int sbi_iv1d;
+ int sbi_iv1e;
+};
+struct ioa {
+ union ioacsr {
+ long ioa_csr;
+ u_char ioa_type;
+ } ioacsr;
+ long ioa_pad[IOAMAPSIZ / sizeof (long) - 1];
+};
+
+#define IOA_TYPMSK 0xf0
+#define IOA_SBIA 0x10
+
+#endif /* VAX8600 */
diff -r 42c95bf9eb6e -r 9b3b990000bd sys/arch/vax/vax/clock.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/vax/vax/clock.c Wed May 16 05:36:56 2001 +0000
@@ -0,0 +1,328 @@
+/* $NetBSD: clock.c,v 1.40.8.2 2001/05/16 05:36:56 matt Exp $ */
+/*
+ * Copyright (c) 1995 Ludd, University of Lule}, Sweden.
+ * All rights reserved.
+ *
+ * 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 at Ludd, University of Lule}.
+ * 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.
+ */
+
+
+#include <sys/param.h>
+#include <sys/kernel.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+
+#include <dev/clock_subr.h>
+
+#include <machine/mtpr.h>
+#include <machine/sid.h>
+#include <machine/clock.h>
+#include <machine/cpu.h>
+#include <machine/uvax.h>
+
+#include "opt_cputype.h"
+
+struct evcnt clock_intrcnt =
+ EVCNT_INITIALIZER(EVCNT_TYPE_INTR, NULL, "clock", "intr");
+
+/*
+ * microtime() should return number of usecs in struct timeval.
+ * We may get wrap-arounds, but that will be fixed with lasttime
+ * check. This may fault within 10 msecs.
+ */
+void
+microtime(tvp)
+ struct timeval *tvp;
+{
+ int s, i;
+ static struct timeval lasttime;
+
+ s = splhigh();
+ bcopy((caddr_t)&time, tvp, sizeof(struct timeval));
+
+ switch (vax_boardtype) {
+#if VAX46 || VAXANY
+ case VAX_BTYP_46: {
+ extern struct vs_cpu *ka46_cpu;
+ i = *(volatile int *)(&ka46_cpu->vc_diagtimu);
+ i = (i >> 16) * 1024 + (i & 0x3ff);
+ break;
+ }
+#endif
+#if VAX48 || VAXANY
+ case VAX_BTYP_48: {
+ /*
+ * PR_ICR doesn't exist. We could use the vc_diagtimu
+ * counter, saving the value on the timer interrupt and
+ * subtracting that from the current value.
+ */
+ i = 0;
+ break;
+ }
+#endif
+ default:
+ i = mfpr(PR_ICR);
+ break;
+ }
+ i += tick; /* Get current interval count */
+ tvp->tv_usec += i;
+ while (tvp->tv_usec >= 1000000) {
+ tvp->tv_sec++;
+ tvp->tv_usec -= 1000000;
+ }
+ if (tvp->tv_sec == lasttime.tv_sec &&
+ tvp->tv_usec <= lasttime.tv_usec &&
+ (tvp->tv_usec = lasttime.tv_usec + 1) >= 1000000) {
+ tvp->tv_sec++;
+ tvp->tv_usec -= 1000000;
+ }
+ bcopy(tvp, &lasttime, sizeof(struct timeval));
+ splx(s);
+}
+
+/*
+ * Sets year to the year in fs_time and then calculates the number of
+ * 100th of seconds in the current year and saves that info in year_len.
+ * fs_time contains the time set in the superblock in the root filesystem.
+ * If the clock is started, it then checks if the time is valid
+ * compared with the time in fs_time. If the clock is stopped, an
+ * alert is printed and the time is temporary set to the time in fs_time.
+ */
+
+void
+inittodr(fs_time)
+ time_t fs_time;
+{
+ int rv;
+
+ rv = (*dep_call->cpu_clkread) (fs_time);
+ switch (rv) {
+
+ case CLKREAD_BAD: /* No useable information from system clock */
+ time.tv_sec = fs_time;
+ resettodr();
+ break;
+
+ case CLKREAD_WARN: /* Just give the warning */
+ break;
+
+ default: /* System clock OK, no warning if we don't want to. */
+ if (time.tv_sec > fs_time + 3 * SEC_PER_DAY) {
+ printf("Clock has gained %ld days",
+ (time.tv_sec - fs_time) / SEC_PER_DAY);
+ rv = CLKREAD_WARN;
+ } else if (time.tv_sec + SEC_PER_DAY < fs_time) {
+ printf("Clock has lost %ld day(s)",
+ (fs_time - time.tv_sec) / SEC_PER_DAY);
+ rv = CLKREAD_WARN;
+ }
+ break;
+ }
+
+ if (rv < CLKREAD_OK)
+ printf(" - CHECK AND RESET THE DATE.\n");
+}
+
+/*
+ * Resettodr restores the time of day hardware after a time change.
+ */
+
+void
+resettodr()
+{
+ (*dep_call->cpu_clkwrite)();
+}
+/*
+ * A delayloop that delays about the number of milliseconds that is
+ * given as argument.
+ */
+void
+delay(i)
+ int i;
+{
+ asm ("1: sobgtr %0, 1b" : : "r" (dep_call->cpu_vups * i));
+}
+
+/*
+ * On all VAXen there are a microsecond clock that should
+ * be used for interval interrupts. Some CPUs don't use the ICR interval
+ * register but it doesn't hurt to load it anyway.
+ */
Home |
Main Index |
Thread Index |
Old Index