From caed2aba48f4ffb18e3f5e1e5a6144cbef023fa8 Mon Sep 17 00:00:00 2001 From: niklas Date: Thu, 16 Jan 1997 09:23:08 +0000 Subject: [PATCH] Sync to NetBSD 970110 --- sys/arch/amiga/Makefile | 7 +- sys/arch/amiga/amiga/Locore.c | 7 +- sys/arch/amiga/amiga/amiga_init.c | 44 +- sys/arch/amiga/amiga/autoconf.c | 26 +- sys/arch/amiga/amiga/conf.c | 28 +- sys/arch/amiga/amiga/db_memrw.c | 45 +- sys/arch/amiga/amiga/device.h | 4 +- sys/arch/amiga/amiga/disksubr.c | 4 +- sys/arch/amiga/amiga/drcustom.h | 6 +- sys/arch/amiga/amiga/genassym.c | 10 +- sys/arch/amiga/amiga/locore.s | 166 +- sys/arch/amiga/amiga/machdep.c | 151 +- sys/arch/amiga/amiga/pmap.c | 134 +- sys/arch/amiga/amiga/swapgeneric.c | 4 +- sys/arch/amiga/amiga/sys_machdep.c | 4 +- sys/arch/amiga/amiga/trap.c | 6 +- sys/arch/amiga/conf/A3000 | 109 -- sys/arch/amiga/conf/COFFEE | 224 --- sys/arch/amiga/conf/CRASH | 3 +- sys/arch/amiga/conf/DRACO | 15 +- sys/arch/amiga/conf/FILIPPA | 6 +- sys/arch/amiga/conf/GENERIC | 15 +- sys/arch/amiga/conf/Makefile.amiga | 63 +- sys/arch/amiga/conf/files.amiga | 16 +- sys/arch/amiga/conf/std.amiga | 7 +- sys/arch/amiga/conf/std.draco | 9 +- sys/arch/amiga/dev/afsc.c | 4 +- sys/arch/amiga/dev/ahsc.c | 4 +- sys/arch/amiga/dev/ahscreg.h | 1 + sys/arch/amiga/dev/atzsc.c | 4 +- sys/arch/amiga/dev/atzscreg.h | 1 + sys/arch/amiga/dev/bzsc.c | 25 +- sys/arch/amiga/dev/bztzsc.c | 429 +++++ sys/arch/amiga/dev/bztzscreg.h | 55 + sys/arch/amiga/dev/bztzscvar.h | 50 + sys/arch/amiga/dev/clock.c | 316 ++-- sys/arch/amiga/dev/clockioctl.h | 1 + sys/arch/amiga/dev/dmavar.h | 1 + sys/arch/amiga/dev/drcom.c | 1285 ++++++++++++++ sys/arch/amiga/dev/drcomvar.h | 40 + sys/arch/amiga/dev/drisavar.h | 23 + sys/arch/amiga/dev/drsc.c | 8 +- sys/arch/amiga/dev/empsc.c | 4 +- sys/arch/amiga/dev/event.c | 3 +- sys/arch/amiga/dev/event_var.h | 3 +- sys/arch/amiga/dev/fd.c | 4 +- sys/arch/amiga/dev/flsc.c | 4 +- sys/arch/amiga/dev/genpar.c | 1 + sys/arch/amiga/dev/grf.c | 4 +- sys/arch/amiga/dev/grf_cc.c | 4 +- sys/arch/amiga/dev/grf_cl.c | 14 +- sys/arch/amiga/dev/grf_clreg.h | 4 +- sys/arch/amiga/dev/grf_cv.c | 35 +- sys/arch/amiga/dev/grf_et.c | 381 +++-- sys/arch/amiga/dev/grf_etreg.h | 165 +- sys/arch/amiga/dev/grf_rh.c | 77 +- sys/arch/amiga/dev/grf_rt.c | 6 +- sys/arch/amiga/dev/grf_ul.c | 11 +- sys/arch/amiga/dev/grf_ulreg.h | 8 +- sys/arch/amiga/dev/grf_ultms.g | 8 +- sys/arch/amiga/dev/grfabs_cc.c | 4 +- sys/arch/amiga/dev/grfabs_ccreg.h | 1 + sys/arch/amiga/dev/grfioctl.h | 3 +- sys/arch/amiga/dev/gtsc.c | 4 +- sys/arch/amiga/dev/gtscreg.h | 1 + sys/arch/amiga/dev/gvpbus.c | 4 +- sys/arch/amiga/dev/gvpbusvar.h | 1 + sys/arch/amiga/dev/idesc.c | 4 +- sys/arch/amiga/dev/if_ae.c | 47 +- sys/arch/amiga/dev/if_aereg.h | 1 + sys/arch/amiga/dev/if_bah.c | 112 +- sys/arch/amiga/dev/if_bahreg.h | 1 + sys/arch/amiga/dev/if_ed.c | 27 +- sys/arch/amiga/dev/if_edreg.h | 1 + sys/arch/amiga/dev/if_es.c | 26 +- sys/arch/amiga/dev/if_esreg.h | 1 + sys/arch/amiga/dev/if_le.c | 4 +- sys/arch/amiga/dev/if_le_zbus.c | 4 +- sys/arch/amiga/dev/if_qn.c | 77 +- sys/arch/amiga/dev/if_qnreg.h | 3 +- sys/arch/amiga/dev/ite.c | 10 +- sys/arch/amiga/dev/ite_et.c | 3 +- sys/arch/amiga/dev/ite_ul.c | 6 +- sys/arch/amiga/dev/iteioctl.h | 1 + sys/arch/amiga/dev/ivsc.c | 4 +- sys/arch/amiga/dev/kbd.c | 8 +- sys/arch/amiga/dev/kbdreg.h | 1 + sys/arch/amiga/dev/kf_8x11.c | 1 + sys/arch/amiga/dev/kf_8x8.c | 1 + sys/arch/amiga/dev/mfc.c | 4 +- sys/arch/amiga/dev/mlhsc.c | 4 +- sys/arch/amiga/dev/ms.c | 4 +- sys/arch/amiga/dev/msc.c | 1501 ++++++++--------- sys/arch/amiga/dev/msc6502.h | 407 ++--- sys/arch/amiga/dev/mscreg.h | 30 +- sys/arch/amiga/dev/otgsc.c | 4 +- sys/arch/amiga/dev/par.c | 4 +- sys/arch/amiga/dev/parioctl.h | 1 + sys/arch/amiga/dev/rtmondefs.c | 1 + sys/arch/amiga/dev/rtmons | 1 + sys/arch/amiga/dev/sbic.c | 17 +- sys/arch/amiga/dev/sbicreg.h | 1 + sys/arch/amiga/dev/sci.c | 4 +- sys/arch/amiga/dev/scireg.h | 1 + sys/arch/amiga/dev/scsidefs.h | 0 sys/arch/amiga/dev/ser.c | 18 +- sys/arch/amiga/dev/serreg.h | 1 + sys/arch/amiga/dev/sfas.c | 7 +- sys/arch/amiga/dev/siop.c | 4 +- sys/arch/amiga/dev/siop_script.ss | 1 + sys/arch/amiga/dev/view.c | 4 +- sys/arch/amiga/dev/viewvar.h | 1 + sys/arch/amiga/dev/vuid_event.h | 1 + sys/arch/amiga/dev/wesc.c | 4 +- sys/arch/amiga/dev/wstsc.c | 4 +- sys/arch/amiga/dev/zbus.c | 29 +- sys/arch/amiga/dev/zbusvar.h | 1 + sys/arch/amiga/dev/zssc.c | 4 +- sys/arch/amiga/include/ansi.h | 1 + sys/arch/amiga/include/asm.h | 1 + sys/arch/amiga/include/cdefs.h | 1 + sys/arch/amiga/include/conf.h | 6 +- sys/arch/amiga/include/cpu.h | 89 +- sys/arch/amiga/include/cpufunc.h | 1 + sys/arch/amiga/include/db_machdep.h | 1 + sys/arch/amiga/include/exec.h | 1 + sys/arch/amiga/include/fbio.h | 1 + sys/arch/amiga/include/float.h | 1 + sys/arch/amiga/include/frame.h | 1 + sys/arch/amiga/include/ieeefp.h | 1 + sys/arch/amiga/include/kcore.h | 1 + sys/arch/amiga/include/limits.h | 1 + sys/arch/amiga/include/mtpr.h | 1 + sys/arch/amiga/include/param.h | 4 +- sys/arch/amiga/include/pcb.h | 1 + sys/arch/amiga/include/pmap.h | 1 + sys/arch/amiga/include/proc.h | 1 + sys/arch/amiga/include/profile.h | 1 + sys/arch/amiga/include/psl.h | 25 +- sys/arch/amiga/include/pte.h | 1 + sys/arch/amiga/include/ptrace.h | 1 + sys/arch/amiga/include/reg.h | 1 + sys/arch/amiga/include/setjmp.h | 1 + sys/arch/amiga/include/signal.h | 1 + sys/arch/amiga/include/stdarg.h | 1 + sys/arch/amiga/include/trap.h | 1 + sys/arch/amiga/include/types.h | 3 +- sys/arch/amiga/include/varargs.h | 1 + sys/arch/amiga/stand/Makefile | 6 +- sys/arch/amiga/stand/binpatch/Makefile | 4 +- sys/arch/amiga/stand/boot/Makefile | 102 ++ sys/arch/amiga/stand/boot/Makefile.txlt | 12 + sys/arch/amiga/stand/boot/alloc.s | 60 + sys/arch/amiga/stand/boot/amigagraph.h | 80 + sys/arch/amiga/stand/boot/amigaio.h | 79 + sys/arch/amiga/stand/boot/amigatypes.h | 84 + sys/arch/amiga/stand/boot/aout2bb/Makefile | 14 + sys/arch/amiga/stand/boot/aout2bb/aout2bb.c | 340 ++++ sys/arch/amiga/stand/boot/aout2bb/aout2bb.h | 71 + sys/arch/amiga/stand/boot/aout2bb/chksum.c | 85 + sys/arch/amiga/stand/boot/aout2bb/chksum.h | 39 + sys/arch/amiga/stand/boot/ashrdi3.s | 50 + sys/arch/amiga/stand/boot/bbstart.s | 185 ++ sys/arch/amiga/stand/boot/bcopy.s | 64 + sys/arch/amiga/stand/boot/bzero.c | 50 + .../gen_cvtab.c => stand/boot/configure.c} | 49 +- sys/arch/amiga/stand/boot/console.c | 185 ++ sys/arch/amiga/stand/boot/installboot.8 | 122 ++ sys/arch/amiga/stand/boot/installboot.sh | 28 + sys/arch/amiga/stand/boot/libsa/Makefile | 46 + sys/arch/amiga/stand/boot/libsa/Makefile.inc | 24 + sys/arch/amiga/stand/boot/libstubs.h | 94 ++ sys/arch/amiga/stand/boot/libstubs.s | 269 +++ sys/arch/amiga/stand/boot/main.c | 566 +++++++ sys/arch/amiga/stand/boot/muldi3.s | 63 + sys/arch/amiga/stand/boot/printf.s | 76 + sys/arch/amiga/stand/boot/samachdep.h | 51 + sys/arch/amiga/stand/boot/startit.s | 235 +++ sys/arch/amiga/stand/boot/test.s | 7 + sys/arch/amiga/stand/boot/twiddle.c | 52 + sys/arch/amiga/stand/boot/txlt/Makefile | 10 + sys/arch/amiga/stand/boot/txlt/txlt.l | 19 + sys/arch/amiga/stand/boot/xd.c | 157 ++ sys/arch/amiga/stand/boot/xd.h | 48 + sys/arch/amiga/stand/dumpfont/dumpfont.c | 1 + sys/arch/amiga/stand/dumpfont/fontdumper.c | 1 + sys/arch/amiga/stand/loadbsd/Makefile | 13 + sys/arch/amiga/stand/loadbsd/README | 22 + sys/arch/amiga/stand/loadbsd/loadbsd.c | 6 +- sys/arch/amiga/stand/loadkmap/Makefile | 4 +- sys/arch/amiga/stand/loadkmap/Makefile.inc | 23 +- .../amiga/stand/loadkmap/din/din-kbdmap.c | 4 +- sys/arch/amiga/stand/loadkmap/sw/Makefile | 5 +- sys/arch/amiga/stand/loadkmap/sw/sw-kbdmap.c | 4 +- sys/arch/amiga/stand/loadkmap/us/Makefile | 5 +- sys/arch/amiga/stand/loadkmap/us/us-kbdmap.c | 4 +- 196 files changed, 7674 insertions(+), 2516 deletions(-) delete mode 100644 sys/arch/amiga/conf/A3000 delete mode 100644 sys/arch/amiga/conf/COFFEE create mode 100644 sys/arch/amiga/dev/bztzsc.c create mode 100644 sys/arch/amiga/dev/bztzscreg.h create mode 100644 sys/arch/amiga/dev/bztzscvar.h create mode 100644 sys/arch/amiga/dev/drcom.c create mode 100644 sys/arch/amiga/dev/drcomvar.h create mode 100644 sys/arch/amiga/dev/drisavar.h delete mode 100644 sys/arch/amiga/dev/scsidefs.h create mode 100644 sys/arch/amiga/stand/boot/Makefile create mode 100644 sys/arch/amiga/stand/boot/Makefile.txlt create mode 100644 sys/arch/amiga/stand/boot/alloc.s create mode 100644 sys/arch/amiga/stand/boot/amigagraph.h create mode 100644 sys/arch/amiga/stand/boot/amigaio.h create mode 100644 sys/arch/amiga/stand/boot/amigatypes.h create mode 100644 sys/arch/amiga/stand/boot/aout2bb/Makefile create mode 100644 sys/arch/amiga/stand/boot/aout2bb/aout2bb.c create mode 100644 sys/arch/amiga/stand/boot/aout2bb/aout2bb.h create mode 100644 sys/arch/amiga/stand/boot/aout2bb/chksum.c create mode 100644 sys/arch/amiga/stand/boot/aout2bb/chksum.h create mode 100644 sys/arch/amiga/stand/boot/ashrdi3.s create mode 100644 sys/arch/amiga/stand/boot/bbstart.s create mode 100644 sys/arch/amiga/stand/boot/bcopy.s create mode 100644 sys/arch/amiga/stand/boot/bzero.c rename sys/arch/amiga/{dev/gen_cvtab.c => stand/boot/configure.c} (64%) create mode 100644 sys/arch/amiga/stand/boot/console.c create mode 100644 sys/arch/amiga/stand/boot/installboot.8 create mode 100644 sys/arch/amiga/stand/boot/installboot.sh create mode 100644 sys/arch/amiga/stand/boot/libsa/Makefile create mode 100644 sys/arch/amiga/stand/boot/libsa/Makefile.inc create mode 100644 sys/arch/amiga/stand/boot/libstubs.h create mode 100644 sys/arch/amiga/stand/boot/libstubs.s create mode 100644 sys/arch/amiga/stand/boot/main.c create mode 100644 sys/arch/amiga/stand/boot/muldi3.s create mode 100644 sys/arch/amiga/stand/boot/printf.s create mode 100644 sys/arch/amiga/stand/boot/samachdep.h create mode 100644 sys/arch/amiga/stand/boot/startit.s create mode 100644 sys/arch/amiga/stand/boot/test.s create mode 100644 sys/arch/amiga/stand/boot/twiddle.c create mode 100644 sys/arch/amiga/stand/boot/txlt/Makefile create mode 100644 sys/arch/amiga/stand/boot/txlt/txlt.l create mode 100644 sys/arch/amiga/stand/boot/xd.c create mode 100644 sys/arch/amiga/stand/boot/xd.h create mode 100644 sys/arch/amiga/stand/loadbsd/Makefile create mode 100644 sys/arch/amiga/stand/loadbsd/README diff --git a/sys/arch/amiga/Makefile b/sys/arch/amiga/Makefile index d494906d86c..7f713b4e241 100644 --- a/sys/arch/amiga/Makefile +++ b/sys/arch/amiga/Makefile @@ -1,5 +1,5 @@ -# $OpenBSD: Makefile,v 1.2 1996/08/23 19:05:29 niklas Exp $ -# $NetBSD: Makefile,v 1.10.6.1 1996/06/09 20:48:33 is Exp $ +# $OpenBSD: Makefile,v 1.3 1997/01/16 09:23:08 niklas Exp $ +# $NetBSD: Makefile,v 1.11 1997/01/06 12:33:09 is Exp $ # @(#)Makefile 7.3 (Berkeley) 6/9/91 @@ -14,9 +14,6 @@ COMM= $S/vm/*.[ch] $S/ufs/*.[ch] $S/sys/*.h $S/compat/sunos/*.[ch] \ SUBDIR=stand -#all: -# @echo "make tags or links only" - TAMIGA= $S/arch/amiga/tags SAMIGA= $S/arch/m68k/m68k/*.c $S/arch/m68k/include/*.h \ $S/arch/amiga/amiga/*.[ch] $S/arch/amiga/include/*.h \ diff --git a/sys/arch/amiga/amiga/Locore.c b/sys/arch/amiga/amiga/Locore.c index b1b0fdf7b68..cde2bb1ee44 100644 --- a/sys/arch/amiga/amiga/Locore.c +++ b/sys/arch/amiga/amiga/Locore.c @@ -1,5 +1,5 @@ -/* $OpenBSD: Locore.c,v 1.3 1996/11/23 23:19:26 kstailey Exp $ */ -/* $NetBSD: Locore.c,v 1.11 1995/08/13 00:05:05 mycroft Exp $ */ +/* $OpenBSD: Locore.c,v 1.4 1997/01/16 09:23:12 niklas Exp $ */ +/* $NetBSD: Locore.c,v 1.15 1996/11/06 20:19:21 cgd Exp $ */ /* * Copyright (c) 1982, 1986, 1990 The Regents of the University of California. @@ -336,9 +336,6 @@ scanc(size, cp, table, mask) /*ARGSUSED*/ skpc(mask, size, cp) int mask; int size; char *cp; { return (0); } -/*ARGSUSED*/ -locc(mask, size, cp) int mask; char *cp; unsigned size; { return (0); } - /*ARGSUSED*/ ffs(v) long v; { return (0); } diff --git a/sys/arch/amiga/amiga/amiga_init.c b/sys/arch/amiga/amiga/amiga_init.c index 61420e13cf4..033a6613137 100644 --- a/sys/arch/amiga/amiga/amiga_init.c +++ b/sys/arch/amiga/amiga/amiga_init.c @@ -1,5 +1,5 @@ -/* $OpenBSD: amiga_init.c,v 1.13 1996/10/04 23:34:35 niklas Exp $ */ -/* $NetBSD: amiga_init.c,v 1.41.4.4 1996/08/03 00:56:12 jtc Exp $ */ +/* $OpenBSD: amiga_init.c,v 1.14 1997/01/16 09:23:14 niklas Exp $ */ +/* $NetBSD: amiga_init.c,v 1.53 1996/11/30 01:20:14 is Exp $ */ /* * Copyright (c) 1994 Michael L. Hitch @@ -924,14 +924,21 @@ start_c(id, fphystart, fphysize, cphysize, esym_addr, flags, inh_sync) *draco_intpen = 0; *draco_intfrc = 0; ciaa.icr = 0x7f; /* and keyboard */ -#if 0 ciab.icr = 0x7f; /* and again */ -#endif - *(volatile u_int8_t *)(DRCCADDR + + + draco_ioct->io_control &= + ~(DRCNTRL_KBDINTENA|DRCNTRL_FDCINTENA); /* and another */ + + draco_ioct->io_status2 &= + ~(DRSTAT2_PARIRQENA|DRSTAT2_TMRINTENA); /* some more */ + + *(volatile u_int8_t *)(DRCCADDR + 1 + DRSUPIOPG*NBPG + 4*(0x3F8 + 1)) = 0; /* and com0 */ - *(volatile u_int8_t *)(DRCCADDR + + + *(volatile u_int8_t *)(DRCCADDR + 1 + DRSUPIOPG*NBPG + 4*(0x2F8 + 1)) = 0; /* and com1 */ + draco_ioct->io_control |= DRCNTRL_WDOGDIS; /* stop Fido */ *draco_misc &= ~1/*DRMISC_FASTZ2*/; } else @@ -965,6 +972,7 @@ void start_c_cleanup() { u_int *sg, *esg; + extern u_int32_t delaydivisor; /* * remove shadow mapping of kernel? @@ -975,6 +983,22 @@ start_c_cleanup() esg = (u_int *)&sg[namigashdwpg]; while (sg < esg) *sg++ = PG_NV; + + /* + * preliminary delay divisor value + */ + + if (machineid & AMIGA_68060) + delaydivisor = (1024 * 1) / 80; /* 80 MHz 68060 w. BTC */ + + else if (machineid & AMIGA_68040) + delaydivisor = (1024 * 3) / 40; /* 40 MHz 68040 */ + + else if (machineid & AMIGA_68030) + delaydivisor = (1024 * 3) / 50; /* 50 MHz 68030 */ + + else + delaydivisor = (1024 * 8) / 33; /* 33 MHz 68020 */ } void @@ -1057,12 +1081,12 @@ kernel_reload_write(uio) /* * Pull in the exec header and check it. */ - if ((error = uiomove((caddr_t)&kernel_exec, sizeof(kernel_exec), - uio)) != 0) + if ((error = uiomove((caddr_t)&kernel_exec, + sizeof(kernel_exec), uio)) != 0) return(error); printf("loading kernel %ld+%ld+%ld+%ld\n", kernel_exec.a_text, - kernel_exec.a_data, kernel_exec.a_bss, - esym == NULL ? 0 : kernel_exec.a_syms); + kernel_exec.a_data, kernel_exec.a_bss, + esym == NULL ? 0 : kernel_exec.a_syms); /* * Looks good - allocate memory for a kernel image. */ diff --git a/sys/arch/amiga/amiga/autoconf.c b/sys/arch/amiga/amiga/autoconf.c index 612d31a63ab..13b6488dbb7 100644 --- a/sys/arch/amiga/amiga/autoconf.c +++ b/sys/arch/amiga/amiga/autoconf.c @@ -1,5 +1,5 @@ -/* $OpenBSD: autoconf.c,v 1.8 1997/01/04 12:40:31 niklas Exp $ */ -/* $NetBSD: autoconf.c,v 1.38.4.1 1996/05/26 16:23:26 is Exp $ */ +/* $OpenBSD: autoconf.c,v 1.9 1997/01/16 09:23:15 niklas Exp $ */ +/* $NetBSD: autoconf.c,v 1.45 1996/12/23 09:15:39 veego Exp $ */ /* * Copyright (c) 1994 Christian E. Hopps @@ -55,6 +55,8 @@ int cold; /* 1 if still booting */ void configure() { + int s; + /* * this is the real thing baby (i.e. not console init) */ @@ -65,10 +67,11 @@ configure() } else #endif custom.intena = INTF_INTEN; + s = splhigh(); if (config_rootfound("mainbus", "mainbus") == NULL) panic("no mainbus found"); - + splx(s); #ifdef DEBUG_KERNEL_START printf("survived autoconf, going to enable interrupts\n"); #endif @@ -188,6 +191,12 @@ config_console() if (cf == NULL) { panic("no mainbus"); } + + /* + * delay clock calibration. + */ + amiga_config_found(cf, NULL, "clock", NULL); + /* * internal grf. */ @@ -236,12 +245,14 @@ mbattach(pdp, dp, auxp) struct device *pdp, *dp; void *auxp; { - printf ("\n"); + printf("\n"); config_found(dp, "clock", simple_devprint); #ifdef DRACO if (is_draco()) { config_found(dp, "kbd", simple_devprint); config_found(dp, "drsc", simple_devprint); + config_found(dp, "drcom", simple_devprint); + config_found(dp, "drcom", simple_devprint); /* * XXX -- missing here: * SuperIO chip serial, parallel, floppy @@ -343,9 +354,8 @@ setroot() */ if (rootdev == orootdev) return; - printf("changing root device to %c%c%d%c\n", - devname[majdev][0], devname[majdev][1], - unit, part + 'a'); + printf("changing root device to %c%c%d%c\n", devname[majdev][0], + devname[majdev][1], unit, part + 'a'); #ifdef DOSWAP mindev = DISKUNIT(rootdev); for (swp = swdevt; swp->sw_dev; swp++) { @@ -443,7 +453,7 @@ is_a4000() return (1); #ifdef DEBUG if (a4000_flag) - printf ("Denise ID = %04x\n", (unsigned short)custom.deniseid); + printf("Denise ID = %04x\n", (unsigned short)custom.deniseid); #endif if (machineid >> 16) return (0); /* It's not an A4000 */ diff --git a/sys/arch/amiga/amiga/conf.c b/sys/arch/amiga/amiga/conf.c index d21206853c0..f32b3acc9ba 100644 --- a/sys/arch/amiga/amiga/conf.c +++ b/sys/arch/amiga/amiga/conf.c @@ -1,5 +1,5 @@ -/* $OpenBSD: conf.c,v 1.15 1996/11/28 23:33:02 niklas Exp $ */ -/* $NetBSD: conf.c,v 1.36 1996/05/19 21:04:18 veego Exp $ */ +/* $OpenBSD: conf.c,v 1.16 1997/01/16 09:23:16 niklas Exp $ */ +/* $NetBSD: conf.c,v 1.42 1997/01/07 11:35:03 mrg Exp $ */ /*- * Copyright (c) 1991 The Regents of the University of California. @@ -51,8 +51,6 @@ #include #endif -int ttselect __P((dev_t, int, struct proc *)); - #include "vnd.h" #include "sd.h" #include "cd.h" @@ -65,6 +63,7 @@ int ttselect __P((dev_t, int, struct proc *)); #if 0 #include "rd.h" #endif +#include "ch.h" struct bdevsw bdevsw[] = { @@ -100,6 +99,7 @@ int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]); #include "ms.h" #include "view.h" #include "mfcs.h" +#include "drcom.h" dev_decl(filedesc,open); #include "bpfilter.h" #include "tun.h" @@ -153,6 +153,8 @@ struct cdevsw cdevsw[] = cdev_uk_init(NUK,uk), /* 36: unknown SCSI */ cdev_disk_init(NWD,wd), /* 37: ST506/ESDI/IDE disk */ cdev_disk_init(NACD,acd), /* 38: ATAPI CD-ROM */ + cdev_tty_init(NDRCOM,drcom), /* 39: DraCo com ports */ + cdev_ch_init(NCH,ch), /* 40: SCSI autochanger */ }; int nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]); @@ -222,9 +224,9 @@ static int chrtoblktab[] = { /* 4 */ NODEV, /* 5 */ NODEV, /* 6 */ NODEV, - /* 7 */ 8, - /* 8 */ 4, - /* 9 */ 7, + /* 7 */ 8, /* ccd */ + /* 8 */ 4, /* sd */ + /* 9 */ 7, /* cd */ /* 10 */ NODEV, /* 11 */ NODEV, /* 12 */ NODEV, @@ -233,9 +235,9 @@ static int chrtoblktab[] = { /* 15 */ NODEV, /* 16 */ NODEV, /* 17 */ NODEV, - /* 18 */ 2, - /* 19 */ 6, - /* 20 */ 5, + /* 18 */ 2, /* fd */ + /* 19 */ 6, /* vnd */ + /* 20 */ 5, /* st */ /* 21 */ NODEV, /* 22 */ NODEV, /* 23 */ NODEV, @@ -252,8 +254,10 @@ static int chrtoblktab[] = { /* 34 */ NODEV, /* 35 */ NODEV, /* 36 */ NODEV, - /* 37 */ 0, - /* 38 */ 15, + /* 37 */ 0, /* wd */ + /* 38 */ 15, /* acd */ + /* 39 */ NODEV, + /* 40 */ NODEV, }; /* diff --git a/sys/arch/amiga/amiga/db_memrw.c b/sys/arch/amiga/amiga/db_memrw.c index 6f4b7db6e4f..bdf9cb43c9b 100644 --- a/sys/arch/amiga/amiga/db_memrw.c +++ b/sys/arch/amiga/amiga/db_memrw.c @@ -1,10 +1,13 @@ -/* $OpenBSD: db_memrw.c,v 1.3 1996/05/02 06:43:14 niklas Exp $ */ -/* $NetBSD: db_memrw.c,v 1.3 1996/04/21 21:06:55 veego Exp $ */ +/* $OpenBSD: db_memrw.c,v 1.4 1997/01/16 09:23:17 niklas Exp $ */ +/* $NetBSD: db_memrw.c,v 1.6 1996/12/09 17:53:07 thorpej Exp $ */ -/* - * Copyright (c) 1994 Gordon W. Ross +/*- + * Copyright (c) 1996 The NetBSD Foundation, Inc. * All rights reserved. * + * This code is derived from software contributed to The NetBSD Foundation + * by Gordon W. Ross. + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -13,19 +16,25 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation 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 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. + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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. */ /* @@ -115,7 +124,9 @@ db_write_text(dst, ch) return; } -/*printf("db_write_text: %x: %x = %x (%x:%x)\n", dst, *dst, ch, pte, *pte);*/ +#if 0 +printf("db_write_text: %x: %x = %x (%x:%x)\n", dst, *dst, ch, pte, *pte); +#endif *pte &= ~PG_RO; TBIS((vm_offset_t)dst); diff --git a/sys/arch/amiga/amiga/device.h b/sys/arch/amiga/amiga/device.h index 8f472f82f9a..31ea76c81e9 100644 --- a/sys/arch/amiga/amiga/device.h +++ b/sys/arch/amiga/amiga/device.h @@ -1,5 +1,5 @@ -/* $OpenBSD: device.h,v 1.3 1996/11/23 21:45:04 kstailey Exp $ */ -/* $NetBSD: device.h,v 1.5 1996/04/21 21:06:57 veego Exp $ */ +/* $OpenBSD: device.h,v 1.4 1997/01/16 09:23:17 niklas Exp $ */ +/* $NetBSD: device.h,v 1.6 1996/08/27 21:54:26 cgd Exp $ */ /* * Copyright (c) 1994 Christian E. Hopps diff --git a/sys/arch/amiga/amiga/disksubr.c b/sys/arch/amiga/amiga/disksubr.c index ca73414bf37..a68b2aaaf84 100644 --- a/sys/arch/amiga/amiga/disksubr.c +++ b/sys/arch/amiga/amiga/disksubr.c @@ -1,5 +1,5 @@ -/* $OpenBSD: disksubr.c,v 1.7 1996/12/20 16:48:09 niklas Exp $ */ -/* $NetBSD: disksubr.c,v 1.25 1996/04/30 05:00:51 mhitch Exp $ */ +/* $OpenBSD: disksubr.c,v 1.8 1997/01/16 09:23:18 niklas Exp $ */ +/* $NetBSD: disksubr.c,v 1.27 1996/10/13 03:06:34 christos Exp $ */ /* * Copyright (c) 1994 Christian E. Hopps diff --git a/sys/arch/amiga/amiga/drcustom.h b/sys/arch/amiga/amiga/drcustom.h index d8660e73296..b2f81c5a5ca 100644 --- a/sys/arch/amiga/amiga/drcustom.h +++ b/sys/arch/amiga/amiga/drcustom.h @@ -1,6 +1,6 @@ /* - * $OpenBSD: drcustom.h,v 1.3 1996/08/19 00:04:13 niklas Exp $ - * $NetBSD: drcustom.h,v 1.1.4.1 1996/06/21 06:42:44 jtc Exp $ + * $OpenBSD: drcustom.h,v 1.4 1997/01/16 09:23:19 niklas Exp $ + * $NetBSD: drcustom.h,v 1.3 1996/09/24 17:11:54 is Exp $ * * Motherboard addresses for the DraCo. * @@ -66,7 +66,7 @@ struct drioct { #define DRCNTRL_FDCINTENA 1 #define DRCNTRL_KBDDATOUT 2 #define DRCNTRL_KBDCLKOUT 4 -#define DRCNTRL_WDOGENA 8 +#define DRCNTRL_WDOGDIS 8 #define DRCNTRL_WDOGDAT 16 #define DRCNTRL_KBDINTENA 32 #define DRCNTRL_KBDKBDACK 64 diff --git a/sys/arch/amiga/amiga/genassym.c b/sys/arch/amiga/amiga/genassym.c index 99925256e79..08888a3fb2a 100644 --- a/sys/arch/amiga/amiga/genassym.c +++ b/sys/arch/amiga/amiga/genassym.c @@ -1,5 +1,5 @@ -/* $OpenBSD: genassym.c,v 1.6 1996/05/29 10:14:25 niklas Exp $ */ -/* $NetBSD: genassym.c,v 1.26 1996/05/09 20:30:37 is Exp $ */ +/* $OpenBSD: genassym.c,v 1.7 1997/01/16 09:23:20 niklas Exp $ */ +/* $NetBSD: genassym.c,v 1.29 1996/12/17 07:32:55 is Exp $ */ /* * Copyright (c) 1982, 1990 The Regents of the University of California. @@ -36,6 +36,7 @@ * @(#)genassym.c 7.8 (Berkeley) 5/7/91 */ +#include #include #include #include @@ -43,7 +44,6 @@ #include #include #include -#include #include @@ -134,6 +134,10 @@ main() printf("#define\tDC_CLEAR %d\n", DC_CLEAR); printf("#define\tCACHE40_ON %d\n", CACHE40_ON); printf("#define\tCACHE40_OFF %d\n", CACHE40_OFF); + printf("#define\tCACHE60_ON %d\n", CACHE60_ON); + printf("#define\tCACHE60_OFF %d\n", CACHE60_OFF); + printf("#define\tIC60_CUBC %d\n", IC60_CUBC); + printf("#define\tIC60_CABC %d\n", IC60_CABC); printf("#define\tPG_V %d\n", PG_V); printf("#define\tPG_NV %d\n", PG_NV); printf("#define\tPG_RO %d\n", PG_RO); diff --git a/sys/arch/amiga/amiga/locore.s b/sys/arch/amiga/amiga/locore.s index 460b049e509..a10545bb671 100644 --- a/sys/arch/amiga/amiga/locore.s +++ b/sys/arch/amiga/amiga/locore.s @@ -1,5 +1,5 @@ -/* $OpenBSD: locore.s,v 1.12 1996/11/23 23:19:27 kstailey Exp $ */ -/* $NetBSD: locore.s,v 1.56.2.2 1996/06/14 11:20:45 is Exp $ */ +/* $OpenBSD: locore.s,v 1.13 1997/01/16 09:23:22 niklas Exp $ */ +/* $NetBSD: locore.s,v 1.72 1996/12/17 11:09:10 is Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -60,7 +60,7 @@ L_base: #include #include "ser.h" #include "fd.h" - + #ifdef DRACO #include #endif @@ -71,7 +71,7 @@ L_base: #define INTREQRADDR(ar) movl _INTREQRaddr,ar #define INTREQWADDR(ar) movl _INTREQWaddr,ar #define INTENAWADDR(ar) movl _INTENAWaddr,ar -#define INTENARADDR(ar) movl _INTENARaddr,ar +#define INTENARADDR(ar) movl _INTENARaddr,ar .text /* @@ -130,10 +130,11 @@ _addrerr: btst #2,d0 | branch prediction error? jeq Lnobpe movc cacr,d2 - orl #0x00400000,d2 | clear all branch cache entries + orl #IC60_CABC,d2 | clear all branch cache entries movc d2,cacr movl d0,d1 andl #0x7ffd,d1 + addql #1,L60bpe jeq Lbpedone Lnobpe: movl d0,sp@ | code is FSLW now. @@ -220,18 +221,18 @@ Lbe10: Lbe10a: ptestr d0,a0@,#7 | do a table search pmove psr,sp@ | save result - movl sp@,d1 - btst #26,d1 | invalid (incl. limit viol. and berr)? + movb sp@,d1 + btst #2,d1 | invalid (incl. limit viol. and berr)? jeq Lmightnotbemerr | no -> wp check - btst #31,d1 | is it MMU table berr? + btst #7,d1 | is it MMU table berr? jeq Lismerr | no, must be fast jra Lisberr1 | real bus err needs not be fast. Lmightnotbemerr: - btst #27,d1 | write protect bit set? + btst #3,d1 | write protect bit set? jeq Lisberr1 | no: must be bus error - | ssw is in low word of d1 - andw #0xc0,d1 | Write protect is set on page: - cmpw #0x40,d1 | was it read cycle? + movl sp@,d0 | ssw into low word of d0 + andw #0xc0,d0 | Write protect is set on page: + cmpw #0x40,d0 | was it read cycle? jeq Lisberr1 | yes, was not WPE, must be bus err Lismerr: movl #T_MMUFLT,sp@- | show that we are an MMU fault @@ -543,8 +544,7 @@ _DraCoLev2intr: CIAAADDR(a0) movb a0@(CIAICR),d0 | read irc register (clears ints!) - tstb d0 | check if CIAB was source - jeq Ldrintrcommon + jge Ldrintrcommon | CIAA IR not set, go through isr chain movel _draco_intpen,a0 | andib #4,a0@ |XXX this would better be @@ -564,6 +564,41 @@ Ldraciaend: moveml sp@+,#0x0303 addql #1,_cnt+V_INTR jra rei + +/* XXX on the DraCo rev. 4 or later, lev 1 is vectored here. */ + .globl _DraCoLev1intr + .globl _amiga_clk_interval +_DraCoLev1intr: + moveml #0xC0C0,sp@- + movl _draco_ioct,a0 + btst #5,a0@(7) + jeq Ldrintrcommon + btst #4,a0@(7) | this only happens during autoconfiguration, + jeq Ldrintrcommon | so test last. + movw #PSL_HIGHIPL,sr | run clock at high ipl +Ldrclockretry: + lea sp@(16),a1 | get pointer to PS + movl a1,sp@- | push pointer to PS, PC + jbsr _hardclock + addql #4,sp | pop params + addql #1,_intrcnt+32 | add another system clock interrupt + + movl _draco_ioct,a0 + tstb a0@(9) | latch timer value + movw a0@(11),d0 | can't use movpw here, might be 68060 + movb a0@(13),d0 + addw _amiga_clk_interval+2,d0 + movb d0,a0@(13) | low byte: latch write value + movw d0,a0@(11) | ...and write it into timer + tstw d0 | already positive? + jcs Ldrclockretry | we lost more than one tick, call us again. + + clrb a0@(9) | reset timer irq + + moveml sp@+,#0x0303 + addql #1,_cnt+V_INTR + jra rei + /* XXX on the DraCo, lev 1, 3, 4, 5 and 6 are vectored here by initcpu() */ .globl _DraCoIntr _DraCoIntr: @@ -671,8 +706,7 @@ _fake_lev6intr: CIABADDR(a0) movb a0@(CIAICR),d0 | read irc register (clears ints!) - tstb d0 | check if CIAB was source - jeq Lchkexter | no, go through isr chain + jge Lchkexter | CIAB IR not set, go through isr chain INTREQWADDR(a0) #ifndef LEV6_DEFER movew #INTF_EXTER,a0@ | clear EXTER interrupt in intreq @@ -983,7 +1017,7 @@ Lsetcpu040: movl #CACHE40_OFF,d0 | 68040 cache disable btst #7,sp@(3) | XXX jeq Lstartnot040 - orl #0x400000,d0 | XXX and clear all 060 branch cache + orl #IC60_CABC,d0 | XXX and clear all 060 branch cache Lstartnot040: movc d0,cacr | clear and disable on-chip cache(s) movl #_vectab,a0 @@ -1030,6 +1064,11 @@ Lunshadow: | is this needed? MLH .word 0xf4f8 | cpusha bc - push & invalidate caches movl #CACHE40_ON,d0 +#ifdef M68060 + btst #7,_machineid+3 + jeq Lcacheon + movl #CACHE60_ON,d0 +#endif Lcacheon: movc d0,cacr | clear cache(s) /* final setup for C code */ @@ -1069,11 +1108,12 @@ Lcacheon: jne Lnoflush | no, skip .word 0xf478 | cpusha dc .word 0xf498 | cinva ic - btst #7,_machineid+3 - jeq Lnoflush - movc cacr,d0 - orl #200000,d0 - movc d0,cacr +| XXX dont need these; the cinva ic also clears the branch cache. +| btst #7,_machineid+3 +| jeq Lnoflush +| movc cacr,d0 +| orl #IC60_CUBC,d0 +| movc d0,cacr Lnoflush: movl sp@(FR_SP),a0 | grab and load movl a0,usp | user SP @@ -1229,8 +1269,8 @@ ENTRY(longjmp) /* * The following primitives manipulate the run queues. - * _whichqs tells which of the 32 queues _qs - * have processes in them. Setrunqueue puts processes into queues, Remrq + * _whichqs tells which of the 32 queues _qs have processes + * in them. Setrunqueue puts processes into queues, remrunqueue * removes them from queues. The running process is on no queue, * other processes are on a queue related to p->p_priority, divided by 4 * actually to shrink the 0-127 range of priorities into the 32 available @@ -1274,7 +1314,7 @@ Lset2: .even /* - * Remrq(p) + * remrunqueue(p) * * Call should be made at spl6(). */ @@ -1513,7 +1553,7 @@ Lres2: btst #7,_machineid+3 jeq Lres3 movc cacr,d2 - orl #0x00200000,d2 | clear user branch cache entries + orl #IC60_CUBC,d2 | clear user branch cache entries movc d2,cacr #endif Lres3: @@ -1712,7 +1752,7 @@ Ltbia040: btst #7,_machineid+3 jeq Ltbiano60 movc cacr,d0 - orl #0x400000,d0 | and clear all branch cache entries + orl #IC60_CABC,d0 | and clear all branch cache entries movc d0,cacr #endif Ltbiano60: @@ -1749,7 +1789,7 @@ Ltbis040: btst #7,_machineid+3 jeq Ltbisno60 movc cacr,d0 - orl #0x400000,d0 | and clear all branch cache entries + orl #IC60_CABC,d0 | and clear all branch cache entries movc d0,cacr Ltbisno60: #endif @@ -1781,7 +1821,7 @@ Ltbias040: btst #7,_machineid+3 jeq Ltbiasno60 movc cacr,d0 - orl #0x400000,d0 | and clear all branch cache entries + orl #IC60_CABC,d0 | and clear all branch cache entries movc d0,cacr Ltbiasno60: #endif @@ -1813,7 +1853,7 @@ Ltbiau040: btst #7,_machineid+3 jeq Ltbiauno60 movc cacr,d0 - orl #0x200000,d0 | but only user branch cache entries + orl #IC60_CUBC,d0 | but only user branch cache entries movc d0,cacr Ltbiauno60: #endif @@ -1991,11 +2031,11 @@ ENTRY(loadustp) #ifdef M68060 Lldustp060: movc cacr,d1 - orl #0x200000,d1 | clear user branch cache entries + orl #IC60_CUBC,d1 | clear user branch cache entries movc d1,cacr #endif Lldustp040: - .word 0x4e7b,0x0806 | movec d0,URP + .word 0x4e7b,0x0806 | movec d0,URP rts /* @@ -2022,7 +2062,7 @@ Lnot68851: #ifdef M68060 Lflustp060: movc cacr,d1 - orl #0x200000,d1 | clear user branch cache entries + orl #IC60_CUBC,d1 | clear user branch cache entries movc d1,cacr rts #endif @@ -2071,7 +2111,7 @@ ENTRY(m68881_save) fsave a0@ | save state #if defined(M68020) || defined(M68030) || defined(M68040) #ifdef M68060 - btst #7,_machineid + btst #7,_machineid+3 jne Lm68060fpsave #endif tstb a0@ | null state frame? @@ -2098,7 +2138,7 @@ ENTRY(m68881_restore) movl sp@(4),a0 | save area pointer #if defined(M68020) || defined(M68030) || defined(M68040) #if defined(M68060) - btst #7,_machineid + btst #7,_machineid+3 jne Lm68060fprestore #endif tstb a0@ | null state frame? @@ -2331,11 +2371,45 @@ nullrp: .long 0x7fff0001 zero: .long 0 Ldorebootend: + .align 2 + .globl _DELAY + .globl _delay + nop +_delay: +_DELAY: + movql #10,d1 | 2 +2 + movl sp@(4),d0 | 4 +4 + lsll d1,d0 | 8 +2 + movl _delaydivisor,d1 | A +6 +Ldelay: | longword aligned again. + subl d1,d0 + jcc Ldelay + rts + +#ifdef M68060 + .globl _intemu60, _fpiemu60, _fpdemu60, _fpeaemu60 +_intemu60: + addql #1,L60iem + jra _I_CALL_TOP+128+0x00 +_fpiemu60: + addql #1,L60fpiem + jra _FP_CALL_TOP+128+0x30 +_fpdemu60: + addql #1,L60fpdem + jra _FP_CALL_TOP+128+0x38 +_fpeaemu60: + addql #1,L60fpeaem + jra _FP_CALL_TOP+128+0x40 +#endif .data .space NBPG tmpstk: - .globl _mmutype,_protorp + .globl _mmutype,_fputype,_protorp +_mmutype: + .long 0 +_fputype: + .long 0 _protorp: .long 0x80000002,0 | prototype root pointer .globl _cold @@ -2344,6 +2418,12 @@ _cold: .globl _proc0paddr _proc0paddr: .long 0 | KVA of proc0 u-area + .globl _delaydivisor +_delaydivisor: + .long 12 | should be enough for 80 MHz 68060 + | will be adapted to other CPUs in + | start_c_cleanup and calibrated + | at clock attach time. #ifdef DEBUG .globl fulltflush, fullcflush fulltflush: @@ -2376,6 +2456,13 @@ _intrnames: .asciz "lcl/zbus" | 6: lcl/zorro lev6 .asciz "buserr" | 7: nmi: bus timeout #endif +#ifdef M68060 + .asciz "60intemu" + .asciz "60fpiemu" + .asciz "60fpdemu" + .asciz "60fpeaemu" + .asciz "60bpe" +#endif _eintrnames: .align 2 _intrcnt: @@ -2384,4 +2471,11 @@ _intrcnt: Drintrcnt: .long 0,0,0,0,0,0,0 #endif +#ifdef M68060 +L60iem: .long 0 +L60fpiem: .long 0 +L60fpdem: .long 0 +L60fpeaem: .long 0 +L60bpe: .long 0 +#endif _eintrcnt: diff --git a/sys/arch/amiga/amiga/machdep.c b/sys/arch/amiga/amiga/machdep.c index 9621cbbef7d..f998c2b3386 100644 --- a/sys/arch/amiga/amiga/machdep.c +++ b/sys/arch/amiga/amiga/machdep.c @@ -1,5 +1,5 @@ -/* $OpenBSD: machdep.c,v 1.15 1996/08/19 00:04:15 niklas Exp $ */ -/* $NetBSD: machdep.c,v 1.72.4.1 1996/05/26 16:23:23 is Exp $ */ +/* $OpenBSD: machdep.c,v 1.16 1997/01/16 09:23:24 niklas Exp $ */ +/* $NetBSD: machdep.c,v 1.82 1996/12/17 07:32:54 is Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -154,6 +154,11 @@ void ser_outintr __P((void)); void fdintr __P((int)); #endif +/* + * patched by some devices at attach time (currently, only drcom) + */ +u_int16_t amiga_ttyspl = PSL_S|PSL_IPL4; + /* * Declare these as initialized data so we can patch them. */ @@ -197,6 +202,7 @@ char machine[] = "amiga"; struct isr *isr_ports; #ifdef DRACO struct isr *isr_slot3; +struct isr *isr_supio; #endif #if defined(IPL_REMAP_1) || defined(IPL_REMAP_2) struct isr *isr_exter[7]; @@ -499,8 +505,8 @@ again: #endif printf("avail mem = %ld (%ld pages)\n", ptoa(cnt.v_free_count), ptoa(cnt.v_free_count)/NBPG); - printf("using %d buffers containing %d bytes of memory\n", - nbuf, bufpages * CLBYTES); + printf("using %d buffers containing %d bytes of memory\n", nbuf, + bufpages * CLBYTES); /* * display memory configuration passed from loadbsd @@ -511,9 +517,9 @@ again: memlist->m_seg[i].ms_start, memlist->m_seg[i].ms_size); #if defined(MACHINE_NONCONTIG) && defined(DEBUG) - printf ("Physical memory segments:\n"); + printf("Physical memory segments:\n"); for (i = 0; i < memlist->m_nseg && phys_segs[i].start; ++i) - printf ("Physical segment %d at %08lx size %ld offset %d\n", i, + printf("Physical segment %d at %08lx size %ld offset %d\n", i, phys_segs[i].start, (phys_segs[i].end - phys_segs[i].start) / NBPG, phys_segs[i].first_page); @@ -522,6 +528,7 @@ again: #ifdef DEBUG_KERNEL_START printf("calling initcpu...\n"); #endif + /* * Set up CPU-specific registers, cache, etc. */ @@ -595,7 +602,12 @@ setregs(p, pack, stack, retval) */ char cpu_model[120]; extern char version[]; - + +#if defined(M68060) +int m68060_pcr_init = 0x21; /* make this patchable */ +#endif + + void identifycpu() { @@ -640,7 +652,7 @@ identifycpu() cpu_type = "m68040"; mmu = "/MMU"; fpu = "/FPU"; - fputype = FPU_68040; + fputype = FPU_68040; /* XXX */ } else if (machineid & AMIGA_68030) { cpu_type = "m68030"; /* XXX */ mmu = "/MMU"; @@ -747,7 +759,9 @@ sendsig(catcher, sig, mask, code) extern char sigcode[], esigcode[]; -/*printf("sendsig %d %d %x %x %x\n", p->p_pid, sig, mask, code, catcher);*/ +#if 0 +printf("sendsig %d %d %x %x %x\n", p->p_pid, sig, mask, code, catcher); +#endif frame = (struct frame *)p->p_md.md_regs; ft = frame->f_format; @@ -772,13 +786,13 @@ sendsig(catcher, sig, mask, code) #ifdef DEBUG if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid) printf("sendsig(%d): sig %d ssp %p usp %p scp %p ft %d\n", - p->p_pid, sig, &oonstack, fp, &fp->sf_sc, ft); + p->p_pid, sig, &oonstack, fp, &fp->sf_sc, ft); #endif if (useracc((caddr_t)fp, sizeof(struct sigframe), B_WRITE) == 0) { #ifdef DEBUG if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid) printf("sendsig(%d): useracc failed on sig %d\n", - p->p_pid, sig); + p->p_pid, sig); #endif /* * Process has trashed its stack; give it an illegal @@ -807,8 +821,8 @@ sendsig(catcher, sig, mask, code) * - FP coprocessor state */ kfp->sf_state.ss_flags = SS_USERREGS; - bcopy((caddr_t)frame->f_regs, - (caddr_t)kfp->sf_state.ss_frame.f_regs, sizeof frame->f_regs); + bcopy((caddr_t)frame->f_regs, (caddr_t)kfp->sf_state.ss_frame.f_regs, + sizeof frame->f_regs); if (ft >= FMT9) { #ifdef DEBUG if (ft != FMT9 && ft != FMTA && ft != FMTB) @@ -818,7 +832,7 @@ sendsig(catcher, sig, mask, code) kfp->sf_state.ss_frame.f_format = frame->f_format; kfp->sf_state.ss_frame.f_vector = frame->f_vector; bcopy((caddr_t)&frame->F_u, - (caddr_t)&kfp->sf_state.ss_frame.F_u, exframesize[ft]); + (caddr_t)&kfp->sf_state.ss_frame.F_u, exframesize[ft]); /* * Leave an indicator that we need to clean up the kernel * stack. We do this by setting the "pad word" above the @@ -834,7 +848,7 @@ sendsig(catcher, sig, mask, code) #ifdef DEBUG if (sigdebug & SDB_FOLLOW) printf("sendsig(%d): copy out %d of frame %d\n", - p->p_pid, exframesize[ft], ft); + p->p_pid, exframesize[ft], ft); #endif } #ifdef FPCOPROC @@ -842,9 +856,9 @@ sendsig(catcher, sig, mask, code) m68881_save(&kfp->sf_state.ss_fpstate); #ifdef DEBUG if ((sigdebug & SDB_FPSTATE) && *(char *)&kfp->sf_state.ss_fpstate) - printf("sendsig(%d): copy out FP state (%x) to %p\n", - p->p_pid, *(u_int *)&kfp->sf_state.ss_fpstate, - &kfp->sf_state.ss_fpstate); + printf("sendsig(%d): copy out FP state (%x) to %p\n", p->p_pid, + *(u_int *)&kfp->sf_state.ss_fpstate, + &kfp->sf_state.ss_fpstate); #endif #endif /* @@ -862,8 +876,8 @@ sendsig(catcher, sig, mask, code) #ifdef DEBUG if (sigdebug & SDB_FOLLOW) printf("sendsig(%d): sig %d scp %p fp %p sc_sp %x sc_ap %x\n", - p->p_pid, sig, kfp->sf_scp, fp, - kfp->sf_sc.sc_sp, kfp->sf_sc.sc_ap); + p->p_pid, sig, kfp->sf_scp, fp, kfp->sf_sc.sc_sp, + kfp->sf_sc.sc_ap); #endif /* * Signal trampoline code is at base of user stack. @@ -871,8 +885,7 @@ sendsig(catcher, sig, mask, code) frame->f_pc = (int)(((char *)PS_STRINGS) - (esigcode - sigcode)); #ifdef DEBUG if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid) - printf("sendsig(%d): sig %d returns\n", - p->p_pid, sig); + printf("sendsig(%d): sig %d returns\n", p->p_pid, sig); #endif free((caddr_t)kfp, M_TEMP); } @@ -947,8 +960,8 @@ sys_sigreturn(p, v, retval) flags = fuword((caddr_t)rf); #ifdef DEBUG if (sigdebug & SDB_FOLLOW) - printf("sigreturn(%d): sc_ap %x flags %x\n", - p->p_pid, rf, flags); + printf("sigreturn(%d): sc_ap %x flags %x\n", p->p_pid, rf, + flags); #endif /* * fuword failed (bogus sc_ap value). @@ -959,9 +972,9 @@ sys_sigreturn(p, v, retval) return (EJUSTRETURN); #ifdef DEBUG if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid) - printf("sigreturn(%d): ssp %p usp %x scp %p ft %d\n", - p->p_pid, &flags, scp->sc_sp, SCARG(uap, sigcntxp), - (flags&SS_RTEFRAME) ? tstate.ss_frame.f_format : -1); + printf("sigreturn(%d): ssp %p usp %x scp %p ft %d\n", p->p_pid, + &flags, scp->sc_sp, SCARG(uap, sigcntxp), + (flags&SS_RTEFRAME) ? tstate.ss_frame.f_format : -1); #endif /* * Restore most of the users registers except for A6 and SP @@ -989,7 +1002,7 @@ sys_sigreturn(p, v, retval) #ifdef DEBUG if (sigdebug & SDB_FOLLOW) printf("sigreturn(%d): copy in %d of frame type %d\n", - p->p_pid, sz, tstate.ss_frame.f_format); + p->p_pid, sz, tstate.ss_frame.f_format); #endif } #ifdef FPCOPROC @@ -1001,8 +1014,8 @@ sys_sigreturn(p, v, retval) #ifdef DEBUG if ((sigdebug & SDB_FPSTATE) && *(char *)&tstate.ss_fpstate) printf("sigreturn(%d): copied in FP state (%x) at %p\n", - p->p_pid, *(u_int *)&tstate.ss_fpstate, - &tstate.ss_fpstate); + p->p_pid, *(u_int *)&tstate.ss_fpstate, + &tstate.ss_fpstate); #endif #endif #ifdef DEBUG @@ -1021,6 +1034,7 @@ bootsync(void) if (waittime < 0) { waittime = 0; vfs_shutdown(); + /* * If we've been adjusting the clock, the todr * will be out of synch; adjust it now. @@ -1261,10 +1275,6 @@ microtime(tvp) splx(s); } -#if defined(M68060) -int m68060_pcr_init = 0x21; /* make this patchable */ -#endif - void initcpu() { @@ -1275,7 +1285,8 @@ initcpu() #ifdef M68060 #if defined(M060SP) - extern u_int8_t I_CALL_TOP[]; + /*extern u_int8_t I_CALL_TOP[];*/ + extern u_int8_t intemu60, fpiemu60, fpdemu60, fpeaemu60; extern u_int8_t FP_CALL_TOP[]; #else extern u_int8_t illinst; @@ -1284,7 +1295,8 @@ initcpu() #endif #ifdef DRACO - extern u_int8_t DraCoIntr, DraCoLev2intr; + extern u_int8_t DraCoIntr, DraCoLev1intr, DraCoLev2intr; + u_char dracorev; #endif #ifdef M68060 @@ -1294,12 +1306,17 @@ initcpu() #if defined(M060SP) /* integer support */ - vectab[61] = &I_CALL_TOP[128 + 0x00]; + vectab[61] = &intemu60/*&I_CALL_TOP[128 + 0x00]*/; /* floating point support */ - vectab[11] = &FP_CALL_TOP[128 + 0x30]; - vectab[55] = &FP_CALL_TOP[128 + 0x38]; - vectab[60] = &FP_CALL_TOP[128 + 0x40]; + /* + * XXX maybe we really should run-time check for the + * stack frame format here: + */ + vectab[11] = &fpiemu60/*&FP_CALL_TOP[128 + 0x30]*/; + + vectab[55] = &fpdemu60/*&FP_CALL_TOP[128 + 0x38]*/; + vectab[60] = &fpeaemu60/*&FP_CALL_TOP[128 + 0x40]*/; vectab[54] = &FP_CALL_TOP[128 + 0x00]; vectab[52] = &FP_CALL_TOP[128 + 0x08]; @@ -1315,10 +1332,20 @@ initcpu() } #endif +/* + * Vector initialization for special motherboards + */ + #ifdef DRACO - if (is_draco()) { - vectab[24+1] = &DraCoIntr; - vectab[24+2] = &DraCoLev2intr; + dracorev = is_draco(); + if (dracorev) { + if (dracorev >= 4) { + vectab[24+1] = &DraCoLev1intr; + vectab[24+2] = &DraCoIntr; + } else { + vectab[24+1] = &DraCoIntr; + vectab[24+2] = &DraCoLev2intr; + } vectab[24+3] = &DraCoIntr; vectab[24+4] = &DraCoIntr; vectab[24+5] = &DraCoIntr; @@ -1583,9 +1610,12 @@ add_isr(isr) break; #ifdef DRACO case 3: - panic("DraCo IPL3 not yet supported here"); p = &isr_slot3; break; + + case 5: + p = &isr_supio; + break; #endif case 6: #if defined(IPL_REMAP_1) || defined(IPL_REMAP_2) @@ -1608,8 +1638,16 @@ add_isr(isr) /* enable interrupt */ #ifdef DRACO if (is_draco()) - *draco_intena |= isr->isr_ipl == 6 ? - DRIRQ_INT6 : DRIRQ_INT2; + switch(isr->isr_ipl) { + case 6: + *draco_intena |= DRIRQ_INT6; + break; + case 2: + *draco_intena |= DRIRQ_INT2; + break; + default: + break; + } else #endif custom.intena = INTF_SETCLR | @@ -1628,9 +1666,12 @@ remove_isr(isr) break; #ifdef DRACO case 3: - panic("DraCo IPL3 not yet supported here"); chain = &isr_slot3; break; + + case 5: + chain = &isr_supio; + break; #endif case 6: #if defined(IPL_REMAP_1) || defined(IPL_REMAP_2) @@ -1648,6 +1689,7 @@ remove_isr(isr) *p = q->isr_forw; else panic("remove_isr: handler not registered"); + /* disable interrupt if no more handlers */ if (*chain == NULL) switch (isr->isr_ipl) { case 2: @@ -1658,11 +1700,6 @@ remove_isr(isr) #endif custom.intena = INTF_PORTS; break; -#ifdef DRACO - case 3: - panic("DraCo IPL3 not yet supported here"); - break; -#endif case 6: #if defined(IPL_REMAP_1) || defined(IPL_REMAP_2) if (isr->isr_mapped_ipl == isr_exter_lowipl) { @@ -1801,6 +1838,16 @@ intrhand(sr) if (ireq & INTF_VERTB) vbl_handler(); break; +#ifdef DRACO + case 5: + p = &isr_supio; + while ((q = *p) != NULL) { + if ((q->isr_intr)(q->isr_arg)) + break; + p = &q->isr_forw; + } + break; +#endif #if 0 /* now dealt with in locore.s for speed reasons */ case 5: diff --git a/sys/arch/amiga/amiga/pmap.c b/sys/arch/amiga/amiga/pmap.c index ee318677821..94fe673b387 100644 --- a/sys/arch/amiga/amiga/pmap.c +++ b/sys/arch/amiga/amiga/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.7 1996/10/04 23:34:39 niklas Exp $ */ +/* $OpenBSD: pmap.c,v 1.8 1997/01/16 09:23:26 niklas Exp $ */ /* $NetBSD: pmap.c,v 1.34.4.1 1996/08/03 00:53:58 jtc Exp $ */ /* @@ -499,9 +499,9 @@ pmap_init(phys_start, phys_end) #ifdef DEBUG if (pmapdebug & PDB_INIT) { printf("pmap_init: Sysseg %p, Sysmap %p, Sysptmap %p\n", - Sysseg, Sysmap, Sysptmap); + Sysseg, Sysmap, Sysptmap); printf(" pstart %lx, pend %lx, vstart %lx, vend %lx\n", - avail_start, avail_end, virtual_avail, virtual_end); + avail_start, avail_end, virtual_avail, virtual_end); } #endif @@ -516,8 +516,8 @@ pmap_init(phys_start, phys_end) npg += atop(phys_segs[i].end - phys_segs[i].start); } #ifdef DEBUG - printf ("pmap_init: avail_start %lx phys_segs[0].start %lx npg %ld\n", - avail_start, phys_segs[0].start, npg); + printf("pmap_init: avail_start %lx phys_segs[0].start %lx npg %ld\n", + avail_start, phys_segs[0].start, npg); #endif #else npg = atop(phys_end - phys_start); @@ -547,7 +547,7 @@ pmap_init(phys_start, phys_end) #ifdef DEBUG if (pmapdebug & PDB_INIT) printf("pmap_init: %lx bytes (%lx pgs): seg %p tbl %p attr %p\n", - s, npg, Segtabzero, pv_table, pmap_attributes); + s, npg, Segtabzero, pv_table, pmap_attributes); #endif /* @@ -596,8 +596,8 @@ pmap_init(phys_start, phys_end) #ifdef DEBUG kpt_stats.kpttotal = atop(s); if (pmapdebug & PDB_INIT) - printf("pmap_init: KPT: %ld pages from %lx to %lx\n", - atop(s), addr, addr + s); + printf("pmap_init: KPT: %ld pages from %lx to %lx\n", atop(s), + addr, addr + s); #endif /* @@ -661,8 +661,8 @@ pmap_next_page(addrp) if (avail_next == phys_segs[cur_seg].end) { avail_next = phys_segs[++cur_seg].start; #ifdef DEBUG - printf ("pmap_next_page: next %lx remain %ld\n", - avail_next, avail_remaining); + printf("pmap_next_page: next %lx remain %ld\n", avail_next, + avail_remaining); #endif } @@ -833,7 +833,8 @@ pmap_map(virt, start, end, prot) { #ifdef DEBUG if (pmapdebug & PDB_FOLLOW) - printf("pmap_map(%lx, %lx, %lx, %x)\n", virt, start, end, prot); + printf("pmap_map(%lx, %lx, %lx, %x)\n", virt, start, end, + prot); #endif while (start < end) { pmap_enter(pmap_kernel(), virt, start, prot, FALSE); @@ -1114,11 +1115,11 @@ pmap_remove(pmap, sva, eva) #ifdef DEBUG if (npv == NULL) { #ifdef MACHINE_NONCONTIG /* XXX this need to be fixed */ - printf("pmap_remove: PA %lx index %d\n", - pa, pa_index(pa)); + printf("pmap_remove: PA %lx index %d\n", pa, + pa_index(pa)); #else - printf("pmap_remove: PA %lx index %ld\n", - pa, pa_index(pa)); + printf("pmap_remove: PA %lx index %ld\n", pa, + pa_index(pa)); #endif panic("pmap_remove: PA not in pv_tab"); } @@ -1138,8 +1139,8 @@ pmap_remove(pmap, sva, eva) remove_stats.ptinvalid++; if (pmapdebug & (PDB_REMOVE|PDB_PTPAGE)) { printf("remove: ste was %x@%p pte was %x@%p\n", - *ste, ste, - *(int *)&opte, pmap_pte(pmap, va)); + *ste, ste, *(int *)&opte, + pmap_pte(pmap, va)); } #endif #if defined(M68040) || defined(M68060) @@ -1173,8 +1174,8 @@ pmap_remove(pmap, sva, eva) #ifdef DEBUG if (pmapdebug & (PDB_REMOVE|PDB_SEGTAB)) printf("remove: stab %p, refcnt %d\n", - ptpmap->pm_stab, - ptpmap->pm_sref - 1); + ptpmap->pm_stab, + ptpmap->pm_sref - 1); if ((pmapdebug & PDB_PARANOIA) && ptpmap->pm_stab != (u_int *)trunc_page(ste)) panic("remove: bogus ste"); @@ -1183,11 +1184,11 @@ pmap_remove(pmap, sva, eva) #ifdef DEBUG if (pmapdebug&(PDB_REMOVE|PDB_SEGTAB)) printf("remove: free stab %p\n", - ptpmap->pm_stab); + ptpmap->pm_stab); #endif kmem_free_wakeup(kernel_map, - (vm_offset_t)ptpmap->pm_stab, - AMIGA_STSIZE); + (vm_offset_t)ptpmap->pm_stab, + AMIGA_STSIZE); ptpmap->pm_stab = Segtabzero; ptpmap->pm_stpa = Segtabzeropa; #if defined(M68040) || defined(M68060) @@ -1272,15 +1273,15 @@ pmap_page_protect(pa, prot) if (!pmap_ste_v(pv->pv_pmap,pv->pv_va) || pmap_pte_pa(pmap_pte(pv->pv_pmap,pv->pv_va)) != pa) { - printf ("pmap_page_protect: va %lx, pmap_ste_v %d pmap_pte_pa %08x/%lx\n", - pv->pv_va, pmap_ste_v(pv->pv_pmap,pv->pv_va), - pmap_pte_pa(pmap_pte(pv->pv_pmap,pv->pv_va)),pa); - printf (" pvh %p pv %p pv_next %p\n", pa_to_pvh(pa), pv, pv->pv_next); - panic("pmap_page_protect: bad mapping"); + printf ("pmap_page_protect: va %lx, pmap_ste_v %d pmap_pte_pa %08x/%lx\n", + pv->pv_va, pmap_ste_v(pv->pv_pmap,pv->pv_va), + pmap_pte_pa(pmap_pte(pv->pv_pmap,pv->pv_va)), pa); + printf (" pvh %p pv %p pv_next %p\n", pa_to_pvh(pa), pv, pv->pv_next); + panic("pmap_page_protect: bad mapping"); } #endif pmap_remove(pv->pv_pmap, pv->pv_va, - pv->pv_va + PAGE_SIZE); + pv->pv_va + PAGE_SIZE); } splx(s); break; @@ -1304,7 +1305,8 @@ pmap_protect(pmap, sva, eva, prot) #ifdef DEBUG if (pmapdebug & (PDB_FOLLOW|PDB_PROTECT)) - printf("pmap_protect(%p, %lx, %lx, %x)\n", pmap, sva, eva, prot); + printf("pmap_protect(%p, %lx, %lx, %x)\n", pmap, sva, eva, + prot); #endif if (pmap == NULL) return; @@ -1390,8 +1392,8 @@ pmap_enter(pmap, va, pa, prot, wired) #ifdef DEBUG if (pmapdebug & (PDB_FOLLOW|PDB_ENTER)) - printf("pmap_enter(%p, %lx, %lx, %x, %x)\n", - pmap, va, pa, prot, wired); + printf("pmap_enter(%p, %lx, %lx, %x, %x)\n", pmap, va, pa, + prot, wired); #endif if (pmap == NULL) return; @@ -1497,8 +1499,8 @@ pmap_enter(pmap, va, pa, prot, wired) s = splimp(); #ifdef DEBUG if (pmapdebug & PDB_ENTER) - printf("enter: pv at %p: %lx/%p/%p\n", - pv, pv->pv_va, pv->pv_pmap, pv->pv_next); + printf("enter: pv at %p: %lx/%p/%p\n", pv, pv->pv_va, + pv->pv_pmap, pv->pv_next); #endif /* * No entries yet, use header as the first entry @@ -1668,7 +1670,8 @@ pmap_change_wiring(pmap, va, wired) */ if (!pmap_ste_v(pmap, va)) { if (pmapdebug & PDB_PARANOIA) - printf("pmap_change_wiring: invalid STE for %lx\n", va); + printf("pmap_change_wiring: invalid STE for %lx\n", + va); return; } /* @@ -1677,7 +1680,8 @@ pmap_change_wiring(pmap, va, wired) */ if (!pmap_pte_v(pte)) { if (pmapdebug & PDB_PARANOIA) - printf("pmap_change_wiring: invalid PTE for %lx\n", va); + printf("pmap_change_wiring: invalid PTE for %lx\n", + va); } #endif if ((wired && !pmap_pte_w(pte)) || (!wired && pmap_pte_w(pte))) { @@ -1739,8 +1743,8 @@ void pmap_copy(dst_pmap, src_pmap, dst_addr, len, src_addr) { #ifdef DEBUG if (pmapdebug & PDB_FOLLOW) - printf("pmap_copy(%p, %p, %lx, %lx, %lx)\n", - dst_pmap, src_pmap, dst_addr, len, src_addr); + printf("pmap_copy(%p, %p, %lx, %lx, %lx)\n", dst_pmap, + src_pmap, dst_addr, len, src_addr); #endif } @@ -1834,7 +1838,7 @@ ok: #ifdef DEBUG if (pmapdebug & (PDB_PTPAGE|PDB_COLLECT)) { printf("collect: freeing KPT page at %lx (ste %x@%p)\n", - pv->pv_va, *(int *)pv->pv_ptste, pv->pv_ptste); + pv->pv_va, *(int *)pv->pv_ptste, pv->pv_ptste); opmapdebug = pmapdebug; pmapdebug |= PDB_PTPAGE; } @@ -1863,7 +1867,7 @@ ok: panic("pmap_collect: lost a KPT page"); if (pmapdebug & (PDB_PTPAGE|PDB_COLLECT)) printf("collect: %lx (%lx) to free list\n", - kpt->kpt_va, kpa); + kpt->kpt_va, kpa); #endif *pkpt = kpt->kpt_next; kpt->kpt_next = kpt_free_list; @@ -1876,11 +1880,11 @@ ok: if (*ste) printf("collect: kernel STE at %p still valid (%x)\n", - ste, *ste); + ste, *ste); ste = (int *)&Sysptmap[(u_int *)ste-pmap_ste(pmap_kernel(), 0)]; if (*ste) printf("collect: kernel PTmap at %p still valid (%x)\n", - ste, *ste); + ste, *ste); #endif } splx(s); @@ -1958,8 +1962,8 @@ pmap_pageable(pmap, sva, eva, pageable) { #ifdef DEBUG if (pmapdebug & PDB_FOLLOW) - printf("pmap_pageable(%p, %lx, %lx, %x)\n", - pmap, sva, eva, pageable); + printf("pmap_pageable(%p, %lx, %lx, %x)\n", pmap, sva, eva, + pageable); #endif /* * If we are making a PT page pageable then all valid @@ -1975,8 +1979,8 @@ pmap_pageable(pmap, sva, eva, pageable) #ifdef DEBUG if ((pmapdebug & (PDB_FOLLOW|PDB_PTPAGE)) == PDB_PTPAGE) - printf("pmap_pageable(%p, %lx, %lx, %x)\n", - pmap, sva, eva, pageable); + printf("pmap_pageable(%p, %lx, %lx, %x)\n", pmap, sva, + eva, pageable); #endif if (!pmap_ste_v(pmap, sva)) return; @@ -1989,7 +1993,7 @@ pmap_pageable(pmap, sva, eva, pageable) #ifdef DEBUG if (pv->pv_va != sva || pv->pv_next) { printf("pmap_pageable: bad PT page va %lx next %p\n", - pv->pv_va, pv->pv_next); + pv->pv_va, pv->pv_next); return; } #endif @@ -2000,7 +2004,7 @@ pmap_pageable(pmap, sva, eva, pageable) #ifdef DEBUG if (pmapdebug & PDB_PTPAGE) printf("pmap_pageable: PT page %lx(%x) unmodified\n", - sva, *(int *)pmap_pte(pmap, sva)); + sva, *(int *)pmap_pte(pmap, sva)); if (pmapdebug & PDB_WIRING) pmap_check_wiring("pageable", sva); #endif @@ -2172,8 +2176,8 @@ pmap_changebit(pa, bit, setem) #ifdef DEBUG if (pmapdebug & PDB_BITS) - printf("pmap_changebit(%lx, %x, %s)\n", - pa, bit, setem ? "set" : "clear"); + printf("pmap_changebit(%lx, %x, %s)\n", pa, bit, + setem ? "set" : "clear"); #endif if (!pmap_valid_page(pa)) return; @@ -2290,8 +2294,8 @@ pmap_enter_ptpage(pmap, va) PMAP_ACTIVATE(pmap, (struct pcb *)curproc->p_addr, 1); #ifdef DEBUG if (pmapdebug & (PDB_ENTER|PDB_PTPAGE|PDB_SEGTAB)) - printf("enter_pt: pmap %p stab %p(%p)\n", - pmap, pmap->pm_stab, pmap->pm_stpa); + printf("enter_pt: pmap %p stab %p(%p)\n", pmap, + pmap->pm_stab, pmap->pm_stpa); #endif } @@ -2323,7 +2327,8 @@ pmap_enter_ptpage(pmap, va) #endif #ifdef DEBUG if (pmapdebug & (PDB_ENTER|PDB_PTPAGE|PDB_SEGTAB)) - printf("enter_pt: alloc ste2 %d(%p)\n", ix, addr); + printf("enter_pt: alloc ste2 %d(%p)\n", ix, + addr); #endif } ste = pmap_ste2(pmap, va); @@ -2338,8 +2343,8 @@ pmap_enter_ptpage(pmap, va) ste = (u_int *)((int)ste & ~(NBPG / SG4_LEV3SIZE - 1)); #ifdef DEBUG if (pmapdebug & (PDB_ENTER|PDB_PTPAGE|PDB_SEGTAB)) - printf("enter_pt: ste2 %p (%p)\n", - pmap_ste2(pmap, va), ste); + printf("enter_pt: ste2 %p (%p)\n", pmap_ste2(pmap, va), + ste); #endif } #endif @@ -2387,9 +2392,9 @@ pmap_enter_ptpage(pmap, va) #ifdef DEBUG if (pmapdebug & (PDB_ENTER|PDB_PTPAGE)) printf("enter_pt: add &Sysptmap[%d]: %x (KPT page %lx)\n", - ste - pmap_ste(pmap, 0), - *(int *)&Sysptmap[ste - pmap_ste(pmap, 0)], - kpt->kpt_va); + ste - pmap_ste(pmap, 0), + *(int *)&Sysptmap[ste - pmap_ste(pmap, 0)], + kpt->kpt_va); #endif splx(s); } @@ -2447,7 +2452,8 @@ pmap_enter_ptpage(pmap, va) pv->pv_ptpmap = pmap; #ifdef DEBUG if (pmapdebug & (PDB_ENTER|PDB_PTPAGE)) - printf("enter_pt: new PT page at PA %lx, ste at %p\n", ptpa, ste); + printf("enter_pt: new PT page at PA %lx, ste at %p\n", ptpa, + ste); #endif /* @@ -2473,8 +2479,8 @@ pmap_enter_ptpage(pmap, va) if (pmap != pmap_kernel()) { #ifdef DEBUG if (pmapdebug & (PDB_ENTER|PDB_PTPAGE|PDB_SEGTAB)) - printf("enter_pt: stab %p refcnt %d\n", - pmap->pm_stab, pmap->pm_sref); + printf("enter_pt: stab %p refcnt %d\n", pmap->pm_stab, + pmap->pm_sref); #endif } /* @@ -2498,8 +2504,8 @@ pmap_pvdump(pa) printf("pa %lx", pa); for (pv = pa_to_pvh(pa); pv; pv = pv->pv_next) printf(" -> pmap %p, va %lx, ptste %p, ptpmap %p, flags %x", - pv->pv_pmap, pv->pv_va, pv->pv_ptste, pv->pv_ptpmap, - pv->pv_flags); + pv->pv_pmap, pv->pv_va, pv->pv_ptste, pv->pv_ptpmap, + pv->pv_flags); printf("\n"); } @@ -2525,7 +2531,7 @@ pmap_check_wiring(str, va) if (*pte) count++; if (entry->wired_count != count) - printf("*%s*: %lx: w%d/a%d\n", - str, va, entry->wired_count, count); + printf("*%s*: %lx: w%d/a%d\n", str, va, entry->wired_count, + count); } #endif diff --git a/sys/arch/amiga/amiga/swapgeneric.c b/sys/arch/amiga/amiga/swapgeneric.c index 61f186bf72f..4fad803d30d 100644 --- a/sys/arch/amiga/amiga/swapgeneric.c +++ b/sys/arch/amiga/amiga/swapgeneric.c @@ -1,5 +1,5 @@ -/* $OpenBSD: swapgeneric.c,v 1.6 1996/10/05 15:47:51 niklas Exp $ */ -/* $NetBSD: swapgeneric.c,v 1.24 1996/05/21 17:15:40 is Exp $ */ +/* $OpenBSD: swapgeneric.c,v 1.7 1997/01/16 09:23:28 niklas Exp $ */ +/* $NetBSD: swapgeneric.c,v 1.26 1996/10/13 03:06:40 christos Exp $ */ /* * Copyright (c) 1982, 1986 Regents of the University of California. diff --git a/sys/arch/amiga/amiga/sys_machdep.c b/sys/arch/amiga/amiga/sys_machdep.c index 459e12ca793..a1034c9551a 100644 --- a/sys/arch/amiga/amiga/sys_machdep.c +++ b/sys/arch/amiga/amiga/sys_machdep.c @@ -1,5 +1,5 @@ -/* $OpenBSD: sys_machdep.c,v 1.4 1996/08/19 00:04:15 niklas Exp $ */ -/* $NetBSD: sys_machdep.c,v 1.14.4.1 1996/05/26 16:23:34 is Exp $ */ +/* $OpenBSD: sys_machdep.c,v 1.5 1997/01/16 09:23:29 niklas Exp $ */ +/* $NetBSD: sys_machdep.c,v 1.15 1996/05/25 21:54:28 is Exp $ */ /* * Copyright (c) 1982, 1986 Regents of the University of California. diff --git a/sys/arch/amiga/amiga/trap.c b/sys/arch/amiga/amiga/trap.c index 063348ac690..48ede72e45d 100644 --- a/sys/arch/amiga/amiga/trap.c +++ b/sys/arch/amiga/amiga/trap.c @@ -1,5 +1,5 @@ -/* $OpenBSD: trap.c,v 1.7 1996/11/28 23:33:03 niklas Exp $ */ -/* $NetBSD: trap.c,v 1.47 1996/05/10 14:31:08 is Exp $ */ +/* $OpenBSD: trap.c,v 1.8 1997/01/16 09:23:30 niklas Exp $ */ +/* $NetBSD: trap.c,v 1.52 1996/11/13 06:22:20 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -481,7 +481,7 @@ trapmmufault(type, code, v, fp, p, sticks) if (type == T_MMUFLT) return; userret(p, fp->f_pc, sticks); - reutrn; + return; } #else /* use hacky 386bsd_code */ if (rv == KERN_SUCCESS) { diff --git a/sys/arch/amiga/conf/A3000 b/sys/arch/amiga/conf/A3000 deleted file mode 100644 index c08c6ebe2a3..00000000000 --- a/sys/arch/amiga/conf/A3000 +++ /dev/null @@ -1,109 +0,0 @@ -# $OpenBSD: A3000,v 1.6 1996/12/11 23:06:32 niklas Exp $ -# $NetBSD: A3000,v 1.7 1994/10/26 02:02:23 cgd Exp $ - -# -# Minimal AMIGA 3000 -# -# Author: Stephen Roznowski (sjr@zombie.ncsc.mil) -# -# This configuration file is for a multiple disk/multiple tape A3000. -# - -include "arch/amiga/conf/std.amiga" -# -# Add support for about 16 users. This variable is used to size -# various kernel structures. -# -maxusers 16 - -# -# processors this kernel should support -# -options "M68030" # support for 030 - -options TIMEZONE=300 # Set the timezone that the kernel will use -options DST=1 # Set the timezone that the kernel will use - -options FPCOPROC # Support for MC68881/MC68882 -options FPSP - -# -# Networking options -# -options INET # Basic networking support - -options FFS # Berkeley fast file system -options MFS # Memory based filesystem -options PROCFS # Process filesystem -options KERNFS # Kernel parameter filesystem -options NULLFS # Loopback filesystem - -options FIFO # FIFO operations on vnodes - -options SWAPPAGER # Pager for swap device -options DEVPAGER # Pager - -# -# Compatability options for various existing systems -# -options "COMPAT_09" # fs type binary compatability (name vs number) -options COMPAT_SUNOS # Support to run Sun-3 executables -options "COMPAT_43" # 4.3 BSD compatible system calls -#options "TCP_COMPAT_42" # Use 4.2 BSD style TCP -options "COMPAT_NOMID" # ??? - -# -# Graphics options -# -options GRF_ECS # Enhanced Chip Set -options GRF_NTSC # NTSC -options GRF_PAL # PAL -options "GRF_A2024" # Support for the A2024 - -# -# Support for System V IPC facilities. -# -options SYSVSHM # System V shared memory -options SYSVMSG # System V messages -options SYSVSEM # System V semaphores - -# -# Support for various kernel options -# -options KTRACE # Add kernel tracing system call -options DIAGNOSTIC # Add additional error checking code -options "NKMEMCLUSTERS=256" # Size of kernel malloc area -options GENERIC # Mini-root boot support - -# -# Build one kernel that can boot from any disk. -# -config bsd swap on generic - -pseudo-device view 10 # View (graphics mapping) -pseudo-device pty 16 # Pseudo-tty support -pseudo-device loop # Loopback network - -# -#The following sections describe various hardware options. -# - -# -# Devices on an Amiga 3000 -# -ahsc0 at mainbus0 # A3000 scsi -scsibus0 at ahsc0 - -# any drives on configured controllers. -sd0 at scsibus? target 0 lun 0 -sd1 at scsibus? target 1 lun 0 -sd2 at scsibus? target 2 lun 0 -sd3 at scsibus? target 3 lun 0 -sd4 at scsibus? target 4 lun 0 -sd5 at scsibus? target 5 lun 0 -sd6 at scsibus? target 6 lun 0 -st0 at scsibus? target ? lun 0 - -grfcc0 at mainbus0 -grf0 at grfcc0 -ite0 at grf0 diff --git a/sys/arch/amiga/conf/COFFEE b/sys/arch/amiga/conf/COFFEE deleted file mode 100644 index e023c49511f..00000000000 --- a/sys/arch/amiga/conf/COFFEE +++ /dev/null @@ -1,224 +0,0 @@ -# $OpenBSD: COFFEE,v 1.7 1996/12/11 23:06:33 niklas Exp $ -# $NetBSD: COFFEE,v 1.12 1995/10/09 02:08:35 chopps Exp $ - -# -# COFFEE - GENERIC but with GATEWAY and DEBUG -# -# This configuration file contains all possible options -# - -include "arch/amiga/conf/std.amiga" - -maxusers 8 -option TIMEZONE=300, DST=1 - -# -# processors this kernel should support -# -option "M68040" # support for 040 -option FPSP # MC68040 floating point support -option "M68030" # support for 030 -option "M68020" # support for 020/851 -option FPCOPROC # Support for MC6888[12] (Required) - -option SWAPPAGER # Pager for processes (Required) -option DEVPAGER # Pager for devices (Required) - -# -# Networking options -# -option INET # IP networking support (Required) -#option ISO # ISO Networking support -#option TPIP # ARGO TP networking support -#option CCITT # CCITT X.25 -#option NS # Xerox XNS -#option EON # ISO CLNL over IP -option GATEWAY # Packet forwarding -#option DIRECTED_BROADCAST # Broadcast across subnets -#option NSIP # XNS over IP - -# -# File system related options -# -option QUOTA # Disk quotas for local disks -option NFSSERVER # Network File System server side code -option NFSCLIENT # Network File System client side code - -# -# File systems -# -option FFS # Berkeley fast file system -option MFS # Memory based filesystem -option PROCFS # Process filesystem -option KERNFS # Kernel parameter filesystem (Recommended) -option FDESC # /dev/fd filesystem -option NULLFS # Loopback filesystem -option FIFO # FIFO operations on vnodes (Recommended) -option ADOSFS # AmigaDOS file system -option "CD9660" # ISO 9660 file system, with Rock Ridge -option UNION # union file system -option UMAPFS # uid/gid remapping filesystem -#option PORTAL # Portal filesystem -#option MSDOSFS # MS-DOS filesystem - - -# -# Compatability options for various existing systems -# -option "COMPAT_10" # compatability with older NetBSD release -option "COMPAT_09" # compatability with older NetBSD release -option "COMPAT_43" # 4.3 BSD compatible system calls -option COMPAT_SUNOS # Support to run Sun (m68k) executables -#option "TCP_COMPAT_42" # Use 4.2 BSD style TCP -option "COMPAT_NOMID" # allow nonvalid machine id executables -#option COMPAT_HPUX # HP300 compatability - -# -# Support for System V IPC facilities. -# -option SYSVSHM # System V-like shared memory -option SYSVMSG # System V-like messages -option SYSVSEM # System V-like semaphores - -# -# Support for various kernel options -# -option GENERIC # Mini-root boot support -option LKM # Loadable kernel modules -option KTRACE # Add kernel tracing system call -option DIAGNOSTIC # Add additional error checking code -option "NKMEMCLUSTERS=256" # Size of kernel malloc area - -# -# Misc. debuging options -# -option PANICWAIT # Require keystroke to dump/reboot -option DEBUG # Add debugging statements -option DDB # Kernel debugger -#option SYSCALL_DEBUG # debug all syscalls. -#option SCSIDEBUG # Add SCSI debugging statements -#option KGDB # Kernel debugger (KGDB) support -#option PANICBUTTON # Forced crash via keypress (???) - -# -# Amiga specific options -# -option MACHINE_NONCONTIG # Non-contiguous memory support - -option RETINACONSOLE # enable code to allow retina to be console -option ULOWELLCONSOLE # enable code to allow a2410 to be console -option CL5426CONSOLE # Cirrus console - -option GRF_ECS # Enhanced Chip Set -option GRF_NTSC # NTSC -option GRF_PAL # PAL -option "GRF_A2024" # Support for the A2024 -option GRF_AGA # AGA Chip Set -option GRF_CL5426 # Cirrus board support -#option "KFONT_8X11" # 8x11 font - -# This is how you would tell the kernel the A2410 oscillator frequencies: -# The used frequencies are the defaults, and don't need option setting -#option "ULOWELL_OSC1=36000000" -#option "ULOWELL_OSC2=66667000" - -# This is how you specify the blitting speed, higher values may speed up blits -# a littel bit. If you raise this value too much some trash may appear. -# the commented version is the default. -#option RH_MEMCLK 61000000 -# this option enables the 64 bit sprite which doesn't seems to be work -# for quite a few people. E.g. The cursor sprite will turn to a block -# when moved to the top of the screen in X. -#option RH_64BIT_SPRITE -# enables fast scroll code appears to now work on 040 systems. -#option RETINA_SPEED_HACK - -grfcc0 at mainbus0 # custom chips -grfrt0 at zbus0 # retina II -grfrh0 at zbus0 # retina III -grfcl* at zbus0 # Picasso II/Piccalo/Spectrum -grful0 at zbus0 # A2410 -grfcv0 at zbus0 # CyberVision 64 - -grf0 at grfcc0 -grf1 at grfrt0 -grf2 at grfrh0 -grf3 at grfcl? -grf4 at grful0 -grf5 at grfcv0 - -ite0 at grf0 # terminal emulators for grf's -ite1 at grf1 # terminal emulators for grf's -ite2 at grf2 # terminal emulators for grf's -ite3 at grf3 # terminal emulators for grf's -ite4 at grf4 # terminal emulators for grf's - -msc0 at zbus0 # A2232 MSC multiport serial. -mfc0 at zbus0 # MultiFaceCard I/O board -mfcs0 at mfc0 unit 0 # MFC serial -mfcs1 at mfc0 unit 1 # MFC serial -#mfcp0 at mfc0 unit 0 # MFC parallel [not available yet] -#mfc1 at zbus0 # MultiFaceCard 2nd I/O board -#mfcs2 at mfc1 unit 0 -#mfcs3 at mfc1 unit 1 -#mfcp1 at mfc1 unit 0 - -le0 at zbus0 # Lance ethernet. -ed0 at zbus0 # dp8390 ethernet -es0 at zbus0 # SMC 91C90 ethernet -qn0 at zbus0 # quicknet ethernet -ae0 at zbus0 # Ariadne ethernet -bah0 at zbus0 # C= arcnet - -# scsi stuff, all possible -gvpbus* at zbus0 -gtsc0 at gvpbus? # GVP series II scsi -ahsc0 at mainbus0 # A3000 scsi -atzsc0 at zbus0 -wstsc0 at zbus0 # Wordsync II scsi -ivsc0 at zbus0 # IVS scsi -mlhsc0 at zbus0 # Hacker scsi -otgsc0 at zbus0 # 12 gauge scsi -zssc0 at zbus0 # Zeus scsi -mgnsc0 at zbus0 # Magnum scsi -wesc0 at zbus0 # Warp Engine scsi -idesc0 at mainbus0 # A4000 & A1200 IDE -afsc0 at zbus0 # A4091 scsi -aftsc0 at mainbus0 # A4000T scsi -flsc0 at zbus0 # FastlaneZ3 scsi -bzsc0 at zbus0 # Blizzard 1230 scsi - -scsibus* at gtsc0 -scsibus* at ahsc0 -scsibus* at atzsc0 -scsibus* at wstsc0 -scsibus* at ivsc0 -scsibus* at mlhsc0 -scsibus* at otgsc0 -scsibus* at zssc0 -scsibus* at mgnsc0 -scsibus* at wesc0 -scsibus* at idesc0 -scsibus* at afsc0 -scsibus* at aftsc0 -scsibus* at flsc0 -scsibus* at bzsc0 - -# each hard drive from low target to high -# will configure to the next available sd unit number -sd* at scsibus? target ? lun ? # scsi disks - -st* at scsibus? target ? lun ? # scsi tapes -cd* at scsibus? target ? lun ? # scsi cd's - -pseudo-device ccd 4 # concat disks -pseudo-device sl # slip -pseudo-device ppp # ppp -pseudo-device view 10 # views -pseudo-device pty 16 # pseudo terminals -pseudo-device loop # network loopback -pseudo-device bpfilter 12 # berkeley packet filters -pseudo-device tun 2 -pseudo-device vnd 3 # 3 pseudo disks (see vnconfig) - -config bsd swap on generic diff --git a/sys/arch/amiga/conf/CRASH b/sys/arch/amiga/conf/CRASH index 0b5f536eb0f..3ee26dc0580 100644 --- a/sys/arch/amiga/conf/CRASH +++ b/sys/arch/amiga/conf/CRASH @@ -1,4 +1,4 @@ -# $OpenBSD: CRASH,v 1.6 1996/12/11 23:06:33 niklas Exp $ +# $OpenBSD: CRASH,v 1.7 1997/01/16 09:23:34 niklas Exp $ # # The first OpenBSD/Amiga "user" Neil Brewitt's GG2 + NE2000 equipped A3000 @@ -21,7 +21,6 @@ option "M68030" # support for 030 option FPCOPROC # Support for MC6888[12] (Required) option SWAPPAGER # Pager for processes (Required) -option VNODEPAGER # Pager for vnodes (Required) option DEVPAGER # Pager for devices (Required) # diff --git a/sys/arch/amiga/conf/DRACO b/sys/arch/amiga/conf/DRACO index d6cf4cee56b..96ed319e665 100644 --- a/sys/arch/amiga/conf/DRACO +++ b/sys/arch/amiga/conf/DRACO @@ -1,5 +1,5 @@ -# $OpenBSD: DRACO,v 1.7 1996/12/11 23:06:34 niklas Exp $ -# $NetBSD: DRACO,v 1.2.4.2 1996/09/06 00:28:31 jtc Exp $ +# $OpenBSD: DRACO,v 1.8 1997/01/16 09:23:35 niklas Exp $ +# $NetBSD: DRACO,v 1.7 1996/12/20 19:18:16 veego Exp $ # # Macro System GmbH "DraCo", currently 68060-only until FPE is integrated. @@ -24,10 +24,6 @@ option "M68060" # support for 060 option "M060SP" # MC68060 software support (Required for 060) option FPCOPROC # Support for MC6888[12] (Required) -# -# pagers: -# - option SWAPPAGER # Pager for processes (Required) option DEVPAGER # Pager for devices (Required) @@ -70,7 +66,7 @@ option MSDOSFS # MS-DOS filesystem # # Compatability options for various existing systems # -#option "COMPAT_10" # compatability with older NetBSD release +option COMPAT_12 #option COMPAT_SUNOS # Support to run Sun (m68k) executables #option "TCP_COMPAT_42" # Use 4.2 BSD style TCP option "COMPAT_NOMID" # allow nonvalid machine id executables @@ -95,7 +91,6 @@ option "NKMEMCLUSTERS=256" # Size of kernel malloc area # # Misc. debuging options # -option PANICWAIT # Require keystroke to dump/reboot option DEBUG # Add debugging statements option DDB # Kernel debugger #option SYSCALL_DEBUG # debug all syscalls. @@ -156,8 +151,10 @@ scsibus* at drsc0 # will configure to the next available sd unit number sd* at scsibus? target ? lun ? # scsi disks st* at scsibus? target ? lun ? # scsi tapes -ss* at scsibus? target ? lun ? # scsi scanner cd* at scsibus? target ? lun ? # scsi cd's +ss* at scsibus? target ? lun ? # scsi scanner +ch* at scsibus? target ? lun ? # scsi autochangers +uk* at scsibus? target ? lun ? # scsi unknown pseudo-device pty 16 # pseudo terminals pseudo-device loop # network loopback diff --git a/sys/arch/amiga/conf/FILIPPA b/sys/arch/amiga/conf/FILIPPA index 28c51c2c53d..4a1d7239ac2 100644 --- a/sys/arch/amiga/conf/FILIPPA +++ b/sys/arch/amiga/conf/FILIPPA @@ -1,4 +1,4 @@ -# $OpenBSD: FILIPPA,v 1.13 1997/01/04 12:45:45 niklas Exp $ +# $OpenBSD: FILIPPA,v 1.14 1997/01/16 09:23:36 niklas Exp $ # # Niklas' AMIGA with ISA support @@ -18,8 +18,8 @@ option FPSP # MC68040 floating point support #option "M68020" # support for 020/851 option FPCOPROC # Support for MC6888[12] (Required) -option SWAPPAGER # Pager for processes (Required) -option DEVPAGER # Pager for devices (Required) +option SWAPPAGER +option DEVPAGER # # Networking option diff --git a/sys/arch/amiga/conf/GENERIC b/sys/arch/amiga/conf/GENERIC index 324027289c7..fbf5e425fd7 100644 --- a/sys/arch/amiga/conf/GENERIC +++ b/sys/arch/amiga/conf/GENERIC @@ -1,5 +1,5 @@ -# $OpenBSD: GENERIC,v 1.17 1997/01/05 02:08:05 niklas Exp $ -# $NetBSD: GENERIC,v 1.57.4.4 1996/09/06 00:34:18 jtc Exp $ +# $OpenBSD: GENERIC,v 1.18 1997/01/16 09:23:37 niklas Exp $ +# $NetBSD: GENERIC,v 1.67 1997/01/07 11:35:04 mrg Exp $ # # GENERIC AMIGA @@ -52,13 +52,14 @@ option "NKMEMCLUSTERS=256" # Size of kernel malloc area #option DEBUG # Add debugging statements #option SYSCALL_DEBUG # debug all syscalls. #option SCSIDEBUG # Add SCSI debugging statements -#option KGDB # Kernel debugger (KGDB) support #option PANICBUTTON # Forced crash via keypress (???) # # Amiga specific options # option MACHINE_NONCONTIG # Non-contiguous memory support +# ATTENTION: There is NO WARRANTY AT ALL that the sync will be complete +# before the 10 secondinterval ends, or that KBDRESET does work at all. #option KBDRESET # sync on Ctrl-Amiga-Amiga # These options improve performance with the built-in serial port @@ -158,7 +159,8 @@ idesc0 at mainbus0 # A4000 & A1200 IDE afsc0 at zbus0 # A4091 scsi aftsc0 at mainbus0 # A4000T scsi flsc0 at zbus0 # FastlaneZ3 scsi -bzsc0 at zbus0 # Blizzard 1230 scsi +bzsc0 at zbus0 # Blizzard 1230 I,II scsi +bztzsc0 at zbus0 # Blizzard 1230 IV / 1260 / 2060 empsc0 at zbus0 # Emplant drsc0 at mainbus0 # DraCo scsi @@ -177,6 +179,7 @@ scsibus* at afsc0 scsibus* at aftsc0 scsibus* at flsc0 scsibus* at bzsc0 +scsibus* at bztzsc0 scsibus* at empsc0 scsibus* at drsc0 @@ -185,9 +188,9 @@ scsibus* at drsc0 sd* at scsibus? target ? lun ? # scsi disks st* at scsibus? target ? lun ? # scsi tapes cd* at scsibus? target ? lun ? # scsi cd's -ch* at scsibus? target ? lun ? # scsi cd changers ss* at scsibus? target ? lun ? # scsi scanners -uk* at scsibus? target ? lun ? # unknown scsi +ch* at scsibus? target ? lun ? # scsi autochangers +uk* at scsibus? target ? lun ? # scsi unknown ggbus* at zbus0 # Goldengate bridge isa* at ggbus? diff --git a/sys/arch/amiga/conf/Makefile.amiga b/sys/arch/amiga/conf/Makefile.amiga index fe2384e4bee..7f3194d98e3 100644 --- a/sys/arch/amiga/conf/Makefile.amiga +++ b/sys/arch/amiga/conf/Makefile.amiga @@ -1,5 +1,5 @@ -# $OpenBSD: Makefile.amiga,v 1.16 1996/08/19 00:15:51 niklas Exp $ -# $NetBSD: Makefile.amiga,v 1.45 1996/05/16 17:07:08 is Exp $ +# $OpenBSD: Makefile.amiga,v 1.17 1997/01/16 09:23:38 niklas Exp $ +# $NetBSD: Makefile.amiga,v 1.52 1996/12/01 12:10:07 veego Exp $ # Makefile for OpenBSD # @@ -22,32 +22,40 @@ # DEBUG is set to -g if debugging. # PROF is set to -pg if profiling. -AS?= as CC?= cc -CPP?= cpp LD?= ld -STRIP?= strip -d +MKDEP?= mkdep +STRIP?= strip TOUCH?= touch -f -c +COPTS?= -O2 # source tree is located via $S relative to the compilation directory -S= ../../../.. -AMIGA= ../.. +.ifndef S +S!= cd ../../../..; pwd +.endif +AMIGA= $S/arch/amiga -INCLUDES= -I. -I$S/arch -I$S -CPPFLAGS= ${INCLUDES} ${IDENT} -D_KERNEL -Dmc68020 -Damiga +INCLUDES= -I. -I$S/arch -I$S -nostdinc +CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -Dmc68020 -Damiga -CDIAGFLAGS= -Werror -Wall -Wstrict-prototypes -Wno-uninitialized \ +CWARNFLAGS= -Werror -Wall -Wstrict-prototypes -Wno-uninitialized \ -Wno-format .if empty(IDENT:M-DM68060) -CMACHFLAGS= -m68020 -msoft-float +CMACHFLAGS= -m68020 .else -CMACHFLAGS= -m68060 -Wa,-m68030 -msoft-float +CMACHFLAGS= -m68060 -Wa,-m68030 .endif +CMACHFLAGS+= -msoft-float -CFLAGS= ${DEBUG} -O2 ${CDIAGFLAGS} ${CMACHFLAGS} ${COPTS} +CFLAGS= ${DEBUG} ${CWARNFLAGS} ${COPTS} ${CMACHFLAGS} AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE LINKFLAGS= -n -Ttext 0 -e start +STRIPFLAGS= -d + +HOSTCC?= ${CC} +HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} +HOSTED_CFLAGS= ${CFLAGS} ### find out what to use for libkern .include "$S/lib/libkern/Makefile.inc" @@ -71,14 +79,14 @@ LIBCOMPAT= ${COMPATLIB_PROF} ### for the Motorola 68060 Software Support Package .include "$S/arch/m68k/060sp/Makefile.inc" -# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP} -# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix, -# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file -# is marked as config-dependent. +# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or +# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file). NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< NORMAL_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $< +HOSTED_C= ${HOSTCC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $< + DRIVER_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< DRIVER_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $< @@ -115,9 +123,9 @@ DEBUG?= LINKFLAGS+= -X SYSTEM_LD_TAIL+=; \ echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \ - echo ${STRIP} $@; ${STRIP} $@ + echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@ .else -LINKFLAGS+= -x +LINKFLAGS+= -S .endif %LOAD @@ -126,17 +134,17 @@ assym.h: genassym ./genassym >assym.h genassym: genassym.o - ${CC} -o $@ genassym.o + ${HOSTCC} -o $@ genassym.o genassym.o: ${AMIGA}/amiga/genassym.c - ${NORMAL_C_C} + ${HOSTED_C} param.c: $S/conf/param.c rm -f param.c cp $S/conf/param.c . param.o: param.c Makefile - ${NORMAL_C_C} + ${NORMAL_C} ioconf.o: ioconf.c ${NORMAL_C} @@ -151,7 +159,7 @@ clean:: [Ee]rrs linterrs makelinks genassym genassym.o assym.h lint: - @lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} ${PARAM} -UKGDB \ + @lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} -UKGDB \ ${AMIGA}/amiga/Locore.c ${CFILES} ${AMIGA}/amiga/swapgeneric.c \ ioconf.c param.c | \ grep -v 'static function .* unused' @@ -171,10 +179,11 @@ SRCS= ${AMIGA}/amiga/locore.s \ param.c ioconf.c ${CFILES} ${SFILES} depend:: .depend .depend: ${SRCS} assym.h param.c - mkdep ${AFLAGS} ${CPPFLAGS} ${AMIGA}/amiga/locore.s - mkdep -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} - mkdep -a ${AFLAGS} ${CPPFLAGS} ${SFILES} - mkdep -a ${CFLAGS} ${CPPFLAGS} ${PARAM} ${AMIGA}/amiga/genassym.c + ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${AMIGA}/amiga/locore.s + ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} + ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES} + ${MKDEP} -a ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} \ + ${AMIGA}/amiga/genassym.c # depend on root or device configuration diff --git a/sys/arch/amiga/conf/files.amiga b/sys/arch/amiga/conf/files.amiga index f32d9764aee..505a5884eb4 100644 --- a/sys/arch/amiga/conf/files.amiga +++ b/sys/arch/amiga/conf/files.amiga @@ -1,5 +1,5 @@ -# $OpenBSD: files.amiga,v 1.18 1996/08/19 06:57:02 niklas Exp $ -# $NetBSD: files.amiga,v 1.48 1996/05/19 21:04:50 veego Exp $ +# $OpenBSD: files.amiga,v 1.19 1997/01/16 09:23:39 niklas Exp $ +# $NetBSD: files.amiga,v 1.51 1996/12/16 16:17:31 is Exp $ # maxpartitions must be first item in files.${ARCH} maxpartitions 16 # NOTE THAT AMIGA IS SPECIAL! @@ -160,6 +160,11 @@ device mfcp attach mfcp at mfc file arch/amiga/dev/mfc.c mfcs | mfcp needs-count +# DraCo internal com port +device drcom: tty +attach drcom at mainbus +file arch/amiga/dev/drcom.c drcom needs-count + include "../../../scsi/files.scsi" # wd 33c93 controllers @@ -251,11 +256,16 @@ device flsc: scsi, sfas attach flsc at zbus file arch/amiga/dev/flsc.c flsc needs-flag -# Blizzard1230 +# Blizzard1230-I,II device bzsc: scsi, sfas attach bzsc at zbus file arch/amiga/dev/bzsc.c bzsc needs-flag +# Blizzard2060 scsi +device bztzsc: scsi, sfas +attach bztzsc at zbus +file arch/amiga/dev/bztzsc.c bztzsc needs-flag + # Amiga 4000/1200 IDE masquerading as SCSI device idesc: scsi attach idesc at mainbus diff --git a/sys/arch/amiga/conf/std.amiga b/sys/arch/amiga/conf/std.amiga index 8840cf9a9b5..e109d2107f2 100644 --- a/sys/arch/amiga/conf/std.amiga +++ b/sys/arch/amiga/conf/std.amiga @@ -1,5 +1,5 @@ -# $OpenBSD: std.amiga,v 1.3 1996/05/29 10:14:46 niklas Exp $ -# $NetBSD: std.amiga,v 1.8 1996/05/09 20:31:03 is Exp $ +# $OpenBSD: std.amiga,v 1.4 1997/01/16 09:23:40 niklas Exp $ +# $NetBSD: std.amiga,v 1.10 1996/12/20 19:15:06 veego Exp $ # standard amiga information @@ -15,3 +15,6 @@ ms* at mainbus0 fdc0 at mainbus0 fd* at fdc0 unit ? zbus0 at mainbus0 + +#options SWAPPAGER # paging +#options DEVPAGER # mmap() of devices diff --git a/sys/arch/amiga/conf/std.draco b/sys/arch/amiga/conf/std.draco index a82c2881ef2..8a1031023c7 100644 --- a/sys/arch/amiga/conf/std.draco +++ b/sys/arch/amiga/conf/std.draco @@ -1,7 +1,7 @@ -# $OpenBSD: std.draco,v 1.2 1996/10/04 15:05:40 niklas Exp $ -# $NetBSD: std.draco,v 1.1 1996/05/09 20:31:04 is Exp $ +# $OpenBSD: std.draco,v 1.3 1997/01/16 09:23:41 niklas Exp $ +# $NetBSD: std.draco,v 1.2 1996/12/20 19:15:07 veego Exp $ -# standard amiga information +# standard DraCo information machine amiga m68k @@ -10,3 +10,6 @@ mainbus0 at root clock0 at mainbus0 kbd0 at mainbus0 zbus0 at mainbus0 + +#options SWAPPAGER # paging +#options DEVPAGER # mmap() of devices 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 #include -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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +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/bztzscreg.h b/sys/arch/amiga/dev/bztzscreg.h new file mode 100644 index 00000000000..ad0528552ac --- /dev/null +++ b/sys/arch/amiga/dev/bztzscreg.h @@ -0,0 +1,55 @@ +/* $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 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. + */ + +/* + * Blizzard 2060 with FAS216 SCSI interface hardware + * description. + */ + +#ifndef _BZTZSCREG_H_ +#define _BZTZSCREG_H_ + +#ifndef _SFASREG_H_ +#include +#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 +#endif + +#ifndef _BZTZSCREG_H_ +#include +#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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include +#include + +#include +#include +#include + +#include + +#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 +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 + +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 +#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 #endif +#ifdef NS +#include +#include +#endif + +#if defined(CCITT) && defined(LLC) +#include +#include +#include +#include +#include +#include +#include +#include +#include +#endif + #if NBPFILTER > 0 #include #include @@ -968,6 +985,22 @@ aeioctl(ifp, cmd, data) aeinit(sc); 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); @@ -975,6 +1008,16 @@ aeioctl(ifp, cmd, data) } 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 #endif +#ifdef NS +#include +#include +#endif + #if NBPFILTER > 0 #include #include @@ -885,6 +890,24 @@ ed_ioctl(ifp, command, data) ed_init(sc); 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); 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 #endif +#ifdef NS +#include +#include +#endif + #include #include #include @@ -983,6 +988,23 @@ esioctl(ifp, command, data) esinit(sc); 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); 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 #endif +#ifdef NS +#include +#include +#endif + #include #include #include @@ -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", @@ -889,6 +895,23 @@ qnioctl(ifp, command, data) qninit(sc); 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"); 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 . + * Copyright (c) 1995 Jukka Marin . * Copyright (c) 1995 Timo Rossi . * Copyright (c) 1995 Rob Healey . * Copyright (c) 1982, 1986, 1990 The Regents of the University of California. @@ -49,6 +49,7 @@ * Integrated more bug fixes by Jukka Marin 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 . + * Copyright (c) 1995 Jukka Marin . * 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, 0x74, 0xF0, 0x0A, 0xC5, - 0x76, 0xF0, 0x09, 0x85, 0x76, 0xA9, 0x40, 0x85, - 0x75, 0x4C, 0xBB, 0x39, 0xC6, 0x75, 0x10, 0xF9, - 0x85, 0x74, 0xA5, 0x74, 0x29, 0x01, 0x45, 0x0D, - 0xF0, 0x1D, 0xA6, 0x00, 0xE8, 0xE4, 0x01, 0xF0, - 0x16, 0xCA, 0xA0, 0x02, 0x45, 0x0D, 0x85, 0x0D, - 0xF0, 0x02, 0xA0, 0x03, 0xA9, 0x01, 0x9D, 0x00, - 0x10, 0x98, 0x9D, 0x00, 0x09, 0xE6, 0x00, 0xA5, - 0x74, 0x29, 0x02, 0x45, 0x1D, 0xF0, 0x1D, 0xA6, - 0x10, 0xE8, 0xE4, 0x11, 0xF0, 0x16, 0xCA, 0xA0, - 0x02, 0x45, 0x1D, 0x85, 0x1D, 0xF0, 0x02, 0xA0, - 0x03, 0xA9, 0x01, 0x9D, 0x00, 0x11, 0x98, 0x9D, - 0x00, 0x0A, 0xE6, 0x10, 0xA5, 0x74, 0x29, 0x04, - 0x45, 0x2D, 0xF0, 0x1D, 0xA6, 0x20, 0xE8, 0xE4, - 0x21, 0xF0, 0x16, 0xCA, 0xA0, 0x02, 0x45, 0x2D, - 0x85, 0x2D, 0xF0, 0x02, 0xA0, 0x03, 0xA9, 0x01, - 0x9D, 0x00, 0x12, 0x98, 0x9D, 0x00, 0x0B, 0xE6, - 0x20, 0xA5, 0x74, 0x29, 0x08, 0x45, 0x3D, 0xF0, - 0x1D, 0xA6, 0x30, 0xE8, 0xE4, 0x31, 0xF0, 0x16, - 0xCA, 0xA0, 0x02, 0x45, 0x3D, 0x85, 0x3D, 0xF0, - 0x02, 0xA0, 0x03, 0xA9, 0x01, 0x9D, 0x00, 0x13, - 0x98, 0x9D, 0x00, 0x0C, 0xE6, 0x30, 0xA5, 0x74, - 0x29, 0x10, 0x45, 0x4D, 0xF0, 0x1D, 0xA6, 0x40, - 0xE8, 0xE4, 0x41, 0xF0, 0x16, 0xCA, 0xA0, 0x02, - 0x45, 0x4D, 0x85, 0x4D, 0xF0, 0x02, 0xA0, 0x03, - 0xA9, 0x01, 0x9D, 0x00, 0x14, 0x98, 0x9D, 0x00, - 0x0D, 0xE6, 0x40, 0xA5, 0x74, 0x29, 0x20, 0x45, - 0x5D, 0xF0, 0x1D, 0xA6, 0x50, 0xE8, 0xE4, 0x51, - 0xF0, 0x16, 0xCA, 0xA0, 0x02, 0x45, 0x5D, 0x85, - 0x5D, 0xF0, 0x02, 0xA0, 0x03, 0xA9, 0x01, 0x9D, - 0x00, 0x15, 0x98, 0x9D, 0x00, 0x0E, 0xE6, 0x50, - 0xA5, 0x74, 0x29, 0x40, 0x45, 0x6D, 0xF0, 0x1D, - 0xA6, 0x60, 0xE8, 0xE4, 0x61, 0xF0, 0x16, 0xCA, - 0xA0, 0x02, 0x45, 0x6D, 0x85, 0x6D, 0xF0, 0x02, - 0xA0, 0x03, 0xA9, 0x01, 0x9D, 0x00, 0x16, 0x98, - 0x9D, 0x00, 0x0F, 0xE6, 0x60, 0x20, 0x26, 0x3B, - 0xA5, 0x09, 0xF0, 0x0F, 0xA5, 0x0C, 0x85, 0x0E, - 0xA5, 0x0A, 0x09, 0x10, 0x8D, 0x06, 0x44, 0x64, - 0x04, 0x64, 0x09, 0xA5, 0x00, 0xE5, 0x01, 0xC9, - 0xC8, 0xA5, 0x0B, 0x29, 0xF3, 0xB0, 0x02, 0x09, - 0x08, 0x8D, 0x04, 0x44, 0xA5, 0x08, 0xF0, 0x08, - 0xA5, 0x05, 0x85, 0x06, 0x64, 0x04, 0x64, 0x08, - 0x20, 0x26, 0x3B, 0xA5, 0x19, 0xF0, 0x0F, 0xA5, - 0x1C, 0x85, 0x1E, 0xA5, 0x1A, 0x09, 0x10, 0x8D, - 0x06, 0x4C, 0x64, 0x14, 0x64, 0x19, 0xA5, 0x10, - 0xE5, 0x11, 0xC9, 0xC8, 0xA5, 0x1B, 0x29, 0xF3, - 0xB0, 0x02, 0x09, 0x08, 0x8D, 0x04, 0x4C, 0xA5, - 0x18, 0xF0, 0x08, 0xA5, 0x15, 0x85, 0x16, 0x64, - 0x14, 0x64, 0x18, 0x20, 0x26, 0x3B, 0xA5, 0x29, - 0xF0, 0x0F, 0xA5, 0x2C, 0x85, 0x2E, 0xA5, 0x2A, - 0x09, 0x10, 0x8D, 0x06, 0x54, 0x64, 0x24, 0x64, - 0x29, 0xA5, 0x20, 0xE5, 0x21, 0xC9, 0xC8, 0xA5, - 0x2B, 0x29, 0xF3, 0xB0, 0x02, 0x09, 0x08, 0x8D, - 0x04, 0x54, 0xA5, 0x28, 0xF0, 0x08, 0xA5, 0x25, - 0x85, 0x26, 0x64, 0x24, 0x64, 0x28, 0x20, 0x26, - 0x3B, 0xA5, 0x39, 0xF0, 0x0F, 0xA5, 0x3C, 0x85, - 0x3E, 0xA5, 0x3A, 0x09, 0x10, 0x8D, 0x06, 0x5C, - 0x64, 0x34, 0x64, 0x39, 0xA5, 0x30, 0xE5, 0x31, - 0xC9, 0xC8, 0xA5, 0x3B, 0x29, 0xF3, 0xB0, 0x02, - 0x09, 0x08, 0x8D, 0x04, 0x5C, 0xA5, 0x38, 0xF0, - 0x08, 0xA5, 0x35, 0x85, 0x36, 0x64, 0x34, 0x64, - 0x38, 0x20, 0x26, 0x3B, 0xA5, 0x49, 0xF0, 0x0F, - 0xA5, 0x4C, 0x85, 0x4E, 0xA5, 0x4A, 0x09, 0x10, - 0x8D, 0x06, 0x64, 0x64, 0x44, 0x64, 0x49, 0xA5, - 0x40, 0xE5, 0x41, 0xC9, 0xC8, 0xA5, 0x4B, 0x29, - 0xF3, 0xB0, 0x02, 0x09, 0x08, 0x8D, 0x04, 0x64, - 0xA5, 0x48, 0xF0, 0x08, 0xA5, 0x45, 0x85, 0x46, - 0x64, 0x44, 0x64, 0x48, 0x20, 0x26, 0x3B, 0xA5, - 0x59, 0xF0, 0x0F, 0xA5, 0x5C, 0x85, 0x5E, 0xA5, - 0x5A, 0x09, 0x10, 0x8D, 0x06, 0x6C, 0x64, 0x54, - 0x64, 0x59, 0xA5, 0x50, 0xE5, 0x51, 0xC9, 0xC8, - 0xA5, 0x5B, 0x29, 0xF3, 0xB0, 0x02, 0x09, 0x08, - 0x8D, 0x04, 0x6C, 0xA5, 0x58, 0xF0, 0x08, 0xA5, - 0x55, 0x85, 0x56, 0x64, 0x54, 0x64, 0x58, 0x20, - 0x26, 0x3B, 0xA5, 0x69, 0xF0, 0x0F, 0xA5, 0x6C, - 0x85, 0x6E, 0xA5, 0x6A, 0x09, 0x10, 0x8D, 0x06, - 0x74, 0x64, 0x64, 0x64, 0x69, 0xA5, 0x60, 0xE5, - 0x61, 0xC9, 0xC8, 0xA5, 0x6B, 0x29, 0xF3, 0xB0, - 0x02, 0x09, 0x08, 0x8D, 0x04, 0x74, 0xA5, 0x68, - 0xF0, 0x08, 0xA5, 0x65, 0x85, 0x66, 0x64, 0x64, - 0x64, 0x68, 0x20, 0x26, 0x3B, 0x4C, 0x9E, 0x38, - 0xAD, 0x02, 0x44, 0x89, 0x08, 0xF0, 0x3B, 0x89, - 0x02, 0xF0, 0x1B, 0xAD, 0x00, 0x44, 0xD0, 0x32, - 0xA6, 0x00, 0xA9, 0x01, 0x9D, 0x00, 0x10, 0xA9, - 0x01, 0x9D, 0x00, 0x09, 0xE8, 0xE4, 0x01, 0xF0, - 0x02, 0x86, 0x00, 0x4C, 0x68, 0x3B, 0xA6, 0x00, - 0xAD, 0x00, 0x44, 0x9D, 0x00, 0x09, 0x9E, 0x00, - 0x10, 0xE8, 0xE4, 0x01, 0xF0, 0x02, 0x86, 0x00, - 0x29, 0x7F, 0xC9, 0x13, 0xD0, 0x04, 0xA5, 0x0E, - 0x85, 0x04, 0xAD, 0x02, 0x44, 0x29, 0x10, 0xF0, - 0x2C, 0xA6, 0x07, 0xF0, 0x0F, 0xAD, 0x02, 0x7C, - 0x29, 0x01, 0xD0, 0x21, 0x8E, 0x00, 0x44, 0x64, - 0x07, 0x4C, 0x9B, 0x3B, 0xA6, 0x06, 0xE4, 0x05, - 0xF0, 0x13, 0xA5, 0x04, 0xD0, 0x0F, 0xAD, 0x02, - 0x7C, 0x29, 0x01, 0xD0, 0x08, 0xBD, 0x00, 0x02, - 0x8D, 0x00, 0x44, 0xE6, 0x06, 0xAD, 0x02, 0x4C, + 0xA9, 0x00, 0xA0, 0x54, 0x95, 0x00, 0xE8, 0x88, + 0xD0, 0xFA, 0x64, 0x5C, 0x64, 0x5E, 0x64, 0x58, + 0x64, 0x59, 0xA9, 0x00, 0x85, 0x55, 0xA9, 0xAA, + 0xC9, 0x64, 0x90, 0x02, 0xE6, 0x55, 0xA5, 0x54, + 0xF0, 0x03, 0x4C, 0x92, 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, 0x57, 0xAD, 0x0A, 0x7C, 0x85, + 0x56, 0xC9, 0xD0, 0x90, 0x05, 0xA9, 0x02, 0x4C, + 0x82, 0x38, 0xA9, 0x01, 0x85, 0x54, 0xA9, 0x00, + 0x8D, 0x02, 0x44, 0x8D, 0x06, 0x44, 0x8D, 0x04, + 0x44, 0x4C, 0x92, 0x38, 0xAD, 0x00, 0x7C, 0xC5, + 0x5C, 0xF0, 0x1F, 0xC5, 0x5E, 0xF0, 0x09, 0x85, + 0x5E, 0xA9, 0x40, 0x85, 0x5D, 0x4C, 0xB8, 0x38, + 0xC6, 0x5D, 0x10, 0x0E, 0xA6, 0x58, 0x9D, 0x00, + 0x17, 0xE8, 0xE4, 0x59, 0xF0, 0x04, 0x86, 0x58, + 0x85, 0x5C, 0x20, 0x23, 0x3A, 0xA5, 0x07, 0xF0, + 0x0F, 0xA5, 0x0A, 0x85, 0x0B, 0xA5, 0x08, 0x09, + 0x10, 0x8D, 0x06, 0x44, 0x64, 0x02, 0x64, 0x07, + 0xA5, 0x00, 0xE5, 0x01, 0xC9, 0xC8, 0xA5, 0x09, + 0x29, 0xF3, 0xB0, 0x02, 0x09, 0x08, 0x8D, 0x04, + 0x44, 0xA5, 0x06, 0xF0, 0x08, 0xA5, 0x03, 0x85, + 0x04, 0x64, 0x02, 0x64, 0x06, 0x20, 0x23, 0x3A, + 0xA5, 0x13, 0xF0, 0x0F, 0xA5, 0x16, 0x85, 0x17, + 0xA5, 0x14, 0x09, 0x10, 0x8D, 0x06, 0x4C, 0x64, + 0x0E, 0x64, 0x13, 0xA5, 0x0C, 0xE5, 0x0D, 0xC9, + 0xC8, 0xA5, 0x15, 0x29, 0xF3, 0xB0, 0x02, 0x09, + 0x08, 0x8D, 0x04, 0x4C, 0xA5, 0x12, 0xF0, 0x08, + 0xA5, 0x0F, 0x85, 0x10, 0x64, 0x0E, 0x64, 0x12, + 0x20, 0x23, 0x3A, 0xA5, 0x1F, 0xF0, 0x0F, 0xA5, + 0x22, 0x85, 0x23, 0xA5, 0x20, 0x09, 0x10, 0x8D, + 0x06, 0x54, 0x64, 0x1A, 0x64, 0x1F, 0xA5, 0x18, + 0xE5, 0x19, 0xC9, 0xC8, 0xA5, 0x21, 0x29, 0xF3, + 0xB0, 0x02, 0x09, 0x08, 0x8D, 0x04, 0x54, 0xA5, + 0x1E, 0xF0, 0x08, 0xA5, 0x1B, 0x85, 0x1C, 0x64, + 0x1A, 0x64, 0x1E, 0x20, 0x23, 0x3A, 0xA5, 0x2B, + 0xF0, 0x0F, 0xA5, 0x2E, 0x85, 0x2F, 0xA5, 0x2C, + 0x09, 0x10, 0x8D, 0x06, 0x5C, 0x64, 0x26, 0x64, + 0x2B, 0xA5, 0x24, 0xE5, 0x25, 0xC9, 0xC8, 0xA5, + 0x2D, 0x29, 0xF3, 0xB0, 0x02, 0x09, 0x08, 0x8D, + 0x04, 0x5C, 0xA5, 0x2A, 0xF0, 0x08, 0xA5, 0x27, + 0x85, 0x28, 0x64, 0x26, 0x64, 0x2A, 0x20, 0x23, + 0x3A, 0xA5, 0x37, 0xF0, 0x0F, 0xA5, 0x3A, 0x85, + 0x3B, 0xA5, 0x38, 0x09, 0x10, 0x8D, 0x06, 0x64, + 0x64, 0x32, 0x64, 0x37, 0xA5, 0x30, 0xE5, 0x31, + 0xC9, 0xC8, 0xA5, 0x39, 0x29, 0xF3, 0xB0, 0x02, + 0x09, 0x08, 0x8D, 0x04, 0x64, 0xA5, 0x36, 0xF0, + 0x08, 0xA5, 0x33, 0x85, 0x34, 0x64, 0x32, 0x64, + 0x36, 0x20, 0x23, 0x3A, 0xA5, 0x43, 0xF0, 0x0F, + 0xA5, 0x46, 0x85, 0x47, 0xA5, 0x44, 0x09, 0x10, + 0x8D, 0x06, 0x6C, 0x64, 0x3E, 0x64, 0x43, 0xA5, + 0x3C, 0xE5, 0x3D, 0xC9, 0xC8, 0xA5, 0x45, 0x29, + 0xF3, 0xB0, 0x02, 0x09, 0x08, 0x8D, 0x04, 0x6C, + 0xA5, 0x42, 0xF0, 0x08, 0xA5, 0x3F, 0x85, 0x40, + 0x64, 0x3E, 0x64, 0x42, 0x20, 0x23, 0x3A, 0xA5, + 0x4F, 0xF0, 0x0F, 0xA5, 0x52, 0x85, 0x53, 0xA5, + 0x50, 0x09, 0x10, 0x8D, 0x06, 0x74, 0x64, 0x4A, + 0x64, 0x4F, 0xA5, 0x48, 0xE5, 0x49, 0xC9, 0xC8, + 0xA5, 0x51, 0x29, 0xF3, 0xB0, 0x02, 0x09, 0x08, + 0x8D, 0x04, 0x74, 0xA5, 0x4E, 0xF0, 0x08, 0xA5, + 0x4B, 0x85, 0x4C, 0x64, 0x4A, 0x64, 0x4E, 0x20, + 0x23, 0x3A, 0x4C, 0x92, 0x38, 0xAD, 0x02, 0x44, 0x89, 0x08, 0xF0, 0x3B, 0x89, 0x02, 0xF0, 0x1B, - 0xAD, 0x00, 0x4C, 0xD0, 0x32, 0xA6, 0x10, 0xA9, - 0x01, 0x9D, 0x00, 0x11, 0xA9, 0x01, 0x9D, 0x00, - 0x0A, 0xE8, 0xE4, 0x11, 0xF0, 0x02, 0x86, 0x10, - 0x4C, 0xDD, 0x3B, 0xA6, 0x10, 0xAD, 0x00, 0x4C, - 0x9D, 0x00, 0x0A, 0x9E, 0x00, 0x11, 0xE8, 0xE4, - 0x11, 0xF0, 0x02, 0x86, 0x10, 0x29, 0x7F, 0xC9, - 0x13, 0xD0, 0x04, 0xA5, 0x1E, 0x85, 0x14, 0xAD, - 0x02, 0x4C, 0x29, 0x10, 0xF0, 0x2C, 0xA6, 0x17, - 0xF0, 0x0F, 0xAD, 0x02, 0x7C, 0x29, 0x02, 0xD0, - 0x21, 0x8E, 0x00, 0x4C, 0x64, 0x17, 0x4C, 0x10, - 0x3C, 0xA6, 0x16, 0xE4, 0x15, 0xF0, 0x13, 0xA5, - 0x14, 0xD0, 0x0F, 0xAD, 0x02, 0x7C, 0x29, 0x02, - 0xD0, 0x08, 0xBD, 0x00, 0x03, 0x8D, 0x00, 0x4C, - 0xE6, 0x16, 0xAD, 0x02, 0x54, 0x89, 0x08, 0xF0, - 0x3B, 0x89, 0x02, 0xF0, 0x1B, 0xAD, 0x00, 0x54, - 0xD0, 0x32, 0xA6, 0x20, 0xA9, 0x01, 0x9D, 0x00, - 0x12, 0xA9, 0x01, 0x9D, 0x00, 0x0B, 0xE8, 0xE4, - 0x21, 0xF0, 0x02, 0x86, 0x20, 0x4C, 0x52, 0x3C, - 0xA6, 0x20, 0xAD, 0x00, 0x54, 0x9D, 0x00, 0x0B, - 0x9E, 0x00, 0x12, 0xE8, 0xE4, 0x21, 0xF0, 0x02, - 0x86, 0x20, 0x29, 0x7F, 0xC9, 0x13, 0xD0, 0x04, - 0xA5, 0x2E, 0x85, 0x24, 0xAD, 0x02, 0x54, 0x29, - 0x10, 0xF0, 0x2C, 0xA6, 0x27, 0xF0, 0x0F, 0xAD, - 0x02, 0x7C, 0x29, 0x04, 0xD0, 0x21, 0x8E, 0x00, - 0x54, 0x64, 0x27, 0x4C, 0x85, 0x3C, 0xA6, 0x26, - 0xE4, 0x25, 0xF0, 0x13, 0xA5, 0x24, 0xD0, 0x0F, - 0xAD, 0x02, 0x7C, 0x29, 0x04, 0xD0, 0x08, 0xBD, - 0x00, 0x04, 0x8D, 0x00, 0x54, 0xE6, 0x26, 0xAD, - 0x02, 0x5C, 0x89, 0x08, 0xF0, 0x3B, 0x89, 0x02, - 0xF0, 0x1B, 0xAD, 0x00, 0x5C, 0xD0, 0x32, 0xA6, - 0x30, 0xA9, 0x01, 0x9D, 0x00, 0x13, 0xA9, 0x01, - 0x9D, 0x00, 0x0C, 0xE8, 0xE4, 0x31, 0xF0, 0x02, - 0x86, 0x30, 0x4C, 0xC7, 0x3C, 0xA6, 0x30, 0xAD, - 0x00, 0x5C, 0x9D, 0x00, 0x0C, 0x9E, 0x00, 0x13, - 0xE8, 0xE4, 0x31, 0xF0, 0x02, 0x86, 0x30, 0x29, - 0x7F, 0xC9, 0x13, 0xD0, 0x04, 0xA5, 0x3E, 0x85, - 0x34, 0xAD, 0x02, 0x5C, 0x29, 0x10, 0xF0, 0x2C, - 0xA6, 0x37, 0xF0, 0x0F, 0xAD, 0x02, 0x7C, 0x29, - 0x08, 0xD0, 0x21, 0x8E, 0x00, 0x5C, 0x64, 0x37, - 0x4C, 0xFA, 0x3C, 0xA6, 0x36, 0xE4, 0x35, 0xF0, - 0x13, 0xA5, 0x34, 0xD0, 0x0F, 0xAD, 0x02, 0x7C, - 0x29, 0x08, 0xD0, 0x08, 0xBD, 0x00, 0x05, 0x8D, - 0x00, 0x5C, 0xE6, 0x36, 0xAD, 0x02, 0x64, 0x89, + 0xAD, 0x00, 0x44, 0xD0, 0x32, 0xA6, 0x00, 0xA9, + 0x01, 0x9D, 0x00, 0x10, 0xA9, 0x01, 0x9D, 0x00, + 0x09, 0xE8, 0xE4, 0x01, 0xF0, 0x02, 0x86, 0x00, + 0x4C, 0x65, 0x3A, 0xA6, 0x00, 0xAD, 0x00, 0x44, + 0x9D, 0x00, 0x09, 0x9E, 0x00, 0x10, 0xE8, 0xE4, + 0x01, 0xF0, 0x02, 0x86, 0x00, 0x29, 0x7F, 0xC9, + 0x13, 0xD0, 0x04, 0xA5, 0x0B, 0x85, 0x02, 0xAD, + 0x02, 0x44, 0x29, 0x10, 0xF0, 0x2C, 0xA6, 0x05, + 0xF0, 0x0F, 0xAD, 0x02, 0x7C, 0x29, 0x01, 0xD0, + 0x21, 0x8E, 0x00, 0x44, 0x64, 0x05, 0x4C, 0x98, + 0x3A, 0xA6, 0x04, 0xE4, 0x03, 0xF0, 0x13, 0xA5, + 0x02, 0xD0, 0x0F, 0xAD, 0x02, 0x7C, 0x29, 0x01, + 0xD0, 0x08, 0xBD, 0x00, 0x02, 0x8D, 0x00, 0x44, + 0xE6, 0x04, 0xAD, 0x02, 0x4C, 0x89, 0x08, 0xF0, + 0x3B, 0x89, 0x02, 0xF0, 0x1B, 0xAD, 0x00, 0x4C, + 0xD0, 0x32, 0xA6, 0x0C, 0xA9, 0x01, 0x9D, 0x00, + 0x11, 0xA9, 0x01, 0x9D, 0x00, 0x0A, 0xE8, 0xE4, + 0x0D, 0xF0, 0x02, 0x86, 0x0C, 0x4C, 0xDA, 0x3A, + 0xA6, 0x0C, 0xAD, 0x00, 0x4C, 0x9D, 0x00, 0x0A, + 0x9E, 0x00, 0x11, 0xE8, 0xE4, 0x0D, 0xF0, 0x02, + 0x86, 0x0C, 0x29, 0x7F, 0xC9, 0x13, 0xD0, 0x04, + 0xA5, 0x17, 0x85, 0x0E, 0xAD, 0x02, 0x4C, 0x29, + 0x10, 0xF0, 0x2C, 0xA6, 0x11, 0xF0, 0x0F, 0xAD, + 0x02, 0x7C, 0x29, 0x02, 0xD0, 0x21, 0x8E, 0x00, + 0x4C, 0x64, 0x11, 0x4C, 0x0D, 0x3B, 0xA6, 0x10, + 0xE4, 0x0F, 0xF0, 0x13, 0xA5, 0x0E, 0xD0, 0x0F, + 0xAD, 0x02, 0x7C, 0x29, 0x02, 0xD0, 0x08, 0xBD, + 0x00, 0x03, 0x8D, 0x00, 0x4C, 0xE6, 0x10, 0xAD, + 0x02, 0x54, 0x89, 0x08, 0xF0, 0x3B, 0x89, 0x02, + 0xF0, 0x1B, 0xAD, 0x00, 0x54, 0xD0, 0x32, 0xA6, + 0x18, 0xA9, 0x01, 0x9D, 0x00, 0x12, 0xA9, 0x01, + 0x9D, 0x00, 0x0B, 0xE8, 0xE4, 0x19, 0xF0, 0x02, + 0x86, 0x18, 0x4C, 0x4F, 0x3B, 0xA6, 0x18, 0xAD, + 0x00, 0x54, 0x9D, 0x00, 0x0B, 0x9E, 0x00, 0x12, + 0xE8, 0xE4, 0x19, 0xF0, 0x02, 0x86, 0x18, 0x29, + 0x7F, 0xC9, 0x13, 0xD0, 0x04, 0xA5, 0x23, 0x85, + 0x1A, 0xAD, 0x02, 0x54, 0x29, 0x10, 0xF0, 0x2C, + 0xA6, 0x1D, 0xF0, 0x0F, 0xAD, 0x02, 0x7C, 0x29, + 0x04, 0xD0, 0x21, 0x8E, 0x00, 0x54, 0x64, 0x1D, + 0x4C, 0x82, 0x3B, 0xA6, 0x1C, 0xE4, 0x1B, 0xF0, + 0x13, 0xA5, 0x1A, 0xD0, 0x0F, 0xAD, 0x02, 0x7C, + 0x29, 0x04, 0xD0, 0x08, 0xBD, 0x00, 0x04, 0x8D, + 0x00, 0x54, 0xE6, 0x1C, 0xAD, 0x02, 0x5C, 0x89, 0x08, 0xF0, 0x3B, 0x89, 0x02, 0xF0, 0x1B, 0xAD, - 0x00, 0x64, 0xD0, 0x32, 0xA6, 0x40, 0xA9, 0x01, - 0x9D, 0x00, 0x14, 0xA9, 0x01, 0x9D, 0x00, 0x0D, - 0xE8, 0xE4, 0x41, 0xF0, 0x02, 0x86, 0x40, 0x4C, - 0x3C, 0x3D, 0xA6, 0x40, 0xAD, 0x00, 0x64, 0x9D, - 0x00, 0x0D, 0x9E, 0x00, 0x14, 0xE8, 0xE4, 0x41, - 0xF0, 0x02, 0x86, 0x40, 0x29, 0x7F, 0xC9, 0x13, - 0xD0, 0x04, 0xA5, 0x4E, 0x85, 0x44, 0xAD, 0x02, - 0x64, 0x29, 0x10, 0xF0, 0x2C, 0xA6, 0x47, 0xF0, - 0x0F, 0xAD, 0x02, 0x7C, 0x29, 0x10, 0xD0, 0x21, - 0x8E, 0x00, 0x64, 0x64, 0x47, 0x4C, 0x6F, 0x3D, - 0xA6, 0x46, 0xE4, 0x45, 0xF0, 0x13, 0xA5, 0x44, - 0xD0, 0x0F, 0xAD, 0x02, 0x7C, 0x29, 0x10, 0xD0, - 0x08, 0xBD, 0x00, 0x06, 0x8D, 0x00, 0x64, 0xE6, - 0x46, 0xAD, 0x02, 0x6C, 0x89, 0x08, 0xF0, 0x3B, - 0x89, 0x02, 0xF0, 0x1B, 0xAD, 0x00, 0x6C, 0xD0, - 0x32, 0xA6, 0x50, 0xA9, 0x01, 0x9D, 0x00, 0x15, - 0xA9, 0x01, 0x9D, 0x00, 0x0E, 0xE8, 0xE4, 0x51, - 0xF0, 0x02, 0x86, 0x50, 0x4C, 0xB1, 0x3D, 0xA6, - 0x50, 0xAD, 0x00, 0x6C, 0x9D, 0x00, 0x0E, 0x9E, - 0x00, 0x15, 0xE8, 0xE4, 0x51, 0xF0, 0x02, 0x86, - 0x50, 0x29, 0x7F, 0xC9, 0x13, 0xD0, 0x04, 0xA5, - 0x5E, 0x85, 0x54, 0xAD, 0x02, 0x6C, 0x29, 0x10, - 0xF0, 0x2C, 0xA6, 0x57, 0xF0, 0x0F, 0xAD, 0x02, - 0x7C, 0x29, 0x20, 0xD0, 0x21, 0x8E, 0x00, 0x6C, - 0x64, 0x57, 0x4C, 0xE4, 0x3D, 0xA6, 0x56, 0xE4, - 0x55, 0xF0, 0x13, 0xA5, 0x54, 0xD0, 0x0F, 0xAD, - 0x02, 0x7C, 0x29, 0x20, 0xD0, 0x08, 0xBD, 0x00, - 0x07, 0x8D, 0x00, 0x6C, 0xE6, 0x56, 0xAD, 0x02, - 0x74, 0x89, 0x08, 0xF0, 0x3B, 0x89, 0x02, 0xF0, - 0x1B, 0xAD, 0x00, 0x74, 0xD0, 0x32, 0xA6, 0x60, - 0xA9, 0x01, 0x9D, 0x00, 0x16, 0xA9, 0x01, 0x9D, - 0x00, 0x0F, 0xE8, 0xE4, 0x61, 0xF0, 0x02, 0x86, - 0x60, 0x4C, 0x26, 0x3E, 0xA6, 0x60, 0xAD, 0x00, - 0x74, 0x9D, 0x00, 0x0F, 0x9E, 0x00, 0x16, 0xE8, - 0xE4, 0x61, 0xF0, 0x02, 0x86, 0x60, 0x29, 0x7F, - 0xC9, 0x13, 0xD0, 0x04, 0xA5, 0x6E, 0x85, 0x64, - 0xAD, 0x02, 0x74, 0x29, 0x10, 0xF0, 0x2C, 0xA6, - 0x67, 0xF0, 0x0F, 0xAD, 0x02, 0x7C, 0x29, 0x40, - 0xD0, 0x21, 0x8E, 0x00, 0x74, 0x64, 0x67, 0x4C, - 0x59, 0x3E, 0xA6, 0x66, 0xE4, 0x65, 0xF0, 0x13, - 0xA5, 0x64, 0xD0, 0x0F, 0xAD, 0x02, 0x7C, 0x29, - 0x40, 0xD0, 0x08, 0xBD, 0x00, 0x08, 0x8D, 0x00, - 0x74, 0xE6, 0x66, 0x60, 0xFF, 0xFF, 0xFF, 0xFF, + 0x00, 0x5C, 0xD0, 0x32, 0xA6, 0x24, 0xA9, 0x01, + 0x9D, 0x00, 0x13, 0xA9, 0x01, 0x9D, 0x00, 0x0C, + 0xE8, 0xE4, 0x25, 0xF0, 0x02, 0x86, 0x24, 0x4C, + 0xC4, 0x3B, 0xA6, 0x24, 0xAD, 0x00, 0x5C, 0x9D, + 0x00, 0x0C, 0x9E, 0x00, 0x13, 0xE8, 0xE4, 0x25, + 0xF0, 0x02, 0x86, 0x24, 0x29, 0x7F, 0xC9, 0x13, + 0xD0, 0x04, 0xA5, 0x2F, 0x85, 0x26, 0xAD, 0x02, + 0x5C, 0x29, 0x10, 0xF0, 0x2C, 0xA6, 0x29, 0xF0, + 0x0F, 0xAD, 0x02, 0x7C, 0x29, 0x08, 0xD0, 0x21, + 0x8E, 0x00, 0x5C, 0x64, 0x29, 0x4C, 0xF7, 0x3B, + 0xA6, 0x28, 0xE4, 0x27, 0xF0, 0x13, 0xA5, 0x26, + 0xD0, 0x0F, 0xAD, 0x02, 0x7C, 0x29, 0x08, 0xD0, + 0x08, 0xBD, 0x00, 0x05, 0x8D, 0x00, 0x5C, 0xE6, + 0x28, 0xAD, 0x02, 0x64, 0x89, 0x08, 0xF0, 0x3B, + 0x89, 0x02, 0xF0, 0x1B, 0xAD, 0x00, 0x64, 0xD0, + 0x32, 0xA6, 0x30, 0xA9, 0x01, 0x9D, 0x00, 0x14, + 0xA9, 0x01, 0x9D, 0x00, 0x0D, 0xE8, 0xE4, 0x31, + 0xF0, 0x02, 0x86, 0x30, 0x4C, 0x39, 0x3C, 0xA6, + 0x30, 0xAD, 0x00, 0x64, 0x9D, 0x00, 0x0D, 0x9E, + 0x00, 0x14, 0xE8, 0xE4, 0x31, 0xF0, 0x02, 0x86, + 0x30, 0x29, 0x7F, 0xC9, 0x13, 0xD0, 0x04, 0xA5, + 0x3B, 0x85, 0x32, 0xAD, 0x02, 0x64, 0x29, 0x10, + 0xF0, 0x2C, 0xA6, 0x35, 0xF0, 0x0F, 0xAD, 0x02, + 0x7C, 0x29, 0x10, 0xD0, 0x21, 0x8E, 0x00, 0x64, + 0x64, 0x35, 0x4C, 0x6C, 0x3C, 0xA6, 0x34, 0xE4, + 0x33, 0xF0, 0x13, 0xA5, 0x32, 0xD0, 0x0F, 0xAD, + 0x02, 0x7C, 0x29, 0x10, 0xD0, 0x08, 0xBD, 0x00, + 0x06, 0x8D, 0x00, 0x64, 0xE6, 0x34, 0xAD, 0x02, + 0x6C, 0x89, 0x08, 0xF0, 0x3B, 0x89, 0x02, 0xF0, + 0x1B, 0xAD, 0x00, 0x6C, 0xD0, 0x32, 0xA6, 0x3C, + 0xA9, 0x01, 0x9D, 0x00, 0x15, 0xA9, 0x01, 0x9D, + 0x00, 0x0E, 0xE8, 0xE4, 0x3D, 0xF0, 0x02, 0x86, + 0x3C, 0x4C, 0xAE, 0x3C, 0xA6, 0x3C, 0xAD, 0x00, + 0x6C, 0x9D, 0x00, 0x0E, 0x9E, 0x00, 0x15, 0xE8, + 0xE4, 0x3D, 0xF0, 0x02, 0x86, 0x3C, 0x29, 0x7F, + 0xC9, 0x13, 0xD0, 0x04, 0xA5, 0x47, 0x85, 0x3E, + 0xAD, 0x02, 0x6C, 0x29, 0x10, 0xF0, 0x2C, 0xA6, + 0x41, 0xF0, 0x0F, 0xAD, 0x02, 0x7C, 0x29, 0x20, + 0xD0, 0x21, 0x8E, 0x00, 0x6C, 0x64, 0x41, 0x4C, + 0xE1, 0x3C, 0xA6, 0x40, 0xE4, 0x3F, 0xF0, 0x13, + 0xA5, 0x3E, 0xD0, 0x0F, 0xAD, 0x02, 0x7C, 0x29, + 0x20, 0xD0, 0x08, 0xBD, 0x00, 0x07, 0x8D, 0x00, + 0x6C, 0xE6, 0x40, 0xAD, 0x02, 0x74, 0x89, 0x08, + 0xF0, 0x3B, 0x89, 0x02, 0xF0, 0x1B, 0xAD, 0x00, + 0x74, 0xD0, 0x32, 0xA6, 0x48, 0xA9, 0x01, 0x9D, + 0x00, 0x16, 0xA9, 0x01, 0x9D, 0x00, 0x0F, 0xE8, + 0xE4, 0x49, 0xF0, 0x02, 0x86, 0x48, 0x4C, 0x23, + 0x3D, 0xA6, 0x48, 0xAD, 0x00, 0x74, 0x9D, 0x00, + 0x0F, 0x9E, 0x00, 0x16, 0xE8, 0xE4, 0x49, 0xF0, + 0x02, 0x86, 0x48, 0x29, 0x7F, 0xC9, 0x13, 0xD0, + 0x04, 0xA5, 0x53, 0x85, 0x4A, 0xAD, 0x02, 0x74, + 0x29, 0x10, 0xF0, 0x2C, 0xA6, 0x4D, 0xF0, 0x0F, + 0xAD, 0x02, 0x7C, 0x29, 0x40, 0xD0, 0x21, 0x8E, + 0x00, 0x74, 0x64, 0x4D, 0x4C, 0x56, 0x3D, 0xA6, + 0x4C, 0xE4, 0x4B, 0xF0, 0x13, 0xA5, 0x4A, 0xD0, + 0x0F, 0xAD, 0x02, 0x7C, 0x29, 0x40, 0xD0, 0x08, + 0xBD, 0x00, 0x08, 0x8D, 0x00, 0x74, 0xE6, 0x4C, + 0x60, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, diff --git a/sys/arch/amiga/dev/mscreg.h b/sys/arch/amiga/dev/mscreg.h index e1e106e040a..afeaee89562 100644 --- a/sys/arch/amiga/dev/mscreg.h +++ b/sys/arch/amiga/dev/mscreg.h @@ -1,4 +1,5 @@ -/* $NetBSD: mscreg.h,v 1.4 1995/10/07 18:22:14 chopps Exp $ */ +/* $OpenBSD: mscreg.h,v 1.2 1997/01/16 09:25:07 niklas Exp $ */ +/* $NetBSD: mscreg.h,v 1.5 1996/12/09 17:24:58 is Exp $ */ /* * 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 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 diff --git a/sys/arch/amiga/include/ansi.h b/sys/arch/amiga/include/ansi.h index d2286176862..46114eee1f6 100644 --- a/sys/arch/amiga/include/ansi.h +++ b/sys/arch/amiga/include/ansi.h @@ -1,3 +1,4 @@ +/* $OpenBSD: ansi.h,v 1.2 1997/01/16 09:25:41 niklas Exp $ */ /* $NetBSD: ansi.h,v 1.8 1994/10/26 02:05:55 cgd Exp $ */ #ifndef _MACHINE_ANSI_H_ diff --git a/sys/arch/amiga/include/asm.h b/sys/arch/amiga/include/asm.h index 3e9ddfbf3b7..c77d57177b9 100644 --- a/sys/arch/amiga/include/asm.h +++ b/sys/arch/amiga/include/asm.h @@ -1,3 +1,4 @@ +/* $OpenBSD: asm.h,v 1.2 1997/01/16 09:25:43 niklas Exp $ */ /* $NetBSD: asm.h,v 1.4 1994/10/26 02:05:57 cgd Exp $ */ #ifndef _MACHINE_ASM_H_ diff --git a/sys/arch/amiga/include/cdefs.h b/sys/arch/amiga/include/cdefs.h index a3c9c4377d7..aa33d6d365a 100644 --- a/sys/arch/amiga/include/cdefs.h +++ b/sys/arch/amiga/include/cdefs.h @@ -1,3 +1,4 @@ +/* $OpenBSD: cdefs.h,v 1.2 1997/01/16 09:25:45 niklas Exp $ */ /* $NetBSD: cdefs.h,v 1.1 1995/01/19 01:38:36 jtc Exp $ */ #ifndef _MACHINE_CDEFS_H_ diff --git a/sys/arch/amiga/include/conf.h b/sys/arch/amiga/include/conf.h index 98ded5dd89d..e3bfee98297 100644 --- a/sys/arch/amiga/include/conf.h +++ b/sys/arch/amiga/include/conf.h @@ -1,5 +1,5 @@ -/* $OpenBSD: conf.h,v 1.5 1996/09/04 22:44:22 niklas Exp $ */ -/* $NetBSD: conf.h,v 1.1 1996/04/21 21:13:16 veego Exp $ */ +/* $OpenBSD: conf.h,v 1.6 1997/01/16 09:25:45 niklas Exp $ */ +/* $NetBSD: conf.h,v 1.4 1996/11/30 01:13:07 is Exp $ */ /* * Copyright (c) 1996 Bernd Ernesti. All rights reserved. @@ -37,6 +37,8 @@ cdev_decl(com); cdev_decl(ctty); +cdev_decl(drcom); + bdev_decl(fd); cdev_decl(fd); diff --git a/sys/arch/amiga/include/cpu.h b/sys/arch/amiga/include/cpu.h index 8ddb9c5b888..d63e077db00 100644 --- a/sys/arch/amiga/include/cpu.h +++ b/sys/arch/amiga/include/cpu.h @@ -1,5 +1,5 @@ -/* $OpenBSD: cpu.h,v 1.8 1996/05/29 10:15:50 niklas Exp $ */ -/* $NetBSD: cpu.h,v 1.35 1996/05/19 15:35:43 is Exp $ */ +/* $OpenBSD: cpu.h,v 1.9 1997/01/16 09:25:46 niklas Exp $ */ +/* $NetBSD: cpu.h,v 1.36 1996/09/11 00:11:42 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -50,6 +50,12 @@ */ #include +/* + * Get common m68k CPU definitions. + */ +#include +#define M68K_MMU_MOTOROLA + /* * definitions of cpu-dependent requirements * referenced in generic code @@ -123,87 +129,10 @@ int want_resched; /* resched() was called */ #define AMIGA_FPU40 (1L<<6) #define AMIGA_68060 (1L<<7) -/* values for fputype */ -#define FPU_NONE 0 -#define FPU_68881 1 -#define FPU_68882 2 -#define FPU_68040 3 - -/* values for mmutype (assigned for quick testing) */ -#define MMU_68030 -1 /* 68030 on-chip subset of 68851 */ -#define MMU_68851 1 /* Motorola 68851 */ -#define MMU_68040 -2 /* 68040 on-chip subsubset */ - #ifdef _KERNEL -int machineid, mmutype, fputype; +int machineid; #endif -/* - * 68851 and 68030 MMU - */ -#define PMMU_LVLMASK 0x0007 -#define PMMU_INV 0x0400 -#define PMMU_WP 0x0800 -#define PMMU_ALV 0x1000 -#define PMMU_SO 0x2000 -#define PMMU_LV 0x4000 -#define PMMU_BE 0x8000 -#define PMMU_FAULT (PMMU_WP|PMMU_INV) - -/* 680X0 function codes */ -#define FC_USERD 1 /* user data space */ -#define FC_USERP 2 /* user program space */ -#define FC_SUPERD 5 /* supervisor data space */ -#define FC_SUPERP 6 /* supervisor program space */ -#define FC_CPU 7 /* CPU space */ - -/* fields in the 68020 cache control register */ -#define IC_ENABLE 0x0001 /* enable instruction cache */ -#define IC_FREEZE 0x0002 /* freeze instruction cache */ -#define IC_CE 0x0004 /* clear instruction cache entry */ -#define IC_CLR 0x0008 /* clear entire instruction cache */ - -/* additional fields in the 68030 cache control register */ -#define IC_BE 0x0010 /* instruction burst enable */ -#define DC_ENABLE 0x0100 /* data cache enable */ -#define DC_FREEZE 0x0200 /* data cache freeze */ -#define DC_CE 0x0400 /* clear data cache entry */ -#define DC_CLR 0x0800 /* clear entire data cache */ -#define DC_BE 0x1000 /* data burst enable */ -#define DC_WA 0x2000 /* write allocate */ - -/* fields in the 68040 cache control register */ -#define IC40_ENABLE 0x00008000 /* enable instruction cache */ -#define DC40_ENABLE 0x80000000 /* enable data cache */ - -/* additional fields in the 68060 cache control register */ - -#define DC60_NAD 0x40000000 /* no allocate mode, data cache */ -#define DC60_ESB 0x20000000 /* enable store buffer */ -#define DC60_DPI 0x10000000 /* disable CPUSH invalidation */ -#define DC60_FOC 0x08000000 /* four kB data cache mode (else 8) */ - -#define IC60_EBC 0x00800000 /* enable branch cache */ -#define IC60_CABC 0x00400000 /* clear all branch cache entries */ -#define IC60_CUBC 0x00200000 /* clear user branch cache entries */ - -#define IC60_NAI 0x00004000 /* no allocate mode, instr. cache */ -#define IC60_FIC 0x00002000 /* four kB instr. cache (else 8) */ - - -#define CACHE_ON (DC_WA|DC_BE|DC_CLR|DC_ENABLE|IC_BE|IC_CLR|IC_ENABLE) -#define CACHE_OFF (DC_CLR|IC_CLR) -#define CACHE_CLR (CACHE_ON) -#define IC_CLEAR (DC_WA|DC_BE|DC_ENABLE|IC_BE|IC_CLR|IC_ENABLE) -#define DC_CLEAR (DC_WA|DC_BE|DC_CLR|DC_ENABLE|IC_BE|IC_ENABLE) - -/* 68040 cache control */ -#define CACHE40_ON (IC40_ENABLE|DC40_ENABLE) -#define CACHE40_OFF 0x00000000 - -#define CACHE60_ON (CACHE40_ON |IC60_CABC|IC60_EBC|DC60_ESB) -#define CACHE60_OFF (CACHE40_OFF|IC60_CABC) - /* * CTL_MACHDEP definitions. */ diff --git a/sys/arch/amiga/include/cpufunc.h b/sys/arch/amiga/include/cpufunc.h index 04242c01797..5e7f1a45881 100644 --- a/sys/arch/amiga/include/cpufunc.h +++ b/sys/arch/amiga/include/cpufunc.h @@ -1,3 +1,4 @@ +/* $OpenBSD: cpufunc.h,v 1.2 1997/01/16 09:25:48 niklas Exp $ */ /* $NetBSD: cpufunc.h,v 1.7 1994/10/26 02:06:02 cgd Exp $ */ /* diff --git a/sys/arch/amiga/include/db_machdep.h b/sys/arch/amiga/include/db_machdep.h index bd9b4fa03e2..c851880fa83 100644 --- a/sys/arch/amiga/include/db_machdep.h +++ b/sys/arch/amiga/include/db_machdep.h @@ -1,3 +1,4 @@ +/* $OpenBSD: db_machdep.h,v 1.2 1997/01/16 09:25:49 niklas Exp $ */ /* $NetBSD: db_machdep.h,v 1.4 1994/10/26 02:06:03 cgd Exp $ */ #ifndef _MACHINE_DB_MACHDEP_H_ diff --git a/sys/arch/amiga/include/exec.h b/sys/arch/amiga/include/exec.h index 4850a249ac2..84f2fd5b686 100644 --- a/sys/arch/amiga/include/exec.h +++ b/sys/arch/amiga/include/exec.h @@ -1,3 +1,4 @@ +/* $OpenBSD: exec.h,v 1.4 1997/01/16 09:25:50 niklas Exp $ */ /* $NetBSD: exec.h,v 1.8 1994/10/26 02:06:11 cgd Exp $ */ /* diff --git a/sys/arch/amiga/include/fbio.h b/sys/arch/amiga/include/fbio.h index 2f6dd29abbb..19d88410a4c 100644 --- a/sys/arch/amiga/include/fbio.h +++ b/sys/arch/amiga/include/fbio.h @@ -1,3 +1,4 @@ +/* $OpenBSD: fbio.h,v 1.2 1997/01/16 09:25:51 niklas Exp $ */ /* $NetBSD: fbio.h,v 1.1 1996/05/19 20:06:12 is Exp $ */ /* diff --git a/sys/arch/amiga/include/float.h b/sys/arch/amiga/include/float.h index c4910de3ce3..121b9698b36 100644 --- a/sys/arch/amiga/include/float.h +++ b/sys/arch/amiga/include/float.h @@ -1,3 +1,4 @@ +/* $OpenBSD: float.h,v 1.2 1997/01/16 09:25:52 niklas Exp $ */ /* $NetBSD: float.h,v 1.8 1994/10/26 02:06:13 cgd Exp $ */ #ifndef _MACHINE_FLOAT_H_ diff --git a/sys/arch/amiga/include/frame.h b/sys/arch/amiga/include/frame.h index 2a4df888355..50a90d0e811 100644 --- a/sys/arch/amiga/include/frame.h +++ b/sys/arch/amiga/include/frame.h @@ -1,3 +1,4 @@ +/* $OpenBSD: frame.h,v 1.2 1997/01/16 09:25:53 niklas Exp $ */ /* $NetBSD: frame.h,v 1.7 1994/10/26 02:06:15 cgd Exp $ */ #ifndef _MACHINE_FRAME_H_ diff --git a/sys/arch/amiga/include/ieeefp.h b/sys/arch/amiga/include/ieeefp.h index 1e1bfc2a13d..37374060bfc 100644 --- a/sys/arch/amiga/include/ieeefp.h +++ b/sys/arch/amiga/include/ieeefp.h @@ -1,3 +1,4 @@ +/* $OpenBSD: ieeefp.h,v 1.2 1997/01/16 09:25:54 niklas Exp $ */ /* $NetBSD: ieeefp.h,v 1.2 1995/04/16 16:47:03 jtc Exp $ */ /* Just use the common m68k definition */ diff --git a/sys/arch/amiga/include/kcore.h b/sys/arch/amiga/include/kcore.h index e303289aaef..cab7e69a459 100644 --- a/sys/arch/amiga/include/kcore.h +++ b/sys/arch/amiga/include/kcore.h @@ -1,3 +1,4 @@ +/* $OpenBSD: kcore.h,v 1.2 1997/01/16 09:25:55 niklas Exp $ */ /* $NetBSD: kcore.h,v 1.1 1996/05/12 02:47:46 mhitch Exp $ */ #ifndef _MACHINE_KCORE_H_ diff --git a/sys/arch/amiga/include/limits.h b/sys/arch/amiga/include/limits.h index e88ce065d54..b02a1612c80 100644 --- a/sys/arch/amiga/include/limits.h +++ b/sys/arch/amiga/include/limits.h @@ -1,3 +1,4 @@ +/* $OpenBSD: limits.h,v 1.2 1997/01/16 09:25:56 niklas Exp $ */ /* $NetBSD: limits.h,v 1.8 1994/10/26 02:06:16 cgd Exp $ */ #ifndef _MACHINE_LIMITS_H_ diff --git a/sys/arch/amiga/include/mtpr.h b/sys/arch/amiga/include/mtpr.h index 5d85d6e656b..623c88ab546 100644 --- a/sys/arch/amiga/include/mtpr.h +++ b/sys/arch/amiga/include/mtpr.h @@ -1,3 +1,4 @@ +/* $OpenBSD: mtpr.h,v 1.3 1997/01/16 09:25:57 niklas Exp $ */ /* $NetBSD: mtpr.h,v 1.10 1996/05/09 20:31:53 is Exp $ */ /* diff --git a/sys/arch/amiga/include/param.h b/sys/arch/amiga/include/param.h index 22ea7f2bbfb..6fad68ccfcc 100644 --- a/sys/arch/amiga/include/param.h +++ b/sys/arch/amiga/include/param.h @@ -1,5 +1,5 @@ -/* $OpenBSD: param.h,v 1.7 1996/05/04 09:29:50 niklas Exp $ */ -/* $NetBSD: param.h,v 1.29 1996/04/21 21:13:20 veego Exp $ */ +/* $OpenBSD: param.h,v 1.8 1997/01/16 09:25:58 niklas Exp $ */ +/* $NetBSD: param.h,v 1.30 1996/09/28 15:54:04 mhitch Exp $ */ /* * Copyright (c) 1988 University of Utah. diff --git a/sys/arch/amiga/include/pcb.h b/sys/arch/amiga/include/pcb.h index fd78f0f1cb2..79988a800c5 100644 --- a/sys/arch/amiga/include/pcb.h +++ b/sys/arch/amiga/include/pcb.h @@ -1,3 +1,4 @@ +/* $OpenBSD: pcb.h,v 1.2 1997/01/16 09:25:59 niklas Exp $ */ /* $NetBSD: pcb.h,v 1.9 1995/05/11 23:05:57 chopps Exp $ */ /* diff --git a/sys/arch/amiga/include/pmap.h b/sys/arch/amiga/include/pmap.h index 0b830babf4e..e627e170091 100644 --- a/sys/arch/amiga/include/pmap.h +++ b/sys/arch/amiga/include/pmap.h @@ -1,3 +1,4 @@ +/* $OpenBSD: pmap.h,v 1.2 1997/01/16 09:26:01 niklas Exp $ */ /* $NetBSD: pmap.h,v 1.16 1995/09/29 13:52:08 chopps Exp $ */ /* diff --git a/sys/arch/amiga/include/proc.h b/sys/arch/amiga/include/proc.h index 03e0110ba2e..22e636ee922 100644 --- a/sys/arch/amiga/include/proc.h +++ b/sys/arch/amiga/include/proc.h @@ -1,3 +1,4 @@ +/* $OpenBSD: proc.h,v 1.3 1997/01/16 09:26:02 niklas Exp $ */ /* $NetBSD: proc.h,v 1.10 1994/10/26 02:06:27 cgd Exp $ */ /* diff --git a/sys/arch/amiga/include/profile.h b/sys/arch/amiga/include/profile.h index e29f9651cd3..94824ec7d6d 100644 --- a/sys/arch/amiga/include/profile.h +++ b/sys/arch/amiga/include/profile.h @@ -1,3 +1,4 @@ +/* $OpenBSD: profile.h,v 1.2 1997/01/16 09:26:03 niklas Exp $ */ /* $NetBSD: profile.h,v 1.2 1994/10/26 02:06:29 cgd Exp $ */ #ifndef _MACHINE_PROFILE_H_ diff --git a/sys/arch/amiga/include/psl.h b/sys/arch/amiga/include/psl.h index 069f4839d90..e3c5def73aa 100644 --- a/sys/arch/amiga/include/psl.h +++ b/sys/arch/amiga/include/psl.h @@ -1,5 +1,5 @@ -/* $OpenBSD: psl.h,v 1.7 1996/05/31 10:46:29 niklas Exp $ */ -/* $NetBSD: psl.h,v 1.8 1996/04/21 21:13:22 veego Exp $ */ +/* $OpenBSD: psl.h,v 1.8 1997/01/16 09:26:04 niklas Exp $ */ +/* $NetBSD: psl.h,v 1.11 1996/11/30 00:33:49 is Exp $ */ #ifndef _MACHINE_PSL_H_ #define _MACHINE_PSL_H_ @@ -103,8 +103,25 @@ spllower(npsl) */ #define splbio() spl3() #define splnet() spl3() -#define spltty() spl4() -#define splimp() spl4() + +/* + * spltty hack, idea by Jason Thorpe. + * drivers which need it (at the present only drcom) raise the variable to + * spl5 (the idea being that only ser.c really wants it below 5, and ser + * and drcom will never be present at the same time). + * + * XXX ttyspl is statically initialized in drcom.c at the moment; should + * be some driver independent file. + * + * XXX should ttyspl be volatile? I think not; it is intended to be set only + * during xxx_attach() time, and will be used only later. + * -is + */ + +extern u_int16_t amiga_ttyspl; +#define spltty() splexact(amiga_ttyspl) +#define splimp() spltty() /* XXX for the full story, see i386 */ + #if defined(LEV6_DEFER) || defined(IPL_REMAP_1) || defined(IPL_REMAP_2) #define splclock() spl4() #else diff --git a/sys/arch/amiga/include/pte.h b/sys/arch/amiga/include/pte.h index 8617b5f3213..97e7444d5f5 100644 --- a/sys/arch/amiga/include/pte.h +++ b/sys/arch/amiga/include/pte.h @@ -1,3 +1,4 @@ +/* $OpenBSD: pte.h,v 1.2 1997/01/16 09:26:05 niklas Exp $ */ /* $NetBSD: pte.h,v 1.14 1995/09/29 13:52:09 chopps Exp $ */ /* diff --git a/sys/arch/amiga/include/ptrace.h b/sys/arch/amiga/include/ptrace.h index 24aa91a2e64..72c16112e45 100644 --- a/sys/arch/amiga/include/ptrace.h +++ b/sys/arch/amiga/include/ptrace.h @@ -1,3 +1,4 @@ +/* $OpenBSD: ptrace.h,v 1.2 1997/01/16 09:26:06 niklas Exp $ */ /* $NetBSD: ptrace.h,v 1.4 1994/10/26 02:06:36 cgd Exp $ */ #ifndef _MACHINE_PTRACE_H_ diff --git a/sys/arch/amiga/include/reg.h b/sys/arch/amiga/include/reg.h index b485e45d618..92bf5dd84fe 100644 --- a/sys/arch/amiga/include/reg.h +++ b/sys/arch/amiga/include/reg.h @@ -1,3 +1,4 @@ +/* $OpenBSD: reg.h,v 1.2 1997/01/16 09:26:08 niklas Exp $ */ /* $NetBSD: reg.h,v 1.11 1994/10/26 02:06:37 cgd Exp $ */ #ifndef _MACHINE_REG_H_ diff --git a/sys/arch/amiga/include/setjmp.h b/sys/arch/amiga/include/setjmp.h index 7c4f40837b4..34b1f7af05e 100644 --- a/sys/arch/amiga/include/setjmp.h +++ b/sys/arch/amiga/include/setjmp.h @@ -1,3 +1,4 @@ +/* $OpenBSD: setjmp.h,v 1.2 1997/01/16 09:26:09 niklas Exp $ */ /* $NetBSD: setjmp.h,v 1.1 1994/12/20 10:36:27 cgd Exp $ */ #include diff --git a/sys/arch/amiga/include/signal.h b/sys/arch/amiga/include/signal.h index 20a114a32e4..d72674fa0c1 100644 --- a/sys/arch/amiga/include/signal.h +++ b/sys/arch/amiga/include/signal.h @@ -1,3 +1,4 @@ +/* $OpenBSD: signal.h,v 1.2 1997/01/16 09:26:10 niklas Exp $ */ /* $NetBSD: signal.h,v 1.5 1994/10/26 02:06:39 cgd Exp $ */ #ifndef _MACHINE_SIGNAL_H_ diff --git a/sys/arch/amiga/include/stdarg.h b/sys/arch/amiga/include/stdarg.h index 0717f83d839..c9b3a89d5af 100644 --- a/sys/arch/amiga/include/stdarg.h +++ b/sys/arch/amiga/include/stdarg.h @@ -1,3 +1,4 @@ +/* $OpenBSD: stdarg.h,v 1.2 1997/01/16 09:26:11 niklas Exp $ */ /* $NetBSD: stdarg.h,v 1.8 1994/10/26 02:06:40 cgd Exp $ */ /* Just use the common m68k definition */ diff --git a/sys/arch/amiga/include/trap.h b/sys/arch/amiga/include/trap.h index 2da4dd73844..d1b64809762 100644 --- a/sys/arch/amiga/include/trap.h +++ b/sys/arch/amiga/include/trap.h @@ -1,3 +1,4 @@ +/* $OpenBSD: trap.h,v 1.2 1997/01/16 09:26:12 niklas Exp $ */ /* $NetBSD: trap.h,v 1.8 1995/02/12 19:19:39 chopps Exp $ */ #ifndef _MACHINE_TRAP_H_ diff --git a/sys/arch/amiga/include/types.h b/sys/arch/amiga/include/types.h index 3c8c13b2d3c..278c36f9511 100644 --- a/sys/arch/amiga/include/types.h +++ b/sys/arch/amiga/include/types.h @@ -1,4 +1,5 @@ -/* $NetBSD: types.h,v 1.9 1995/09/16 16:11:40 chopps Exp $ */ +/* $OpenBSD: types.h,v 1.2 1997/01/16 09:26:13 niklas Exp $ */ +/* $NetBSD: types.h,v 1.11 1996/12/23 09:16:20 veego Exp $ */ #ifndef _MACHINE_TYPES_H_ #define _MACHINE_TYPES_H_ diff --git a/sys/arch/amiga/include/varargs.h b/sys/arch/amiga/include/varargs.h index 24a0e69b483..1d6d4f5a2aa 100644 --- a/sys/arch/amiga/include/varargs.h +++ b/sys/arch/amiga/include/varargs.h @@ -1,3 +1,4 @@ +/* $OpenBSD: varargs.h,v 1.2 1997/01/16 09:26:14 niklas Exp $ */ /* $NetBSD: varargs.h,v 1.6 1994/10/26 02:06:46 cgd Exp $ */ /* Just use the common m68k definition */ diff --git a/sys/arch/amiga/stand/Makefile b/sys/arch/amiga/stand/Makefile index 67d17c0804f..f97da891d20 100644 --- a/sys/arch/amiga/stand/Makefile +++ b/sys/arch/amiga/stand/Makefile @@ -1,6 +1,6 @@ -# $OpenBSD: Makefile,v 1.1 1996/08/23 23:15:50 niklas Exp $ -# $NetBSD: Makefile,v 1.1.2.1 1996/06/08 15:44:55 is Exp $ +# $OpenBSD: Makefile,v 1.2 1997/01/16 09:26:18 niklas Exp $ +# $NetBSD: Makefile,v 1.3 1996/11/30 20:34:58 is Exp $ -SUBDIR=binpatch loadkmap +SUBDIR=binpatch boot loadkmap .include diff --git a/sys/arch/amiga/stand/binpatch/Makefile b/sys/arch/amiga/stand/binpatch/Makefile index dac23888e22..706a584db1b 100644 --- a/sys/arch/amiga/stand/binpatch/Makefile +++ b/sys/arch/amiga/stand/binpatch/Makefile @@ -1,5 +1,5 @@ -# $OpenBSD: Makefile,v 1.2 1996/10/04 23:09:50 niklas Exp $ -# $NetBSD: Makefile,v 1.4.6.1 1996/07/31 16:05:53 jtc Exp $ +# $OpenBSD: Makefile,v 1.3 1997/01/16 09:26:20 niklas Exp $ +# $NetBSD: Makefile,v 1.6 1996/09/27 03:23:12 chopps Exp $ PROG=binpatch MAN=binpatch.8 diff --git a/sys/arch/amiga/stand/boot/Makefile b/sys/arch/amiga/stand/boot/Makefile new file mode 100644 index 00000000000..4dc2b872c9d --- /dev/null +++ b/sys/arch/amiga/stand/boot/Makefile @@ -0,0 +1,102 @@ +# $OpenBSD: Makefile,v 1.1 1997/01/16 09:26:21 niklas Exp $ + +NOPROG= installboot +MAN=installboot.8 + +SUBDIR=aout2bb txlt + +TXLT=txlt/txlt + +OBJS = configure.o main.o +OBJS += console.o xd.o + +# libsa library replacements: +OBJS += alloc.o printf.o twiddle.o + +# libkern replacements: +OBJS += bcopy.o bzero.o ashrdi3.o muldi3.o + +# machine language startup code: +OBJS += startit.o + +SRCS = installboot.sh configure.c main.c console.c xd.c +SRCS+= twiddle.c +SRCS+= bbstart.s libstubs.s alloc.s printf.s startit.s +SRCS+= bcopy.s bzero.c ashrdi3.s muldi3.s + +CLEANFILES = $(OBJS) $(BOOTBLOCKS) x.out xxstart.s f.out fdstart.s + +S= ${.CURDIR}/../../../.. +INCPATH=-I${.CURDIR} -I${.CURDIR}/../.. -I${S} -I${S}/lib/libsa +COPTIM= -O2 -fomit-frame-pointer -fno-function-cse -Wa,-l -m68060 -Wa,-m68030 +CFLAGS = ${COPTIM} ${INCPATH} ${DEFS} +COPTS += -Wall -Wstrict-prototypes + +BOOTBLOCKS=xxboot # XXX fdboot is too large at the moment. + +.s.o: ; $(CC) $(CAFLAGS) $(COPTS) -x assembler-with-cpp -o $*.o -c $*.s + +#libs: + +.include "${.CURDIR}/libsa/Makefile.inc" +LIBSA= ${SA_LIB} + +# libstubs should really be a library, but we don't care for now. +LIBS= ${LIBSA} ${LIBKERN} libstubs.o + +all: $(BOOTBLOCKS) installboot + +$(OBJS): txlt + +xxstart.s: bbstart.s + cpp bbstart.s > $@ + +fdstart.s: bbstart.s + cpp -DAUTOLOAD=8192 bbstart.s > $@ + +x.out: xxstart.o $(OBJS) $(LIBS) + $(LD) $(LDFLAGS) -r -dc -e _start -o x.out xxstart.o $(OBJS) $(LIBS) + size x.out + +f.out: fdstart.o $(OBJS) $(LIBS) + $(LD) $(LDFLAGS) -r -dc -e _start -o f.out fdstart.o $(OBJS) $(LIBS) + size f.out + + +$(BOOTBLOCKS): aout2bb + +xxboot: x.out + rm -f $@ + aout2bb/aout2bb x.out $@ || nm -u x.out + +fdboot: f.out + rm -f $@ + aout2bb/aout2bb -F f.out $@ || nm -u f.out + +clean:: + rm -f $(OBJS) fdstart.[os] xxstart.[os] f.out x.out installboot + +install: all maninstall + install -o $(BINOWN) -g $(BINGRP) $(BOOTBLOCKS) /usr/mdec + install -o $(BINOWN) -g $(BINGRP) installboot /usr/sbin + +ci: + ci -l $(SRCS) Makefile + +tar: + (cd ..; tar \ + --exclude '*.o' --exclude RCS --exclude .depend \ + --exclude '*.out' --exclude fdstart.s --exclude xxstart.s \ + --exclude aout2bb/aout2bb --exclude libsa.a \ + -czvf boot.tar.gz boot) + +test: xxtest fdtest + +xxtest: xxboot + dd if=$? of=/dev/rsd1e bs=8192 count=1 + +fdtest: fdboot + dd if=$? of=/dev/rfd0a bs=8192 count=1 + +.include +.include "Makefile.txlt" diff --git a/sys/arch/amiga/stand/boot/Makefile.txlt b/sys/arch/amiga/stand/boot/Makefile.txlt new file mode 100644 index 00000000000..714c912dd7e --- /dev/null +++ b/sys/arch/amiga/stand/boot/Makefile.txlt @@ -0,0 +1,12 @@ +# $OpenBSD: Makefile.txlt,v 1.1 1997/01/16 09:26:22 niklas Exp $ +# $NetBSD: Makefile.txlt,v 1.1.1.1 1996/11/29 23:36:30 is Exp $ + +AFLAGS += -m68060 -m68030 -l +CAFLAGS += -Wa,-l -Wa,-m68030 +#CFLAGS += -ffixed-a4 +# -ffixed-a5 + +.c.o: + $(CC) $(CFLAGS) -S $< -o $*.s + $(TXLT) < $*.s | $(AS) $(AFLAGS) -o $*.o + rm $*.s diff --git a/sys/arch/amiga/stand/boot/alloc.s b/sys/arch/amiga/stand/boot/alloc.s new file mode 100644 index 00000000000..4d7879cc6dc --- /dev/null +++ b/sys/arch/amiga/stand/boot/alloc.s @@ -0,0 +1,60 @@ +/* + * $OpenBSD: alloc.s,v 1.1 1997/01/16 09:26:23 niklas Exp $ + * $NetBSD: alloc.s,v 1.1.1.1 1996/11/29 23:36:29 is Exp $ + * + * Copyright (c) 1996 Ignatios Souvatzis + * 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 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 + * + * 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. + * + */ + +/* + * Memory allocation through exec library. + */ + + .globl _SysBase + .globl _alloc +_alloc: + movl a6,sp@- + movl pc@(_SysBase:w),a6 + movl sp@(8),d0 + movl #0x50001,d1 | MEMF_CLEAR|MEMF_REVERSE|MEMF_PUBLIC for now. + jsr a6@(-0xc6) + movl sp@+,a6 + rts + + .globl _free +_free: + movl a6,sp@- + movl pc@(_SysBase:w),a6 + movl sp@(8),a1 + movl sp@(12),d0 + jsr a6@(-0xd2) + movl sp@+,a6 + rts + diff --git a/sys/arch/amiga/stand/boot/amigagraph.h b/sys/arch/amiga/stand/boot/amigagraph.h new file mode 100644 index 00000000000..7d3c619b3a0 --- /dev/null +++ b/sys/arch/amiga/stand/boot/amigagraph.h @@ -0,0 +1,80 @@ +/* + * $OpenBSD: amigagraph.h,v 1.1 1997/01/16 09:26:24 niklas Exp $ + * $NetBSD: amigagraph.h,v 1.1.1.1 1996/11/29 23:36:29 is Exp $ + * + * Copyright (c) 1996 Ignatios Souvatzis + * 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 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 + * + * 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 AMIGA_GRAPH_H +#define AMIGA_GRAPH_H + +#define SA_Title 0x80000028 +#define SA_Colors 0x80000029 + +#define SA_Sysfont 0x8000002C +#define SA_Type 0x8000002D + +#define SA_DisplayID 0x80000032 +#define SA_ShowTitle 0x80000036 +#define SA_Quiet 0x80000038 +#define SA_AutoScroll 0x80000039 +#define SA_Pens 0x8000003A + +#define PUBLICSCREEN 2 +#define CUSTOMSCREEN 0xF + +#define WA_Left 0x80000064 +#define WA_Top 0x80000065 +#define WA_Width 0x80000066 +#define WA_Height 0x80000067 +#define WA_DetailPen 0x80000068 +#define WA_BlockPen 0x80000069 +#define WA_IDCMP 0x8000006A +#define WA_Flags 0x8000006B +#define WA_Gadgets 0x8000006C +#define WA_Checkmark 0x8000006D +#define WA_Title 0x8000006E +#define WA_ScreenTitle 0x8000006F +#define WA_CustomScreen 0x80000070 +#define WA_SuperBitMap 0x80000071 +#define WA_MinWidth 0x80000072 +#define WA_MinHeight 0x80000073 +#define WA_MaxWidth 0x80000074 +#define WA_MaxHeight 0x80000075 +#define WA_Backdrop 0x80000085 +#define WA_Borderless 0x80000088 +#define WA_Activate 0x80000089 +#define WA_AutoAdjust 0x80000090 + +struct Window { + u_int8_t dum1[136]; +}; +#endif AMIGA_GRAPH_H diff --git a/sys/arch/amiga/stand/boot/amigaio.h b/sys/arch/amiga/stand/boot/amigaio.h new file mode 100644 index 00000000000..bc94f0f6454 --- /dev/null +++ b/sys/arch/amiga/stand/boot/amigaio.h @@ -0,0 +1,79 @@ +/* + * $OpenBSD: amigaio.h,v 1.1 1997/01/16 09:26:25 niklas Exp $ + * $NetBSD: amigaio.h,v 1.1.1.1 1996/11/29 23:36:29 is Exp $ + * + * + * Copyright (c) 1996 Ignatios Souvatzis + * 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 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 + * + * 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. + * + */ + +/* + * This describes the IO parameter block used by many standard + * Amiga OS device drivers. + */ +#ifndef AMIGA_IO_H +#define AMIGA_IO_H + +struct AmigaIO { + u_int8_t dum0[28]; + u_int16_t cmd; + u_int8_t flags; + int8_t err; + u_int32_t actual, /* transferred */ + length; /* please transfer this much */ + void *buf; /* data buffer */ + u_int32_t offset; /* offset for block devices */ +}; + +struct TimerIO { + u_int8_t dum0[28]; + u_int16_t cmd; + u_int8_t flags; + int8_t err; + u_int32_t secs, + usec; +}; + +/* flags */ +#define QuickIO 0x1 + +/* commands */ +#define Cmd_Rst 0x1 +#define Cmd_Rd 0x2 +#define Cmd_Wr 0x3 +#define Cmd_Upd 0x4 +#define Cmd_Clr 0x5 +#define Cmd_Stp 0x6 +#define Cmd_Strt 0x7 +#define Cmd_Flsh 0x8 + +#define Cmd_Addtimereq 0x9 + +#endif /* AMIGA_IO_H */ diff --git a/sys/arch/amiga/stand/boot/amigatypes.h b/sys/arch/amiga/stand/boot/amigatypes.h new file mode 100644 index 00000000000..bbdb6d0ee41 --- /dev/null +++ b/sys/arch/amiga/stand/boot/amigatypes.h @@ -0,0 +1,84 @@ +/* + * $OpenBSD: amigatypes.h,v 1.1 1997/01/16 09:26:26 niklas Exp $ + * $NetBSD: amigatypes.h,v 1.1.1.1 1996/11/29 23:36:29 is Exp $ + * + * Copyright (c) 1996 Ignatios Souvatzis + * 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 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 + * + * 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 _AMIGA_TYPES_H_ +#define _AMIGA_TYPES_H_ + +/* Dummy structs, used only as abstract pointers */ + +struct Library; +struct TextAttr; +struct Gadget; +struct BitMap; +struct NewScreen; +struct MemNode; + +/* real structs */ + +struct TagItem {u_int32_t item; void * data;}; + +struct Library { + u_int8_t Dmy1[20]; + u_int16_t Version, Revision; + u_int8_t Dmy2[34-24]; +}; + +struct MemHead { + struct MemHead *next; + u_int8_t Dmy1[ 9- 4]; + u_int8_t Pri; + u_int8_t Dmy2[ 14- 10]; + u_int16_t Attribs; + u_int32_t First, Lower, Upper, Free; +}; + +struct ExecBase { + struct Library LibNode; + u_int8_t Dmy1[296-34]; + u_int16_t AttnFlags; /* 296 */ + u_int8_t Dmy2[300-298]; /* 298 */ + void *ResModules; /* 300 */ + u_int8_t Dmy3[322-304]; /* 304 */ + struct MemHead *MemLst; /* 322 */ + /* + * XXX: actually, its a longer List base, but we only need to + * search it once. + */ + u_int8_t Dmy4[568-326]; /* 326 */ + u_int32_t EClockFreq; /* 330 */ + u_int8_t Dmy5[632-334]; +}; + +#endif /* _AMIGA_TYPES_H */ diff --git a/sys/arch/amiga/stand/boot/aout2bb/Makefile b/sys/arch/amiga/stand/boot/aout2bb/Makefile new file mode 100644 index 00000000000..7e03937714d --- /dev/null +++ b/sys/arch/amiga/stand/boot/aout2bb/Makefile @@ -0,0 +1,14 @@ +# $OpenBSD: Makefile,v 1.1 1997/01/16 09:26:47 niklas Exp $ + +PROG=aout2bb +SRCS=aout2bb.c chksum.c +NOMAN=notyet +INCLUDES=aout2bb.h chksum.h + +COPTS += -Wall -Wstrict-prototypes -g + + +ci: + ci -l $(SRCS) $(INCLUDES) Makefile + +.include diff --git a/sys/arch/amiga/stand/boot/aout2bb/aout2bb.c b/sys/arch/amiga/stand/boot/aout2bb/aout2bb.c new file mode 100644 index 00000000000..3ef98391ecf --- /dev/null +++ b/sys/arch/amiga/stand/boot/aout2bb/aout2bb.c @@ -0,0 +1,340 @@ +/* + * $OpenBSD: aout2bb.c,v 1.1 1997/01/16 09:26:48 niklas Exp $ + * $NetBSD: aout2bb.c,v 1.2 1996/12/31 22:39:58 veego Exp $ + * + * Copyright (c) 1996 Ignatios Souvatzis + * 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 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 + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include + +#include +#include +#include +#include +#include +#include + +#include /* of the machine we're running on */ +#include /* of the machine we're running on */ + +#include /* TARGET */ + +#include "aout2bb.h" +#include "chksum.h" + +void usage __P((void)); +int intcmp(const void *, const void *); +int main(int argc, char *argv[]); + +#ifdef DEBUG +#define dprintf(x) printf x +#else +#define dprintf(x) +#endif + +#define BBSIZE 8192 + +char *progname; +u_int8_t buffer[BBSIZE]; +u_int32_t relbuf[BBSIZE/sizeof(u_int32_t)]; + /* can't have more relocs than that*/ + +int +intcmp(i, j) + const void *i, *j; +{ + int r; + + r = (*(u_int32_t *)i) < (*(u_int32_t *)j); + + return 2*r-1; +} + +int +main(argc, argv) + int argc; + char *argv[]; +{ + int ifd, ofd; + u_int mid, flags, magic; + caddr_t image; + struct exec *eh; + struct relocation_info_m68k *rpi; + u_int32_t *lptr; + int i, delta; + u_int8_t *rpo; + u_int32_t oldaddr, addrdiff; + u_int32_t tsz, dsz, bsz, trsz, drsz, entry, relver; + int sumsize = 16; + int c; + + + progname = argv[0]; + + /* insert getopt here, if needed */ + while ((c = getopt(argc, argv, "F")) != -1) + switch(c) { + case 'F': + sumsize = 2; + break; + default: + usage(); + } + argv += optind; + argc -= optind; + + if (argc < 2) + usage(); + + ifd = open(argv[0], O_RDONLY, 0); + if (ifd < 0) + err(1, "Can't open %s", argv[0]); + + image = mmap(0, 65536, PROT_READ, MAP_FILE|MAP_PRIVATE, ifd, 0); + if (image == 0) + err(1, "Can't mmap %s", argv[1]); + + eh = (struct exec *)image; /* XXX endianness */ + + magic = N_GETMAGIC(*eh); + if (magic != OMAGIC) + errx(1, "%s isn't an OMAGIC file, but 0%o", argv[0], magic); + + flags = N_GETFLAG(*eh); + if (flags != 0) + errx(1, "%s has strange exec flags 0x%x", argv[0], flags); + + mid = N_GETMID(*eh); + switch(mid) { + case MID_M68K: + break; + default: + errx(1, "%s has strange machine id 0x%x (%d)", argv[0], mid, + mid); + } + + tsz = ntohl(eh->a_text); + dsz = ntohl(eh->a_data); + bsz = ntohl(eh->a_bss); + trsz = ntohl(eh->a_trsize); + drsz = ntohl(eh->a_drsize); + entry = ntohl(eh->a_entry); + + dprintf(("tsz = 0x%x, dsz = 0x%x, bsz = 0x%x, total 0x%x, entry=0x%x\n", + tsz, dsz, bsz, tsz+dsz+bsz, entry)); + + if ((trsz+drsz)==0) + errx(1, "%s has no relocation records.\n", argv[0]); + + dprintf(("%d text relocs, %d data relocs\n", trsz/8, drsz/8)); + if (entry != 12) + errx(1, "%s: entry point 0x%04x is not 0x000c\n", argv[0], + entry); + + /* + * We have one contiguous area allocated by the ROM to us. + */ + if (tsz+dsz+bsz > BBSIZE) + errx(1, "%s: resulting image too big\n", argv[0]); + + memset(buffer, sizeof(buffer), 0); + memcpy(buffer, image + N_TXTOFF(*eh), tsz+dsz); + + /* + * Hm. This tool REALLY should understand more than one + * relocator version. For now, check that the relocator at + * the image start does understand what we output. + */ + relver = ntohl(*(u_int32_t *)(image+0x24)); + switch (relver) { + default: + errx(1, "%s: unrecognized relocator version %d\n", + argv[0], relver); + /*NOTREACHED*/ + + case RELVER_RELATIVE_BYTES: + rpo = buffer + BBSIZE - 1; + delta = -1; + break; + + case RELVER_RELATIVE_BYTES_FORWARD: + rpo = buffer + tsz + dsz; + delta = +1; + *(u_int16_t *)(buffer + 14) = htons(tsz + dsz); + break; + } + + + + i = 0; + + for (rpi = (struct relocation_info_m68k *)(image+N_TRELOFF(*eh)); + (caddr_t)rpi < image+N_TRELOFF(*eh)+trsz; rpi++) { + + NTOHL(((u_int32_t *)rpi)[0]); + NTOHL(((u_int32_t *)rpi)[1]); + + dprintf(("0x%08x 0x%08x %c\n", *(u_int32_t *)rpi, + ((u_int32_t *)rpi)[1], rpi->r_extern ? 'U' : ' ')); + + if (rpi->r_extern) + errx(1, "code accesses unresolved symbol"); + if (rpi->r_copy) + errx(1, "code accesses r_copy symbol"); + if (rpi->r_jmptable) + errx(1, "code accesses r_jmptable symbol"); + if (rpi->r_relative) + errx(1, "code accesses r_relative symbol"); + if (rpi->r_baserel) + errx(1, "code accesses r_baserel symbol"); + + /* + * We don't worry about odd sized symbols which are pc + * relative, so test for pcrel first: + */ + + if (rpi->r_pcrel) + continue; + + if (rpi->r_length != 2) + errx(1, "code accesses size %d symbol", rpi->r_length); + + relbuf[i++] = rpi->r_address; + } + + for (rpi = (struct relocation_info_m68k *)(image+N_DRELOFF(*eh)); + (caddr_t)rpi < image+N_DRELOFF(*eh)+drsz; rpi++) { + + NTOHL(((u_int32_t *)rpi)[0]); + NTOHL(((u_int32_t *)rpi)[1]); + + dprintf(("0x%08x 0x%08x %c\n", *(u_int32_t *)rpi, + ((u_int32_t *)rpi)[1], rpi->r_extern ? 'U' : ' ')); + + if (rpi->r_extern) + errx(1, "data accesses unresolved symbol"); + if (rpi->r_copy) + errx(1, "data accesses r_copy symbol"); + if (rpi->r_jmptable) + errx(1, "data accesses r_jmptable symbol"); + if (rpi->r_relative) + errx(1, "data accesses r_relative symbol"); + if (rpi->r_baserel) + errx(1, "data accesses r_baserel symbol"); + + /* + * We don't worry about odd sized symbols which are pc + * relative, so test for pcrel first: + */ + + if (rpi->r_pcrel) + continue; + + if (rpi->r_length != 2) + errx(1, "data accesses size %d symbol", rpi->r_length); + + + relbuf[i++] = rpi->r_address + tsz; + } + printf("%d absolute reloc%s found, ", i, i==1?"":"s"); + + if (i > 1) + heapsort(relbuf, i, 4, intcmp); + + oldaddr = 0; + + for (--i; i>=0; --i) { + dprintf(("0x%04x: ", relbuf[i])); + lptr = (u_int32_t *)&buffer[relbuf[i]]; + addrdiff = relbuf[i] - oldaddr; + dprintf(("(0x%04x, 0x%04x): ", *lptr, addrdiff)); + if (addrdiff > 255) { + *rpo = 0; + if (delta > 0) { + ++rpo; + *rpo++ = (relbuf[i] >> 8) & 0xff; + *rpo++ = relbuf[i] & 0xff; + dprintf(("%02x%02x%02x\n", + rpo[-3], rpo[-2], rpo[-1])); + } else { + *--rpo = relbuf[i] & 0xff; + *--rpo = (relbuf[i] >> 8) & 0xff; + --rpo; + dprintf(("%02x%02x%02x\n", + rpo[0], rpo[1], rpo[2])); + } + } else { + *rpo = addrdiff; + dprintf(("%02x\n", *rpo)); + rpo += delta; + } + + oldaddr = relbuf[i]; + + if (delta < 0 ? rpo <= buffer+tsz+dsz + : rpo >= buffer + BBSIZE) + errx(1, "Relocs don't fit."); + } + *rpo = 0; rpo += delta; + *rpo = 0; rpo += delta; + *rpo = 0; rpo += delta; + + printf("using %d bytes.\n", delta > 0 ? + rpo-buffer-tsz-dsz : buffer+BBSIZE-rpo); + /* + * RELOCs must fit into the bss area. + */ + if (delta < 0 ? rpo <= buffer+tsz+dsz + : rpo >= buffer + BBSIZE) + errx(1, "Relocs don't fit."); + + ((u_int32_t *)buffer)[1] = 0; + ((u_int32_t *)buffer)[1] = + (0xffffffff - chksum((u_int32_t *)buffer, sumsize * 512 / 4)); + + ofd = open(argv[1], O_CREAT|O_WRONLY, 0644); + if (ofd < 0) + err(1, "Can't open %s", argv[1]); + + if (write(ofd, buffer, BBSIZE) != BBSIZE) + err(1, "Writing output file"); + + exit(0); +} + +void +usage() +{ + fprintf(stderr, "Usage: %s [-F] bootprog bootprog.bin\n", + progname); + exit(1); + /* NOTREACHED */ +} diff --git a/sys/arch/amiga/stand/boot/aout2bb/aout2bb.h b/sys/arch/amiga/stand/boot/aout2bb/aout2bb.h new file mode 100644 index 00000000000..59627748c24 --- /dev/null +++ b/sys/arch/amiga/stand/boot/aout2bb/aout2bb.h @@ -0,0 +1,71 @@ +/* + * $OpenBSD: aout2bb.h,v 1.1 1997/01/16 09:26:49 niklas Exp $ + * $NetBSD: aout2bb.h,v 1.1.1.1 1996/11/29 23:36:30 is Exp $ + * + * Copyright (c) 1996 Ignatios Souvatzis + * 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 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 + * + * 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. + * + */ + +/* + * Relocator version definitions for aout to Amiga bootblock converter. + */ + +/* + * All the tables are at the end of the bootblock, with logical start at the + * end. + */ + +/* + * The following formats are for a length of 8 kBytes only. + */ + +/* + * Absolute words in Motorola byte order, end of table marked by 0x0000 + */ +#define RELVER_ABSOLUTE_WORDS 0 + +/* + * Unsigned bytes relative to previous address to relocate; first one to 0. + * If the difference is >255, the logical next two bytes (in Motorola byte + * order) give the absolute address to relocate. + */ +#define RELVER_RELATIVE_BYTES 1 + +/* + * Same as above, but with the bytes stored in forward direction beginning + * with the __relocation_bytes symbol + */ +#define RELVER_RELATIVE_BYTES_FORWARD 2 + +/* + * loader can autoload + */ + +#define RELFLAG_SELFLOADING 0x10 diff --git a/sys/arch/amiga/stand/boot/aout2bb/chksum.c b/sys/arch/amiga/stand/boot/aout2bb/chksum.c new file mode 100644 index 00000000000..1a857e69016 --- /dev/null +++ b/sys/arch/amiga/stand/boot/aout2bb/chksum.c @@ -0,0 +1,85 @@ +/* + * $OpenBSD: chksum.c,v 1.1 1997/01/16 09:26:50 niklas Exp $ + * $NetBSD: chksum.c,v 1.1.1.1 1996/11/29 23:36:30 is Exp $ + * + * Copyright (c) 1996 Ignatios Souvatzis + * 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 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 + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +#include +#include + +#include "chksum.h" + +u_int32_t +chksum(block, size) + u_int32_t *block; + int size; +{ + u_int32_t sum, lastsum; + int i; + + sum = 0; + + for (i=0; i +#include + +void +bzero(p, len) + void *p; + size_t len; +{ + char *s = p; + while (len > 0) { + *s++ = 0; + --len; + } +} diff --git a/sys/arch/amiga/dev/gen_cvtab.c b/sys/arch/amiga/stand/boot/configure.c similarity index 64% rename from sys/arch/amiga/dev/gen_cvtab.c rename to sys/arch/amiga/stand/boot/configure.c index a78f9e4c867..05288594a21 100644 --- a/sys/arch/amiga/dev/gen_cvtab.c +++ b/sys/arch/amiga/stand/boot/configure.c @@ -1,8 +1,8 @@ -/* $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 $ */ - /* - * Copyright (c) 1996 Christian E. Hopps + * $OpenBSD: configure.c,v 1.1 1997/01/16 09:26:31 niklas Exp $ + * $NetBSD: configure.c,v 1.1.1.1 1996/11/29 23:36:29 is Exp $ + * + * Copyright (c) 1996 Ignatios Souvatzis * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -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 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 * @@ -29,38 +30,18 @@ * 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 -#include -/* - * generate a conversion table to replace the use of the - * floating point expression below in grf_cv.c - */ +#include "stand.h" +#include "samachdep.h" + int -main(int argc, char** argv) +configure(aio) +void *aio; { - 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"); + xdinit(aio); + return (consinit()); } diff --git a/sys/arch/amiga/stand/boot/console.c b/sys/arch/amiga/stand/boot/console.c new file mode 100644 index 00000000000..d30af457d36 --- /dev/null +++ b/sys/arch/amiga/stand/boot/console.c @@ -0,0 +1,185 @@ +/* + * $OpenBSD: console.c,v 1.1 1997/01/16 09:26:32 niklas Exp $ + * $NetBSD: console.c,v 1.1.1.1 1996/11/29 23:36:29 is Exp $ + * + * Copyright (c) 1996 Ignatios Souvatzis + * 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 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 + * + * 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. + * + */ + +/* + * Bootblock support routines for Intuition console support. + */ + +#include + +#include +#include "samachdep.h" + +#include "amigatypes.h" +#include "amigagraph.h" +#include "amigaio.h" +#include "libstubs.h" + +const u_int32_t screentags[] = { + SA_Type, CUSTOMSCREEN, + SA_DisplayID, 0x8000, + SA_ShowTitle, 0, + SA_Quiet, 1, + 0 +}; + +u_int32_t windowtags[] = { + WA_CustomScreen, 0L, + WA_Borderless, 1L, + WA_Backdrop, 1L, + WA_Activate, 1L, + 0 +}; + +struct AmigaIO *cnior; +struct TimerIO *tmior; +struct MsgPort *cnmp; + +u_int16_t timelimit; + +int +consinit() { + struct Screen *s = 0; + struct Window *w = 0; + + IntuitionBase = OpenLibrary("intuition.library", 36L); + if (IntuitionBase == 0) + goto err; + + s = OpenScreenTagList(0, screentags); + if (!s) + goto err; + + windowtags[1] = (u_int32_t)s; + w = OpenWindowTagList(0, windowtags); + if (!w) + goto err; + + cnmp = CreateMsgPort(); + + if (!cnmp) + goto err; + + cnior = (struct AmigaIO *)CreateIORequest(cnmp, sizeof(struct AmigaIO)); + if (!cnior) + goto err; + + cnior->buf = (void *)w; + if (OpenDevice("console.device", 0, cnior, 0)) + goto err; + + tmior = (struct TimerIO *)CreateIORequest(cnmp, sizeof(struct TimerIO)); + if (!tmior) + goto err; + + if (OpenDevice("timer.device", 0, (struct AmigaIO*)tmior, 0)) + goto err; + + return 0; + +err: +#ifdef notyet + if (tmior) + DeleteIORequest(tmior); + + if (cnior) + DeleteIORequest(cnior); + + if (cnmp) + DeleteMsgPort(cnmp); + + if (w) + CloseWindow(w); + + if (s) + CloseScreen(s); + if (IntuitionBase) + CloseLibrary(IntuitionBase); +#endif + + return 1; +} + +void +putchar(c) + char c; +{ + cnior->length = 1; + cnior->buf = &c; + cnior->cmd = Cmd_Wr; + (void)DoIO(cnior); +} + +void +puts(s) + char *s; +{ + cnior->length = -1; + cnior->buf = s; + cnior->cmd = Cmd_Wr; + (void)DoIO(cnior); +} + +int +getchar() +{ + struct AmigaIO *ior; + char c = -1; + + cnior->length = 1; + cnior->buf = &c; + cnior->cmd = Cmd_Rd; + + SendIO(cnior); + + if (timelimit) { + tmior->cmd = Cmd_Addtimereq; + tmior->secs = timelimit; + tmior->usec = 2; /* Paranoid */ + SendIO((struct AmigaIO *)tmior); + + ior = WaitPort(cnmp); + if (ior == cnior) + AbortIO((struct AmigaIO *)tmior); + else /* if (ior == tmior) */ { + AbortIO(cnior); + c = '\n'; + } + WaitIO((struct AmigaIO *)tmior); + timelimit = 0; + } + (void)WaitIO(cnior); + return c; +} diff --git a/sys/arch/amiga/stand/boot/installboot.8 b/sys/arch/amiga/stand/boot/installboot.8 new file mode 100644 index 00000000000..b3c1f2c7c03 --- /dev/null +++ b/sys/arch/amiga/stand/boot/installboot.8 @@ -0,0 +1,122 @@ +.\" $OpenBSD: installboot.8,v 1.1 1997/01/16 09:26:33 niklas Exp $ +.\" $NetBSD: installboot.8,v 1.1.1.1 1996/11/29 23:36:30 is Exp $ +.\" +.\" Copyright (c) 1995 Paul Kranenburg +.\" 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 Paul Kranenburg. +.\" 3. 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. +.\" +.Dd November 29, 1996 +.Dt INSTALLBOOT 8 +.Os +.Sh NAME +.Nm installboot +.Nd install a bootstrap on an FFS filesystem partition +.Sh SYNOPSIS +.Nm installboot +.Ar bootblock +.Ar device +.Sh DESCRIPTION +.Nm installboot +copies the bootblock to a bootable partition. The +bootstrap is written into the bootblock area on the partition, right +in front of the superblock, and hence limited in size to +8192 bytes. +.Pp +The bootstrap resides in the first few blocks on the partition +.Pq as specified by Commodore-Amiga Inc. +The bootstrap is loaded into memory by the ROM from bootable devices: +RDB devices, where the partition is marked as bootable, or (not on the +DraCo) floppy disks in Amiga format (880K/1760k). +.Pp +In presence of more than one bootable partiton/floppy disk, the partition +is chosen by the bootpriority (from the RDB), which can be overridden by +the operator from the boot menu (on Amiga machines, hold down the outer +mouse buttons during boot; on DraCo machines, press the left mouse button +when prompted). +.Pp +On RDB devices, the whole bootblock is loaded by the ROM. The number of +boot blocks in the RDB partition entry must be correct. +.Pp +On floppy disks, the ROM always loads the first two blocks (1024 bytes), +and the bootblock allocates memory and loads the whole bootblock on startup. +.Pp +After receiving control, the bootblock uses the stand-alone +filesystem code in +.Dq libsa.a +to load the kernel from the filesystem on the partition it was started from. +The code for the boot program can be found in +.Pa /usr/mdec/fdboot +.Pq floppy disk code +or +.Pa /usr/mdec/xxboot +.Pq generic RDB disk code . +.Pp +The arguments are: +.Bl -tag -width bootblock +.It Ar bootblock +The file containing the bootblock (normally /usr/mdec/xxboot for RDB devices). +.It Ar device +The name of the character special device specifying the partition on which the +bootstrap is to be installed. +.El +.Sh EXAMPLES +The following command will install the +boot program in the bootblock area on +.Dq sd0a : +.Bd -literal -offset indent +installboot /usr/mdec/xxboot /dev/rsd0a +.Ed +.Sh CAVEATS +If +.Nm +is used on the whole disk partition, the RDB will be overwritten. +.Pp +Some third-party accellerator boards are not auto-configuring. You won't +be able to use their memory when booting from the bootblock after a cold +start. +.Pp +Some third-party disk controllers don't support bootblock booting. +.Pp +Phase 5 68060 boards don't set the SysBase->AttnFlags bit for the 68060 +CPU (a patch program which is called during AmigaOS startup does this). +Currently, +.Tn OpenBSD +is not able to detect this condition, and will fail. +.Sh BUGS +There is currently no easy way to edit the RDB from within +.Tn OpenBSD. +.Pp +As normal dd is used to install the bootblock, you can only install onto +your currently used root (or any other mounted) partiton from single-user +mode, or while otherwise running in insecure mode. +.Sh "SEE ALSO" +.Xr dd 1 +.Sh HISTORY +The +.Nm +command first appeared in +.Nx 1.3 diff --git a/sys/arch/amiga/stand/boot/installboot.sh b/sys/arch/amiga/stand/boot/installboot.sh new file mode 100644 index 00000000000..642e941e734 --- /dev/null +++ b/sys/arch/amiga/stand/boot/installboot.sh @@ -0,0 +1,28 @@ +#!/bin/sh +# $OpenBSD: installboot.sh,v 1.1 1997/01/16 09:26:34 niklas Exp $ +# $NetBSD: installboot.sh,v 1.1.1.1 1996/11/29 23:36:29 is Exp $ + +# compatibility with old installboot program +# +# @(#)installboot.sh 8.1 (Berkeley) 6/10/93 +# +if [ $# != 2 ] +then + echo "Usage: installboot bootprog device" + exit 1 +fi +if [ ! -f $1 ] +then + echo "Usage: installboot bootprog device" + echo "${1}: bootprog must be a regular file" + exit 1 +fi +if [ ! -c $2 ] +then + echo "Usage: installboot bootprog device" + echo "${2}: device must be a char special file" + exit 1 +fi +#/sbin/disklabel -B -b $1 $2 +dd if=$1 of=$2 bs=512 count=16 +exit $? diff --git a/sys/arch/amiga/stand/boot/libsa/Makefile b/sys/arch/amiga/stand/boot/libsa/Makefile new file mode 100644 index 00000000000..f6a3ee7fa06 --- /dev/null +++ b/sys/arch/amiga/stand/boot/libsa/Makefile @@ -0,0 +1,46 @@ +# $OpenBSD: Makefile,v 1.1 1997/01/16 09:26:53 niklas Exp $ +# $NetBSD: Makefile,v 1.1.1.1 1996/11/29 23:36:30 is Exp $ + +LIB= sa + +DIR_SA = ${.CURDIR}/../../../../../lib/libsa +DIR_KERN = ${.CURDIR}/../../../../../lib/libkern +DIR_KERN_MD = ${.CURDIR}/../../../../../lib/libkern/arch/$(MACHINE_ARCH) + +TXLT = ${.CURDIR}/../txlt/txlt + +.PATH: $(DIR_SA) $(DIR_KERN) $(DIR_KERN_MD) + +CFLAGS+=-DSTANDALONE -DINSECURE ${DEBUGFLAGS} +# -DCOMPAT_UFS +CFLAGS+=-I${.CURDIR}/../../../../.. -I${.CURDIR}/../../../../../lib/libsa +CFLAGS+=-O2 -fomit-frame-pointer -fno-function-cse -m68060 -Wa,-l -Wa,-m68030 +CFLAGS+=$(COPTS) + +# stand routines +SRCS= gets.c +# memcpy.c bcopy.c strerror.c + +# io routines +SRCS+= close.c lseek.c open.c read.c dev.c + +# dev.c stat.c + +# boot filesystems +SRCS+= ufs.c + +# kernlib routines +SRCS+= strlen.S strcmp.S +#$(DIR_KERN)/bcmp.c + + +#ashrdi3.c bzero.S muldi3.S + +NOPROFILE= +NOPIC= +OBJMACHINE= + +install: + +.include +.include "../Makefile.txlt" diff --git a/sys/arch/amiga/stand/boot/libsa/Makefile.inc b/sys/arch/amiga/stand/boot/libsa/Makefile.inc new file mode 100644 index 00000000000..35aeea68879 --- /dev/null +++ b/sys/arch/amiga/stand/boot/libsa/Makefile.inc @@ -0,0 +1,24 @@ +# $OpenBSD: Makefile.inc,v 1.1 1997/01/16 09:26:54 niklas Exp $ +# $NetBSD: Makefile.inc,v 1.1.1.1 1996/11/29 23:36:30 is Exp $ + +# NOTE: $S must correspond to the top of the 'sys' tree + +SA_DIR= $S/arch/amiga/stand/boot/libsa + +.if exists($(SA_DIR)/obj.${MACHINE}) +SA_LIBDIR= $(SA_DIR)/obj.${MACHINE} +.else +SA_LIBDIR= $(SA_DIR) +.endif + +SA_LIB= $(SA_LIBDIR)/libsa.a + +$(SA_LIB): .NOTMAIN __always_make_sa_lib + @echo making sure the stand-alone library is up to date... + @(cd $(SA_DIR) ; make) + +clean:: .NOTMAIN __always_make_sa_lib + @echo cleaning the stand-alone library objects + @(cd $(SA_DIR) ; make clean) + +__always_make_sa_lib: .NOTMAIN diff --git a/sys/arch/amiga/stand/boot/libstubs.h b/sys/arch/amiga/stand/boot/libstubs.h new file mode 100644 index 00000000000..73d93ef9b22 --- /dev/null +++ b/sys/arch/amiga/stand/boot/libstubs.h @@ -0,0 +1,94 @@ +/* + * $OpenBSD: libstubs.h,v 1.1 1997/01/16 09:26:35 niklas Exp $ + * $NetBSD: libstubs.h,v 1.1.1.1 1996/11/29 23:36:29 is Exp $ + * + * Copyright (c) 1996 Ignatios Souvatzis + * 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 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 + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "amigaio.h" +#include "amigagraph.h" +#include "amigatypes.h" +#include + +extern struct ExecBase *SysBase; +extern struct Library *IntuitionBase; +extern struct Library *ExpansionBase; + +void *AllocMem (size_t, u_int32_t); +void FreeMem (void *, size_t); + +struct Library *OpenLibrary (const char *, u_int32_t); +void CloseLibrary (struct Library *); +struct MsgPort *CreateMsgPort(void); +void *CreateIORequest(struct MsgPort *, u_int32_t); +void DeleteIORequest(void *); +void DeleteMsgPort(struct MsgPort *); + +u_int8_t DoIO(struct AmigaIO *); +void SendIO(struct AmigaIO *); +struct AmigaIO *CheckIO(struct AmigaIO *); +void *WaitPort(struct MsgPort *); +void AbortIO(struct AmigaIO *); +u_int8_t WaitIO(struct AmigaIO *); + +int OpenDevice(const char *, u_int32_t, struct AmigaIO *, u_int32_t); + +void *FindResident(const char *); +void *OpenResource(const char *); + +u_int32_t CachePreDMA(u_int32_t, u_int32_t *, int); +#define DMAF_Continue 2 +#define DMAF_NoModify 4 +#define DMAF_ReadFromRAM 8 + +void Forbid(void); +void Permit(void); + +struct Screen *OpenScreenTagList(struct NewScreen *, const u_int32_t *); +struct Screen *OpenScreenTag(struct NewScreen *, ...); +struct Window *OpenWindowTagList(struct Window *, const u_int32_t *); +struct Window *OpenWindowTag(struct Window *, ...); + +#ifdef nomore +u_int32_t mytime(void); +#endif + +struct cfdev *FindConfigDev(struct cfdev *, int, int); + +#ifndef DOINLINES +void CacheClearU(void); +#else +#define LibCallNone(lib, what) \ + asm("movl a6,sp@-; movl %0,a6; " what "; movl sp@+,a6" :: \ + "r"(lib) : "d0", "d1", "a0", "a1") + +#define CacheClearU() LibCallNone(SysBase, "jsr a6@(-0x27c)") +#endif diff --git a/sys/arch/amiga/stand/boot/libstubs.s b/sys/arch/amiga/stand/boot/libstubs.s new file mode 100644 index 00000000000..d1dbe36e6c4 --- /dev/null +++ b/sys/arch/amiga/stand/boot/libstubs.s @@ -0,0 +1,269 @@ +/* + * $OpenBSD: libstubs.s,v 1.1 1997/01/16 09:26:36 niklas Exp $ + * $NetBSD: libstubs.s,v 1.1.1.1 1996/11/29 23:36:29 is Exp $ + * + * + * Copyright (c) 1996 Ignatios Souvatzis + * 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 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 + * + * 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. + * + */ + +/* + * Exec.library functions. + */ + .comm _SysBase,4 + + .globl _OpenLibrary +_OpenLibrary: + movl a6,sp@- + movl pc@(_SysBase:w),a6 + movl sp@(8),a1 + movl sp@(12),d0 + jsr a6@(-0x228) + movl sp@+,a6 + rts +#ifdef notyet + .globl _CloseLibrary +_CloseLibrary: + movl a6,sp@- + movl pc@(_SysBase:w),a6 + movl sp@(8),a1 + jsr a6@(-0x19e) + movl sp@+,a6 + rts +#endif + .globl _CreateIORequest +_CreateIORequest: + movl a6,sp@- + movl pc@(_SysBase:w),a6 + movl sp@(8),a0 + movl sp@(12),d0 + jsr a6@(-0x28e) + movl sp@+,a6 + rts + + .globl _CreateMsgPort +_CreateMsgPort: + movl a6,sp@- + movl pc@(_SysBase:w),a6 + jsr a6@(-0x29a) + movl sp@+,a6 + rts + +#ifdef notyet + .globl _DeleteMsgPort +_DeleteMsgPort: + movl a6,sp@- + movl pc@(_SysBase:w),a6 + movl sp@(8),a0 + jsr a6@(-0x2a0) + movl sp@+,a6 + rts + + .globl _DeleteIORequest +_DeleteIORequest: + movl a6,sp@- + movl pc@(_SysBase:w),a6 + movl sp@(8),a0 + jsr a6@(-0x294) + movl sp@+,a6 + rts +#endif + + .globl _OpenDevice +_OpenDevice: + movl a6,sp@- + movl pc@(_SysBase:w),a6 + movl sp@(8),a0 + movl sp@(12),d0 + movl sp@(16),a1 + movl sp@(20),d1 + jsr a6@(-0x1bc) + movl sp@+,a6 + rts + + .globl _DoIO +_DoIO: + movl a6,sp@- + movl pc@(_SysBase:w),a6 + movl sp@(8),a1 + jsr a6@(-0x1c8) + movl sp@+,a6 + rts +#ifdef nomore + .globl _CheckIO +_CheckIO: + movl a6,sp@- + movl pc@(_SysBase:w),a6 + movl sp@(8),a1 + jsr a6@(-0x1d4) + movl sp@+,a6 + rts +#endif + .globl _WaitIO +_WaitIO: + movl a6,sp@- + movl pc@(_SysBase:w),a6 + movl sp@(8),a1 + jsr a6@(-0x1da) + movl sp@+,a6 + rts + + .globl _SendIO +_SendIO: + movl a6,sp@- + movl pc@(_SysBase:w),a6 + movl sp@(8),a1 + jsr a6@(-0x1ce) + movl sp@+,a6 + rts + + .globl _AbortIO +_AbortIO: + movl a6,sp@- + movl pc@(_SysBase:w),a6 + movl sp@(8),a1 + jsr a6@(-0x1e0) + movl sp@+,a6 + rts + + .globl _WaitPort +_WaitPort: + movl a6,sp@- + movl pc@(_SysBase:w),a6 + movl sp@(8),a0 + jsr a6@(-0x180) + movl sp@+,a6 + rts + +#ifndef DOINLINES + .globl _CacheClearU +_CacheClearU: + movl a6,sp@- + movl pc@(_SysBase:w),a6 + jsr a6@(-0x27c) + movl sp@+,a6 + rts +#endif + .globl _CachePreDMA +_CachePreDMA: + movl a6,sp@- + movl pc@(_SysBase:w),a6 + movl sp@(8),a0 + movl sp@(12),a1 + movl sp@(16),d0 + jsr a6@(-0x2fa) + movl sp@+,a6 + rts + + .globl _FindResident +_FindResident: + movl a6,sp@- + movl pc@(_SysBase:w),a6 + movl sp@(8),a1 + jsr a6@(-0x60) + movl sp@+,a6 + rts + + .globl _OpenResource +_OpenResource: + movl a6,sp@- + movl pc@(_SysBase:w),a6 + movl sp@(8),a1 + jsr a6@(-0x1f2) + movl sp@+,a6 + rts +#ifdef notyet + .globl _Forbid +_Forbid: + movl a6,sp@- + movl pc@(_SysBase:W),a6 + jsr a6@(-0x84) + movl sp@+,a6 + rts + + .globl _Permit +_Permit: + movl a6,sp@- + movl pc@(_SysBase:W),a6 + jsr a6@(-0x8a) + movl sp@+,a6 + rts +#endif + +/* + * Intuition.library functions. + */ + + .comm _IntuitionBase,4 + + .globl _OpenScreenTagList +_OpenScreenTagList: + movl a6,sp@- + movl pc@(_IntuitionBase:w),a6 + movl sp@(8),a0 + movl sp@(12),a1 + jsr a6@(-0x264) + movl sp@+,a6 + rts + + .globl _OpenWindowTagList +_OpenWindowTagList: + movl a6,sp@- + movl pc@(_IntuitionBase:w),a6 + movl sp@(8),a0 + movl sp@(12),a1 + jsr a6@(-0x25e) + movl sp@+,a6 + rts +#ifdef nomore + .globl _mytime +_mytime: + movl a6,sp@- + movl pc@(_IntuitionBase:w),a6 + subql #8,sp + movl sp,a0 + lea sp@(4),a1 + jsr a6@(-0x54) + movl sp@+,d0 + addql #4,sp + movl sp@+,a6 + rts +#endif + .comm _ExpansionBase,4 + .globl _FindConfigDev +_FindConfigDev: + movl a6,sp@- + movl _ExpansionBase,a6 + movl sp@(8),a0 + movl sp@(12),d0 + movl sp@(16),d1 + jsr a6@(-0x48) + movl sp@+,a6 + rts diff --git a/sys/arch/amiga/stand/boot/main.c b/sys/arch/amiga/stand/boot/main.c new file mode 100644 index 00000000000..431468423bf --- /dev/null +++ b/sys/arch/amiga/stand/boot/main.c @@ -0,0 +1,566 @@ +/* + * $OpenBSD: main.c,v 1.1 1997/01/16 09:26:38 niklas Exp $ + * $NetBSD: main.c,v 1.1.1.1 1996/11/29 23:36:29 is Exp $ + * + * + * Copyright (c) 1996 Ignatios Souvatzis + * Copyright (c) 1994 Michael L. Hitch + * 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 Michael L. Hitch. + * 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 + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include +#include +#include + +#include + +#include +#include +#include + +#include "saerrno.h" +#include "stand.h" + +#include "libstubs.h" +#include "samachdep.h" + +#define __LDPGSZ 8192 +#define __PGSZ 8192 + +#define DRACOREVISION (*(u_int8_t *)0x02000009) +#define DRACOMMUMARGIN 0x200000 +#define DRACOZ2OFFSET 0x3000000 +#define DRACOZ2MAX 0x1000000 + +#define EXECMIN 36 + +void startit __P((void *, u_long, u_long, void *, u_long, u_long, int, void *, + int, int, u_long, u_long, int)); +void startit_end __P((void)); +int get_cpuid __P((u_int32_t *)); + +/* + * Kernel startup interface version + * 1: first version of loadbsd + * 2: needs esym location passed in a4 + * 3: load kernel image into fastmem rather than chipmem + * MAX: highest version with backward compatibility. + */ + +#define KERNEL_STARTUP_VERSION 3 +#define KERNEL_STARTUP_VERSION_MAX 9 + +static long get_number(char **); + +const char version[] = "2.0"; +char default_command[] = "openbsd -Sn2"; + +int +pain() +{ + long int io = 0; + char linebuf[128]; + char *kernel_name = default_command; + char *path = default_command; + int boothowto = RB_AUTOBOOT; + u_int32_t cpuid = 0; + int amiga_flags = 0; + u_int32_t I_flag = 0; + int k_flag = 0; + int p_flag = 0; + int Z_flag = 0; + int m_value = 0; + int S_flag = 0; + int t_flag = 0; + long stringsz; + + u_int32_t fmem = 0x0; + int fmemsz = 0x0; + int cmemsz = 0x0; + int eclock = SysBase->EClockFreq; + /* int skip_chipmem = 0; */ + + void (*start_it)(void *, u_long, u_long, void *, u_long, u_long, int, + void *, int, int, u_long, u_long, int) = startit; + + caddr_t kp; + u_int16_t *kvers; + struct exec *eh; + int textsz, ksize; + void *esym = 0; + int32_t *nkcd; + struct cfdev *cd, *kcd; + struct boot_memseg *kmemseg; + struct boot_memseg *memseg; + struct MemHead *mh; + u_int32_t from, size, vfrom, vsize; + int contflag, mapped1to1; + + int ncd, nseg; + char c; + + extern u_int16_t timelimit; + + /* + * we need V36 for: EClock, RDB Bootblocks, CacheClearU + */ + + if (SysBase->LibNode.Version < EXECMIN) { + printf("Exec V%ld, need V%ld\n", + (long)SysBase->LibNode.Version, (long)EXECMIN); + goto out; + } + + printf("\2337mOpenBSD/Amiga bootblock %s\2330m\n%s :- ", + version, kernel_name); + + timelimit = 3; + gets(linebuf); + + if (*linebuf == 'q') + return 1; + + if (*linebuf) + path = linebuf; + + /* + * parse boot command for path name and process any options + */ + while ((c = *path)) { + while (c == ' ') + c = *++path; + if (c == '-') { + while ((c = *++path) && c != ' ') { + switch (c) { + case 'a': /* multi-user state */ + boothowto &= ~RB_SINGLE; + break; + case 'b': /* ask for root device */ + boothowto |= RB_ASKNAME; + break; + case 'c': /* force machine model */ + cpuid = get_number(&path) << 16; + break; + case 'k': /* Reserve first 4M fastmem */ + k_flag++; + break; + case 'm': /* Force fastmem size */ + m_value = get_number(&path) * 1024; + break; + case 'n': /* non-contiguous memory */ + amiga_flags |= + (get_number(&path) & 3) << 1; + break; + case 'p': /* Select fastmem by priority */ + p_flag++; + break; + case 's': /* single-user state */ + boothowto |= RB_SINGLE; + break; + case 't': /* test flag */ + t_flag = 1; + break; + case 'A': /* enable AGA modes */ + amiga_flags |= 1; + break; + case 'D': /* enter Debugger */ + boothowto |= RB_KDB; + break; + case 'I': /* inhibit sync negotiation */ + I_flag = get_number(&path); + break; + case 'K': /* remove 1st 4MB fastmem */ + break; + case 'S': /* include debug symbols */ + S_flag = 1; + break; + case 'Z': /* force chip memory load */ + Z_flag = 1; + break; + } + } + } else { + kernel_name = path; + while ((c = *++path) && c != ' ') + ; + if (c) + *path++ = 0; + } + } + while ((c = *kernel_name) && c == ' ') + ++kernel_name; + path = kernel_name; + while ((c = *path) && c != ' ') + ++path; + if (c) + *path = 0; + + if (get_cpuid(&cpuid)) + goto out; + + ExpansionBase = OpenLibrary("expansion.library", 0); + if (!ExpansionBase) { + printf("can't open %s\n", "expansion.library"); + return 1; + } + + for (ncd=0, cd=0; (cd = FindConfigDev(cd, -1, -1)); ncd++) + /* nothing */; + + /* find memory list */ + + memseg = (struct boot_memseg *)alloc(16*sizeof(struct boot_memseg)); + + /* Forbid(); */ + + nseg = 0; + mh = SysBase->MemLst; + vfrom = mh->Lower & -__PGSZ; + vsize = (mh->Upper - vfrom) & -__PGSZ; + contflag = mapped1to1 = 0; + + do { + size = vsize; + + if (SysBase->LibNode.Version > 36) { + from = CachePreDMA(vfrom, &size, contflag); + contflag = DMAF_Continue; + mapped1to1 = (from == vfrom); + vsize -= size; + vfrom += size; + } else { + from = vfrom; + vsize = 0; + } + +#if DEBUG_MEMORY_LIST + printf("%lx %lx %lx %ld/%lx %lx\n", + (long)from, (long)size, + (long)mh->Attribs, (long)mh->Pri, + (long)vfrom, (long)vsize); +#endif + /* Insert The Evergrowing Kludge List Here: */ + + /* a) dont load kernel over DraCo MMU table */ + + if (((cpuid >> 24) == 0x7D) && + ((from & -DRACOMMUMARGIN) == 0x40000000) && + (size >= DRACOMMUMARGIN)) { + + memseg[nseg].ms_start = from & -DRACOMMUMARGIN; + memseg[nseg].ms_size = DRACOMMUMARGIN; + memseg[nseg].ms_attrib = mh->Attribs; + memseg[nseg].ms_pri = mh->Pri; + + size -= DRACOMMUMARGIN - (from & (DRACOMMUMARGIN - 1)); + from += DRACOMMUMARGIN - (from & (DRACOMMUMARGIN - 1)); + ++nseg; + } + + if ((mh->Attribs & (MEMF_CHIP|MEMF_FAST)) == MEMF_CHIP) { + size += from; + cmemsz = size;; + from = 0; + } else if ((fmemsz < size) && mapped1to1) { + fmem = from; + fmemsz = size; + } + + memseg[nseg].ms_start = from; + memseg[nseg].ms_size = size; + memseg[nseg].ms_attrib = mh->Attribs; + memseg[nseg].ms_pri = mh->Pri; + + if (vsize == 0) { + mh = mh->next; + contflag = 0; + if (mh->next) { + vfrom = mh->Lower & -__PGSZ; + vsize = (mh->Upper & -__PGSZ) - vfrom; + } + } + } while ((++nseg <= 16) && vsize); + + /* Permit(); */ + + printf("Loading %s: ", kernel_name); + io = open(kernel_name, 0); + if (io < 0) + goto err; + + eh = alloc(sizeof(*eh)); + if (!eh) { + errno = ENOMEM; + goto err; + } + if (read(io, eh, sizeof(*eh)) != sizeof(*eh)) { + errno = ENOEXEC; + goto err; + } + + if ((N_GETMAGIC(*eh) != NMAGIC) || (N_GETMID(*eh) != MID_M68K)) { + errno = ENOEXEC; + goto err; + } + + textsz = (eh->a_text + __LDPGSZ - 1) & (-__LDPGSZ); + esym = 0; + + ksize = textsz + eh->a_data + eh->a_bss + + sizeof(*nkcd) + ncd*sizeof(*cd) + + sizeof(*nkcd) + nseg * sizeof(struct boot_memseg); + + if (S_flag && eh->a_syms) { + if (lseek(io, eh->a_text+ eh->a_data+ eh->a_syms, SEEK_CUR) + <= 0 + || read(io, &stringsz, 4) != 4 + || lseek(io, sizeof(*eh), SEEK_SET) < 0) + goto err; + ksize += eh->a_syms + 4 + ((stringsz + 3) & ~3); + } + + kp = alloc(ksize + 256 + ((u_char *)startit_end - (u_char *)startit)); + if (kp == 0) { + errno = ENOMEM; + goto err; + } + + printf("%ld", eh->a_text); + if (read(io, kp, eh->a_text) != eh->a_text) + goto err; + + printf("+%ld", eh->a_data); + if (read(io, kp + textsz, eh->a_data) != eh->a_data) + goto err; + + printf("+%ld", eh->a_bss); + + kvers = (u_short *)(kp + eh->a_entry - 2); + + if (*kvers > KERNEL_STARTUP_VERSION_MAX && *kvers != 0x4e73) { + printf("\nnewer bootblock required: %ld\n", (long)*kvers); + goto freeall; + } +#if 0 + if (*kvers > KERNEL_STARTUP_VERSION) + printf("\nKernel V%ld newer than bootblock V%ld\n", + (long)*kvers, (long)KERNEL_STARTUP_VERSION); +#endif + nkcd = (int *)(kp + textsz + eh->a_data + eh->a_bss); + if (*kvers != 0x4e73 && *kvers > 1 && S_flag && eh->a_syms) { + *nkcd++ = eh->a_syms; + printf("+[%ld", eh->a_syms); + if (read(io, (char *)nkcd, eh->a_syms) != eh->a_syms) + goto err; + nkcd = (int *)((char *)nkcd + eh->a_syms); + printf("+%ld]", stringsz); + if (read(io, (char *)nkcd, stringsz) != stringsz) + goto err; + nkcd = (int*)((char *)nkcd + ((stringsz + 3) & ~3)); + esym = (char *)(textsz + eh->a_data + eh->a_bss + + eh->a_syms + 4 + ((stringsz + 3) & ~3)); + } + putchar('\n'); + + *nkcd = ncd; + kcd = (struct cfdev *)(nkcd + 1); + + while ((cd = FindConfigDev(cd, -1, -1))) { + *kcd = *cd; + if (((cpuid >> 24) == 0x7D) && + ((u_long)kcd->addr < 0x1000000)) { + kcd->addr += 0x3000000; + } + ++kcd; + } + + nkcd = (u_int32_t *)kcd; + *nkcd = nseg; + + kmemseg = (struct boot_memseg *)(nkcd + 1); + + while (nseg-- > 0) + *kmemseg++ = *memseg++; + + if (*kvers > 2 && Z_flag == 0) { + /* + * Kernel supports direct load to fastmem, and the -Z + * option was not specified. Copy startup code to end + * of kernel image and set start_it. + */ + if ((u_int32_t)kp < fmem) { + errno = EFBIG; + goto err; + } + memcpy(kp + ksize + 256, (char *)startit, + (char *)startit_end - (char *)startit); + CacheClearU(); + (caddr_t)start_it = kp + ksize + 256; + printf("*** Loading from %08lx to Fastmem %08lx ***\n", + (u_long)kp, (u_long)fmem); + /* sleep(2); */ + } else { + /* + * Either the kernel doesn't suppport loading directly to + * fastmem or the -Z flag was given. Verify kernel image + * fits into chipmem. + */ + if (ksize >= cmemsz) { + printf("Kernel size %d exceeds Chip Memory of %d\n", + ksize, cmemsz); + return 20; + } + Z_flag = 1; + printf("*** Loading from %08lx to Chipmem ***\n", (u_long)kp); + } + +#if 0 + printf("would start(kp=0x%lx, ksize=%ld, entry=0x%lx,\n" + "fmem=0x%lx, fmemsz=%ld, cmemsz=%ld\n" + "boothow=0x%lx, esym=0x%lx, cpuid=0x%lx, eclock=%ld\n" + "amigaflags=0x%lx, I_flags=0x%lx, Zflag=%ld, ok?\n", + (u_long)kp, (u_long)ksize, eh->a_entry, + (u_long)fmem, (u_long)fmemsz, (u_long)cmemsz, + (u_long)boothowto, (u_long)esym, (u_long)cpuid, (u_long)eclock, + (u_long)amiga_flags, (u_long)I_flag, (u_long)(Z_flag == 0)); +#endif + timelimit = 2; + (void)getchar(); + + start_it(kp, ksize, eh->a_entry, (void *)fmem, fmemsz, cmemsz, + boothowto, esym, cpuid, eclock, amiga_flags, I_flag, Z_flag == 0); + /*NOTREACHED*/ + +freeall: + free(kp, ksize); + free(eh, sizeof(*eh)); +err: + printf("\nError %ld\n", (long)errno); + close(io); +out: + timelimit = 10; + (void)getchar(); + return 1; +} + +static +long get_number(ptr) +char **ptr; +{ + long value = 0; + int base = 10; + char *p = *ptr; + char c; + char sign = 0; + + c = *++p; + while (c == ' ') + c = *++p; + if (c == '-') { + sign = -1; + c = *++p; + } + if (c == '$') { + base = 16; + c = *++p; + } else if (c == '0') { + c = *++p; + if ((c & 0xdf) == 'X') { + base = 16; + c = *++p; + } + } + while (c) { + if (c >= '0' && c <= '9') + c -= '0'; + else { + c = (c & 0xdf) - 'A' + 10; + if (base != 16 || c < 10 || c > 15) + break; + } + value = value * base + c; + c = *++p; + } + *ptr = p - 1; +#ifdef TEST + fprintf(stderr, "get_number: got %c0x%x", + sign ? '-' : '+', value); +#endif + return (sign ? -value : value); +} + +/* + * Try to determine the machine ID by searching the resident module list + * for modules only present on specific machines. (Thanks, Bill!) + */ + +int +get_cpuid(cpuid) + u_int32_t *cpuid; +{ + *cpuid |= SysBase->AttnFlags; /* get FPU and CPU flags */ + if (*cpuid & 0xffff0000) { + if ((*cpuid >> 24) == 0x7D) + return 0; + + switch (*cpuid >> 16) { + case 500: + case 600: + case 1000: + case 1200: + case 2000: + case 3000: + case 4000: + return 0; + default: + printf("Amiga %ld ???\n", + (long)(*cpuid >> 16)); + return(1); + } + } + if (FindResident("A4000 Bonus") || FindResident("A4000 bonus") + || FindResident("A1000 Bonus")) + *cpuid |= 4000 << 16; + else if (FindResident("A3000 Bonus") || FindResident("A3000 bonus") + || (SysBase->LibNode.Version == 36)) + *cpuid |= 3000 << 16; + else if (OpenResource("card.resource")) { + /* Test for AGA? */ + *cpuid |= 1200 << 16; + } else if (OpenResource("draco.resource")) { + *cpuid |= (32000 | DRACOREVISION) << 16; + } + /* + * Nothing found, it's probably an A2000 or A500 + */ + if ((*cpuid >> 16) == 0) + *cpuid |= 2000 << 16; + + return 0; +} diff --git a/sys/arch/amiga/stand/boot/muldi3.s b/sys/arch/amiga/stand/boot/muldi3.s new file mode 100644 index 00000000000..d2003ff5a4d --- /dev/null +++ b/sys/arch/amiga/stand/boot/muldi3.s @@ -0,0 +1,63 @@ +/* $OpenBSD: muldi3.s,v 1.1 1997/01/16 09:26:39 niklas Exp $ +/* $NetBSD: muldi3.s,v 1.1.1.1 1996/11/29 23:36:30 is Exp $ + * + * Copyright (c) 1996 Ignatios Souvatzis + * 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 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 + * + * 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. + * + * Slow but small muldi3. + * Beware... the multiplicand is unsigned (but should be enough for + * usage by ufs.c :-) + */ + + .text + .even + .globl ___muldi3 +___muldi3: + movml d2/d3/d4/d5/d6,sp@- | 0..4 regs, 5 pc, 6..9 parameters + movml sp@(24),d2-d5 +| movl sp@(24),d2 +| movl sp@(28),d3 +| movl sp@(32),d4 +| movl sp@(36),d5 + movq #0,d0 + movq #0,d1 + movq #63,d6 +L4: + asrl #1,d2 + roxrl #1,d3 + jcc L5 + addl d5,d1 + addxl d4,d0 +L5: + addl d5,d5 + addxl d4,d4 +L7: + dbra d6,L4 + movml sp@+,d2/d3/d4/d5/d6 + rts diff --git a/sys/arch/amiga/stand/boot/printf.s b/sys/arch/amiga/stand/boot/printf.s new file mode 100644 index 00000000000..a49a597342a --- /dev/null +++ b/sys/arch/amiga/stand/boot/printf.s @@ -0,0 +1,76 @@ +/* + * $OpenBSD: printf.s,v 1.1 1997/01/16 09:26:40 niklas Exp $ + * $NetBSD: printf.s,v 1.1.1.1 1996/11/29 23:36:29 is Exp $ + * + * + * Copyright (c) 1996 Ignatios Souvatzis + * 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 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 + * + * 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. + * + */ + +/* + * printf calling exec's RawDoFmt + * Beware! You have to explicitly use %ld etc. for 32bit integers! + */ + .text + .globl _printf + .globl _putchar, _SysBase + +Lputch: + movl d0,sp@- + bsr _putchar + addql #4,sp + rts + +_printf: + movml #0x0032,sp@- + lea pc@(Lputch:w),a2 + lea sp@(20),a1 + movl sp@(16),a0 + movl pc@(_SysBase:w),a6 + jsr a6@(-0x20a) + movml sp@+, #0x4c00 + rts +#if 0 +Lstorech: + movb d0, a3@+ + rts + + .globl _sprintf +_sprintf: + movml #0x0032,sp@- + movl sp@(16),a3 + lea pc@(Lstorech:w),a2 + lea sp@(24),a1 + movl sp@(20),a0 + movl pc@(_SysBase:w),a6 + jsr a6@(-0x20a) + movml sp@+, #0x4c00 + rts +#endif diff --git a/sys/arch/amiga/stand/boot/samachdep.h b/sys/arch/amiga/stand/boot/samachdep.h new file mode 100644 index 00000000000..57ca2285ef9 --- /dev/null +++ b/sys/arch/amiga/stand/boot/samachdep.h @@ -0,0 +1,51 @@ +/* + * $OpenBSD: samachdep.h,v 1.1 1997/01/16 09:26:41 niklas Exp $ + * $NetBSD: samachdep.h,v 1.1.1.1 1996/11/29 23:36:29 is Exp $ + * + * Copyright (c) 1996 Ignatios Souvatzis + * 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 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 + * + * 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 _SA_MACHDEP_H_ +#define _SA_MACHDEP_H_ + +/* "hardware" init: */ + +int configure(void *); +int pain(void); + +/* console functions not declared MI: */ + +int consinit(void); +void puts(char *); + +void xdinit(void *); + +#endif diff --git a/sys/arch/amiga/stand/boot/startit.s b/sys/arch/amiga/stand/boot/startit.s new file mode 100644 index 00000000000..a8dd10c9c2f --- /dev/null +++ b/sys/arch/amiga/stand/boot/startit.s @@ -0,0 +1,235 @@ +/* $OpenBSD: startit.s,v 1.1 1997/01/16 09:26:41 niklas Exp $ */ +/* $NetBSD: startit.s,v 1.1.1.1 1996/11/29 23:36:29 is Exp $ */ + +/* + * Copyright (c) 1996 Ignatios Souvatzis + * Copyright (c) 1994 Michael L. Hitch + * 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 Michael L. Hitch. + * 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. + * + * + * From: $NetBSD: startit.s,v 1.1.1.1 1996/11/29 23:36:29 is Exp $ + */ + + .set ABSEXECBASE,4 + + .text + + .globl _startit + .globl _startit_end + +_startit: +#if TESTONAMIGA + movew #0x999,0xdff180 | gray +#endif + movel sp,a3 + movel 4:w,a6 + lea pc@(start_super:w),a5 + jmp a6@(-0x1e) | supervisor-call + +start_super: +#if TESTONAMIGA + movew #0x900,0xdff180 | dark red +#endif + movew #0x2700,sr + + | the BSD kernel wants values into the following registers: + | a0: fastmem-start + | d0: fastmem-size + | d1: chipmem-size + | d3: Amiga specific flags + | d4: E clock frequency + | d5: AttnFlags (cpuid) + | d7: boothowto + | a4: esym location + | a2: Inhibit sync flags + | All other registers zeroed for possible future requirements. + + lea pc@(_startit:w),sp | make sure we have a good stack *** + + movel a3@(4),a1 | loaded kernel + movel a3@(8),d2 | length of loaded kernel +| movel a3@(12),sp | entry point in stack pointer + movel a3@(12),a6 | entry point *** + movel a3@(16),a0 | fastmem-start + movel a3@(20),d0 | fastmem-size + movel a3@(24),d1 | chipmem-size + movel a3@(28),d7 | boothowto + movel a3@(32),a4 | esym + movel a3@(36),d5 | cpuid + movel a3@(40),d4 | E clock frequency + movel a3@(44),d3 | Amiga flags + movel a3@(48),a2 | Inhibit sync flags + movel a3@(52),d6 | Load to fastmem flag + subl a5,a5 | target, load to 0 + + cmpb #0x7D,a3@(36) | is it DraCo? + beq nott | yes, switch off MMU later + + | no, it is an Amiga: + +#if TESTONAMIGA + movew #0xf00,0xdff180 |red +#endif +| moveb #0,0x200003c8 +| moveb #63,0x200003c9 +| moveb #0,0x200003c9 +| moveb #0,0x200003c9 + + movew #(1<<9),0xdff096 | disable DMA on Amigas. + +| ------ mmu off start ----- + + btst #3,d5 | AFB_68040,SysBase->AttnFlags + beq not040 + +| Turn off 68040/060 MMU + + subl a3,a3 + .word 0x4e7b,0xb003 | movec a3,tc + .word 0x4e7b,0xb806 | movec a3,urp + .word 0x4e7b,0xb807 | movec a3,srp + .word 0x4e7b,0xb004 | movec a3,itt0 + .word 0x4e7b,0xb005 | movec a3,itt1 + .word 0x4e7b,0xb006 | movec a3,dtt0 + .word 0x4e7b,0xb007 | movec a3,dtt1 + bra nott + +not040: + lea pc@(zero:w),a3 + pmove a3@,tc | Turn off MMU + lea pc@(nullrp:w),a3 + pmove a3@,crp | Turn off MMU some more + pmove a3@,srp | Really, really, turn off MMU + +| Turn off 68030 TT registers + + btst #2,d5 | AFB_68030,SysBase->AttnFlags + beq nott | Skip TT registers if not 68030 + lea pc@(zero:w),a3 + .word 0xf013,0x0800 | pmove a3@,tt0 (gas only knows about 68851 ops..) + .word 0xf013,0x0c00 | pmove a3@,tt1 (gas only knows about 68851 ops..) + +nott: +| ---- mmu off end ---- +#if TESTONAMIGA + movew #0xf60,0xdff180 | orange +#endif +| moveb #0,0x200003c8 +| moveb #63,0x200003c9 +| moveb #24,0x200003c9 +| moveb #0,0x200003c9 + +| ---- copy kernel start ---- + + tstl d6 | Can we load to fastmem? + beq L0 | No, leave destination at 0 + movl a0,a5 | Move to start of fastmem chunk + addl a0,a6 | relocate kernel entry point +L0: + movl a1@+,a5@+ + subl #4,d2 + bcc L0 + + lea pc@(ckend:w),a1 + movl a5,sp@- + pea pc@(_startit_end:w) +L1: + movl a1@+,a5@+ + cmpl sp@,a1 + bcs L1 + addql #4,sp + + btst #3,d5 + jeq L2 + .word 0xf4f8 +L2: movql #0,d2 | switch off cache to ensure we use + movec d2,cacr | valid kernel data + +#if TESTONAMIGA + movew #0xFF0,0xdff180 | yellow +#endif +| moveb #0,0x200003c8 +| moveb #63,0x200003c9 +| moveb #0,0x200003c9 +| moveb #0,0x200003c9 + + rts + +| ---- copy kernel end ---- + +ckend: +#if TESTONAMIGA + movew #0x0ff,0xdff180 | petrol +#endif +| moveb #0,0x200003c8 +| moveb #0,0x200003c9 +| moveb #63,0x200003c9 +| moveb #63,0x200003c9 + + movl d5,d2 + roll #8,d2 + cmpb #0x7D,d2 + jne noDraCo + +| DraCo: switch off MMU now: + + subl a3,a3 + .word 0x4e7b,0xb003 | movec a3,tc + .word 0x4e7b,0xb806 | movec a3,urp + .word 0x4e7b,0xb807 | movec a3,srp + .word 0x4e7b,0xb004 | movec a3,itt0 + .word 0x4e7b,0xb005 | movec a3,itt1 + .word 0x4e7b,0xb006 | movec a3,dtt0 + .word 0x4e7b,0xb007 | movec a3,dtt1 + +noDraCo: + moveq #0,d2 | zero out unused registers + moveq #0,d6 | (might make future compatibility + movel d6,a1 | would have known contents) + movel d6,a3 + movel d6,a5 + movel a6,sp | entry point into stack pointer + movel d6,a6 + +#if TESTONAMIGA + movew #0x0F0,0xdff180 | green +#endif +| moveb #0,0x200003c8 +| moveb #0,0x200003c9 +| moveb #63,0x200003c9 +| moveb #0,0x200003c9 + + jmp sp@ | jump to kernel entry point + + +| A do-nothing MMU root pointer (includes the following long as well) + +nullrp: .long 0x7fff0001 +zero: .long 0 + +_startit_end: diff --git a/sys/arch/amiga/stand/boot/test.s b/sys/arch/amiga/stand/boot/test.s new file mode 100644 index 00000000000..e5abdd9d4bb --- /dev/null +++ b/sys/arch/amiga/stand/boot/test.s @@ -0,0 +1,7 @@ + .text + .globl _start +_start: + lea pc@(bla),a0 + movq #1,d0 + rts + .globl bla diff --git a/sys/arch/amiga/stand/boot/twiddle.c b/sys/arch/amiga/stand/boot/twiddle.c new file mode 100644 index 00000000000..bd07e47cb57 --- /dev/null +++ b/sys/arch/amiga/stand/boot/twiddle.c @@ -0,0 +1,52 @@ +/* $OpenBSD: twiddle.c,v 1.1 1997/01/16 09:26:44 niklas Exp $ */ +/* $NetBSD: twiddle.c,v 1.1.1.1 1996/11/29 23:36:29 is Exp $ */ + +/*- + * Copyright (c) 1993 + * 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. + * + * @(#)printf.c 8.1 (Berkeley) 6/11/93 + */ + +/* From: $NetBSD: twiddle.c,v 1.1.1.1 1996/11/29 23:36:29 is Exp $ */ + +#include "stand.h" + +const static char chars[4] = {'|', '/', '-', '\\'}; + +void +twiddle() +{ + static short int pos; + + putchar(chars[pos++ & 3]); + putchar('\b'); +} diff --git a/sys/arch/amiga/stand/boot/txlt/Makefile b/sys/arch/amiga/stand/boot/txlt/Makefile new file mode 100644 index 00000000000..8a13db5974c --- /dev/null +++ b/sys/arch/amiga/stand/boot/txlt/Makefile @@ -0,0 +1,10 @@ +# $OpenBSD: Makefile,v 1.1 1997/01/16 09:26:55 niklas Exp $ + +PROG=txlt +NOMAN=noman +LDADD=-ll +CLEANFILES+=txlt.c + +install: + +.include diff --git a/sys/arch/amiga/stand/boot/txlt/txlt.l b/sys/arch/amiga/stand/boot/txlt/txlt.l new file mode 100644 index 00000000000..a9156778644 --- /dev/null +++ b/sys/arch/amiga/stand/boot/txlt/txlt.l @@ -0,0 +1,19 @@ + void munchit(char *); +%% +\..*\n printf("%s", yytext); +pea[ ][_A-Za-z][A-Za-z0-9_]*$ {printf("pea");munchit(yytext+3);} +\ [_A-Za-z][A-Za-z0-9_]*/\, munchit(yytext); +. putchar(*yytext); +%% +void +munchit(s) + char *s; +{ + putchar(*s++); + if (!strncmp(s, "fp", 2) || + !strncmp(s, "sp", 2) || + ((*s == 'a') || (*s == 'd')) && ((s[1]-'0')<=7)) + printf("%s", s); + else + printf("pc@(%s)",s); +} diff --git a/sys/arch/amiga/stand/boot/xd.c b/sys/arch/amiga/stand/boot/xd.c new file mode 100644 index 00000000000..b3831842c60 --- /dev/null +++ b/sys/arch/amiga/stand/boot/xd.c @@ -0,0 +1,157 @@ +/* + * $OpenBSD: xd.c,v 1.1 1997/01/16 09:26:45 niklas Exp $ + * $NetBSD: xd.c,v 1.1.1.1 1996/11/29 23:36:29 is Exp $ + * + * Copyright (c) 1996 Ignatios Souvatzis. + * Copyright (c) 1995 Waldi Ravens. + * 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 Waldi Ravens. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include +#include + + +#include "samachdep.h" +#include "amigaio.h" +#include "libstubs.h" + +static int xdstrategy __P((void *, int, daddr_t, size_t, void *, size_t *)); +static int xdopen __P((struct open_file *, ...)); +static int xdclose __P((struct open_file *)); +static int xdioctl __P((struct open_file *, u_long, void *)); + +static u_int32_t aio_base; +static struct AmigaIO *aio_save; + +static struct devsw devsw[] = { + { "xd", xdstrategy, xdopen, xdclose, xdioctl } +}; + +struct fs_ops file_system[] = { + { ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek, ufs_stat }, +}; + +int nfsys = sizeof(file_system)/sizeof(struct fs_ops); + + + +/* called from configure */ + +void +xdinit(aio) + void *aio; +{ + aio_save = aio; + aio_base = aio_save->offset; +} + +/* + * Kernel ist loaded from device and partition the kickstart + * menu or boot priority has chosen: + */ + +int +devopen(f, fname, file) + struct open_file *f; + const char *fname; + char **file; +{ + f->f_devdata = aio_save; + f->f_dev = &devsw[0]; + *file = (char *)fname; + return 0; +} + +/* tell kickstart to do the real work */ + +static int +xdstrategy (devd, flag, dblk, size, buf, rsize) + void *devd; + int flag; + daddr_t dblk; + size_t size; + void *buf; + size_t *rsize; +{ + struct AmigaIO *aio = (struct AmigaIO *)devd; + + if (flag != F_READ) + return EIO; + + aio->cmd = Cmd_Rd; + aio->length = size; + aio->offset = aio_base + (dblk << 9); + aio->buf = buf; + +#ifdef XDDEBUG + printf("strategy called: %ld(%ld), %ld, 0x%lx\n", + (long)dblk, (long)aio->offset, (long)size, (unsigned long)buf); +#endif + + DoIO(aio); + +#ifdef XDDEBUG + printf("strategy got err %ld, rsize %ld\n", aio->err, aio->actual); +#endif + + if (aio->err) { + *rsize = 0; + return EIO; + } + + *rsize = aio->actual; + return 0; +} + + +/* nothing do do for these: */ + +static int +xdopen(f) + struct open_file *f; +{ + return 0; +} + +static int +xdclose(f) + struct open_file *f; +{ + return 0; +} + +static int +xdioctl (f, cmd, data) + struct open_file *f; + u_long cmd; + void *data; +{ + return EIO; +} diff --git a/sys/arch/amiga/stand/boot/xd.h b/sys/arch/amiga/stand/boot/xd.h new file mode 100644 index 00000000000..c50a64bb174 --- /dev/null +++ b/sys/arch/amiga/stand/boot/xd.h @@ -0,0 +1,48 @@ +/* + * $OpenBSD: xd.h,v 1.1 1997/01/16 09:26:45 niklas Exp $ + * $NetBSD: xd.h,v 1.1.1.1 1996/11/29 23:36:29 is Exp $ + * + * Copyright (c) 1996 Ignatios Souvatzis + * 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 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 + * + * 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. + * + */ + +/* + * Prototypes for eXec disks: + */ + +#ifndef _XD_H_ +#define _XD_H_ + +#include + +void xdinit (void *); +int xdstrategy (void *, int, daddr_t, size_t, void *, size_t *); + +#endif diff --git a/sys/arch/amiga/stand/dumpfont/dumpfont.c b/sys/arch/amiga/stand/dumpfont/dumpfont.c index 0107c2e7dd5..1c3da88e743 100644 --- a/sys/arch/amiga/stand/dumpfont/dumpfont.c +++ b/sys/arch/amiga/stand/dumpfont/dumpfont.c @@ -1,3 +1,4 @@ +/* $OpenBSD: dumpfont.c,v 1.2 1997/01/16 09:26:58 niklas Exp $ */ /* $NetBSD: dumpfont.c,v 1.5 1994/10/26 02:06:57 cgd Exp $ */ /* diff --git a/sys/arch/amiga/stand/dumpfont/fontdumper.c b/sys/arch/amiga/stand/dumpfont/fontdumper.c index 365dbb7916d..d7d31d3e9b2 100644 --- a/sys/arch/amiga/stand/dumpfont/fontdumper.c +++ b/sys/arch/amiga/stand/dumpfont/fontdumper.c @@ -1,3 +1,4 @@ +/* $OpenBSD: fontdumper.c,v 1.2 1997/01/16 09:26:59 niklas Exp $ */ /* $NetBSD: fontdumper.c,v 1.3 1994/10/26 02:06:59 cgd Exp $ */ /* diff --git a/sys/arch/amiga/stand/loadbsd/Makefile b/sys/arch/amiga/stand/loadbsd/Makefile new file mode 100644 index 00000000000..2acabbffa1a --- /dev/null +++ b/sys/arch/amiga/stand/loadbsd/Makefile @@ -0,0 +1,13 @@ +# $OpenBSD: Makefile,v 1.1 1997/01/16 09:27:00 niklas Exp $ + +CC = gcc +CFLAGS = -m68030 -O2 -D__progname=program_name -noixemul + +OBJS = loadbsd.o getopt.o +LIBS = -lamiga + +loadbsd: $(OBJS) + $(CC) $(CFLAGS) $(LDFLAGS) -o loadbsd $(OBJS) $(LIBS) + +clean: + delete $(OBJS) loadbsd diff --git a/sys/arch/amiga/stand/loadbsd/README b/sys/arch/amiga/stand/loadbsd/README new file mode 100644 index 00000000000..d70a2911e89 --- /dev/null +++ b/sys/arch/amiga/stand/loadbsd/README @@ -0,0 +1,22 @@ +$OpenBSD: README,v 1.1 1997/01/16 09:27:01 niklas Exp $ + +This was prepared to compile with gcc 2.7.0 for AmigaOS and +libnix 1.0. You don't need ixemul or special directories to run the +binary, if compiled that way. + +With very old versions of gcc, you might need to add +2-. to relative +offsets in the assembler part, but honestly, I suggest you upgrade your +assembler (and compiler) instead, even if you know what I'm talking about +and how to identify the lines. + +You'll need the (unchanged) getopt.c from src/lib/libc/stdlib, too. + +With newer libnix or the ADE version of gcc, or when removing the +-noixemul option from CFLAGS, you might need (or want) to delete the +sleep() function at the bottom of loadbsd, or getopt.o from the +"OBJS =" line of Makefile. + +[Sorry, but I didn't dare to risk my gcc installation a few weeks + before the release by trying to install ADE] + + Ignatios Souvatzis diff --git a/sys/arch/amiga/stand/loadbsd/loadbsd.c b/sys/arch/amiga/stand/loadbsd/loadbsd.c index bd30916977a..11c9c417d7d 100644 --- a/sys/arch/amiga/stand/loadbsd/loadbsd.c +++ b/sys/arch/amiga/stand/loadbsd/loadbsd.c @@ -1,5 +1,5 @@ -/* $OpenBSD: loadbsd.c,v 1.9 1997/01/15 23:41:50 millert Exp $ */ -/* $NetBSD: loadbsd.c,v 1.19.4.2 1996/08/03 00:51:46 jtc Exp $ */ +/* $OpenBSD: loadbsd.c,v 1.10 1997/01/16 09:27:03 niklas Exp $ */ +/* $NetBSD: loadbsd.c,v 1.22 1996/10/13 13:39:52 is Exp $ */ /* * Copyright (c) 1994 Michael L. Hitch @@ -409,7 +409,7 @@ main(argc, argv) if ((void *)kp < fmem) { printf("Kernel at %08lx, Fastmem used at %08lx\n", kp, fmem); - errx(20, "Can't copy downwards yet."); + errx(20, "Can't copy upwards yet.\nDefragment your memory and try again OR try the -p OR try the -Z options."); } memcpy(kp + ksize + 256, (char *)startit, (char *)startit_end - (char *)startit); diff --git a/sys/arch/amiga/stand/loadkmap/Makefile b/sys/arch/amiga/stand/loadkmap/Makefile index a13714f1176..d08e6e75dd2 100644 --- a/sys/arch/amiga/stand/loadkmap/Makefile +++ b/sys/arch/amiga/stand/loadkmap/Makefile @@ -1,5 +1,5 @@ -# $OpenBSD: Makefile,v 1.2 1996/10/04 22:35:34 niklas Exp $ -# $NetBSD: Makefile,v 1.1.2.2 1996/07/31 16:08:59 jtc Exp $ +# $OpenBSD: Makefile,v 1.3 1997/01/16 09:27:05 niklas Exp $ +# $NetBSD: Makefile,v 1.5 1996/09/27 03:23:13 chopps Exp $ PROG=loadkmap NOMAN=loadkmap diff --git a/sys/arch/amiga/stand/loadkmap/Makefile.inc b/sys/arch/amiga/stand/loadkmap/Makefile.inc index 9114e0bf062..9fe957060e2 100644 --- a/sys/arch/amiga/stand/loadkmap/Makefile.inc +++ b/sys/arch/amiga/stand/loadkmap/Makefile.inc @@ -1,18 +1,15 @@ -# $OpenBSD: Makefile.inc,v 1.3 1996/10/04 23:31:23 niklas Exp $ -# $NetBSD: Makefile.inc,v 1.1.2.3 1996/06/25 01:13:36 jtc Exp $ +# $OpenBSD: Makefile.inc,v 1.4 1997/01/16 09:27:06 niklas Exp $ +# $NetBSD: Makefile.inc,v 1.2 1996/06/21 21:55:53 is Exp $ -BINDIR= /usr/share/keymaps/amiga +BINDIR= ${DESTDIR}/usr/share/keymaps/amiga NOMAN= CC= ${HOSTCC} -all: ${MAP} - -${MAP}: ${PROG} - ./${PROG} >${MAP} - -realinstall: -.if !exists(${DESTDIR}${BINDIR}) - mkdir -p ${DESTDIR}${BINDIR} +# XXX making dirs should be handled by mtree +realinstall: ${PROG} +.if !exists(${BINDIR}) + mkdir -p ${BINDIR} .endif - install ${COPY} -o ${BINOWN} -g ${BINGRP} -m 555 ${MAP} \ - ${DESTDIR}${BINDIR} + ./${PROG} > ${BINDIR}/${MAP} + chmod 555 ${BINDIR}/${MAP} + chown ${BINOWN}.${BINGRP} ${BINDIR}/${MAP} diff --git a/sys/arch/amiga/stand/loadkmap/din/din-kbdmap.c b/sys/arch/amiga/stand/loadkmap/din/din-kbdmap.c index 8872b9251ce..f2346dcb5d1 100644 --- a/sys/arch/amiga/stand/loadkmap/din/din-kbdmap.c +++ b/sys/arch/amiga/stand/loadkmap/din/din-kbdmap.c @@ -1,5 +1,5 @@ -/* $OpenBSD: din-kbdmap.c,v 1.2 1996/10/04 22:35:39 niklas Exp $ */ -/* $NetBSD: din-kbdmap.c,v 1.4.6.1 1996/06/08 16:03:59 is Exp $ */ +/* $OpenBSD: din-kbdmap.c,v 1.3 1997/01/16 09:27:07 niklas Exp $ */ +/* $NetBSD: din-kbdmap.c,v 1.5 1996/06/08 15:28:51 is Exp $ */ #include "../../../dev/kbdmap.h" diff --git a/sys/arch/amiga/stand/loadkmap/sw/Makefile b/sys/arch/amiga/stand/loadkmap/sw/Makefile index 14aabe63262..2eaa0f2f5f4 100644 --- a/sys/arch/amiga/stand/loadkmap/sw/Makefile +++ b/sys/arch/amiga/stand/loadkmap/sw/Makefile @@ -1,7 +1,8 @@ -# $OpenBSD: Makefile,v 1.2 1996/10/04 22:35:40 niklas Exp $ -# $NetBSD: Makefile,v 1.2.2.1 1996/07/31 16:11:27 jtc Exp $ +# $OpenBSD: Makefile,v 1.3 1997/01/16 09:27:09 niklas Exp $ +# $NetBSD: Makefile,v 1.4 1996/12/31 22:36:19 veego Exp $ PROG=sw-kbdmap +NOMAN= MAP=sw.map .include diff --git a/sys/arch/amiga/stand/loadkmap/sw/sw-kbdmap.c b/sys/arch/amiga/stand/loadkmap/sw/sw-kbdmap.c index 8ed46de9840..84da5915830 100644 --- a/sys/arch/amiga/stand/loadkmap/sw/sw-kbdmap.c +++ b/sys/arch/amiga/stand/loadkmap/sw/sw-kbdmap.c @@ -1,5 +1,5 @@ -/* $OpenBSD: sw-kbdmap.c,v 1.2 1996/10/04 22:35:40 niklas Exp $ */ -/* $NetBSD: sw-kbdmap.c,v 1.2.4.1 1996/06/08 16:04:02 is Exp $ */ +/* $OpenBSD: sw-kbdmap.c,v 1.3 1997/01/16 09:27:11 niklas Exp $ */ +/* $NetBSD: sw-kbdmap.c,v 1.3 1996/06/08 15:28:58 is Exp $ */ /* * Copyright (c) 1993 Markus Wild diff --git a/sys/arch/amiga/stand/loadkmap/us/Makefile b/sys/arch/amiga/stand/loadkmap/us/Makefile index 5c303e5b5e6..df748236577 100644 --- a/sys/arch/amiga/stand/loadkmap/us/Makefile +++ b/sys/arch/amiga/stand/loadkmap/us/Makefile @@ -1,7 +1,8 @@ -# $OpenBSD: Makefile,v 1.2 1996/10/04 22:35:41 niklas Exp $ -# $NetBSD: Makefile,v 1.2 1996/06/08 15:42:03 is Exp $ +# $OpenBSD: Makefile,v 1.3 1997/01/16 09:27:12 niklas Exp $ +# $NetBSD: Makefile,v 1.3 1996/12/31 22:36:20 veego Exp $ PROG=us-kbdmap +NOMAN= MAP=us.map .include diff --git a/sys/arch/amiga/stand/loadkmap/us/us-kbdmap.c b/sys/arch/amiga/stand/loadkmap/us/us-kbdmap.c index b2acc38d0a0..26c4febfb22 100644 --- a/sys/arch/amiga/stand/loadkmap/us/us-kbdmap.c +++ b/sys/arch/amiga/stand/loadkmap/us/us-kbdmap.c @@ -1,5 +1,5 @@ -/* $OpenBSD: us-kbdmap.c,v 1.2 1996/10/04 22:35:42 niklas Exp $ */ -/* $NetBSD: us-kbdmap.c,v 1.3.6.1 1996/06/08 16:04:03 is Exp $ */ +/* $OpenBSD: us-kbdmap.c,v 1.3 1997/01/16 09:27:13 niklas Exp $ */ +/* $NetBSD: us-kbdmap.c,v 1.4 1996/06/08 15:29:04 is Exp $ */ #include "../../../dev/kbdmap.h" -- 2.20.1