summaryrefslogtreecommitdiff
path: root/sys/arch/amiga/dev
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/amiga/dev')
-rw-r--r--sys/arch/amiga/dev/afsc.c4
-rw-r--r--sys/arch/amiga/dev/ahsc.c4
-rw-r--r--sys/arch/amiga/dev/ahscreg.h1
-rw-r--r--sys/arch/amiga/dev/atzsc.c4
-rw-r--r--sys/arch/amiga/dev/atzscreg.h1
-rw-r--r--sys/arch/amiga/dev/bzsc.c25
-rw-r--r--sys/arch/amiga/dev/bztzsc.c429
-rw-r--r--sys/arch/amiga/dev/bztzscreg.h (renamed from sys/arch/amiga/dev/gen_cvtab.c)59
-rw-r--r--sys/arch/amiga/dev/bztzscvar.h50
-rw-r--r--sys/arch/amiga/dev/clock.c316
-rw-r--r--sys/arch/amiga/dev/clockioctl.h1
-rw-r--r--sys/arch/amiga/dev/dmavar.h1
-rw-r--r--sys/arch/amiga/dev/drcom.c1285
-rw-r--r--sys/arch/amiga/dev/drcomvar.h40
-rw-r--r--sys/arch/amiga/dev/drisavar.h23
-rw-r--r--sys/arch/amiga/dev/drsc.c8
-rw-r--r--sys/arch/amiga/dev/empsc.c4
-rw-r--r--sys/arch/amiga/dev/event.c3
-rw-r--r--sys/arch/amiga/dev/event_var.h3
-rw-r--r--sys/arch/amiga/dev/fd.c4
-rw-r--r--sys/arch/amiga/dev/flsc.c4
-rw-r--r--sys/arch/amiga/dev/genpar.c1
-rw-r--r--sys/arch/amiga/dev/grf.c4
-rw-r--r--sys/arch/amiga/dev/grf_cc.c4
-rw-r--r--sys/arch/amiga/dev/grf_cl.c14
-rw-r--r--sys/arch/amiga/dev/grf_clreg.h4
-rw-r--r--sys/arch/amiga/dev/grf_cv.c35
-rw-r--r--sys/arch/amiga/dev/grf_et.c381
-rw-r--r--sys/arch/amiga/dev/grf_etreg.h165
-rw-r--r--sys/arch/amiga/dev/grf_rh.c77
-rw-r--r--sys/arch/amiga/dev/grf_rt.c6
-rw-r--r--sys/arch/amiga/dev/grf_ul.c11
-rw-r--r--sys/arch/amiga/dev/grf_ulreg.h8
-rw-r--r--sys/arch/amiga/dev/grf_ultms.g8
-rw-r--r--sys/arch/amiga/dev/grfabs_cc.c4
-rw-r--r--sys/arch/amiga/dev/grfabs_ccreg.h1
-rw-r--r--sys/arch/amiga/dev/grfioctl.h3
-rw-r--r--sys/arch/amiga/dev/gtsc.c4
-rw-r--r--sys/arch/amiga/dev/gtscreg.h1
-rw-r--r--sys/arch/amiga/dev/gvpbus.c4
-rw-r--r--sys/arch/amiga/dev/gvpbusvar.h1
-rw-r--r--sys/arch/amiga/dev/idesc.c4
-rw-r--r--sys/arch/amiga/dev/if_ae.c47
-rw-r--r--sys/arch/amiga/dev/if_aereg.h1
-rw-r--r--sys/arch/amiga/dev/if_bah.c112
-rw-r--r--sys/arch/amiga/dev/if_bahreg.h1
-rw-r--r--sys/arch/amiga/dev/if_ed.c27
-rw-r--r--sys/arch/amiga/dev/if_edreg.h1
-rw-r--r--sys/arch/amiga/dev/if_es.c26
-rw-r--r--sys/arch/amiga/dev/if_esreg.h1
-rw-r--r--sys/arch/amiga/dev/if_le.c4
-rw-r--r--sys/arch/amiga/dev/if_le_zbus.c4
-rw-r--r--sys/arch/amiga/dev/if_qn.c77
-rw-r--r--sys/arch/amiga/dev/if_qnreg.h3
-rw-r--r--sys/arch/amiga/dev/ite.c10
-rw-r--r--sys/arch/amiga/dev/ite_et.c3
-rw-r--r--sys/arch/amiga/dev/ite_ul.c6
-rw-r--r--sys/arch/amiga/dev/iteioctl.h1
-rw-r--r--sys/arch/amiga/dev/ivsc.c4
-rw-r--r--sys/arch/amiga/dev/kbd.c8
-rw-r--r--sys/arch/amiga/dev/kbdreg.h1
-rw-r--r--sys/arch/amiga/dev/kf_8x11.c1
-rw-r--r--sys/arch/amiga/dev/kf_8x8.c1
-rw-r--r--sys/arch/amiga/dev/mfc.c4
-rw-r--r--sys/arch/amiga/dev/mlhsc.c4
-rw-r--r--sys/arch/amiga/dev/ms.c4
-rw-r--r--sys/arch/amiga/dev/msc.c1501
-rw-r--r--sys/arch/amiga/dev/msc6502.h407
-rw-r--r--sys/arch/amiga/dev/mscreg.h30
-rw-r--r--sys/arch/amiga/dev/otgsc.c4
-rw-r--r--sys/arch/amiga/dev/par.c4
-rw-r--r--sys/arch/amiga/dev/parioctl.h1
-rw-r--r--sys/arch/amiga/dev/rtmondefs.c1
-rw-r--r--sys/arch/amiga/dev/rtmons1
-rw-r--r--sys/arch/amiga/dev/sbic.c17
-rw-r--r--sys/arch/amiga/dev/sbicreg.h1
-rw-r--r--sys/arch/amiga/dev/sci.c4
-rw-r--r--sys/arch/amiga/dev/scireg.h1
-rw-r--r--sys/arch/amiga/dev/scsidefs.h0
-rw-r--r--sys/arch/amiga/dev/ser.c18
-rw-r--r--sys/arch/amiga/dev/serreg.h1
-rw-r--r--sys/arch/amiga/dev/sfas.c7
-rw-r--r--sys/arch/amiga/dev/siop.c4
-rw-r--r--sys/arch/amiga/dev/siop_script.ss1
-rw-r--r--sys/arch/amiga/dev/view.c4
-rw-r--r--sys/arch/amiga/dev/viewvar.h1
-rw-r--r--sys/arch/amiga/dev/vuid_event.h1
-rw-r--r--sys/arch/amiga/dev/wesc.c4
-rw-r--r--sys/arch/amiga/dev/wstsc.c4
-rw-r--r--sys/arch/amiga/dev/zbus.c29
-rw-r--r--sys/arch/amiga/dev/zbusvar.h1
-rw-r--r--sys/arch/amiga/dev/zssc.c4
92 files changed, 3630 insertions, 1781 deletions
diff --git a/sys/arch/amiga/dev/afsc.c b/sys/arch/amiga/dev/afsc.c
index d139aa802e6..5fadc11ab20 100644
--- a/sys/arch/amiga/dev/afsc.c
+++ b/sys/arch/amiga/dev/afsc.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: afsc.c,v 1.6 1996/11/23 21:45:05 kstailey Exp $ */
-/* $NetBSD: afsc.c,v 1.14 1996/04/21 21:10:48 veego Exp $ */
+/* $OpenBSD: afsc.c,v 1.7 1997/01/16 09:23:42 niklas Exp $ */
+/* $NetBSD: afsc.c,v 1.20 1996/12/23 09:09:49 veego Exp $ */
/*
* Copyright (c) 1994 Michael L. Hitch
diff --git a/sys/arch/amiga/dev/ahsc.c b/sys/arch/amiga/dev/ahsc.c
index aa1dd49090d..f3e698a1b16 100644
--- a/sys/arch/amiga/dev/ahsc.c
+++ b/sys/arch/amiga/dev/ahsc.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: ahsc.c,v 1.4 1996/11/23 21:45:05 kstailey Exp $ */
-/* $NetBSD: ahsc.c,v 1.12 1996/04/21 21:10:49 veego Exp $ */
+/* $OpenBSD: ahsc.c,v 1.5 1997/01/16 09:23:43 niklas Exp $ */
+/* $NetBSD: ahsc.c,v 1.18 1996/12/23 09:09:51 veego Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
diff --git a/sys/arch/amiga/dev/ahscreg.h b/sys/arch/amiga/dev/ahscreg.h
index 81bcab615c9..63ec2ffa932 100644
--- a/sys/arch/amiga/dev/ahscreg.h
+++ b/sys/arch/amiga/dev/ahscreg.h
@@ -1,3 +1,4 @@
+/* $OpenBSD: ahscreg.h,v 1.3 1997/01/16 09:23:44 niklas Exp $ */
/* $NetBSD: ahscreg.h,v 1.2 1994/10/26 02:02:46 cgd Exp $ */
/*
diff --git a/sys/arch/amiga/dev/atzsc.c b/sys/arch/amiga/dev/atzsc.c
index fbc439a4089..44e22e3bd3e 100644
--- a/sys/arch/amiga/dev/atzsc.c
+++ b/sys/arch/amiga/dev/atzsc.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: atzsc.c,v 1.4 1996/11/23 21:45:06 kstailey Exp $ */
-/* $NetBSD: atzsc.c,v 1.16 1996/04/21 21:10:51 veego Exp $ */
+/* $OpenBSD: atzsc.c,v 1.5 1997/01/16 09:23:45 niklas Exp $ */
+/* $NetBSD: atzsc.c,v 1.22 1996/12/23 09:09:52 veego Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
diff --git a/sys/arch/amiga/dev/atzscreg.h b/sys/arch/amiga/dev/atzscreg.h
index 13666b4154a..4fcfc54c191 100644
--- a/sys/arch/amiga/dev/atzscreg.h
+++ b/sys/arch/amiga/dev/atzscreg.h
@@ -1,3 +1,4 @@
+/* $OpenBSD: atzscreg.h,v 1.2 1997/01/16 09:23:46 niklas Exp $ */
/* $NetBSD: atzscreg.h,v 1.2 1994/10/26 02:02:49 cgd Exp $ */
/*
diff --git a/sys/arch/amiga/dev/bzsc.c b/sys/arch/amiga/dev/bzsc.c
index 997e96a7ca0..d1d0311cb01 100644
--- a/sys/arch/amiga/dev/bzsc.c
+++ b/sys/arch/amiga/dev/bzsc.c
@@ -1,6 +1,6 @@
-/* $OpenBSD: bzsc.c,v 1.4 1996/11/23 21:45:06 kstailey Exp $ */
+/* $OpenBSD: bzsc.c,v 1.5 1997/01/16 09:23:48 niklas Exp $ */
-/* $NetBSD: bzsc.c,v 1.7 1996/04/21 21:10:52 veego Exp $ */
+/* $NetBSD: bzsc.c,v 1.14 1996/12/23 09:09:53 veego Exp $ */
/*
* Copyright (c) 1995 Daniel Widenfalk
@@ -59,7 +59,7 @@
#include <amiga/dev/bzscreg.h>
#include <amiga/dev/bzscvar.h>
-int bzscprint __P((void *auxp, const char *));
+int bzscprint __P((void *auxp, const char *));
void bzscattach __P((struct device *, struct device *, void *));
int bzscmatch __P((struct device *, void *, void *));
@@ -104,15 +104,26 @@ bzscmatch(pdp, match, auxp)
void *match, *auxp;
{
struct zbus_args *zap;
+ vu_char *ta;
if (!is_a1200())
return(0);
zap = auxp;
- if (zap->manid == 0x2140 && zap->prodid == 11)
- return(1);
+ if (zap->manid != 0x2140 || zap->prodid != 11)
+ return(0);
+
+ ta = (vu_char *)(((char *)zap->va)+0x10010);
+ if (badbaddr((caddr_t)ta))
+ return(0);
- return(0);
+ *ta = 0;
+ *ta = 1;
+ DELAY(5);
+ if (*ta != 1)
+ return(0);
+
+ return(1);
}
void
@@ -336,7 +347,7 @@ do { chain[n].ptr = (p); chain[n].len = (l); chain[n++].flg = (f); } while(0)
if (l < 512)
set_link(n, (vm_offset_t)p, l, SFAS_CHAIN_BUMP);
else if (
-#ifdef M68040
+#if defined(M68040) || defined(M68060)
((mmutype == MMU_68040) && ((vm_offset_t)p >= 0xFFFC0000)) &&
#endif
((vm_offset_t)p >= 0xFF000000)) {
diff --git a/sys/arch/amiga/dev/bztzsc.c b/sys/arch/amiga/dev/bztzsc.c
new file mode 100644
index 00000000000..7c18b0b4e79
--- /dev/null
+++ b/sys/arch/amiga/dev/bztzsc.c
@@ -0,0 +1,429 @@
+/* $OpenBSD: bztzsc.c,v 1.1 1997/01/16 09:23:49 niklas Exp $ */
+/* $NetBSD: bztzsc.c,v 1.2 1996/12/23 09:09:54 veego Exp $ */
+
+/*
+ * Copyright (c) 1996 Ignatios Souvatzis
+ * Copyright (c) 1982, 1990 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 contains software written by Ignatios Souvatzis for
+ * the NetBSD project.
+ * 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.
+ *
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/device.h>
+#include <scsi/scsi_all.h>
+#include <scsi/scsiconf.h>
+#include <vm/vm.h>
+#include <vm/vm_kern.h>
+#include <vm/vm_page.h>
+#include <machine/pmap.h>
+#include <amiga/amiga/custom.h>
+#include <amiga/amiga/cc.h>
+#include <amiga/amiga/device.h>
+#include <amiga/amiga/isr.h>
+#include <amiga/dev/sfasreg.h>
+#include <amiga/dev/sfasvar.h>
+#include <amiga/dev/zbusvar.h>
+#include <amiga/dev/bztzscreg.h>
+#include <amiga/dev/bztzscvar.h>
+
+int bztzscprint __P((void *auxp, const char *));
+void bztzscattach __P((struct device *, struct device *, void *));
+int bztzscmatch __P((struct device *, void *, void *));
+
+struct scsi_adapter bztzsc_scsiswitch = {
+ sfas_scsicmd,
+ sfas_minphys,
+ 0, /* no lun support */
+ 0, /* no lun support */
+};
+
+struct scsi_device bztzsc_scsidev = {
+ NULL, /* use default error handler */
+ NULL, /* do not have a start functio */
+ NULL, /* have no async handler */
+ NULL, /* Use default done routine */
+};
+
+struct cfattach bztzsc_ca = {
+ sizeof(struct bztzsc_softc), bztzscmatch, bztzscattach
+};
+
+struct cfdriver bztzsc_cd = {
+ NULL, "bztzsc", DV_DULL, NULL, 0
+};
+
+int bztzsc_intr __P((void *));
+void bztzsc_set_dma_tc __P((struct sfas_softc *sc, unsigned int len));
+int bztzsc_setup_dma __P((struct sfas_softc *sc, vm_offset_t ptr, int len,
+ int mode));
+int bztzsc_build_dma_chain __P((struct sfas_softc *sc,
+ struct sfas_dma_chain *chain, void *p, int l));
+int bztzsc_need_bump __P((struct sfas_softc *sc, vm_offset_t ptr, int len));
+void bztzsc_led __P((struct sfas_softc *sc, int mode));
+
+/*
+ * If we are an Phase 5 Devices Blizzard-2060 SCSI option:
+ */
+int
+bztzscmatch(pdp, cfp, auxp)
+ struct device *pdp;
+ void *cfp;
+ void *auxp;
+{
+ struct zbus_args *zap;
+ volatile u_int8_t *ta;
+
+ zap = auxp;
+
+ if (zap->manid != 0x2140) /* Phase V ? */
+ return(0);
+
+
+ if (zap->prodid != 24) /* is it B2060? */
+ return 0;
+
+ ta = (vu_char *)(((char *)zap->va) + 0x1ff00 + 0x20);
+
+ if (badbaddr((caddr_t)ta))
+ return(0);
+
+ *ta = 0;
+ *ta = 1;
+ DELAY(5);
+ if (*ta != 1)
+ return(0);
+
+ return(1);
+}
+
+u_int32_t bztzsc_flags = 0;
+
+void
+bztzscattach(pdp, dp, auxp)
+ struct device *pdp;
+ struct device *dp;
+ void *auxp;
+{
+ struct bztzsc_softc *sc;
+ struct zbus_args *zap;
+ bztzsc_regmap_p rp;
+ vu_char *fas;
+
+ zap = auxp;
+
+ fas = &((vu_char *)zap->va)[0x1ff00];
+
+ sc = (struct bztzsc_softc *)dp;
+ rp = &sc->sc_regmap;
+
+ rp->FAS216.sfas_tc_low = &fas[0x00];
+ rp->FAS216.sfas_tc_mid = &fas[0x04];
+ rp->FAS216.sfas_fifo = &fas[0x08];
+ rp->FAS216.sfas_command = &fas[0x0C];
+ rp->FAS216.sfas_dest_id = &fas[0x10];
+ rp->FAS216.sfas_timeout = &fas[0x14];
+ rp->FAS216.sfas_syncper = &fas[0x18];
+ rp->FAS216.sfas_syncoff = &fas[0x1C];
+ rp->FAS216.sfas_config1 = &fas[0x20];
+ rp->FAS216.sfas_clkconv = &fas[0x24];
+ rp->FAS216.sfas_test = &fas[0x28];
+ rp->FAS216.sfas_config2 = &fas[0x2C];
+ rp->FAS216.sfas_config3 = &fas[0x30];
+ rp->FAS216.sfas_tc_high = &fas[0x38];
+ rp->FAS216.sfas_fifo_bot = &fas[0x3C];
+
+ rp->hardbits = &fas[0xe0];
+ rp->addrport = &fas[0xf0];
+
+ sc->sc_softc.sc_fas = (sfas_regmap_p)rp;
+
+ sc->sc_softc.sc_led = bztzsc_led;
+
+ sc->sc_softc.sc_setup_dma = bztzsc_setup_dma;
+ sc->sc_softc.sc_build_dma_chain = bztzsc_build_dma_chain;
+ sc->sc_softc.sc_need_bump = bztzsc_need_bump;
+
+ sc->sc_softc.sc_clock_freq = 40; /* Phase5 SCSI all run at 40MHz */
+ sc->sc_softc.sc_timeout = 250; /* Set default timeout to 250ms */
+
+ sc->sc_softc.sc_config_flags = bztzsc_flags; /* for the moment */
+
+ sc->sc_softc.sc_host_id = 7; /* Should check the jumpers */
+
+ sc->sc_softc.sc_bump_sz = NBPG; /* XXX should be the VM pagesize */
+ sc->sc_softc.sc_bump_pa = 0x0;
+
+ sfasinitialize((struct sfas_softc *)sc);
+
+ sc->sc_softc.sc_link.adapter_softc = sc;
+ sc->sc_softc.sc_link.adapter_target = sc->sc_softc.sc_host_id;
+ sc->sc_softc.sc_link.adapter = &bztzsc_scsiswitch;
+ sc->sc_softc.sc_link.device = &bztzsc_scsidev;
+ sc->sc_softc.sc_link.openings = 1;
+
+ sc->sc_softc.sc_isr.isr_intr = bztzsc_intr;
+ sc->sc_softc.sc_isr.isr_arg = &sc->sc_softc;
+ sc->sc_softc.sc_isr.isr_ipl = 2;
+ add_isr(&sc->sc_softc.sc_isr);
+
+/* We don't want interrupt until we're initialized! */
+
+ printf("\n");
+
+/* attach all scsi units on us */
+ config_found(dp, &sc->sc_softc.sc_link, bztzscprint);
+}
+
+/* print diag if pnp is NULL else just extra */
+int
+bztzscprint(auxp, pnp)
+ void *auxp;
+ const char *pnp;
+{
+ if (pnp == NULL)
+ return(UNCONF);
+
+ return(QUIET);
+}
+
+int
+bztzsc_intr(arg)
+ void *arg;
+{
+ struct sfas_softc *dev = arg;
+ bztzsc_regmap_p rp;
+ int quickints;
+
+ rp = (bztzsc_regmap_p)dev->sc_fas;
+
+ if (*rp->FAS216.sfas_status & SFAS_STAT_INTERRUPT_PENDING) {
+ quickints = 16;
+ do {
+ dev->sc_status = *rp->FAS216.sfas_status;
+ dev->sc_interrupt = *rp->FAS216.sfas_interrupt;
+
+ if (dev->sc_interrupt & SFAS_INT_RESELECTED) {
+ dev->sc_resel[0] = *rp->FAS216.sfas_fifo;
+ dev->sc_resel[1] = *rp->FAS216.sfas_fifo;
+ }
+ sfasintr(dev);
+
+ } while((*rp->FAS216.sfas_status & SFAS_STAT_INTERRUPT_PENDING)
+ && --quickints);
+
+ return(1);
+ }
+ return(0);
+}
+
+/* Set DMA transfer counter */
+void
+bztzsc_set_dma_tc(sc, len)
+ struct sfas_softc *sc;
+ unsigned int len;
+{
+ *sc->sc_fas->sfas_tc_low = len; len >>= 8;
+ *sc->sc_fas->sfas_tc_mid = len; len >>= 8;
+ *sc->sc_fas->sfas_tc_high = len;
+}
+
+/* Initialize DMA for transfer */
+int
+bztzsc_setup_dma(sc, ptr, len, mode)
+ struct sfas_softc *sc;
+ vm_offset_t ptr;
+ int len;
+ int mode;
+{
+ int retval;
+ u_int32_t d;
+ bztzsc_regmap_p rp;
+
+ retval = 0;
+
+ switch(mode) {
+
+ case SFAS_DMA_READ:
+ case SFAS_DMA_WRITE:
+
+ rp = (bztzsc_regmap_p)sc->sc_fas;
+
+ d = (u_int32_t)ptr;
+ d >>= 1;
+
+ if (mode == SFAS_DMA_WRITE)
+ d |= (1L << 31);
+
+ rp->addrport[12] = (u_int8_t)d;
+ __asm __volatile("nop");
+
+ d >>= 8;
+ rp->addrport[8] = (u_int8_t)d;
+ __asm __volatile("nop");
+
+ d >>= 8;
+ rp->addrport[4] = (u_int8_t)d;
+ __asm __volatile("nop");
+
+ d >>= 8;
+ rp->addrport[0] = (u_int8_t)d;
+ __asm __volatile("nop");
+
+ bztzsc_set_dma_tc(sc, len);
+ break;
+
+ case SFAS_DMA_CLEAR:
+ default:
+ retval = (*sc->sc_fas->sfas_tc_high << 16) |
+ (*sc->sc_fas->sfas_tc_mid << 8) |
+ *sc->sc_fas->sfas_tc_low;
+
+ bztzsc_set_dma_tc(sc, 0);
+ break;
+ }
+
+ return(retval);
+}
+
+/* Check if address and len is ok for DMA transfer */
+int
+bztzsc_need_bump(sc, ptr, len)
+ struct sfas_softc *sc;
+ vm_offset_t ptr;
+ int len;
+{
+ int p;
+
+ p = (int)ptr & 0x03;
+
+ if (p) {
+ p = 4-p;
+
+ if (len < 256)
+ p = len;
+ }
+ return(p);
+}
+
+/* Interrupt driven routines */
+/* XXX some of this is voodoo might be remnants intended for the Fastlane. */
+int
+bztzsc_build_dma_chain(sc, chain, p, l)
+ struct sfas_softc *sc;
+ struct sfas_dma_chain *chain;
+ void *p;
+ int l;
+{
+ vm_offset_t pa, lastpa;
+ char *ptr;
+ int len, prelen, max_t, n;
+
+ if (l == 0)
+ return(0);
+
+#define set_link(n, p, l, f)\
+do { chain[n].ptr = (p); chain[n].len = (l); chain[n++].flg = (f); } while(0)
+
+ n = 0;
+
+ if (l < 512)
+ set_link(n, (vm_offset_t)p, l, SFAS_CHAIN_BUMP);
+ else if ((p >= (void *)0xFF000000)
+#if defined(M68040) || defined(M68060)
+ && ((mmutype == MMU_68040) && (p >= (void *)0xFFFC0000))
+#endif
+ ) {
+ while(l != 0) {
+ len = ((l > sc->sc_bump_sz) ? sc->sc_bump_sz : l);
+
+ set_link(n, (vm_offset_t)p, len, SFAS_CHAIN_BUMP);
+
+ p += len;
+ l -= len;
+ }
+ } else {
+ ptr = p;
+ len = l;
+
+ pa = kvtop(ptr);
+ prelen = ((int)ptr & 0x03);
+
+ if (prelen) {
+ prelen = 4-prelen;
+ set_link(n, (vm_offset_t)ptr, prelen, SFAS_CHAIN_BUMP);
+ ptr += prelen;
+ len -= prelen;
+ }
+
+ lastpa = 0;
+ while(len > 3) {
+ pa = kvtop(ptr);
+ max_t = NBPG - (pa & PGOFSET);
+ if (max_t > len)
+ max_t = len;
+
+ max_t &= ~3;
+
+ if (lastpa == pa)
+ sc->sc_chain[n-1].len += max_t;
+ else
+ set_link(n, pa, max_t, SFAS_CHAIN_DMA);
+
+ lastpa = pa+max_t;
+
+ ptr += max_t;
+ len -= max_t;
+ }
+
+ if (len)
+ set_link(n, (vm_offset_t)ptr, len, SFAS_CHAIN_BUMP);
+ }
+
+ return(n);
+}
+
+/* real one for 2060 */
+void
+bztzsc_led(sc, mode)
+ struct sfas_softc *sc;
+ int mode;
+{
+ bztzsc_regmap_p rp;
+
+ rp = (bztzsc_regmap_p)sc->sc_fas;
+
+ if (mode)
+ *rp->hardbits = 0x00; /* Led on, Int on */
+ else
+ *rp->hardbits = 0x02; /* Led off, Int on */
+}
diff --git a/sys/arch/amiga/dev/gen_cvtab.c b/sys/arch/amiga/dev/bztzscreg.h
index a78f9e4c867..ad0528552ac 100644
--- a/sys/arch/amiga/dev/gen_cvtab.c
+++ b/sys/arch/amiga/dev/bztzscreg.h
@@ -1,9 +1,9 @@
-/* $OpenBSD: gen_cvtab.c,v 1.1 1996/02/26 21:08:03 niklas Exp $ */
-/* $NetBSD: gen_cvtab.c,v 1.1 1996/02/24 20:13:00 chopps Exp $ */
+/* $OpenBSD: bztzscreg.h,v 1.1 1997/01/16 09:23:50 niklas Exp $ */
+/* $NetBSD: bztzscreg.h,v 1.1 1996/12/16 16:17:29 is Exp $ */
/*
- * Copyright (c) 1996 Christian E. Hopps
- * All rights reserved.
+ * Copyright (c) 1996 Ignatios Souvatzis
+ * Copyright (c) 1995 Daniel Widenfalk
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -15,7 +15,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 Christian E. Hopps.
+ * This product includes software developed by Daniel Widenfalk
+ * for the NetBSD Project.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
@@ -30,37 +31,25 @@
* (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/types.h>
-#include <stdio.h>
/*
- * generate a conversion table to replace the use of the
- * floating point expression below in grf_cv.c
+ * Blizzard 2060 with FAS216 SCSI interface hardware
+ * description.
*/
-int
-main(int argc, char** argv)
-{
- u_long vals[31];
- u_long clock;
- int m = 33;
- int lastm = -1;
- for (clock = 0; clock < 1080 && m > 0; ++clock) {
- m = ((55 * .72 + 16.867) * 89.736 / (clock + 39) - 21.1543);
- m = m / 2 - 1;
- if (m > 31)
- continue;
- if (m != lastm) {
- vals[m] = clock;
- lastm = m;
- }
- }
- printf("/* generated by gen_cvtab */\n");
- printf("static int cv_convtab[31] = {");
- for (m = 0; m < 31; ++m) {
- if (m % 5 == 0)
- printf("\n");
- printf("\t%ld,", vals[m]);
- }
- printf("\n};\n");
-}
+#ifndef _BZTZSCREG_H_
+#define _BZTZSCREG_H_
+
+#ifndef _SFASREG_H_
+#include <amiga/dev/sfasreg.h>
+#endif
+
+typedef struct bztzsc_regmap {
+ sfas_regmap_t FAS216;
+ vu_char *hardbits;
+ vu_char *addrport;
+} bztzsc_regmap_t;
+
+typedef bztzsc_regmap_t *bztzsc_regmap_p;
+
+#endif
diff --git a/sys/arch/amiga/dev/bztzscvar.h b/sys/arch/amiga/dev/bztzscvar.h
new file mode 100644
index 00000000000..b0222cc2a48
--- /dev/null
+++ b/sys/arch/amiga/dev/bztzscvar.h
@@ -0,0 +1,50 @@
+/* $OpenBSD: bztzscvar.h,v 1.1 1997/01/16 09:23:51 niklas Exp $ */
+/* $NetBSD: bztzscvar.h,v 1.1 1996/12/16 16:17:30 is Exp $ */
+
+/*
+ * Copyright (c) 1996 Ignatios Souvatzis
+ * Copyright (c) 1995 Daniel Widenfalk
+ *
+ * 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 Daniel Widenfalk
+ * for the NetBSD Project.
+ * 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.
+ */
+#ifndef _BZTZSCVAR_H_
+#define _BZTZSCVAR_H_
+
+#ifndef _SFASVAR_H_
+#include <amiga/dev/sfasvar.h>
+#endif
+
+#ifndef _BZTZSCREG_H_
+#include <amiga/dev/bztzscreg.h>
+#endif
+
+struct bztzsc_softc {
+ struct sfas_softc sc_softc;
+ bztzsc_regmap_t sc_regmap;
+};
+
+#endif /* _BZTZSCVAR_H_ */
diff --git a/sys/arch/amiga/dev/clock.c b/sys/arch/amiga/dev/clock.c
index b69de85c67f..6f8d075238d 100644
--- a/sys/arch/amiga/dev/clock.c
+++ b/sys/arch/amiga/dev/clock.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: clock.c,v 1.8 1996/06/04 13:28:39 niklas Exp $ */
-/* $NetBSD: clock.c,v 1.15 1996/05/10 14:30:53 is Exp $ */
+/* $OpenBSD: clock.c,v 1.9 1997/01/16 09:23:52 niklas Exp $ */
+/* $NetBSD: clock.c,v 1.25 1997/01/02 20:59:42 is Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -100,8 +100,8 @@ struct clockframe hardclock_frame;
int clockmatch __P((struct device *, void *, void *));
void clockattach __P((struct device *, struct device *, void *));
+void calibrate_delay __P((struct device *));
void cpu_initclocks __P((void));
-void setmicspertick __P((void));
int clockintr __P((void *));
struct cfattach clock_ca = {
@@ -117,11 +117,7 @@ clockmatch(pdp, match, auxp)
void *match, *auxp;
{
- if (matchname("clock", auxp)
-#ifdef DRACO
- && (is_draco() < 4)
-#endif
- )
+ if (matchname("clock", auxp))
return(1);
return(0);
}
@@ -134,8 +130,11 @@ clockattach(pdp, dp, auxp)
struct device *pdp, *dp;
void *auxp;
{
+ char *clockchip;
unsigned short interval;
- char cia;
+#ifdef DRACO
+ u_char dracorev;
+#endif
if (eclockfreq == 0)
eclockfreq = 715909; /* guess NTSC */
@@ -143,17 +142,43 @@ clockattach(pdp, dp, auxp)
CLK_INTERVAL = (eclockfreq / 100);
#ifdef DRACO
- if (is_draco()) {
+ dracorev = is_draco();
+ if (dracorev >= 4) {
+ CLK_INTERVAL = (eclockfreq / 700);
+ clockchip = "QuickLogic";
+ } else if (dracorev) {
clockcia = (struct CIA *)CIAAbase;
- cia = 'A';
+ clockchip = "CIA A";
} else
#endif
{
clockcia = (struct CIA *)CIABbase;
- cia = 'B';
+ clockchip = "CIA B";
}
- printf(": CIA %c system hz %d hardware hz %d\n", cia, hz, eclockfreq);
+ if (dp)
+ printf(": %s system hz %d hardware hz %d\n", clockchip, hz,
+#ifdef DRACO
+ dracorev >= 4 ? eclockfreq / 7 : eclockfreq);
+#else
+ eclockfreq);
+#endif
+
+#ifdef DRACO
+ if (dracorev >= 4) {
+ /*
+ * can't preload anything beforehand, timer is free_running;
+ * but need this for delay calibration.
+ */
+
+ draco_ioct->io_timerlo = CLK_INTERVAL & 0xff;
+ draco_ioct->io_timerhi = CLK_INTERVAL >> 8;
+
+ calibrate_delay(dp);
+
+ return;
+ }
+#endif
/*
* stop timer A
@@ -174,6 +199,13 @@ clockattach(pdp, dp, auxp)
*/
clockcia->talo = interval & 0xff;
clockcia->tahi = interval >> 8;
+
+ /*
+ * start timer A in continuous mode
+ */
+ clockcia->cra = (clockcia->cra & 0xc0) | 1;
+
+ calibrate_delay(dp);
}
#if defined(IPL_REMAP_1) || defined(IPL_REMAP_2)
@@ -190,6 +222,65 @@ clockintr (arg)
}
#endif
+/*
+ * Calibrate delay loop.
+ * We use two iterations because we don't have enough bits to do a factor of
+ * 8 with better than 1%.
+ *
+ * XXX Note that we MUST stay below 1 tick if using clkread(), even for
+ * underestimated values of delaydivisor.
+ *
+ * XXX the "ns" below is only correct for a shift of 10 bits, and even then
+ * off by 2.4%
+ */
+
+void calibrate_delay(dp)
+ struct device *dp;
+{
+ unsigned long t1, t2;
+ extern u_int32_t delaydivisor;
+ /* XXX this should be defined elsewhere */
+
+ if (dp)
+ printf("Calibrating delay loop... ");
+
+ do {
+ t1 = clkread();
+ delay(1024);
+ t2 = clkread();
+ } while (t2 <= t1);
+ t2 -= t1;
+ delaydivisor = (delaydivisor * t2 + 1023) >> 10;
+#ifdef DIAGNOSTIC
+ if (dp)
+ printf("\ndiff %ld us, new divisor %u/1024 us\n", t2,
+ delaydivisor);
+ do {
+ t1 = clkread();
+ delay(1024);
+ t2 = clkread();
+ } while (t2 <= t1);
+ t2 -= t1;
+ delaydivisor = (delaydivisor * t2 + 1023) >> 10;
+ if (dp)
+ printf("diff %ld us, new divisor %u/1024 us\n", t2,
+ delaydivisor);
+#endif
+ do {
+ t1 = clkread();
+ delay(1024);
+ t2 = clkread();
+ } while (t2 <= t1);
+ t2 -= t1;
+ delaydivisor = (delaydivisor * t2 + 1023) >> 10;
+#ifdef DIAGNOSTIC
+ if (dp)
+ printf("diff %ld us, new divisor ", t2);
+#endif
+ if (dp)
+ printf("%u/1024 us\n", delaydivisor);
+}
+
void
cpu_initclocks()
{
@@ -217,7 +308,7 @@ cpu_initclocks()
* and globally enable interrupts for ciab
*/
#ifdef DRACO
- if (is_draco()) /* we use cia a on DraCo */
+ if (dracorev) /* we use cia a on DraCo */
*draco_intena |= DRIRQ_INT2;
else
#endif
@@ -238,184 +329,41 @@ setstatclockrate(hz)
u_long
clkread()
{
- u_char hi, hi2, lo;
u_int interval;
-
- hi = clockcia->tahi;
- lo = clockcia->talo;
- hi2 = clockcia->tahi;
- if (hi != hi2) {
- lo = clockcia->talo;
- hi = hi2;
- }
-
- interval = (CLK_INTERVAL - 1) - ((hi<<8) | lo);
-
- /*
- * should read ICR and if there's an int pending, adjust interval.
- * However, * since reading ICR clears the interrupt, we'd lose a
- * hardclock int, and * this is not tolerable.
- */
-
- return((interval * tick) / CLK_INTERVAL);
-}
-
-u_int micspertick;
+ u_char hi, hi2, lo;
-/*
- * we set up as much of the CIAa as possible
- * as all access to chip memory are very slow.
- */
-void
-setmicspertick()
-{
#ifdef DRACO
- if (is_draco())
- return; /* XXX */
-#endif
- micspertick = (1000000ULL << 20) / 715909;
-
- /*
- * disable interrupts (just in case.)
- */
- ciaa.icr = 0x3;
-
- /*
- * stop both timers if not already
- */
- ciaa.cra &= ~1;
- ciaa.crb &= ~1;
+ if (is_draco() >= 4) {
+ hi2 = draco_ioct->io_chiprev; /* latch timer */
+ hi = draco_ioct->io_timerhi;
+ lo = draco_ioct->io_timerlo;
+ interval = ((hi<<8) | lo);
+ if (interval > CLK_INTERVAL) /* timer underflow */
+ interval = 65536 + CLK_INTERVAL - interval;
+ else
+ interval = CLK_INTERVAL - interval;
- /*
- * set timer B in "count timer A underflows" mode
- * set timer A in one-shot mode
- */
- ciaa.crb = (ciaa.crb & 0x80) | 0x48;
- ciaa.cra = (ciaa.cra & 0xc0) | 0x08;
-}
-
-/*
- * this function assumes that on any entry beyond the first
- * the following condintions exist:
- * Interrupts for Timers A and B are disabled.
- * Timers A and B are stoped.
- * Timers A and B are in one-shot mode with B counting timer A underflows
- *
- */
-void
-delay(mic)
- u_int mic;
-{
- u_int temp;
-
-#ifdef DRACO
- if (is_draco()) {
- DELAY(mic);
- return;
- }
+ } else
#endif
- if (micspertick == 0)
- setmicspertick();
-
- if (mic <= 1)
- return;
-
- /*
- * basically this is going to do an integer
- * usec / (1000000 / 715909) with no loss of
- * precision
- */
- temp = mic >> 12;
- asm("divul %3,%1:%0" : "=d" (temp) : "d" (mic >> 12), "0" (mic << 20),
- "d" (micspertick));
-
- if ((temp & 0xffff0000) > 0x10000) {
- mic = (temp >> 16) - 1;
- temp &= 0xffff;
-
- /*
- * set timer A in continous mode
- */
- ciaa.cra = (ciaa.cra & 0xc0) | 0x00;
-
- /*
- * latch/load/start "counts of timer A underflows" in B
- */
- ciaa.tblo = mic & 0xff;
- ciaa.tbhi = mic >> 8;
-
- /*
- * timer A latches 0xffff
- * and start it.
- */
- ciaa.talo = 0xff;
- ciaa.tahi = 0xff;
- ciaa.cra |= 1;
-
- while (ciaa.crb & 1)
- ;
-
- /*
- * stop timer A
- */
- ciaa.cra &= ~1;
-
- /*
- * set timer A in one shot mode
- */
- ciaa.cra = (ciaa.cra & 0xc0) | 0x08;
- } else if ((temp & 0xffff0000) == 0x10000) {
- temp &= 0xffff;
-
+ {
+ hi = clockcia->tahi;
+ lo = clockcia->talo;
+ hi2 = clockcia->tahi;
+ if (hi != hi2) {
+ lo = clockcia->talo;
+ hi = hi2;
+ }
+
+ interval = (CLK_INTERVAL - 1) - ((hi<<8) | lo);
+
/*
- * timer A is in one shot latch/load/start 1 full turn
+ * should read ICR and if there's an int pending, adjust
+ * interval. However, since reading ICR clears the interrupt,
+ * we'd lose a hardclock int, and this is not tolerable.
*/
- ciaa.talo = 0xff;
- ciaa.tahi = 0xff;
- while (ciaa.cra & 1)
- ;
}
- if (temp < 1)
- return;
-
- /*
- * temp is now residual ammount, latch/load/start it.
- */
- ciaa.talo = temp & 0xff;
- ciaa.tahi = temp >> 8;
- while (ciaa.cra & 1)
- ;
-}
-/*
- * Needs to be calibrated for use, its way off most of the time
- */
-void
-DELAY(mic)
- u_int mic;
-{
- u_long n;
- short hpos;
-
-#ifdef DRACO
- if (is_draco()) {
- while (--mic > 0)
- n = *draco_intena;
- return;
- }
-#endif
- /*
- * this function uses HSync pulses as base units. The custom chips
- * display only deals with 31.6kHz/2 refresh, this gives us a
- * resolution of 1/15800 s, which is ~63us (add some fuzz so we really
- * wait awhile, even if using small timeouts)
- */
- n = mic/63 + 2;
- do {
- hpos = custom.vhposr & 0xff00;
- while (hpos == (custom.vhposr & 0xff00))
- ;
- } while (n--);
+ return((interval * tick) / CLK_INTERVAL);
}
#if notyet
@@ -1078,5 +1026,5 @@ a2settod(tim)
rt->year2 = year2;
rt->control2 &= ~A2CONTROL1_HOLD;
- return 1;
+ return 1;
}
diff --git a/sys/arch/amiga/dev/clockioctl.h b/sys/arch/amiga/dev/clockioctl.h
index 498ca8cabef..26bb4bd533b 100644
--- a/sys/arch/amiga/dev/clockioctl.h
+++ b/sys/arch/amiga/dev/clockioctl.h
@@ -1,3 +1,4 @@
+/* $OpenBSD: clockioctl.h,v 1.2 1997/01/16 09:23:53 niklas Exp $ */
/* $NetBSD: clockioctl.h,v 1.2 1994/10/26 02:02:54 cgd Exp $ */
/*
diff --git a/sys/arch/amiga/dev/dmavar.h b/sys/arch/amiga/dev/dmavar.h
index a27c513eecb..3709cace2c1 100644
--- a/sys/arch/amiga/dev/dmavar.h
+++ b/sys/arch/amiga/dev/dmavar.h
@@ -1,3 +1,4 @@
+/* $OpenBSD: dmavar.h,v 1.2 1997/01/16 09:23:54 niklas Exp $ */
/* $NetBSD: dmavar.h,v 1.9 1995/03/28 18:14:51 jtc Exp $ */
/*
diff --git a/sys/arch/amiga/dev/drcom.c b/sys/arch/amiga/dev/drcom.c
new file mode 100644
index 00000000000..c4ed739439f
--- /dev/null
+++ b/sys/arch/amiga/dev/drcom.c
@@ -0,0 +1,1285 @@
+/* $OpenBSD: drcom.c,v 1.1 1997/01/16 09:23:55 niklas Exp $ */
+/* $NetBSD: drcom.c,v 1.2 1996/12/23 09:09:56 veego Exp $ */
+
+/*-
+ * Copyright (c) 1993, 1994, 1995, 1996
+ * Charles M. Hannum. All rights reserved.
+ * Copyright (c) 1991 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.
+ *
+ * @(#)drcom.c 7.5 (Berkeley) 5/16/91
+ */
+
+/*
+ * COM driver, based on HP dca driver
+ * uses National Semiconductor NS16450/NS16550AF UART
+ */
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/ioctl.h>
+#include <sys/select.h>
+#include <sys/tty.h>
+#include <sys/ttycom.h>
+#include <sys/proc.h>
+#include <sys/user.h>
+#include <sys/file.h>
+#include <sys/uio.h>
+#include <sys/kernel.h>
+#include <sys/syslog.h>
+#include <sys/types.h>
+#include <sys/device.h>
+
+#include <sys/conf.h>
+#include <machine/conf.h>
+
+#include <machine/cpu.h>
+
+#include <amiga/amiga/device.h>
+#include <amiga/amiga/drcustom.h>
+#include <amiga/amiga/isr.h>
+
+#include <amiga/dev/drisavar.h>
+#include <amiga/dev/drcomreg.h>
+#include <amiga/dev/drcomvar.h>
+
+#include <dev/ic/ns16550reg.h>
+
+#define com_lcr com_cfcr
+
+#include "drcom.h"
+
+
+#define COM_IBUFSIZE (2 * 512)
+#define COM_IHIGHWATER ((3 * COM_IBUFSIZE) / 4)
+
+struct drcom_softc {
+ struct device sc_dev;
+ void *sc_ih;
+ struct tty *sc_tty;
+
+ int sc_overflows;
+ int sc_floods;
+ int sc_failures;
+ int sc_errors;
+
+ int sc_halt;
+
+ int sc_iobase;
+
+ bus_chipset_tag_t sc_bc;
+ bus_io_handle_t sc_ioh;
+
+ struct isr sc_isr;
+
+ u_char sc_hwflags;
+#define COM_HW_NOIEN 0x01
+#define COM_HW_FIFO 0x02
+#define COM_HW_HAYESP 0x04
+#define COM_HW_CONSOLE 0x40
+ u_char sc_swflags;
+#define COM_SW_SOFTCAR 0x01
+#define COM_SW_CLOCAL 0x02
+#define COM_SW_CRTSCTS 0x04
+#define COM_SW_MDMBUF 0x08
+ u_char sc_msr, sc_mcr, sc_lcr, sc_ier;
+ u_char sc_dtr;
+
+ u_char *sc_ibuf, *sc_ibufp, *sc_ibufhigh, *sc_ibufend;
+ u_char sc_ibufs[2][COM_IBUFSIZE];
+
+ u_char sc_iir;
+};
+
+void drcomdiag __P((void *));
+int drcomspeed __P((long));
+int drcomparam __P((struct tty *, struct termios *));
+void drcomstart __P((struct tty *));
+void drcomsoft __P((void *));
+int drcomintr __P((void *));
+
+struct consdev;
+void drcomcnprobe __P((struct consdev *));
+void drcomcninit __P((struct consdev *));
+int drcomcngetc __P((dev_t));
+void drcomcnputc __P((dev_t, int));
+void drcomcnpollc __P((dev_t, int));
+
+static u_char tiocm_xxx2mcr __P((int));
+
+/*
+ * XXX the following two cfattach structs should be different, and possibly
+ * XXX elsewhere.
+ */
+int drcommatch __P((struct device *, struct cfdata *, void *));
+void drcomattach __P((struct device *, struct device *, void *));
+
+struct cfattach drcom_ca = {
+ sizeof(struct drcom_softc), drcommatch, drcomattach
+};
+
+struct cfdriver drcom_cd = {
+ NULL, "drcom", DV_TTY
+};
+
+void drcominit __P((bus_chipset_tag_t, bus_io_handle_t, int));
+
+#ifdef COMCONSOLE
+int drcomdefaultrate = CONSPEED; /* XXX why set default? */
+#else
+int drcomdefaultrate = 1200 /*TTYDEF_SPEED*/;
+#endif
+int drcomconsaddr;
+int drcomconsinit;
+int drcomconsattached;
+bus_chipset_tag_t drcomconsbc;
+bus_io_handle_t drcomconsioh;
+tcflag_t drcomconscflag = TTYDEF_CFLAG;
+
+int drcommajor;
+int drcomsopen = 0;
+int drcomevents = 0;
+
+#ifdef KGDB
+#include <machine/remote-sl.h>
+extern int kgdb_dev;
+extern int kgdb_rate;
+extern int kgdb_debug_init;
+#endif
+
+#define COMUNIT(x) (minor(x))
+
+/* Macros to clear/set/test flags. */
+#define SET(t, f) (t) |= (f)
+#define CLR(t, f) (t) &= ~(f)
+#define ISSET(t, f) ((t) & (f))
+
+int
+drcomspeed(speed)
+ long speed;
+{
+#define divrnd(n, q) (((n)*2/(q)+1)/2) /* divide and round off */
+
+ int x, err;
+
+ if (speed == 0)
+ return 0;
+ if (speed < 0)
+ return -1;
+ x = divrnd((COM_FREQ / 16), speed);
+ if (x <= 0)
+ return -1;
+ err = divrnd((COM_FREQ / 16) * 1000, speed * x) - 1000;
+ if (err < 0)
+ err = -err;
+ if (err > COM_TOLERANCE)
+ return -1;
+ return x;
+
+#undef divrnd(n, q)
+}
+
+int
+drcommatch(parent, cfp, auxp)
+ struct device *parent;
+ struct cfdata *cfp;
+ void *auxp;
+{
+
+ /* Exactly two of us live on the DraCo */
+
+ if (is_draco() && matchname(auxp, "drcom") &&
+ (cfp->cf_unit >= 0) && (cfp->cf_unit < 2))
+ return 1;
+
+ return 0;
+}
+
+void
+drcomattach(parent, self, auxp)
+ struct device *parent, *self;
+ void *auxp;
+{
+ struct drcom_softc *sc = (void *)self;
+ int iobase;
+ bus_chipset_tag_t bc;
+ bus_io_handle_t ioh;
+
+ /*
+ * XXX should be broken out into functions for isa attach and
+ * XXX for drcommulti attach, with a helper function that contains
+ * XXX most of the interesting stuff.
+ */
+ sc->sc_hwflags = 0;
+ sc->sc_swflags = 0;
+
+ bc = 0;
+ iobase = self->dv_cfdata->cf_unit ? 0x2f8 : 0x3f8;
+
+ if (iobase != drcomconsaddr) {
+ (void)bus_io_map(bc, iobase, COM_NPORTS, &ioh);
+ } else {
+ ioh = drcomconsioh;
+ }
+
+ sc->sc_bc = bc;
+ sc->sc_ioh = ioh;
+ sc->sc_iobase = iobase;
+
+ if (iobase == drcomconsaddr) {
+ drcomconsattached = 1;
+
+ /*
+ * Need to reset baud rate, etc. of next print so reset
+ * drcomconsinit. Also make sure console is always "hardwired".
+ */
+ delay(1000); /* wait for output to finish */
+ drcomconsinit = 0;
+ SET(sc->sc_hwflags, COM_HW_CONSOLE);
+ SET(sc->sc_swflags, COM_SW_SOFTCAR);
+ }
+
+
+ /* look for a NS 16550AF UART with FIFOs */
+ bus_io_write_1(bc, ioh, com_fifo,
+ FIFO_ENABLE | FIFO_RCV_RST | FIFO_XMT_RST | FIFO_TRIGGER_14);
+ delay(100);
+ if (ISSET(bus_io_read_1(bc, ioh, com_iir), IIR_FIFO_MASK) == IIR_FIFO_MASK)
+ if (ISSET(bus_io_read_1(bc, ioh, com_fifo), FIFO_TRIGGER_14) == FIFO_TRIGGER_14) {
+ SET(sc->sc_hwflags, COM_HW_FIFO);
+ printf(": ns16550a, working fifo\n");
+ } else
+ printf(": ns16550, broken fifo\n");
+ else
+ printf(": ns8250 or ns16450, no fifo\n");
+ bus_io_write_1(bc, ioh, com_fifo, 0);
+#ifdef COM_HAYESP
+ }
+#endif
+
+ if (amiga_ttyspl < (PSL_S|PSL_IPL5)) {
+ printf("%s: raising amiga_ttyspl from 0x%x to 0x%x\n",
+ sc->sc_dev.dv_xname, amiga_ttyspl, PSL_S|PSL_IPL5);
+ amiga_ttyspl = PSL_S|PSL_IPL5;
+ }
+
+ /* disable interrupts */
+ (void)bus_io_read_1(bc, ioh, com_iir);
+ bus_io_write_1(bc, ioh, com_ier, 0);
+ bus_io_write_1(bc, ioh, com_mcr, 0);
+
+ sc->sc_isr.isr_intr = drcomintr;
+ sc->sc_isr.isr_arg = sc;
+ sc->sc_isr.isr_ipl = 5;
+ add_isr(&sc->sc_isr);
+
+#ifdef KGDB
+ if (kgdb_dev == makedev(drcommajor, unit)) {
+ if (ISSET(sc->sc_hwflags, COM_HW_CONSOLE))
+ kgdb_dev = -1; /* can't debug over console port */
+ else {
+ drcominit(bc, ioh, kgdb_rate);
+ if (kgdb_debug_init) {
+ /*
+ * Print prefix of device name,
+ * let kgdb_connect print the rest.
+ */
+ printf("%s: ", sc->sc_dev.dv_xname);
+ kgdb_connect(1);
+ } else
+ printf("%s: kgdb enabled\n",
+ sc->sc_dev.dv_xname);
+ }
+ }
+#endif
+
+ /* XXX maybe move up some? */
+ if (ISSET(sc->sc_hwflags, COM_HW_CONSOLE))
+ printf("%s: console\n", sc->sc_dev.dv_xname);
+}
+
+int
+drcomopen(dev, flag, mode, p)
+ dev_t dev;
+ int flag, mode;
+ struct proc *p;
+{
+ int unit = COMUNIT(dev);
+ struct drcom_softc *sc;
+ bus_chipset_tag_t bc;
+ bus_io_handle_t ioh;
+ struct tty *tp;
+ int s;
+ int error = 0;
+
+ if (unit >= drcom_cd.cd_ndevs)
+ return ENXIO;
+ sc = drcom_cd.cd_devs[unit];
+ if (!sc)
+ return ENXIO;
+
+ if (!sc->sc_tty) {
+ tp = sc->sc_tty = ttymalloc();
+ tty_attach(tp);
+ } else
+ tp = sc->sc_tty;
+
+ tp->t_oproc = drcomstart;
+ tp->t_param = drcomparam;
+ tp->t_dev = dev;
+ if (!ISSET(tp->t_state, TS_ISOPEN)) {
+ SET(tp->t_state, TS_WOPEN);
+ ttychars(tp);
+ tp->t_iflag = TTYDEF_IFLAG;
+ tp->t_oflag = TTYDEF_OFLAG;
+ if (ISSET(sc->sc_hwflags, COM_HW_CONSOLE))
+ tp->t_cflag = drcomconscflag;
+ else
+ tp->t_cflag = TTYDEF_CFLAG;
+ if (ISSET(sc->sc_swflags, COM_SW_CLOCAL))
+ SET(tp->t_cflag, CLOCAL);
+ if (ISSET(sc->sc_swflags, COM_SW_CRTSCTS))
+ SET(tp->t_cflag, CRTSCTS);
+ if (ISSET(sc->sc_swflags, COM_SW_MDMBUF))
+ SET(tp->t_cflag, MDMBUF);
+ tp->t_lflag = TTYDEF_LFLAG;
+ tp->t_ispeed = tp->t_ospeed = drcomdefaultrate;
+
+ s = spltty();
+
+ drcomparam(tp, &tp->t_termios);
+ ttsetwater(tp);
+
+ if (drcomsopen++ == 0)
+ timeout(drcomsoft, NULL, 1);
+
+ sc->sc_ibufp = sc->sc_ibuf = sc->sc_ibufs[0];
+ sc->sc_ibufhigh = sc->sc_ibuf + COM_IHIGHWATER;
+ sc->sc_ibufend = sc->sc_ibuf + COM_IBUFSIZE;
+
+ bc = sc->sc_bc;
+ ioh = sc->sc_ioh;
+#ifdef COM_HAYESP
+ /* Setup the ESP board */
+ if (ISSET(sc->sc_hwflags, COM_HW_HAYESP)) {
+ bus_io_handle_t hayespioh = sc->sc_hayespioh;
+
+ bus_io_write_1(bc, ioh, com_fifo,
+ FIFO_DMA_MODE|FIFO_ENABLE|
+ FIFO_RCV_RST|FIFO_XMT_RST|FIFO_TRIGGER_8);
+
+ /* Set 16550 drcompatibility mode */
+ bus_io_write_1(bc, hayespioh, HAYESP_CMD1, HAYESP_SETMODE);
+ bus_io_write_1(bc, hayespioh, HAYESP_CMD2,
+ HAYESP_MODE_FIFO|HAYESP_MODE_RTS|
+ HAYESP_MODE_SCALE);
+
+ /* Set RTS/CTS flow control */
+ bus_io_write_1(bc, hayespioh, HAYESP_CMD1, HAYESP_SETFLOWTYPE);
+ bus_io_write_1(bc, hayespioh, HAYESP_CMD2, HAYESP_FLOW_RTS);
+ bus_io_write_1(bc, hayespioh, HAYESP_CMD2, HAYESP_FLOW_CTS);
+
+ /* Set flow control levels */
+ bus_io_write_1(bc, hayespioh, HAYESP_CMD1, HAYESP_SETRXFLOW);
+ bus_io_write_1(bc, hayespioh, HAYESP_CMD2,
+ HAYESP_HIBYTE(HAYESP_RXHIWMARK));
+ bus_io_write_1(bc, hayespioh, HAYESP_CMD2,
+ HAYESP_LOBYTE(HAYESP_RXHIWMARK));
+ bus_io_write_1(bc, hayespioh, HAYESP_CMD2,
+ HAYESP_HIBYTE(HAYESP_RXLOWMARK));
+ bus_io_write_1(bc, hayespioh, HAYESP_CMD2,
+ HAYESP_LOBYTE(HAYESP_RXLOWMARK));
+ } else
+#endif
+ if (ISSET(sc->sc_hwflags, COM_HW_FIFO))
+ /* Set the FIFO threshold based on the receive speed. */
+ bus_io_write_1(bc, ioh, com_fifo,
+ FIFO_ENABLE | FIFO_RCV_RST | FIFO_XMT_RST |
+ (tp->t_ispeed <= 1200 ? FIFO_TRIGGER_1 : FIFO_TRIGGER_8));
+ /* flush any pending I/O */
+ while (ISSET(bus_io_read_1(bc, ioh, com_lsr), LSR_RXRDY))
+ (void) bus_io_read_1(bc, ioh, com_data);
+ /* you turn me on, baby */
+ sc->sc_mcr = MCR_DTR | MCR_RTS;
+ if (!ISSET(sc->sc_hwflags, COM_HW_NOIEN))
+ SET(sc->sc_mcr, MCR_IENABLE);
+ bus_io_write_1(bc, ioh, com_mcr, sc->sc_mcr);
+ sc->sc_ier = IER_ERXRDY | IER_ERLS | IER_EMSC;
+ bus_io_write_1(bc, ioh, com_ier, sc->sc_ier);
+
+ sc->sc_msr = bus_io_read_1(bc, ioh, com_msr);
+ if (ISSET(sc->sc_swflags, COM_SW_SOFTCAR) ||
+ ISSET(sc->sc_msr, MSR_DCD) || ISSET(tp->t_cflag, MDMBUF))
+ SET(tp->t_state, TS_CARR_ON);
+ else
+ CLR(tp->t_state, TS_CARR_ON);
+ } else if (ISSET(tp->t_state, TS_XCLUDE) && p->p_ucred->cr_uid != 0)
+ return EBUSY;
+ else
+ s = spltty();
+
+ /* wait for carrier if necessary */
+ if (!ISSET(flag, O_NONBLOCK))
+ while (!ISSET(tp->t_cflag, CLOCAL) &&
+ !ISSET(tp->t_state, TS_CARR_ON)) {
+ SET(tp->t_state, TS_WOPEN);
+ error = ttysleep(tp, &tp->t_rawq, TTIPRI | PCATCH,
+ ttopen, 0);
+ if (error) {
+ /* XXX should turn off chip if we're the
+ only waiter */
+ splx(s);
+ return error;
+ }
+ }
+ splx(s);
+
+ return (*linesw[tp->t_line].l_open)(dev, tp);
+}
+
+int
+drcomclose(dev, flag, mode, p)
+ dev_t dev;
+ int flag, mode;
+ struct proc *p;
+{
+ int unit = COMUNIT(dev);
+ struct drcom_softc *sc = drcom_cd.cd_devs[unit];
+ struct tty *tp = sc->sc_tty;
+ bus_chipset_tag_t bc = sc->sc_bc;
+ bus_io_handle_t ioh = sc->sc_ioh;
+ int s;
+
+ /* XXX This is for cons.c. */
+ if (!ISSET(tp->t_state, TS_ISOPEN))
+ return 0;
+
+ (*linesw[tp->t_line].l_close)(tp, flag);
+ s = spltty();
+ CLR(sc->sc_lcr, LCR_SBREAK);
+ bus_io_write_1(bc, ioh, com_lcr, sc->sc_lcr);
+ bus_io_write_1(bc, ioh, com_ier, 0);
+ if (ISSET(tp->t_cflag, HUPCL) &&
+ !ISSET(sc->sc_swflags, COM_SW_SOFTCAR)) {
+ /* XXX perhaps only clear DTR */
+ bus_io_write_1(bc, ioh, com_mcr, 0);
+ bus_io_write_1(bc, ioh, com_fifo, FIFO_RCV_RST | FIFO_XMT_RST);
+ }
+ CLR(tp->t_state, TS_BUSY | TS_FLUSH);
+ if (--drcomsopen == 0)
+ untimeout(drcomsoft, NULL);
+ splx(s);
+ ttyclose(tp);
+#ifdef notyet /* XXXX */
+ if (ISSET(sc->sc_hwflags, COM_HW_CONSOLE)) {
+ ttyfree(tp);
+ sc->sc_tty = 0;
+ }
+#endif
+ return 0;
+}
+
+int
+drcomread(dev, uio, flag)
+ dev_t dev;
+ struct uio *uio;
+ int flag;
+{
+ struct drcom_softc *sc = drcom_cd.cd_devs[COMUNIT(dev)];
+ struct tty *tp = sc->sc_tty;
+
+ return ((*linesw[tp->t_line].l_read)(tp, uio, flag));
+}
+
+int
+drcomwrite(dev, uio, flag)
+ dev_t dev;
+ struct uio *uio;
+ int flag;
+{
+ struct drcom_softc *sc = drcom_cd.cd_devs[COMUNIT(dev)];
+ struct tty *tp = sc->sc_tty;
+
+ return ((*linesw[tp->t_line].l_write)(tp, uio, flag));
+}
+
+struct tty *
+drcomtty(dev)
+ dev_t dev;
+{
+ struct drcom_softc *sc = drcom_cd.cd_devs[COMUNIT(dev)];
+ struct tty *tp = sc->sc_tty;
+
+ return (tp);
+}
+
+static u_char
+tiocm_xxx2mcr(data)
+ int data;
+{
+ u_char m = 0;
+
+ if (ISSET(data, TIOCM_DTR))
+ SET(m, MCR_DTR);
+ if (ISSET(data, TIOCM_RTS))
+ SET(m, MCR_RTS);
+ return m;
+}
+
+int
+drcomioctl(dev, cmd, data, flag, p)
+ dev_t dev;
+ u_long cmd;
+ caddr_t data;
+ int flag;
+ struct proc *p;
+{
+ int unit = COMUNIT(dev);
+ struct drcom_softc *sc = drcom_cd.cd_devs[unit];
+ struct tty *tp = sc->sc_tty;
+ bus_chipset_tag_t bc = sc->sc_bc;
+ bus_io_handle_t ioh = sc->sc_ioh;
+ int error;
+
+ error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
+ if (error >= 0)
+ return error;
+
+ error = ttioctl(tp, cmd, data, flag, p);
+ if (error >= 0)
+ return error;
+
+ switch (cmd) {
+ case TIOCSBRK:
+ SET(sc->sc_lcr, LCR_SBREAK);
+ bus_io_write_1(bc, ioh, com_lcr, sc->sc_lcr);
+ break;
+ case TIOCCBRK:
+ CLR(sc->sc_lcr, LCR_SBREAK);
+ bus_io_write_1(bc, ioh, com_lcr, sc->sc_lcr);
+ break;
+ case TIOCSDTR:
+ SET(sc->sc_mcr, sc->sc_dtr);
+ bus_io_write_1(bc, ioh, com_mcr, sc->sc_mcr);
+ break;
+ case TIOCCDTR:
+ CLR(sc->sc_mcr, sc->sc_dtr);
+ bus_io_write_1(bc, ioh, com_mcr, sc->sc_mcr);
+ break;
+ case TIOCMSET:
+ CLR(sc->sc_mcr, MCR_DTR | MCR_RTS);
+ case TIOCMBIS:
+ SET(sc->sc_mcr, tiocm_xxx2mcr(*(int *)data));
+ bus_io_write_1(bc, ioh, com_mcr, sc->sc_mcr);
+ break;
+ case TIOCMBIC:
+ CLR(sc->sc_mcr, tiocm_xxx2mcr(*(int *)data));
+ bus_io_write_1(bc, ioh, com_mcr, sc->sc_mcr);
+ break;
+ case TIOCMGET: {
+ u_char m;
+ int bits = 0;
+
+ m = sc->sc_mcr;
+ if (ISSET(m, MCR_DTR))
+ SET(bits, TIOCM_DTR);
+ if (ISSET(m, MCR_RTS))
+ SET(bits, TIOCM_RTS);
+ m = sc->sc_msr;
+ if (ISSET(m, MSR_DCD))
+ SET(bits, TIOCM_CD);
+ if (ISSET(m, MSR_CTS))
+ SET(bits, TIOCM_CTS);
+ if (ISSET(m, MSR_DSR))
+ SET(bits, TIOCM_DSR);
+ if (ISSET(m, MSR_RI | MSR_TERI))
+ SET(bits, TIOCM_RI);
+ if (bus_io_read_1(bc, ioh, com_ier))
+ SET(bits, TIOCM_LE);
+ *(int *)data = bits;
+ break;
+ }
+ case TIOCGFLAGS: {
+ int driverbits, userbits = 0;
+
+ driverbits = sc->sc_swflags;
+ if (ISSET(driverbits, COM_SW_SOFTCAR))
+ SET(userbits, TIOCFLAG_SOFTCAR);
+ if (ISSET(driverbits, COM_SW_CLOCAL))
+ SET(userbits, TIOCFLAG_CLOCAL);
+ if (ISSET(driverbits, COM_SW_CRTSCTS))
+ SET(userbits, TIOCFLAG_CRTSCTS);
+ if (ISSET(driverbits, COM_SW_MDMBUF))
+ SET(userbits, TIOCFLAG_MDMBUF);
+
+ *(int *)data = userbits;
+ break;
+ }
+ case TIOCSFLAGS: {
+ int userbits, driverbits = 0;
+
+ error = suser(p->p_ucred, &p->p_acflag);
+ if (error != 0) {
+ return(EPERM);
+ }
+
+ userbits = *(int *)data;
+ if (ISSET(userbits, TIOCFLAG_SOFTCAR) ||
+ ISSET(sc->sc_hwflags, COM_HW_CONSOLE))
+ SET(driverbits, COM_SW_SOFTCAR);
+ if (ISSET(userbits, TIOCFLAG_CLOCAL))
+ SET(driverbits, COM_SW_CLOCAL);
+ if (ISSET(userbits, TIOCFLAG_CRTSCTS))
+ SET(driverbits, COM_SW_CRTSCTS);
+ if (ISSET(userbits, TIOCFLAG_MDMBUF))
+ SET(driverbits, COM_SW_MDMBUF);
+
+ sc->sc_swflags = driverbits;
+ break;
+ }
+ default:
+ return ENOTTY;
+ }
+
+ return 0;
+}
+
+int
+drcomparam(tp, t)
+ struct tty *tp;
+ struct termios *t;
+{
+ struct drcom_softc *sc = drcom_cd.cd_devs[COMUNIT(tp->t_dev)];
+ bus_chipset_tag_t bc = sc->sc_bc;
+ bus_io_handle_t ioh = sc->sc_ioh;
+ int ospeed = drcomspeed(t->c_ospeed);
+ u_char lcr;
+ tcflag_t oldcflag;
+ int s;
+
+ /* check requested parameters */
+ if (ospeed < 0 || (t->c_ispeed && t->c_ispeed != t->c_ospeed))
+ return EINVAL;
+
+ lcr = ISSET(sc->sc_lcr, LCR_SBREAK);
+
+ switch (ISSET(t->c_cflag, CSIZE)) {
+ case CS5:
+ SET(lcr, LCR_5BITS);
+ break;
+ case CS6:
+ SET(lcr, LCR_6BITS);
+ break;
+ case CS7:
+ SET(lcr, LCR_7BITS);
+ break;
+ case CS8:
+ SET(lcr, LCR_8BITS);
+ break;
+ }
+ if (ISSET(t->c_cflag, PARENB)) {
+ SET(lcr, LCR_PENAB);
+ if (!ISSET(t->c_cflag, PARODD))
+ SET(lcr, LCR_PEVEN);
+ }
+ if (ISSET(t->c_cflag, CSTOPB))
+ SET(lcr, LCR_STOPB);
+
+ sc->sc_lcr = lcr;
+
+ s = spltty();
+
+ if (ospeed == 0) {
+ CLR(sc->sc_mcr, MCR_DTR);
+ bus_io_write_1(bc, ioh, com_mcr, sc->sc_mcr);
+ }
+
+ /*
+ * Set the FIFO threshold based on the receive speed, if we are
+ * changing it.
+ */
+#if 1
+ if (tp->t_ispeed != t->c_ispeed) {
+#else
+ if (1) {
+#endif
+ if (ospeed != 0) {
+ /*
+ * Make sure the transmit FIFO is empty before
+ * proceeding. If we don't do this, some revisions
+ * of the UART will hang. Interestingly enough,
+ * even if we do this will the last character is
+ * still being pushed out, they don't hang. This
+ * seems good enough.
+ */
+ while (ISSET(tp->t_state, TS_BUSY)) {
+ int error;
+
+ ++sc->sc_halt;
+ error = ttysleep(tp, &tp->t_outq,
+ TTOPRI | PCATCH, "drcomprm", 0);
+ --sc->sc_halt;
+ if (error) {
+ splx(s);
+ drcomstart(tp);
+ return (error);
+ }
+ }
+
+ bus_io_write_1(bc, ioh, com_lcr, lcr | LCR_DLAB);
+ bus_io_write_1(bc, ioh, com_dlbl, ospeed);
+ bus_io_write_1(bc, ioh, com_dlbh, ospeed >> 8);
+ bus_io_write_1(bc, ioh, com_lcr, lcr);
+ SET(sc->sc_mcr, MCR_DTR);
+ bus_io_write_1(bc, ioh, com_mcr, sc->sc_mcr);
+ } else
+ bus_io_write_1(bc, ioh, com_lcr, lcr);
+
+ if (!ISSET(sc->sc_hwflags, COM_HW_HAYESP) &&
+ ISSET(sc->sc_hwflags, COM_HW_FIFO))
+ bus_io_write_1(bc, ioh, com_fifo,
+ FIFO_ENABLE |
+ (t->c_ispeed <= 1200 ? FIFO_TRIGGER_1 : FIFO_TRIGGER_8));
+ } else
+ bus_io_write_1(bc, ioh, com_lcr, lcr);
+
+ /* When not using CRTSCTS, RTS follows DTR. */
+ if (!ISSET(t->c_cflag, CRTSCTS)) {
+ if (ISSET(sc->sc_mcr, MCR_DTR)) {
+ if (!ISSET(sc->sc_mcr, MCR_RTS)) {
+ SET(sc->sc_mcr, MCR_RTS);
+ bus_io_write_1(bc, ioh, com_mcr, sc->sc_mcr);
+ }
+ } else {
+ if (ISSET(sc->sc_mcr, MCR_RTS)) {
+ CLR(sc->sc_mcr, MCR_RTS);
+ bus_io_write_1(bc, ioh, com_mcr, sc->sc_mcr);
+ }
+ }
+ sc->sc_dtr = MCR_DTR | MCR_RTS;
+ } else
+ sc->sc_dtr = MCR_DTR;
+
+ /* and copy to tty */
+ tp->t_ispeed = t->c_ispeed;
+ tp->t_ospeed = t->c_ospeed;
+ oldcflag = tp->t_cflag;
+ tp->t_cflag = t->c_cflag;
+
+ /*
+ * If DCD is off and MDMBUF is changed, ask the tty layer if we should
+ * stop the device.
+ */
+ if (!ISSET(sc->sc_msr, MSR_DCD) &&
+ !ISSET(sc->sc_swflags, COM_SW_SOFTCAR) &&
+ ISSET(oldcflag, MDMBUF) != ISSET(tp->t_cflag, MDMBUF) &&
+ (*linesw[tp->t_line].l_modem)(tp, 0) == 0) {
+ CLR(sc->sc_mcr, sc->sc_dtr);
+ bus_io_write_1(bc, ioh, com_mcr, sc->sc_mcr);
+ }
+
+ /* Just to be sure... */
+ splx(s);
+ drcomstart(tp);
+ return 0;
+}
+
+void
+drcomstart(tp)
+ struct tty *tp;
+{
+ struct drcom_softc *sc = drcom_cd.cd_devs[COMUNIT(tp->t_dev)];
+ bus_chipset_tag_t bc = sc->sc_bc;
+ bus_io_handle_t ioh = sc->sc_ioh;
+ int s;
+
+ s = spltty();
+ if (ISSET(tp->t_state, TS_BUSY))
+ goto out;
+ if (ISSET(tp->t_state, TS_TIMEOUT | TS_TTSTOP) ||
+ sc->sc_halt > 0)
+ goto stopped;
+ if (ISSET(tp->t_cflag, CRTSCTS) && !ISSET(sc->sc_msr, MSR_CTS))
+ goto stopped;
+ if (tp->t_outq.c_cc <= tp->t_lowat) {
+ if (ISSET(tp->t_state, TS_ASLEEP)) {
+ CLR(tp->t_state, TS_ASLEEP);
+ wakeup(&tp->t_outq);
+ }
+ if (tp->t_outq.c_cc == 0)
+ goto stopped;
+ selwakeup(&tp->t_wsel);
+ }
+ SET(tp->t_state, TS_BUSY);
+
+ if (!ISSET(sc->sc_ier, IER_ETXRDY)) {
+ SET(sc->sc_ier, IER_ETXRDY);
+ bus_io_write_1(bc, ioh, com_ier, sc->sc_ier);
+ }
+#ifdef COM_HAYESP
+ if (ISSET(sc->sc_hwflags, COM_HW_HAYESP)) {
+ u_char buffer[1024], *cp = buffer;
+ int n = q_to_b(&tp->t_outq, cp, sizeof buffer);
+ do
+ bus_io_write_1(bc, ioh, com_data, *cp++);
+ while (--n);
+ }
+ else
+#endif
+ if (ISSET(sc->sc_hwflags, COM_HW_FIFO)) {
+ u_char buffer[16], *cp = buffer;
+ int n = q_to_b(&tp->t_outq, cp, sizeof buffer);
+ do {
+ bus_io_write_1(bc, ioh, com_data, *cp++);
+ } while (--n);
+ } else
+ bus_io_write_1(bc, ioh, com_data, getc(&tp->t_outq));
+out:
+ splx(s);
+ return;
+stopped:
+ if (ISSET(sc->sc_ier, IER_ETXRDY)) {
+ CLR(sc->sc_ier, IER_ETXRDY);
+ bus_io_write_1(bc, ioh, com_ier, sc->sc_ier);
+ }
+ splx(s);
+}
+
+/*
+ * Stop output on a line.
+ */
+void
+drcomstop(tp, flag)
+ struct tty *tp;
+ int flag;
+{
+ int s;
+
+ s = spltty();
+ if (ISSET(tp->t_state, TS_BUSY))
+ if (!ISSET(tp->t_state, TS_TTSTOP))
+ SET(tp->t_state, TS_FLUSH);
+ splx(s);
+}
+
+void
+drcomdiag(arg)
+ void *arg;
+{
+ struct drcom_softc *sc = arg;
+ int overflows, floods, failures;
+ int s;
+
+ s = spltty();
+ sc->sc_errors = 0;
+ overflows = sc->sc_overflows;
+ sc->sc_overflows = 0;
+ floods = sc->sc_floods;
+ sc->sc_floods = 0;
+ failures = sc->sc_failures;
+ sc->sc_failures = 0;
+ splx(s);
+
+ log(LOG_WARNING, "%s: %d silo overflow%s, %d ibuf overflow%s, %d uart failure%s\n",
+ sc->sc_dev.dv_xname,
+ overflows, overflows == 1 ? "" : "s",
+ floods, floods == 1 ? "" : "s",
+ failures, failures == 1 ? "" : "s");
+}
+
+void
+drcomsoft(arg)
+ void *arg;
+{
+ int unit;
+ struct drcom_softc *sc;
+ struct tty *tp;
+ register u_char *ibufp;
+ u_char *ibufend;
+ register int c;
+ int s;
+ static int lsrmap[8] = {
+ 0, TTY_PE,
+ TTY_FE, TTY_PE|TTY_FE,
+ TTY_FE, TTY_PE|TTY_FE,
+ TTY_FE, TTY_PE|TTY_FE
+ };
+
+ s = spltty();
+ if (drcomevents == 0) {
+ splx(s);
+ goto out;
+ }
+ drcomevents = 0;
+ splx(s);
+
+ for (unit = 0; unit < drcom_cd.cd_ndevs; unit++) {
+ sc = drcom_cd.cd_devs[unit];
+ if (sc == 0 || sc->sc_ibufp == sc->sc_ibuf)
+ continue;
+
+ tp = sc->sc_tty;
+
+ s = spltty();
+
+ ibufp = sc->sc_ibuf;
+ ibufend = sc->sc_ibufp;
+
+ if (ibufp == ibufend) {
+ splx(s);
+ continue;
+ }
+
+ sc->sc_ibufp = sc->sc_ibuf = (ibufp == sc->sc_ibufs[0]) ?
+ sc->sc_ibufs[1] : sc->sc_ibufs[0];
+ sc->sc_ibufhigh = sc->sc_ibuf + COM_IHIGHWATER;
+ sc->sc_ibufend = sc->sc_ibuf + COM_IBUFSIZE;
+
+ if (tp == 0 || !ISSET(tp->t_state, TS_ISOPEN)) {
+ splx(s);
+ continue;
+ }
+
+ if (ISSET(tp->t_cflag, CRTSCTS) &&
+ !ISSET(sc->sc_mcr, MCR_RTS)) {
+ /* XXX */
+ SET(sc->sc_mcr, MCR_RTS);
+ bus_io_write_1(sc->sc_bc, sc->sc_ioh, com_mcr,
+ sc->sc_mcr);
+ }
+
+ splx(s);
+
+ while (ibufp < ibufend) {
+ c = *ibufp++;
+ if (*ibufp & LSR_OE) {
+ sc->sc_overflows++;
+ if (sc->sc_errors++ == 0)
+ timeout(drcomdiag, sc, 60 * hz);
+ }
+ /* This is ugly, but fast. */
+ c |= lsrmap[(*ibufp++ & (LSR_BI|LSR_FE|LSR_PE)) >> 2];
+ (*linesw[tp->t_line].l_rint)(c, tp);
+ }
+ }
+
+out:
+ timeout(drcomsoft, NULL, 1);
+}
+
+int
+drcomintr(arg)
+ void *arg;
+{
+ struct drcom_softc *sc = arg;
+ bus_chipset_tag_t bc = sc->sc_bc;
+ bus_io_handle_t ioh = sc->sc_ioh;
+ struct tty *tp;
+ u_char iir, lsr, data, msr, delta;
+#ifdef COM_DEBUG
+ int n;
+ struct {
+ u_char iir, lsr, msr;
+ } iter[32];
+#endif
+
+#ifdef COM_DEBUG
+ n = 0;
+ iter[n].iir =
+#endif
+ iir = bus_io_read_1(bc, ioh, com_iir);
+ if (ISSET(iir, IIR_NOPEND))
+ return (0);
+
+ tp = sc->sc_tty;
+
+ for (;;) {
+#ifdef COM_DEBUG
+ iter[n].lsr =
+#endif
+ lsr = bus_io_read_1(bc, ioh, com_lsr);
+
+ if (ISSET(lsr, LSR_RXRDY)) {
+ register u_char *p = sc->sc_ibufp;
+
+ drcomevents = 1;
+ do {
+ data = bus_io_read_1(bc, ioh, com_data);
+ if (ISSET(lsr, LSR_BI)) {
+#ifdef notdef
+ printf("break %02x %02x %02x %02x\n",
+ sc->sc_msr, sc->sc_mcr, sc->sc_lcr,
+ sc->sc_dtr);
+#endif
+#ifdef DDB
+ if (ISSET(sc->sc_hwflags,
+ COM_HW_CONSOLE)) {
+ Debugger();
+ goto next;
+ }
+#endif
+ }
+ if (p >= sc->sc_ibufend) {
+ sc->sc_floods++;
+ if (sc->sc_errors++ == 0)
+ timeout(drcomdiag, sc, 60 * hz);
+ } else {
+ *p++ = data;
+ *p++ = lsr;
+ if (p == sc->sc_ibufhigh &&
+ ISSET(tp->t_cflag, CRTSCTS)) {
+ /* XXX */
+ CLR(sc->sc_mcr, MCR_RTS);
+ bus_io_write_1(bc, ioh,
+ com_mcr, sc->sc_mcr);
+ }
+ }
+#ifdef DDB
+ next:
+#endif
+#ifdef COM_DEBUG
+ if (++n >= 32)
+ goto ohfudge;
+ iter[n].lsr =
+#endif
+ lsr = bus_io_read_1(bc, ioh, com_lsr);
+ } while (ISSET(lsr, LSR_RXRDY));
+
+ sc->sc_ibufp = p;
+ } else {
+#ifdef COM_DEBUG
+ if (ISSET(lsr, LSR_BI|LSR_FE|LSR_PE|LSR_OE))
+ printf("weird lsr %02x\n", lsr);
+#endif
+ if ((iir & IIR_IMASK) == IIR_RXRDY) {
+ sc->sc_failures++;
+ if (sc->sc_errors++ == 0)
+ timeout(drcomdiag, sc, 60 * hz);
+ bus_io_write_1(bc, ioh, com_ier, 0);
+ delay(10);
+ bus_io_write_1(bc, ioh, com_ier, sc->sc_ier);
+ iir = IIR_NOPEND;
+ continue;
+ }
+ }
+
+#ifdef COM_DEBUG
+ iter[n].msr =
+#endif
+ msr = bus_io_read_1(bc, ioh, com_msr);
+
+ if (msr != sc->sc_msr) {
+ delta = msr ^ sc->sc_msr;
+ sc->sc_msr = msr;
+ if (ISSET(delta, MSR_DCD) &&
+ !ISSET(sc->sc_swflags, COM_SW_SOFTCAR) &&
+ (*linesw[tp->t_line].l_modem)(tp, ISSET(msr, MSR_DCD)) == 0) {
+ CLR(sc->sc_mcr, sc->sc_dtr);
+ bus_io_write_1(bc, ioh, com_mcr, sc->sc_mcr);
+ }
+ if (ISSET(delta & msr, MSR_CTS) &&
+ ISSET(tp->t_cflag, CRTSCTS)) {
+ /* the line is up and we want to do rts/cts flow control */
+ (*linesw[tp->t_line].l_start)(tp);
+ }
+ }
+
+ if (ISSET(lsr, LSR_TXRDY) && ISSET(tp->t_state, TS_BUSY)) {
+ CLR(tp->t_state, TS_BUSY | TS_FLUSH);
+ if (sc->sc_halt > 0)
+ wakeup(&tp->t_outq);
+ (*linesw[tp->t_line].l_start)(tp);
+ }
+
+#ifdef COM_DEBUG
+ if (++n >= 32)
+ goto ohfudge;
+ iter[n].iir =
+#endif
+ iir = bus_io_read_1(bc, ioh, com_iir);
+ if (ISSET(iir, IIR_NOPEND))
+ return (1);
+ }
+
+#ifdef COM_DEBUG
+ohfudge:
+ printf("drcomintr: too many iterations");
+ for (n = 0; n < 32; n++) {
+ if ((n % 4) == 0)
+ printf("\ndrcomintr: iter[%02d]", n);
+ printf(" %02x %02x %02x", iter[n].iir, iter[n].lsr, iter[n].msr);
+ }
+ printf("\n");
+ printf("drcomintr: msr %02x mcr %02x lcr %02x ier %02x\n",
+ sc->sc_msr, sc->sc_mcr, sc->sc_lcr, sc->sc_ier);
+ printf("drcomintr: state %08x cc %d\n", sc->sc_tty->t_state,
+ sc->sc_tty->t_outq.c_cc);
+ return (1);
+#endif
+}
+
+/*
+ * Following are all routines needed for COM to act as console
+ */
+#include <dev/cons.h>
+
+void
+drcomcnprobe(cp)
+ struct consdev *cp;
+{
+ /* XXX NEEDS TO BE FIXED XXX */
+ bus_chipset_tag_t bc = 0;
+ bus_io_handle_t ioh;
+ int found;
+
+ if (bus_io_map(bc, CONADDR, COM_NPORTS, &ioh)) {
+ cp->cn_pri = CN_DEAD;
+ return;
+ }
+ found = 1/*drcomprobe1(bc, ioh, CONADDR)*/;
+ bus_io_unmap(bc, ioh, COM_NPORTS);
+ if (!found) {
+ cp->cn_pri = CN_DEAD;
+ return;
+ }
+
+ /* locate the major number */
+ for (drcommajor = 0; drcommajor < nchrdev; drcommajor++)
+ if (cdevsw[drcommajor].d_open == drcomopen)
+ break;
+
+ /* initialize required fields */
+ cp->cn_dev = makedev(drcommajor, CONUNIT);
+#ifdef COMCONSOLE
+ cp->cn_pri = CN_REMOTE; /* Force a serial port console */
+#else
+ cp->cn_pri = CN_NORMAL;
+#endif
+}
+
+void
+drcomcninit(cp)
+ struct consdev *cp;
+{
+
+#if 0
+ XXX NEEDS TO BE FIXED XXX
+ drcomconsbc = ???;
+#endif
+ if (bus_io_map(drcomconsbc, CONADDR, COM_NPORTS, &drcomconsioh))
+ panic("drcomcninit: mapping failed");
+
+ drcominit(drcomconsbc, drcomconsioh, drcomdefaultrate);
+ drcomconsaddr = CONADDR;
+ drcomconsinit = 0;
+}
+
+void
+drcominit(bc, ioh, rate)
+ bus_chipset_tag_t bc;
+ bus_io_handle_t ioh;
+ int rate;
+{
+ int s = splhigh();
+ u_char stat;
+
+ bus_io_write_1(bc, ioh, com_lcr, LCR_DLAB);
+ rate = drcomspeed(drcomdefaultrate);
+ bus_io_write_1(bc, ioh, com_dlbl, rate);
+ bus_io_write_1(bc, ioh, com_dlbh, rate >> 8);
+ bus_io_write_1(bc, ioh, com_lcr, LCR_8BITS);
+ bus_io_write_1(bc, ioh, com_ier, IER_ERXRDY | IER_ETXRDY);
+ bus_io_write_1(bc, ioh, com_fifo,
+ FIFO_ENABLE | FIFO_RCV_RST | FIFO_XMT_RST | FIFO_TRIGGER_1);
+ bus_io_write_1(bc, ioh, com_mcr, MCR_DTR | MCR_RTS);
+ DELAY(100);
+ stat = bus_io_read_1(bc, ioh, com_iir);
+ splx(s);
+}
+
+int
+drcomcngetc(dev)
+ dev_t dev;
+{
+ int s = splhigh();
+ bus_chipset_tag_t bc = drcomconsbc;
+ bus_io_handle_t ioh = drcomconsioh;
+ u_char stat, c;
+
+ while (!ISSET(stat = bus_io_read_1(bc, ioh, com_lsr), LSR_RXRDY))
+ ;
+ c = bus_io_read_1(bc, ioh, com_data);
+ stat = bus_io_read_1(bc, ioh, com_iir);
+ splx(s);
+ return c;
+}
+
+/*
+ * Console kernel output character routine.
+ */
+void
+drcomcnputc(dev, c)
+ dev_t dev;
+ int c;
+{
+ int s = splhigh();
+ bus_chipset_tag_t bc = drcomconsbc;
+ bus_io_handle_t ioh = drcomconsioh;
+ u_char stat;
+ register int timo;
+
+#ifdef KGDB
+ if (dev != kgdb_dev)
+#endif
+ if (drcomconsinit == 0) {
+ drcominit(bc, ioh, drcomdefaultrate);
+ drcomconsinit = 1;
+ }
+ /* wait for any pending transmission to finish */
+ timo = 50000;
+ while (!ISSET(stat = bus_io_read_1(bc, ioh, com_lsr), LSR_TXRDY) && --timo)
+ ;
+ bus_io_write_1(bc, ioh, com_data, c);
+ /* wait for this transmission to drcomplete */
+ timo = 1500000;
+ while (!ISSET(stat = bus_io_read_1(bc, ioh, com_lsr), LSR_TXRDY) && --timo)
+ ;
+ /* clear any interrupts generated by this transmission */
+ stat = bus_io_read_1(bc, ioh, com_iir);
+ splx(s);
+}
+
+void
+drcomcnpollc(dev, on)
+ dev_t dev;
+ int on;
+{
+
+}
diff --git a/sys/arch/amiga/dev/drcomvar.h b/sys/arch/amiga/dev/drcomvar.h
new file mode 100644
index 00000000000..f6431d2a4b4
--- /dev/null
+++ b/sys/arch/amiga/dev/drcomvar.h
@@ -0,0 +1,40 @@
+/* $OpenBSD: drcomvar.h,v 1.1 1997/01/16 09:23:56 niklas Exp $ */
+/* $NetBSD: drcomvar.h,v 1.1 1996/11/30 00:43:04 is Exp $ */
+
+/*
+ * Copyright (c) 1996 Christopher G. Demetriou. 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 Christopher G. Demetriou
+ * for the NetBSD Project.
+ * 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.
+ */
+
+int comintr __P((void *));
+
+extern int comconsaddr;
+extern int comconsattached;
+extern bus_chipset_tag_t comconsbc;
+extern bus_io_handle_t comconsioh;
+extern tcflag_t comconscflag;
diff --git a/sys/arch/amiga/dev/drisavar.h b/sys/arch/amiga/dev/drisavar.h
new file mode 100644
index 00000000000..04e102ea750
--- /dev/null
+++ b/sys/arch/amiga/dev/drisavar.h
@@ -0,0 +1,23 @@
+/* $OpenBSD: drisavar.h,v 1.1 1997/01/16 09:23:57 niklas Exp $ */
+/* $NetBSD: drisavar.h,v 1.1 1996/11/30 00:43:05 is Exp $ */
+
+#ifndef DRISAVAR_H
+
+#ifndef DRCCADDR
+#include <amiga/amiga/drcustom.h>
+#endif
+
+#define i2drabs(io) (DRCCADDR + NBPG * DRSUPIOPG + (io << 2) + 1)
+#define i2drrel(ioh,io) (ioh + (io << 2))
+
+#define bus_chipset_tag_t void *
+#define bus_io_handle_t vm_offset_t
+
+#define bus_io_map(bc, iob, n, iohp) (*(iohp) = i2drabs(iob), 0)
+#define bus_io_unmap(bc, ioh, n) do {(void)bc; (void)ioh; (void)n;} while (0)
+
+#define bus_io_read_1(bt, ioh, off) ((void)bc, *(u_int8_t *)i2drrel(ioh, off))
+#define bus_io_write_1(bt, ioh, off, val) do {\
+ (void)bt; *(u_int8_t *)i2drrel(ioh, off) = (val); } while (0)
+
+#endif
diff --git a/sys/arch/amiga/dev/drsc.c b/sys/arch/amiga/dev/drsc.c
index 09768e8fe91..d79459f5ef5 100644
--- a/sys/arch/amiga/dev/drsc.c
+++ b/sys/arch/amiga/dev/drsc.c
@@ -1,4 +1,5 @@
-/* $NetBSD: drsc.c,v 1.2 1996/05/19 19:03:01 is Exp $ */
+/* $OpenBSD: drsc.c,v 1.3 1997/01/16 09:23:58 niklas Exp $ */
+/* $NetBSD: drsc.c,v 1.9 1996/12/23 09:09:57 veego Exp $ */
/*
* Copyright (c) 1996 Ignatios Souvatzis
@@ -97,8 +98,9 @@ drscmatch(pdp, match, auxp)
struct device *pdp;
void *match, *auxp;
{
- struct cfdata *cdp = (struct cfdata *)match;
- if (is_draco() && (cdp->cf_unit == 0))
+ struct cfdata *cfp = (struct cfdata *)match;
+
+ if (is_draco() && matchname(auxp, "drsc") && (cfp->cf_unit == 0))
return(1);
return(0);
}
diff --git a/sys/arch/amiga/dev/empsc.c b/sys/arch/amiga/dev/empsc.c
index a603e4d9be6..369de4349bd 100644
--- a/sys/arch/amiga/dev/empsc.c
+++ b/sys/arch/amiga/dev/empsc.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: empsc.c,v 1.4 1996/11/23 21:45:07 kstailey Exp $ */
-/* $NetBSD: empsc.c,v 1.7 1996/05/10 13:02:33 is Exp $ */
+/* $OpenBSD: empsc.c,v 1.5 1997/01/16 09:23:59 niklas Exp $ */
+/* $NetBSD: empsc.c,v 1.13 1996/12/23 09:09:58 veego Exp $ */
/*
diff --git a/sys/arch/amiga/dev/event.c b/sys/arch/amiga/dev/event.c
index 1de83faa4b9..d727e795c7c 100644
--- a/sys/arch/amiga/dev/event.c
+++ b/sys/arch/amiga/dev/event.c
@@ -1,4 +1,5 @@
-/* $NetBSD: event.c,v 1.3.6.1 1996/05/31 09:17:39 is Exp $ */
+/* $OpenBSD: event.c,v 1.3 1997/01/16 09:24:00 niklas Exp $ */
+/* $NetBSD: event.c,v 1.5 1996/10/11 21:12:43 mhitch Exp $ */
/*
* Copyright (c) 1992, 1993
diff --git a/sys/arch/amiga/dev/event_var.h b/sys/arch/amiga/dev/event_var.h
index 95dd5fa8807..52fc3a84a88 100644
--- a/sys/arch/amiga/dev/event_var.h
+++ b/sys/arch/amiga/dev/event_var.h
@@ -1,4 +1,5 @@
-/* $NetBSD: event_var.h,v 1.2 1994/10/26 02:03:00 cgd Exp $ */
+/* $OpenBSD: event_var.h,v 1.2 1997/01/16 09:24:02 niklas Exp $ */
+/* $NetBSD: event_var.h,v 1.3 1996/10/11 21:12:46 mhitch Exp $ */
/*
* Copyright (c) 1992, 1993
diff --git a/sys/arch/amiga/dev/fd.c b/sys/arch/amiga/dev/fd.c
index 6fa601a477c..46f0d15589f 100644
--- a/sys/arch/amiga/dev/fd.c
+++ b/sys/arch/amiga/dev/fd.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: fd.c,v 1.10 1996/11/23 21:45:08 kstailey Exp $ */
-/* $NetBSD: fd.c,v 1.32 1996/05/04 04:54:00 mhitch Exp $ */
+/* $OpenBSD: fd.c,v 1.11 1997/01/16 09:24:03 niklas Exp $ */
+/* $NetBSD: fd.c,v 1.36 1996/12/23 09:09:59 veego Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
diff --git a/sys/arch/amiga/dev/flsc.c b/sys/arch/amiga/dev/flsc.c
index 35875d2d3d5..a58d0b4755e 100644
--- a/sys/arch/amiga/dev/flsc.c
+++ b/sys/arch/amiga/dev/flsc.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: flsc.c,v 1.6 1996/11/23 21:45:09 kstailey Exp $ */
-/* $NetBSD: flsc.c,v 1.5.4.3 1996/08/05 20:40:35 jtc Exp $ */
+/* $OpenBSD: flsc.c,v 1.7 1997/01/16 09:24:04 niklas Exp $ */
+/* $NetBSD: flsc.c,v 1.14 1996/12/23 09:10:00 veego Exp $ */
/*
* Copyright (c) 1995 Daniel Widenfalk
diff --git a/sys/arch/amiga/dev/genpar.c b/sys/arch/amiga/dev/genpar.c
index a2cafad320a..0efcf0ed133 100644
--- a/sys/arch/amiga/dev/genpar.c
+++ b/sys/arch/amiga/dev/genpar.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: genpar.c,v 1.2 1997/01/16 09:24:06 niklas Exp $ */
/* $NetBSD: genpar.c,v 1.6 1995/02/16 21:57:31 chopps Exp $ */
/*
diff --git a/sys/arch/amiga/dev/grf.c b/sys/arch/amiga/dev/grf.c
index 3366f4ec3a6..be8f6d4ff00 100644
--- a/sys/arch/amiga/dev/grf.c
+++ b/sys/arch/amiga/dev/grf.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: grf.c,v 1.7 1996/11/24 20:23:40 niklas Exp $ */
-/* $NetBSD: grf.c,v 1.27 1996/05/19 20:06:20 is Exp $ */
+/* $OpenBSD: grf.c,v 1.8 1997/01/16 09:24:07 niklas Exp $ */
+/* $NetBSD: grf.c,v 1.32 1996/12/23 09:10:01 veego Exp $ */
/*
* Copyright (c) 1988 University of Utah.
diff --git a/sys/arch/amiga/dev/grf_cc.c b/sys/arch/amiga/dev/grf_cc.c
index 94b68bfb9d3..e0ca7993de9 100644
--- a/sys/arch/amiga/dev/grf_cc.c
+++ b/sys/arch/amiga/dev/grf_cc.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: grf_cc.c,v 1.5 1996/11/24 20:23:41 niklas Exp $ */
-/* $NetBSD: grf_cc.c,v 1.19 1996/04/21 21:11:08 veego Exp $ */
+/* $OpenBSD: grf_cc.c,v 1.6 1997/01/16 09:24:08 niklas Exp $ */
+/* $NetBSD: grf_cc.c,v 1.23 1996/12/23 09:10:02 veego Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
diff --git a/sys/arch/amiga/dev/grf_cl.c b/sys/arch/amiga/dev/grf_cl.c
index a3c01db9bcb..03c48dd9b1e 100644
--- a/sys/arch/amiga/dev/grf_cl.c
+++ b/sys/arch/amiga/dev/grf_cl.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: grf_cl.c,v 1.8 1996/11/24 20:23:42 niklas Exp $ */
-/* $NetBSD: grf_cl.c,v 1.11.4.1 1996/05/27 10:50:40 is Exp $ */
+/* $OpenBSD: grf_cl.c,v 1.9 1997/01/16 09:24:10 niklas Exp $ */
+/* $NetBSD: grf_cl.c,v 1.18 1996/12/23 09:10:04 veego Exp $ */
/*
* Copyright (c) 1995 Ezra Story
@@ -161,7 +161,7 @@ static void *cl_fbaddr = 0; /* framebuffer */
static void *cl_regaddr = 0; /* registers */
static int cl_fbsize; /* framebuffer size */
-/* current sprite info, if you add summport for multiple boards
+/* current sprite info, if you add support for multiple boards
* make this an array or something
*/
struct grf_spriteinfo cl_cursprite;
@@ -358,8 +358,8 @@ grfclattach(pdp, dp, auxp)
int
grfclprint(auxp, pnp)
- void *auxp;
- const char *pnp;
+ void *auxp;
+ const char *pnp;
{
if (pnp)
printf("ite at %s: ", pnp);
@@ -553,7 +553,7 @@ cl_blank(gp, on)
struct grf_softc *gp;
int *on;
{
- WSeq(gp->g_regkva, SEQ_ID_CLOCKING_MODE, *on ? 0x01 : 0x21);
+ WSeq(gp->g_regkva, SEQ_ID_CLOCKING_MODE, *on > 0 ? 0x01 : 0x21);
return(0);
}
@@ -1281,7 +1281,7 @@ cl_load_mon(gp, md)
sr15 = ((cl_fbsize / 0x100000 == 2) ? 0x38 : 0xb8);
WSeq(ba, SEQ_ID_CONF_RBACK, 0x00);
} else {
- sr15 = (TEXT || (gv->depth == 1)) ? 0x90 : 0xb0;
+ sr15 = (TEXT || (gv->depth == 1)) ? 0xd0 : 0xb0;
}
WSeq(ba, SEQ_ID_DRAM_CNTL, sr15);
WGfx(ba, GCT_ID_READ_MAP_SELECT, 0x00);
diff --git a/sys/arch/amiga/dev/grf_clreg.h b/sys/arch/amiga/dev/grf_clreg.h
index 228df97f167..048cc22105e 100644
--- a/sys/arch/amiga/dev/grf_clreg.h
+++ b/sys/arch/amiga/dev/grf_clreg.h
@@ -1,5 +1,5 @@
-/* $OpenBSD: grf_clreg.h,v 1.5 1996/08/23 18:52:38 niklas Exp $ */
-/* $NetBSD: grf_clreg.h,v 1.4.4.1 1996/05/27 10:50:42 is Exp $ */
+/* $OpenBSD: grf_clreg.h,v 1.6 1997/01/16 09:24:11 niklas Exp $ */
+/* $NetBSD: grf_clreg.h,v 1.5 1996/10/08 23:18:51 thorpej Exp $ */
/*
* Copyright (c) 1995 Ezra Story
diff --git a/sys/arch/amiga/dev/grf_cv.c b/sys/arch/amiga/dev/grf_cv.c
index b37595238c4..1dc6fddfc17 100644
--- a/sys/arch/amiga/dev/grf_cv.c
+++ b/sys/arch/amiga/dev/grf_cv.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: grf_cv.c,v 1.13 1996/11/24 20:23:44 niklas Exp $ */
-/* $NetBSD: grf_cv.c,v 1.14 1996/05/19 21:05:27 veego Exp $ */
+/* $OpenBSD: grf_cv.c,v 1.14 1997/01/16 09:24:13 niklas Exp $ */
+/* $NetBSD: grf_cv.c,v 1.20 1996/12/23 09:10:05 veego Exp $ */
/*
* Copyright (c) 1995 Michael Teske
@@ -114,18 +114,7 @@ static struct grfvideo_mode monitor_def[24] = {
static struct grfvideo_mode *monitor_current = &monitor_def[0];
#define MAXPIXELCLOCK 135000000 /* safety */
-#if 0
-/* generated by gen_cvtab.c */
-static int cv_convtab[31] = {
- 163, 148, 135, 124, 114,
- 106, 98, 91, 85, 79,
- 74, 69, 65, 61, 57,
- 53, 50, 47, 44, 42,
- 39, 37, 35, 33, 31,
- 29, 27, 26, 24, 22,
- 21,
-};
-#endif
+unsigned char cv_pass_toggle; /* passthru status tracker */
/* Console display definition.
* Default hardcoded text mode. This grf_cv is set up to
@@ -796,7 +785,7 @@ cv_blank(gp, on)
volatile caddr_t ba;
ba = gp->g_regkva;
- gfx_on_off(*on ? 0 : 1, ba);
+ gfx_on_off(*on > 0 ? 0 : 1, ba);
return (0);
}
@@ -823,7 +812,7 @@ cv_mode(gp, cmd, arg, a2, a3)
case GM_GRFOFF:
#ifndef CV64CONSOLE
- (void)cv_toggle(gp);
+ cvscreen(1, gp->g_regkva - 0x02000000)
#else
cv_load_mon(gp, &cvconsole_mode);
ite_reinit(gp->g_itedev);
@@ -1051,7 +1040,17 @@ cv_toggle(gp)
volatile caddr_t ba;
ba = gp->g_regkva;
- cvscreen(1, ba - 0x02000000);
+#ifndef CV64CONSOLE
+ cv_pass_toggle = 1;
+#endif /* !CV64CONSOLE */
+
+ if (cv_pass_toggle) {
+ cvscreen(0, ba - 0x02000000);
+ cv_pass_toggle = 0;
+ } else {
+ cvscreen(1, ba - 0x02000000);
+ cv_pass_toggle = 1;
+ }
return (0);
}
@@ -1425,7 +1424,7 @@ cv_load_mon(gp, md)
* Divide by 1000 to prevent overflows.
*/
- tfillm = (96 * (cv_memclk/1000))/240000;
+ tfillm = (96 * (cv_memclk/1000))/240000;
switch(gv->depth) {
case 32:
diff --git a/sys/arch/amiga/dev/grf_et.c b/sys/arch/amiga/dev/grf_et.c
index 968fe19114d..3aed82e5d23 100644
--- a/sys/arch/amiga/dev/grf_et.c
+++ b/sys/arch/amiga/dev/grf_et.c
@@ -1,4 +1,5 @@
-/* $NetBSD: grf_et.c,v 1.1.4.2 1996/06/04 09:01:21 is Exp $ */
+/* $OpenBSD: grf_et.c,v 1.5 1997/01/16 09:24:15 niklas Exp $ */
+/* $NetBSD: grf_et.c,v 1.8 1996/12/23 09:10:06 veego Exp $ */
/*
* Copyright (c) 1996 Tobias Abt
@@ -235,13 +236,13 @@ grfetmatch(pdp, match, auxp)
/* Configure either registers or framebuffer in any order */
/* as said before, oMniBus does not support ProdID */
if (ettype == OMNIBUS) {
- if (zap->size == 64*1024) {
+ if (zap->size == 64 * 1024) {
/* register area */
- et_regaddr=zap->va;
+ et_regaddr = zap->va;
} else {
/* memory area */
- et_fbaddr=zap->va;
- et_fbsize=zap->size;
+ et_fbaddr = zap->va;
+ et_fbsize = zap->size;
}
} else {
if (zap->prodid == regprod) {
@@ -365,8 +366,8 @@ grfetattach(pdp, dp, auxp)
int
grfetprint(auxp, pnp)
- void *auxp;
- const char *pnp;
+ void *auxp;
+ const char *pnp;
{
if (pnp)
printf("ite at %s: ", pnp);
@@ -387,34 +388,41 @@ et_boardinit(gp)
RegOnpass(ba);
if (ettype == MERLIN) {
- /* Merlin needs some special initialisations */
- vgaw(ba, MERLIN_SWITCH_REG, 0);
- delay(20000);
- vgaw(ba, MERLIN_SWITCH_REG, 8);
- delay(20000);
- vgaw(ba, MERLIN_SWITCH_REG, 0);
- delay(20000);
- vgaw(ba, MERLIN_VDAC_DATA, 1);
-
- vgaw(ba, MERLIN_VDAC_INDEX, 0x00);
- vgaw(ba, MERLIN_VDAC_SPRITE, 0xff);
- vgaw(ba, MERLIN_VDAC_INDEX, 0x01);
- vgaw(ba, MERLIN_VDAC_SPRITE, 0x0f);
- vgaw(ba, MERLIN_VDAC_INDEX, 0x02);
- vgaw(ba, MERLIN_VDAC_SPRITE, 0x42);
- vgaw(ba, MERLIN_VDAC_INDEX, 0x03);
- vgaw(ba, MERLIN_VDAC_SPRITE, 0x00);
-
- vgaw(ba, MERLIN_VDAC_DATA, 0);
+ /* Merlin needs some special initialisations */
+ vgaw(ba, MERLIN_SWITCH_REG, 0);
+ delay(20000);
+ vgaw(ba, MERLIN_SWITCH_REG, 8);
+ delay(20000);
+ vgaw(ba, MERLIN_SWITCH_REG, 0);
+ delay(20000);
+ vgaw(ba, MERLIN_VDAC_DATA, 1);
+
+ vgaw(ba, MERLIN_VDAC_INDEX, 0x00);
+ vgaw(ba, MERLIN_VDAC_SPRITE, 0xff);
+ vgaw(ba, MERLIN_VDAC_INDEX, 0x01);
+ vgaw(ba, MERLIN_VDAC_SPRITE, 0x0f);
+ vgaw(ba, MERLIN_VDAC_INDEX, 0x02);
+ vgaw(ba, MERLIN_VDAC_SPRITE, 0x42);
+ vgaw(ba, MERLIN_VDAC_INDEX, 0x03);
+ vgaw(ba, MERLIN_VDAC_SPRITE, 0x00);
+
+ vgaw(ba, MERLIN_VDAC_DATA, 0);
}
/* setup initial unchanging parameters */
- vgaw(ba, GREG_HERCULESCOMPAT, 0x03);
+ vgaw(ba, GREG_HERCULESCOMPAT + ((ettype == DOMINO) ? 0x0fff : 0), 0x03);
vgaw(ba, GREG_DISPMODECONTROL, 0xa0);
vgaw(ba, GREG_MISC_OUTPUT_W, 0x63);
+ if (ettype == DOMINO)
+ {
+ vgaw(ba, CRT_ADDRESS, CRT_ID_VIDEO_CONFIG1);
+ vgaw(ba, CRT_ADDRESS_W + 0x0fff,
+ 0xc0 | vgar(ba, CRT_ADDRESS_R + 0x0fff));
+ }
+
WSeq(ba, SEQ_ID_RESET, 0x03);
WSeq(ba, SEQ_ID_CLOCKING_MODE, 0x21); /* 8 dot, Display off */
WSeq(ba, SEQ_ID_MAP_MASK, 0x0f);
@@ -480,17 +488,17 @@ et_boardinit(gp)
case MERLIN:
vgaw(ba, MERLIN_VDAC_INDEX, 0);
for (x = 255; x >= 0; x--) {
- vgaw(ba, MERLIN_VDAC_COLORS, x);
- vgaw(ba, MERLIN_VDAC_COLORS, x);
- vgaw(ba, MERLIN_VDAC_COLORS, x);
+ vgaw(ba, MERLIN_VDAC_COLORS, x);
+ vgaw(ba, MERLIN_VDAC_COLORS, x);
+ vgaw(ba, MERLIN_VDAC_COLORS, x);
}
break;
default:
vgaw(ba, VDAC_ADDRESS_W, 0);
for (x = 255; x >= 0; x--) {
- vgaw(ba, VDAC_DATA, x);
- vgaw(ba, VDAC_DATA, x);
- vgaw(ba, VDAC_DATA, x);
+ vgaw(ba, VDAC_DATA + ((ettype == DOMINO) ? 0x0fff : 0), x);
+ vgaw(ba, VDAC_DATA + ((ettype == DOMINO) ? 0x0fff : 0), x);
+ vgaw(ba, VDAC_DATA + ((ettype == DOMINO) ? 0x0fff : 0), x);
}
break;
}
@@ -505,16 +513,16 @@ et_boardinit(gp)
/* card spezific initialisations */
switch(ettype) {
case OMNIBUS:
- etctype=et_getControllerType(gp);
- etdtype=et_getDACType(gp);
+ etctype = et_getControllerType(gp);
+ etdtype = et_getDACType(gp);
break;
case MERLIN:
- etctype=ETW32;
- etdtype=MERLINDAC;
- break;
+ etctype = ETW32;
+ etdtype = MERLINDAC;
+ break;
case DOMINO:
- etctype=ET4000;
- etdtype=SIERRA11483;
+ etctype = ET4000;
+ etdtype = SIERRA11483;
break;
}
}
@@ -535,26 +543,26 @@ et_getvmode(gp, vm)
vm->depth = etconsole_mode.fy;
} else
#endif
- {
- if (vm->mode_num == 0)
- vm->mode_num = (monitor_current - monitor_def) + 1;
- if (vm->mode_num < 1 || vm->mode_num > monitor_def_max)
- return (EINVAL);
- gv = monitor_def + (vm->mode_num - 1);
- if (gv->mode_num == 0)
- return (EINVAL);
-
- bcopy(gv, vm, sizeof(struct grfvideo_mode));
- }
-
- /* adjust internal values to pixel values */
-
- vm->hblank_start *= 8;
- vm->hblank_stop *= 8;
- vm->hsync_start *= 8;
- vm->hsync_stop *= 8;
- vm->htotal *= 8;
-
+ {
+ if (vm->mode_num == 0)
+ vm->mode_num = (monitor_current - monitor_def) + 1;
+ if (vm->mode_num < 1 || vm->mode_num > monitor_def_max)
+ return (EINVAL);
+ gv = monitor_def + (vm->mode_num - 1);
+ if (gv->mode_num == 0)
+ return (EINVAL);
+
+ bcopy(gv, vm, sizeof(struct grfvideo_mode));
+ }
+
+ /* adjust internal values to pixel values */
+
+ vm->hblank_start *= 8;
+ vm->hblank_stop *= 8;
+ vm->hsync_start *= 8;
+ vm->hsync_stop *= 8;
+ vm->htotal *= 8;
+
return (0);
}
@@ -589,13 +597,12 @@ et_off(gp)
int
et_blank(gp, on)
- struct grf_softc *gp;
- int *on;
+ struct grf_softc *gp;
+ int *on;
{
- WSeq(gp->g_regkva, SEQ_ID_CLOCKING_MODE, *on ? 0x01 : 0x21);
- return(0);
+ WSeq(gp->g_regkva, SEQ_ID_CLOCKING_MODE, *on > 0 ? 0x01 : 0x21);
+ return(0);
}
-
/*
* Change the mode of the display.
@@ -609,7 +616,7 @@ et_mode(gp, cmd, arg, a2, a3)
u_long a2;
int a3;
{
- int error;
+ int error;
switch (cmd) {
case GM_GRFON:
@@ -689,7 +696,7 @@ et_ioctl(gp, cmd, data)
case GRFIOCSETMON:
return (et_setmonitor(gp, (struct grfvideo_mode *) data));
- case GRFIOCBLANK:
+ case GRFIOCBLANK:
return (et_blank(gp, (int *)data));
}
return (EINVAL);
@@ -728,19 +735,19 @@ et_setmousepos(gp, data)
if (et_cursprite.pos.x == data->x && et_cursprite.pos.y == data->y)
return (0);
- /* current and previous real coordinates */
+ /* current and previous real coordinates */
rx = data->x - et_cursprite.hot.x;
ry = data->y - et_cursprite.hot.y;
prx = et_cursprite.pos.x - et_cursprite.hot.x;
pry = et_cursprite.pos.y - et_cursprite.hot.y;
- /* if we are/were on an edge, create (un)shifted bitmap --
- * ripped out optimization (not extremely worthwhile,
- * and kind of buggy anyhow).
- */
+ /* if we are/were on an edge, create (un)shifted bitmap --
+ * ripped out optimization (not extremely worthwhile,
+ * and kind of buggy anyhow).
+ */
- /* do movement, save position */
- et_writesprpos(ba, rx < 0 ? 0 : rx, ry < 0 ? 0 : ry);
+ /* do movement, save position */
+ et_writesprpos(ba, rx < 0 ? 0 : rx, ry < 0 ? 0 : ry);
et_cursprite.pos.x = data->x;
et_cursprite.pos.y = data->y;
@@ -785,18 +792,18 @@ et_setmonitor(gp, gv)
{
struct grfvideo_mode *md;
- if (!et_mondefok(gv))
- return(EINVAL);
+ if (!et_mondefok(gv))
+ return(EINVAL);
#ifdef TSENGCONSOLE
/* handle interactive setting of console mode */
if (gv->mode_num == 255) {
bcopy(gv, &etconsole_mode.gv, sizeof(struct grfvideo_mode));
- etconsole_mode.gv.hblank_start /= 8;
- etconsole_mode.gv.hblank_stop /= 8;
- etconsole_mode.gv.hsync_start /= 8;
- etconsole_mode.gv.hsync_stop /= 8;
- etconsole_mode.gv.htotal /= 8;
+ etconsole_mode.gv.hblank_start /= 8;
+ etconsole_mode.gv.hblank_stop /= 8;
+ etconsole_mode.gv.hsync_start /= 8;
+ etconsole_mode.gv.hsync_stop /= 8;
+ etconsole_mode.gv.htotal /= 8;
etconsole_mode.rows = gv->disp_height / etconsole_mode.fy;
etconsole_mode.cols = gv->disp_width / etconsole_mode.fx;
if (!(gp->g_flags & GF_GRFON))
@@ -809,13 +816,13 @@ et_setmonitor(gp, gv)
md = monitor_def + (gv->mode_num - 1);
bcopy(gv, md, sizeof(struct grfvideo_mode));
- /* adjust pixel oriented values to internal rep. */
+ /* adjust pixel oriented values to internal rep. */
- md->hblank_start /= 8;
- md->hblank_stop /= 8;
- md->hsync_start /= 8;
- md->hsync_stop /= 8;
- md->htotal /= 8;
+ md->hblank_start /= 8;
+ md->hblank_stop /= 8;
+ md->hsync_start /= 8;
+ md->hsync_stop /= 8;
+ md->htotal /= 8;
return (0);
}
@@ -827,9 +834,9 @@ et_getcmap(gfp, cmap)
struct grf_colormap *cmap;
{
volatile unsigned char *ba;
- u_char red[256], green[256], blue[256], *rp, *gp, *bp;
- short x;
- int error;
+ u_char red[256], green[256], blue[256], *rp, *gp, *bp;
+ short x;
+ int error;
if (cmap->count == 0 || cmap->index >= 256)
return 0;
@@ -855,11 +862,11 @@ et_getcmap(gfp, cmap)
} while (x-- > 0);
break;
default:
- vgaw(ba, VDAC_ADDRESS_W, cmap->index);
+ vgaw(ba, VDAC_ADDRESS_R+((ettype==DOMINO)?0x0fff:0), cmap->index);
do {
- *rp++ = vgar(ba, VDAC_DATA) << etcmap_shift;
- *gp++ = vgar(ba, VDAC_DATA) << etcmap_shift;
- *bp++ = vgar(ba, VDAC_DATA) << etcmap_shift;
+ *rp++ = vgar(ba, VDAC_DATA+((ettype==DOMINO)?0x0fff:0)) << etcmap_shift;
+ *gp++ = vgar(ba, VDAC_DATA+((ettype==DOMINO)?0x0fff:0)) << etcmap_shift;
+ *bp++ = vgar(ba, VDAC_DATA+((ettype==DOMINO)?0x0fff:0)) << etcmap_shift;
} while (x-- > 0);
break;
}
@@ -880,9 +887,9 @@ et_putcmap(gfp, cmap)
struct grf_colormap *cmap;
{
volatile unsigned char *ba;
- u_char red[256], green[256], blue[256], *rp, *gp, *bp;
- short x;
- int error;
+ u_char red[256], green[256], blue[256], *rp, *gp, *bp;
+ short x;
+ int error;
if (cmap->count == 0 || cmap->index >= 256)
return (0);
@@ -908,7 +915,7 @@ et_putcmap(gfp, cmap)
bp = blue + cmap->index;
switch(ettype){
- case MERLIN:
+ case MERLIN:
vgaw(ba, MERLIN_VDAC_INDEX, cmap->index);
do {
vgaw(ba, MERLIN_VDAC_COLORS, *rp++);
@@ -916,12 +923,15 @@ et_putcmap(gfp, cmap)
vgaw(ba, MERLIN_VDAC_COLORS, *bp++);
} while (x-- > 0);
break;
- default:
+ default:
vgaw(ba, VDAC_ADDRESS_W, cmap->index);
do {
- vgaw(ba, VDAC_DATA, *rp++ >> etcmap_shift);
- vgaw(ba, VDAC_DATA, *gp++ >> etcmap_shift);
- vgaw(ba, VDAC_DATA, *bp++ >> etcmap_shift);
+ vgaw(ba, VDAC_DATA + ((ettype == DOMINO) ? 0x0fff : 0),
+ *rp++ >> etcmap_shift);
+ vgaw(ba, VDAC_DATA + ((ettype == DOMINO) ? 0x0fff : 0),
+ *gp++ >> etcmap_shift);
+ vgaw(ba, VDAC_DATA + ((ettype == DOMINO) ? 0x0fff : 0),
+ *bp++ >> etcmap_shift);
} while (x-- > 0);
break;
}
@@ -964,14 +974,14 @@ static u_char et_clockdividers[ET_NUMCLOCKS] = {
};
static u_int et_clockfreqs[ET_NUMCLOCKS] = {
- 6293750, 7080500, 7875000, 8125000,
- 9000000, 9375000, 10000000, 11225000,
- 12587500, 14161000, 15750000, 16250000,
- 18000000, 18750000, 20000000, 22450000,
- 25175000, 28322000, 31500000, 32500000,
- 36000000, 37500000, 40000000, 44900000,
- 50350000, 56644000, 63000000, 65000000,
- 72000000, 75000000, 80000000, 89800000
+ 6293750, 7080500, 7875000, 8125000,
+ 9000000, 9375000, 10000000, 11225000,
+ 12587500, 14161000, 15750000, 16250000,
+ 18000000, 18750000, 20000000, 22450000,
+ 25175000, 28322000, 31500000, 32500000,
+ 36000000, 37500000, 40000000, 44900000,
+ 50350000, 56644000, 63000000, 65000000,
+ 72000000, 75000000, 80000000, 89800000
};
@@ -987,7 +997,7 @@ et_CompFQ(fq, num, denom)
if (fq <= et_clockfreqs[i++]) {
break;
}
- }
+ }
*num = et_clocks[--i];
*denom = et_clockdividers[i];
@@ -1000,25 +1010,24 @@ int
et_mondefok(gv)
struct grfvideo_mode *gv;
{
-
if (gv->mode_num < 1 || gv->mode_num > monitor_def_max)
- if (gv->mode_num != 255 || gv->depth != 4)
- return(0);
+ if (gv->mode_num != 255 || gv->depth != 4)
+ return(0);
switch (gv->depth) {
case 4:
- if (gv->mode_num != 255)
- return(0);
+ if (gv->mode_num != 255)
+ return(0);
case 1:
case 8:
case 15:
case 16:
case 24:
- break;
+ break;
default:
return (0);
}
- return (1);
+ return (1);
}
@@ -1191,18 +1200,18 @@ et_load_mon(gp, md)
WCrt(ba, CRT_ID_LINE_COMPARE, 0xff);
WCrt(ba, CRT_ID_OVERFLOW_HIGH,
- ((VBS & 0x400) ? 0x01 : 0x00) |
- ((VT & 0x400) ? 0x02 : 0x00) |
- ((VDE & 0x400) ? 0x04 : 0x00) |
- ((VSS & 0x400) ? 0x08 : 0x00) |
- 0x10 |
- (LACE ? 0x80 : 0x00));
-
- WCrt(ba, CRT_ID_HOR_OVERFLOW,
- ((HT & 0x100) ? 0x01 : 0x00) |
- ((HBS & 0x100) ? 0x04 : 0x00) |
- ((HSS & 0x100) ? 0x10 : 0x00)
- );
+ ((VBS & 0x400) ? 0x01 : 0x00) |
+ ((VT & 0x400) ? 0x02 : 0x00) |
+ ((VDE & 0x400) ? 0x04 : 0x00) |
+ ((VSS & 0x400) ? 0x08 : 0x00) |
+ 0x10 |
+ (LACE ? 0x80 : 0x00));
+
+ WCrt(ba, CRT_ID_HOR_OVERFLOW,
+ ((HT & 0x100) ? 0x01 : 0x00) |
+ ((HBS & 0x100) ? 0x04 : 0x00) |
+ ((HSS & 0x100) ? 0x10 : 0x00)
+ );
/* depth dependent stuff */
@@ -1381,9 +1390,12 @@ et_inittextmode(gp)
for (z = 0; z < 256; z++) {
y = (z & 1) ? ((z > 7) ? 2 : 1) : 0;
- vgaw(ba, VDAC_DATA, etconscolors[y][0] >> etcmap_shift);
- vgaw(ba, VDAC_DATA, etconscolors[y][1] >> etcmap_shift);
- vgaw(ba, VDAC_DATA, etconscolors[y][2] >> etcmap_shift);
+ vgaw(ba, VDAC_DATA + ((ettype == DOMINO) ? 0x0fff : 0),
+ etconscolors[y][0] >> etcmap_shift);
+ vgaw(ba, VDAC_DATA + ((ettype == DOMINO) ? 0x0fff : 0),
+ etconscolors[y][1] >> etcmap_shift);
+ vgaw(ba, VDAC_DATA + ((ettype == DOMINO) ? 0x0fff : 0),
+ etconscolors[y][2] >> etcmap_shift);
}
break;
}
@@ -1417,13 +1429,13 @@ et_getControllerType(gp)
*((unsigned long *)mmu) = 0;
*(mem + 0x13) = 0x38;
-
+
*mmu = 0xff;
/* hide ACL */
WIma(ba, IMA_PORTCONTROL, 0x00);
WCrt(ba, CRT_ID_VIDEO_CONFIG1, 0xd3);
-
+
return((*mem == 0xff) ? ETW32 : ET4000);
}
@@ -1440,55 +1452,52 @@ et_getDACType(gp)
/* check for Sierra SC 15025 */
- if(vgar(ba, HDR)); if(vgar(ba, HDR)); if(vgar(ba, HDR)); if(vgar(ba, HDR));
- vgaw(ba, VDAC_COMMAND, 0x10); /* set ERPF */
-
- vgaw(ba, VDAC_XINDEX, 9);
- check.cc[0]=vgar(ba, VDAC_XDATA);
- vgaw(ba, VDAC_XINDEX, 10);
- check.cc[1]=vgar(ba, VDAC_XDATA);
- vgaw(ba, VDAC_XINDEX, 11);
- check.cc[2]=vgar(ba, VDAC_XDATA);
- vgaw(ba, VDAC_XINDEX, 12);
- check.cc[3]=vgar(ba, VDAC_XDATA);
-
- if(vgar(ba, HDR)); if(vgar(ba, HDR)); if(vgar(ba, HDR)); if(vgar(ba, HDR));
- vgaw(ba, VDAC_COMMAND, 0x00); /* clear ERPF */
-
- if(check.tt == 0x533ab141){
- if(vgar(ba, HDR)); if(vgar(ba, HDR)); if(vgar(ba, HDR)); if(vgar(ba, HDR));
- vgaw(ba, VDAC_COMMAND, 0x10); /* set ERPF */
-
- /* switch to 8 bits per color */
- vgaw(ba, VDAC_XINDEX, 8);
- vgaw(ba, VDAC_XDATA, 1);
- /* do not shift color values */
- etcmap_shift = 0;
-
- if(vgar(ba, HDR)); if(vgar(ba, HDR)); if(vgar(ba, HDR)); if(vgar(ba, HDR));
- vgaw(ba, VDAC_COMMAND, 0x00); /* clear ERPF */
-
- vgaw(ba, VDAC_MASK, 0xff);
- return(SIERRA15025);
- }
-
- /* check for MUSIC DAC */
-
- if(vgar(ba, HDR)); /* We MUST do 4 HW reads to switch into command mode */
- if(vgar(ba, HDR));
- if(vgar(ba, HDR));
- if(vgar(ba, HDR));
-
- vgaw(ba, VDAC_COMMAND, 0x02); /* set some strange MUSIC mode (???) */
-
- vgaw(ba, VDAC_XINDEX, 0x01);
- if(vgar(ba, VDAC_XDATA) == 0x01){
- /* shift color values by 2 */
- etcmap_shift = 2;
-
- vgaw(ba, VDAC_MASK, 0xff);
- return(MUSICDAC);
- }
+ /* We MUST do 4 HW reads to switch into command mode */
+ if (vgar(ba, HDR)); if (vgar(ba, HDR)); if (vgar(ba, HDR)); if (vgar(ba, HDR));
+ vgaw(ba, VDAC_COMMAND, 0x10); /* set ERPF */
+
+ vgaw(ba, VDAC_XINDEX, 9);
+ check.cc[0] = vgar(ba, VDAC_XDATA);
+ vgaw(ba, VDAC_XINDEX, 10);
+ check.cc[1] = vgar(ba, VDAC_XDATA);
+ vgaw(ba, VDAC_XINDEX, 11);
+ check.cc[2] = vgar(ba, VDAC_XDATA);
+ vgaw(ba, VDAC_XINDEX, 12);
+ check.cc[3] = vgar(ba, VDAC_XDATA);
+
+ if (vgar(ba, HDR)); if (vgar(ba, HDR)); if (vgar(ba, HDR)); if (vgar(ba, HDR));
+ vgaw(ba, VDAC_COMMAND, 0x00); /* clear ERPF */
+
+ if (check.tt == 0x533ab141) {
+ if (vgar(ba, HDR)); if (vgar(ba, HDR)); if (vgar(ba, HDR)); if (vgar(ba, HDR));
+ vgaw(ba, VDAC_COMMAND, 0x10); /* set ERPF */
+
+ /* switch to 8 bits per color */
+ vgaw(ba, VDAC_XINDEX, 8);
+ vgaw(ba, VDAC_XDATA, 1);
+ /* do not shift color values */
+ etcmap_shift = 0;
+
+ if (vgar(ba, HDR)); if (vgar(ba, HDR)); if (vgar(ba, HDR)); if (vgar(ba, HDR));
+ vgaw(ba, VDAC_COMMAND, 0x00); /* clear ERPF */
+
+ vgaw(ba, VDAC_MASK, 0xff);
+ return (SIERRA15025);
+ }
+
+ /* check for MUSIC DAC */
+
+ if (vgar(ba, HDR)); if (vgar(ba, HDR)); if (vgar(ba, HDR)); if (vgar(ba, HDR));
+ vgaw(ba, VDAC_COMMAND, 0x02); /* set some strange MUSIC mode (???) */
+
+ vgaw(ba, VDAC_XINDEX, 0x01);
+ if (vgar(ba, VDAC_XDATA) == 0x01) {
+ /* shift color values by 2 */
+ etcmap_shift = 2;
+
+ vgaw(ba, VDAC_MASK, 0xff);
+ return (MUSICDAC);
+}
/*
* nothing else found, so let us pretend it is a stupid
@@ -1497,9 +1506,9 @@ et_getDACType(gp)
/* shift color values by 2 */
etcmap_shift = 2;
-
+
vgaw(ba, VDAC_MASK, 0xff);
- return(SIERRA11483);
+ return(SIERRA11483);
}
#endif /* NGRFET */
diff --git a/sys/arch/amiga/dev/grf_etreg.h b/sys/arch/amiga/dev/grf_etreg.h
index bec07ac688f..a5b3832b7cb 100644
--- a/sys/arch/amiga/dev/grf_etreg.h
+++ b/sys/arch/amiga/dev/grf_etreg.h
@@ -1,4 +1,5 @@
-/* $NetBSD: grf_etreg.h,v 1.1.4.1 1996/05/27 01:12:13 is Exp $ */
+/* $OpenBSD: grf_etreg.h,v 1.3 1997/01/16 09:24:17 niklas Exp $ */
+/* $NetBSD: grf_etreg.h,v 1.2 1996/06/09 13:21:11 veego Exp $ */
/*
* Copyright (c) 1996 Tobias Abt
@@ -49,14 +50,14 @@
* fields for a text mode are present.
*/
struct grfettext_mode {
- struct grfvideo_mode gv;
- unsigned short fx; /* font x dimension */
- unsigned short fy; /* font y dimension */
- unsigned short cols; /* screen dimensions */
- unsigned short rows;
- void *fdata; /* font data */
- unsigned short fdstart;
- unsigned short fdend;
+ struct grfvideo_mode gv;
+ unsigned short fx; /* font x dimension */
+ unsigned short fy; /* font y dimension */
+ unsigned short cols; /* screen dimensions */
+ unsigned short rows;
+ void *fdata; /* font data */
+ unsigned short fdstart;
+ unsigned short fdend;
};
@@ -69,14 +70,14 @@ struct grfettext_mode {
#define MERLIN 2117
/* VGA controller types */
-#define ET4000 0
-#define ETW32 1
+#define ET4000 0
+#define ETW32 1
/* DAC types */
-#define SIERRA11483 0 /* Sierra 11483 HiColor DAC */
-#define SIERRA15025 1 /* Sierra 15025 TrueColor DAC */
-#define MUSICDAC 2 /* MUSIC TrueColor DAC */
-#define MERLINDAC 3 /* Merlin's BrookTree TrueColor DAC */
+#define SIERRA11483 0 /* Sierra 11483 HiColor DAC */
+#define SIERRA15025 1 /* Sierra 15025 TrueColor DAC */
+#define MUSICDAC 2 /* MUSIC TrueColor DAC */
+#define MERLINDAC 3 /* Merlin's BrookTree TrueColor DAC */
/* read VGA register */
#define vgar(ba, reg) (*(((volatile unsigned char *)ba)+reg))
@@ -101,7 +102,7 @@ struct grfettext_mode {
#define GREG_STATUS0_R 0x03C2
#define GREG_STATUS1_R 0x03DA
#define GREG_MISC_OUTPUT_R 0x03CC
-#define GREG_MISC_OUTPUT_W 0x03C2
+#define GREG_MISC_OUTPUT_W 0x03C2
#define GREG_FEATURE_CONTROL_R 0x03CA
#define GREG_FEATURE_CONTROL_W 0x03DA
#define GREG_POS 0x0102
@@ -114,7 +115,7 @@ struct grfettext_mode {
/* ETW32 special */
#define W32mappedRegs 0xfff00
-
+
/* MMU */
#define MMU_APERTURE0 0x80000
#define MMU_APERTURE1 0xa0000
@@ -177,9 +178,9 @@ struct grfettext_mode {
#define SEQ_ID_AUXILIARY_MODE 0x07
/* don't know about them right now...
-#define TEXT_PLANE_CHAR 0x01
-#define TEXT_PLANE_ATTR 0x02
-#define TEXT_PLANE_FONT 0x04
+#define TEXT_PLANE_CHAR 0x01
+#define TEXT_PLANE_ATTR 0x02
+#define TEXT_PLANE_FONT 0x04
*/
/* CRT Controller: */
@@ -226,18 +227,20 @@ struct grfettext_mode {
#define IMA_ADDRESS 0x217a
#define IMA_ADDRESS_R 0x217b
#define IMA_ADDRESS_W 0x217b
-#define IMA_STARTADDRESSLOW 0xf0
-#define IMA_STARTADDRESSMIDDLE 0xf1
-#define IMA_STARTADDRESSHIGH 0xf2
-#define IMA_TRANSFERLENGTHLOW 0xf3
-#define IMA_TRANSFERLENGTHHIGH 0xf4
-#define IMA_ROWOFFSETLOW 0xf5
-#define IMA_ROWOFFSETHIGH 0xf6
-#define IMA_PORTCONTROL 0xf7
+#define IMA_STARTADDRESSLOW 0xf0
+#define IMA_STARTADDRESSMIDDLE 0xf1
+#define IMA_STARTADDRESSHIGH 0xf2
+#define IMA_TRANSFERLENGTHLOW 0xf3
+#define IMA_TRANSFERLENGTHHIGH 0xf4
+#define IMA_ROWOFFSETLOW 0xf5
+#define IMA_ROWOFFSETHIGH 0xf6
+#define IMA_PORTCONTROL 0xf7
/* Pass-through */
#define PASS_ADDRESS 0x8000
#define PASS_ADDRESS_W 0x8000
+#define PASS_ADDRESS_DOM 0xa000
+#define PASS_ADDRESS_DOMW 0xb000
/* Video DAC */
#define VDAC_ADDRESS 0x03c8
@@ -248,15 +251,15 @@ struct grfettext_mode {
#define VDAC_MASK 0x03c6
#define HDR 0x03c6 /* Hidden DAC register, 4 reads to access */
-#define VDAC_COMMAND 0x03c6
-#define VDAC_XINDEX 0x03c7
-#define VDAC_XDATA 0x03c8
+#define VDAC_COMMAND 0x03c6
+#define VDAC_XINDEX 0x03c7
+#define VDAC_XDATA 0x03c8
-#define MERLIN_VDAC_INDEX 0x01
-#define MERLIN_VDAC_COLORS 0x05
-#define MERLIN_VDAC_SPRITE 0x09
-#define MERLIN_VDAC_DATA 0x19
-#define MERLIN_SWITCH_REG 0x0401
+#define MERLIN_VDAC_INDEX 0x01
+#define MERLIN_VDAC_COLORS 0x05
+#define MERLIN_VDAC_SPRITE 0x09
+#define MERLIN_VDAC_DATA 0x19
+#define MERLIN_SWITCH_REG 0x0401
#define WGfx(ba, idx, val) \
do { vgaw(ba, GCT_ADDRESS, idx); vgaw(ba, GCT_ADDRESS_W , val); } while (0)
@@ -295,65 +298,63 @@ struct grfettext_mode {
* inline functions.
*/
static inline void RegWakeup(volatile void *ba) {
- extern int ettype;
-
- switch (ettype) {
- case OMNIBUS:
- vgaw(ba, PASS_ADDRESS_W, 0x00);
- break;
-/*
- case DOMINO:
- vgaw(ba, PASS_ADDRESS_W, 0x00);
- break;
- case MERLIN:
- break;
-*/
- }
- delay(200000);
+ extern int ettype;
+
+ switch (ettype) {
+ case OMNIBUS:
+ vgaw(ba, PASS_ADDRESS_W, 0x00);
+ break;
+ case DOMINO:
+ vgaw(ba, PASS_ADDRESS_DOM, 0x00);
+ break;
+ case MERLIN:
+ break;
+ }
+ delay(200000);
}
static inline void RegOnpass(volatile void *ba) {
- extern int ettype;
+ extern int ettype;
extern unsigned char pass_toggle;
extern unsigned char Merlin_switch;
- switch (ettype) {
- case OMNIBUS:
- vgaw(ba, PASS_ADDRESS_W, 0x00);
- break;
- case DOMINO:
- vgaw(ba, PASS_ADDRESS_W, 0x00);
- break;
- case MERLIN:
- Merlin_switch &= 0xfe;
- vgaw(ba, MERLIN_SWITCH_REG, Merlin_switch);
- break;
- }
- pass_toggle = 1;
- delay(200000);
+ switch (ettype) {
+ case OMNIBUS:
+ vgaw(ba, PASS_ADDRESS_W, 0x00);
+ break;
+ case DOMINO:
+ vgaw(ba, PASS_ADDRESS_DOMW, 0x00);
+ break;
+ case MERLIN:
+ Merlin_switch &= 0xfe;
+ vgaw(ba, MERLIN_SWITCH_REG, Merlin_switch);
+ break;
+ }
+ pass_toggle = 1;
+ delay(200000);
}
static inline void RegOffpass(volatile void *ba) {
- extern int ettype;
- extern unsigned char pass_toggle;
+ extern int ettype;
+ extern unsigned char pass_toggle;
extern unsigned char Merlin_switch;
- switch (ettype) {
- case OMNIBUS:
- vgaw(ba, PASS_ADDRESS_W, 0x01);
- break;
- case DOMINO:
- vgaw(ba, PASS_ADDRESS_W, 0x00);
- break;
- case MERLIN:
- Merlin_switch |= 0x01;
- vgaw(ba, MERLIN_SWITCH_REG, Merlin_switch);
- break;
- }
- pass_toggle = 0;
- delay(200000);
+ switch (ettype) {
+ case OMNIBUS:
+ vgaw(ba, PASS_ADDRESS_W, 0x01);
+ break;
+ case DOMINO:
+ vgaw(ba, PASS_ADDRESS_DOM, 0x00);
+ break;
+ case MERLIN:
+ Merlin_switch |= 0x01;
+ vgaw(ba, MERLIN_SWITCH_REG, Merlin_switch);
+ break;
+ }
+ pass_toggle = 0;
+ delay(200000);
}
static inline unsigned char RAttr(volatile void * ba, short idx) {
diff --git a/sys/arch/amiga/dev/grf_rh.c b/sys/arch/amiga/dev/grf_rh.c
index 180929648d1..0bd1839facb 100644
--- a/sys/arch/amiga/dev/grf_rh.c
+++ b/sys/arch/amiga/dev/grf_rh.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: grf_rh.c,v 1.11 1996/11/24 20:23:47 niklas Exp $ */
-/* $NetBSD: grf_rh.c,v 1.17.4.3 1996/09/06 00:40:22 jtc Exp $ */
+/* $OpenBSD: grf_rh.c,v 1.12 1997/01/16 09:24:18 niklas Exp $ */
+/* $NetBSD: grf_rh.c,v 1.26 1996/12/31 17:54:28 is Exp $ */
/*
* Copyright (c) 1994 Markus Wild
@@ -592,22 +592,18 @@ RZ3SetPalette (gp, colornum, red, green, blue)
}
-/* XXXXXXXXX !! */
-static unsigned short xpan;
-static unsigned short ypan;
-
void
RZ3SetPanning (gp, xoff, yoff)
struct grf_softc *gp;
unsigned short xoff, yoff;
{
volatile unsigned char *ba = gp->g_regkva;
+ struct grfinfo *gi = &gp->g_display;
const struct MonDef * md = (struct MonDef *) gp->g_data;
unsigned long off;
- xpan = xoff;
- ypan = yoff;
-
+ gi->gd_fbx = xoff;
+ gi->gd_fby = yoff;
if (md->DEP > 8 && md->DEP <= 16) xoff *= 2;
else if (md->DEP > 16) xoff *= 3;
@@ -640,27 +636,35 @@ RZ3SetHWCloc (gp, x, y)
{
volatile unsigned char *ba = gp->g_regkva;
const struct MonDef *md = (struct MonDef *) gp->g_data;
- volatile unsigned char *acm = ba + ACM_OFFSET;
+ /*volatile unsigned char *acm = ba + ACM_OFFSET;*/
+ struct grfinfo *gi = &gp->g_display;
- if (x < xpan)
- RZ3SetPanning(gp, x, ypan);
+ if (x < gi->gd_fbx)
+ RZ3SetPanning(gp, x, gi->gd_fby);
- if (x >= (xpan+md->MW))
- RZ3SetPanning(gp, (1 + x - md->MW) , ypan);
+ if (x >= (gi->gd_fbx+md->MW))
+ RZ3SetPanning(gp, (1 + x - md->MW) , gi->gd_fby);
- if (y < ypan)
- RZ3SetPanning(gp, xpan, y);
+ if (y < gi->gd_fby)
+ RZ3SetPanning(gp, gi->gd_fbx, y);
- if (y >= (ypan+md->MH))
- RZ3SetPanning(gp, xpan, (1 + y - md->MH));
+ if (y >= (gi->gd_fby+md->MH))
+ RZ3SetPanning(gp, gi->gd_fbx, (1 + y - md->MH));
- x -= xpan;
- y -= ypan;
+ x -= gi->gd_fbx;
+ y -= gi->gd_fby;
- *(acm + (ACM_CURSOR_POSITION+0)) = x & 0xff;
+#if 1
+ WSeq(ba, SEQ_ID_CURSOR_X_LOC_HI, x >> 8);
+ WSeq(ba, SEQ_ID_CURSOR_X_LOC_LO, x & 0xff);
+ WSeq(ba, SEQ_ID_CURSOR_Y_LOC_HI, y >> 8);
+ WSeq(ba, SEQ_ID_CURSOR_Y_LOC_LO, y & 0xff);
+#else
*(acm + (ACM_CURSOR_POSITION+1)) = x >> 8;
- *(acm + (ACM_CURSOR_POSITION+2)) = y & 0xff;
+ *(acm + (ACM_CURSOR_POSITION+0)) = x & 0xff;
*(acm + (ACM_CURSOR_POSITION+3)) = y >> 8;
+ *(acm + (ACM_CURSOR_POSITION+2)) = y & 0xff;
+#endif
}
u_short
@@ -890,7 +894,7 @@ rh_load_mon(gp, md)
WSeq(ba, SEQ_ID_ACM_APERTURE_1, 0x00);
WSeq(ba, SEQ_ID_ACM_APERTURE_2, 0x30);
WSeq(ba, SEQ_ID_ACM_APERTURE_3, 0x00);
- WSeq(ba, SEQ_ID_MEMORY_MAP_CNTL, 0x07);
+ WSeq(ba, SEQ_ID_MEMORY_MAP_CNTL, 0x03); /* was 7, but stupid cursor */
WCrt(ba, CRT_ID_END_VER_RETR, (md->VSE & 0xf) | 0x20);
WCrt(ba, CRT_ID_HOR_TOTAL, md->HT & 0xff);
@@ -1152,8 +1156,8 @@ rh_load_mon(gp, md)
RZ3BitBlit(gp, &bb);
- xpan = 0;
- ypan = 0;
+ gi->gd_fbx = 0;
+ gi->gd_fby = 0;
return(1);
} else if (md->DEP == 16) {
@@ -1168,8 +1172,8 @@ rh_load_mon(gp, md)
RZ3BitBlit16(gp, &bb);
- xpan = 0;
- ypan = 0;
+ gi->gd_fbx = 0;
+ gi->gd_fby = 0;
return(1);
} else if (md->DEP == 24) {
@@ -1184,8 +1188,8 @@ rh_load_mon(gp, md)
RZ3BitBlit24(gp, &bb );
- xpan = 0;
- ypan = 0;
+ gi->gd_fbx = 0;
+ gi->gd_fby = 0;
return 1;
} else
@@ -1890,15 +1894,24 @@ rh_getspritepos (gp, pos)
struct grf_softc *gp;
struct grf_position *pos;
{
+ struct grfinfo *gi = &gp->g_display;
+#if 1
+ volatile unsigned char *ba = gp->g_regkva;
+
+ pos->x = (RSeq(ba, SEQ_ID_CURSOR_X_LOC_HI) << 8) |
+ RSeq(ba, SEQ_ID_CURSOR_X_LOC_LO);
+ pos->y = (RSeq(ba, SEQ_ID_CURSOR_Y_LOC_HI) << 8) |
+ RSeq(ba, SEQ_ID_CURSOR_Y_LOC_LO);
+#else
volatile unsigned char *acm = gp->g_regkva + ACM_OFFSET;
pos->x = acm[ACM_CURSOR_POSITION + 0] +
(acm[ACM_CURSOR_POSITION + 1] << 8);
pos->y = acm[ACM_CURSOR_POSITION + 2] +
(acm[ACM_CURSOR_POSITION + 3] << 8);
-
- pos->x += xpan;
- pos->y += ypan;
+#endif
+ pos->x += gi->gd_fbx;
+ pos->y += gi->gd_fby;
return(0);
}
diff --git a/sys/arch/amiga/dev/grf_rt.c b/sys/arch/amiga/dev/grf_rt.c
index 5b8cf875a26..17d9013be25 100644
--- a/sys/arch/amiga/dev/grf_rt.c
+++ b/sys/arch/amiga/dev/grf_rt.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: grf_rt.c,v 1.9 1996/11/24 20:23:48 niklas Exp $ */
-/* $NetBSD: grf_rt.c,v 1.27.4.1 1996/05/26 17:26:43 is Exp $ */
+/* $OpenBSD: grf_rt.c,v 1.10 1997/01/16 09:24:20 niklas Exp $ */
+/* $NetBSD: grf_rt.c,v 1.34 1996/12/23 09:10:09 veego Exp $ */
/*
* Copyright (c) 1993 Markus Wild
@@ -1465,7 +1465,7 @@ rt_blank(gp, on)
r = 0x01 | ((md->FLG & MDF_CLKDIV2)/ MDF_CLKDIV2 * 8);
- WSeq(gp->g_regkva, SEQ_ID_CLOCKING_MODE, *on ? r : 0x21);
+ WSeq(gp->g_regkva, SEQ_ID_CLOCKING_MODE, *on > 0 ? r : 0x21);
return(0);
}
diff --git a/sys/arch/amiga/dev/grf_ul.c b/sys/arch/amiga/dev/grf_ul.c
index e1b396dd37b..54ec3261e16 100644
--- a/sys/arch/amiga/dev/grf_ul.c
+++ b/sys/arch/amiga/dev/grf_ul.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: grf_ul.c,v 1.11 1996/11/24 20:23:49 niklas Exp $ */
-/* $NetBSD: grf_ul.c,v 1.17 1996/05/09 20:31:25 is Exp $ */
+/* $OpenBSD: grf_ul.c,v 1.12 1997/01/16 09:24:21 niklas Exp $ */
+/* $NetBSD: grf_ul.c,v 1.23 1996/12/23 09:10:10 veego Exp $ */
#define UL_DEBUG
@@ -17,8 +17,9 @@
* 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 Lutz Vieweg.
- * 4. The name of the author may not be used to endorse or promote products
+ * This product includes software developed by Ignatios Souvatzis for
+ * the NetBSD project.
+ * 4. The name of the authors 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
@@ -912,7 +913,7 @@ ul_blank(gp, onoff, dev)
gsp->ctrl = (gsp->ctrl & ~(INCR | INCW)) | LBL;
gsp->hstadrh = 0xC000;
gsp->hstadrl = 0x0080;
- if (*onoff)
+ if (*onoff > 0)
gsp->data |= 0x9000;
else
gsp->data &= ~0x9000;
diff --git a/sys/arch/amiga/dev/grf_ulreg.h b/sys/arch/amiga/dev/grf_ulreg.h
index 3f8a8634e1b..e55391d9b6e 100644
--- a/sys/arch/amiga/dev/grf_ulreg.h
+++ b/sys/arch/amiga/dev/grf_ulreg.h
@@ -1,4 +1,5 @@
-/* $NetBSD: grf_ulreg.h,v 1.3 1995/12/31 01:22:03 chopps Exp $ */
+/* $OpenBSD: grf_ulreg.h,v 1.3 1997/01/16 09:24:22 niklas Exp $ */
+/* $NetBSD: grf_ulreg.h,v 1.4 1996/07/08 13:28:42 is Exp $ */
/*
* Copyright (c) 1995 Ignatios Souvatzis
@@ -14,7 +15,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 Lutz Vieweg.
+ * This product includes software developed by Ignatios Souvatzis
+ * for the NetBSD project.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
@@ -35,7 +37,7 @@
struct gspregs {
/*
- * alas, they didn't invert the A1 bit, so be have to write the
+ * alas, they didn't invert the A1 bit, so we have to write the
* address pointer in two parts
*/
__volatile u_short hstadrl;
diff --git a/sys/arch/amiga/dev/grf_ultms.g b/sys/arch/amiga/dev/grf_ultms.g
index 502af7b3323..7ea72a1a082 100644
--- a/sys/arch/amiga/dev/grf_ultms.g
+++ b/sys/arch/amiga/dev/grf_ultms.g
@@ -15,6 +15,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 contains software developed by Ignatios Souvatzis
+; for the NetBSD project.
; 4. The name of the author may not be used to endorse or promote products
; derived from this software withough specific prior written permission
;
@@ -33,11 +35,9 @@
; assembler code for the TMS34010 CPU/graphics processor.
;
; Use Paul Mackerras' gspa assembler to transfer it to hex format, then
-; Ignatios Souvatzis' hex2c utility (available from the author) or a small
-; perl script to transform that into the form of grf_ultmscode.h.
+; Ignatios Souvatzis' gpsahextoc utility to convert it to grf_ultmscode.h.
;
-; A modified gspa for this purpose will be released as soon as this
-; procedure is cleaned up.
+; This has been integrated into the OpenBSD/Amiga kernel build procedure.
;
; memory map:
diff --git a/sys/arch/amiga/dev/grfabs_cc.c b/sys/arch/amiga/dev/grfabs_cc.c
index ca4288c1522..2f862c03ab4 100644
--- a/sys/arch/amiga/dev/grfabs_cc.c
+++ b/sys/arch/amiga/dev/grfabs_cc.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: grfabs_cc.c,v 1.4 1996/08/23 18:52:55 niklas Exp $ */
-/* $NetBSD: grfabs_cc.c,v 1.12.4.1 1996/05/28 20:46:04 is Exp $ */
+/* $OpenBSD: grfabs_cc.c,v 1.5 1997/01/16 09:24:25 niklas Exp $ */
+/* $NetBSD: grfabs_cc.c,v 1.15 1996/10/13 03:07:09 christos Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
diff --git a/sys/arch/amiga/dev/grfabs_ccreg.h b/sys/arch/amiga/dev/grfabs_ccreg.h
index b6da07331b2..f8018fc3098 100644
--- a/sys/arch/amiga/dev/grfabs_ccreg.h
+++ b/sys/arch/amiga/dev/grfabs_ccreg.h
@@ -1,3 +1,4 @@
+/* $OpenBSD: grfabs_ccreg.h,v 1.2 1997/01/16 09:24:27 niklas Exp $ */
/* $NetBSD: grfabs_ccreg.h,v 1.6 1995/10/05 12:41:19 chopps Exp $ */
/*
diff --git a/sys/arch/amiga/dev/grfioctl.h b/sys/arch/amiga/dev/grfioctl.h
index f7b9534ea02..5a2f6f4c652 100644
--- a/sys/arch/amiga/dev/grfioctl.h
+++ b/sys/arch/amiga/dev/grfioctl.h
@@ -1,4 +1,5 @@
-/* $NetBSD: grfioctl.h,v 1.11.6.1 1996/06/04 10:22:00 is Exp $ */
+/* $OpenBSD: grfioctl.h,v 1.3 1997/01/16 09:24:29 niklas Exp $ */
+/* $NetBSD: grfioctl.h,v 1.12 1996/06/03 18:55:08 is Exp $ */
/*
* Copyright (c) 1988 University of Utah.
diff --git a/sys/arch/amiga/dev/gtsc.c b/sys/arch/amiga/dev/gtsc.c
index 7735f01765e..4025c755574 100644
--- a/sys/arch/amiga/dev/gtsc.c
+++ b/sys/arch/amiga/dev/gtsc.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: gtsc.c,v 1.4 1996/11/23 21:45:17 kstailey Exp $ */
-/* $NetBSD: gtsc.c,v 1.15 1996/04/21 21:11:34 veego Exp $ */
+/* $OpenBSD: gtsc.c,v 1.5 1997/01/16 09:24:30 niklas Exp $ */
+/* $NetBSD: gtsc.c,v 1.20 1996/12/23 09:10:11 veego Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
diff --git a/sys/arch/amiga/dev/gtscreg.h b/sys/arch/amiga/dev/gtscreg.h
index 1d85b80f3da..cb39c050107 100644
--- a/sys/arch/amiga/dev/gtscreg.h
+++ b/sys/arch/amiga/dev/gtscreg.h
@@ -1,3 +1,4 @@
+/* $OpenBSD: gtscreg.h,v 1.2 1997/01/16 09:24:31 niklas Exp $ */
/* $NetBSD: gtscreg.h,v 1.2 1994/10/26 02:03:39 cgd Exp $ */
/*
diff --git a/sys/arch/amiga/dev/gvpbus.c b/sys/arch/amiga/dev/gvpbus.c
index d2536685549..3bc7a16f54f 100644
--- a/sys/arch/amiga/dev/gvpbus.c
+++ b/sys/arch/amiga/dev/gvpbus.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: gvpbus.c,v 1.4 1996/11/23 21:45:18 kstailey Exp $ */
-/* $NetBSD: gvpbus.c,v 1.11 1996/04/21 21:11:36 veego Exp $ */
+/* $OpenBSD: gvpbus.c,v 1.5 1997/01/16 09:24:32 niklas Exp $ */
+/* $NetBSD: gvpbus.c,v 1.15 1996/12/23 09:10:12 veego Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
diff --git a/sys/arch/amiga/dev/gvpbusvar.h b/sys/arch/amiga/dev/gvpbusvar.h
index a3dc7f544b9..bf4cfb3a74d 100644
--- a/sys/arch/amiga/dev/gvpbusvar.h
+++ b/sys/arch/amiga/dev/gvpbusvar.h
@@ -1,3 +1,4 @@
+/* $OpenBSD: gvpbusvar.h,v 1.2 1997/01/16 09:24:33 niklas Exp $ */
/* $NetBSD: gvpbusvar.h,v 1.8 1995/08/18 15:27:55 chopps Exp $ */
/*
diff --git a/sys/arch/amiga/dev/idesc.c b/sys/arch/amiga/dev/idesc.c
index d2c90fdd65a..c5528f9e3f1 100644
--- a/sys/arch/amiga/dev/idesc.c
+++ b/sys/arch/amiga/dev/idesc.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: idesc.c,v 1.7 1996/11/23 21:45:19 kstailey Exp $ */
-/* $NetBSD: idesc.c,v 1.21.4.2 1996/05/30 03:20:14 mhitch Exp $ */
+/* $OpenBSD: idesc.c,v 1.8 1997/01/16 09:24:34 niklas Exp $ */
+/* $NetBSD: idesc.c,v 1.29 1996/12/23 09:10:12 veego Exp $ */
/*
* Copyright (c) 1994 Michael L. Hitch
diff --git a/sys/arch/amiga/dev/if_ae.c b/sys/arch/amiga/dev/if_ae.c
index 22e2fbea4c1..893ab0d478d 100644
--- a/sys/arch/amiga/dev/if_ae.c
+++ b/sys/arch/amiga/dev/if_ae.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: if_ae.c,v 1.8 1996/08/23 18:53:04 niklas Exp $ */
-/* $NetBSD: if_ae.c,v 1.8.4.1 1996/05/26 17:26:41 is Exp $ */
+/* $OpenBSD: if_ae.c,v 1.9 1997/01/16 09:24:35 niklas Exp $ */
+/* $NetBSD: if_ae.c,v 1.12 1996/12/23 09:10:13 veego Exp $ */
/*
* Copyright (c) 1995 Bernd Ernesti and Klaus Burkert. All rights reserved.
@@ -84,6 +84,23 @@
#include <netinet/if_ether.h>
#endif
+#ifdef NS
+#include <netns/ns.h>
+#include <netns/ns_if.h>
+#endif
+
+#if defined(CCITT) && defined(LLC)
+#include <sys/socketvar.h>
+#include <netccitt/x25.h>
+#include <net/if_dl.h>
+#include <net/if_llc.h>
+#include <netccitt/dll.h>
+#include <netccitt/llc_var.h>
+#include <netccitt/pk.h>
+#include <netccitt/pk_var.h>
+#include <netccitt/pk_extern.h>
+#endif
+
#if NBPFILTER > 0
#include <net/bpf.h>
#include <net/bpfdesc.h>
@@ -969,12 +986,38 @@ aeioctl(ifp, cmd, data)
arp_ifinit(&sc->sc_arpcom, ifa);
break;
#endif
+#ifdef NS
+ case AF_NS:
+ {
+ register struct ns_addr *ina = &IA_SNS(ifa)->sns_addr;
+
+ if (ns_nullhost(*ina))
+ ina->x_host =
+ *(union ns_host *)(sc->sc_arpcom.ac_enaddr);
+ else
+ wcopyto(ina->x_host.c_host,
+ sc->sc_arpcom.ac_enaddr,
+ sizeof(sc->sc_arpcom.ac_enaddr));
+ aeinit(sc); /* does ae_setaddr() */
+ break;
+ }
+#endif
default:
aeinit(sc);
break;
}
break;
+#if defined(CCITT) && defined(LLC)
+ case SIOCSIFCONF_X25:
+ ifp->if_flags |= IFF_UP;
+ ifa->ifa_rtrequest = cons_rtrequest; /* XXX */
+ error = x25_llcglue(PRC_IFUP, ifa->ifa_addr);
+ if (error == 0)
+ aeinit(sc);
+ break;
+#endif /* CCITT && LLC */
+
case SIOCSIFFLAGS:
if ((ifp->if_flags & IFF_UP) == 0 &&
(ifp->if_flags & IFF_RUNNING) != 0) {
diff --git a/sys/arch/amiga/dev/if_aereg.h b/sys/arch/amiga/dev/if_aereg.h
index 0d0ce51ee3d..c08eede7d49 100644
--- a/sys/arch/amiga/dev/if_aereg.h
+++ b/sys/arch/amiga/dev/if_aereg.h
@@ -1,3 +1,4 @@
+/* $OpenBSD: if_aereg.h,v 1.2 1997/01/16 09:24:37 niklas Exp $ */
/* $NetBSD: if_aereg.h,v 1.2 1995/08/18 15:53:32 chopps Exp $ */
/*
diff --git a/sys/arch/amiga/dev/if_bah.c b/sys/arch/amiga/dev/if_bah.c
index 4c63ea441e6..82abd456f03 100644
--- a/sys/arch/amiga/dev/if_bah.c
+++ b/sys/arch/amiga/dev/if_bah.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: if_bah.c,v 1.6 1996/05/09 22:39:59 niklas Exp $ */
-/* $NetBSD: if_bah.c,v 1.18 1996/05/07 00:46:39 thorpej Exp $ */
+/* $OpenBSD: if_bah.c,v 1.7 1997/01/16 09:24:38 niklas Exp $ */
+/* $NetBSD: if_bah.c,v 1.25 1996/12/23 09:10:15 veego Exp $ */
/*
* Copyright (c) 1994, 1995 Ignatios Souvatzis
@@ -189,8 +189,8 @@ void movepout __P((u_char *from, u_char __volatile *to, int len));
void movepin __P((u_char __volatile *from, u_char *to, int len));
void bah_srint __P((void *vsc, void *dummy));
void callstart __P((void *vsc, void *dummy));
-static void bah_tint __P((struct bah_softc *, int));
-
+__inline static void bah_tint __P((struct bah_softc *, int));
+void bah_reconwatch(void *);
struct cfattach bah_zbus_ca = {
sizeof(struct bah_softc), bah_zbus_match, bah_zbus_attach
@@ -1048,10 +1048,8 @@ bahintr(arg)
sc->sc_arccom.ac_if.if_collisions++;
/*
- * If more than 2 seconds per reconfig:
- * Reset time and counter.
- * else:
- * If more than ARC_EXCESSIVE_RECONFIGS reconfigs
+! * If less than 2 seconds per reconfig:
+! * If ARC_EXCESSIVE_RECONFIGS
* since last burst, complain and set treshold for
* warnings to ARC_EXCESSIVE_RECONS_REWARN.
*
@@ -1063,24 +1061,19 @@ bahintr(arg)
* time if necessary.
*/
+ untimeout(bah_reconwatch, (void *)sc);
newsec = time.tv_sec;
- if (newsec - sc->sc_recontime > 2 * sc->sc_reconcount) {
- sc->sc_recontime = newsec;
- sc->sc_reconcount = 0;
- sc->sc_reconcount_excessive = ARC_EXCESSIVE_RECONS;
- } else if (++sc->sc_reconcount > sc->sc_reconcount_excessive) {
- sc->sc_reconcount_excessive =
- ARC_EXCESSIVE_RECONS_REWARN;
+ if ((newsec - sc->sc_recontime <= 2) &&
+ (++sc->sc_reconcount == ARC_EXCESSIVE_RECONS)) {
log(LOG_WARNING,
"%s: excessive token losses, cable problem?\n",
sc->sc_dev.dv_xname);
- sc->sc_recontime = newsec;
- sc->sc_reconcount = 0;
}
+ sc->sc_recontime = newsec;
+ timeout(bah_reconwatch, (void *)sc, 15*hz);
}
if (maskedisr & ARC_RI) {
-
#if defined(BAH_DEBUG) && (BAH_DEBUG > 1)
printf("%s: intr: hard rint, act %ld\n",
sc->sc_dev.dv_xname, sc->sc_rx_act);
@@ -1089,52 +1082,71 @@ bahintr(arg)
buffer = sc->sc_rx_act;
/* look if buffer is marked invalid: */
if (sc->sc_base->buffers[buffer*512*2] == 0) {
- /* invalid marked buffer (or illegally configured sender) */
+ /*
+ * invalid marked buffer (or illegally configured
+ * sender)
+ */
log(LOG_WARNING,
"%s: spurious RX interrupt or sender 0 (ignored)\n",
sc->sc_dev.dv_xname);
/*
* restart receiver on same buffer.
+ * XXX maybe better reset interface?
*/
sc->sc_base->command = ARC_RXBC(buffer);
-
- } else if (++sc->sc_rx_fillcount > 1) {
- sc->sc_intmask &= ~ARC_RI;
- sc->sc_base->status = sc->sc_intmask;
} else {
-
- buffer ^= 1;
- sc->sc_rx_act = buffer;
-
- /*
- * Start receiver on other receive buffer.
- * This also clears the RI interupt flag.
- */
- sc->sc_base->command = ARC_RXBC(buffer);
- /* we are in the RX intr, so mask is ok for RX */
-
+ if (++sc->sc_rx_fillcount > 1) {
+ sc->sc_intmask &= ~ARC_RI;
+ sc->sc_base->status = sc->sc_intmask;
+ } else {
+
+ buffer ^= 1;
+ sc->sc_rx_act = buffer;
+
+ /*
+ * Start receiver on other receive buffer.
+ * This also clears the RI interupt flag.
+ */
+ sc->sc_base->command = ARC_RXBC(buffer);
+ /* in the RX intr, so mask is ok for RX */
+
#ifdef BAH_DEBUG
- printf("%s: started rx for buffer %ld, status 0x%02x\n",
- sc->sc_dev.dv_xname, sc->sc_rx_act,
- sc->sc_base->status);
+ printf("%s: strt rx for buf %ld, stat 0x%02x\n",
+ sc->sc_dev.dv_xname, sc->sc_rx_act,
+ sc->sc_base->status);
#endif
- }
-
+ }
+
#ifdef BAHSOFTCOPY
- /* this one starts a soft int to copy out of the hw */
- add_sicallback((sifunc_t)bah_srint, sc,NULL);
+ /* this one starts a soft int to copy out of the hw */
+ add_sicallback((sifunc_t)bah_srint, sc,NULL);
#else
- /* this one does the copy here */
- bah_srint(sc,NULL);
+ /* this one does the copy here */
+ bah_srint(sc,NULL);
#endif
+ }
}
-
- if (maskedisr & ARC_TA)
+ if (maskedisr & ARC_TA) {
bah_tint(sc, isr);
+ }
return (1);
}
+void
+bah_reconwatch(arg)
+ void *arg;
+{
+ struct bah_softc *sc = arg;
+
+ if (sc->sc_reconcount >= ARC_EXCESSIVE_RECONS) {
+ sc->sc_reconcount = 0;
+ log(LOG_WARNING, "%s: token valid again.\n",
+ sc->sc_dev.dv_xname);
+ }
+ sc->sc_reconcount = 0;
+}
+
/*
* Process an ioctl request.
* This code needs some work - it looks pretty ugly.
@@ -1147,11 +1159,13 @@ bah_ioctl(ifp, command, data)
{
struct bah_softc *sc;
register struct ifaddr *ifa;
+ struct ifreq *ifr;
int s, error;
error = 0;
sc = ifp->if_softc;
ifa = (struct ifaddr *)data;
+ ifr = (struct ifreq *)data;
s = splnet();
#if defined(BAH_DEBUG) && (BAH_DEBUG > 2)
@@ -1192,7 +1206,13 @@ bah_ioctl(ifp, command, data)
}
break;
- /* Multicast not supported */
+ case SIOCADDMULTI:
+ case SIOCDELMULTI:
+ if (ifr->ifr_addr.sa_family == AF_INET)
+ error = 0;
+ else
+ error = EAFNOSUPPORT;
+ break;
default:
error = EINVAL;
diff --git a/sys/arch/amiga/dev/if_bahreg.h b/sys/arch/amiga/dev/if_bahreg.h
index 568d8c44d4f..4b950479846 100644
--- a/sys/arch/amiga/dev/if_bahreg.h
+++ b/sys/arch/amiga/dev/if_bahreg.h
@@ -1,3 +1,4 @@
+/* $OpenBSD: if_bahreg.h,v 1.2 1997/01/16 09:24:39 niklas Exp $ */
/* $NetBSD: if_bahreg.h,v 1.4 1995/06/07 00:16:59 cgd Exp $ */
/*
diff --git a/sys/arch/amiga/dev/if_ed.c b/sys/arch/amiga/dev/if_ed.c
index 4f5133b9669..2e287ef3e2c 100644
--- a/sys/arch/amiga/dev/if_ed.c
+++ b/sys/arch/amiga/dev/if_ed.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: if_ed.c,v 1.8 1996/10/04 15:11:40 niklas Exp $ */
-/* $NetBSD: if_ed.c,v 1.21 1996/05/07 00:46:41 thorpej Exp $ */
+/* $OpenBSD: if_ed.c,v 1.9 1997/01/16 09:24:40 niklas Exp $ */
+/* $NetBSD: if_ed.c,v 1.24 1996/12/23 09:10:16 veego Exp $ */
/*
* Device driver for National Semiconductor DS8390/WD83C690 based ethernet
@@ -40,6 +40,11 @@
#include <netinet/if_ether.h>
#endif
+#ifdef NS
+#include <netns/ns.h>
+#include <netns/ns_if.h>
+#endif
+
#if NBPFILTER > 0
#include <net/bpf.h>
#include <net/bpfdesc.h>
@@ -886,6 +891,24 @@ ed_ioctl(ifp, command, data)
arp_ifinit(&sc->sc_arpcom, ifa);
break;
#endif
+#ifdef NS
+ /* XXX - This code is probably wrong. */
+ case AF_NS:
+ {
+ register struct ns_addr *ina = &IA_SNS(ifa)->sns_addr;
+
+ if (ns_nullhost(*ina))
+ ina->x_host =
+ *(union ns_host *)(sc->sc_arpcom.ac_enaddr);
+ else
+ bcopy(ina->x_host.c_host,
+ sc->sc_arpcom.ac_enaddr,
+ sizeof(sc->sc_arpcom.ac_enaddr));
+ /* Set new address. */
+ ed_init(sc);
+ break;
+ }
+#endif
default:
ed_init(sc);
break;
diff --git a/sys/arch/amiga/dev/if_edreg.h b/sys/arch/amiga/dev/if_edreg.h
index 10c8c82ebc4..57aca3272ef 100644
--- a/sys/arch/amiga/dev/if_edreg.h
+++ b/sys/arch/amiga/dev/if_edreg.h
@@ -1,3 +1,4 @@
+/* $OpenBSD: if_edreg.h,v 1.2 1997/01/16 09:24:41 niklas Exp $ */
/* $NetBSD: if_edreg.h,v 1.4 1995/05/08 02:40:54 chopps Exp $ */
/*
diff --git a/sys/arch/amiga/dev/if_es.c b/sys/arch/amiga/dev/if_es.c
index 798b7f9d607..11a6a0bb3cb 100644
--- a/sys/arch/amiga/dev/if_es.c
+++ b/sys/arch/amiga/dev/if_es.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: if_es.c,v 1.9 1996/05/09 22:40:01 niklas Exp $ */
-/* $NetBSD: if_es.c,v 1.13 1996/05/07 00:46:44 thorpej Exp $ */
+/* $OpenBSD: if_es.c,v 1.10 1997/01/16 09:24:43 niklas Exp $ */
+/* $NetBSD: if_es.c,v 1.16 1996/12/23 09:10:17 veego Exp $ */
/*
* Copyright (c) 1995 Michael L. Hitch
@@ -60,6 +60,11 @@
#include <netinet/if_ether.h>
#endif
+#ifdef NS
+#include <netns/ns.h>
+#include <netns/ns_if.h>
+#endif
+
#include <machine/cpu.h>
#include <machine/mtpr.h>
#include <amiga/amiga/device.h>
@@ -984,6 +989,23 @@ esioctl(ifp, command, data)
arp_ifinit(&sc->sc_arpcom, ifa);
break;
#endif
+#ifdef NS
+ case AF_NS:
+ {
+ register struct ns_addr *ina = &IA_SNS(ifa)->sns_addr;
+
+ if (ns_nullhost(*ina))
+ ina->x_host =
+ *(union ns_host *)(sc->sc_arpcom.ac_enaddr);
+ else
+ bcopy(ina->x_host.c_host,
+ sc->sc_arpcom.ac_enaddr,
+ sizeof(sc->sc_arpcom.ac_enaddr));
+ /* Set new address. */
+ esinit(sc);
+ break;
+ }
+#endif
default:
esinit(sc);
break;
diff --git a/sys/arch/amiga/dev/if_esreg.h b/sys/arch/amiga/dev/if_esreg.h
index e3cb9d4eed1..86e8456bbc2 100644
--- a/sys/arch/amiga/dev/if_esreg.h
+++ b/sys/arch/amiga/dev/if_esreg.h
@@ -1,3 +1,4 @@
+/* $OpenBSD: if_esreg.h,v 1.3 1997/01/16 09:24:44 niklas Exp $ */
/* $NetBSD: if_esreg.h,v 1.4 1996/05/01 15:51:08 mhitch Exp $ */
/*
diff --git a/sys/arch/amiga/dev/if_le.c b/sys/arch/amiga/dev/if_le.c
index 7aaa51848be..cefc8b46f33 100644
--- a/sys/arch/amiga/dev/if_le.c
+++ b/sys/arch/amiga/dev/if_le.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: if_le.c,v 1.5 1996/05/09 22:43:24 niklas Exp $ */
-/* $NetBSD: if_le.c,v 1.21 1996/05/07 00:35:07 thorpej Exp $ */
+/* $OpenBSD: if_le.c,v 1.6 1997/01/16 09:24:45 niklas Exp $ */
+/* $NetBSD: if_le.c,v 1.22 1996/12/23 09:10:18 veego Exp $ */
/*-
* Copyright (c) 1995 Charles M. Hannum. All rights reserved.
diff --git a/sys/arch/amiga/dev/if_le_zbus.c b/sys/arch/amiga/dev/if_le_zbus.c
index 97dc943520d..d57d27b6c5e 100644
--- a/sys/arch/amiga/dev/if_le_zbus.c
+++ b/sys/arch/amiga/dev/if_le_zbus.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: if_le_zbus.c,v 1.5 1996/05/09 22:43:24 niklas Exp $ */
-/* $NetBSD: if_le.c,v 1.21 1996/05/07 00:35:07 thorpej Exp $ */
+/* $OpenBSD: if_le_zbus.c,v 1.6 1997/01/16 09:24:45 niklas Exp $ */
+/* $NetBSD: if_le.c,v 1.22 1996/12/23 09:10:18 veego Exp $ */
/*-
* Copyright (c) 1995 Charles M. Hannum. All rights reserved.
diff --git a/sys/arch/amiga/dev/if_qn.c b/sys/arch/amiga/dev/if_qn.c
index eba8567bc5a..46909ff8413 100644
--- a/sys/arch/amiga/dev/if_qn.c
+++ b/sys/arch/amiga/dev/if_qn.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: if_qn.c,v 1.8 1996/05/09 22:40:02 niklas Exp $ */
-/* $NetBSD: if_qn.c,v 1.6 1996/05/07 00:46:47 thorpej Exp $ */
+/* $OpenBSD: if_qn.c,v 1.9 1997/01/16 09:24:47 niklas Exp $ */
+/* $NetBSD: if_qn.c,v 1.10 1996/12/23 09:10:19 veego Exp $ */
/*
* Copyright (c) 1995 Mika Kortelainen
@@ -71,6 +71,7 @@
#define QN_DEBUG
#define QN_DEBUG1_no /* hides some old tests */
+#define QN_CHECKS_no /* adds some checks (not needed in normal situations) */
#include "bpfilter.h"
@@ -102,6 +103,11 @@
#include <netinet/if_ether.h>
#endif
+#ifdef NS
+#include <netns/ns.h>
+#include <netns/ns_if.h>
+#endif
+
#include <machine/cpu.h>
#include <machine/mtpr.h>
#include <amiga/amiga/device.h>
@@ -163,9 +169,9 @@ void qnstop __P((struct qn_softc *));
static u_short qn_put __P((u_short volatile *, struct mbuf *));
static void qn_rint __P((struct qn_softc *, u_short));
static void qn_flush __P((struct qn_softc *));
-static void inline word_copy_from_card __P((u_short volatile *, u_short *, u_short));
-static void inline word_copy_to_card __P((u_short *, u_short volatile *, u_short));
-static void qn_get_packet __P((struct qn_softc *, u_short));
+static void __inline word_copy_from_card __P((u_short volatile *, u_short *, u_short));
+static void __inline word_copy_to_card __P((u_short *, u_short volatile *, u_short));
+void qn_get_packet __P((struct qn_softc *, u_short));
#ifdef QN_DEBUG1
static void qn_dump __P((struct qn_softc *));
#endif
@@ -426,7 +432,6 @@ qnstart(ifp)
* that RAM is not visible to the host but is read from FIFO)
*
*/
- log(LOG_INFO, "NBPFILTER... no-one has tested this with qn.\n");
if (sc->sc_bpf)
bpf_mtap(sc->sc_bpf, m);
#endif
@@ -462,7 +467,7 @@ qnstart(ifp)
/*
* Memory copy, copies word at a time
*/
-static void inline
+static void __inline
word_copy_from_card(card, b, len)
u_short volatile *card;
u_short *b, len;
@@ -473,15 +478,13 @@ word_copy_from_card(card, b, len)
*b++ = *card;
}
-static void inline
+static void __inline
word_copy_to_card(a, card, len)
u_short *a;
u_short volatile *card;
u_short len;
{
- register u_short l = len/2;
-
- while (l--)
+ while (len--)
*card = *a++;
}
@@ -492,13 +495,14 @@ word_copy_to_card(a, card, len)
* unless the whole packet fits in one mbuf.
*
*/
-static u_short
+u_short
qn_put(addr, m)
u_short volatile *addr;
struct mbuf *m;
{
- u_short *data, savebyte[2];
- int len, wantbyte;
+ u_short *data;
+ u_char savebyte[2];
+ int len, len1, wantbyte;
u_short totlen;
totlen = wantbyte = 0;
@@ -508,23 +512,26 @@ qn_put(addr, m)
len = m->m_len;
totlen += len;
if (len > 0) {
+ totlen += len;
+
/* Finish the last word. */
if (wantbyte) {
- savebyte[1] = *data;
+ savebyte[1] = *((u_char *)data);
*addr = *((u_short *)savebyte);
- data++;
+ ((u_char *)data)++;
len--;
wantbyte = 0;
}
/* Output contiguous words. */
if (len > 1) {
- word_copy_to_card(data, addr, len);
- data += len & ~1;
+ len1 = len/2;
+ word_copy_to_card(data, addr, len1);
+ data += len1;
len &= 1;
}
/* Save last byte, if necessary. */
if (len == 1) {
- savebyte[0] = *data;
+ savebyte[0] = *((u_char *)data);
wantbyte = 1;
}
}
@@ -554,7 +561,7 @@ qn_put(addr, m)
* Trailers not supported.
*
*/
-static void
+void
qn_get_packet(sc, len)
struct qn_softc *sc;
u_short len;
@@ -621,7 +628,6 @@ qn_get_packet(sc, len)
}
#if NBPFILTER > 0
- log(LOG_INFO, "qn: Beware, an untested code section\n");
if (sc->sc_bpf) {
bpf_mtap(sc->sc_bpf, head);
@@ -671,25 +677,25 @@ qn_rint(sc, rstat)
* Some of them are senseless because they are masked off.
* XXX
*/
- if (rstat & 0x0101) {
+ if (rstat & R_INT_OVR_FLO) {
#ifdef QN_DEBUG
log(LOG_INFO, "Overflow\n");
#endif
++sc->sc_arpcom.ac_if.if_ierrors;
}
- if (rstat & 0x0202) {
+ if (rstat & R_INT_CRC_ERR) {
#ifdef QN_DEBUG
log(LOG_INFO, "CRC Error\n");
#endif
++sc->sc_arpcom.ac_if.if_ierrors;
}
- if (rstat & 0x0404) {
+ if (rstat & R_INT_ALG_ERR) {
#ifdef QN_DEBUG
log(LOG_INFO, "Alignment error\n");
#endif
++sc->sc_arpcom.ac_if.if_ierrors;
}
- if (rstat & 0x0808) {
+ if (rstat & R_INT_SRT_PKT) {
/* Short packet (these may occur and are
* no reason to worry about - or maybe
* they are?).
@@ -732,7 +738,7 @@ qn_rint(sc, rstat)
len = *sc->nic_fifo;
len = ((len << 8) & 0xff00) | ((len >> 8) & 0x00ff);
-#ifdef QN_DEBUG
+#ifdef QN_CHECKS
if (len > ETHER_MAX_LEN || len < ETHER_HDR_SIZE) {
log(LOG_WARNING,
"%s: received a %s packet? (%u bytes)\n",
@@ -742,7 +748,7 @@ qn_rint(sc, rstat)
continue;
}
#endif
-#ifdef QN_DEBUG
+#ifdef QN_CHECKS
if (len < ETHER_MIN_LEN)
log(LOG_WARNING,
"%s: received a short packet? (%u bytes)\n",
@@ -890,6 +896,23 @@ qnioctl(ifp, command, data)
arp_ifinit(&sc->sc_arpcom, ifa);
break;
#endif
+#ifdef NS
+ case AF_NS:
+ {
+ register struct ns_addr *ina = &(IA_SNS(ifa)->sns_addr);
+
+ if (ns_nullhost(*ina))
+ ina->x_host =
+ *(union ns_host *)(sc->sc_arpcom.ac_enaddr);
+ else
+ bcopy(ina->x_host.c_host,
+ sc->sc_arpcom.ac_enaddr,
+ sizeof(sc->sc_arpcom.ac_enaddr));
+ qnstop(sc);
+ qninit(sc);
+ break;
+ }
+#endif
default:
log(LOG_INFO, "qn:sa_family:default (not tested)\n");
qnstop(sc);
diff --git a/sys/arch/amiga/dev/if_qnreg.h b/sys/arch/amiga/dev/if_qnreg.h
index 2094db7d925..91ae2fc7a41 100644
--- a/sys/arch/amiga/dev/if_qnreg.h
+++ b/sys/arch/amiga/dev/if_qnreg.h
@@ -1,4 +1,5 @@
-/* $NetBSD: if_qnreg.h,v 1.1.2.1 1995/11/10 16:39:14 chopps Exp $ */
+/* $OpenBSD: if_qnreg.h,v 1.3 1997/01/16 09:24:48 niklas Exp $ */
+/* $NetBSD: if_qnreg.h,v 1.2 1995/11/30 00:57:04 jtc Exp $ */
/*
* Copyright (c) 1995 Mika Kortelainen
diff --git a/sys/arch/amiga/dev/ite.c b/sys/arch/amiga/dev/ite.c
index 5b32e7437ff..48d5142027a 100644
--- a/sys/arch/amiga/dev/ite.c
+++ b/sys/arch/amiga/dev/ite.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: ite.c,v 1.8 1996/08/23 18:53:07 niklas Exp $ */
-/* $NetBSD: ite.c,v 1.41.4.1 1996/06/06 04:53:13 mhitch Exp $ */
+/* $OpenBSD: ite.c,v 1.9 1997/01/16 09:24:50 niklas Exp $ */
+/* $NetBSD: ite.c,v 1.47 1996/12/23 09:10:20 veego Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -163,7 +163,7 @@ itematch(pdp, match, auxp)
struct device *pdp;
void *match, *auxp;
{
- struct cfdata *cdp = match;
+ struct cfdata *cfp = match;
struct grf_softc *gp;
int maj;
@@ -172,7 +172,7 @@ itematch(pdp, match, auxp)
* all that our mask allows (more than enough no one
* has > 32 monitors for text consoles on one machine)
*/
- if (cdp->cf_unit >= sizeof(ite_confunits) * NBBY)
+ if (cfp->cf_unit >= sizeof(ite_confunits) * NBBY)
return(0);
/*
* XXX
@@ -183,7 +183,7 @@ itematch(pdp, match, auxp)
for(maj = 0; maj < nchrdev; maj++)
if (cdevsw[maj].d_open == iteopen)
break;
- gp->g_itedev = makedev(maj, cdp->cf_unit);
+ gp->g_itedev = makedev(maj, cfp->cf_unit);
return(1);
}
diff --git a/sys/arch/amiga/dev/ite_et.c b/sys/arch/amiga/dev/ite_et.c
index 6cfb981c122..0942bb03fb1 100644
--- a/sys/arch/amiga/dev/ite_et.c
+++ b/sys/arch/amiga/dev/ite_et.c
@@ -1,4 +1,5 @@
-/* $NetBSD: ite_et.c,v 1.1.4.1 1996/05/27 01:12:10 is Exp $ */
+/* $OpenBSD: ite_et.c,v 1.3 1997/01/16 09:24:51 niklas Exp $ */
+/* $NetBSD: ite_et.c,v 1.2 1996/10/08 23:18:54 thorpej Exp $ */
/*
* Copyright (c) 1995 Ezra Story
diff --git a/sys/arch/amiga/dev/ite_ul.c b/sys/arch/amiga/dev/ite_ul.c
index b9bc4aa9995..0e6646c5ac7 100644
--- a/sys/arch/amiga/dev/ite_ul.c
+++ b/sys/arch/amiga/dev/ite_ul.c
@@ -1,4 +1,5 @@
-/* $NetBSD: ite_ul.c,v 1.4 1996/05/10 13:02:35 is Exp $ */
+/* $OpenBSD: ite_ul.c,v 1.4 1997/01/16 09:24:52 niklas Exp $ */
+/* $NetBSD: ite_ul.c,v 1.7 1996/10/13 03:07:20 christos Exp $ */
/*
* Copyright (c) 1995 Ignatios Souvatzis
@@ -14,7 +15,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 Lutz Vieweg.
+ * This product includes software developed by Ignatios Souvatzis for
+ * the NetBSD project.
* 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/amiga/dev/iteioctl.h b/sys/arch/amiga/dev/iteioctl.h
index 4236d64108b..d9ffc98cdf3 100644
--- a/sys/arch/amiga/dev/iteioctl.h
+++ b/sys/arch/amiga/dev/iteioctl.h
@@ -1,3 +1,4 @@
+/* $OpenBSD: iteioctl.h,v 1.2 1997/01/16 09:24:53 niklas Exp $ */
/* $NetBSD: iteioctl.h,v 1.9 1994/10/26 02:04:02 cgd Exp $ */
/*
diff --git a/sys/arch/amiga/dev/ivsc.c b/sys/arch/amiga/dev/ivsc.c
index 27db9e1d9ca..6ff8c735976 100644
--- a/sys/arch/amiga/dev/ivsc.c
+++ b/sys/arch/amiga/dev/ivsc.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: ivsc.c,v 1.4 1996/11/23 21:45:19 kstailey Exp $ */
-/* $NetBSD: ivsc.c,v 1.15 1996/04/21 21:12:04 veego Exp $ */
+/* $OpenBSD: ivsc.c,v 1.5 1997/01/16 09:24:54 niklas Exp $ */
+/* $NetBSD: ivsc.c,v 1.21 1996/12/23 09:10:21 veego Exp $ */
/*
* Copyright (c) 1994 Michael L. Hitch
diff --git a/sys/arch/amiga/dev/kbd.c b/sys/arch/amiga/dev/kbd.c
index 14a18256161..e3fe894d037 100644
--- a/sys/arch/amiga/dev/kbd.c
+++ b/sys/arch/amiga/dev/kbd.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: kbd.c,v 1.4 1996/05/29 10:15:33 niklas Exp $ */
-/* $NetBSD: kbd.c,v 1.22 1996/05/16 20:18:01 is Exp $ */
+/* $OpenBSD: kbd.c,v 1.5 1997/01/16 09:24:55 niklas Exp $ */
+/* $NetBSD: kbd.c,v 1.28 1996/12/23 09:10:22 veego Exp $ */
/*
* Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
@@ -152,7 +152,6 @@ kbdenable()
ciaa.icr = CIA_ICR_IR_SC | CIA_ICR_SP;
/* SP interrupt enable */
ciaa.cra &= ~(1<<6); /* serial line == input */
- printf("ok.\n");
break;
case 1:
case 2:
@@ -175,7 +174,6 @@ kbdenable()
while (draco_ioct->io_status & DRSTAT_KBDRECV) {
c = draco_ioct->io_kbddata;
draco_ioct->io_kbdrst = 0;
- printf(".");
DELAY(2000);
}
@@ -335,7 +333,7 @@ kbdintr(mask)
#ifdef DRACO
/* maps MF-II keycodes to Amiga keycodes */
-u_char drkbdtab[] = {
+const u_char drkbdtab[] = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x50,
0x45, 0xff, 0xff, 0xff, 0xff, 0x42, 0x00, 0x51,
diff --git a/sys/arch/amiga/dev/kbdreg.h b/sys/arch/amiga/dev/kbdreg.h
index 4f970d088a1..1807c4a1c8f 100644
--- a/sys/arch/amiga/dev/kbdreg.h
+++ b/sys/arch/amiga/dev/kbdreg.h
@@ -1,3 +1,4 @@
+/* $OpenBSD: kbdreg.h,v 1.2 1997/01/16 09:24:56 niklas Exp $ */
/* $NetBSD: kbdreg.h,v 1.5 1994/10/26 02:04:14 cgd Exp $ */
/*
diff --git a/sys/arch/amiga/dev/kf_8x11.c b/sys/arch/amiga/dev/kf_8x11.c
index dc25971347a..c44a9a231e9 100644
--- a/sys/arch/amiga/dev/kf_8x11.c
+++ b/sys/arch/amiga/dev/kf_8x11.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: kf_8x11.c,v 1.2 1997/01/16 09:24:58 niklas Exp $ */
/* $NetBSD: kf_8x11.c,v 1.3 1994/10/26 02:04:16 cgd Exp $ */
/*
diff --git a/sys/arch/amiga/dev/kf_8x8.c b/sys/arch/amiga/dev/kf_8x8.c
index 2b3ece84370..2d593f035ce 100644
--- a/sys/arch/amiga/dev/kf_8x8.c
+++ b/sys/arch/amiga/dev/kf_8x8.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: kf_8x8.c,v 1.2 1997/01/16 09:24:59 niklas Exp $ */
/* $NetBSD: kf_8x8.c,v 1.3 1994/10/26 02:04:18 cgd Exp $ */
/*
diff --git a/sys/arch/amiga/dev/mfc.c b/sys/arch/amiga/dev/mfc.c
index 22d4768a2ad..3d6cd5b62e5 100644
--- a/sys/arch/amiga/dev/mfc.c
+++ b/sys/arch/amiga/dev/mfc.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: mfc.c,v 1.9 1996/11/23 21:45:20 kstailey Exp $ */
-/* $NetBSD: mfc.c,v 1.12.4.1 1996/06/06 04:53:16 mhitch Exp $ */
+/* $OpenBSD: mfc.c,v 1.10 1997/01/16 09:25:01 niklas Exp $ */
+/* $NetBSD: mfc.c,v 1.18 1996/12/23 09:10:23 veego Exp $ */
/*
* Copyright (c) 1994 Michael L. Hitch
diff --git a/sys/arch/amiga/dev/mlhsc.c b/sys/arch/amiga/dev/mlhsc.c
index de282adee2c..2a13f94468e 100644
--- a/sys/arch/amiga/dev/mlhsc.c
+++ b/sys/arch/amiga/dev/mlhsc.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: mlhsc.c,v 1.4 1996/11/23 21:45:21 kstailey Exp $ */
-/* $NetBSD: mlhsc.c,v 1.10 1996/04/21 21:12:12 veego Exp $ */
+/* $OpenBSD: mlhsc.c,v 1.5 1997/01/16 09:25:02 niklas Exp $ */
+/* $NetBSD: mlhsc.c,v 1.16 1996/12/23 09:10:25 veego Exp $ */
/*
* Copyright (c) 1994 Michael L. Hitch
diff --git a/sys/arch/amiga/dev/ms.c b/sys/arch/amiga/dev/ms.c
index 4e14bef5f3e..b994de20357 100644
--- a/sys/arch/amiga/dev/ms.c
+++ b/sys/arch/amiga/dev/ms.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: ms.c,v 1.3 1996/05/29 10:15:35 niklas Exp $ */
-/* $NetBSD: ms.c,v 1.10 1996/05/09 20:31:41 is Exp $ */
+/* $OpenBSD: ms.c,v 1.4 1997/01/16 09:25:03 niklas Exp $ */
+/* $NetBSD: ms.c,v 1.14 1996/12/23 09:10:25 veego Exp $ */
/*
* based on:
diff --git a/sys/arch/amiga/dev/msc.c b/sys/arch/amiga/dev/msc.c
index d8828ed5f8d..eb4d51d4836 100644
--- a/sys/arch/amiga/dev/msc.c
+++ b/sys/arch/amiga/dev/msc.c
@@ -1,9 +1,9 @@
-/* $OpenBSD: msc.c,v 1.5 1996/08/23 18:53:14 niklas Exp $ */
-/* $NetBSD: msc.c,v 1.6.4.1 1996/06/06 04:53:17 mhitch Exp $ */
+/* $OpenBSD: msc.c,v 1.6 1997/01/16 09:25:04 niklas Exp $ */
+/* $NetBSD: msc.c,v 1.13 1996/12/23 09:10:26 veego Exp $ */
/*
* Copyright (c) 1993 Zik.
- * Copyright (c) 1995 Jukka Marin <jmarin@teeri.jmp.fi>.
+ * Copyright (c) 1995 Jukka Marin <jmarin@jmp.fi>.
* Copyright (c) 1995 Timo Rossi <trossi@jyu.fi>.
* Copyright (c) 1995 Rob Healey <rhealey@kas.helios.mn.org>.
* Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
@@ -49,6 +49,7 @@
* Integrated more bug fixes by Jukka Marin <jmarin@jmp.fi> 950918
* Also added Jukka's turbo board code. 950918
* - Reformatted to NetBSD style format.
+ * - Rewritten the carrier detect system to prevent lock-ups (jm 951029)
*/
#include "msc.h"
@@ -121,8 +122,8 @@ struct vbl_node msc_vbl_node[NMSC]; /* vbl interrupt node per board */
struct speedtab mscspeedtab_normal[] = {
{ 0, 0 },
{ 50, MSCPARAM_B50 },
- { 75, MSCPARAM_B75 },
- { 110, MSCPARAM_B110 },
+ { 75, MSCPARAM_B75 },
+ { 110, MSCPARAM_B110 },
{ 134, MSCPARAM_B134 },
{ 150, MSCPARAM_B150 },
{ 300, MSCPARAM_B300 },
@@ -169,7 +170,6 @@ int mscmatch __P((struct device *, void *, void *));
void mscattach __P((struct device *, struct device *, void *));
#define SWFLAGS(dev) (msc->openflags | (MSCDIALIN(dev) ? 0 : TIOCFLAG_SOFTCAR))
-#define DEBUG_MSC 0
#define DEBUG_CD 0
struct cfattach msc_ca = {
@@ -180,30 +180,6 @@ struct cfdriver msc_cd = {
NULL, "msc",DV_TTY, NULL, 0
};
-#if DEBUG_MSC
-void
-bugi(msc, string)
- struct mscdevice *msc;
- char *string;
-{
- volatile struct mscstatus *ms;
- volatile struct mscmemory *mscmem;
-
- mscmem = msc->board;
- ms = &mscmem->Status[msc->port];
-
- printf("msc %s u%d f%08lx F%08lx\n", string, msc->port, msc->flags,
- msc->openflags);
- printf("msc h%d t%d H%d t%d p%02x c%02x CD%02x\n", ms->InHead,
- ms->InTail, ms->OutHead, ms->OutTail, ms->Param, ms->Command,
- ms->chCD);
- printf("msc a%02x b%02x c%02x\n", ms->Pad_a, ms->Pad_b, ms->Padc);
-
- return
-}
-
-#endif
-
int
mscmatch(pdp, match, auxp)
struct device *pdp;
@@ -223,65 +199,72 @@ mscattach(pdp, dp, auxp)
struct device *pdp, *dp;
void *auxp;
{
- volatile struct mscmemory *mscmem;
- struct mscdevice *msc;
- struct zbus_args *zap;
- int unit;
- int Count;
-
- zap = (struct zbus_args *)auxp;
- unit = dp->dv_unit;
-
- if (mscinitcard(zap) != 0) {
- printf("\nmsc%d: Board initialize failed, bad download code.\n", unit);
- return;
- }
-
- printf("\nmsc%d: Board successfully initialized.\n", unit);
-
- mscmem = (struct mscmemory *) zap->va;
-
- if (mscmem->Common.Crystal == MSC_UNKNOWN) {
- printf("msc%d: Unable to detect crystal frequency.\n", unit);
- return;
- }
-
- if (mscmem->Common.Crystal == MSC_TURBO) {
- printf("msc%d: Turbo version detected (%02x%02x:%d)\n", unit,
- mscmem->Common.TimerH, mscmem->Common.TimerL,
- mscmem->Common.Pad_a);
- mscspeedtab = mscspeedtab_turbo;
- } else {
- printf("msc%d: Normal version detected (%02x%02x:%d)\n", unit,
- mscmem->Common.TimerH, mscmem->Common.TimerL,
- mscmem->Common.Pad_a);
- mscspeedtab = mscspeedtab_normal;
- }
-
- /* XXX 8 is a constant */
- for (Count = 0; Count < 8 && MSCSLOTUL(unit, Count) < MSCSLOTS; Count++) {
- msc = &mscdev[MSCSLOTUL(unit, Count)];
- msc->board = mscmem;
- msc->port = Count;
- msc->flags = 0;
- msc->openflags = 0;
- msc->active = 1;
- msc->closing = FALSE;
- msc_tty[MSCTTYSLOT(MSCSLOTUL(unit, Count))] = NULL;
- msc_tty[MSCTTYSLOT(MSCSLOTUL(unit, Count))+1] = NULL;
-
- }
-
- /* disable the non-existant eighth port */
- if (MSCSLOTUL(unit, NUMLINES) < MSCSLOTS)
- mscdev[MSCSLOTUL(unit, NUMLINES)].active = 0;
-
- msc_vbl_node[unit].function = (void (*) (void *)) mscmint;
- msc_vbl_node[unit].data = (void *) unit;
-
- add_vbl_function (&msc_vbl_node[unit], MSC_VBL_PRIORITY, (void *)unit);
-
- return;
+ volatile struct mscmemory *mscmem;
+ struct mscdevice *msc;
+ struct zbus_args *zap;
+ int unit;
+ int Count;
+
+ zap = (struct zbus_args *)auxp;
+ unit = dp->dv_unit;
+
+ /*
+ * Make config msgs look nicer.
+ */
+ printf("\n");
+
+ if (mscinitcard(zap) != 0) {
+ printf("msc%d: Board initialize failed, bad download code.\n", unit);
+ return;
+ }
+
+ printf("msc%d: Board successfully initialized.\n", unit);
+
+ mscmem = (struct mscmemory *) zap->va;
+
+ if (mscmem->Common.Crystal == MSC_UNKNOWN) {
+ printf("msc%d: Unable to detect crystal frequency.\n", unit);
+ return;
+ }
+
+ if (mscmem->Common.Crystal == MSC_TURBO) {
+ printf("msc%d: Turbo version detected (%02x%02x:%d)\n", unit,
+ mscmem->Common.TimerH, mscmem->Common.TimerL,
+ mscmem->Common.Pad_a);
+ mscspeedtab = mscspeedtab_turbo;
+ } else {
+ printf("msc%d: Normal version detected (%02x%02x:%d)\n", unit,
+ mscmem->Common.TimerH, mscmem->Common.TimerL,
+ mscmem->Common.Pad_a);
+ mscspeedtab = mscspeedtab_normal;
+ }
+
+ mscmem->Common.CDStatus = 0; /* common status for all 7 ports */
+
+ /* XXX 8 is a constant */
+ for (Count = 0; Count < 8 && MSCSLOTUL(unit, Count) < MSCSLOTS; Count++) {
+ msc = &mscdev[MSCSLOTUL(unit, Count)];
+ msc->board = mscmem;
+ msc->port = Count;
+ msc->flags = 0;
+ msc->openflags = 0;
+ msc->active = 1;
+ msc->unit = unit;
+ msc->closing = FALSE;
+ msc_tty[MSCTTYSLOT(MSCSLOTUL(unit, Count))] = NULL;
+ msc_tty[MSCTTYSLOT(MSCSLOTUL(unit, Count)) + 1] = NULL;
+ }
+
+ /* disable the non-existant eighth port */
+ if (MSCSLOTUL(unit, NUMLINES) < MSCSLOTS)
+ mscdev[MSCSLOTUL(unit, NUMLINES)].active = 0;
+
+ msc_vbl_node[unit].function = (void (*) (void *)) mscmint;
+ msc_vbl_node[unit].data = (void *) unit;
+
+ add_vbl_function (&msc_vbl_node[unit], MSC_VBL_PRIORITY, (void *)unit);
+
+ return;
}
/* ARGSUSED */
@@ -291,159 +274,155 @@ mscopen(dev, flag, mode, p)
int flag, mode;
struct proc *p;
{
- register struct tty *tp;
- int error = 0;
- int s;
- int slot;
- int ttyn;
- struct mscdevice *msc;
- volatile struct mscstatus *ms;
+ register struct tty *tp;
+ struct mscdevice *msc;
+ volatile struct mscstatus *ms;
+ int error = 0;
+ int s, slot, ttyn;
- /* get the device structure */
- slot = MSCSLOT(dev);
- ttyn = MSCTTY(dev);
+ /* get the device structure */
+ slot = MSCSLOT(dev);
+ ttyn = MSCTTY(dev);
- if (slot >= MSCSLOTS)
- return ENXIO;
+ if (slot >= MSCSLOTS)
+ return ENXIO;
- if (MSCLINE(dev) >= NUMLINES)
- return ENXIO;
+ if (MSCLINE(dev) >= NUMLINES)
+ return ENXIO;
- msc = &mscdev[slot];
- ms = &msc->board->Status[msc->port];
+ msc = &mscdev[slot];
+ ms = &msc->board->Status[msc->port];
- if (!msc->active)
- return ENXIO;
+ if (!msc->active)
+ return ENXIO;
- /*
- * RFH: WHY here? Put down by while like other serial drivers
- * But if we do that it makes things bomb.
- */
- s = spltty();
+ /*
+ * RFH: WHY here? Put down by while like other serial drivers
+ * But if we do that it makes things bomb.
+ */
+ s = spltty();
- if (!msc_tty[ttyn]) {
+ if (!msc_tty[ttyn]) {
- tp = ttymalloc();
- tty_attach(tp);
- msc_tty[ttyn] = tp;
- msc_tty[ttyn+1] = (struct tty *)NULL;
+ tp = ttymalloc();
+ tty_attach(tp);
+ msc_tty[ttyn] = tp;
+ msc_tty[ttyn+1] = (struct tty *)NULL;
#if 0
- /* default values are not optimal for this device, increase buffers. */
- clfree(&tp->t_rawq);
- clfree(&tp->t_canq);
- clfree(&tp->t_outq);
- clalloc(&tp->t_rawq, 8192, 1);
- clalloc(&tp->t_canq, 8192, 1);
- clalloc(&tp->t_outq, 8192, 0);
+ /* default values are not optimal for this device, increase buffers. */
+ clfree(&tp->t_rawq);
+ clfree(&tp->t_canq);
+ clfree(&tp->t_outq);
+ clalloc(&tp->t_rawq, 8192, 1);
+ clalloc(&tp->t_canq, 8192, 1);
+ clalloc(&tp->t_outq, 8192, 0);
#endif
- }
- else
- tp = msc_tty[ttyn];
+ } else
+ tp = msc_tty[ttyn];
- tp->t_oproc = (void (*) (struct tty *)) mscstart;
- tp->t_param = mscparam;
- tp->t_dev = dev;
- tp->t_hwiflow = mschwiflow;
+ tp->t_oproc = (void (*) (struct tty *)) mscstart;
+ tp->t_param = mscparam;
+ tp->t_dev = dev;
+ tp->t_hwiflow = mschwiflow;
- /* if port is still closing, just bitbucket remaining characters */
- if (msc->closing) {
-
- ms->OutFlush = TRUE;
- msc->closing = FALSE;
- }
-
- /* initialize tty */
- if ((tp->t_state & TS_ISOPEN) == 0) {
-
- tp->t_state |= TS_WOPEN;
- ttychars(tp);
- if (tp->t_ispeed == 0) {
-
- tp->t_iflag = TTYDEF_IFLAG;
- tp->t_oflag = TTYDEF_OFLAG;
- tp->t_cflag = TTYDEF_CFLAG;
- tp->t_lflag = TTYDEF_LFLAG;
- tp->t_ispeed = tp->t_ospeed = mscdefaultrate;
- }
-
- /* flags changed to be private to every unit by JM */
- if (msc->openflags & TIOCFLAG_CLOCAL)
- tp->t_cflag |= CLOCAL;
- if (msc->openflags & TIOCFLAG_CRTSCTS)
- tp->t_cflag |= CRTSCTS;
- if (msc->openflags & TIOCFLAG_MDMBUF)
- tp->t_cflag |= MDMBUF;
-
- mscparam(tp, &tp->t_termios);
- ttsetwater(tp);
-
- (void) mscmctl(dev, TIOCM_DTR | TIOCM_RTS, DMSET);
-
- if ((SWFLAGS(dev) & TIOCFLAG_SOFTCAR) ||
- (mscmctl(dev, 0, DMGET) & TIOCM_CD))
- tp->t_state |= TS_CARR_ON;
- else
- tp->t_state &= ~TS_CARR_ON;
-
- }
- else {
- if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) {
- splx(s);
- return (EBUSY);
- }
- }
+ /* if port is still closing, just bitbucket remaining characters */
+ if (msc->closing) {
+ ms->OutFlush = TRUE;
+ msc->closing = FALSE;
+ }
- /*
- * if NONBLOCK requested, ignore carrier
- */
- if (flag & O_NONBLOCK)
- goto done;
+ /* initialize tty */
+ if ((tp->t_state & TS_ISOPEN) == 0) {
+ tp->t_state |= TS_WOPEN;
+ ttychars(tp);
+ if (tp->t_ispeed == 0) {
+ tp->t_iflag = TTYDEF_IFLAG;
+ tp->t_oflag = TTYDEF_OFLAG;
+ tp->t_cflag = TTYDEF_CFLAG;
+ tp->t_lflag = TTYDEF_LFLAG;
+ tp->t_ispeed = tp->t_ospeed = mscdefaultrate;
+ }
- /*
- * s = spltty();
- *
- * This causes hangs when put here, like other TTY drivers do, rather than
- * above, WHY? RFH
- *
- */
+ /* flags changed to be private to every unit by JM */
+ if (msc->openflags & TIOCFLAG_CLOCAL)
+ tp->t_cflag |= CLOCAL;
+ if (msc->openflags & TIOCFLAG_CRTSCTS)
+ tp->t_cflag |= CRTSCTS;
+ if (msc->openflags & TIOCFLAG_MDMBUF)
+ tp->t_cflag |= MDMBUF;
+
+ mscparam(tp, &tp->t_termios);
+ ttsetwater(tp);
+
+ (void) mscmctl(dev, TIOCM_DTR | TIOCM_RTS, DMSET);
+
+ if ((SWFLAGS(dev) & TIOCFLAG_SOFTCAR) ||
+ (mscmctl(dev, 0, DMGET) & TIOCM_CD))
+ tp->t_state |= TS_CARR_ON;
+ else
+ tp->t_state &= ~TS_CARR_ON;
+
+ } else {
+ if (tp->t_state & TS_XCLUDE && p->p_ucred->cr_uid != 0) {
+ splx(s);
+ return (EBUSY);
+ }
+ }
- while ((tp->t_state & TS_CARR_ON) == 0 && (tp->t_cflag & CLOCAL) == 0) {
+ /*
+ * if NONBLOCK requested, ignore carrier
+ */
+ if (flag & O_NONBLOCK) {
+#if DEBUG_CD
+ printf("msc%d: %d open nonblock\n", msc->unit, MSCLINE(dev));
+#endif
+ goto done;
+ }
+
+ /*
+ * s = spltty();
+ *
+ * This causes hangs when put here, like other TTY drivers do, rather than
+ * above, WHY? RFH
+ *
+ */
- tp->t_state |= TS_WOPEN;
+ while ((tp->t_state & TS_CARR_ON) == 0 && (tp->t_cflag & CLOCAL) == 0) {
+ tp->t_state |= TS_WOPEN;
#if DEBUG_CD
- printf("msc %ld waiting for CD\n", MSCLINE(dev));
+ printf("msc%d: %d waiting for CD\n", msc->unit, MSCLINE(dev));
#endif
- error = ttysleep(tp, (caddr_t)&tp->t_rawq, TTIPRI | PCATCH, ttopen, 0);
+ error = ttysleep(tp, (caddr_t)&tp->t_rawq, TTIPRI | PCATCH, ttopen, 0);
- if (error) {
- splx(s);
- return(error);
- }
- }
+ if (error) {
+ splx(s);
+ return(error);
+ }
+ }
-done:
#if DEBUG_CD
- printf("msc %ld waiting for CD\n", MSCLINE(dev));
+ printf("msc%d: %d got CD\n", msc->unit, MSCLINE(dev));
#endif
- /* This is a way to handle lost XON characters */
- if ((flag & O_TRUNC) && (tp->t_state & TS_TTSTOP)) {
- tp->t_state &= ~TS_TTSTOP;
- ttstart (tp);
- }
- splx(s);
+ done:
+ /* This is a way to handle lost XON characters */
+ if ((flag & O_TRUNC) && (tp->t_state & TS_TTSTOP)) {
+ tp->t_state &= ~TS_TTSTOP;
+ ttstart (tp);
+ }
- /*
- * Reset the tty pointer, as there could have been a dialout
- * use of the tty with a dialin open waiting.
- */
- tp->t_dev = dev;
+ splx(s);
- return((*linesw[tp->t_line].l_open)(dev, tp));
+ /*
+ * Reset the tty pointer, as there could have been a dialout
+ * use of the tty with a dialin open waiting.
+ */
+ tp->t_dev = dev;
+ return((*linesw[tp->t_line].l_open)(dev, tp));
}
int
@@ -452,46 +431,37 @@ mscclose(dev, flag, mode, p)
int flag, mode;
struct proc *p;
{
- register struct tty *tp;
- int slot;
- volatile struct mscstatus *ms;
- struct mscdevice *msc;
+ register struct tty *tp;
+ int slot;
+ volatile struct mscstatus *ms;
+ struct mscdevice *msc;
- /* get the device structure */
- slot = MSCSLOT(dev);
+ /* get the device structure */
+ slot = MSCSLOT(dev);
- if (slot >= MSCSLOTS)
- return ENXIO;
+ if (slot >= MSCSLOTS)
+ return ENXIO;
- msc = &mscdev[slot];
+ msc = &mscdev[slot];
- if (!msc->active)
- return ENXIO;
+ if (!msc->active)
+ return ENXIO;
- ms = &msc->board->Status[msc->port];
+ ms = &msc->board->Status[msc->port];
-#if DEBUG_MSC
- bugi(msc, "close1");
-#endif
-
- tp = msc_tty[MSCTTY(dev)];
- (*linesw[tp->t_line].l_close)(tp, flag);
-
- (void) mscmctl(dev, 0, DMSET);
-
- ttyclose(tp);
+ tp = msc_tty[MSCTTY(dev)];
+ (*linesw[tp->t_line].l_close)(tp, flag);
- if (msc->flags & TIOCM_DTR)
- msc->closing = TRUE; /* flush remaining characters before dropping DTR */
- else
- ms->OutFlush = TRUE; /* just bitbucket remaining characters */
+ (void) mscmctl(dev, 0, DMSET);
-#if DEBUG_MSC
- bugi(msc, "close2");
-#endif
+ ttyclose(tp);
- return (0);
+ if (msc->flags & TIOCM_DTR)
+ msc->closing = TRUE; /* flush remaining characters before dropping DTR */
+ else
+ ms->OutFlush = TRUE; /* just bitbucket remaining characters */
+ return (0);
}
int
@@ -516,14 +486,14 @@ mscwrite(dev, uio, flag)
struct uio *uio;
int flag;
{
- register struct tty *tp;
+ register struct tty *tp;
- tp = msc_tty[MSCTTY(dev)];
+ tp = msc_tty[MSCTTY(dev)];
- if (! tp)
- return ENXIO;
+ if (! tp)
+ return ENXIO;
- return ((*linesw[tp->t_line].l_write)(tp, uio, flag));
+ return ((*linesw[tp->t_line].l_write)(tp, uio, flag));
}
/*
@@ -543,278 +513,217 @@ void
mscmint (data)
register void *data;
{
- int unit;
- register struct tty *tp;
- int slot;
- int maxslot;
- struct mscdevice *msc;
- volatile struct mscstatus *ms;
- volatile u_char *ibuf, *cbuf;
- unsigned char newhead; /* was int */
- unsigned char bufpos; /* was int */
- int s;
-
- unit = (int) data;
-
- /* check each line on this board */
- maxslot = MSCSLOTUL(unit, NUMLINES);
- if (maxslot > MSCSLOTS)
- maxslot = MSCSLOTS;
-
- for (slot = MSCSLOTUL(unit, 0); slot < maxslot; slot++)
- {
- msc = &mscdev[slot];
-
- if (!msc->active)
- continue;
-
- tp = msc_tty[MSCTTYSLOT(slot)];
- ms = &msc->board->Status[msc->port];
-
- newhead = ms->InHead; /* 65c02 write pointer */
-
- /* yoohoo, is the port open? */
- if (tp && (tp->t_state & (TS_ISOPEN|TS_WOPEN))) {
- /* port is open, handle all type of events */
-
- /* set interrupt priority level */
- s = spltty();
-
- /* check for input for this port */
- if (newhead != (bufpos = ms->InTail))
- {
-#if DEBUG_MSC
- printf("iop%d\n",slot);
-#endif
- /* buffer for input chars/events */
- ibuf = &msc->board->InBuf[msc->port][0];
-
- /* data types of bytes in ibuf */
- cbuf = &msc->board->InCtl[msc->port][0];
-
- /* do for all chars, if room */
- while (bufpos != newhead)
- {
- /* which type of input data? */
- switch (cbuf[bufpos])
- {
- /* input event (CD, BREAK, etc.) */
- case MSCINCTL_EVENT:
- switch (ibuf[bufpos++])
- {
- /* carrier detect change OFF -> ON */
- case MSCEVENT_CarrierOn:
+ register struct tty *tp;
+ struct mscdevice *msc;
+ volatile struct mscstatus *ms;
+ volatile u_char *ibuf, *cbuf;
+ unsigned char newhead; /* was int */
+ unsigned char bufpos; /* was int */
+ unsigned char ncd, ocd, ccd;
+ int unit, slot, maxslot;
+ int s, i;
+
+ unit = (int) data;
+
+ /* check each line on this board */
+ maxslot = MSCSLOTUL(unit, NUMLINES);
+ if (maxslot > MSCSLOTS)
+ maxslot = MSCSLOTS;
+
+ msc = &mscdev[MSCSLOTUL(unit, 0)];
+
+ newhead = msc->board->Common.CDHead;
+ bufpos = msc->board->Common.CDTail;
+ if (newhead != bufpos) { /* CD events in queue */
+ /* set interrupt priority level */
+ s = spltty();
+ ocd = msc->board->Common.CDStatus; /* get old status bits */
+ while (newhead != bufpos) { /* read all events */
+ ncd = msc->board->CDBuf[bufpos++]; /* get one event */
+ ccd = ncd ^ ocd; /* mask of changed lines*/
+ ocd = ncd; /* save new status bits */
#if DEBUG_CD
- printf("msc CD ON %d\n", msc->port);
+ printf("ocd %02x ncd %02x ccd %02x\n", ocd, ncd, ccd);
#endif
- msc->flags |= TIOCM_CD;
- if (MSCDIALIN(tp->t_dev))
- (*linesw[tp->t_line].l_modem)(tp, 1);
- break;
-
- /* carrier detect change ON -> OFF */
- case MSCEVENT_CarrierOff:
+ for(i = 0; i < NUMLINES; i++) { /* do for all lines */
+ if (ccd & 1) { /* this one changed */
+ msc = &mscdev[MSCSLOTUL(unit, i)];
+ if (ncd & 1) { /* CD is now OFF */
#if DEBUG_CD
- printf("msc CD OFF %d\n", msc->port);
+ printf("msc%d: CD OFF %d\n", unit, msc->port);
#endif
- msc->flags &= ~TIOCM_CD;
+ msc->flags &= ~TIOCM_CD;
+ if ((tp = msc_tty[MSCTTYSLOT(MSCSLOTUL(unit, i))]) &&
+ (tp->t_state & (TS_ISOPEN | TS_WOPEN))) {
+
#ifndef MSCCDHACK
- if (MSCDIALIN(tp->t_dev))
-#endif /* Note to format police: Don't merge the { below
- in to the line above! */
- {
- if ((*linesw[tp->t_line].l_modem)(tp, 0) == 0)
- {
- /* clear RTS and DTR, bitbucket output */
- ms->Command = (ms->Command & ~MSCCMD_CMask) | MSCCMD_Close;
- ms->Setup = TRUE;
- msc->flags &= ~(TIOCM_DTR | TIOCM_RTS);
- ms->OutFlush = TRUE;
- }
- }
- break;
-
- case MSCEVENT_Break:
-#if DEBUG_MSC
- printf("Break received on msc%d\n", slot);
+ if (MSCDIALIN(tp->t_dev))
#endif
- (*linesw[tp->t_line].l_rint)(TTY_FE, tp);
- break;
-
- default:
- printf("msc: unknown event type %d\n",
- ibuf[(bufpos-1)&0xff]);
-
- } /* event type switch */
- break;
-
- case MSCINCTL_CHAR:
- if (tp->t_state & TS_TBLOCK) {
- if (ms->chCD) {
- /* Carrier detect ON -> OFF */
+ {
+ if ((*linesw[tp->t_line].l_modem)(tp, 0) == 0) {
+ /* clear RTS and DTR, bitbucket output */
+ ms = &msc->board->Status[msc->port];
+ ms->Command = (ms->Command & ~MSCCMD_CMask) |
+ MSCCMD_Close;
+ ms->Setup = TRUE;
+ msc->flags &= ~(TIOCM_DTR | TIOCM_RTS);
+ ms->OutFlush = TRUE;
+ }
+ }
+ }
+ } else { /* CD is now ON */
#if DEBUG_CD
- printf("msc CD OFF blocked %d msc->flags %08lx\n",
- msc->port, msc->flags);
+ printf("msc%d: CD ON %d\n", unit, msc->port);
#endif
- msc->flags &= ~TIOCM_CD;
+ msc->flags |= TIOCM_CD;
+ if ((tp = msc_tty[MSCTTYSLOT(MSCSLOTUL(unit, i))]) &&
+ (tp->t_state & (TS_ISOPEN | TS_WOPEN))) {
+ if (MSCDIALIN(tp->t_dev))
+ (*linesw[tp->t_line].l_modem)(tp, 1);
+ } /* if tp valid and port open */
+ } /* CD on/off */
+ } /* if CD changed for this line */
+ ccd >>= 1; ncd >>= 1; /* bit for next line */
+ } /* for every line */
+ } /* while events in queue */
+ msc->board->Common.CDStatus = ocd; /* save new status */
+ msc->board->Common.CDTail = bufpos; /* remove events */
+ splx(s);
+ } /* if events in CD queue */
-#ifndef MSCCDHACK
- if (MSCDIALIN(tp->t_dev))
-#endif
- {
- if ((*linesw[tp->t_line].l_modem)(tp, 0) == 0) {
- /* Clear RTS and DTR, bitbucket output */
- ms->Command = (ms->Command & ~MSCCMD_CMask) |
- MSCCMD_Close;
- ms->Setup = TRUE;
- msc->flags &= ~(TIOCM_DTR | TIOCM_RTS);
- ms->OutFlush = TRUE;
- }
- }
- }
- goto NoRoomForYa;
- }
-#if DEBUG_MSC
- printf("'%c' ",ibuf[bufpos]);
-#endif
- (*linesw[tp->t_line].l_rint)((int)ibuf[bufpos++], tp);
- break;
+ for (slot = MSCSLOTUL(unit, 0); slot < maxslot; slot++) {
+ msc = &mscdev[slot];
- default:
- printf("msc: unknown data type %d\n", cbuf[bufpos]);
- bufpos++;
+ if (!msc->active)
+ continue;
- } /* switch on input data type */
+ tp = msc_tty[MSCTTYSLOT(slot)];
+ ms = &msc->board->Status[msc->port];
- } /* while there's something in the buffer */
-NoRoomForYa:
- ms->InTail = bufpos; /* tell 65C02 what we've read */
+ newhead = ms->InHead; /* 65c02 write pointer */
- } /* if there was something in the buffer */
+ /* yoohoo, is the port open? */
+ if (tp && (tp->t_state & (TS_ISOPEN|TS_WOPEN))) {
+ /* port is open, handle all type of events */
- /* we get here only when the port is open */
- /* send output */
- if (tp->t_state & (TS_BUSY|TS_FLUSH))
- {
-
- bufpos = ms->OutHead - ms->OutTail;
-
- /* busy and below low water mark? */
- if (tp->t_state & TS_BUSY)
- {
- if (bufpos < IOBUFLOWWATER)
- {
- tp->t_state &= ~TS_BUSY; /* not busy any more */
- if (tp->t_line)
- (*linesw[tp->t_line].l_start)(tp);
- else
- mscstart(tp);
- }
- }
+ /* set interrupt priority level */
+ s = spltty();
- /* waiting for flush and buffer empty? */
- if (tp->t_state & TS_FLUSH)
- {
- if (bufpos == 0)
- tp->t_state &= ~TS_FLUSH; /* finished flushing */
- }
- } /* BUSY or FLUSH */
+ /* check for input for this port */
+ if (newhead != (bufpos = ms->InTail)) {
+ /* buffer for input chars/events */
+ ibuf = &msc->board->InBuf[msc->port][0];
- splx(s);
+ /* data types of bytes in ibuf */
+ cbuf = &msc->board->InCtl[msc->port][0];
+
+ /* do for all chars, if room */
+ while (bufpos != newhead) {
+ /* which type of input data? */
+ switch (cbuf[bufpos]) {
+ /* input event (CD, BREAK, etc.) */
+ case MSCINCTL_EVENT:
+ switch (ibuf[bufpos++]) {
+ case MSCEVENT_Break:
+ (*linesw[tp->t_line].l_rint)(TTY_FE, tp);
+ break;
+
+ default:
+ printf("msc%d: unknown event type %d\n",
+ msc->unit, ibuf[(bufpos-1)&0xff]);
+ } /* event type switch */
+ break;
+
+ case MSCINCTL_CHAR:
+ if (tp->t_state & TS_TBLOCK) {
+ goto NoRoomForYa;
+ }
+ (*linesw[tp->t_line].l_rint)((int)ibuf[bufpos++], tp);
+ break;
- } else { /* End of port open */
- /* port is closed, don't pass on the chars from it */
+ default:
+ printf("msc%d: unknown data type %d\n",
+ msc->unit, cbuf[bufpos]);
+ bufpos++;
+ } /* switch on input data type */
+ } /* while there's something in the buffer */
+NoRoomForYa:
+ ms->InTail = bufpos; /* tell 65C02 what we've read */
+ } /* if there was something in the buffer */
- /* check for input for this port */
- if (newhead != (bufpos = ms->InTail))
- {
-#if DEBUG_MSC
- printf("icp%d\n",slot);
-#endif
- /* buffer for input chars/events */
- ibuf = &msc->board->InBuf[msc->port][0];
+ /* we get here only when the port is open */
+ /* send output */
+ if (tp->t_state & (TS_BUSY|TS_FLUSH)) {
- /* data types of bytes in ibuf */
- cbuf = &msc->board->InCtl[msc->port][0];
-
- /* do for all chars, if room */
- while (bufpos != newhead)
- {
- /* which type of input data? */
- switch (cbuf[bufpos])
- {
- /* input event (CD, BREAK, etc.) */
- case MSCINCTL_EVENT:
- switch (ibuf[bufpos++])
- {
- /* carrier detect change OFF -> ON */
- case MSCEVENT_CarrierOn:
-#if DEBUG_CD
- printf("msc CD ON %d (closed)\n", msc->port);
-#endif
- msc->flags |= TIOCM_CD;
- break;
-
- /* carrier detect change ON -> OFF */
- case MSCEVENT_CarrierOff:
-#if DEBUG_CD
- printf("msc CD OFF %d (closed)\n", msc->port);
-#endif
- msc->flags &= ~TIOCM_CD;
-#ifndef MSCCDHACK
- if (tp && MSCDIALIN(tp->t_dev))
-#else
- if (tp )
-#endif
- {
- if ((*linesw[tp->t_line].l_modem)(tp, 0) == 0)
- {
- /* clear RTS and DTR, bitbucket output */
- ms->Command = (ms->Command & ~MSCCMD_CMask) | MSCCMD_Close;
- ms->Setup = TRUE;
- msc->flags &= ~(TIOCM_DTR | TIOCM_RTS);
- ms->OutFlush = TRUE;
- }
- }
- break;
-
- default:
- printf("msc: unknown event type %d\n",
- ibuf[(bufpos-1)&0xff]);
+ bufpos = ms->OutHead - ms->OutTail;
- } /* event type switch */
- break;
+ /* busy and below low water mark? */
+ if (tp->t_state & TS_BUSY) {
+ if (bufpos < IOBUFLOWWATER) {
+ tp->t_state &= ~TS_BUSY; /* not busy any more */
+ if (tp->t_line)
+ (*linesw[tp->t_line].l_start)(tp);
+ else
+ mscstart(tp);
+ }
+ }
- default:
- bufpos++;
+ /* waiting for flush and buffer empty? */
+ if (tp->t_state & TS_FLUSH) {
+ if (bufpos == 0)
+ tp->t_state &= ~TS_FLUSH; /* finished flushing */
+ }
+ } /* BUSY or FLUSH */
- } /* switch on input data type */
+ splx(s);
- } /* while there's something in the buffer */
+ } else { /* End of port open */
+ /* port is closed, don't pass on the chars from it */
- ms->InTail = bufpos; /* tell 65C02 what we've read */
+ /* check for input for this port */
+ if (newhead != (bufpos = ms->InTail)) {
+ /* buffer for input chars/events */
+ ibuf = &msc->board->InBuf[msc->port][0];
- } /* if there was something in the buffer */
- } /* End of port open/close */
-
- /* is this port closing? */
- if (msc->closing)
- {
- /* if DTR is off, just bitbucket remaining characters */
- if ( (msc->flags & TIOCM_DTR) == 0)
- {
- ms->OutFlush = TRUE;
- msc->closing = FALSE;
+ /* data types of bytes in ibuf */
+ cbuf = &msc->board->InCtl[msc->port][0];
+
+ /* do for all chars, if room */
+ while (bufpos != newhead) {
+ /* which type of input data? */
+ switch (cbuf[bufpos]) {
+ /* input event (BREAK, etc.) */
+ case MSCINCTL_EVENT:
+ switch (ibuf[bufpos++]) {
+ default:
+ printf("msc: unknown event type %d\n",
+ ibuf[(bufpos-1)&0xff]);
+ } /* event type switch */
+ break;
+
+ default:
+ bufpos++;
+ } /* switch on input data type */
+ } /* while there's something in the buffer */
+
+ ms->InTail = bufpos; /* tell 65C02 what we've read */
+ } /* if there was something in the buffer */
+ } /* End of port open/close */
+
+ /* is this port closing? */
+ if (msc->closing) {
+ /* if DTR is off, just bitbucket remaining characters */
+ if ( (msc->flags & TIOCM_DTR) == 0) {
+ ms->OutFlush = TRUE;
+ msc->closing = FALSE;
+ }
+ /* if output has drained, drop DTR */
+ else if (ms->OutHead == ms->OutTail) {
+ (void) mscmctl(tp->t_dev, 0, DMSET);
+ msc->closing = FALSE;
+ }
}
- /* if output has drained, drop DTR */
- else if (ms->OutHead == ms->OutTail)
- {
- (void) mscmctl(tp->t_dev, 0, DMSET);
- msc->closing = FALSE;
- }
- }
- } /* For all ports */
-
+ } /* For all ports */
}
int
@@ -825,170 +734,157 @@ mscioctl(dev, cmd, data, flag, p)
int flag;
struct proc *p;
{
- register struct tty *tp;
- register int slot;
- register int error;
- struct mscdevice *msc;
- volatile struct mscstatus *ms;
- int s;
+ register struct tty *tp;
+ register int slot;
+ register int error;
+ struct mscdevice *msc;
+ volatile struct mscstatus *ms;
+ int s;
- /* get the device structure */
- slot = MSCSLOT(dev);
+ /* get the device structure */
+ slot = MSCSLOT(dev);
- if (slot >= MSCSLOTS)
- return ENXIO;
+ if (slot >= MSCSLOTS)
+ return ENXIO;
- msc = &mscdev[slot];
+ msc = &mscdev[slot];
- if (!msc->active)
- return ENXIO;
+ if (!msc->active)
+ return ENXIO;
- ms = &msc->board->Status[msc->port];
- if (!(tp = msc_tty[MSCTTY(dev)]))
- return ENXIO;
+ ms = &msc->board->Status[msc->port];
+ if (!(tp = msc_tty[MSCTTY(dev)]))
+ return ENXIO;
- error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
+ error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p);
- if (error >= 0)
- return (error);
+ if (error >= 0)
+ return (error);
- error = ttioctl(tp, cmd, data, flag, p);
+ error = ttioctl(tp, cmd, data, flag, p);
- if (error >= 0)
- return (error);
+ if (error >= 0)
+ return (error);
- switch (cmd) {
-
- /* send break */
- case TIOCSBRK:
- s = spltty();
- ms->Command = (ms->Command & (~MSCCMD_RTSMask)) | MSCCMD_Break;
- ms->Setup = TRUE;
- splx(s);
- break;
-
- /* clear break */
- case TIOCCBRK:
- s = spltty();
- ms->Command = (ms->Command & (~MSCCMD_RTSMask)) | MSCCMD_RTSOn;
- ms->Setup = TRUE;
- splx(s);
- break;
-
- case TIOCSDTR:
- (void) mscmctl(dev, TIOCM_DTR | TIOCM_RTS, DMBIS);
- break;
-
- case TIOCCDTR:
- if (!MSCDIALIN(dev)) /* don't let dialins drop DTR */
- (void) mscmctl(dev, TIOCM_DTR | TIOCM_RTS, DMBIC);
- break;
+ switch (cmd) {
+
+ /* send break */
+ case TIOCSBRK:
+ s = spltty();
+ ms->Command = (ms->Command & (~MSCCMD_RTSMask)) | MSCCMD_Break;
+ ms->Setup = TRUE;
+ splx(s);
+ break;
+
+ /* clear break */
+ case TIOCCBRK:
+ s = spltty();
+ ms->Command = (ms->Command & (~MSCCMD_RTSMask)) | MSCCMD_RTSOn;
+ ms->Setup = TRUE;
+ splx(s);
+ break;
+
+ case TIOCSDTR:
+ (void) mscmctl(dev, TIOCM_DTR | TIOCM_RTS, DMBIS);
+ break;
- case TIOCMSET:
- (void) mscmctl(dev, *(int *)data, DMSET);
- break;
+ case TIOCCDTR:
+ if (!MSCDIALIN(dev)) /* don't let dialins drop DTR */
+ (void) mscmctl(dev, TIOCM_DTR | TIOCM_RTS, DMBIC);
+ break;
- case TIOCMBIS:
- (void) mscmctl(dev, *(int *)data, DMBIS);
- break;
+ case TIOCMSET:
+ (void) mscmctl(dev, *(int *)data, DMSET);
+ break;
- case TIOCMBIC:
- if (MSCDIALIN(dev)) /* don't let dialins drop DTR */
- (void) mscmctl(dev, *(int *)data & TIOCM_DTR, DMBIC);
- else
- (void) mscmctl(dev, *(int *)data, DMBIC);
- break;
+ case TIOCMBIS:
+ (void) mscmctl(dev, *(int *)data, DMBIS);
+ break;
- case TIOCMGET:
- *(int *)data = mscmctl(dev, 0, DMGET);
- break;
+ case TIOCMBIC:
+ if (MSCDIALIN(dev)) /* don't let dialins drop DTR */
+ (void) mscmctl(dev, *(int *)data & TIOCM_DTR, DMBIC);
+ else
+ (void) mscmctl(dev, *(int *)data, DMBIC);
+ break;
- case TIOCGFLAGS:
- *(int *)data = SWFLAGS(dev);
- break;
-
- case TIOCSFLAGS:
- error = suser(p->p_ucred, &p->p_acflag);
- if (error != 0)
- return(EPERM);
+ case TIOCMGET:
+ *(int *)data = mscmctl(dev, 0, DMGET);
+ break;
- msc->openflags = *(int *)data;
-
- /* only allow valid flags */
- msc->openflags &= (TIOCFLAG_SOFTCAR | TIOCFLAG_CLOCAL | TIOCFLAG_CRTSCTS);
+ case TIOCGFLAGS:
+ *(int *)data = SWFLAGS(dev);
+ break;
- break;
+ case TIOCSFLAGS:
+ error = suser(p->p_ucred, &p->p_acflag);
+ if (error != 0)
+ return(EPERM);
+ msc->openflags = *(int *)data;
+ /* only allow valid flags */
+ msc->openflags &=
+ (TIOCFLAG_SOFTCAR | TIOCFLAG_CLOCAL | TIOCFLAG_CRTSCTS);
+ break;
- default:
- return (ENOTTY);
- }
+ default:
+ return (ENOTTY);
+ }
- return (0);
+ return (0);
}
-
int
mscparam(tp, t)
register struct tty *tp;
register struct termios *t;
{
- register int cflag = t->c_cflag;
- int slot;
- struct mscdevice *msc;
- volatile struct mscstatus *ms;
- int s;
- int ospeed = ttspeedtab(t->c_ospeed, mscspeedtab);
+ register int cflag = t->c_cflag;
+ struct mscdevice *msc;
+ volatile struct mscstatus *ms;
+ int s, slot;
+ int ospeed = ttspeedtab(t->c_ospeed, mscspeedtab);
- /* get the device structure */
- slot = MSCSLOT(tp->t_dev);
+ /* get the device structure */
+ slot = MSCSLOT(tp->t_dev);
- if (slot >= MSCSLOTS)
- return ENXIO;
+ if (slot >= MSCSLOTS)
+ return ENXIO;
- msc = &mscdev[slot];
-
- if (!msc->active)
- return ENXIO;
-
- ms = &msc->board->Status[msc->port];
-
-#if DEBUG_MSC
- bugi(msc, "param1");
-#endif
- /* check requested parameters */
- if (ospeed < 0 || (t->c_ispeed && t->c_ispeed != t->c_ospeed))
- return (EINVAL);
-
- /* and copy to tty */
- tp->t_ispeed = t->c_ispeed;
- tp->t_ospeed = t->c_ospeed;
- tp->t_cflag = cflag;
-
- /* hang up if baud is zero */
- if (t->c_ospeed == 0) {
+ msc = &mscdev[slot];
- if (!MSCDIALIN(tp->t_dev)) /* don't let dialins drop DTR */
- (void) mscmctl(tp->t_dev, 0, DMSET);
- }
- else {
+ if (!msc->active)
+ return ENXIO;
- /* set the baud rate */
- s = spltty();
- ms->Param = (ms->Param & ~MSCPARAM_BaudMask) | ospeed | MSCPARAM_RcvBaud;
+ ms = &msc->board->Status[msc->port];
- /* make sure any previous hangup is undone, ie. reenable DTR.
- * also mscmctl will cause the speed to be set
- */
- (void) mscmctl (tp->t_dev, TIOCM_DTR | TIOCM_RTS, DMSET);
+ /* check requested parameters */
+ if (ospeed < 0 || (t->c_ispeed && t->c_ispeed != t->c_ospeed))
+ return (EINVAL);
- splx(s);
- }
+ /* and copy to tty */
+ tp->t_ispeed = t->c_ispeed;
+ tp->t_ospeed = t->c_ospeed;
+ tp->t_cflag = cflag;
-#if DEBUG_MSC
- bugi(msc, "param2");
-#endif
- return (0);
-
+ /* hang up if baud is zero */
+ if (t->c_ospeed == 0) {
+ if (!MSCDIALIN(tp->t_dev)) /* don't let dialins drop DTR */
+ (void) mscmctl(tp->t_dev, 0, DMSET);
+ } else {
+ /* set the baud rate */
+ s = spltty();
+ ms->Param = (ms->Param & ~MSCPARAM_BaudMask) | ospeed | MSCPARAM_RcvBaud;
+
+ /*
+ * Make sure any previous hangup is undone, ie. reenable DTR.
+ * also mscmctl will cause the speed to be set
+ */
+ (void) mscmctl (tp->t_dev, TIOCM_DTR | TIOCM_RTS, DMSET);
+
+ splx(s);
+ }
+
+ return(0);
}
@@ -1005,149 +901,133 @@ mschwiflow(tp, flag)
/* Rob's version */
#if 1
-#if DEBUG_MSC
- printf("mschwiflow %d\n", flag);
-#endif
-
if (flag)
- mscmctl( tp->t_dev, TIOCM_RTS, DMBIC); /* Clear/Lower RTS */
+ mscmctl( tp->t_dev, TIOCM_RTS, DMBIC); /* Clear/Lower RTS */
else
- mscmctl( tp->t_dev, TIOCM_RTS, DMBIS); /* Set/Raise RTS */
-
-#endif
+ mscmctl( tp->t_dev, TIOCM_RTS, DMBIS); /* Set/Raise RTS */
-/* Jukka's version */
-#if 0
- int slot;
- struct mscdevice *msc;
- volatile struct mscstatus *ms;
- int s;
-
- /* get the device structure */
- slot = MSCSLOT(tp->t_dev);
- if (slot >= MSCSLOTS)
- return ENXIO;
- msc = &mscdev[slot];
- if (!msc->active)
- return ENXIO;
- ms = &msc->board->Status[msc->port];
-
-#if DEBUG_MSC
- bugi(msc, "hwiflow");
-#endif
- /* Well, we should really _do_ something here, but the 65c02 code
- * manages the RTS signal on its own now, so... This will probably
- * change in the future.
- */
+#else /* Jukka's version */
+
+ int s, slot;
+ struct mscdevice *msc;
+ volatile struct mscstatus *ms;
+ /* get the device structure */
+ slot = MSCSLOT(tp->t_dev);
+ if (slot >= MSCSLOTS)
+ return ENXIO;
+ msc = &mscdev[slot];
+ if (!msc->active)
+ return ENXIO;
+ ms = &msc->board->Status[msc->port];
+
+ /* Well, we should really _do_ something here, but the 65c02 code
+ * manages the RTS signal on its own now, so... This will probably
+ * change in the future.
+ */
#endif
return 1;
-
}
void
mscstart(tp)
register struct tty *tp;
{
- register int cc;
- register char *cp;
- register int mhead;
- int s;
- int slot;
- struct mscdevice *msc;
- volatile struct mscstatus *ms;
- volatile char *mob;
- int hiwat = 0;
- int maxout;
-
- if (! (tp->t_state & TS_ISOPEN))
- return;
-
- slot = MSCSLOT(tp->t_dev);
+ register int cc;
+ register char *cp;
+ register int mhead;
+ int s, slot;
+ struct mscdevice *msc;
+ volatile struct mscstatus *ms;
+ volatile char *mob;
+ int hiwat = 0;
+ int maxout;
+
+ if (! (tp->t_state & TS_ISOPEN))
+ return;
+
+ slot = MSCSLOT(tp->t_dev);
#if 0
- printf("starting msc%d\n", slot);
+ printf("starting msc%d\n", slot);
#endif
- s = spltty();
-
- /* don't start if explicitly stopped */
- if (tp->t_state & (TS_TIMEOUT|TS_TTSTOP))
- goto out;
+ s = spltty();
- /* wake up if below low water */
- cc = tp->t_outq.c_cc;
+ /* don't start if explicitly stopped */
+ if (tp->t_state & (TS_TIMEOUT|TS_TTSTOP))
+ goto out;
- if (cc <= tp->t_lowat) {
- if (tp->t_state & TS_ASLEEP) {
+ /* wake up if below low water */
+ cc = tp->t_outq.c_cc;
- tp->t_state &= ~TS_ASLEEP;
- wakeup((caddr_t)&tp->t_outq);
+ if (cc <= tp->t_lowat) {
+ if (tp->t_state & TS_ASLEEP) {
+ tp->t_state &= ~TS_ASLEEP;
+ wakeup((caddr_t)&tp->t_outq);
+ }
+ selwakeup(&tp->t_wsel);
}
- selwakeup(&tp->t_wsel);
- }
-
- /* don't bother if no characters or busy */
- if (cc == 0 || (tp->t_state & TS_BUSY))
- goto out;
+ /* don't bother if no characters or busy */
+ if (cc == 0 || (tp->t_state & TS_BUSY))
+ goto out;
- /*
- * Limit the amount of output we do in one burst
- */
- msc = &mscdev[slot];
- ms = &msc->board->Status[msc->port];
- mhead = ms->OutHead;
- maxout = mhead - ms->OutTail;
+ /*
+ * Limit the amount of output we do in one burst
+ */
+ msc = &mscdev[slot];
+ ms = &msc->board->Status[msc->port];
+ mhead = ms->OutHead;
+ maxout = mhead - ms->OutTail;
- if (maxout < 0)
- maxout += IOBUFLEN;
+ if (maxout < 0)
+ maxout += IOBUFLEN;
- maxout = IOBUFLEN - 1 - maxout;
+ maxout = IOBUFLEN - 1 - maxout;
- if (cc >= maxout) {
- hiwat++;
- cc = maxout;
- }
+ if (cc >= maxout) {
+ hiwat++;
+ cc = maxout;
+ }
- cc = q_to_b (&tp->t_outq, msc->tmpbuf, cc);
+ cc = q_to_b (&tp->t_outq, msc->tmpbuf, cc);
- if (cc > 0) {
- tp->t_state |= TS_BUSY;
+ if (cc > 0) {
+ tp->t_state |= TS_BUSY;
- mob = &msc->board->OutBuf[msc->port][0];
- cp = &msc->tmpbuf[0];
+ mob = &msc->board->OutBuf[msc->port][0];
+ cp = &msc->tmpbuf[0];
- /* enable output */
- ms->OutDisable = FALSE;
+ /* enable output */
+ ms->OutDisable = FALSE;
#if 0
- msc->tmpbuf[cc] = 0;
- printf("sending '%s'\n", msctmpbuf);
+ msc->tmpbuf[cc] = 0;
+ printf("sending '%s'\n", msctmpbuf);
#endif
- /* send the first char across to reduce latency */
- mob[mhead++] = *cp++;
- mhead &= IOBUFLENMASK;
- ms->OutHead = mhead;
- cc--;
-
- /* copy the rest of the chars across quickly */
- while (cc > 0) {
- mob[mhead++] = *cp++;
- mhead &= IOBUFLENMASK;
- cc--;
- }
- ms->OutHead = mhead;
-
- /* leave the device busy if we've filled the buffer */
- if (!hiwat)
- tp->t_state &= ~TS_BUSY;
- }
+ /* send the first char across to reduce latency */
+ mob[mhead++] = *cp++;
+ mhead &= IOBUFLENMASK;
+ ms->OutHead = mhead;
+ cc--;
+
+ /* copy the rest of the chars across quickly */
+ while (cc > 0) {
+ mob[mhead++] = *cp++;
+ mhead &= IOBUFLENMASK;
+ cc--;
+ }
+ ms->OutHead = mhead;
+
+ /* leave the device busy if we've filled the buffer */
+ if (!hiwat)
+ tp->t_state &= ~TS_BUSY;
+ }
out:
- splx(s);
-
+ splx(s);
}
/* XXX */
@@ -1190,81 +1070,68 @@ mscmctl(dev, bits, how)
dev_t dev;
int bits, how;
{
- struct mscdevice *msc;
- volatile struct mscstatus *ms;
- int slot;
- int s;
- u_char newcmd;
- int OldFlags;
-
- /* get the device structure */
- slot = MSCSLOT(dev);
+ struct mscdevice *msc;
+ volatile struct mscstatus *ms;
+ int slot;
+ int s;
+ u_char newcmd;
+ int OldFlags;
- if (slot >= MSCSLOTS)
- return ENXIO;
+ /* get the device structure */
+ slot = MSCSLOT(dev);
- msc = &mscdev[slot];
+ if (slot >= MSCSLOTS)
+ return ENXIO;
- if (!msc->active)
- return ENXIO;
+ msc = &mscdev[slot];
-#if DEBUG_MSC
- bugi(msc, "mctl1");
-#endif
+ if (!msc->active)
+ return ENXIO;
- s = spltty(); /* Jukka wants spl6() here, WHY?!! RFH */
+ s = spltty();
- if (how != DMGET) {
- OldFlags = msc->flags;
- bits &= TIOCM_DTR | TIOCM_RTS; /* can only modify DTR and RTS */
+ if (how != DMGET) {
+ OldFlags = msc->flags;
+ bits &= TIOCM_DTR | TIOCM_RTS; /* can only modify DTR and RTS */
- switch (how) {
- case DMSET:
- msc->flags = (bits | (msc->flags & ~(TIOCM_DTR | TIOCM_RTS)));
- break;
+ switch (how) {
+ case DMSET:
+ msc->flags = (bits | (msc->flags & ~(TIOCM_DTR | TIOCM_RTS)));
+ break;
- case DMBIC:
- msc->flags &= ~bits;
- break;
+ case DMBIC:
+ msc->flags &= ~bits;
+ break;
- case DMBIS:
- msc->flags |= bits;
- break;
- }
-
-#if DEBUG_MSC
- bugi(msc, "mctl2");
-#endif
+ case DMBIS:
+ msc->flags |= bits;
+ break;
+ }
- /* modify modem control state */
- ms = &msc->board->Status[msc->port];
+ /* modify modem control state */
+ ms = &msc->board->Status[msc->port];
- if (msc->flags & TIOCM_RTS) /* was bits & */
- newcmd = MSCCMD_RTSOn;
- else /* this doesn't actually work now */
- newcmd = MSCCMD_RTSOff;
+ if (msc->flags & TIOCM_RTS) /* was bits & */
+ newcmd = MSCCMD_RTSOn;
+ else /* this doesn't actually work now */
+ newcmd = MSCCMD_RTSOff;
- if (msc->flags & TIOCM_DTR) /* was bits & */
- newcmd |= MSCCMD_Enable;
+ if (msc->flags & TIOCM_DTR) /* was bits & */
+ newcmd |= MSCCMD_Enable;
- ms->Command = (ms->Command & (~MSCCMD_RTSMask & ~MSCCMD_Enable)) | newcmd;
- ms->Setup = TRUE;
+ ms->Command = (ms->Command & (~MSCCMD_RTSMask & ~MSCCMD_Enable)) | newcmd;
+ ms->Setup = TRUE;
- /* if we've dropped DTR, bitbucket any pending output */
- if ( (OldFlags & TIOCM_DTR) && ((bits & TIOCM_DTR) == 0))
- ms->OutFlush = TRUE;
- }
+ /* if we've dropped DTR, bitbucket any pending output */
+ if ( (OldFlags & TIOCM_DTR) && ((bits & TIOCM_DTR) == 0))
+ ms->OutFlush = TRUE;
+ }
- bits = msc->flags;
+ bits = msc->flags;
- (void) splx(s);
+ (void) splx(s);
-#if DEBUG_MSC
- bugi(msc, "mctl3");
-#endif
-
- return(bits);
-
+ return(bits);
}
struct tty *
@@ -1283,42 +1150,36 @@ int
mscinitcard(zap)
struct zbus_args *zap;
{
- int bcount;
- short start;
- u_char *from;
- volatile u_char *to;
- volatile struct mscmemory *mlm;
-
- mlm = (volatile struct mscmemory *)zap->va;
- (void)mlm->Enable6502Reset;
-
- /* copy the code across to the board */
- to = (u_char *)mlm;
- from = msc6502code; bcount = sizeof(msc6502code) - 2;
- start = *(short *)from; from += sizeof(start);
- to += start;
-
-#if DEBUG_MSC
- printf("\n** copying %ld bytes from %08lx to %08lx (start=%04lx)\n",
- (unsigned long)bcount, (unsigned long)from, to, start);
- printf("First byte to copy is %02lx\n", *from);
-#endif
+ int bcount;
+ short start;
+ u_char *from;
+ volatile u_char *to;
+ volatile struct mscmemory *mlm;
+
+ mlm = (volatile struct mscmemory *)zap->va;
+ (void)mlm->Enable6502Reset;
- while(bcount--) *to++ = *from++;
+ /* copy the code across to the board */
+ to = (u_char *)mlm;
+ from = msc6502code; bcount = sizeof(msc6502code) - 2;
+ start = *(short *)from; from += sizeof(start);
+ to += start;
- mlm->Common.Crystal = MSC_UNKNOWN; /* use automatic speed check */
+ while(bcount--) *to++ = *from++;
- /* start 6502 running */
- (void)mlm->ResetBoard;
+ mlm->Common.Crystal = MSC_UNKNOWN; /* use automatic speed check */
- /* wait until speed detector has finished */
- for (bcount = 0; bcount < 200; bcount++) {
- delay(10000);
- if (mlm->Common.Crystal) break;
- }
+ /* start 6502 running */
+ (void)mlm->ResetBoard;
- return(0);
+ /* wait until speed detector has finished */
+ for (bcount = 0; bcount < 200; bcount++) {
+ delay(10000);
+ if (mlm->Common.Crystal)
+ break;
+ }
+ return(0);
}
#endif /* NMSC > 0 */
diff --git a/sys/arch/amiga/dev/msc6502.h b/sys/arch/amiga/dev/msc6502.h
index dff1daadfc4..ab01ad87773 100644
--- a/sys/arch/amiga/dev/msc6502.h
+++ b/sys/arch/amiga/dev/msc6502.h
@@ -1,7 +1,8 @@
-/* $NetBSD: msc6502.h,v 1.2 1995/10/07 18:18:32 chopps Exp $ */
+/* $OpenBSD: msc6502.h,v 1.2 1997/01/16 09:25:06 niklas Exp $ */
+/* $NetBSD: msc6502.h,v 1.3 1996/12/09 17:24:57 is Exp $ */
/*
- * Copyright (c) 1995 Jukka Marin <jmarin@teeri.jmp.fi>.
+ * Copyright (c) 1995 Jukka Marin <jmarin@jmp.fi>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,209 +32,209 @@
*/
static unsigned char msc6502code[] = {
0x38, 0x00, 0xA2, 0xFF, 0x9A, 0xD8, 0xA2, 0x00,
- 0xA9, 0x00, 0xA0, 0x70, 0x95, 0x00, 0xE8, 0x88,
- 0xD0, 0xFA, 0xA9, 0xFF, 0x85, 0x0D, 0x85, 0x1D,
- 0x85, 0x2D, 0x85, 0x3D, 0x85, 0x4D, 0x85, 0x5D,
- 0x85, 0x6D, 0x64, 0x74, 0x64, 0x76, 0xA9, 0x00,
- 0x85, 0x71, 0xA9, 0xAA, 0xC9, 0x64, 0x90, 0x02,
- 0xE6, 0x71, 0xA5, 0x70, 0xF0, 0x03, 0x4C, 0x9E,
- 0x38, 0xA9, 0x98, 0x8D, 0x06, 0x44, 0xA9, 0x0B,
- 0x8D, 0x04, 0x44, 0xAD, 0x02, 0x44, 0xA9, 0x80,
- 0x8D, 0x1A, 0x7C, 0xA9, 0xFF, 0x8D, 0x08, 0x7C,
- 0x8D, 0x0A, 0x7C, 0xA2, 0x00, 0x8E, 0x00, 0x44,
- 0xEA, 0xEA, 0xAD, 0x02, 0x44, 0xEA, 0xEA, 0x8E,
- 0x00, 0x44, 0xAD, 0x02, 0x44, 0x29, 0x10, 0xF0,
- 0xF9, 0xA9, 0x11, 0x8E, 0x00, 0x44, 0x8D, 0x1C,
- 0x7C, 0xAD, 0x02, 0x44, 0x29, 0x10, 0xF0, 0xF9,
- 0x8E, 0x1C, 0x7C, 0xAD, 0x08, 0x7C, 0x85, 0x73,
- 0xAD, 0x0A, 0x7C, 0x85, 0x72, 0xC9, 0xD0, 0x90,
- 0x05, 0xA9, 0x02, 0x4C, 0x8E, 0x38, 0xA9, 0x01,
- 0x85, 0x70, 0xA9, 0x00, 0x8D, 0x02, 0x44, 0x8D,
- 0x06, 0x44, 0x8D, 0x04, 0x44, 0x4C, 0x9E, 0x38,
- 0xAD, 0x00, 0x7C, 0xC5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*
* Copyright (c) 1993 Zik.
@@ -46,8 +47,8 @@
* - Change to NetBSD style for integration in to the main tree. 950919
*/
-#define NUMLINES 7 /* number of lines per card */
-#define IOBUFLEN 256 /* number of bytes per buffer */
+#define NUMLINES 7 /* number of lines per card */
+#define IOBUFLEN 256 /* number of bytes per buffer */
#define IOBUFLENMASK 0xff /* mask for maximum number of bytes */
#define IOBUFHIGHWATER 192 /* point at which to enable output */
#define IOBUFLOWWATER 128 /* point at which to wake output */
@@ -64,13 +65,15 @@ struct msccommon {
u_char Pad_a;
u_char TimerH; /* timer value after speed check */
u_char TimerL;
+ u_char CDHead; /* head pointer for CD message queue */
+ u_char CDTail; /* tail pointer for CD message queue */
+ u_char CDStatus;
+ u_char Pad_b;
};
struct mscstatus {
u_char InHead; /* input queue head */
u_char InTail; /* input queue tail */
- u_char Pad_a; /* paddington */
- u_char Pad_b; /* paddington */
u_char OutDisable; /* disables output */
u_char OutHead; /* output queue head */
u_char OutTail; /* output queue tail */
@@ -81,22 +84,22 @@ struct mscstatus {
u_char Command; /* command byte - see MSCCMD */
u_char SoftFlow; /* enables xon/xoff flow control */
/* private 65C02 fields: */
- u_char chCD; /* used to detect CD changes */
u_char XonOff; /* stores XON/XOFF enable/disable */
- u_char Pad_c; /* paddington */
};
-#define MSC_MEMPAD \
+#define MSC_MEMPAD1 \
(0x0200 - NUMLINES * sizeof(struct mscstatus) - sizeof(struct msccommon))
+#define MSC_MEMPAD2 (0x2000 - NUMLINES * IOBUFLEN - IOBUFLEN)
struct mscmemory {
struct mscstatus Status[NUMLINES]; /* 0x0000-0x006f status areas */
- struct msccommon Common; /* 0x0070-0x0073 common flags */
- u_char Dummy1[MSC_MEMPAD]; /* 0x00XX-0x01ff */
+ struct msccommon Common; /* 0x0070-0x0077 common flags */
+ u_char Dummy1[MSC_MEMPAD1]; /* 0x00XX-0x01ff */
u_char OutBuf[NUMLINES][IOBUFLEN]; /* 0x0200-0x08ff output bufs */
u_char InBuf[NUMLINES][IOBUFLEN]; /* 0x0900-0x0fff input bufs */
u_char InCtl[NUMLINES][IOBUFLEN]; /* 0x1000-0x16ff control data */
- u_char Dummy2[ 0x2000 - 7 * 0x0100]; /* 0x1700-0x2fff */
+ u_char CDBuf[IOBUFLEN]; /* 0x1700-0x17ff CD event buffer */
+ u_char Dummy2[MSC_MEMPAD2]; /* 0x1800-0x2fff */
u_char Code[0x1000]; /* 0x3000-0x3fff code area */
u_short InterruptAck; /* 0x4000 intr ack */
u_char Dummy3[0x3ffe]; /* 0x4002-0x7fff */
@@ -107,16 +110,17 @@ struct mscmemory {
/* 6502 RESET line held high */
};
-#undef MSC_MEMPAD
+#undef MSC_MEMPAD1
+#undef MSC_MEMPAD2
struct mscdevice {
volatile struct mscmemory *board; /* where the board is located */
int flags; /* modem control flags */
int openflags; /* flags for device open */
+ u_char unit; /* which unit (ie. which board) */
u_char port; /* which port on the board (0-6) */
u_char active; /* does this port have hardware? */
u_char closing; /* are we flushing before close? */
- u_char paddington; /* just for padding */
char tmpbuf[IOBUFLEN]; /* temp buffer for data transfers */
};
diff --git a/sys/arch/amiga/dev/otgsc.c b/sys/arch/amiga/dev/otgsc.c
index a1aeeb7e5e0..0e57650941a 100644
--- a/sys/arch/amiga/dev/otgsc.c
+++ b/sys/arch/amiga/dev/otgsc.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: otgsc.c,v 1.4 1996/11/23 21:45:22 kstailey Exp $ */
-/* $NetBSD: otgsc.c,v 1.11 1996/04/21 21:12:16 veego Exp $ */
+/* $OpenBSD: otgsc.c,v 1.5 1997/01/16 09:25:08 niklas Exp $ */
+/* $NetBSD: otgsc.c,v 1.17 1996/12/23 09:10:27 veego Exp $ */
/*
* Copyright (c) 1994 Michael L. Hitch
diff --git a/sys/arch/amiga/dev/par.c b/sys/arch/amiga/dev/par.c
index 6ae89c2e069..69fdf80870f 100644
--- a/sys/arch/amiga/dev/par.c
+++ b/sys/arch/amiga/dev/par.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: par.c,v 1.3 1996/05/02 06:44:24 niklas Exp $ */
-/* $NetBSD: par.c,v 1.13 1996/04/21 21:12:18 veego Exp $ */
+/* $OpenBSD: par.c,v 1.4 1997/01/16 09:25:09 niklas Exp $ */
+/* $NetBSD: par.c,v 1.16 1996/12/23 09:10:28 veego Exp $ */
/*
* Copyright (c) 1982, 1990 The Regents of the University of California.
diff --git a/sys/arch/amiga/dev/parioctl.h b/sys/arch/amiga/dev/parioctl.h
index f9250f40f3c..49f799e62bf 100644
--- a/sys/arch/amiga/dev/parioctl.h
+++ b/sys/arch/amiga/dev/parioctl.h
@@ -1,3 +1,4 @@
+/* $OpenBSD: parioctl.h,v 1.2 1997/01/16 09:25:11 niklas Exp $ */
/* $NetBSD: parioctl.h,v 1.5 1994/10/26 02:32:00 cgd Exp $ */
/*
diff --git a/sys/arch/amiga/dev/rtmondefs.c b/sys/arch/amiga/dev/rtmondefs.c
index 18bf42a3eca..a3cac40cd10 100644
--- a/sys/arch/amiga/dev/rtmondefs.c
+++ b/sys/arch/amiga/dev/rtmondefs.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: rtmondefs.c,v 1.2 1997/01/16 09:25:12 niklas Exp $ */
/* $NetBSD: rtmondefs.c,v 1.2 1994/10/26 02:04:33 cgd Exp $ */
static struct MonDef monitor_defs[] = {
diff --git a/sys/arch/amiga/dev/rtmons b/sys/arch/amiga/dev/rtmons
index 22811edaeb0..ab4b80a6d77 100644
--- a/sys/arch/amiga/dev/rtmons
+++ b/sys/arch/amiga/dev/rtmons
@@ -1,3 +1,4 @@
+; $OpenBSD: rtmons,v 1.2 1997/01/16 09:25:13 niklas Exp $
; $NetBSD: rtmons,v 1.2 1994/10/26 02:04:36 cgd Exp $
; 640 × 200, 4 Bit, 31609 Hz, 75 Hz d
diff --git a/sys/arch/amiga/dev/sbic.c b/sys/arch/amiga/dev/sbic.c
index cf83fabaecb..eaba55a78c6 100644
--- a/sys/arch/amiga/dev/sbic.c
+++ b/sys/arch/amiga/dev/sbic.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: sbic.c,v 1.7 1996/05/29 10:15:38 niklas Exp $ */
-/* $NetBSD: sbic.c,v 1.25 1996/05/12 02:26:10 mhitch Exp $ */
+/* $OpenBSD: sbic.c,v 1.8 1997/01/16 09:25:16 niklas Exp $ */
+/* $NetBSD: sbic.c,v 1.28 1996/10/13 03:07:29 christos Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
@@ -1791,7 +1791,7 @@ sbicgo(dev, xs)
/*
* push the data cache ( I think this won't work (EH))
*/
-#if defined(M68040)
+#if defined(M68040) || defined(M68060)
if (mmutype == MMU_68040 && usedma && count) {
dma_cachectl(addr, count);
if (((u_int)addr & 0xF) || (((u_int)addr + count) & 0xF))
@@ -2279,10 +2279,11 @@ sbicnextstate(dev, csr, asr)
/*
* check for overlapping cache line, flush if so
*/
-#ifdef M68040
+#if defined(M68040) || defined(M68060)
if (dev->sc_flags & SBICF_DCFLUSH) {
#if 0
- printf("sbic: 68040 DMA cache flush needs fixing? %x:%x\n",
+ printf("sbic: 68040/68060 DMA cache flush needs "
+ "fixing? %x:%x\n",
dev->sc_xs->data, dev->sc_xs->datalen);
#endif
}
@@ -2558,10 +2559,12 @@ sbicnextstate(dev, csr, asr)
/*
* check for overlapping cache line, flush if so
*/
-#ifdef M68040
+#if defined(M68040) || defined(M68060)
+
if (dev->sc_flags & SBICF_DCFLUSH) {
#if 0
- printf("sibc: 68040 DMA cache flush needs fixing? %x:%x\n",
+ printf("sbic: 68040/060 DMA cache flush needs "
+ "fixing? %x:%x\n",
dev->sc_xs->data, dev->sc_xs->datalen);
#endif
}
diff --git a/sys/arch/amiga/dev/sbicreg.h b/sys/arch/amiga/dev/sbicreg.h
index 088d3e3177a..a7b08a4dfcb 100644
--- a/sys/arch/amiga/dev/sbicreg.h
+++ b/sys/arch/amiga/dev/sbicreg.h
@@ -1,3 +1,4 @@
+/* $OpenBSD: sbicreg.h,v 1.3 1997/01/16 09:25:17 niklas Exp $ */
/* $NetBSD: sbicreg.h,v 1.2 1994/10/26 02:04:40 cgd Exp $ */
/*
diff --git a/sys/arch/amiga/dev/sci.c b/sys/arch/amiga/dev/sci.c
index ea12bc58ce2..f49bce1aeb3 100644
--- a/sys/arch/amiga/dev/sci.c
+++ b/sys/arch/amiga/dev/sci.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: sci.c,v 1.4 1996/05/29 10:15:40 niklas Exp $ */
-/* $NetBSD: sci.c,v 1.17 1996/05/12 02:26:19 mhitch Exp $ */
+/* $OpenBSD: sci.c,v 1.5 1997/01/16 09:25:19 niklas Exp $ */
+/* $NetBSD: sci.c,v 1.19 1996/10/13 03:07:31 christos Exp $ */
/*
* Copyright (c) 1994 Michael L. Hitch
diff --git a/sys/arch/amiga/dev/scireg.h b/sys/arch/amiga/dev/scireg.h
index b86f5a611cc..8be3d9c0cd2 100644
--- a/sys/arch/amiga/dev/scireg.h
+++ b/sys/arch/amiga/dev/scireg.h
@@ -1,3 +1,4 @@
+/* $OpenBSD: scireg.h,v 1.2 1997/01/16 09:25:20 niklas Exp $ */
/* $NetBSD: scireg.h,v 1.3 1994/10/26 02:04:46 cgd Exp $ */
/*
diff --git a/sys/arch/amiga/dev/scsidefs.h b/sys/arch/amiga/dev/scsidefs.h
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/sys/arch/amiga/dev/scsidefs.h
+++ /dev/null
diff --git a/sys/arch/amiga/dev/ser.c b/sys/arch/amiga/dev/ser.c
index 1d40b2cb402..8561cf2f0c2 100644
--- a/sys/arch/amiga/dev/ser.c
+++ b/sys/arch/amiga/dev/ser.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: ser.c,v 1.5 1996/08/23 18:53:17 niklas Exp $ */
-/* $NetBSD: ser.c,v 1.34.4.1 1996/06/06 04:53:19 mhitch Exp $ */
+/* $OpenBSD: ser.c,v 1.6 1997/01/16 09:25:22 niklas Exp $ */
+/* $NetBSD: ser.c,v 1.39 1996/12/23 09:10:29 veego Exp $ */
/*
* Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
@@ -354,12 +354,16 @@ serclose(dev, flag, mode, p)
if (dev != kgdb_dev)
#endif
custom.intena = INTF_RBF | INTF_TBE; /* disable interrups */
- custom.intreq = INTF_RBF | INTF_TBE; /* clear int request */
+ custom.intreq = INTF_RBF | INTF_TBE; /* clear intr req */
- if ((tp->t_cflag & HUPCL) &&
- !(SWFLAGS(dev) & TIOCFLAG_SOFTCAR))
- /* XXX perhaps only clear DTR */
- (void) sermctl(dev, 0, DMSET);
+ /*
+ * If the device is closed, it's close, no matter whether we deal with
+ * modem control signals nor not.
+ */
+#if 0
+ if (tp->t_cflag & HUPCL || tp->t_state & TS_WOPEN ||
+ (tp->t_state & TS_ISOPEN) == 0)
+#endif
ttyclose(tp);
#if not_yet
if (tp != &ser_cons) {
diff --git a/sys/arch/amiga/dev/serreg.h b/sys/arch/amiga/dev/serreg.h
index a53d30a2d1e..879bf7d284b 100644
--- a/sys/arch/amiga/dev/serreg.h
+++ b/sys/arch/amiga/dev/serreg.h
@@ -1,3 +1,4 @@
+/* $OpenBSD: serreg.h,v 1.2 1997/01/16 09:25:23 niklas Exp $ */
/* $NetBSD: serreg.h,v 1.7 1994/10/26 02:04:54 cgd Exp $ */
/*
diff --git a/sys/arch/amiga/dev/sfas.c b/sys/arch/amiga/dev/sfas.c
index 644171be546..1a2fba01ad2 100644
--- a/sys/arch/amiga/dev/sfas.c
+++ b/sys/arch/amiga/dev/sfas.c
@@ -1,6 +1,5 @@
-/* $OpenBSD: sfas.c,v 1.5 1996/05/02 06:44:31 niklas Exp $ */
-
-/* $NetBSD: sfas.c,v 1.9 1996/04/23 22:53:23 veego Exp $ */
+/* $OpenBSD: sfas.c,v 1.6 1997/01/16 09:25:25 niklas Exp $ */
+/* $NetBSD: sfas.c,v 1.12 1996/10/13 03:07:33 christos Exp $ */
/*
* Copyright (c) 1995 Daniel Widenfalk
@@ -369,7 +368,7 @@ sfas_scsicmd(struct scsi_xfer *xs)
* 2) Out data source/destination is not in the u-stack area.
*/
if (!(flags & SCSI_POLL) && (
-#ifdef M68040
+#if defined(M68040) || defined(M68060)
((mmutype == MMU_68040) && ((vm_offset_t)xs->data >= 0xFFFC0000)) &&
#endif
((vm_offset_t)xs->data >= 0xFF000000))) {
diff --git a/sys/arch/amiga/dev/siop.c b/sys/arch/amiga/dev/siop.c
index 127d1fc25d1..f63d723afac 100644
--- a/sys/arch/amiga/dev/siop.c
+++ b/sys/arch/amiga/dev/siop.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: siop.c,v 1.8 1996/05/29 10:15:43 niklas Exp $ */
-/* $NetBSD: siop.c,v 1.33 1996/05/12 02:26:26 mhitch Exp $ */
+/* $OpenBSD: siop.c,v 1.9 1997/01/16 09:25:26 niklas Exp $ */
+/* $NetBSD: siop.c,v 1.35 1996/10/13 03:07:34 christos Exp $ */
/*
* Copyright (c) 1994 Michael L. Hitch
diff --git a/sys/arch/amiga/dev/siop_script.ss b/sys/arch/amiga/dev/siop_script.ss
index f43c74bfe10..3a37fc80a38 100644
--- a/sys/arch/amiga/dev/siop_script.ss
+++ b/sys/arch/amiga/dev/siop_script.ss
@@ -1,3 +1,4 @@
+; $OpenBSD: siop_script.ss,v 1.2 1997/01/16 09:25:29 niklas Exp $
; $NetBSD: siop_script.ss,v 1.3 1995/08/18 15:28:11 chopps Exp $
;
diff --git a/sys/arch/amiga/dev/view.c b/sys/arch/amiga/dev/view.c
index f6a00f1e9be..83cba6231c5 100644
--- a/sys/arch/amiga/dev/view.c
+++ b/sys/arch/amiga/dev/view.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: view.c,v 1.2 1996/05/02 06:44:36 niklas Exp $ */
-/* $NetBSD: view.c,v 1.13 1996/04/21 21:12:39 veego Exp $ */
+/* $OpenBSD: view.c,v 1.3 1997/01/16 09:25:30 niklas Exp $ */
+/* $NetBSD: view.c,v 1.16 1996/10/13 03:07:35 christos Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
diff --git a/sys/arch/amiga/dev/viewvar.h b/sys/arch/amiga/dev/viewvar.h
index b3e4f4cd015..fd8844e2cd9 100644
--- a/sys/arch/amiga/dev/viewvar.h
+++ b/sys/arch/amiga/dev/viewvar.h
@@ -1,3 +1,4 @@
+/* $OpenBSD: viewvar.h,v 1.2 1997/01/16 09:25:30 niklas Exp $ */
/* $NetBSD: viewvar.h,v 1.3 1994/10/26 02:05:08 cgd Exp $ */
/*
diff --git a/sys/arch/amiga/dev/vuid_event.h b/sys/arch/amiga/dev/vuid_event.h
index d98e2c0b380..1b07a1901c7 100644
--- a/sys/arch/amiga/dev/vuid_event.h
+++ b/sys/arch/amiga/dev/vuid_event.h
@@ -1,3 +1,4 @@
+/* $OpenBSD: vuid_event.h,v 1.2 1997/01/16 09:25:32 niklas Exp $ */
/* $NetBSD: vuid_event.h,v 1.2 1994/10/26 02:05:10 cgd Exp $ */
/*
diff --git a/sys/arch/amiga/dev/wesc.c b/sys/arch/amiga/dev/wesc.c
index be70b880250..17927617b61 100644
--- a/sys/arch/amiga/dev/wesc.c
+++ b/sys/arch/amiga/dev/wesc.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: wesc.c,v 1.5 1996/11/23 21:45:23 kstailey Exp $ */
-/* $NetBSD: wesc.c,v 1.13 1996/04/21 21:12:42 veego Exp $ */
+/* $OpenBSD: wesc.c,v 1.6 1997/01/16 09:25:33 niklas Exp $ */
+/* $NetBSD: wesc.c,v 1.19 1996/12/23 09:10:30 veego Exp $ */
/*
* Copyright (c) 1994 Michael L. Hitch
diff --git a/sys/arch/amiga/dev/wstsc.c b/sys/arch/amiga/dev/wstsc.c
index 7ca477742a1..410eb048bf8 100644
--- a/sys/arch/amiga/dev/wstsc.c
+++ b/sys/arch/amiga/dev/wstsc.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: wstsc.c,v 1.4 1996/11/23 21:45:23 kstailey Exp $ */
-/* $NetBSD: wstsc.c,v 1.12 1996/04/28 06:49:35 mhitch Exp $ */
+/* $OpenBSD: wstsc.c,v 1.5 1997/01/16 09:25:34 niklas Exp $ */
+/* $NetBSD: wstsc.c,v 1.18 1996/12/23 09:10:31 veego Exp $ */
/*
* Copyright (c) 1994 Michael L. Hitch
diff --git a/sys/arch/amiga/dev/zbus.c b/sys/arch/amiga/dev/zbus.c
index ab07e788297..588b1511050 100644
--- a/sys/arch/amiga/dev/zbus.c
+++ b/sys/arch/amiga/dev/zbus.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: zbus.c,v 1.7 1996/11/23 21:45:24 kstailey Exp $ */
-/* $NetBSD: zbus.c,v 1.19 1996/05/19 21:06:09 veego Exp $ */
+/* $OpenBSD: zbus.c,v 1.8 1997/01/16 09:25:35 niklas Exp $ */
+/* $NetBSD: zbus.c,v 1.31 1997/01/06 18:05:15 is Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
@@ -57,19 +57,22 @@ struct preconfdata {
*/
static struct aconfdata aconftab[] = {
/* Commodore Amiga */
- { "atfsc", 514, 84 },
{ "atzee", 513, 1 },
+ { "atzsc", 514, 2 },
{ "atzsc", 514, 3 },
{ "bah", 514, 9 }, /* A2060 */
- { "le", 514, 112 },
{ "ql", 514, 69 },
{ "ql", 514, 70 },
+ { "atfsc", 514, 84 },
+ { "le", 514, 112 },
/* Ameristar */
{ "le", 1053, 1 },
{ "bah", 1053, 9 }, /* A2060 */
{ "es", 1053, 10 },
/* University of Lowell */
{ "grful", 1030, 0 },
+ /* DMI */
+ { "grfrs", 2129, 1 }, /* Resolver graphics board */
/* Macrosystems */
{ "grfrt", 18260, 6 },
{ "grfrh", 18260, 16}, /* Retina BLT Z3 */
@@ -101,10 +104,11 @@ static struct aconfdata aconftab[] = {
/* Hydra */
{ "ed", 2121, 1 },
/* ASDG */
- { "ed", 9999, 9 }, /* XXXX */
+ { "ed", 1023, 254 },
/* Village Tronic Ariadne */
{ "ae", 2167, 201},
/* bsc/Alf Data */
+ { "Tandem", 2092, 6 }, /* Tandem AT disk controler */
{ "mfc", 2092, 16 },
{ "mfc", 2092, 17 },
{ "mfc", 2092, 18 },
@@ -122,21 +126,30 @@ static struct aconfdata aconftab[] = {
/* phase 5 digital products */
{ "flmem", 8512, 10}, /* FastlaneZ3 memory */
{ "flsc", 8512, 11}, /* FastlaneZ3 */
+ { "cbsc", 8512, 12}, /* Cyberstorm Mk I SCSI */
+ { "bzivsc", 8512, 17}, /* Blizzard IV SCSI */
+ { "bztzsc", 8512, 24}, /* Blizzard 2060 SCSI */
+ { "cbiisc", 8512, 25}, /* Cyberstorm Mk II SCSI */
{ "grfcv", 8512, 34}, /* CyberVison 64 */
- /* Commodore Amiga */
- { "afsc", 514, 84}, /* A4091 SCSI HD Controller */
/* Hacker Inc. */
{ "mlhsc", 2011, 1 },
/* Resource Management Force */
{ "qn", 2011, 2 }, /* QuickNet Ethernet */
/* ??? */
{ "empsc", 2171, 21 }, /* Emplant SCSI */
+ { "empsc", 2171, 32 }, /* Emplant SCSI */
/* Tseng ET4000 boards */
{ "grfet", 2181, 0 }, /* oMniBus */
{ "grfet", 2167, 1 }, /* Domnio mem */
{ "grfet", 2167, 2 }, /* Domino regs */
{ "grfet", 2117, 3 }, /* Merlin mem */
- { "grfet", 2117, 4 } /* Merlin regs */
+ { "grfet", 2117, 4 }, /* Merlin regs */
+ /* Advanced Systems */
+ { "nxsc", 2102, 1 }, /* Nexus SCSI board */
+ /* Masoboshi */
+ { "mcsc", 8535, 4 }, /* Masoboshi Mastercard 702 */
+ /* Apollo */
+ { "apssc", 8738, 35 } /* Apollo '060 scsi */
};
static int naconfent = sizeof(aconftab) / sizeof(struct aconfdata);
diff --git a/sys/arch/amiga/dev/zbusvar.h b/sys/arch/amiga/dev/zbusvar.h
index 6c17a0e054e..bc799bdbe63 100644
--- a/sys/arch/amiga/dev/zbusvar.h
+++ b/sys/arch/amiga/dev/zbusvar.h
@@ -1,3 +1,4 @@
+/* $OpenBSD: zbusvar.h,v 1.2 1997/01/16 09:25:36 niklas Exp $ */
/* $NetBSD: zbusvar.h,v 1.1 1994/12/28 09:26:09 chopps Exp $ */
/*
diff --git a/sys/arch/amiga/dev/zssc.c b/sys/arch/amiga/dev/zssc.c
index 0184d806b85..ffd2eefcbe1 100644
--- a/sys/arch/amiga/dev/zssc.c
+++ b/sys/arch/amiga/dev/zssc.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: zssc.c,v 1.8 1996/11/23 21:45:25 kstailey Exp $ */
-/* $NetBSD: zssc.c,v 1.16 1996/04/21 21:12:45 veego Exp $ */
+/* $OpenBSD: zssc.c,v 1.9 1997/01/16 09:25:37 niklas Exp $ */
+/* $NetBSD: zssc.c,v 1.22 1996/12/23 09:10:33 veego Exp $ */
/*
* Copyright (c) 1994 Michael L. Hitch