summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>1996-05-29 10:15:55 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>1996-05-29 10:15:55 +0000
commitef9b5449c466470e5241ed75226f1d70921ec10c (patch)
treeeed1e5d5c1692c582fe6a670ff97f50c75f1a66c /sys/arch
parenta7586fe5b7fc8cab4fec3c60ca9dc5f2dcdd8627 (diff)
Merge of 960526 NetBSD
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/amiga/amiga/amiga_init.c303
-rw-r--r--sys/arch/amiga/amiga/autoconf.c89
-rw-r--r--sys/arch/amiga/amiga/conf.c7
-rw-r--r--sys/arch/amiga/amiga/drcustom.h127
-rw-r--r--sys/arch/amiga/amiga/genassym.c8
-rw-r--r--sys/arch/amiga/amiga/locore.s380
-rw-r--r--sys/arch/amiga/amiga/machdep.c291
-rw-r--r--sys/arch/amiga/amiga/pmap.c279
-rw-r--r--sys/arch/amiga/amiga/swapgeneric.c7
-rw-r--r--sys/arch/amiga/amiga/trap.c68
-rw-r--r--sys/arch/amiga/amiga/vectors.s4
-rw-r--r--sys/arch/amiga/conf/DRACO163
-rw-r--r--sys/arch/amiga/conf/GENERIC13
-rw-r--r--sys/arch/amiga/conf/Makefile.amiga17
-rw-r--r--sys/arch/amiga/conf/files.amiga20
-rw-r--r--sys/arch/amiga/conf/std.amiga6
-rw-r--r--sys/arch/amiga/conf/std.draco11
-rw-r--r--sys/arch/amiga/dev/clock.c94
-rw-r--r--sys/arch/amiga/dev/drsc.c232
-rw-r--r--sys/arch/amiga/dev/empsc.c4
-rw-r--r--sys/arch/amiga/dev/grf.c9
-rw-r--r--sys/arch/amiga/dev/grf_cl.c194
-rw-r--r--sys/arch/amiga/dev/grf_clreg.h117
-rw-r--r--sys/arch/amiga/dev/grf_cv.c196
-rw-r--r--sys/arch/amiga/dev/grf_cvreg.h7
-rw-r--r--sys/arch/amiga/dev/grf_et.c1545
-rw-r--r--sys/arch/amiga/dev/grf_etreg.h385
-rw-r--r--sys/arch/amiga/dev/grf_rh.c110
-rw-r--r--sys/arch/amiga/dev/grf_rhreg.h5
-rw-r--r--sys/arch/amiga/dev/grf_rt.c888
-rw-r--r--sys/arch/amiga/dev/grf_ul.c5
-rw-r--r--sys/arch/amiga/dev/grfabs_cc.c16
-rw-r--r--sys/arch/amiga/dev/grfvar.h7
-rw-r--r--sys/arch/amiga/dev/idesc.c13
-rw-r--r--sys/arch/amiga/dev/ite.c16
-rw-r--r--sys/arch/amiga/dev/ite_cv.c156
-rw-r--r--sys/arch/amiga/dev/ite_et.c257
-rw-r--r--sys/arch/amiga/dev/ite_ul.c2
-rw-r--r--sys/arch/amiga/dev/kbd.c239
-rw-r--r--sys/arch/amiga/dev/ms.c10
-rw-r--r--sys/arch/amiga/dev/sbic.c11
-rw-r--r--sys/arch/amiga/dev/sci.c11
-rw-r--r--sys/arch/amiga/dev/scsidefs.h390
-rw-r--r--sys/arch/amiga/dev/siop.c11
-rw-r--r--sys/arch/amiga/dev/zbus.c32
-rw-r--r--sys/arch/amiga/include/cpu.h24
-rw-r--r--sys/arch/amiga/include/fbio.h42
-rw-r--r--sys/arch/amiga/include/kcore.h8
-rw-r--r--sys/arch/amiga/include/mtpr.h13
49 files changed, 5367 insertions, 1475 deletions
diff --git a/sys/arch/amiga/amiga/amiga_init.c b/sys/arch/amiga/amiga/amiga_init.c
index 422cf221164..693cf64c79c 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.10 1996/05/07 09:55:10 niklas Exp $ */
-/* $NetBSD: amiga_init.c,v 1.40 1996/05/04 04:45:18 mhitch Exp $ */
+/* $OpenBSD: amiga_init.c,v 1.11 1996/05/29 10:14:17 niklas Exp $ */
+/* $NetBSD: amiga_init.c,v 1.41 1996/05/09 20:30:30 is Exp $ */
/*
* Copyright (c) 1994 Michael L. Hitch
@@ -56,6 +56,7 @@
#include <amiga/amiga/cia.h>
#include <amiga/amiga/custom.h>
#include <amiga/amiga/cfdev.h>
+#include <amiga/amiga/drcustom.h>
#include <amiga/amiga/memlist.h>
#include <amiga/dev/zbusvar.h>
@@ -173,6 +174,8 @@ alloc_z2mem(amount)
* Very crude 68040 support by Michael L. Hitch.
*/
+int kernel_copyback = 1;
+
void
start_c(id, fphystart, fphysize, cphysize, esym_addr, flags, inh_sync)
int id;
@@ -194,9 +197,21 @@ start_c(id, fphystart, fphysize, cphysize, esym_addr, flags, inh_sync)
u_int loadbase = 0; /* XXXXXXXXXXXXXXXXXXXXXXXXXXXX */
u_int *shadow_pt = 0; /* XXXXXXXXXXXXXXXXXXXXXXXXXXXX */
+ /* XXX this only is valid if Altais is in slot 0 */
+ volatile u_int8_t *altaiscolpt = (u_int8_t *)0x200003c8;
+ volatile u_int8_t *altaiscol = (u_int8_t *)0x200003c9;
+
if ((u_int)&loadbase > cphysize)
loadbase = fphystart;
+ if ((id>>24)==0x7D) {
+ *altaiscolpt = 0;
+ *altaiscol = 40;
+ *altaiscol = 0;
+ *altaiscol = 0;
+ } else
+((volatile struct Custom *)0xdff000)->color[0] = 0xa00; /* RED */
+
RELOC(boot_fphystart, u_long) = fphystart;
RELOC(boot_fphysize, u_long) = fphysize;
RELOC(boot_cphysize, u_long) = cphysize;
@@ -334,6 +349,13 @@ start_c(id, fphystart, fphysize, cphysize, esym_addr, flags, inh_sync)
*/
pt = vstart;
ptpa = pstart;
+#ifdef DRACO
+ if ((id>>24)==0x7D) {
+ ptextra = NDRCCPG
+ + RELOC(NZTWOMEMPG, u_int)
+ + btoc(RELOC(ZBUSAVAIL, u_int));
+ } else
+#endif
ptextra = NCHIPMEMPG + NCIAPG + NZTWOROMPG + RELOC(NZTWOMEMPG, u_int) +
btoc(RELOC(ZBUSAVAIL, u_int));
/*
@@ -380,7 +402,7 @@ start_c(id, fphystart, fphysize, cphysize, esym_addr, flags, inh_sync)
/*
* initialize segment table and page table map
*/
-#ifdef M68040
+#if defined(M68040) || defined(M68060)
if (RELOC(mmutype, int) == MMU_68040) {
/*
* First invalidate the entire "segment table" pages
@@ -455,8 +477,11 @@ start_c(id, fphystart, fphysize, cphysize, esym_addr, flags, inh_sync)
}
sg = (u_int *)RELOC(Sysseg_pa, u_int);
sg = (u_int *)(sg[loadbase >> SG4_SHIFT1] & SG4_ADDR1);
- shadow_pt = (u_int *)(sg[(loadbase & SG4_MASK2) >>
- SG4_SHIFT2] & SG4_ADDR1);
+ shadow_pt =
+ ((u_int *)(sg[(loadbase & SG4_MASK2) >> SG4_SHIFT2]
+ & SG4_ADDR1)) +
+ ((loadbase & SG4_MASK3) >> SG4_SHIFT3); /* XXX is */
+
}
/*
* Initialize Sysptmap
@@ -519,8 +544,9 @@ start_c(id, fphystart, fphysize, cphysize, esym_addr, flags, inh_sync)
vstart += NBPG;
avail -= NBPG;
}
- shadow_pt = (u_int *)(sg[loadbase >> SG_ISHIFT]
- & 0xffffff00);
+ shadow_pt =
+ ((u_int *)(sg[loadbase >> SG_ISHIFT] & 0xffffff00))
+ + ((loadbase & SG_PMASK) >> SG_PSHIFT);
}
}
@@ -538,9 +564,24 @@ start_c(id, fphystart, fphysize, cphysize, esym_addr, flags, inh_sync)
* data, bss and dynamic tables are read/write
*/
pg_proto = (pg_proto & PG_FRAME) | PG_RW | PG_V;
-#ifdef M68040
- if (RELOC(mmutype, int) == MMU_68040)
- pg_proto |= PG_CCB;
+
+#if defined(M68040) || defined(M68060)
+ /*
+ * map the kernel segment table cache invalidated for
+ * these machines (for the 68040 not strictly necessary, but
+ * recommended by Motorola; for the 68060 mandatory)
+ */
+ if (RELOC(mmutype, int) == MMU_68040) {
+
+ pg_proto |= PG_CI;
+ for (; i < RELOC(Sysseg, u_int) + kstsize; i += NBPG,
+ pg_proto += NBPG)
+ *pg++ = pg_proto;
+
+ pg_proto = (pg_proto & ~PG_CI);
+ if (RELOC(kernel_copyback, int))
+ pg_proto |= PG_CCB;
+ }
#endif
/*
* go till end of data allocated so far
@@ -559,10 +600,49 @@ start_c(id, fphystart, fphysize, cphysize, esym_addr, flags, inh_sync)
* at end of allocated PT space
*/
pg -= ptextra;
- pg_proto = CHIPMEMBASE | PG_RW | PG_CI | PG_V; /* CI needed here?? */
- while (pg_proto < CHIPMEMTOP) {
- *pg++ = pg_proto;
- pg_proto += NBPG;
+#ifdef DRACO
+ if ((id >> 24) == 0x7D) {
+ pg_proto = DRCCBASE | PG_RW | PG_CI | PG_V;
+ while (pg_proto < DRCIATOP) {
+ if (*pg != PG_NV) {
+ *altaiscolpt = 0;
+ *altaiscol = 20;
+ *altaiscol = 0;
+ *altaiscol = 0;
+ asm volatile("stop #0x2700"::);
+ }
+ *pg++ = pg_proto;
+ pg_proto += DRCCSTRIDE;
+ }
+
+ /* NCR 53C710 chip */
+ if (*pg != PG_NV) {
+ *altaiscolpt = 0;
+ *altaiscol = 20;
+ *altaiscol = 0;
+ *altaiscol = 0;
+ asm volatile("stop #0x2700"::);
+ }
+ *pg++ = DRSCSIBASE | PG_RW | PG_CI | PG_V;
+
+ /* XXX Debug Altais register mapping */
+ if (*pg != PG_NV) {
+ *altaiscolpt = 0;
+ *altaiscol = 20;
+ *altaiscol = 0;
+ *altaiscol = 0;
+ asm volatile("stop #0x2700"::);
+ }
+ *pg++ = 0x20000000 | PG_RW | PG_CI | PG_V;
+ } else
+#endif
+ {
+ pg_proto = CHIPMEMBASE | PG_RW | PG_CI | PG_V;
+ /* CI needed here?? */
+ while (pg_proto < CHIPMEMTOP) {
+ *pg++ = pg_proto;
+ pg_proto += NBPG;
+ }
}
if (RELOC(z2mem_end, vm_offset_t)) { /* XXX */
pg_proto = RELOC(z2mem_start, vm_offset_t) | /* XXX */
@@ -572,15 +652,20 @@ start_c(id, fphystart, fphysize, cphysize, esym_addr, flags, inh_sync)
pg_proto += NBPG; /* XXX */
} /* XXX */
} /* XXX */
- pg_proto = CIABASE | PG_RW | PG_CI | PG_V;
- while (pg_proto < CIATOP) {
- *pg++ = pg_proto;
- pg_proto += NBPG;
- }
- pg_proto = ZTWOROMBASE | PG_RW | PG_CI | PG_V;
- while (pg_proto < ZTWOROMTOP) {
- *pg++ = pg_proto;
- pg_proto += NBPG;
+#ifdef DRACO
+ if ((id >> 24) != 0x7D)
+#endif
+ {
+ pg_proto = CIABASE | PG_RW | PG_CI | PG_V;
+ while (pg_proto < CIATOP) {
+ *pg++ = pg_proto;
+ pg_proto += NBPG;
+ }
+ pg_proto = ZTWOROMBASE | PG_RW | PG_CI | PG_V;
+ while (pg_proto < ZTWOROMTOP) {
+ *pg++ = pg_proto;
+ pg_proto += NBPG;
+ }
}
/*
@@ -593,10 +678,10 @@ start_c(id, fphystart, fphysize, cphysize, esym_addr, flags, inh_sync)
pg = shadow_pt;
*pg++ = PG_NV; /* Make page 0 invalid */
pg_proto += NBPG;
- for (i = NBPG; i < (u_int)etext; i += NBPG, pg_proto += NBPG)
+ for (i = NBPG; i < (u_int)etext; i += NBPG, pg_proto += NBPG)
*pg++ = pg_proto;
pg_proto = (pg_proto & PG_FRAME) | PG_RW | PG_V;
- for (; i < vstart + USPACE; i += NBPG, pg_proto += NBPG)
+ for (; i < vstart + USPACE; i += NBPG, pg_proto += NBPG)
*pg++ = pg_proto;
}
@@ -631,30 +716,60 @@ start_c(id, fphystart, fphysize, cphysize, esym_addr, flags, inh_sync)
/*
* record base KVA of IO spaces which are just before Sysmap
*/
- RELOC(CHIPMEMADDR, u_int) =
- (u_int)RELOC(Sysmap, u_int) - ptextra * NBPG;
- if (RELOC(z2mem_end, u_int) == 0)
- RELOC(CIAADDR, u_int) =
- RELOC(CHIPMEMADDR, u_int) + NCHIPMEMPG * NBPG;
- else {
- RELOC(ZTWOMEMADDR, u_int) =
- RELOC(CHIPMEMADDR, u_int) + NCHIPMEMPG * NBPG;
+#ifdef DRACO
+ if ((id >> 24) == 0x7D) {
+ RELOC(DRCCADDR, u_int) =
+ (u_int)RELOC(Sysmap, u_int) - ptextra * NBPG;
+
RELOC(CIAADDR, u_int) =
- RELOC(ZTWOMEMADDR, u_int) + RELOC(NZTWOMEMPG, u_int) * NBPG;
+ RELOC(DRCCADDR, u_int) + DRCIAPG * NBPG;
+
+ if (RELOC(z2mem_end, vm_offset_t)) { /* XXX */
+ RELOC(ZTWOMEMADDR, u_int) =
+ RELOC(DRCCADDR, u_int) + NDRCCPG * NBPG;
+
+ RELOC(ZBUSADDR, vm_offset_t) =
+ RELOC(ZTWOMEMADDR, u_int) +
+ RELOC(NZTWOMEMPG, u_int)*NBPG;
+ } else {
+ RELOC(ZBUSADDR, vm_offset_t) =
+ RELOC(DRCCADDR, u_int) + NDRCCPG * NBPG;
+ }
+
+ /*
+ * some nice variables for pmap to use
+ */
+ RELOC(amigahwaddr, vm_offset_t) = RELOC(DRCCADDR, u_int);
+ RELOC(namigahwpg, u_int) =
+ NDRCCPG + NDRCIAPG + RELOC(NZTWOMEMPG, u_int);
+ } else
+#endif
+ {
+ RELOC(CHIPMEMADDR, u_int) =
+ (u_int)RELOC(Sysmap, u_int) - ptextra * NBPG;
+ if (RELOC(z2mem_end, u_int) == 0)
+ RELOC(CIAADDR, u_int) =
+ RELOC(CHIPMEMADDR, u_int) + NCHIPMEMPG * NBPG;
+ else {
+ RELOC(ZTWOMEMADDR, u_int) =
+ RELOC(CHIPMEMADDR, u_int) + NCHIPMEMPG * NBPG;
+ RELOC(CIAADDR, u_int) =
+ RELOC(ZTWOMEMADDR, u_int) + RELOC(NZTWOMEMPG, u_int) * NBPG;
+ }
+ RELOC(ZTWOROMADDR, vm_offset_t) =
+ RELOC(CIAADDR, u_int) + NCIAPG * NBPG;
+ RELOC(ZBUSADDR, vm_offset_t) =
+ RELOC(ZTWOROMADDR, u_int) + NZTWOROMPG * NBPG;
+ RELOC(CIAADDR, vm_offset_t) += NBPG/2; /* not on 8k boundery :-( */
+ RELOC(CUSTOMADDR, vm_offset_t) =
+ RELOC(ZTWOROMADDR, u_int) - ZTWOROMBASE + CUSTOMBASE;
+ /*
+ * some nice variables for pmap to use
+ */
+ RELOC(amigahwaddr, vm_offset_t) = RELOC(CHIPMEMADDR, u_int);
+ RELOC(namigahwpg, u_int) =
+ NCHIPMEMPG + NCIAPG + NZTWOROMPG + RELOC(NZTWOMEMPG, u_int);
}
- RELOC(ZTWOROMADDR, vm_offset_t) =
- RELOC(CIAADDR, u_int) + NCIAPG * NBPG;
- RELOC(ZBUSADDR, vm_offset_t) =
- RELOC(ZTWOROMADDR, u_int) + NZTWOROMPG * NBPG;
- RELOC(CIAADDR, vm_offset_t) += NBPG/2; /* not on 8k boundery :-( */
- RELOC(CUSTOMADDR, vm_offset_t) =
- RELOC(ZTWOROMADDR, u_int) - ZTWOROMBASE + CUSTOMBASE;
- /*
- * some nice variables for pmap to use
- */
- RELOC(amigahwaddr, vm_offset_t) = RELOC(CHIPMEMADDR, u_int);
- RELOC(namigahwpg, u_int) =
- NCHIPMEMPG + NCIAPG + NZTWOROMPG + RELOC(NZTWOMEMPG, u_int);
/*
* set this before copying the kernel, so the variable is updated in
@@ -678,6 +793,13 @@ start_c(id, fphystart, fphysize, cphysize, esym_addr, flags, inh_sync)
*fp++ = *lp++;
}
+ if ((id>>24)==0x7D) {
+ *altaiscolpt = 0;
+ *altaiscol = 40;
+ *altaiscol = 40;
+ *altaiscol = 0;
+ } else
+((volatile struct Custom *)0xdff000)->color[0] = 0xAA0; /* YELLOW */
/*
* prepare to enable the MMU
*/
@@ -690,11 +812,28 @@ start_c(id, fphystart, fphysize, cphysize, esym_addr, flags, inh_sync)
* movel #$0xc000,d0;
* movec d0,TC
*/
+
+ if (id & AMIGA_68060) {
+ /* do i need to clear the branch cache? */
+ asm volatile ( ".word 0x4e7a,0x0002;"
+ "orl #0x400000,d0;"
+ ".word 0x4e7b,0x0002" : : : "d0");
+ }
+
asm volatile ("movel %0,a0; .word 0x4e7b,0x8807"
: : "a" (RELOC(Sysseg_pa, u_int)) : "a0");
asm volatile (".word 0xf518" : : );
- asm volatile ("movel #0xc000,d0; .word 0x4e7b,0x0003"
- : : : "d0");
+
+ if ((id>>24)==0x7D) {
+ *altaiscolpt = 0;
+ *altaiscol = 40;
+ *altaiscol = 33;
+ *altaiscol = 0;
+ } else
+((volatile struct Custom *)0xdff000)->color[0] = 0xA70; /* ORANGE */
+
+ asm volatile ("movel #0xc000,d0; .word 0x4e7b,0x0003"
+ : : :"d0" );
} else
#endif
{
@@ -713,6 +852,21 @@ start_c(id, fphystart, fphysize, cphysize, esym_addr, flags, inh_sync)
tc = 0x82d08b00;
asm volatile ("pmove %0@,tc" : : "a" (&tc));
}
+#ifdef DRACO
+ if ((id >> 24) == 0x7D) { /* mapping on, is_draco() is valid */
+ int i;
+ /* XXX experimental Altais register mapping only */
+ altaiscolpt = (volatile u_int8_t *)(DRCCADDR+NBPG*8+0x3c8);
+ altaiscol = altaiscolpt + 1;
+ for (i=0; i<140000; i++) {
+ *altaiscolpt = 0;
+ *altaiscol = 0;
+ *altaiscol = 40;
+ *altaiscol = 0;
+ }
+ } else
+#endif
+((volatile struct Custom *)CUSTOMADDR)->color[0] = 0x0a0; /* GREEN */
bzero ((u_char *)proc0paddr, USPACE); /* XXXXXXXXXXXXXXXXXXXXX */
pmap_bootstrap(pstart, fphystart); /* XXXXXXXXXXXXXXXXXXXXXXx*/
@@ -723,10 +877,21 @@ start_c(id, fphystart, fphysize, cphysize, esym_addr, flags, inh_sync)
CIAAbase = CIAADDR + 0x1001; /* CIA-A at odd addresses ! */
CIABbase = CIAADDR;
CUSTOMbase = CUSTOMADDR;
- INTREQRaddr = (vm_offset_t)&custom.intreqr;
- INTREQWaddr = (vm_offset_t)&custom.intreq;
- INTENARaddr = (vm_offset_t)&custom.intenar;
- INTENAWaddr = (vm_offset_t)&custom.intena;
+#ifdef DRACO
+ if (is_draco()) {
+ draco_intena = (volatile u_int8_t *)DRCCADDR+1;
+ draco_intpen = draco_intena + NBPG;
+ draco_intfrc = draco_intpen + NBPG;
+ draco_misc = draco_intfrc + NBPG;
+ draco_ioct = (struct drioct *)(DRCCADDR + DRIOCTLPG*NBPG);
+ } else
+#endif
+ {
+ INTREQRaddr = (vm_offset_t)&custom.intreqr;
+ INTREQWaddr = (vm_offset_t)&custom.intreq;
+ INTENARaddr = (vm_offset_t)&custom.intenar;
+ INTENAWaddr = (vm_offset_t)&custom.intena;
+ }
/*
* Get our chip memory allocation system working
@@ -746,11 +911,33 @@ start_c(id, fphystart, fphysize, cphysize, esym_addr, flags, inh_sync)
* disable all interupts but enable allow them to be enabled
* by specific driver code (global int enable bit)
*/
- custom.intena = 0x7fff; /* disable ints */
- custom.intena = INTF_SETCLR | INTF_INTEN; /* but allow them */
- custom.intreq = 0x7fff; /* clear any current */
- ciaa.icr = 0x7f; /* and keyboard */
- ciab.icr = 0x7f; /* and again */
+#ifdef DRACO
+ if (is_draco()) {
+ /* XXX to be done. For now, just: */
+ *draco_intena = 0;
+ *draco_intpen = 0;
+ *draco_intfrc = 0;
+ ciaa.icr = 0x7f; /* and keyboard */
+#if 0
+ ciab.icr = 0x7f; /* and again */
+#endif
+ *(volatile u_int8_t *)(DRCCADDR +
+ DRSUPIOPG*NBPG + 4*(0x3F8 + 1)) = 0; /* and com0 */
+ *(volatile u_int8_t *)(DRCCADDR +
+ DRSUPIOPG*NBPG + 4*(0x2F8 + 1)) = 0; /* and com1 */
+
+ *draco_misc &= ~1/*DRMISC_FASTZ2*/;
+
+ } else
+#endif
+ {
+ custom.intena = 0x7fff; /* disable ints */
+ custom.intena = INTF_SETCLR | INTF_INTEN;
+ /* but allow them */
+ custom.intreq = 0x7fff; /* clear any current */
+ ciaa.icr = 0x7f; /* and keyboard */
+ ciab.icr = 0x7f; /* and again */
+ }
/*
* This is needed for 3000's with superkick ROM's. Bit 7 of
diff --git a/sys/arch/amiga/amiga/autoconf.c b/sys/arch/amiga/amiga/autoconf.c
index 21e27e544ef..788ae6f886b 100644
--- a/sys/arch/amiga/amiga/autoconf.c
+++ b/sys/arch/amiga/amiga/autoconf.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: autoconf.c,v 1.4 1996/05/04 20:04:28 niklas Exp $ */
-/* $NetBSD: autoconf.c,v 1.34 1996/04/27 20:48:47 veego Exp $ */
+/* $OpenBSD: autoconf.c,v 1.5 1996/05/29 10:14:20 niklas Exp $ */
+/* $NetBSD: autoconf.c,v 1.38 1996/05/12 02:41:00 mhitch Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
@@ -59,24 +59,46 @@ configure()
* this is the real thing baby (i.e. not console init)
*/
amiga_realconfig = 1;
+#ifdef DRACO
+ if (is_draco()) {
+ *draco_intena &= ~DRIRQ_GLOBAL;
+ } else
+#endif
custom.intena = INTF_INTEN;
if (config_rootfound("mainbus", "mainbus") == NULL)
panic("no mainbus found");
+
+ printf("survived autoconf, going to enable interrupts\n");
- custom.intena = INTF_SETCLR | INTF_INTEN;
+#ifdef DRACO
+ if (is_draco()) {
+ *draco_intena |= DRIRQ_GLOBAL;
+ /* softints always enabled */
+ } else
+#endif
+ {
+ custom.intena = INTF_SETCLR | INTF_INTEN;
- /* also enable hardware aided software interrupts */
- custom.intena = INTF_SETCLR | INTF_SOFTINT;
+ /* also enable hardware aided software interrupts */
+ custom.intena = INTF_SETCLR | INTF_SOFTINT;
+ }
+ printf("survived interrupt enable\n");
#ifdef GENERIC
- if ((boothowto & RB_ASKNAME) == 0)
+ if ((boothowto & RB_ASKNAME) == 0) {
setroot();
+ printf("survived setroot()\n");
+ }
setconf();
+ printf("survived setconf()\n");
#else
setroot();
+ printf("survived setroot()\n");
#endif
+ printf("survived root device search\n");
swapconf();
+ printf("survived swap device search\n");
cold = 0;
}
@@ -149,12 +171,16 @@ config_console()
* we need mainbus' cfdata.
*/
cf = config_rootsearch(NULL, "mainbus", "mainbus");
- if (cf == NULL)
+ if (cf == NULL) {
panic("no mainbus");
+ }
/*
* internal grf.
*/
- amiga_config_found(cf, NULL, "grfcc", NULL);
+#ifdef DRACO
+ if (!(is_draco()))
+#endif
+ amiga_config_found(cf, NULL, "grfcc", NULL);
/*
* zbus knows when its not for real and will
* only configure the appropriate hardware
@@ -198,13 +224,27 @@ mbattach(pdp, dp, auxp)
{
printf ("\n");
config_found(dp, "clock", simple_devprint);
- config_found(dp, "ser", simple_devprint);
- config_found(dp, "par", simple_devprint);
- config_found(dp, "kbd", simple_devprint);
- config_found(dp, "ms", simple_devprint);
- config_found(dp, "ms", simple_devprint);
- config_found(dp, "grfcc", simple_devprint);
- config_found(dp, "fdc", simple_devprint);
+#ifdef DRACO
+ if (is_draco()) {
+ config_found(dp, "kbd", simple_devprint);
+ config_found(dp, "drsc", simple_devprint);
+ /*
+ * XXX -- missing here:
+ * SuperIO chip serial, parallel, floppy
+ * or maybe just make that into a pseudo
+ * ISA bus.
+ */
+ } else
+#endif
+ {
+ config_found(dp, "ser", simple_devprint);
+ config_found(dp, "par", simple_devprint);
+ config_found(dp, "kbd", simple_devprint);
+ config_found(dp, "ms", simple_devprint);
+ config_found(dp, "ms", simple_devprint);
+ config_found(dp, "grfcc", simple_devprint);
+ config_found(dp, "fdc", simple_devprint);
+ }
if (is_a4000() || is_a1200())
config_found(dp, "idesc", simple_devprint);
if (is_a4000()) /* Try to configure A4000T SCSI */
@@ -247,10 +287,7 @@ swapconf()
}
swp->sw_nblks = ctod(dtoc(swp->sw_nblks));
}
- if (dumplo == 0 && bdevsw[major(dumpdev)].d_psize)
- /*dumplo = (*bdevsw[major(dumpdev)].d_psize)(dumpdev) - physmem;*/
- dumplo = (*bdevsw[major(dumpdev)].d_psize)(dumpdev) -
- ctob(physmem)/DEV_BSIZE;
+ dumpconf();
if (dumplo < 0)
dumplo = 0;
@@ -383,6 +420,10 @@ is_a4000()
return (1); /* It's an A4000 */
if ((machineid >> 16) == 1200)
return (0); /* It's an A1200, so not A4000 */
+#ifdef DRACO
+ if (is_draco())
+ return (0);
+#endif
/* Do I need this any more? */
if ((custom.deniseid & 0xff) == 0xf8)
return (1);
@@ -402,3 +443,13 @@ is_a1200()
return (1); /* It's an A1200 */
return (0); /* Machine type not set */
}
+
+#ifdef DRACO
+int
+is_draco()
+{
+ if ((machineid >> 24) == 0x7D)
+ return ((machineid >> 16) & 0xFF);
+ return (0);
+}
+#endif
diff --git a/sys/arch/amiga/amiga/conf.c b/sys/arch/amiga/amiga/conf.c
index 65966097d46..dfe678cec00 100644
--- a/sys/arch/amiga/amiga/conf.c
+++ b/sys/arch/amiga/amiga/conf.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: conf.c,v 1.8 1996/05/07 10:02:51 niklas Exp $ */
-/* $NetBSD: conf.c,v 1.35 1996/04/27 20:48:50 veego Exp $ */
+/* $OpenBSD: conf.c,v 1.9 1996/05/29 10:14:22 niklas Exp $ */
+/* $NetBSD: conf.c,v 1.36 1996/05/19 21:04:18 veego Exp $ */
/*-
* Copyright (c) 1991 The Regents of the University of California.
@@ -129,7 +129,7 @@ struct cdevsw cdevsw[] =
cdev_bpftun_init(NBPFILTER,bpf),/* 22: Berkeley packet filter */
cdev_bpftun_init(NTUN,tun), /* 23: network tunnel */
cdev_lkm_init(NLKM,lkm), /* 24: loadable module driver */
- cdev_lkm_dummy(), /* 25 */
+ cdev_scanner_init(NSS,ss), /* 25: SCSI scanner */
cdev_lkm_dummy(), /* 26 */
cdev_lkm_dummy(), /* 27 */
cdev_lkm_dummy(), /* 28 */
@@ -139,7 +139,6 @@ struct cdevsw cdevsw[] =
cdev_tty_init(NCOM,com), /* 32: ISA serial port */
cdev_lpt_init(NLPT,lpt), /* 33: ISA parallel printer */
cdev_gen_ipf(NIPF,ipl), /* 34: IP filter log */
- cdev_scanner_init(NSS,ss), /* 35: SCSI scanner */
};
int nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]);
diff --git a/sys/arch/amiga/amiga/drcustom.h b/sys/arch/amiga/amiga/drcustom.h
new file mode 100644
index 00000000000..e8fc6126905
--- /dev/null
+++ b/sys/arch/amiga/amiga/drcustom.h
@@ -0,0 +1,127 @@
+/*
+ * $NetBSD: drcustom.h,v 1.1 1996/05/09 20:30:36 is Exp $
+ *
+ * Motherboard addresses for the DraCo.
+ *
+ */
+
+#ifndef _DRACO_HARDWARE
+#define _DRACO_HARDWARE
+
+/*
+ * CIA-B is available only in very early models.
+ * CIA-A is available only up to revision 3.
+ */
+
+#define DRCIABASE 0x02800000
+#define DRCIATOP 0x02802000
+#define NDRCIAPG ((DRCIATOP - DRCIABASE) / NBPG) /* which is 1 */
+
+#define NDRCCPG (7+1+1) /* (3 int+msc+ctrl+superio+cia)+scsi+altais */
+
+#define DRCCBASE 0x01000000
+#define DRCCSTRIDE 0x00400000 /* for up to and including CIA */
+
+#define DRZ2BASE 0x03000000 /*
+ * not really used, appears as Z3 to
+ * our kernel.
+ */
+#define DRSCSIBASE 0x04000000
+
+#define DR_INTENA (DRCCBASE+0x1)
+#define DR_INTPEN (DRCCBASE+0x00400001)
+#define DR_INTFRC (DRCCBASE+0x00800001)
+
+#define DRIRQ_GLOBAL 1 /* not force */
+#define DRIRQ_SOFT DRIRQ_GLOBAL /* only force */
+#define DRIRQ_SCSI 2
+#define DRIRQ_INT2 4
+#define DRIRQ_INT6 8
+
+
+/* mapped state: */
+#define DRMISCPG 3
+#define DRIOCTLPG 4
+#define DRSUPIOPG 5
+#define DRCIAPG 6
+#define DRSCSIPG 7
+
+#ifdef _KERNEL
+#ifndef _LOCORE
+
+vm_offset_t DRCCADDR;
+
+volatile u_int8_t *draco_intena, *draco_intpen, *draco_intfrc;
+volatile u_int8_t *draco_misc;
+volatile struct drioct *draco_ioct;
+
+struct drioct {
+ u_int8_t dum0;
+ volatile u_int8_t io_control; /* 1 */
+#define DRCNTRL_FDCINTENA 1
+#define DRCNTRL_KBDDATOUT 2
+#define DRCNTRL_KBDCLKOUT 4
+#define DRCNTRL_WDOGENA 8
+#define DRCNTRL_WDOGDAT 16
+#define DRCNTRL_KBDINTENA 32
+#define DRCNTRL_KBDKBDACK 64
+#define DRCNTRL_SCSITERM 128
+
+ u_int8_t dum1;
+ volatile u_int8_t io_status; /* 3 */
+#define DRSTAT_CLKDAT 1
+#define DRSTAT_KBDDATIN 2
+#define DRSTAT_KBDCLKIN 4
+#define DRSTAT_KBDRECV 8
+#define DRSTAT_CLKBUSY 16
+#define DRSTAT_BUSTIMO 32
+#define DRSTAT_SCSILED 64
+
+ u_int8_t dum2;
+ volatile u_int8_t io_kbddata; /* 5 */
+
+ u_int8_t dum3;
+ volatile u_int8_t io_status2; /* 7 */
+#define DRSTAT2_KBDBUSY 1
+#define DRSTAT2_PARIRQPEN 4
+#define DRSTAT2_PARIRQENA 8
+#define DRSTAT2_TMRINTENA 16
+#define DRSTAT2_TMRIRQPEN 32
+
+ u_int8_t dum4;
+ volatile u_int8_t io_chiprev; /* 9 */
+#define io_timerrst io_chiprev /* on writes */
+
+ u_int8_t dum5;
+ volatile u_int8_t io_timerhi; /* b */
+ u_int8_t dum6;
+ volatile u_int8_t io_timerlo; /* d */
+
+ u_int8_t dum7[3]; /* nothing @ f, at least yet */
+
+ volatile u_int8_t io_clockw0; /* 11 */
+ u_int8_t dum8;
+ volatile u_int8_t io_clockw1; /* 13 */
+ u_int8_t dum9;
+ volatile u_int8_t io_clockrst; /* 15 */
+
+ u_int8_t dum10;
+ volatile u_int8_t io_kbdrst; /* 17 */
+
+ u_int8_t dum11;
+ volatile u_int8_t io_bustimeoutrst; /* 19 */
+
+ u_int8_t dum12;
+ volatile u_int8_t io_scsiledrst; /* 1b */
+
+ u_int8_t dum13;
+ volatile u_int8_t io_fdcread; /* 1d */
+
+ u_int8_t dum14;
+ volatile u_int8_t io_parrst; /* 1e */
+
+};
+#endif
+#endif
+
+#endif
diff --git a/sys/arch/amiga/amiga/genassym.c b/sys/arch/amiga/amiga/genassym.c
index dd6216565f0..99925256e79 100644
--- a/sys/arch/amiga/amiga/genassym.c
+++ b/sys/arch/amiga/amiga/genassym.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: genassym.c,v 1.5 1996/05/02 06:43:17 niklas Exp $ */
-/* $NetBSD: genassym.c,v 1.25 1996/04/21 21:07:01 veego Exp $ */
+/* $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 $ */
/*
* Copyright (c) 1982, 1990 The Regents of the University of California.
@@ -168,5 +168,9 @@ main()
printf("#define\tISR_INTR %p\n", (void *)&isr->isr_intr);
printf("#define\tISR_ARG %p\n", (void *)&isr->isr_arg);
printf("#define\tMMU_68040 %d\n", MMU_68040);
+#ifdef DRACO
+ printf("#define\tDRACO %d\n", DRACO);
+#endif
+
exit(0);
}
diff --git a/sys/arch/amiga/amiga/locore.s b/sys/arch/amiga/amiga/locore.s
index b17f02194c1..c2b6d6a5c66 100644
--- a/sys/arch/amiga/amiga/locore.s
+++ b/sys/arch/amiga/amiga/locore.s
@@ -1,5 +1,5 @@
-/* $OpenBSD: locore.s,v 1.9 1996/05/07 09:58:36 niklas Exp $ */
-/* $NetBSD: locore.s,v 1.52 1996/05/04 04:43:23 mhitch Exp $ */
+/* $OpenBSD: locore.s,v 1.10 1996/05/29 10:14:27 niklas Exp $ */
+/* $NetBSD: locore.s,v 1.56 1996/05/21 18:22:13 is Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -50,6 +50,8 @@
#include "assym.h"
+ .globl _kernel_text
+_kernel_text:
L_base:
.long 0x4ef80400+NBPG /* jmp jmp0.w */
.fill NBPG/4-1,4,0/*xdeadbeef*/
@@ -59,6 +61,10 @@ L_base:
#include "ser.h"
#include "fd.h"
+#ifdef DRACO
+#include <amiga/amiga/drcustom.h>
+#endif
+
#define CIAAADDR(ar) movl _CIAAbase,ar
#define CIABADDR(ar) movl _CIABbase,ar
#define CUSTOMADDR(ar) movl _CUSTOMbase,ar
@@ -117,6 +123,36 @@ _addrerr:
andw #0x0fff,d0
cmpw #12,d0 | is it address error
jeq Lisaerr
+#ifdef M68060
+ btst #7,_machineid+3 | is it 68060?
+ jeq Lbe040
+ movel a1@(12),d0 | FSLW
+ btst #2,d0 | branch prediction error?
+ jeq Lnobpe
+ movc cacr,d2
+ orl #0x00400000,d2 | clear all branch cache entries
+ movc d2,cacr
+ movl d0,d1
+ andl #0x7ffd,d1
+ jeq Lbpedone
+Lnobpe:
+ movl d0,sp@ | code is FSLW now.
+| we need to adjust for misaligned addresses
+ movl a1@(8),d1 | grab VA
+ btst #27,d0 | check for mis-aligned access
+ jeq Lberr3 | no, skip
+ addl #28,d1 | yes, get into next page
+ | operand case: 3,
+ | instruction case: 4+12+12
+ | XXX instr. case not done yet
+ andl #PG_FRAME,d1 | and truncate
+Lberr3:
+ movl d1,sp@(4)
+ andw #0x1f80,d0
+ jeq Lisberr
+ jra Lismerr
+Lbe040:
+#endif
movl a1@(20),d1 | get fault address
moveq #0,d0
movw a1@(12),d0 | get SSW
@@ -128,7 +164,7 @@ Lbe1stpg:
movl d1,sp@(4) | pass fault address.
movl d0,sp@ | pass SSW as code
btst #10,d0 | test ATC
- jeq Lisberr | it's a bus error
+ jeq Lisberr | it is a bus error
jra Lismerr
Lbe030:
moveq #0,d0
@@ -189,6 +225,7 @@ Lisberr:
movl #T_BUSERR,sp@- | mark bus error
Ltrapnstkadj:
jbsr _trap | handle the error
+Lbpedone:
lea sp@(12),sp | pop value args
movl sp@(FR_SP),a0 | restore user SP
movl a0,usp | from save area
@@ -250,6 +287,11 @@ _fpunsupp:
* Note that since some FP exceptions generate mid-instruction frames
* and may cause signal delivery, we need to test for stack adjustment
* after the trap call.
+ *
+ * XXX I don't really understand what they do for the 68881/82, for which
+ * I dont have docs at the moment. I don't find anything which looks like
+ * it is intended in the 68040 FP docs. I pretend for the moment I don't
+ * need to do anything for the 68060. -is
*/
.globl _fpfault
_fpfault:
@@ -262,7 +304,12 @@ _fpfault:
movl _curpcb,a0 | current pcb
lea a0@(PCB_FPCTX),a0 | address of FP savearea
fsave a0@ | save state
- tstb a0@ | null state frame?
+#if defined(M68060) || defined(M68040)
+ movb _machineid+3,d0
+ andb #0x90,d0 | AMIGA_68060 | AMIGA_68040
+ jne Lfptnull | XXX
+#endif
+ tstb a0@ | null state frame?
jeq Lfptnull | yes, safe
clrw d0 | no, need to tweak BIU
movb a0@(1),d0 | get frame size
@@ -469,6 +516,36 @@ _spurintr:
addql #1,_cnt+V_INTR
jra rei
+#ifdef DRACO
+ .globl _DraCoLev2intr
+_DraCoLev2intr:
+ moveml #0xC0C0,sp@-
+
+ CIAAADDR(a0)
+ movb a0@(CIAICR),d0 | read irc register (clears ints!)
+ tstb d0 | check if CIAB was source
+ jeq Lintrcommon
+ movel _draco_intpen,a0
+| andib #4,a0@
+|XXX this would better be
+ bclr #2,a0@
+ btst #0,d0 | timerA interrupt?
+ jeq Ldraciaend
+
+ lea sp@(16),a1 | get pointer to PS
+ movl a1,sp@- | push pointer to PS, PC
+
+ movw #PSL_HIGHIPL,sr | hardclock at high IPL
+ jbsr _hardclock | call generic clock int routine
+ addql #4,sp | pop params
+ addql #1,_intrcnt+32 | add another system clock interrupt
+
+Ldraciaend:
+ moveml sp@+,#0x0303
+ addql #1,_cnt+V_INTR
+ jra rei
+#endif
+
_lev5intr:
moveml d0/d1/a0/a1,sp@-
#if NSER > 0
@@ -489,6 +566,7 @@ _lev3intr:
_lev4intr:
#endif
moveml d0-d1/a0-a1,sp@-
+/* XXX on the DraCo, lev 4, 5 and 6 are vectored here by initcpu() */
Lintrcommon:
lea _intrcnt,a0
movw sp@(22),d0 | use vector offset
@@ -514,6 +592,8 @@ Lintrcommon:
.globl _hardclock_frame
#endif
+/* XXX used to be ifndef DRACO; vector will be overwritten by initcpu() */
+
_lev6intr:
#ifndef IPL_REMAP_1
#ifdef LEV6_DEFER
@@ -612,6 +692,7 @@ Lexterdone:
#endif
addql #1,_intrcnt+24 | count EXTER interrupts
jra Llev6done
+/* XXX endifndef DRACO used to be here */
#else /* IPL_REMAP_1 */
@@ -723,7 +804,15 @@ Laststkadj:
moveml sp@+,#0x7FFF | restore user registers
movl sp@,sp | and our SP
Ldorte:
+| moveml a0/a1/d0/d1,sp@-
+| pea pc@(Ldoinrte)
+| jsr _printf
+| addql #4,sp
+| moveml sp@+,a0/a1/d0/d1
rte | real return
+|Ldoinrte:
+| .asciz "Doing RTE.\n"
+| .even
/*
* Kernel access to the current processes kernel stack is via a fixed
@@ -767,7 +856,7 @@ start:
RELOC(tmpstk,a6)
movl a6,sp | give ourselves a temporary stack
- | save the passed parameters. `prepass' them on the stack for
+ | save the passed parameters. "prepass" them on the stack for
| later catch by _start_c
movl a2,sp@- | pass sync inhibit flags
movl d3,sp@- | pass AGA mode
@@ -781,6 +870,42 @@ start:
* initialize some hw addresses to their physical address
* for early running
*/
+#ifdef DRACO
+ /*
+ * this is already dynamically done on DraCo
+ */
+ cmpb #0x7D,sp@
+ jne LisAmiga1
+| debug code:
+| we should need about 1 uSec for the loop.
+| we dont need the AGA mode register.
+ movel #100000,d3
+LisDraco0:
+ movb #0,0x200003c8
+ movb #00,0x200003c9
+ movb #40,0x200003c9
+ movb #00,0x200003c9
+|XXX:
+ movb #0,0x200003c8
+ movb #40,0x200003c9
+ movb #00,0x200003c9
+ movb #00,0x200003c9
+ subql #1,d3
+ jcc LisDraco0
+
+ RELOC(_chipmem_start, a0)
+ movl #0,a0@
+
+ RELOC(_CIAAbase, a0)
+ movl #0x2801001, a0@
+ RELOC(_CIABbase, a0)
+ movl #0x2800000, a0@
+
+ /* XXXX more to come here; as we need it */
+
+ jra LisDraco1
+LisAmiga1:
+#endif
RELOC(_chipmem_start, a0)
movl #0x400,a0@
RELOC(_CIAAbase, a0)
@@ -790,6 +915,9 @@ start:
RELOC(_CUSTOMbase, a0)
movl #0xdff000,a0@
+#ifdef DRACO
+LisDraco1:
+#endif
/*
* initialize the timer frequency
*/
@@ -811,10 +939,13 @@ Lsetcpu040:
movl #CACHE_OFF,d0 | 68020/030 cache
movl #AMIGA_68040,d1
andl d1,d5
- jeq Lstartnot040 | it's not 68040
+ jeq Lstartnot040 | it is not 68040
movl #MMU_68040,a0@ | same as hp300 for compat
- .word 0xf4f8 | cpusha bc - push and invalidate caches
+ .word 0xf4f8 | cpusha bc - push and invalidate caches
movl #CACHE40_OFF,d0 | 68040 cache disable
+ btst #7,sp@(3) | XXX
+ jeq Lstartnot040
+ orl #0x400000,d0 | XXX and clear all 060 branch cache
Lstartnot040:
movc d0,cacr | clear and disable on-chip cache(s)
movl #_vectab,a0
@@ -832,8 +963,10 @@ Lstartnot040:
jmp Lunshadow
Lunshadow:
-| lea tmpstk,sp | give ourselves a temporary stack
+
+ lea tmpstk,sp | give ourselves a temporary stack
jbsr _start_c_cleanup
+
/* set kernel stack, user SP, and initial pcb */
movl _proc0paddr,a1 | proc0 kernel stack
lea a1@(USPACE),sp | set kernel stack to end of area
@@ -850,6 +983,8 @@ Lunshadow:
addql #4,sp
#endif
/* flush TLB and turn on caches */
+
+
jbsr _TBIA | invalidate TLB
movl #CACHE_ON,d0
tstl d5
@@ -861,7 +996,6 @@ Lcacheon:
movc d0,cacr | clear cache(s)
/* final setup for C code */
-
movw #PSL_LOWIPL,sr | lower SPL
movl d7,_boothowto | save reboot flags
@@ -889,12 +1023,19 @@ Lcacheon:
movl usp,a1
movl a1,sp@(FR_SP) | save user stack pointer in frame
pea sp@ | addr of space for D0
+
jbsr _main | main(firstaddr, r0)
addql #4,sp | pop args
+
cmpl #MMU_68040,_mmutype | 68040?
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
Lnoflush:
movl sp@(FR_SP),a0 | grab and load
movl a0,usp | user SP
@@ -911,7 +1052,7 @@ Lnoflush:
*/
.globl _proc_trampoline
_proc_trampoline:
- movl a3@(P_MD + MD_REGS),sp | process' frame pointer in sp
+ movl a3@(P_MD + MD_REGS),sp | frame pointer of process in sp
movl a3,sp@- | push function arg (curproc)
jbsr a2@ | call function
addql #4,sp | pop arg
@@ -1157,7 +1298,7 @@ ENTRY(switch_exit)
/* Free old process's user area. */
movl #USPACE,sp@- | size of u-area
- movl a0@(P_ADDR),sp@- | address of process's u-area
+ movl a0@(P_ADDR),sp@- | address u-area of process
movl _kernel_map,sp@- | map it was allocated in
jbsr _kmem_free | deallocate it
lea sp@(12),sp | pop args
@@ -1268,10 +1409,28 @@ Lsw2:
#ifdef FPCOPROC
lea a1@(PCB_FPCTX),a2 | pointer to FP save area
fsave a2@ | save FP state
+#if defined(M68020) || defined(M68030) || defined(M68040)
+#ifdef M68060
+ btst #7,_machineid+3
+ jne Lsavfp60
+#endif
tstb a2@ | null state frame?
jeq Lswnofpsave | yes, all done
fmovem fp0-fp7,a2@(216) | save FP general registers
fmovem fpcr/fpsr/fpi,a2@(312) | save FP control registers
+#ifdef M68060
+ jra Lswnofpsave
+#endif
+#endif
+#ifdef M68060
+Lsavfp60:
+ tstb a2@(2) | null state frame?
+ jeq Lswnofpsave | yes, all done
+ fmovem fp0-fp7,a2@(216) | save FP general registers
+ fmovem fpcr,a2@(312) | save FP control registers
+ fmovem fpsr,a2@(316)
+ fmovem fpi,a2@(320)
+#endif
Lswnofpsave:
#endif
@@ -1310,8 +1469,8 @@ Lswnochg:
jra Lres3
Lres2:
.word 0xf518 | pflusha (68040)
- movl #CACHE40_ON,d0
- movc d0,cacr | invalidate cache(s)
+| movl #CACHE40_ON,d0
+| movc d0,cacr | invalidate cache(s)
Lres3:
movl a1@(PCB_USTP),d0 | get USTP
moveq #PGSHIFT,d1
@@ -1331,16 +1490,37 @@ Lres5:
movl a0,usp | and USP
#ifdef FPCOPROC
lea a1@(PCB_FPCTX),a0 | pointer to FP save area
+#if defined(M68020) || defined(M68030) || defined(M68040)
+#ifdef M68060
+ btst #7,_machineid+3
+ jne Lresfp60rest1
+#endif
tstb a0@ | null state frame?
jeq Lresfprest2 | yes, easy
fmovem a0@(312),fpcr/fpsr/fpi | restore FP control registers
fmovem a0@(216),fp0-fp7 | restore FP general registers
Lresfprest2:
frestore a0@ | restore state
+ movw a1@(PCB_PS),sr | no, restore PS
+ moveq #1,d0 | return 1 (for alternate returns)
+ rts
#endif
+
+#ifdef M68060
+Lresfp60rest1:
+ tstb a0@(2) | null state frame?
+ jeq Lresfp60rest2 | yes, easy
+ fmovem a0@(312),fpcr | restore FP control registers
+ fmovem a0@(316),fpsr
+ fmovem a0@(320),fpi
+ fmovem a0@(216),fp0-fp7 | restore FP general registers
+Lresfp60rest2:
+ frestore a0@ | restore state
movw a1@(PCB_PS),sr | no, restore PS
moveq #1,d0 | return 1 (for alternate returns)
rts
+#endif
+#endif
/*
* savectx(pcb)
@@ -1356,10 +1536,29 @@ ENTRY(savectx)
#ifdef FPCOPROC
lea a1@(PCB_FPCTX),a0 | pointer to FP save area
fsave a0@ | save FP state
+#if defined(M68020) || defined(M68030) || defined(M68040)
+#ifdef M68060
+ btst #7,_machineid+3
+ jne Lsavctx60
+#endif
tstb a0@ | null state frame?
jeq Lsavedone | yes, all done
fmovem fp0-fp7,a0@(216) | save FP general registers
fmovem fpcr/fpsr/fpi,a0@(312) | save FP control registers
+#ifdef M68060
+ moveq #0,d0
+ rts
+#endif
+#endif
+#ifdef M68060
+Lsavctx60:
+ tstb a0@(2)
+ jeq Lsavedone
+ fmovem fp0-fp7,a0@(216) | save FP general registers
+ fmovem fpcr,a0@(312) | save FP control registers
+ fmovem fpsr,a0@(316)
+ fmovem fpi,a0@(320)
+#endif
#endif
Lsavedone:
moveq #0,d0 | return 0
@@ -1464,6 +1663,14 @@ Lmc68851a:
rts
Ltbia040:
.word 0xf518 | pflusha
+#ifdef M68060
+ btst #7,_machineid+3
+ jeq Ltbiano60
+ movc cacr,d0
+ orl #0x400000,d0 | and clear all branch cache entries
+ movc d0,cacr
+#endif
+Ltbiano60:
rts
/*
@@ -1493,6 +1700,14 @@ Ltbis040:
moveq #FC_USERD,d0 | select user
movc d0,dfc
.word 0xf508 | pflush a0@
+#ifdef M68060
+ btst #7,_machineid+3
+ jeq Ltbisno60
+ movc cacr,d0
+ orl #0x400000,d0 | and clear all branch cache entries
+ movc d0,cacr
+Ltbisno60:
+#endif
rts
/*
@@ -1515,8 +1730,16 @@ Lmc68851c:
pflushs #4,#4 | flush supervisor TLB entries
rts
Ltbias040:
-| 68040 can't specify supervisor/user on pflusha, so we flush all
+| 68040 cannot specify supervisor/user on pflusha, so we flush all
.word 0xf518 | pflusha
+#ifdef M68060
+ btst #7,_machineid+3
+ jeq Ltbiasno60
+ movc cacr,d0
+ orl #0x400000,d0 | and clear all branch cache entries
+ movc d0,cacr
+Ltbiasno60:
+#endif
rts
/*
@@ -1541,6 +1764,14 @@ Lmc68851d:
Ltbiau040:
| 68040 can't specify supervisor/user on pflusha, so we flush all
.word 0xf518 | pflusha
+#ifdef M68060
+ btst #7,_machineid+3
+ jeq Ltbiauno60
+ movc cacr,d0
+ orl #0x200000,d0 | but only user branch cache entries
+ movc d0,cacr
+Ltbiauno60:
+#endif
rts
/*
@@ -1549,7 +1780,7 @@ Ltbiau040:
ENTRY(ICIA)
ENTRY(ICPA)
#if defined(M68030) || defined(M68020)
-#if defined(M68040)
+#if defined(M68040) || defined(M68060)
cmpl #MMU_68040,_mmutype
jeq Licia040
#endif
@@ -1558,8 +1789,8 @@ ENTRY(ICPA)
rts
Licia040:
#endif
-#if defined(M68040)
- .word 0xf498 | cinva ic
+#if defined(M68040) || defined(M68060)
+ .word 0xf498 | cinva ic, clears also branch cache on 060
rts
#endif
@@ -1604,7 +1835,7 @@ __DCIAS:
.word 0xf468 | cpushl dc,a0@
Ldciasx:
rts
-#ifdef M68040
+#if defined(M68040) || defined(M68060)
ENTRY(ICPL) /* invalidate instruction physical cache line */
movl sp@(4),a0 | address
.word 0xf488 | cinvl ic,a0@
@@ -1636,7 +1867,7 @@ ENTRY(DCFP) /* data cache flush page */
ENTRY(PCIA)
#if defined(M68030) || defined(M68030)
-#if defined(M68040)
+#if defined(M68040) || defined(M68060)
cmpl #MMU_68040,_mmutype
jeq Lpcia040
#endif
@@ -1644,7 +1875,7 @@ ENTRY(PCIA)
movc d0,cacr | invalidate on-chip d-cache
rts
#endif
-#if defined(M68040)
+#if defined(M68040) || defined(M68060)
ENTRY(DCFA)
Lpcia040:
.word 0xf478 | cpusha dc
@@ -1700,6 +1931,10 @@ ENTRY(loadustp)
movl sp@(4),d0 | new USTP
moveq #PGSHIFT,d1
lsll d1,d0 | convert to addr
+#ifdef M68060
+ btst #7,_machineid+3
+ jne Lldustp060
+#endif
cmpl #MMU_68040,_mmutype
jeq Lldustp040
lea _protorp,a0 | CRP prototype
@@ -1708,6 +1943,12 @@ ENTRY(loadustp)
movl #DC_CLEAR,d0
movc d0,cacr | invalidate on-chip d-cache
rts | since pmove flushes TLB
+#ifdef M68060
+Lldustp060:
+ movc cacr,d1
+ orl #0x200000,d1 | clear user branch cache entries
+ movc d1,cacr
+#endif
Lldustp040:
.word 0x4e7b,0x0806 | movec d0,URP
rts
@@ -1718,6 +1959,10 @@ Lldustp040:
* and ATC entries in PMMU.
*/
ENTRY(flushustp)
+#ifdef M68060
+ btst #7,_machineid+3
+ jne Lflustp060
+#endif
cmpl #MMU_68040,_mmutype
jeq Lnot68851
tstl _mmutype | 68851 PMMU?
@@ -1729,6 +1974,14 @@ ENTRY(flushustp)
pflushr _protorp | flush RPT/TLB entries
Lnot68851:
rts
+#ifdef M68060
+Lflustp060:
+ movc cacr,d1
+ orl #0x200000,d1 | clear user branch cache entries
+ movc d1,cacr
+ rts
+#endif
+
ENTRY(ploadw)
movl sp@(4),a0 | address to load
@@ -1771,15 +2024,38 @@ ENTRY(_remque)
ENTRY(m68881_save)
movl sp@(4),a0 | save area pointer
fsave a0@ | save state
+#if defined(M68020) || defined(M68030) || defined(M68040)
+#ifdef M68060
+ btst #7,_machineid
+ jne Lm68060fpsave
+#endif
tstb a0@ | null state frame?
jeq Lm68881sdone | yes, all done
fmovem fp0-fp7,a0@(216) | save FP general registers
fmovem fpcr/fpsr/fpi,a0@(312) | save FP control registers
Lm68881sdone:
rts
+#endif
+
+#ifdef M68060
+Lm68060fpsave:
+ tstb a0@(2) | null state frame?
+ jeq Lm68060sdone | yes, all done
+ fmovem fp0-fp7,a0@(216) | save FP general registers
+ fmovem fpcr,a0@(312) | save FP control registers
+ fmovem fpsr,a0@(316)
+ fmovem fpi,a0@(320)
+Lm68060sdone:
+ rts
+#endif
ENTRY(m68881_restore)
movl sp@(4),a0 | save area pointer
+#if defined(M68020) || defined(M68030) || defined(M68040)
+#if defined(M68060)
+ btst #7,_machineid
+ jne Lm68060fprestore
+#endif
tstb a0@ | null state frame?
jeq Lm68881rdone | yes, easy
fmovem a0@(312),fpcr/fpsr/fpi | restore FP control registers
@@ -1789,6 +2065,20 @@ Lm68881rdone:
rts
#endif
+#ifdef M68060
+Lm68060fprestore:
+ tstb a0@(2) | null state frame?
+ jeq Lm68060fprdone | yes, easy
+ fmovem a0@(312),fpcr | restore FP control registers
+ fmovem a0@(316),fpsr
+ fmovem a0@(320),fpi
+ fmovem a0@(216),fp0-fp7 | restore FP general registers
+Lm68060fprdone:
+ frestore a0@ | restore state
+ rts
+#endif
+#endif
+
/*
* Handle the nitty-gritty of rebooting the machine.
*
@@ -1806,6 +2096,11 @@ Ldoboot0:
movw #0x2700,sr | cut off any interrupts
+#if defined(DRACO)
+ cmpb #0x7d,_machineid
+ jeq LdbOnDraCo
+#endif
+
| clear first 4k of CHIPMEM
movl _CHIPMEMADDR,a0
movl a0,a1
@@ -1865,7 +2160,52 @@ Ldoreset:
| now rely on prefetch for next jmp
jmp a0@
| NOT REACHED
+#ifdef DRACO
+LdbOnDraCo:
+| we should better use TTR instead of this... we want to boot even if
+| half of us is already dead.
+
+| pea LdoDraCoBoot
+| pea _kernel_pmap_store
+| jsr _pmap_extract
+| movl d0,sp@(4)
+| andl #0xFFFFE000,d0
+| movl #1,sp@ | wired = TRUE
+| movl #0x4,sp@- | prot = VM_PROT_EXECUTE
+| movl d0,sp@- | map va == pa
+| movl d0,sp@- | to pa
+| pea _kernel_pmap_store
+| jsr _pmap_enter
+| addl #NBPG,sp@(4)
+| addl #NBPG,sp@(8)
+| jsr _pmap_enter
+| addl #20,sp
+
+ movl _boot_fphystart, d0
+ lea LdoDraCoBoot, a0
+ lea a0@(d0),a0
+ andl #0xFF000000,d0
+ orl #0x0000C044,d0 | enable, supervisor, CI, RO
+ .word 0x4e7b,0x0004 | movc d0,ITT0
+ jmp a0@
+ .align 2
+LdoDraCoBoot:
+| turn off MMU now ... were more ore less guaranteed to run on 040/060:
+ movl #0,d0
+ .word 0x4e7b,0x0003 | movc d0,TC
+ .word 0x4e7b,0x0806 | movc d0,URP
+ .word 0x4e7b,0x0807 | movc d0,SRP
+ .word 0x4e7b,0x0004 | movc d0,ITT0
+ nop
+| map in boot ROM @0:
+ reset
+| and simulate what a reset exception would have done.
+ movl 4,a0
+ movl 0,a7
+ jmp a0@
+ | NOT REACHED
+#endif
/*
* Reboot directly into a new kernel image.
* kernel_reload(image, image_size, entry,
diff --git a/sys/arch/amiga/amiga/machdep.c b/sys/arch/amiga/amiga/machdep.c
index ccac1292092..990a37c97a7 100644
--- a/sys/arch/amiga/amiga/machdep.c
+++ b/sys/arch/amiga/amiga/machdep.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: machdep.c,v 1.12 1996/05/28 09:45:11 niklas Exp $ */
-/* $NetBSD: machdep.c,v 1.65 1996/05/01 09:56:22 veego Exp $ */
+/* $OpenBSD: machdep.c,v 1.13 1996/05/29 10:14:29 niklas Exp $ */
+/* $NetBSD: machdep.c,v 1.72 1996/05/19 14:55:31 is Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -65,6 +65,8 @@
#include <sys/sysctl.h>
#include <sys/mount.h>
#include <sys/syscallargs.h>
+#include <sys/core.h>
+#include <sys/kcore.h>
#ifdef SYSVSHM
#include <sys/shm.h>
#endif
@@ -91,9 +93,13 @@
#include <machine/reg.h>
#include <machine/psl.h>
#include <machine/pte.h>
+#include <machine/kcore.h>
#include <dev/cons.h>
#include <amiga/amiga/isr.h>
#include <amiga/amiga/custom.h>
+#ifdef DRACO
+#include <amiga/amiga/drcustom.h>
+#endif
#include <amiga/amiga/cia.h>
#include <amiga/amiga/cc.h>
#include <amiga/amiga/memlist.h>
@@ -189,6 +195,9 @@ char *cpu_type = "m68k";
char machine[] = "amiga";
struct isr *isr_ports;
+#ifdef DRACO
+struct isr *isr_slot3;
+#endif
#if defined(IPL_REMAP_1) || defined(IPL_REMAP_2)
struct isr *isr_exter[7];
#else
@@ -277,8 +286,12 @@ void
consinit()
{
/* initialize custom chip interface */
- custom_chips_init();
-
+#ifdef DRACO
+ if (is_draco()) {
+ /* XXX to be done */
+ } else
+#endif
+ custom_chips_init();
/*
* Initialize the console before we print anything out.
*/
@@ -499,26 +512,39 @@ again:
memlist->m_seg[i].ms_size);
#if defined(MACHINE_NONCONTIG) && defined(DEBUG)
printf ("Physical memory segments:\n");
- for (i = 0; phys_segs[i].start; ++i)
- printf ("Physical segment %d at %08lx size %ld pages %d\n", i,
+ for (i = 0; i < memlist->m_nseg && phys_segs[i].start; ++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);
#endif
+
+#ifdef DEBUG
+ printf("calling initcpu...\n");
+#endif
/*
* Set up CPU-specific registers, cache, etc.
*/
initcpu();
+#ifdef DEBUG
+ printf("survived initcpu...\n");
+#endif
/*
* Set up buffers, so they can be used to read disk labels.
*/
bufinit();
+#ifdef DEBUG
+ printf("survived bufinit...\n");
+#endif
/*
* Configure the system.
*/
configure();
+#ifdef DEBUG
+ printf("survived configure...\n");
+#endif
}
/*
@@ -569,6 +595,19 @@ identifycpu()
/* there's alot of XXX in here... */
char *mach, *mmu, *fpu;
+#ifdef M68060
+ char cpubuf[16];
+ u_int32_t pcr;
+#endif
+
+#ifdef DRACO
+ char machbuf[16];
+
+ if (is_draco()) {
+ sprintf(machbuf, "DraCo rev.%d", is_draco());
+ mach = machbuf;
+ } else
+#endif
if (is_a4000())
mach = "Amiga 4000";
else if (is_a3000())
@@ -579,6 +618,17 @@ identifycpu()
mach = "Amiga 500/2000";
fpu = NULL;
+#ifdef M68060
+ if (machineid & AMIGA_68060) {
+ asm(".word 0x4e7a,0x0808; movl d0,%0" : "=d"(pcr) : : "d0");
+ sprintf(cpubuf, "68%s060 rev.%d",
+ pcr & 0x10000 ? "LC/EC" : "", (pcr>>8)&0xff);
+ cpu_type = cpubuf;
+ mmu = "/MMU";
+ fpu = "/FPU";
+ fputype = FPU_68040; /* XXX */
+ } else
+#endif
if (machineid & AMIGA_68040) {
cpu_type = "m68040";
mmu = "/MMU";
@@ -1005,20 +1055,38 @@ boot(howto)
unsigned dumpmag = 0x8fca0101; /* magic number for savecore */
int dumpsize = 0; /* also for savecore */
long dumplo = 0;
+cpu_kcore_hdr_t cpu_kcore_hdr;
void
dumpconf()
{
int nblks;
+ int i;
+ extern u_int Sysseg_pa;
+ /* XXX new corefile format, single segment + chipmem */
dumpsize = physmem;
+ cpu_kcore_hdr.ram_segs[0].start = lowram;
+ cpu_kcore_hdr.ram_segs[0].size = ctob(physmem);
+ for (i = 0; i < memlist->m_nseg; i++) {
+ if ((memlist->m_seg[i].ms_attrib & MEMF_CHIP) == 0)
+ continue;
+ dumpsize += btoc(memlist->m_seg[i].ms_size);
+ cpu_kcore_hdr.ram_segs[1].start = 0;
+ cpu_kcore_hdr.ram_segs[1].size = memlist->m_seg[i].ms_size;
+ break;
+ }
+ cpu_kcore_hdr.mmutype = mmutype;
+ cpu_kcore_hdr.kernel_pa = lowram;
+ cpu_kcore_hdr.sysseg_pa = (st_entry_t *)Sysseg_pa;
if (dumpdev != NODEV && bdevsw[major(dumpdev)].d_psize) {
nblks = (*bdevsw[major(dumpdev)].d_psize)(dumpdev);
if (dumpsize > btoc(dbtob(nblks - dumplo)))
dumpsize = btoc(dbtob(nblks - dumplo));
else if (dumplo == 0)
- dumplo = nblks - btodb(ctob(physmem));
+ dumplo = nblks - btodb(ctob(dumpsize));
}
+ --dumplo; /* XXX assume header fits in one block */
/*
* Don't dump on the first CLBYTES (why CLBYTES?)
* in case the dump device includes a disk label.
@@ -1046,11 +1114,14 @@ reserve_dumppages(p)
void
dumpsys()
{
- unsigned bytes, i, n;
+ unsigned bytes, i, n, seg;
int maddr, psize;
daddr_t blkno;
int (*dump) __P((dev_t, daddr_t, caddr_t, size_t));
int error = 0;
+ kcore_seg_t *kseg_p;
+ cpu_kcore_hdr_t *chdr_p;
+ char dump_hdr[dbtob(1)]; /* XXX assume hdr fits in 1 block */
msgbufmapped = 0;
if (dumpdev == NODEV)
@@ -1071,11 +1142,29 @@ dumpsys()
printf("area unavailable.\n");
return;
}
+ kseg_p = (kcore_seg_t *)dump_hdr;
+ chdr_p = (cpu_kcore_hdr_t *)&dump_hdr[ALIGN(sizeof(*kseg_p))];
+ bzero(dump_hdr, sizeof(dump_hdr));
+
+ /*
+ * Generate a segment header
+ */
+ CORE_SETMAGIC(*kseg_p, KCORE_MAGIC, MID_MACHINE, CORE_CPU);
+ kseg_p->c_size = dbtob(1) - ALIGN(sizeof(*kseg_p));
+
+ /*
+ * Add the md header
+ */
+
+ *chdr_p = cpu_kcore_hdr;
+
bytes = ctob(dumpsize);
- maddr = lowram;
+ maddr = cpu_kcore_hdr.ram_segs[0].start;
+ seg = 0;
blkno = dumplo;
dump = bdevsw[major(dumpdev)].d_dump;
- for (i = 0; i < bytes; i += n) {
+ error = (*dump) (dumpdev, blkno++, (caddr_t)dump_hdr, dbtob(1));
+ for (i = 0; i < bytes && error == 0; i += n) {
/* Print out how many MBs we have to go. */
n = bytes - i;
if (n && (n % (1024 * 1024)) == 0)
@@ -1085,12 +1174,25 @@ dumpsys()
if (n > BYTES_PER_DUMP)
n = BYTES_PER_DUMP;
+ if (maddr == 0) { /* XXX kvtop chokes on this */
+ maddr += NBPG;
+ n -= NBPG;
+ i += NBPG;
+ ++blkno; /* XXX skip physical page 0 */
+ }
(void) pmap_map(dumpspace, maddr, maddr + n, VM_PROT_READ);
error = (*dump) (dumpdev, blkno, (caddr_t) dumpspace, n);
if (error)
break;
maddr += n;
blkno += btodb(n); /* XXX? */
+ if (maddr >= (cpu_kcore_hdr.ram_segs[seg].start +
+ cpu_kcore_hdr.ram_segs[seg].size)) {
+ ++seg;
+ maddr = cpu_kcore_hdr.ram_segs[seg].start;
+ if (cpu_kcore_hdr.ram_segs[seg].size == 0)
+ break;
+ }
}
switch (error) {
@@ -1152,9 +1254,67 @@ microtime(tvp)
splx(s);
}
+#if defined(M68060)
+int m68060_pcr_init = 0x21; /* make this patchable */
+#endif
+
void
initcpu()
{
+ /* XXX should init '40 vecs here, too */
+#if defined(M68060) || defined(DRACO)
+ extern caddr_t vectab[256];
+#endif
+
+#ifdef M68060
+#if defined(M060SP)
+ extern u_int8_t I_CALL_TOP[];
+ extern u_int8_t FP_CALL_TOP[];
+#else
+ extern u_int8_t illinst;
+#endif
+#endif
+
+#ifdef DRACO
+ extern u_int8_t DraCoLev2intr, lev2intr;
+#endif
+
+#ifdef M68060
+ if (machineid & AMIGA_68060) {
+ asm volatile ("movl %0,d0; .word 0x4e7b,0x0808" : :
+ "d"(m68060_pcr_init):"d0" );
+#if defined(M060SP)
+
+ /* integer support */
+ vectab[61] = &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];
+
+ vectab[54] = &FP_CALL_TOP[128 + 0x00];
+ vectab[52] = &FP_CALL_TOP[128 + 0x08];
+ vectab[53] = &FP_CALL_TOP[128 + 0x10];
+ vectab[51] = &FP_CALL_TOP[128 + 0x18];
+ vectab[50] = &FP_CALL_TOP[128 + 0x20];
+ vectab[49] = &FP_CALL_TOP[128 + 0x28];
+
+#else
+ vectab[61] = &illinst;
+#endif
+ }
+#endif
+
+#ifdef DRACO
+ if (is_draco()) {
+ vectab[24+2] = &DraCoLev2intr;
+ vectab[24+4] = &lev2intr;
+ vectab[24+5] = &lev2intr;
+ vectab[24+6] = &lev2intr;
+ }
+#endif
+ DCIS();
}
void
@@ -1162,8 +1322,8 @@ straytrap(pc, evec)
int pc;
u_short evec;
{
- printf("unexpected trap (vector offset %x) from %x\n",
- evec & 0xFFF, pc);
+ printf("unexpected trap format %x (vector offset %x) from %x\n",
+ evec>>12, evec & 0xFFF, pc);
/*XXX*/ panic("straytrap");
}
@@ -1415,15 +1575,35 @@ add_isr(isr)
isr_exter_lowipl = isr->isr_mapped_ipl;
}
#else
+#ifdef DRACO
+ switch (isr->isr_ipl) {
+ case 2:
+ p = &isr_ports;
+ break;
+ case 3:
+ p = &isr_slot3;
+ break;
+ default: /* was case 6:; make gcc -Wall quiet */
+ p = &isr_exter;
+ break;
+ }
+#else
p = isr->isr_ipl == 2 ? &isr_ports : &isr_exter;
#endif
+#endif
while ((q = *p) != NULL)
p = &q->isr_forw;
isr->isr_forw = NULL;
*p = isr;
/* enable interrupt */
- custom.intena = INTF_SETCLR |
- (isr->isr_ipl == 2 ? INTF_PORTS : INTF_EXTER);
+#ifdef DRACO
+ if (is_draco())
+ *draco_intena |= isr->isr_ipl == 6 ?
+ DRIRQ_INT6 : DRIRQ_INT2;
+ else
+#endif
+ custom.intena = INTF_SETCLR |
+ (isr->isr_ipl == 2 ? INTF_PORTS : INTF_EXTER);
}
void
@@ -1435,8 +1615,22 @@ remove_isr(isr)
#if defined(IPL_REMAP_1) || defined(IPL_REMAP_2)
p = isr->isr_ipl == 6 ? &isr_exter[isr->isr_mapped_ipl] : &isr_ports;
#else
+#ifdef DRACO
+ switch (isr->isr_ipl) {
+ case 2:
+ p = &isr_ports;
+ break;
+ case 3:
+ p = &isr_slot3;
+ break;
+ default: /* XXX to make gcc -Wall quiet, was 6: */
+ p = &isr_exter;
+ break;
+ }
+#else
p = isr->isr_ipl == 6 ? &isr_exter : &isr_ports;
#endif
+#endif
while ((q = *p) != NULL && q != isr)
p = &q->isr_forw;
if (q)
@@ -1462,9 +1656,30 @@ remove_isr(isr)
custom.intena = INTF_PORTS;
}
#else
+#ifdef DRACO
+ switch (isr->isr_ipl) {
+ case 2:
+ p = &isr_ports;
+ break;
+ case 3:
+ p = &isr_slot3;
+ break;
+ case 6:
+ p = &isr_exter;
+ break;
+ }
+#else
p = isr->isr_ipl == 6 ? &isr_exter : &isr_ports;
+#endif
if (*p == NULL)
- custom.intena = isr->isr_ipl == 6 ? INTF_EXTER : INTF_PORTS;
+#ifdef DRACO
+ if (is_draco())
+ *draco_intena &= isr->isr_ipl == 6 ?
+ ~DRIRQ_INT6 : ~DRIRQ_INT2;
+ else
+#endif
+ custom.intena = isr->isr_ipl == 6 ?
+ INTF_EXTER : INTF_PORTS;
#endif
}
@@ -1477,10 +1692,23 @@ intrhand(sr)
register struct isr **p, *q;
ipl = (sr >> 8) & 7;
- ireq = custom.intreqr;
+#ifdef REALLYDEBUG
+ printf("intrhand: got int. %d\n", ipl);
+#endif
+#ifdef DRACO
+ if (is_draco())
+ ireq = ((ipl == 1) && (*draco_intfrc & DRIRQ_SOFT) ?
+ INTF_SOFTINT : 0);
+ else
+#endif
+ ireq = custom.intreqr;
switch (ipl) {
case 1:
+#ifdef DRACO
+ if (is_draco() && (draco_ioct->io_status & DRSTAT_KBDRECV))
+ drkbdintr();
+#endif
if (ireq & INTF_TBE) {
#if NSER > 0
ser_outintr();
@@ -1514,15 +1742,24 @@ intrhand(sr)
siroff(SIR_NET | SIR_CLOCK | SIR_CBACK);
splx(s);
if (ssir_active & SIR_NET) {
+#ifdef REALLYDEBUG
+ printf("calling netintr\n");
+#endif
cnt.v_soft++;
netintr();
}
if (ssir_active & SIR_CLOCK) {
+#ifdef REALLYDEBUG
+ printf("calling softclock\n");
+#endif
cnt.v_soft++;
/* XXXX softclock(&frame.f_stackadj); */
softclock();
}
if (ssir_active & SIR_CBACK) {
+#ifdef REALLYDEBUG
+ printf("calling softcallbacks\n");
+#endif
cnt.v_soft++;
call_sicallbacks();
}
@@ -1538,7 +1775,12 @@ intrhand(sr)
}
if (q == NULL)
ciaa_intr ();
- custom.intreq = INTF_PORTS;
+#ifdef DRACO
+ if (is_draco())
+ *draco_intpen &= ~DRIRQ_INT2;
+ else
+#endif
+ custom.intreq = INTF_PORTS;
break;
case 3:
/* VBL */
@@ -1560,6 +1802,16 @@ intrhand(sr)
#endif
case 4:
+#ifdef DRACO
+#include "drsc.h"
+ if (is_draco())
+#if NDRSC > 0
+ drsc_handler();
+#else
+ *draco_intpen &= ~DRIRQ_SCSI;
+#endif
+ else
+#endif
audio_handler();
break;
default:
@@ -1567,6 +1819,9 @@ intrhand(sr)
sr, ireq);
break;
}
+#ifdef REALLYDEBUG
+ printf("intrhand: leaving.\n");
+#endif
}
#if defined(DEBUG) && !defined(PANICBUTTON)
@@ -1729,7 +1984,9 @@ cpu_exec_aout_makecmds(p, epp)
struct exec_package *epp;
{
int error = ENOEXEC;
+#ifdef COMPAT_NOMID
struct exec *execp = epp->ep_hdr;
+#endif
#ifdef COMPAT_NOMID
if (!((execp->a_midmag >> 16) & 0x0fff)
diff --git a/sys/arch/amiga/amiga/pmap.c b/sys/arch/amiga/amiga/pmap.c
index 272f200024c..04389aee3ee 100644
--- a/sys/arch/amiga/amiga/pmap.c
+++ b/sys/arch/amiga/amiga/pmap.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: pmap.c,v 1.5 1996/05/02 06:43:22 niklas Exp $ */
-/* $NetBSD: pmap.c,v 1.30 1996/04/28 06:59:08 mhitch Exp $ */
+/* $OpenBSD: pmap.c,v 1.6 1996/05/29 10:14:31 niklas Exp $ */
+/* $NetBSD: pmap.c,v 1.34 1996/05/19 21:04:24 veego Exp $ */
/*
* Copyright (c) 1991 Regents of the University of California.
@@ -151,7 +151,7 @@ int pmapdebug = PDB_PARANOIA;
/*
* Get STEs and PTEs for user/kernel address space
*/
-#ifdef M68040
+#if defined(M68040) || defined(M68060)
#define pmap_ste(m, v) (&((m)->pm_stab[(vm_offset_t)(v) >> pmap_ishift]))
#define pmap_ste1(m, v) \
(&((m)->pm_stab[(vm_offset_t)(v) >> SG4_SHIFT1]))
@@ -236,7 +236,9 @@ vm_offset_t vm_first_phys; /* PA of first managed page */
vm_offset_t vm_last_phys; /* PA just past last managed page */
boolean_t pmap_initialized = FALSE; /* Has pmap_init completed? */
char *pmap_attributes; /* reference and modify bits */
-#ifdef M68040
+TAILQ_HEAD(pv_page_list, pv_page) pv_page_freelist;
+int pv_nfree;
+#if defined(M68040) || defined(M68060)
static int pmap_ishift; /* segment table index shift */
int protostfree; /* prototype (default) free ST map */
#endif
@@ -268,6 +270,9 @@ extern vm_offset_t reserve_dumppages __P((vm_offset_t));
static void amiga_protection_init __P((void));
void pmap_check_wiring __P((char *, vm_offset_t));
static void pmap_changebit __P((register vm_offset_t, int, boolean_t));
+struct pv_entry * pmap_alloc_pv __P((void));
+void pmap_free_pv __P((struct pv_entry *));
+
#ifdef DEBUG
void pmap_pvdump __P((vm_offset_t));
#endif
@@ -370,7 +375,7 @@ pmap_bootstrap(firstaddr, loadaddr)
pmap_kernel()->pm_stpa = Sysseg_pa;
pmap_kernel()->pm_stab = Sysseg;
pmap_kernel()->pm_ptab = Sysmap;
-#ifdef M68040
+#if defined(M68040) || defined(M68060)
if (mmutype == MMU_68040) {
pmap_ishift = SG4_SHIFT1;
pmap_kernel()->pm_stfree = protostfree;
@@ -454,7 +459,7 @@ pmap_init(phys_start, phys_end)
#ifdef MACHINE_NONCONTIG
printf("pmap_init(%lx, %lx)\n", avail_start, avail_end);
#else
- printf("pmap_init(%x, %x)\n", phys_start, phys_end);
+ printf("pmap_init(%lx, %lx)\n", phys_start, phys_end);
#endif
#endif
/*
@@ -510,6 +515,17 @@ pmap_init(phys_start, phys_end)
addr = (vm_offset_t) kmem_alloc(kernel_map, s);
Segtabzero = (u_int *) addr;
Segtabzeropa = (u_int *) pmap_extract(pmap_kernel(), addr);
+#ifdef M68060
+ if (machineid & AMIGA_68060) {
+ addr2 = addr;
+ while (addr2 < addr + AMIGA_STSIZE) {
+ pmap_changebit(addr2, PG_CCB, 0);
+ pmap_changebit(addr2, PG_CI, 1);
+ addr2 += NBPG;
+ }
+ DCIS();
+ }
+#endif
addr += AMIGA_STSIZE;
pv_table = (pv_entry_t) addr;
addr += sizeof(struct pv_entry) * npg;
@@ -554,7 +570,15 @@ pmap_init(phys_start, phys_end)
kpt_free_list = kpt_pages;
kpt_pages->kpt_va = addr2;
kpt_pages->kpt_pa = pmap_extract(pmap_kernel(), addr2);
+#ifdef M68060
+ if (machineid & AMIGA_68060) {
+ pmap_changebit(kpt_pages->kpt_pa, PG_CCB, 0);
+ pmap_changebit(kpt_pages->kpt_pa, PG_CI, 1);
+ DCIS();
+ }
+#endif
} while (addr != addr2);
+
#ifdef DEBUG
kpt_stats.kpttotal = atop(s);
if (pmapdebug & PDB_INIT)
@@ -585,7 +609,7 @@ pmap_init(phys_start, phys_end)
printf("pmap_init: pt_map [%lx - %lx)\n", addr, addr2);
#endif
-#ifdef M68040
+#if defined(M68040) || defined(M68060)
if (mmutype == MMU_68040) {
protostfree = ~1 & ~(-1 << MAXUL2SIZE);
}
@@ -663,6 +687,122 @@ pmap_virtual_space(startp, endp)
#define pmap_page_index(pa) (pa_index(pa))
#endif /* MACHINE_NONCONTIG */
+struct pv_entry *
+pmap_alloc_pv()
+{
+ struct pv_page *pvp;
+ struct pv_entry *pv;
+ int i;
+
+ if (pv_nfree == 0) {
+ pvp = (struct pv_page *)kmem_alloc(kernel_map, NBPG);
+ if (pvp == 0)
+ panic("pmap_alloc_pv: kmem_alloc() failed");
+ pvp->pvp_pgi.pgi_freelist = pv = &pvp->pvp_pv[1];
+ for (i = NPVPPG - 2; i; i--, pv++)
+ pv->pv_next = pv + 1;
+ pv->pv_next = 0;
+ pv_nfree += pvp->pvp_pgi.pgi_nfree = NPVPPG - 1;
+ TAILQ_INSERT_HEAD(&pv_page_freelist, pvp, pvp_pgi.pgi_list);
+ pv = &pvp->pvp_pv[0];
+ } else {
+ --pv_nfree;
+ pvp = pv_page_freelist.tqh_first;
+ if (--pvp->pvp_pgi.pgi_nfree == 0) {
+ TAILQ_REMOVE(&pv_page_freelist, pvp, pvp_pgi.pgi_list);
+ }
+ pv = pvp->pvp_pgi.pgi_freelist;
+#ifdef DIAGNOSTIC
+ if (pv == 0)
+ panic("pmap_alloc_pv: pgi_nfree inconsistent");
+#endif
+ pvp->pvp_pgi.pgi_freelist = pv->pv_next;
+ }
+ return pv;
+}
+
+void
+pmap_free_pv(pv)
+ struct pv_entry *pv;
+{
+ register struct pv_page *pvp;
+
+ pvp = (struct pv_page *) trunc_page(pv);
+ switch (++pvp->pvp_pgi.pgi_nfree) {
+ case 1:
+ TAILQ_INSERT_TAIL(&pv_page_freelist, pvp, pvp_pgi.pgi_list);
+ default:
+ pv->pv_next = pvp->pvp_pgi.pgi_freelist;
+ pvp->pvp_pgi.pgi_freelist = pv;
+ ++pv_nfree;
+ break;
+ case NPVPPG:
+ pv_nfree -= NPVPPG - 1;
+ TAILQ_REMOVE(&pv_page_freelist, pvp, pvp_pgi.pgi_list);
+ kmem_free(kernel_map, (vm_offset_t)pvp, NBPG);
+ break;
+ }
+}
+
+#ifdef not_used /* ?? */
+void
+pmap_collect_pv()
+{
+ struct pv_page_list pv_page_collectlist;
+ struct pv_page *pvp, *npvp;
+ struct pv_entry *ph, *ppv, *pv, *npv;
+ int s;
+
+ TAILQ_INIT(&pv_page_collectlist);
+
+ for (pvp = pv_page_freelist.tqh_first; pvp; pvp = npvp) {
+ if (pv_nfree < NPVPPG)
+ break;
+ npvp = pvp->pvp_pgi.pgi_list.tqe_next;
+ if (pvp->pvp_pgi.pgi_nfree > NPVPPG / 3) {
+ TAILQ_REMOVE(&pv_page_freelist, pvp, pvp_pgi.pgi_list);
+ TAILQ_INSERT_TAIL(&pv_page_collectlist, pvp, pvp_pgi.pgi_list);
+ pv_nfree -= pvp->pvp_pgi.pgi_nfree;
+ pvp->pvp_pgi.pgi_nfree = -1;
+ }
+ }
+
+ if (pv_page_collectlist.tqh_first == 0)
+ return;
+
+ for (ph = &pv_table[npages - 1]; ph >= &pv_table[0]; ph--) {
+ if (ph->pv_pmap == 0)
+ continue;
+ s = splimp();
+ for (ppv = ph; (pv = ppv->pv_next) != 0; ) {
+ pvp = (struct pv_page *) trunc_page(pv);
+ if (pvp->pvp_pgi.pgi_nfree == -1) {
+ pvp = pv_page_freelist.tqh_first;
+ if (--pvp->pvp_pgi.pgi_nfree == 0) {
+ TAILQ_REMOVE(&pv_page_freelist, pvp, pvp_pgi.pgi_list);
+ }
+ npv = pvp->pvp_pgi.pgi_freelist;
+#ifdef DIAGNOSTIC
+ if (npv == 0)
+ panic("pmap_collect_pv: pgi_nfree inconsistent");
+#endif
+ pvp->pvp_pgi.pgi_freelist = npv->pv_next;
+ *npv = *pv;
+ ppv->pv_next = npv;
+ ppv = npv;
+ } else
+ ppv = pv;
+ }
+ splx(s);
+ }
+
+ for (pvp = pv_page_collectlist.tqh_first; pvp; pvp = npvp) {
+ npvp = pvp->pvp_pgi.pgi_list.tqe_next;
+ kmem_free(kernel_map, (vm_offset_t)pvp, NBPG);
+ }
+}
+#endif
+
/*
* Used to map a range of physical addresses into kernel
* virtual address space.
@@ -749,7 +889,7 @@ pmap_pinit(pmap)
*/
pmap->pm_stab = Segtabzero;
pmap->pm_stpa = Segtabzeropa;
-#ifdef M68040
+#if defined(M68040) || defined(M68060)
if (mmutype == MMU_68040)
pmap->pm_stfree = protostfree;
#endif
@@ -809,7 +949,8 @@ pmap_release(pmap)
kmem_free_wakeup(pt_map, (vm_offset_t)pmap->pm_ptab,
AMIGA_UPTSIZE);
if (pmap->pm_stab != Segtabzero)
- kmem_free(kernel_map, (vm_offset_t)pmap->pm_stab, AMIGA_STSIZE);
+ kmem_free_wakeup(kernel_map, (vm_offset_t)pmap->pm_stab,
+ AMIGA_STSIZE);
}
/*
@@ -845,8 +986,11 @@ pmap_remove(pmap, sva, eva)
register u_int *pte;
register pv_entry_t pv, npv;
pmap_t ptpmap;
- int *ste, i, s, bits;
+ int *ste, s, bits;
boolean_t flushcache = FALSE;
+#if defined(M68040) || defined(M68060)
+ int i;
+#endif
#ifdef DEBUG
u_int opte;
@@ -938,7 +1082,7 @@ pmap_remove(pmap, sva, eva)
npv = pv->pv_next;
if (npv) {
*pv = *npv;
- free((caddr_t)npv, M_VMPVENT);
+ pmap_free_pv(npv);
} else
pv->pv_pmap = NULL;
#ifdef DEBUG
@@ -955,14 +1099,20 @@ pmap_remove(pmap, sva, eva)
}
#ifdef DEBUG
if (npv == NULL) {
-printf ("pmap_remove: PA %lx index %d\n", pa, pa_index(pa));
+#ifdef MACHINE_NONCONTIG /* XXX this need to be fixed */
+ 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));
+#endif
panic("pmap_remove: PA not in pv_tab");
}
#endif
ste = (int *)npv->pv_ptste;
ptpmap = npv->pv_ptpmap;
pv->pv_next = npv->pv_next;
- free((caddr_t)npv, M_VMPVENT);
+ pmap_free_pv(npv);
pv = pa_to_pvh(pa);
}
/*
@@ -978,7 +1128,7 @@ printf ("pmap_remove: PA %lx index %d\n", pa, pa_index(pa));
*(int *)&opte, pmap_pte(pmap, va));
}
#endif
-#ifdef M68040
+#if defined(M68040) || defined(M68060)
if (mmutype == MMU_68040) {
/*
* On the 68040, the PT page contains NPTEPG/SG4_LEV3SIZE
@@ -998,7 +1148,7 @@ printf ("pmap_remove: PA %lx index %d\n", pa, pa_index(pa));
#endif
}
else
-#endif /* M68040 */
+#endif /* M68040 || M68060 */
*ste = SG_NV;
/*
* If it was a user PT page, we decrement the
@@ -1021,12 +1171,12 @@ printf ("pmap_remove: PA %lx index %d\n", pa, pa_index(pa));
printf("remove: free stab %p\n",
ptpmap->pm_stab);
#endif
- kmem_free(kernel_map,
+ kmem_free_wakeup(kernel_map,
(vm_offset_t)ptpmap->pm_stab,
AMIGA_STSIZE);
ptpmap->pm_stab = Segtabzero;
ptpmap->pm_stpa = Segtabzeropa;
-#ifdef M68040
+#if defined(M68040) || defined(M68060)
if (mmutype == MMU_68040)
ptpmap->pm_stfree = protostfree;
#endif
@@ -1177,7 +1327,7 @@ pmap_protect(pmap, sva, eva, prot)
pte++;
continue;
}
-#ifdef M68040
+#if defined(M68040) || defined(M68060)
/*
* Clear caches if making RO (see section
* "7.3 Cache Coherency" in the manual).
@@ -1208,6 +1358,8 @@ pmap_protect(pmap, sva, eva, prot)
* or lose information. That is, this routine must actually
* insert this page into the given map NOW.
*/
+extern int kernel_copyback;
+
void
pmap_enter(pmap, va, pa, prot, wired)
register pmap_t pmap;
@@ -1358,10 +1510,7 @@ pmap_enter(pmap, va, pa, prot, wired)
if (pmap == npv->pv_pmap && va == npv->pv_va)
panic("pmap_enter: already in pv_tab");
#endif
- npv = (pv_entry_t)
- malloc(sizeof *npv, M_VMPVENT, M_NOWAIT);
- if (npv == NULL)
- panic("pmap_enter: PV allocation failure");
+ npv = pmap_alloc_pv();
npv->pv_va = va;
npv->pv_pmap = pmap;
npv->pv_next = pv->pv_next;
@@ -1399,9 +1548,36 @@ validate:
* Assume uniform modified and referenced status for all
* AMIGA pages in a MACH page.
*/
-#ifdef M68040
+#if defined(M68040) || defined(M68060)
+#if DEBUG
+ if (pmapdebug & 0x10000 && mmutype == MMU_68040 &&
+ pmap == pmap_kernel()) {
+ char *s;
+ if (va >= AMIGA_UPTBASE &&
+ va < (AMIGA_UPTBASE + AMIGA_UPTMAXSIZE))
+ s = "UPT";
+ else if (va >= (u_int)Sysmap &&
+ va < ((u_int)Sysmap + AMIGA_KPTSIZE))
+ s = "KPT";
+ else if (va >= (u_int)pmap->pm_stab &&
+ va < ((u_int)pmap->pm_stab + AMIGA_STSIZE))
+ s = "KST";
+ else if (curproc &&
+ va >= (u_int)curproc->p_vmspace->vm_map.pmap->pm_stab &&
+ va < ((u_int)curproc->p_vmspace->vm_map.pmap->pm_stab +
+ AMIGA_STSIZE))
+ s = "UST";
+ else
+ s = "other";
+ printf("pmap_init: validating %s kernel page at %lx -> %lx\n",
+ s, va, pa);
+
+ }
+#endif
if (mmutype == MMU_68040 && pmap == pmap_kernel() &&
- va >= AMIGA_UPTBASE && va < (AMIGA_UPTBASE + AMIGA_UPTMAXSIZE))
+ ((va >= AMIGA_UPTBASE &&
+ va < (AMIGA_UPTBASE + AMIGA_UPTMAXSIZE)) ||
+ (va >= (u_int)Sysmap && va < ((u_int)Sysmap + AMIGA_KPTSIZE))))
cacheable = FALSE; /* don't cache user page tables */
/* Don't cache if process can't take it, like SunOS ones. */
@@ -1416,8 +1592,9 @@ validate:
npte |= PG_W;
if (!checkpv && !cacheable)
npte |= PG_CI;
-#ifdef M68040
- else if (mmutype == MMU_68040 && (npte & PG_PROT) == PG_RW)
+#if defined(M68040) || defined(M68060)
+ else if (mmutype == MMU_68040 && (npte & PG_PROT) == PG_RW &&
+ (kernel_copyback || pmap != pmap_kernel()))
npte |= PG_CCB; /* cache copyback */
#endif
/*
@@ -1425,7 +1602,7 @@ validate:
* If so, we need not flush the TLB and caches.
*/
wired = ((*(int *)pte ^ npte) == PG_W);
-#ifdef M68040
+#if defined(M68040) || defined(M68060)
if (mmutype == MMU_68040 && !wired) {
DCFP(pa);
ICPP(pa);
@@ -1567,6 +1744,10 @@ void pmap_update()
if (pmapdebug & PDB_FOLLOW)
printf("pmap_update()\n");
#endif
+#if defined(M68060)
+ if (machineid & AMIGA_68060)
+ DCIA();
+#endif
TBIA();
}
@@ -2022,7 +2203,7 @@ pmap_changebit(pa, bit, setem)
* protection make sure the caches are
* flushed (but only once).
*/
-#ifdef M68040
+#if defined(M68040) || defined(M68060)
if (firstpage && mmutype == MMU_68040 &&
((bit == PG_RO && setem) || (bit & PG_CMASK))) {
firstpage = FALSE;
@@ -2046,6 +2227,9 @@ pmap_enter_ptpage(pmap, va)
{
register vm_offset_t ptpa;
register pv_entry_t pv;
+#ifdef M68060
+ u_int stpa;
+#endif
u_int *ste;
int s;
@@ -2066,8 +2250,20 @@ pmap_enter_ptpage(pmap, va)
kmem_alloc(kernel_map, AMIGA_STSIZE);
pmap->pm_stpa = (u_int *) pmap_extract(
pmap_kernel(), (vm_offset_t)pmap->pm_stab);
-#ifdef M68040
+#if defined(M68040) || defined(M68060)
if (mmutype == MMU_68040) {
+#if defined(M68060)
+ stpa = (u_int)pmap->pm_stpa;
+ if (machineid & AMIGA_68060) {
+ while (stpa < (u_int)pmap->pm_stpa +
+ AMIGA_STSIZE) {
+ pmap_changebit(stpa, PG_CCB, 0);
+ pmap_changebit(stpa, PG_CI, 1);
+ stpa += NBPG;
+ }
+ DCIS(); /* XXX */
+ }
+#endif
pmap->pm_stfree = protostfree;
}
#endif
@@ -2087,7 +2283,7 @@ pmap_enter_ptpage(pmap, va)
ste = pmap_ste(pmap, va);
-#ifdef M68040
+#if defined(M68040) || defined(M68060)
/*
* Allocate level 2 descriptor block if necessary
*/
@@ -2104,6 +2300,13 @@ pmap_enter_ptpage(pmap, va)
bzero(addr, SG4_LEV2SIZE * sizeof(st_entry_t));
addr = (caddr_t)&pmap->pm_stpa[ix * SG4_LEV2SIZE];
*ste = (u_int) addr | SG_RW | SG_U | SG_V;
+#if 0 /* XXX should be superfluous here: defined(M68060) */
+ if (machineid & AMIGA_68060) {
+ pmap_changebit(addr, PG_CCB, 0);
+ pmap_changebit(addr, PG_CI, 1);
+ DCIS(); /* XXX */
+ }
+#endif
#ifdef DEBUG
if (pmapdebug & (PDB_ENTER|PDB_PTPAGE|PDB_SEGTAB))
printf("enter_pt: alloc ste2 %d(%p)\n", ix, addr);
@@ -2160,6 +2363,13 @@ pmap_enter_ptpage(pmap, va)
ptpa = kpt->kpt_pa;
bzero((char *)kpt->kpt_va, NBPG);
pmap_enter(pmap, va, ptpa, VM_PROT_DEFAULT, TRUE);
+#if defined(M68060)
+ if (machineid & AMIGA_68060) {
+ pmap_changebit(ptpa, PG_CCB, 0);
+ pmap_changebit(ptpa, PG_CI, 1);
+ DCIS();
+ }
+#endif
#ifdef DEBUG
if (pmapdebug & (PDB_ENTER|PDB_PTPAGE))
printf("enter_pt: add &Sysptmap[%d]: %x (KPT page %lx)\n",
@@ -2192,6 +2402,13 @@ pmap_enter_ptpage(pmap, va)
#endif
}
+#ifdef M68060
+ if (machineid & M68060) {
+ pmap_changebit(ptpa, PG_CCB, 0);
+ pmap_changebit(ptpa, PG_CI, 1);
+ DCIS();
+ }
+#endif
/*
* Locate the PV entry in the kernel for this PT page and
* record the STE address. This is so that we can invalidate
@@ -2227,7 +2444,7 @@ pmap_enter_ptpage(pmap, va)
* it would be difficult to identify ST pages in pmap_pageable to
* release them. We also avoid the overhead of vm_map_pageable.
*/
-#ifdef M68040
+#if defined(M68040) || defined(M68060)
if (mmutype == MMU_68040) {
u_int *este;
diff --git a/sys/arch/amiga/amiga/swapgeneric.c b/sys/arch/amiga/amiga/swapgeneric.c
index f0bb2e0645f..cc1d169d95a 100644
--- a/sys/arch/amiga/amiga/swapgeneric.c
+++ b/sys/arch/amiga/amiga/swapgeneric.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: swapgeneric.c,v 1.4 1996/05/02 06:43:23 niklas Exp $ */
-/* $NetBSD: swapgeneric.c,v 1.22 1996/04/21 21:07:12 veego Exp $ */
+/* $OpenBSD: swapgeneric.c,v 1.5 1996/05/29 10:14:35 niklas Exp $ */
+/* $NetBSD: swapgeneric.c,v 1.24 1996/05/21 17:15:40 is Exp $ */
/*
* Copyright (c) 1982, 1986 Regents of the University of California.
@@ -139,6 +139,7 @@ getgenconf(bp)
return(gc);
}
+#ifdef GENERIC
void
setconf()
{
@@ -203,7 +204,6 @@ setconf()
asm("stop #0x2700");
/*NOTREACHED*/
found:
-
gc->gc_root = MAKEDISKDEV(major(gc->gc_root), unit, 0);
rootdev = gc->gc_root;
#if NCD > 0
@@ -218,6 +218,7 @@ justdoswap:
if (swaponroot)
rootdev = dumpdev;
}
+#endif
void
gets(cp)
diff --git a/sys/arch/amiga/amiga/trap.c b/sys/arch/amiga/amiga/trap.c
index c571ca850e6..97e9b87aa55 100644
--- a/sys/arch/amiga/amiga/trap.c
+++ b/sys/arch/amiga/amiga/trap.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: trap.c,v 1.4 1996/05/02 06:43:24 niklas Exp $ */
-/* $NetBSD: trap.c,v 1.45 1996/04/28 07:01:08 mhitch Exp $ */
+/* $OpenBSD: trap.c,v 1.5 1996/05/29 10:14:38 niklas Exp $ */
+/* $NetBSD: trap.c,v 1.47 1996/05/10 14:31:08 is Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -126,6 +126,9 @@ extern struct emul emul_sunos;
#define MMUSR_W 0x00000004
#define MMUSR_T 0x00000002
#define MMUSR_R 0x00000001
+
+#define FSLW_STRING "\020\1SEE\3BPE\4TTR\5WE\6RE\7TWE\010WP\011SP" \
+ "\012PF\013IL\014PTB\015PTA\016SBE\017PBE"
/*
* XXX End hack
*/
@@ -151,11 +154,12 @@ int trap_types = sizeof trap_type / sizeof trap_type[0];
* Size of various exception stack frames (minus the standard 8 bytes)
*/
short exframesize[] = {
- FMT0SIZE, /* type 0 - normal (68020/030/040) */
+ FMT0SIZE, /* type 0 - normal (68020/030/040/060) */
FMT1SIZE, /* type 1 - throwaway (68020/030/040) */
- FMT2SIZE, /* type 2 - normal 6-word (68020/030/040) */
- FMT3SIZE, /* type 3 - FP post-instruction (68040) */
- -1, -1, -1, /* type 4-6 - undefined */
+ FMT2SIZE, /* type 2 - normal 6-word (68020/030/040/060) */
+ FMT3SIZE, /* type 3 - FP post-instruction (68040/060) */
+ FMT4SIZE, /* type 4 - access error/fp disabled (68060) */
+ -1, -1, /* type 5-6 - undefined */
FMT7SIZE, /* type 7 - access error (68040) */
58, /* type 8 - bus fault (68010) */
FMT9SIZE, /* type 9 - coprocessor mid-instruction (68020/030) */
@@ -267,6 +271,8 @@ trapcpfault(p, fp)
fp->f_pc = (int) p->p_addr->u_pcb.pcb_onfault;
}
+int donomore = 0;
+
void
trapmmufault(type, code, v, fp, p, sticks)
int type;
@@ -275,6 +281,10 @@ trapmmufault(type, code, v, fp, p, sticks)
struct proc *p;
u_quad_t sticks;
{
+#if defined(DEBUG) && defined(M68060)
+ static u_int oldcode=0, oldv=0;
+ static struct proc *oldp=0;
+#endif
extern vm_map_t kernel_map;
struct vmspace *vm = NULL;
vm_prot_t ftype;
@@ -300,12 +310,29 @@ trapmmufault(type, code, v, fp, p, sticks)
mmudebug |= 0x100; /* XXX PAGE0 */
#endif
if (mmudebug && mmutype == MMU_68040) {
+#ifdef M68060
+ if (machineid & AMIGA_68060) {
+ if (--donomore == 0 || mmudebug & 1)
+ printf ("68060 access error: pc %x, code %b,"
+ " ea %x\n", fp->f_pc,
+ code, FSLW_STRING, v);
+ if (p == oldp && v == oldv && code == oldcode)
+ panic("Identical fault backtoback!");
+ if (donomore == 0)
+ panic("Tired of faulting.");
+ oldp = p;
+ oldv = v;
+ oldcode = code;
+ } else
+#endif
printf("68040 access error: pc %x, code %x,"
" ea %x, fa %x\n", fp->f_pc, code, fp->f_fmt7.f_ea, v);
if (curpcb)
printf(" curpcb %p ->pcb_ustp %x / %x\n",
curpcb, curpcb->pcb_ustp,
curpcb->pcb_ustp << PG_SHIFT);
+
+
#ifdef DDB /* XXX PAGE0 */
if (v < NBPG) /* XXX PAGE0 */
Debugger(); /* XXX PAGE0 */
@@ -320,16 +347,23 @@ trapmmufault(type, code, v, fp, p, sticks)
vm = p->p_vmspace;
if (type == T_MMUFLT &&
- (!p || !p->p_addr || p->p_addr->u_pcb.pcb_onfault == 0 ||
- (mmutype == MMU_68040 && (code & SSW_TMMASK) == FC_SUPERD) ||
- (mmutype != MMU_68040 && (code & (SSW_DF|FC_SUPERD)) == (SSW_DF|FC_SUPERD))))
+ (!p || !p->p_addr || p->p_addr->u_pcb.pcb_onfault == 0 || (
+#ifdef M68060
+ machineid & AMIGA_68060 ? code & FSLW_TM_SV :
+#endif
+ mmutype == MMU_68040 ? (code & SSW_TMMASK) == FC_SUPERD :
+ (code & (SSW_DF|FC_SUPERD)) == (SSW_DF|FC_SUPERD))))
map = kernel_map;
else
map = &vm->vm_map;
+
if (
- (mmutype == MMU_68040 && (code & SSW_RW040) == 0) ||
- (mmutype != MMU_68040 && (code & (SSW_DF|SSW_RW)) ==
- SSW_DF)) /* what about RMW? */
+#ifdef M68060
+ machineid & AMIGA_68060 ? code & FSLW_RW_W :
+#endif
+ mmutype == MMU_68040 ? (code & SSW_RW040) == 0 :
+ (code & (SSW_DF|SSW_RW)) == SSW_DF)
+ /* what about RMW? */
ftype = VM_PROT_READ | VM_PROT_WRITE;
else
ftype = VM_PROT_READ;
@@ -366,7 +400,11 @@ trapmmufault(type, code, v, fp, p, sticks)
printf("vmfault %s %lx returned %d\n",
map == kernel_map ? "kernel" : "user", va, rv);
#endif
+#ifdef M68060
+ if ((machineid & AMIGA_68060) == 0 && mmutype == MMU_68040) {
+#else
if (mmutype == MMU_68040) {
+#endif
if(rv != KERN_SUCCESS) {
goto nogo;
}
@@ -511,12 +549,12 @@ trap(type, code, v, frame)
return;
}
#endif
-/*
+#ifdef DEBUG
+ if (mmudebug & 2)
printf("trap: t %x c %x v %x pad %x adj %x sr %x pc %x fmt %x vc %x\n",
type, code, v, frame.f_pad, frame.f_stackadj, frame.f_sr,
frame.f_pc, frame.f_format, frame.f_vector);
-*/
-
+#endif
switch (type) {
default:
panictrap(type, code, v, &frame);
diff --git a/sys/arch/amiga/amiga/vectors.s b/sys/arch/amiga/amiga/vectors.s
index 56400ece38e..fdc3522c859 100644
--- a/sys/arch/amiga/amiga/vectors.s
+++ b/sys/arch/amiga/amiga/vectors.s
@@ -1,5 +1,5 @@
-/* $OpenBSD: vectors.s,v 1.2 1996/05/07 09:59:45 niklas Exp $ */
-/* $NetBSD: vectors.s,v 1.8 1994/10/26 02:02:12 cgd Exp $ */
+/* $OpenBSD: vectors.s,v 1.3 1996/05/29 10:14:39 niklas Exp $ */
+/* $NetBSD: vectors.s,v 1.9 1996/05/09 20:30:53 is Exp $ */
/*
* Copyright (c) 1988 University of Utah
diff --git a/sys/arch/amiga/conf/DRACO b/sys/arch/amiga/conf/DRACO
new file mode 100644
index 00000000000..dc617290496
--- /dev/null
+++ b/sys/arch/amiga/conf/DRACO
@@ -0,0 +1,163 @@
+# $NetBSD: DRACO,v 1.2 1996/05/16 17:52:22 is Exp $
+
+#
+# Macro System GmbH "DraCo"
+#
+
+# look into this later.
+include "std.draco"
+
+maxusers 8
+options TIMEZONE=300, DST=1
+
+# mainboards to support (in addition to Amiga)
+options DRACO
+#
+# processors this kernel should support
+#
+options "M68060" # support for 060 might still need M68040.
+options "M68040" # support for 040
+options M060SP # MC68060 software support (Required)
+options FPSP # MC68040 floating point support
+options FPCOPROC # Support for MC6888[12] (Required)
+
+options SWAPPAGER # Pager for processes (Required)
+options VNODEPAGER # Pager for vnodes (Required)
+options DEVPAGER # Pager for devices (Required)
+
+#
+# Networking options
+#
+options INET # IP networking support (Required)
+#options ISO # ISO Networking support
+#options TPIP # ARGO TP networking support
+#options CCITT # CCITT X.25
+#options NS # Xerox XNS
+#options EON # ISO CLNL over IP
+#options GATEWAY # Packet forwarding
+#options DIRECTED_BROADCAST # Broadcast across subnets
+#options NSIP # XNS over IP
+
+#
+# File system related options
+#
+options QUOTA # Disk quotas for local disks
+options NFSSERVER # Network File System server side code
+options NFSCLIENT # Network File System client side code
+
+#
+# File systems
+#
+options FFS # Berkeley fast file system
+options MFS # Memory based filesystem
+options PROCFS # Process filesystem
+options KERNFS # Kernel parameter filesystem (Recommended)
+options FDESC # /dev/fd filesystem
+options NULLFS # Loopback filesystem
+options FIFO # FIFO operations on vnodes (Recommended)
+options ADOSFS # AmigaDOS file system
+options "CD9660" # ISO 9660 file system, with Rock Ridge
+#options PORTAL # Portal filesystem
+options MSDOSFS # MS-DOS filesystem
+
+
+#
+# Compatability options for various existing systems
+#
+#options "COMPAT_10" # compatability with older NetBSD release
+#options COMPAT_SUNOS # Support to run Sun (m68k) executables
+options "TCP_COMPAT_42" # Use 4.2 BSD style TCP
+options "COMPAT_NOMID" # allow nonvalid machine id executables
+#options COMPAT_HPUX # HP300 compatability
+
+#
+# Support for System V IPC facilities.
+#
+options SYSVSHM # System V-like shared memory
+options SYSVMSG # System V-like messages
+options SYSVSEM # System V-like semaphores
+
+#
+# Support for various kernel options
+#
+options GENERIC # Mini-root boot support
+options LKM # Loadable kernel modules
+options KTRACE # Add kernel tracing system call
+options DIAGNOSTIC # Add additional error checking code
+options "NKMEMCLUSTERS=256" # Size of kernel malloc area
+
+#
+# Misc. debuging options
+#
+options PANICWAIT # Require keystroke to dump/reboot
+options DEBUG # Add debugging statements
+options DDB # Kernel debugger
+#options SYSCALL_DEBUG # debug all syscalls.
+#options SCSIDEBUG # Add SCSI debugging statements
+#options KGDB # Kernel debugger (KGDB) support
+#options PANICBUTTON # Forced crash via keypress (???)
+
+#
+# Amiga specific options
+#
+options MACHINE_NONCONTIG # Non-contiguous memory support
+ # higly recommended for DraCo
+
+options RETINACONSOLE # enable code to allow retina to be console
+
+#options "KFONT_8X11" # 8x11 font
+
+# 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.
+#options 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.
+#options RH_64BIT_SPRITE
+# enables fast scroll code appears to now work on 040 systems.
+#options RETINA_SPEED_HACK
+
+grfrh0 at zbus0 # Altais looks just like the Retina Z3
+grful0 at zbus0 # A2410, for poor ZZA
+
+grf2 at grfrh0
+grf4 at grful0
+
+ite2 at grf2 # 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
+bah* at zbus0 # C= arcnet
+
+
+# scsi stuff
+drsc0 at mainbus0 # DraCo mainboard scsi
+scsibus* at drsc0
+
+# 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 pty 16 # pseudo terminals
+pseudo-device loop # network loopback
+pseudo-device bpfilter 2 # berkeley packet filters
+pseudo-device tun 2
+
+config netbsd swap on generic
diff --git a/sys/arch/amiga/conf/GENERIC b/sys/arch/amiga/conf/GENERIC
index c5317c058b5..42430a05cb5 100644
--- a/sys/arch/amiga/conf/GENERIC
+++ b/sys/arch/amiga/conf/GENERIC
@@ -1,5 +1,5 @@
-# $OpenBSD: GENERIC,v 1.10 1996/05/15 08:56:13 mickey Exp $
-# $NetBSD: GENERIC,v 1.56 1996/04/30 17:40:34 is Exp $
+# $OpenBSD: GENERIC,v 1.11 1996/05/29 10:14:43 niklas Exp $
+# $NetBSD: GENERIC,v 1.57 1996/05/19 21:04:48 veego Exp $
#
# GENERIC AMIGA
@@ -51,7 +51,7 @@ options NFSCLIENT # Network File System client side code
options ADOSFS # AmigaDOS file system
options CD9660 # ISO 9660 + Rock Ridge file system
-options MSDOSFS # MS-DOS file system [does not work]
+options MSDOSFS # MS-DOS file system
options FDESC # /dev/fd
options FIFO # FIFOs; RECOMMENDED
options KERNFS # /kern
@@ -120,13 +120,13 @@ options RETINACONSOLE # enable code to allow retina to be console
options ULOWELLCONSOLE # enable code to allow a2410 to be console
options CL5426CONSOLE # Cirrus console
options CV64CONSOLE # CyberVision console
+options TSENGCONSOLE # Tseng console
options GRF_ECS # Enhanced Chip Set
options GRF_NTSC # NTSC
options GRF_PAL # PAL
options "GRF_A2024" # Support for the A2024
options GRF_AGA # AGA Chip Set
-options GRF_CL5426 # Cirrus board support
#options "KFONT_8X11" # 8x11 font
# This is how you would tell the kernel the A2410 oscillator frequencies:
@@ -150,7 +150,8 @@ grfrt0 at zbus0 # retina II
grfrh0 at zbus0 # retina III
grfcl* at zbus0 # Picasso II/Piccalo/Spectrum
grful0 at zbus0 # A2410
-grfcv0 at zbus0 # CyverVision 64
+grfcv0 at zbus0 # CyberVision 64
+grfet* at zbus0 # Tseng (oMniBus, Domino, Merlin)
grf0 at grfcc0
grf1 at grfrt0
@@ -158,6 +159,7 @@ grf2 at grfrh0
grf3 at grfcl?
grf4 at grful0
grf5 at grfcv0
+grf6 at grfet?
ite0 at grf0 # terminal emulators for grf's
ite1 at grf1 # terminal emulators for grf's
@@ -165,6 +167,7 @@ ite2 at grf2 # terminal emulators for grf's
ite3 at grf3 # terminal emulators for grf's
ite4 at grf4 # terminal emulators for grf's
ite5 at grf5 # terminal emulators for grf's
+ite6 at grf6 # terminal emulators for grf's
msc0 at zbus0 # A2232 MSC multiport serial.
mfc0 at zbus0 # MultiFaceCard I/O board
diff --git a/sys/arch/amiga/conf/Makefile.amiga b/sys/arch/amiga/conf/Makefile.amiga
index fad2e3786ff..941a25bed26 100644
--- a/sys/arch/amiga/conf/Makefile.amiga
+++ b/sys/arch/amiga/conf/Makefile.amiga
@@ -1,5 +1,5 @@
-# $OpenBSD: Makefile.amiga,v 1.12 1996/05/28 10:42:43 niklas Exp $
-# $NetBSD: Makefile.amiga,v 1.40 1996/03/15 20:09:52 is Exp $
+# $OpenBSD: Makefile.amiga,v 1.13 1996/05/29 10:14:44 niklas Exp $
+# $NetBSD: Makefile.amiga,v 1.45 1996/05/16 17:07:08 is Exp $
# Makefile for OpenBSD
#
@@ -35,12 +35,16 @@ AMIGA= ../..
INCLUDES= -I. -I$S/arch -I$S
CPPFLAGS= ${INCLUDES} ${IDENT} -D_KERNEL -Dmc68020 -Damiga
+
+CDIAGFLAGS= -Werror -Wall -Wstrict-prototypes
+
.if empty(IDENT:M-DM68060)
-CFLAGS= ${DEBUG} -O2 -Werror -m68020 -msoft-float ${COPTS}
+CMACHFLAGS= -m68020 -msoft-float
.else
-CFLAGS= ${DEBUG} -O2 -Werror -m68060 -msoft-float ${COPTS}
+CMACHFLAGS= -m68060 -Wa,-m68030 -msoft-float
.endif
+CFLAGS= ${DEBUG} -O2 ${CDIAGFLAGS} ${CMACHFLAGS} ${COPTS}
AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE
LINKFLAGS= -n -Ttext 0 -e start
@@ -63,6 +67,9 @@ LIBCOMPAT= ${COMPATLIB_PROF}
### for the Motorola 68040 Floating Point Software Product
.include "$S/arch/m68k/fpsp/Makefile.inc"
+### 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
@@ -94,7 +101,7 @@ NORMAL_G= gspa < $< | gspahextoc > $*.c; ${CC} -c ${CFLAGS} ${PROF} $*.c
# ${SYSTEM_LD_HEAD}
# ${SYSTEM_LD} swapxxx.o
# ${SYSTEM_LD_TAIL}
-SYSTEM_OBJ= locore.o ${FPSP} \
+SYSTEM_OBJ= locore.o ${FPSP} ${060SP} \
param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
SYSTEM_DEP= Makefile ${SYSTEM_OBJ}
SYSTEM_LD_HEAD= @rm -f $@
diff --git a/sys/arch/amiga/conf/files.amiga b/sys/arch/amiga/conf/files.amiga
index f7b7c8c1517..6335ac7750f 100644
--- a/sys/arch/amiga/conf/files.amiga
+++ b/sys/arch/amiga/conf/files.amiga
@@ -1,5 +1,5 @@
-# $OpenBSD: files.amiga,v 1.14 1996/05/28 09:39:34 niklas Exp $
-# $NetBSD: files.amiga,v 1.45 1996/05/07 00:34:17 thorpej Exp $
+# $OpenBSD: files.amiga,v 1.15 1996/05/29 10:14:45 niklas Exp $
+# $NetBSD: files.amiga,v 1.48 1996/05/19 21:04:50 veego Exp $
# maxpartitions must be first item in files.${ARCH}
maxpartitions 16 # NOTE THAT AMIGA IS SPECIAL!
@@ -109,7 +109,13 @@ device grfrh: grfbus
attach grfrh at zbus
file arch/amiga/dev/grf_rh.c grfrh needs-flag
file arch/amiga/dev/ite_rh.c grfrh & ite
-
+
+# Tseng grf
+device grfet: grfbus
+attach grfet at zbus
+file arch/amiga/dev/grf_et.c grfet needs-flag
+file arch/amiga/dev/ite_et.c grfet & ite
+
# handle gvp's odd autoconf info..
device gvpbus {}
attach gvpbus at zbus
@@ -195,6 +201,12 @@ device wesc: scsi, siop
attach wesc at zbus
file arch/amiga/dev/wesc.c wesc needs-flag
+
+# MacroSystem DraCo internal
+device drsc: scsi, siop
+attach drsc at mainbus
+file arch/amiga/dev/drsc.c drsc needs-flag
+
# C= A4091
device afsc: scsi, siop
attach afsc at zbus
@@ -226,7 +238,7 @@ device mlhsc: scsi, sci
attach mlhsc at zbus
file arch/amiga/dev/mlhsc.c mlhsc needs-flag
-# Emplant
+# EMPLANT
device empsc: scsi, sci
attach empsc at zbus
file arch/amiga/dev/empsc.c empsc needs-flag
diff --git a/sys/arch/amiga/conf/std.amiga b/sys/arch/amiga/conf/std.amiga
index 6ef97f53568..8840cf9a9b5 100644
--- a/sys/arch/amiga/conf/std.amiga
+++ b/sys/arch/amiga/conf/std.amiga
@@ -1,5 +1,5 @@
-# $OpenBSD: std.amiga,v 1.2 1996/05/02 06:43:30 niklas Exp $
-# $NetBSD: std.amiga,v 1.7 1996/04/27 20:51:09 veego Exp $
+# $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 $
# standard amiga information
@@ -15,5 +15,3 @@ ms* at mainbus0
fdc0 at mainbus0
fd* at fdc0 unit ?
zbus0 at mainbus0
-
-#pseudo-device mouse 2
diff --git a/sys/arch/amiga/conf/std.draco b/sys/arch/amiga/conf/std.draco
new file mode 100644
index 00000000000..099f8bf8a80
--- /dev/null
+++ b/sys/arch/amiga/conf/std.draco
@@ -0,0 +1,11 @@
+# $NetBSD: std.draco,v 1.1 1996/05/09 20:31:04 is Exp $
+
+# standard amiga information
+
+machine amiga m68k
+
+mainbus0 at root
+
+clock0 at mainbus0
+kbd0 at mainbus0
+zbus0 at mainbus0
diff --git a/sys/arch/amiga/dev/clock.c b/sys/arch/amiga/dev/clock.c
index 8f307f3316a..b015a7573b4 100644
--- a/sys/arch/amiga/dev/clock.c
+++ b/sys/arch/amiga/dev/clock.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: clock.c,v 1.6 1996/05/02 06:43:37 niklas Exp $ */
-/* $NetBSD: clock.c,v 1.13 1996/04/21 21:10:57 veego Exp $ */
+/* $OpenBSD: clock.c,v 1.7 1996/05/29 10:14:49 niklas Exp $ */
+/* $NetBSD: clock.c,v 1.15 1996/05/10 14:30:53 is Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -53,6 +53,9 @@
#include <amiga/amiga/device.h>
#include <amiga/amiga/custom.h>
#include <amiga/amiga/cia.h>
+#ifdef DRACO
+#include <amiga/amiga/drcustom.h>
+#endif
#include <amiga/amiga/isr.h>
#include <amiga/dev/rtc.h>
#include <amiga/dev/zbusvar.h>
@@ -69,6 +72,7 @@ extern void hardclock();
#define CLK_INTERVAL amiga_clk_interval
int amiga_clk_interval;
int eclockfreq;
+struct CIA *clockcia;
#if defined(IPL_REMAP_1) || defined(IPL_REMAP_2)
/*
@@ -114,7 +118,11 @@ clockmatch(pdp, match, auxp)
void *match, *auxp;
{
- if (matchname("clock", auxp))
+ if (matchname("clock", auxp)
+#ifdef DRACO
+ && (is_draco() < 4)
+#endif
+ )
return(1);
return(0);
}
@@ -128,20 +136,32 @@ clockattach(pdp, dp, auxp)
void *auxp;
{
unsigned short interval;
+ char cia;
if (eclockfreq == 0)
eclockfreq = 715909; /* guess NTSC */
CLK_INTERVAL = (eclockfreq / 100);
- printf(": system hz %d hardware hz %d\n", hz, eclockfreq);
+#ifdef DRACO
+ if (is_draco()) {
+ clockcia = (struct CIA *)CIAAbase;
+ cia = 'A';
+ } else
+#endif
+ {
+ clockcia = (struct CIA *)CIABbase;
+ cia = 'B';
+ }
+
+ printf(": CIA %c system hz %d hardware hz %d\n", cia, hz, eclockfreq);
/*
* stop timer A
*/
- ciab.cra = ciab.cra & 0xc0;
- ciab.icr = 1 << 0; /* disable timer A interrupt */
- interval = ciab.icr; /* and make sure it's clear */
+ clockcia->cra = clockcia->cra & 0xc0;
+ clockcia->icr = 1 << 0; /* disable timer A interrupt */
+ interval = clockcia->icr; /* and make sure it's clear */
/*
* load interval into registers.
@@ -153,8 +173,8 @@ clockattach(pdp, dp, auxp)
/*
* order of setting is important !
*/
- ciab.talo = interval & 0xff;
- ciab.tahi = interval >> 8;
+ clockcia->talo = interval & 0xff;
+ clockcia->tahi = interval >> 8;
}
#if defined(IPL_REMAP_1) || defined(IPL_REMAP_2)
@@ -180,12 +200,12 @@ cpu_initclocks()
/*
* enable interrupts for timer A
*/
- ciab.icr = (1<<7) | (1<<0);
+ clcokcia.icr = (1<<7) | (1<<0);
/*
* start timer A in continuous shot mode
*/
- ciab.cra = (ciab.cra & 0xc0) | 1;
+ clockcia.cra = (clockcia.cra & 0xc0) | 1;
#if defined(IPL_REMAP_1) || defined(IPL_REMAP_2)
isr.isr_intr = clockintr;
@@ -196,7 +216,12 @@ cpu_initclocks()
/*
* and globally enable interrupts for ciab
*/
- custom.intena = INTF_SETCLR | INTF_EXTER;
+#ifdef DRACO
+ if (is_draco()) /* we use cia a on DraCo */
+ *draco_intena |= DRIRQ_INT2;
+ else
+#endif
+ custom.intena = INTF_SETCLR | INTF_EXTER;
#endif
}
@@ -216,11 +241,11 @@ clkread()
u_char hi, hi2, lo;
u_int interval;
- hi = ciab.tahi;
- lo = ciab.talo;
- hi2 = ciab.tahi;
+ hi = clockcia->tahi;
+ lo = clockcia->talo;
+ hi2 = clockcia->tahi;
if (hi != hi2) {
- lo = ciab.talo;
+ lo = clockcia->talo;
hi = hi2;
}
@@ -244,6 +269,10 @@ u_int micspertick;
void
setmicspertick()
{
+#ifdef DRACO
+ if (is_draco())
+ return; /* XXX */
+#endif
micspertick = (1000000ULL << 20) / 715909;
/*
@@ -279,6 +308,12 @@ delay(mic)
{
u_int temp;
+#ifdef DRACO
+ if (is_draco()) {
+ DELAY(mic);
+ return;
+ }
+#endif
if (micspertick == 0)
setmicspertick();
@@ -362,6 +397,13 @@ DELAY(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
@@ -615,7 +657,7 @@ startprofclock()
unsigned short interval;
/* stop timer B */
- ciab.crb = ciab.crb & 0xc0;
+ clockcia->crb = clockcia->crb & 0xc0;
/* load interval into registers.
the clocks run at NTSC: 715.909kHz or PAL: 709.379kHz */
@@ -623,20 +665,20 @@ startprofclock()
interval = profint - 1;
/* order of setting is important ! */
- ciab.tblo = interval & 0xff;
- ciab.tbhi = interval >> 8;
+ clockcia->tblo = interval & 0xff;
+ clockcia->tbhi = interval >> 8;
/* enable interrupts for timer B */
- ciab.icr = (1<<7) | (1<<1);
+ clockcia->icr = (1<<7) | (1<<1);
/* start timer B in continuous shot mode */
- ciab.crb = (ciab.crb & 0xc0) | 1;
+ clockcia->crb = (clockcia->crb & 0xc0) | 1;
}
stopprofclock()
{
/* stop timer B */
- ciab.crb = ciab.crb & 0xc0;
+ clockcia->crb = clockcia->crb & 0xc0;
}
#ifdef PROF
@@ -727,6 +769,14 @@ int
rtcinit()
{
clockaddr = (void *)ztwomap(0xdc0000);
+#ifdef DRACO
+ if (is_draco()) {
+ /* XXX to be done */
+ gettod = (void *)0;
+ settod = (void *)0;
+ return 0;
+ } else
+#endif
if (is_a3000() || is_a4000()) {
if (a3gettod() == 0)
return(0);
diff --git a/sys/arch/amiga/dev/drsc.c b/sys/arch/amiga/dev/drsc.c
new file mode 100644
index 00000000000..e4304a6a5b4
--- /dev/null
+++ b/sys/arch/amiga/dev/drsc.c
@@ -0,0 +1,232 @@
+/* $NetBSD: drsc.c,v 1.2 1996/05/19 19:03:01 is Exp $ */
+
+/*
+ * Copyright (c) 1996 Ignatios Souvatzis
+ * Copyright (c) 1994 Michael L. Hitch
+ * 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 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.
+ *
+ * @(#)dma.c
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/device.h>
+#include <scsi/scsi_all.h>
+#include <scsi/scsiconf.h>
+#include <amiga/amiga/custom.h>
+#include <amiga/amiga/cc.h>
+#include <amiga/amiga/device.h>
+#include <amiga/amiga/isr.h>
+#include <amiga/dev/siopreg.h>
+#include <amiga/dev/siopvar.h>
+#include <amiga/amiga/drcustom.h>
+
+int drscprint __P((void *auxp, char *));
+void drscattach __P((struct device *, struct device *, void *));
+int drscmatch __P((struct device *, void *, void *));
+int drsc_dmaintr __P((struct siop_softc *));
+#ifdef DEBUG
+void drsc_dump __P((void));
+#endif
+
+struct scsi_adapter drsc_scsiswitch = {
+ siop_scsicmd,
+ siop_minphys,
+ 0, /* no lun support */
+ 0, /* no lun support */
+};
+
+struct scsi_device drsc_scsidev = {
+ NULL, /* use default error handler */
+ NULL, /* do not have a start functio */
+ NULL, /* have no async handler */
+ NULL, /* Use default done routine */
+};
+
+
+#ifdef DEBUG
+#endif
+
+struct cfattach drsc_ca = {
+ sizeof(struct siop_softc),
+ drscmatch,
+ drscattach
+};
+
+struct cfdriver drsc_cd = {
+ NULL, "drsc", DV_DULL, NULL, 0
+};
+
+static struct siop_softc *drsc_softc;
+
+/*
+ * One of us is on every DraCo motherboard,
+ */
+int
+drscmatch(pdp, match, auxp)
+ struct device *pdp;
+ void *match, *auxp;
+{
+ struct cfdata *cdp = (struct cfdata *)match;
+ if (is_draco() && (cdp->cf_unit == 0))
+ return(1);
+ return(0);
+}
+
+void
+drscattach(pdp, dp, auxp)
+ struct device *pdp, *dp;
+ void *auxp;
+{
+ struct siop_softc *sc;
+ struct zbus_args *zap;
+ siop_regmap_p rp;
+
+ printf("\n");
+
+ zap = auxp;
+
+ sc = (struct siop_softc *)dp;
+ sc->sc_siopp = rp = (siop_regmap_p)(DRCCADDR+NBPG*DRSCSIPG);
+
+ /*
+ * CTEST7 = TT1
+ */
+ sc->sc_clock_freq = 50; /* Clock = 50MHz */
+ sc->sc_ctest7 = 0x02;
+
+ alloc_sicallback();
+
+ sc->sc_link.adapter_softc = sc;
+ sc->sc_link.adapter_target = 7;
+ sc->sc_link.adapter = &drsc_scsiswitch;
+ sc->sc_link.device = &drsc_scsidev;
+ sc->sc_link.openings = 2;
+
+ siopinitialize(sc);
+
+#if 0
+ sc->sc_isr.isr_intr = drsc_dmaintr;
+ sc->sc_isr.isr_arg = sc;
+ sc->sc_isr.isr_ipl = 4;
+ add_isr(&sc->sc_isr);
+#else
+ drsc_softc = sc;
+ *draco_intpen &= ~DRIRQ_SCSI;
+ *draco_intena |= DRIRQ_SCSI;
+#endif
+ /*
+ * attach all scsi units on us
+ */
+ config_found(dp, &sc->sc_link, drscprint);
+}
+
+/*
+ * print diag if pnp is NULL else just extra
+ */
+int
+drscprint(auxp, pnp)
+ void *auxp;
+ char *pnp;
+{
+ if (pnp == NULL)
+ return(UNCONF);
+ return(QUIET);
+}
+
+
+/*
+ * Level 4 interrupt processing for the MacroSystem DraCo mainboard
+ * SCSI. Because the level 4 interrupt is above splbio, the
+ * interrupt status is saved and an sicallback to the level 2 interrupt
+ * handler scheduled. This way, the actual processing of the interrupt
+ * can be deferred until splbio is unblocked.
+ */
+
+void
+drsc_handler()
+{
+ struct siop_softc *sc = drsc_softc;
+
+ siop_regmap_p rp;
+ int istat;
+
+ if (sc->sc_flags & SIOP_INTSOFF)
+ return; /* interrupts are not active */
+
+ rp = sc->sc_siopp;
+ istat = rp->siop_istat;
+
+ if ((istat & (SIOP_ISTAT_SIP | SIOP_ISTAT_DIP)) == 0)
+ return;
+
+ /*
+ * save interrupt status, DMA status, and SCSI status 0
+ * (may need to deal with stacked interrupts?)
+ */
+ sc->sc_sstat0 = rp->siop_sstat0;
+ sc->sc_istat = istat;
+ sc->sc_dstat = rp->siop_dstat;
+ /*
+ * disable interrupts until the callback can process this
+ * interrupt.
+ */
+#ifdef DRSC_NOCALLBACK
+ (void)spl1();
+ siopintr(sc);
+#else
+ rp->siop_sien = 0;
+ rp->siop_dien = 0;
+ sc->sc_flags |= SIOP_INTDEFER | SIOP_INTSOFF;
+ *draco_intpen &= ~DRIRQ_SCSI;
+#ifdef DEBUG
+ if (*draco_intpen & DRIRQ_SCSI)
+ printf("%s: intpen still 0x%x\n", sc->sc_dev.dv_xname,
+ *draco_intpen);
+#endif
+ add_sicallback((sifunc_t)siopintr, sc, NULL);
+#endif
+ return;
+}
+
+#ifdef DEBUG
+void
+drsc_dump()
+{
+ int i;
+
+ for (i = 0; i < drsc_cd.cd_ndevs; ++i)
+ if (drsc_cd.cd_devs[i])
+ siop_dump(drsc_cd.cd_devs[i]);
+}
+#endif
diff --git a/sys/arch/amiga/dev/empsc.c b/sys/arch/amiga/dev/empsc.c
index b035ebeef3b..7af2b5ab94f 100644
--- a/sys/arch/amiga/dev/empsc.c
+++ b/sys/arch/amiga/dev/empsc.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: empsc.c,v 1.2 1996/05/02 06:43:37 niklas Exp $ */
-/* $NetBSD: empsc.c,v 1.5 1996/04/21 21:10:59 veego Exp $ */
+/* $OpenBSD: empsc.c,v 1.3 1996/05/29 10:14:51 niklas Exp $ */
+/* $NetBSD: empsc.c,v 1.7 1996/05/10 13:02:33 is Exp $ */
/*
diff --git a/sys/arch/amiga/dev/grf.c b/sys/arch/amiga/dev/grf.c
index 473fb36d936..07a2fac3086 100644
--- a/sys/arch/amiga/dev/grf.c
+++ b/sys/arch/amiga/dev/grf.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: grf.c,v 1.4 1996/05/02 06:43:42 niklas Exp $ */
-/* $NetBSD: grf.c,v 1.26 1996/04/21 21:11:07 veego Exp $ */
+/* $OpenBSD: grf.c,v 1.5 1996/05/29 10:14:54 niklas Exp $ */
+/* $NetBSD: grf.c,v 1.27 1996/05/19 20:06:20 is Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -63,6 +63,7 @@
#include <vm/vm_page.h>
#include <vm/vm_pager.h>
#include <machine/cpu.h>
+#include <machine/fbio.h>
#include <amiga/amiga/color.h> /* DEBUG */
#include <amiga/amiga/device.h>
#include <amiga/dev/grfioctl.h>
@@ -279,6 +280,10 @@ grfioctl(dev, cmd, data, flag, p)
* information for grf_ul.
*/
return(gp->g_mode(gp, GM_GRFIOCTL, data, cmd, dev));
+
+ case FBIOSVIDEO:
+ return(gp->g_mode(gp, GM_GRFIOCTL, data, GRFIOCBLANK, dev));
+
default:
#if NVIEW > 0
/*
diff --git a/sys/arch/amiga/dev/grf_cl.c b/sys/arch/amiga/dev/grf_cl.c
index bd378751cf6..9a51bc639f5 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.4 1996/05/02 06:43:44 niklas Exp $ */
-/* $NetBSD: grf_cl.c,v 1.10 1996/04/28 06:31:47 mhitch Exp $ */
+/* $OpenBSD: grf_cl.c,v 1.5 1996/05/29 10:14:57 niklas Exp $ */
+/* $NetBSD: grf_cl.c,v 1.11 1996/05/19 21:05:20 veego Exp $ */
/*
* Copyright (c) 1995 Ezra Story
@@ -80,7 +80,7 @@
static int cl_mondefok __P((struct grfvideo_mode *));
static void cl_boardinit __P((struct grf_softc *));
-static void CompFQ __P((u_int, u_char *, u_char *));
+static void cl_CompFQ __P((u_int, u_char *, u_char *));
static int cl_getvmode __P((struct grf_softc *, struct grfvideo_mode *));
static int cl_setvmode __P((struct grf_softc *, unsigned int));
static int cl_toggle __P((struct grf_softc *, unsigned short));
@@ -143,7 +143,8 @@ unsigned char clconscolors[3][3] = { /* background, foreground, hilite */
{0, 0x40, 0x50}, {152, 152, 152}, {255, 255, 255}
};
-int cltype = 0; /* Picasso, Spectrum or Piccolo */
+int cltype = 0; /* Picasso, Spectrum or Piccolo */
+int cl_sd64 = 0;
unsigned char pass_toggle; /* passthru status tracker */
/* because all 5426-boards have 2 configdev entries, one for
@@ -187,6 +188,7 @@ grfclmatch(pdp, match, auxp)
#endif
struct zbus_args *zap;
static int regprod, fbprod;
+ int error;
zap = auxp;
@@ -200,25 +202,42 @@ grfclmatch(pdp, match, auxp)
* multiple boards at the same time. */
if (cltype == 0) {
switch (zap->manid) {
- case PICASSO:
+ case PICASSO:
if (zap->prodid != 12 && zap->prodid != 11)
return (0);
regprod = 12;
fbprod = 11;
break;
- case SPECTRUM:
+ case SPECTRUM:
if (zap->prodid != 2 && zap->prodid != 1)
return (0);
regprod = 2;
fbprod = 1;
break;
- case PICCOLO:
- if (zap->prodid != 6 && zap->prodid != 5)
- return (0);
- regprod = 6;
- fbprod = 5;
- break;
- default:
+ case PICCOLO:
+ switch (zap->prodid) {
+ case 5:
+ case 6:
+ regprod = 6;
+ fbprod = 5;
+ error = 0;
+ break;
+ case 10:
+ case 11:
+ regprod = 11;
+ fbprod = 10;
+ cl_sd64 = 1;
+ error = 0;
+ break;
+ default:
+ error = 1;
+ break;
+ }
+ if (error == 1)
+ return (0);
+ else
+ break;
+ default:
return (0);
}
cltype = zap->manid;
@@ -303,17 +322,25 @@ grfclattach(pdp, dp, auxp)
attachflag = 1;
printf("grfcl: %dMB ", cl_fbsize / 0x100000);
switch (cltype) {
- case PICASSO:
+ case PICASSO:
printf("Picasso II");
cl_maxpixelclock = 86000000;
break;
- case SPECTRUM:
+ case SPECTRUM:
printf("Spectrum");
cl_maxpixelclock = 90000000;
break;
- case PICCOLO:
- printf("Piccolo");
- cl_maxpixelclock = 90000000;
+ case PICCOLO:
+ if (cl_sd64 == 1) {
+ printf("Piccolo SD64");
+ /* 110MHz will be supported if we
+ * have a palette doubling mode.
+ */
+ cl_maxpixelclock = 90000000;
+ } else {
+ printf("Piccolo");
+ cl_maxpixelclock = 90000000;
+ }
break;
}
printf(" being used\n");
@@ -356,12 +383,17 @@ cl_boardinit(gp)
/* setup initial unchanging parameters */
WSeq(ba, SEQ_ID_CLOCKING_MODE, 0x21); /* 8 dot - display off */
- vgaw(ba, GREG_MISC_OUTPUT_W, 0xe1); /* mem disable */
+ vgaw(ba, GREG_MISC_OUTPUT_W, 0xed); /* mem disable */
WGfx(ba, GCT_ID_OFFSET_1, 0xec); /* magic cookie */
WSeq(ba, SEQ_ID_UNLOCK_EXT, 0x12); /* yum! cookies! */
- WSeq(ba, SEQ_ID_DRAM_CNTL, 0xb0);
+ if (cl_sd64 == 1) {
+ WSeq(ba, SEQ_ID_CONF_RBACK, 0x00);
+ WSeq(ba, SEQ_ID_DRAM_CNTL, (cl_fbsize / 0x100000 == 2) ? 0x38 : 0xb8);
+ } else {
+ WSeq(ba, SEQ_ID_DRAM_CNTL, 0xb0);
+ }
WSeq(ba, SEQ_ID_RESET, 0x03);
WSeq(ba, SEQ_ID_MAP_MASK, 0xff);
WSeq(ba, SEQ_ID_CHAR_MAP_SELECT, 0x00);
@@ -386,6 +418,10 @@ cl_boardinit(gp)
WCrt(ba, CRT_ID_MODE_CONTROL, 0xa3); /* c3 */
WCrt(ba, CRT_ID_LINE_COMPARE, 0xff); /* ff */
WCrt(ba, CRT_ID_EXT_DISP_CNTL, 0x22);
+ if (cl_sd64 == 1) {
+ WCrt(ba, CRT_ID_SYNC_ADJ_GENLOCK, 0x00);
+ WCrt(ba, CRT_ID_OVERLAY_EXT_CTRL_REG, 0x40);
+ }
WSeq(ba, SEQ_ID_CURSOR_STORE, 0x3c); /* mouse 0x00 */
WGfx(ba, GCT_ID_SET_RESET, 0x00);
@@ -412,7 +448,7 @@ cl_boardinit(gp)
vgaw(ba, VDAC_MASK, 0xff);
delay(200000);
- vgaw(ba, GREG_MISC_OUTPUT_W, 0xe3); /* c3 */
+ vgaw(ba, GREG_MISC_OUTPUT_W, 0xef);
WGfx(ba, GCT_ID_BLT_STAT_START, 0x40);
WGfx(ba, GCT_ID_BLT_STAT_START, 0x00);
@@ -526,12 +562,12 @@ cl_mode(gp, cmd, arg, a2, a3)
int error;
switch (cmd) {
- case GM_GRFON:
+ case GM_GRFON:
error = cl_load_mon(gp,
(struct grfcltext_mode *) monitor_current) ? 0 : EINVAL;
return (error);
- case GM_GRFOFF:
+ case GM_GRFOFF:
#ifndef CL5426CONSOLE
cl_off(gp);
#else
@@ -539,27 +575,27 @@ cl_mode(gp, cmd, arg, a2, a3)
#endif
return (0);
- case GM_GRFCONFIG:
+ case GM_GRFCONFIG:
return (0);
- case GM_GRFGETVMODE:
+ case GM_GRFGETVMODE:
return (cl_getvmode(gp, (struct grfvideo_mode *) arg));
- case GM_GRFSETVMODE:
+ case GM_GRFSETVMODE:
error = cl_setvmode(gp, *(unsigned *) arg);
if (!error && (gp->g_flags & GF_GRFON))
cl_load_mon(gp,
(struct grfcltext_mode *) monitor_current);
return (error);
- case GM_GRFGETNUMVM:
+ case GM_GRFGETNUMVM:
*(int *) arg = monitor_def_max;
return (0);
- case GM_GRFIOCTL:
+ case GM_GRFIOCTL:
return (cl_ioctl(gp, a2, arg));
- default:
+ default:
break;
}
@@ -573,37 +609,37 @@ cl_ioctl(gp, cmd, data)
void *data;
{
switch (cmd) {
- case GRFIOCGSPRITEPOS:
+ case GRFIOCGSPRITEPOS:
return (cl_getmousepos(gp, (struct grf_position *) data));
- case GRFIOCSSPRITEPOS:
+ case GRFIOCSSPRITEPOS:
return (cl_setmousepos(gp, (struct grf_position *) data));
- case GRFIOCSSPRITEINF:
+ case GRFIOCSSPRITEINF:
return (cl_setspriteinfo(gp, (struct grf_spriteinfo *) data));
- case GRFIOCGSPRITEINF:
+ case GRFIOCGSPRITEINF:
return (cl_getspriteinfo(gp, (struct grf_spriteinfo *) data));
- case GRFIOCGSPRITEMAX:
+ case GRFIOCGSPRITEMAX:
return (cl_getspritemax(gp, (struct grf_position *) data));
- case GRFIOCGETCMAP:
+ case GRFIOCGETCMAP:
return (cl_getcmap(gp, (struct grf_colormap *) data));
- case GRFIOCPUTCMAP:
+ case GRFIOCPUTCMAP:
return (cl_putcmap(gp, (struct grf_colormap *) data));
- case GRFIOCBITBLT:
+ case GRFIOCBITBLT:
break;
- case GRFTOGGLE:
+ case GRFTOGGLE:
return (cl_toggle(gp, 0));
- case GRFIOCSETMON:
+ case GRFIOCSETMON:
return (cl_setmonitor(gp, (struct grfvideo_mode *) data));
- case GRFIOCBLANK:
+ case GRFIOCBLANK:
return (cl_blank(gp, (int *)data));
}
@@ -950,18 +986,18 @@ cl_getcmap(gfp, cmap)
*/
switch (cltype) {
- case SPECTRUM:
- case PICCOLO:
+ case SPECTRUM:
+ case PICCOLO:
rp = blue + cmap->index;
gp = green + cmap->index;
bp = red + cmap->index;
break;
- case PICASSO:
+ case PICASSO:
rp = red + cmap->index;
gp = green + cmap->index;
bp = blue + cmap->index;
break;
- default:
+ default:
rp = gp = bp = 0;
break;
}
@@ -1005,18 +1041,18 @@ cl_putcmap(gfp, cmap)
x = cmap->count - 1;
switch (cltype) {
- case SPECTRUM:
- case PICCOLO:
+ case SPECTRUM:
+ case PICCOLO:
rp = blue + cmap->index;
gp = green + cmap->index;
bp = red + cmap->index;
break;
- case PICASSO:
+ case PICASSO:
rp = red + cmap->index;
gp = green + cmap->index;
bp = blue + cmap->index;
break;
- default:
+ default:
rp = gp = bp = 0;
break;
}
@@ -1053,7 +1089,7 @@ cl_toggle(gp, wopp)
}
static void
-CompFQ(fq, num, denom)
+cl_CompFQ(fq, num, denom)
u_int fq;
u_char *num;
u_char *denom;
@@ -1126,18 +1162,18 @@ cl_mondefok(gv)
return(0);
switch (gv->depth) {
- case 4:
+ case 4:
if (gv->mode_num != 255)
return(0);
- case 1:
- case 8:
+ case 1:
+ case 8:
maxpix = cl_maxpixelclock;
break;
- case 15:
- case 16:
+ case 15:
+ case 16:
maxpix = cl_maxpixelclock - (cl_maxpixelclock / 3);
break;
- case 24:
+ case 24:
maxpix = cl_maxpixelclock / 3;
break;
default:
@@ -1163,6 +1199,7 @@ cl_load_mon(gp, md)
char LACE, DBLSCAN, TEXT;
unsigned short clkdiv;
int uplim, lowlim;
+ int sr15;
/* identity */
gv = &md->gv;
@@ -1230,17 +1267,26 @@ cl_load_mon(gp, md)
VDE /= 2;
WSeq(ba, SEQ_ID_MEMORY_MODE, (TEXT || (gv->depth == 1)) ? 0x06 : 0x0e);
- WSeq(ba, SEQ_ID_DRAM_CNTL, (TEXT || (gv->depth == 1)) ? 0x90 : 0xb0);
+ if (cl_sd64 == 1) {
+ if (TEXT || (gv->depth == 1))
+ sr15 = 0x90;
+ else
+ sr15 = ((cl_fbsize / 0x100000 == 2) ? 0x38 : 0xb8);
+ WSeq(ba, SEQ_ID_CONF_RBACK, 0x00);
+ } else {
+ sr15 = (TEXT || (gv->depth == 1)) ? 0x90 : 0xb0;
+ }
+ WSeq(ba, SEQ_ID_DRAM_CNTL, sr15);
WGfx(ba, GCT_ID_READ_MAP_SELECT, 0x00);
WSeq(ba, SEQ_ID_MAP_MASK, (gv->depth == 1) ? 0x01 : 0xff);
WSeq(ba, SEQ_ID_CHAR_MAP_SELECT, 0x00);
/* Set clock */
- CompFQ((gv->depth == 24) ? gv->pixel_clock * 3 : gv->pixel_clock,
+ cl_CompFQ((gv->depth == 24) ? gv->pixel_clock * 3 : gv->pixel_clock,
&num0, &denom0);
- WSeq(ba, SEQ_ID_VCLK_0_NUM, num0);
- WSeq(ba, SEQ_ID_VCLK_0_DENOM, denom0);
+ WSeq(ba, SEQ_ID_VCLK_3_NUM, num0);
+ WSeq(ba, SEQ_ID_VCLK_3_DENOM, denom0);
/* load display parameters into board */
@@ -1308,19 +1354,19 @@ cl_load_mon(gp, md)
/* depth dependent stuff */
switch (gv->depth) {
- case 1:
- case 4:
- case 8:
+ case 1:
+ case 4:
+ case 8:
clkdiv = 0;
break;
- case 15:
- case 16:
+ case 15:
+ case 16:
clkdiv = 3;
break;
- case 24:
+ case 24:
clkdiv = 2;
break;
- default:
+ default:
clkdiv = 0;
panic("grfcl: Unsuported depth: %i", gv->depth);
break;
@@ -1354,24 +1400,24 @@ cl_load_mon(gp, md)
vgar(ba, VDAC_MASK);
delay(200000);
switch (gv->depth) {
- case 1:
- case 4: /* text */
+ case 1:
+ case 4: /* text */
vgaw(ba, VDAC_MASK, 0);
HDE = gv->disp_width / 16;
break;
- case 8:
+ case 8:
vgaw(ba, VDAC_MASK, 0);
HDE = gv->disp_width / 8;
break;
- case 15:
+ case 15:
vgaw(ba, VDAC_MASK, 0xd0);
HDE = gv->disp_width / 4;
break;
- case 16:
+ case 16:
vgaw(ba, VDAC_MASK, 0xc1);
HDE = gv->disp_width / 4;
break;
- case 24:
+ case 24:
vgaw(ba, VDAC_MASK, 0xc5);
HDE = (gv->disp_width / 8) * 3;
break;
@@ -1386,6 +1432,10 @@ cl_load_mon(gp, md)
delay(20000);
WCrt(ba, CRT_ID_OFFSET, HDE);
+ if (cl_sd64 == 1) {
+ WCrt(ba, CRT_ID_SYNC_ADJ_GENLOCK, 0x00);
+ WCrt(ba, CRT_ID_OVERLAY_EXT_CTRL_REG, 0x40);
+ }
WCrt(ba, CRT_ID_EXT_DISP_CNTL,
((TEXT && gv->pixel_clock > 29000000) ? 0x40 : 0x00) |
0x22 |
diff --git a/sys/arch/amiga/dev/grf_clreg.h b/sys/arch/amiga/dev/grf_clreg.h
index a55a0c74fa6..c024cf1503f 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.3 1996/05/02 06:43:45 niklas Exp $ */
-/* $NetBSD: grf_clreg.h,v 1.3 1996/04/21 21:11:13 veego Exp $ */
+/* $OpenBSD: grf_clreg.h,v 1.4 1996/05/29 10:14:59 niklas Exp $ */
+/* $NetBSD: grf_clreg.h,v 1.4 1996/05/19 21:05:23 veego Exp $ */
/*
* Copyright (c) 1995 Ezra Story
@@ -166,6 +166,7 @@ struct grfcltext_mode {
#define GCT_ID_BLT_MODE 0x30
#define GCT_ID_BLT_STAT_START 0x31
#define GCT_ID_BLT_ROP 0x32
+#define GCT_ID_RESERVED 0x33
#define GCT_ID_TRP_COL_LOW 0x34 /* transparent color */
#define GCT_ID_TRP_COL_HIGH 0x35
#define GCT_ID_TRP_MASK_LOW 0x38
@@ -246,6 +247,8 @@ struct grfcltext_mode {
#define CRT_ID_LACE_END 0x19
#define CRT_ID_LACE_CNTL 0x1A
#define CRT_ID_EXT_DISP_CNTL 0x1B
+#define CRT_ID_SYNC_ADJ_GENLOCK 0x1C
+#define CRT_ID_OVERLAY_EXT_CTRL_REG 0x1D
#define CRT_ID_GD_LATCH_RBACK 0x22
@@ -297,58 +300,72 @@ struct grfcltext_mode {
* inline functions.
*/
static inline void RegWakeup(volatile void *ba) {
- extern int cltype;
-
- switch (cltype) {
- case SPECTRUM:
- vgaw(ba, PASS_ADDRESS_W, 0x1f);
- break;
- case PICASSO:
- vgaw(ba, PASS_ADDRESS_W, 0xff);
- break;
- case PICCOLO:
- vgaw(ba, PASS_ADDRESS_W, vgar(ba, PASS_ADDRESS) | 0x10);
- break;
- }
- delay(200000);
+ extern int cltype;
+ extern int cl_sd64;
+
+ switch (cltype) {
+ case SPECTRUM:
+ vgaw(ba, PASS_ADDRESS_W, 0x1f);
+ break;
+ case PICASSO:
+ vgaw(ba, PASS_ADDRESS_W, 0xff);
+ break;
+ case PICCOLO:
+ if (cl_sd64 == 1)
+ vgaw(ba, PASS_ADDRESS_W, 0x1f);
+ else
+ vgaw(ba, PASS_ADDRESS_W, vgar(ba, PASS_ADDRESS) | 0x10);
+ break;
+ }
+ delay(200000);
}
+
static inline void RegOnpass(volatile void *ba) {
- extern int cltype;
- extern unsigned char pass_toggle;
-
- switch (cltype) {
- case SPECTRUM:
- vgaw(ba, PASS_ADDRESS_W, 0x4f);
- break;
- case PICASSO:
- vgaw(ba, PASS_ADDRESS_WP, 0x01);
- break;
- case PICCOLO:
- vgaw(ba, PASS_ADDRESS_W, vgar(ba, PASS_ADDRESS) & 0xdf);
- break;
- }
- pass_toggle = 1;
- delay(200000);
+ extern int cltype;
+ extern int cl_sd64;
+ extern unsigned char pass_toggle;
+
+ switch (cltype) {
+ case SPECTRUM:
+ vgaw(ba, PASS_ADDRESS_W, 0x4f);
+ break;
+ case PICASSO:
+ vgaw(ba, PASS_ADDRESS_WP, 0x01);
+ break;
+ case PICCOLO:
+ if (cl_sd64 == 1)
+ vgaw(ba, PASS_ADDRESS_W, 0x4f);
+ else
+ vgaw(ba, PASS_ADDRESS_W, vgar(ba, PASS_ADDRESS) & 0xdf);
+ break;
+ }
+ pass_toggle = 1;
+ delay(200000);
}
+
static inline void RegOffpass(volatile void *ba) {
- extern int cltype;
- extern unsigned char pass_toggle;
-
- switch (cltype) {
- case SPECTRUM:
- vgaw(ba, PASS_ADDRESS_W, 0x6f);
- break;
- case PICASSO:
- vgaw(ba, PASS_ADDRESS_W, 0xff);
- delay(200000);
- vgaw(ba, PASS_ADDRESS_W, 0xff);
- break;
- case PICCOLO:
- vgaw(ba, PASS_ADDRESS_W, vgar(ba, PASS_ADDRESS) | 0x20);
- break;
- }
- pass_toggle = 0;
- delay(200000);
+ extern int cltype;
+ extern int cl_sd64;
+ extern unsigned char pass_toggle;
+
+ switch (cltype) {
+ case SPECTRUM:
+ vgaw(ba, PASS_ADDRESS_W, 0x6f);
+ break;
+ case PICASSO:
+ vgaw(ba, PASS_ADDRESS_W, 0xff);
+ delay(200000);
+ vgaw(ba, PASS_ADDRESS_W, 0xff);
+ break;
+ case PICCOLO:
+ if (cl_sd64 == 1)
+ vgaw(ba, PASS_ADDRESS_W, 0x6f);
+ else
+ vgaw(ba, PASS_ADDRESS_W, vgar(ba, PASS_ADDRESS) | 0x20);
+ break;
+ }
+ pass_toggle = 0;
+ delay(200000);
}
static inline unsigned char RAttr(volatile void * ba, short idx) {
diff --git a/sys/arch/amiga/dev/grf_cv.c b/sys/arch/amiga/dev/grf_cv.c
index 2c768263984..207614f485b 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.9 1996/05/04 13:54:22 niklas Exp $ */
-/* $NetBSD: grf_cv.c,v 1.13 1996/05/01 09:59:24 veego Exp $ */
+/* $OpenBSD: grf_cv.c,v 1.10 1996/05/29 10:15:01 niklas Exp $ */
+/* $NetBSD: grf_cv.c,v 1.14 1996/05/19 21:05:27 veego Exp $ */
/*
* Copyright (c) 1995 Michael Teske
@@ -50,7 +50,7 @@
* The HWC routines provided here are buggy in 16/24 bit
* and may cause a Vertical Bar Crash of the Trio64.
* On the other hand it's better to put the routines in the Xserver,
- * so please don't put CV_HARDWARE_CURSOR in your config file.
+ * so please _don't_ put CV_HARDWARE_CURSOR in your config file.
*/
#include <sys/param.h>
@@ -73,7 +73,7 @@ void grfcvattach __P((struct device *, struct device *, void *));
int grfcvprint __P((void *, char *));
static int cv_has_4mb __P((volatile caddr_t));
-static unsigned short compute_clock __P((unsigned long));
+static unsigned short cv_compute_clock __P((unsigned long));
void cv_boardinit __P((struct grf_softc *));
int cv_getvmode __P((struct grf_softc *, struct grfvideo_mode *));
int cv_setvmode __P((struct grf_softc *, unsigned int));
@@ -95,7 +95,7 @@ static inline void gfx_on_off __P((int, volatile caddr_t));
int cv_getspritepos __P((struct grf_softc *, struct grf_position *));
int cv_setspritepos __P((struct grf_softc *, struct grf_position *));
int cv_getspriteinfo __P((struct grf_softc *,struct grf_spriteinfo *));
-void cv_setup_hwc __P((struct grf_softc *,
+void cv_setup_hwc __P((struct grf_softc *,
unsigned char, unsigned char, unsigned char, unsigned char,
const unsigned long *));
int cv_setspriteinfo __P((struct grf_softc *,struct grf_spriteinfo *));
@@ -169,7 +169,7 @@ unsigned char cvconscolors[16][3] = { /* background, foreground, hilite */
{0x00, 0x00, 0xff},
{0xff, 0xff, 0x00},
{0x00, 0xff, 0xff},
- {0xff, 0x00, 0xff}
+ {0x00, 0x00, 0xff}
};
static unsigned char clocks[]={
@@ -431,7 +431,7 @@ grfcvprint(auxp, pnp)
*/
static unsigned short
-compute_clock(freq)
+cv_compute_clock(freq)
unsigned long freq;
{
static unsigned char *mnr, *save; /* M, N + R vals */
@@ -549,7 +549,7 @@ cv_boardinit(gp)
WSeq(ba, SEQ_ID_CLKSYN_CNTL_2, test);
/* Memory CLK */
- clockpar = compute_clock(cv_memclk);
+ clockpar = cv_compute_clock(cv_memclk);
test = (clockpar & 0xFF00) >> 8;
WSeq(ba, SEQ_ID_MCLK_HI, test); /* PLL N-Divider Value */
@@ -938,6 +938,17 @@ cv_setmonitor(gp, gv)
#endif
md = monitor_def + (gv->mode_num - 1);
+
+ /*
+ * Prevent user from crashing the system by using
+ * grfconfig while in X
+ */
+ if (gp->g_flags & GF_GRFON)
+ if (md == monitor_current) {
+ printf("grf_cv: Changing the used mode not allowed!\n");
+ return (EINVAL);
+ }
+
bcopy(gv, md, sizeof(struct grfvideo_mode));
/* adjust pixel oriented values to internal rep. */
@@ -1049,15 +1060,16 @@ cv_mondefok(gv)
struct grfvideo_mode *gv;
{
unsigned long maxpix;
- int widthok = 0;
if (gv->mode_num < 1 || gv->mode_num > monitor_def_max) {
- if (gv->mode_num != 255 || (gv->depth != 4 && gv->depth != 8))
+ if (gv->mode_num != 255 || gv->depth != 4)
return (0);
}
switch(gv->depth) {
case 4:
+ maxpix = MAXPIXELCLOCK - 55000000;
+ break;
case 8:
maxpix = MAXPIXELCLOCK;
break;
@@ -1078,49 +1090,27 @@ cv_mondefok(gv)
#endif
break;
default:
+ printf("grf_cv: Illegal depth in mode %d\n",
+ (int) gv->mode_num);
return (0);
}
- if (gv->pixel_clock > maxpix)
+ if (gv->pixel_clock > maxpix) {
+ printf("grf_cv: Pixelclock too high in mode %d\n",
+ (int) gv->mode_num);
return (0);
-
- /*
- * These are the supported witdh values for the
- * graphics engine. To Support other widths, one
- * has to use one of these widths for memory alignment, i.e.
- * one has to set CRT_ID_SCREEN_OFFSET to one of these values and
- * CRT_ID_HOR_DISP_ENA_END to the desired width.
- * Since a working graphics engine is essential
- * for the console, console modes of other width are not supported.
- * We could do that, though, but then you have to tell the Xserver
- * about this strange configuration and I don't know how at the moment :-)
- */
-
- switch (gv->disp_width) {
- case 1024:
- case 640:
- case 800:
- case 1280:
- case 1152:
- case 1600:
- widthok = 1;
- break;
- default: /* XXX*/
- widthok = 0;
- break;
}
- if (widthok) return (1);
- else {
- if (gv->mode_num == 255) { /* console mode */
- return (1);
- } else {
- printf ("Warning for mode %d:\n", (int) gv->mode_num);
- printf ("Don't use a blitter-suporting Xserver with this display width\n");
- printf ("Use one of 640 800 1024 1152 1280 1600!\n");
- return (1);
+ if (gv->mode_num == 255) { /* console mode */
+ if ((gv->disp_width / 8) > MAXCOLS) {
+ printf ("grfcv: Too many columns for console\n");
+ return (0);
+ } else if ((gv->disp_height / S3FONTY) > MAXROWS) {
+ printf ("grfcv: Too many rows for console\n");
+ return (0);
}
}
+
return (1);
}
@@ -1138,7 +1128,7 @@ cv_load_mon(gp, md)
VSE, VT;
char LACE, DBLSCAN, TEXT, CONSOLE;
int uplim, lowlim;
- int cr50, cr33, sr15, sr18, clock_mode, test;
+ int cr50, sr15, sr18, clock_mode, test;
int m, n; /* For calc'ing display FIFO */
int tfillm, temptym; /* FIFO fill and empty mclk's */
int hmul; /* Multiplier for hor. Values */
@@ -1149,7 +1139,7 @@ cv_load_mon(gp, md)
CONSOLE = (gv->mode_num == 255);
if (!cv_mondefok(gv)) {
- printf("grfcv: The monitor definition is not okay.\n");
+ printf("grfcv: The monitor definition is illegal.\n");
printf("grfcv: See the manpage of grfconfig for more informations\n");
return (0);
}
@@ -1222,8 +1212,9 @@ cv_load_mon(gp, md)
if (LACE)
VDE /= 2;
- /* GFx hardware cursor off */
+ /* GFX hardware cursor off */
WCrt(ba, CRT_ID_HWGC_MODE, 0x00);
+ WCrt(ba, CRT_ID_EXT_DAC_CNTL, 0x00);
WSeq(ba, SEQ_ID_MEMORY_MODE, (TEXT || (gv->depth == 1)) ? 0x06 : 0x0e);
WGfx(ba, GCT_ID_READ_MAP_SELECT, 0x00);
@@ -1232,7 +1223,7 @@ cv_load_mon(gp, md)
/* Set clock */
- mnr = compute_clock(gv->pixel_clock);
+ mnr = cv_compute_clock(gv->pixel_clock);
WSeq(ba, SEQ_ID_DCLK_HI, ((mnr & 0xFF00) >> 8));
WSeq(ba, SEQ_ID_DCLK_LO, (mnr & 0xFF));
@@ -1321,12 +1312,14 @@ cv_load_mon(gp, md)
vgaw(ba, VDAC_MASK, 0xff);
+ /* Blank border */
+ test = RCrt(ba, CRT_ID_BACKWAD_COMP_2);
+ WCrt(ba, CRT_ID_BACKWAD_COMP_2, (test | 0x20));
+
sr15 = RSeq(ba, SEQ_ID_CLKSYN_CNTL_2);
sr15 &= 0xef;
sr18 = RSeq(ba, SEQ_ID_RAMDAC_CNTL);
sr18 &= 0x7f;
- cr33 = RCrt(ba, CRT_ID_BACKWAD_COMP_2);
- cr33 &= 0xdf;
clock_mode = 0x00;
cr50 = 0x00;
@@ -1347,7 +1340,6 @@ cv_load_mon(gp, md)
clock_mode = 0x10 | 0x02;
sr15 |= 0x10;
sr18 |= 0x80;
- cr33 |= 0x20;
}
HDE = gv->disp_width / 8;
cr50 |= 0x00;
@@ -1376,7 +1368,6 @@ cv_load_mon(gp, md)
WCrt(ba, CRT_ID_EXT_MISC_CNTL_2, clock_mode | test);
WSeq(ba, SEQ_ID_CLKSYN_CNTL_2, sr15);
WSeq(ba, SEQ_ID_RAMDAC_CNTL, sr18);
- WCrt(ba, CRT_ID_BACKWAD_COMP_2, cr33);
WCrt(ba, CRT_ID_SCREEN_OFFSET, HDE);
WCrt(ba, CRT_ID_MISC_1, (TEXT ? 0x05 : 0x35));
@@ -1407,7 +1398,7 @@ cv_load_mon(gp, md)
case 1600:
cr50 |= 0x81;
break;
- default: /* XXX*/
+ default: /* XXX The Xserver has to handle this */
break;
}
@@ -1435,15 +1426,18 @@ cv_load_mon(gp, md)
tfillm = (96 * (cv_memclk/1000))/240000;
switch(gv->depth) {
- case 32:
- case 24:
+ case 32:
+ case 24:
temptym = (24 * (cv_memclk/1000)) / (gv->pixel_clock/1000);
break;
- case 15:
- case 16:
+ case 15:
+ case 16:
temptym = (48 * (cv_memclk/1000)) / (gv->pixel_clock/1000);
break;
- default:
+ case 4:
+ temptym = (192 * (cv_memclk/1000)) / (gv->pixel_clock/1000);
+ break;
+ default:
temptym = (96 * (cv_memclk/1000)) / (gv->pixel_clock/1000);
break;
}
@@ -1664,10 +1658,13 @@ cv_setspritepos (gp, pos)
return(0);
}
-#define M2I(val) \
+static inline short
+M2I(short val) {
asm volatile (" rorw #8,%0 ; \
swap %0 ; \
rorw #8,%0 ; " : "=d" (val) : "0" (val));
+ return (val);
+}
#define M2INS(val) \
asm volatile (" rorw #8,%0 ; \
@@ -1738,7 +1735,7 @@ cv_setup_hwc (gp, col1, col2, hsx, hsy, data)
unsigned char hsy;
const unsigned long *data;
{
- volatile unsigned char *ba = gp->g_regkva;
+ volatile caddr_t ba = gp->g_regkva;
unsigned long *c = (unsigned long *)(gp->g_fbkva + HWC_OFF);
const unsigned long *s = data;
int test;
@@ -1794,6 +1791,7 @@ cv_setspriteinfo (gp, info)
struct grf_spriteinfo *info;
{
volatile caddr_t ba, fb;
+ int depth = gp->g_display.gd_planes;
ba = gp->g_regkva;
fb = gp->g_fbkva;
@@ -1812,7 +1810,24 @@ cv_setspriteinfo (gp, info)
/* Cursor off */
WCrt (ba, CRT_ID_HWGC_MODE, 0x00);
- /* move cursor off-screen */
+
+ /*
+ * The Trio64 crashes if the cursor data is written
+ * while the cursor is displayed.
+ * Sadly, turning the cursor off is not enough.
+ * What we have to do is:
+ * 1. Wait for vertical retrace, to make sure no-one
+ * has moved the cursor in this sync period (because
+ * another write then would have no effect, argh!).
+ * 2. Move the cursor off-screen
+ * 3. Another wait for v. retrace to make sure the cursor
+ * is really off.
+ * 4. Write the data, finally.
+ * (thanks to Harald Koenig for this tip!)
+ */
+
+ VerticalRetraceWait(ba);
+
WCrt (ba, CRT_ID_HWGC_ORIGIN_X_HI, 0x7);
WCrt (ba, CRT_ID_HWGC_ORIGIN_X_LO, 0xff);
WCrt (ba, CRT_ID_HWGC_ORIGIN_Y_LO, 0xff);
@@ -1835,6 +1850,10 @@ cv_setspriteinfo (gp, info)
hwp = (u_short *)(fb +HWC_OFF);
+ /* This is necessary in order not to crash the board */
+
+ VerticalRetraceWait(ba);
+
/*
* setting it is slightly more difficult, because we can't
* force the application to not pass a *smaller* than
@@ -1868,14 +1887,40 @@ cv_setspriteinfo (gp, info)
else
im3 = m3 = im4 = m4 = 0;
- *hwp++ = m1;
- *hwp++ = im1;
- *hwp++ = m2;
- *hwp++ = im2;
- *hwp++ = m3;
- *hwp++ = im3;
- *hwp++ = m4;
- *hwp++ = im4;
+ switch (depth) {
+ case 8:
+ *hwp++ = m1;
+ *hwp++ = im1;
+ *hwp++ = m2;
+ *hwp++ = im2;
+ *hwp++ = m3;
+ *hwp++ = im3;
+ *hwp++ = m4;
+ *hwp++ = im4;
+ break;
+ case 15:
+ case 16:
+ *hwp++ = M2I(m1);
+ *hwp++ = M2I(im1);
+ *hwp++ = M2I(m2);
+ *hwp++ = M2I(im2);
+ *hwp++ = M2I(m3);
+ *hwp++ = M2I(im3);
+ *hwp++ = M2I(m4);
+ *hwp++ = M2I(im4);
+ break;
+ case 24:
+ case 32:
+ *hwp++ = M2I(im1);
+ *hwp++ = M2I(m1);
+ *hwp++ = M2I(im2);
+ *hwp++ = M2I(m2);
+ *hwp++ = M2I(im3);
+ *hwp++ = M2I(m3);
+ *hwp++ = M2I(im4);
+ *hwp++ = M2I(m4);
+ break;
+ }
}
for (; row < 64; row++) {
*hwp++ = 0x0000;
@@ -1893,21 +1938,24 @@ cv_setspriteinfo (gp, info)
cv_hoty = info->hot.y;
/* One must not write twice per vertical blank :-( */
- VerticalRetraceWait(ba);
+ /* VerticalRetraceWait(ba); */
cv_setspritepos (gp, &info->pos);
}
if (info->set & GRFSPRSET_CMAP) {
int test;
- int depth = gp->g_display.gd_planes;
+
+ VerticalRetraceWait(ba);
/* reset colour stack */
test = RCrt(ba, CRT_ID_HWGC_MODE);
asm volatile("nop");
switch (depth) {
- case 24: case 32:
+ case 32:
+ case 24:
WCrt (ba, CRT_ID_HWGC_FG_STACK, 0);
- case 8: case 16:
+ case 16:
+ case 8:
/* info->cmap.green[1] */
WCrt (ba, CRT_ID_HWGC_FG_STACK, 0);
WCrt (ba, CRT_ID_HWGC_FG_STACK, 0);
diff --git a/sys/arch/amiga/dev/grf_cvreg.h b/sys/arch/amiga/dev/grf_cvreg.h
index 64078af7270..96ba25955b2 100644
--- a/sys/arch/amiga/dev/grf_cvreg.h
+++ b/sys/arch/amiga/dev/grf_cvreg.h
@@ -1,5 +1,5 @@
-/* $OpenBSD: grf_cvreg.h,v 1.5 1996/03/30 22:18:17 niklas Exp $ */
-/* $NetBSD: grf_cvreg.h,v 1.4 1996/03/02 14:02:58 veego Exp $ */
+/* $OpenBSD: grf_cvreg.h,v 1.6 1996/05/29 10:15:04 niklas Exp $ */
+/* $NetBSD: grf_cvreg.h,v 1.5 1996/05/19 21:05:30 veego Exp $ */
/*
* Copyright (c) 1995 Michael Teske
@@ -56,6 +56,9 @@ struct grfcvtext_mode {
unsigned short fdend;
};
+/* maximum console size */
+#define MAXROWS 200
+#define MAXCOLS 200
/* read VGA register */
#define vgar(ba, reg) (*(((volatile caddr_t)ba)+reg))
diff --git a/sys/arch/amiga/dev/grf_et.c b/sys/arch/amiga/dev/grf_et.c
new file mode 100644
index 00000000000..411a974b915
--- /dev/null
+++ b/sys/arch/amiga/dev/grf_et.c
@@ -0,0 +1,1545 @@
+/* $NetBSD: grf_et.c,v 1.1 1996/05/19 21:05:32 veego Exp $ */
+
+/*
+ * Copyright (c) 1996 Tobias Abt
+ * Copyright (c) 1995 Ezra Story
+ * Copyright (c) 1995 Kari Mettinen
+ * Copyright (c) 1994 Markus Wild
+ * Copyright (c) 1994 Lutz Vieweg
+ * 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 Lutz Vieweg.
+ * 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 "grfet.h"
+#if NGRFET > 0
+
+/*
+ * Graphics routines for Tseng ET4000 (&W32) boards,
+ *
+ * This code offers low-level routines to access Tseng ET4000
+ * graphics-boards from within NetBSD for the Amiga.
+ * No warranties for any kind of function at all - this
+ * code may crash your hardware and scratch your harddisk. Use at your
+ * own risk. Freely distributable.
+ *
+ * Modified for Tseng ET4000 from
+ * Kari Mettinen's Cirrus driver by Tobias Abt
+ *
+ *
+ * TODO:
+ *
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/errno.h>
+#include <sys/ioctl.h>
+#include <sys/device.h>
+#include <sys/malloc.h>
+
+#include <machine/cpu.h>
+#include <dev/cons.h>
+#ifdef TSENGCONSOLE
+#include <amiga/dev/itevar.h>
+#endif
+#include <amiga/amiga/device.h>
+#include <amiga/dev/grfioctl.h>
+#include <amiga/dev/grfvar.h>
+#include <amiga/dev/grf_etreg.h>
+#include <amiga/dev/zbusvar.h>
+
+int et_mondefok __P((struct grfvideo_mode * gv));
+void et_boardinit __P((struct grf_softc * gp));
+static void et_CompFQ __P((u_int fq, u_char * num, u_char * denom));
+int et_getvmode __P((struct grf_softc * gp, struct grfvideo_mode * vm));
+int et_setvmode __P((struct grf_softc * gp, unsigned int mode));
+int et_toggle __P((struct grf_softc * gp, unsigned short));
+int et_getcmap __P((struct grf_softc * gfp, struct grf_colormap * cmap));
+int et_putcmap __P((struct grf_softc * gfp, struct grf_colormap * cmap));
+#ifndef TSENGCONSOLE
+void et_off __P((struct grf_softc * gp));
+#endif
+void et_inittextmode __P((struct grf_softc * gp));
+int et_ioctl __P((register struct grf_softc * gp, u_long cmd, void *data));
+int et_getmousepos __P((struct grf_softc * gp, struct grf_position * data));
+void et_writesprpos __P((volatile char *ba, short x, short y));
+#ifdef notyet
+void et_writeshifted __P((unsigned char *to, char shiftx, char shifty));
+#endif
+int et_setmousepos __P((struct grf_softc * gp, struct grf_position * data));
+static int et_setspriteinfo __P((struct grf_softc * gp, struct grf_spriteinfo * data));
+int et_getspriteinfo __P((struct grf_softc * gp, struct grf_spriteinfo * data));
+static int et_getspritemax __P((struct grf_softc * gp, struct grf_position * data));
+int et_setmonitor __P((struct grf_softc * gp, struct grfvideo_mode * gv));
+int et_blank __P((struct grf_softc * gp, int * on));
+static int et_getControllerType __P((struct grf_softc * gp));
+static int et_getDACType __P((struct grf_softc * gp));
+
+int grfetmatch __P((struct device *, void *, void *));
+void grfetattach __P((struct device *, struct device *, void *));
+int grfetprint __P((void *, char *));
+void et_memset __P((unsigned char *d, unsigned char c, int l));
+
+/* Graphics display definitions.
+ * These are filled by 'grfconfig' using GRFIOCSETMON.
+ */
+#define monitor_def_max 8
+static struct grfvideo_mode monitor_def[8] = {
+ {0}, {0}, {0}, {0}, {0}, {0}, {0}, {0}
+};
+static struct grfvideo_mode *monitor_current = &monitor_def[0];
+
+/* Console display definition.
+ * Default hardcoded text mode. This grf_et is set up to
+ * use one text mode only, and this is it. You may use
+ * grfconfig to change the mode after boot.
+ */
+/* Console font */
+#ifdef KFONT_8X11
+#define TSENGFONT kernel_font_8x11
+#define TSENGFONTY 11
+#else
+#define TSENGFONT kernel_font_8x8
+#define TSENGFONTY 8
+#endif
+extern unsigned char TSENGFONT[];
+
+struct grfettext_mode etconsole_mode = {
+ {255, "", 25000000, 640, 480, 4, 640/8, 784/8, 680/8, 768/8, 800/8,
+ 481, 521, 491, 493, 525},
+ 8, TSENGFONTY, 640 / 8, 480 / TSENGFONTY, TSENGFONT, 32, 255
+};
+
+/* some modes
+# 640x480 256colors 41kHz 79Hz active
+x 31500000 640 480 8 640 752 672 768 728 487 505 488 490 512
+# 31500000 640 480 8 80 94 84 96 91 487 505 488 490 512
+# 640x512 256colors 42kHz 76Hz active
+x 32500000 640 512 8 640 760 664 760 736 519 536 520 522 543
+# 32500000 640 512 8 80 95 83 95 92 519 536 520 522 543
+# 720x540 256colors 43kHz 74Hz active
+x 37500000 720 540 8 720 856 744 840 832 547 565 548 550 572
+# 37500000 720 540 8 90 107 93 105 104 547 565 548 550 572
+# 800x600 256colors 48kHz 73Hz active
+x 50350000 800 600 8 792 1048 864 960 1016 599 648 615 617 647
+# 50350000 800 600 8 99 131 108 120 127 599 648 615 617 647
+# 912x684 256colors 57kHz 78Hz active
+x 65000000 912 684 8 904 1136 944 1040 1104 683 725 693 695 724
+# 65000000 912 684 8 113 142 118 130 138 683 725 693 695 724
+# 1024x768 256colors 61kHz 75Hz active
+x 80000000 1024 768 8 1024 1288 1072 1168 1264 775 806 780 782 813
+# 80000000 1024 768 8 128 161 134 146 158 775 806 780 782 813
+# 1120x832 256colors 56kHz 64Hz active
+x 80000000 1120 832 8 1120 1424 1152 1248 1400 839 848 833 835 855
+# 80000000 1120 832 8 140 178 144 156 175 839 848 833 835 855
+*/
+
+/* Console colors */
+unsigned char etconscolors[3][3] = { /* background, foreground, hilite */
+ {0, 0x40, 0x50}, {152, 152, 152}, {255, 255, 255}
+};
+
+int ettype = 0; /* oMniBus, Domino or Merlin */
+int etctype = 0; /* ET4000 or ETW32 */
+int etdtype = 0; /* Type of DAC (see grf_etregs.h) */
+
+char etcmap_shift = 0; /* 6 or 8 bit cmap entries */
+unsigned char pass_toggle; /* passthru status tracker */
+
+unsigned char Merlin_switch = 0;
+
+/* because all Tseng-boards have 2 configdev entries, one for
+ * framebuffer mem and the other for regs, we have to hold onto
+ * the pointers globally until we match on both. This and 'ettype'
+ * are the primary obsticles to multiple board support, but if you
+ * have multiple boards you have bigger problems than grf_et.
+ */
+static void *et_fbaddr = 0; /* framebuffer */
+static void *et_regaddr = 0; /* registers */
+static int et_fbsize; /* framebuffer size */
+
+/* current sprite info, if you add support for multiple boards
+ * make this an array or something
+ */
+struct grf_spriteinfo et_cursprite;
+
+/* sprite bitmaps in kernel stack, you'll need to arrayize these too if
+ * you add multiple board support
+ */
+static unsigned char et_imageptr[8 * 64], et_maskptr[8 * 64];
+static unsigned char et_sprred[2], et_sprgreen[2], et_sprblue[2];
+
+/* standard driver stuff */
+struct cfattach grfet_ca = {
+ sizeof(struct grf_softc), grfetmatch, grfetattach
+};
+
+struct cfdriver grfet_cd = {
+ NULL, "grfet", DV_DULL, NULL, 0
+};
+static struct cfdata *cfdata;
+
+
+int
+grfetmatch(pdp, match, auxp)
+ struct device *pdp;
+ void *match, *auxp;
+{
+#ifdef TSENGCONSOLE
+ struct cfdata *cfp = match;
+#endif
+ struct zbus_args *zap;
+ static int regprod, fbprod;
+
+ zap = auxp;
+
+#ifndef TSENGCONSOLE
+ if (amiga_realconfig == 0)
+ return (0);
+#endif
+
+ /* Grab the first board we encounter as the preferred one. This will
+ * allow one board to work in a multiple Tseng board system, but not
+ * multiple boards at the same time. */
+ if (ettype == 0) {
+ switch (zap->manid) {
+ case OMNIBUS:
+ if (zap->prodid != 0)
+ return (0);
+ regprod = 0;
+ fbprod = 0;
+ break;
+ case DOMINO:
+ if (zap->prodid != 2 && zap->prodid != 1)
+ return (0);
+ regprod = 2;
+ fbprod = 1;
+ break;
+ case MERLIN:
+ if (zap->prodid != 3 && zap->prodid != 4)
+ return (0);
+ regprod = 4;
+ fbprod = 3;
+ /*
+ * This card works only in ZorroII mode.
+ * ZorroIII needs different initialisations,
+ * which will be implemented later.
+ */
+ if iszthreepa(zap->pa)
+ return (0);
+ break;
+ default:
+ return (0);
+ }
+ ettype = zap->manid;
+ } else {
+ if (ettype != zap->manid) {
+ return (0);
+ }
+ }
+
+ /* Configure either registers or framebuffer in any order */
+ /* as said before, oMniBus does not support ProdID */
+ if (ettype == OMNIBUS) {
+ if (zap->size == 64 * 1024) {
+ /* register area */
+ et_regaddr = zap->va;
+ } else {
+ /* memory area */
+ et_fbaddr = zap->va;
+ et_fbsize = zap->size;
+ }
+ } else {
+ if (zap->prodid == regprod) {
+ et_regaddr = zap->va;
+ } else {
+ if (zap->prodid == fbprod) {
+ et_fbaddr = zap->va;
+ et_fbsize = zap->size;
+ } else {
+ return (0);
+ }
+ }
+ }
+
+#ifdef TSENGCONSOLE
+ if (amiga_realconfig == 0) {
+ cfdata = cfp;
+ }
+#endif
+
+ return (1);
+}
+
+
+void
+grfetattach(pdp, dp, auxp)
+ struct device *pdp, *dp;
+ void *auxp;
+{
+ static struct grf_softc congrf;
+ struct zbus_args *zap;
+ struct grf_softc *gp;
+ static char attachflag = 0;
+
+ zap = auxp;
+
+ printf("\n");
+
+ /* make sure both halves have matched */
+ if (!et_regaddr || !et_fbaddr)
+ return;
+
+ if (zap->manid == MERLIN && iszthreepa(zap->pa)) {
+ printf("grfet: WARNING: It is not possible to use the Merlin in ZorroIII mode.\n");
+ printf("grfet: Switch the Jumper to use it in ZorroII mode.\n");
+ printf("grfet unattached!!\n");
+ return;
+ }
+
+ /* do all that messy console/grf stuff */
+ if (dp == NULL)
+ gp = &congrf;
+ else
+ gp = (struct grf_softc *) dp;
+
+ if (dp != NULL && congrf.g_regkva != 0) {
+ /*
+ * inited earlier, just copy (not device struct)
+ */
+ bcopy(&congrf.g_display, &gp->g_display,
+ (char *) &gp[1] - (char *) &gp->g_display);
+ } else {
+ gp->g_regkva = (volatile caddr_t) et_regaddr;
+ gp->g_fbkva = (volatile caddr_t) et_fbaddr;
+
+ gp->g_unit = GRF_ET4000_UNIT;
+ gp->g_mode = et_mode;
+ gp->g_conpri = grfet_cnprobe();
+ gp->g_flags = GF_ALIVE;
+
+ /* wakeup the board */
+ et_boardinit(gp);
+
+#ifdef TSENGCONSOLE
+ grfet_iteinit(gp);
+ (void) et_load_mon(gp, &etconsole_mode);
+#endif
+ }
+
+ /*
+ * attach grf (once)
+ */
+ if (amiga_config_found(cfdata, &gp->g_device, gp, grfetprint)) {
+ attachflag = 1;
+ printf("grfet: %dMB ", et_fbsize / 0x100000);
+ switch (ettype) {
+ case OMNIBUS:
+ printf("oMniBus");
+ break;
+ case DOMINO:
+ printf("Domino");
+ break;
+ case MERLIN:
+ printf("Merlin");
+ break;
+ }
+ printf(" with ");
+ switch (etctype) {
+ case ET4000:
+ printf("Tseng ET4000");
+ break;
+ case ETW32:
+ printf("Tseng ETW32");
+ break;
+ }
+ printf(" and ");
+ switch (etdtype) {
+ case SIERRA11483:
+ printf("Sierra SC11483 DAC");
+ break;
+ case SIERRA15025:
+ printf("Sierra SC15025 DAC");
+ break;
+ case MUSICDAC:
+ printf("MUSIC DAC");
+ break;
+ case MERLINDAC:
+ printf("BrookTree DAC");
+ break;
+ }
+ printf(" being used\n");
+ } else {
+ if (!attachflag)
+ printf("grfet unattached!!\n");
+ }
+}
+
+
+int
+grfetprint(auxp, pnp)
+ void *auxp;
+ char *pnp;
+{
+ if (pnp)
+ printf("ite at %s: ", pnp);
+ return (UNCONF);
+}
+
+
+void
+et_boardinit(gp)
+ struct grf_softc *gp;
+{
+ unsigned char *ba = gp->g_regkva;
+ int x;
+
+ /* wakeup board and flip passthru OFF */
+
+ RegWakeup(ba);
+ 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);
+ }
+
+
+ /* setup initial unchanging parameters */
+
+ vgaw(ba, GREG_HERCULESCOMPAT, 0x03);
+ vgaw(ba, GREG_DISPMODECONTROL, 0xa0);
+ vgaw(ba, GREG_MISC_OUTPUT_W, 0x63);
+
+ WSeq(ba, SEQ_ID_RESET, 0x03);
+ WSeq(ba, SEQ_ID_CLOCKING_MODE, 0x21); /* 8 dot, Display off */
+ WSeq(ba, SEQ_ID_MAP_MASK, 0x0f);
+ WSeq(ba, SEQ_ID_CHAR_MAP_SELECT, 0x00);
+ WSeq(ba, SEQ_ID_MEMORY_MODE, 0x0e);
+/* WSeq(ba, SEQ_ID_TS_STATE_CONTROL, 0x00); */
+ WSeq(ba, SEQ_ID_AUXILIARY_MODE, 0xf4);
+
+ WCrt(ba, CRT_ID_PRESET_ROW_SCAN, 0x00);
+ WCrt(ba, CRT_ID_CURSOR_START, 0x00);
+ WCrt(ba, CRT_ID_CURSOR_END, 0x08);
+ WCrt(ba, CRT_ID_START_ADDR_HIGH, 0x00);
+ WCrt(ba, CRT_ID_START_ADDR_LOW, 0x00);
+ WCrt(ba, CRT_ID_CURSOR_LOC_HIGH, 0x00);
+ WCrt(ba, CRT_ID_CURSOR_LOC_LOW, 0x00);
+
+ WCrt(ba, CRT_ID_UNDERLINE_LOC, 0x07);
+ WCrt(ba, CRT_ID_MODE_CONTROL, 0xa3); /* c3 */
+ WCrt(ba, CRT_ID_LINE_COMPARE, 0xff); /* ff */
+/*
+ WCrt(ba, CRT_ID_EXT_DISP_CNTL, 0x22);
+*/
+/* ET4000 special */
+ WCrt(ba, CRT_ID_RASCAS_CONFIG, 0x28);
+ WCrt(ba, CTR_ID_EXT_START, 0x00);
+ WCrt(ba, CRT_ID_6845_COMPAT, 0x08);
+ WCrt(ba, CRT_ID_VIDEO_CONFIG1, 0xd3);
+ WCrt(ba, CRT_ID_VIDEO_CONFIG2, 0x0f);
+ WCrt(ba, CRT_ID_HOR_OVERFLOW, 0x00);
+
+ WGfx(ba, GCT_ID_SET_RESET, 0x00);
+ WGfx(ba, GCT_ID_ENABLE_SET_RESET, 0x00);
+ WGfx(ba, GCT_ID_COLOR_COMPARE, 0x00);
+ WGfx(ba, GCT_ID_DATA_ROTATE, 0x00);
+ WGfx(ba, GCT_ID_READ_MAP_SELECT, 0x00);
+ WGfx(ba, GCT_ID_GRAPHICS_MODE, 0x00);
+ WGfx(ba, GCT_ID_MISC, 0x01);
+ WGfx(ba, GCT_ID_COLOR_XCARE, 0x0f);
+ WGfx(ba, GCT_ID_BITMASK, 0xff);
+
+ vgaw(ba, GREG_SEGMENTSELECT, 0x00);
+
+ for (x = 0; x < 0x10; x++)
+ WAttr(ba, x, x);
+ WAttr(ba, ACT_ID_ATTR_MODE_CNTL, 0x01);
+ WAttr(ba, ACT_ID_OVERSCAN_COLOR, 0x00);
+ WAttr(ba, ACT_ID_COLOR_PLANE_ENA, 0x0f);
+ WAttr(ba, ACT_ID_HOR_PEL_PANNING, 0x00);
+ WAttr(ba, ACT_ID_COLOR_SELECT, 0x00);
+ WAttr(ba, ACT_ID_MISCELLANEOUS, 0x00);
+
+ vgaw(ba, VDAC_MASK, 0xff);
+ delay(200000);
+ vgaw(ba, GREG_MISC_OUTPUT_W, 0xe3); /* c3 */
+
+ /* colors initially set to greyscale */
+
+ switch(ettype) {
+ 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);
+ }
+ 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);
+ }
+ break;
+ }
+ /* set sprite bitmap pointers */
+ /* should work like that */
+ et_cursprite.image = et_imageptr;
+ et_cursprite.mask = et_maskptr;
+ et_cursprite.cmap.red = et_sprred;
+ et_cursprite.cmap.green = et_sprgreen;
+ et_cursprite.cmap.blue = et_sprblue;
+
+ /* card spezific initialisations */
+ switch(ettype) {
+ case OMNIBUS:
+ etctype = et_getControllerType(gp);
+ etdtype = et_getDACType(gp);
+ break;
+ case MERLIN:
+ etctype = ETW32;
+ etdtype = MERLINDAC;
+ break;
+ case DOMINO:
+ etctype = ET4000;
+ etdtype = SIERRA11483;
+ break;
+ }
+}
+
+
+int
+et_getvmode(gp, vm)
+ struct grf_softc *gp;
+ struct grfvideo_mode *vm;
+{
+ struct grfvideo_mode *gv;
+
+#ifdef TSENGCONSOLE
+ /* Handle grabbing console mode */
+ if (vm->mode_num == 255) {
+ bcopy(&etconsole_mode, vm, sizeof(struct grfvideo_mode));
+ /* XXX so grfconfig can tell us the correct text dimensions. */
+ 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;
+
+ return (0);
+}
+
+
+int
+et_setvmode(gp, mode)
+ struct grf_softc *gp;
+ unsigned mode;
+{
+ if (!mode || (mode > monitor_def_max) ||
+ monitor_def[mode - 1].mode_num == 0)
+ return (EINVAL);
+
+ monitor_current = monitor_def + (mode - 1);
+
+ return (0);
+}
+
+
+#ifndef TSENGCONSOLE
+void
+et_off(gp)
+ struct grf_softc *gp;
+{
+ char *ba = gp->g_regkva;
+
+ /* we'll put the pass-through on for cc ite and set Full Bandwidth bit
+ * on just in case it didn't work...but then it doesn't matter does
+ * it? =) */
+ RegOnpass(ba);
+ WSeq(ba, SEQ_ID_CLOCKING_MODE, 0x21);
+}
+#endif
+
+
+int
+et_blank(gp, on)
+ struct grf_softc *gp;
+ int *on;
+{
+ WSeq(gp->g_regkva, SEQ_ID_CLOCKING_MODE, *on ? 0x21 : 0x01);
+ return(0);
+}
+
+
+/*
+ * Change the mode of the display.
+ * Return a UNIX error number or 0 for success.
+ */
+int
+et_mode(gp, cmd, arg, a2, a3)
+ register struct grf_softc *gp;
+ u_long cmd;
+ void *arg;
+ u_long a2;
+ int a3;
+{
+ int error;
+
+ switch (cmd) {
+ case GM_GRFON:
+ error = et_load_mon(gp,
+ (struct grfettext_mode *) monitor_current) ? 0 : EINVAL;
+ return (error);
+
+ case GM_GRFOFF:
+#ifndef TSENGCONSOLE
+ et_off(gp);
+#else
+ et_load_mon(gp, &etconsole_mode);
+#endif
+ return (0);
+
+ case GM_GRFCONFIG:
+ return (0);
+
+ case GM_GRFGETVMODE:
+ return (et_getvmode(gp, (struct grfvideo_mode *) arg));
+
+ case GM_GRFSETVMODE:
+ error = et_setvmode(gp, *(unsigned *) arg);
+ if (!error && (gp->g_flags & GF_GRFON))
+ et_load_mon(gp,
+ (struct grfettext_mode *) monitor_current);
+ return (error);
+
+ case GM_GRFGETNUMVM:
+ *(int *) arg = monitor_def_max;
+ return (0);
+
+ case GM_GRFIOCTL:
+ return (et_ioctl(gp, a2, arg));
+
+ default:
+ break;
+ }
+
+ return (EINVAL);
+}
+
+int
+et_ioctl(gp, cmd, data)
+ register struct grf_softc *gp;
+ u_long cmd;
+ void *data;
+{
+ switch (cmd) {
+ case GRFIOCGSPRITEPOS:
+ return (et_getmousepos(gp, (struct grf_position *) data));
+
+ case GRFIOCSSPRITEPOS:
+ return (et_setmousepos(gp, (struct grf_position *) data));
+
+ case GRFIOCSSPRITEINF:
+ return (et_setspriteinfo(gp, (struct grf_spriteinfo *) data));
+
+ case GRFIOCGSPRITEINF:
+ return (et_getspriteinfo(gp, (struct grf_spriteinfo *) data));
+
+ case GRFIOCGSPRITEMAX:
+ return (et_getspritemax(gp, (struct grf_position *) data));
+
+ case GRFIOCGETCMAP:
+ return (et_getcmap(gp, (struct grf_colormap *) data));
+
+ case GRFIOCPUTCMAP:
+ return (et_putcmap(gp, (struct grf_colormap *) data));
+
+ case GRFIOCBITBLT:
+ break;
+
+ case GRFTOGGLE:
+ return (et_toggle(gp, 0));
+
+ case GRFIOCSETMON:
+ return (et_setmonitor(gp, (struct grfvideo_mode *) data));
+
+ case GRFIOCBLANK:
+ return (et_blank(gp, (int *)data));
+ }
+ return (EINVAL);
+}
+
+
+int
+et_getmousepos(gp, data)
+ struct grf_softc *gp;
+ struct grf_position *data;
+{
+ data->x = et_cursprite.pos.x;
+ data->y = et_cursprite.pos.y;
+ return (0);
+}
+
+
+void
+et_writesprpos(ba, x, y)
+ volatile char *ba;
+ short x;
+ short y;
+{
+}
+
+
+#ifdef notyet
+void
+et_writeshifted(to, shiftx, shifty)
+ unsigned char *to;
+ char shiftx;
+ char shifty;
+{
+}
+#endif
+
+
+int
+et_setmousepos(gp, data)
+ struct grf_softc *gp;
+ struct grf_position *data;
+{
+ volatile char *ba = gp->g_regkva;
+#if 0
+ volatile char *fb = gp->g_fbkva;
+ volatile char *sprite = fb + (et_fbsize - 1024);
+#endif
+ short rx, ry, prx, pry;
+
+ /* no movement */
+ if (et_cursprite.pos.x == data->x && et_cursprite.pos.y == data->y)
+ return (0);
+
+ /* 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).
+ */
+#ifdef notyet
+ if (rx < 0 || ry < 0 || prx < 0 || pry < 0) {
+ et_writeshifted(sprite, rx < 0 ? -rx : 0, ry < 0 ? -ry : 0);
+ }
+#endif
+
+ /* 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;
+
+ return (0);
+}
+
+
+int
+et_getspriteinfo(gp, data)
+ struct grf_softc *gp;
+ struct grf_spriteinfo *data;
+{
+
+ return(EINVAL);
+}
+
+
+static int
+et_setspriteinfo(gp, data)
+ struct grf_softc *gp;
+ struct grf_spriteinfo *data;
+{
+
+ return(EINVAL);
+}
+
+
+static int
+et_getspritemax(gp, data)
+ struct grf_softc *gp;
+ struct grf_position *data;
+{
+
+ return(EINVAL);
+}
+
+
+int
+et_setmonitor(gp, gv)
+ struct grf_softc *gp;
+ struct grfvideo_mode *gv;
+{
+ struct grfvideo_mode *md;
+
+ 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.rows = gv->disp_height / etconsole_mode.fy;
+ etconsole_mode.cols = gv->disp_width / etconsole_mode.fx;
+ if (!(gp->g_flags & GF_GRFON))
+ et_load_mon(gp, &etconsole_mode);
+ ite_reinit(gp->g_itedev);
+ return (0);
+ }
+#endif
+
+ md = monitor_def + (gv->mode_num - 1);
+ bcopy(gv, md, sizeof(struct grfvideo_mode));
+
+ /* 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;
+
+ return (0);
+}
+
+
+int
+et_getcmap(gfp, cmap)
+ struct grf_softc *gfp;
+ struct grf_colormap *cmap;
+{
+ volatile unsigned char *ba;
+ u_char red[256], green[256], blue[256], *rp, *gp, *bp;
+ short x;
+ int error;
+
+ if (cmap->count == 0 || cmap->index >= 256)
+ return 0;
+
+ if (cmap->index + cmap->count > 256)
+ cmap->count = 256 - cmap->index;
+
+ ba = gfp->g_regkva;
+ /* first read colors out of the chip, then copyout to userspace */
+ x = cmap->count - 1;
+
+ rp = red + cmap->index;
+ gp = green + cmap->index;
+ bp = blue + cmap->index;
+
+ switch(ettype) {
+ case MERLIN:
+ vgaw(ba, MERLIN_VDAC_INDEX, cmap->index);
+ do {
+ *rp++ = vgar(ba, MERLIN_VDAC_COLORS);
+ *gp++ = vgar(ba, MERLIN_VDAC_COLORS);
+ *bp++ = vgar(ba, MERLIN_VDAC_COLORS);
+ } while (x-- > 0);
+ break;
+ default:
+ vgaw(ba, VDAC_ADDRESS_W, cmap->index);
+ do {
+ *rp++ = vgar(ba, VDAC_DATA) << etcmap_shift;
+ *gp++ = vgar(ba, VDAC_DATA) << etcmap_shift;
+ *bp++ = vgar(ba, VDAC_DATA) << etcmap_shift;
+ } while (x-- > 0);
+ break;
+ }
+
+ if (!(error = copyout(red + cmap->index, cmap->red, cmap->count))
+ && !(error = copyout(green + cmap->index, cmap->green, cmap->count))
+ && !(error = copyout(blue + cmap->index, cmap->blue, cmap->count)))
+ return (0);
+
+ return (error);
+}
+
+
+int
+et_putcmap(gfp, cmap)
+ struct grf_softc *gfp;
+ struct grf_colormap *cmap;
+{
+ volatile unsigned char *ba;
+ u_char red[256], green[256], blue[256], *rp, *gp, *bp;
+ short x;
+ int error;
+
+ if (cmap->count == 0 || cmap->index >= 256)
+ return (0);
+
+ if (cmap->index + cmap->count > 256)
+ cmap->count = 256 - cmap->index;
+
+ /* first copy the colors into kernelspace */
+ if (!(error = copyin(cmap->red, red + cmap->index, cmap->count))
+ && !(error = copyin(cmap->green, green + cmap->index, cmap->count))
+ && !(error = copyin(cmap->blue, blue + cmap->index, cmap->count))) {
+ ba = gfp->g_regkva;
+ x = cmap->count - 1;
+
+ rp = red + cmap->index;
+ gp = green + cmap->index;
+ bp = blue + cmap->index;
+
+ switch(ettype){
+ case MERLIN:
+ vgaw(ba, MERLIN_VDAC_INDEX, cmap->index);
+ do {
+ vgaw(ba, MERLIN_VDAC_COLORS, *rp++);
+ vgaw(ba, MERLIN_VDAC_COLORS, *gp++);
+ vgaw(ba, MERLIN_VDAC_COLORS, *bp++);
+ } while (x-- > 0);
+ break;
+ 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);
+ } while (x-- > 0);
+ break;
+ }
+
+ return (0);
+ } else
+ return (error);
+}
+
+
+int
+et_toggle(gp, wopp)
+ struct grf_softc *gp;
+ unsigned short wopp; /* don't need that one yet, ill */
+{
+ volatile unsigned char *ba;
+
+ ba = gp->g_regkva;
+
+ if (pass_toggle) {
+ RegOffpass(ba);
+ } else {
+ RegOnpass(ba);
+ }
+ return (0);
+}
+
+#define ET_NUMCLOCKS 32
+
+static u_char et_clocks[ET_NUMCLOCKS] = {
+ 0, 1, 6, 2, 3, 7, 4, 5,
+ 0, 1, 6, 2, 3, 7, 4, 5,
+ 0, 1, 6, 2, 3, 7, 4, 5,
+ 0, 1, 6, 2, 3, 7, 4, 5
+};
+
+static u_char et_clockdividers[ET_NUMCLOCKS] = {
+ 3, 3, 3, 3, 3, 3, 3, 3,
+ 2, 2, 2, 2, 2, 2, 2, 2,
+ 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+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
+};
+
+
+static void
+et_CompFQ(fq, num, denom)
+ u_int fq;
+ u_char *num;
+ u_char *denom;
+{
+ int i;
+
+ for (i=0; i < ET_NUMCLOCKS;) {
+ if (fq <= et_clockfreqs[i++]) {
+ break;
+ }
+ }
+
+ *num = et_clocks[--i];
+ *denom = et_clockdividers[i];
+
+ return;
+}
+
+
+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);
+
+ switch (gv->depth) {
+ case 4:
+ if (gv->mode_num != 255)
+ return(0);
+ case 1:
+ case 8:
+ case 15:
+ case 16:
+ case 24:
+ break;
+ default:
+ return (0);
+ }
+ return (1);
+}
+
+
+int
+et_load_mon(gp, md)
+ struct grf_softc *gp;
+ struct grfettext_mode *md;
+{
+ struct grfvideo_mode *gv;
+ struct grfinfo *gi;
+ volatile unsigned char *ba;
+ unsigned char num0, denom0;
+ unsigned short HT, HDE, HBS, HBE, HSS, HSE, VDE, VBS, VBE, VSS,
+ VSE, VT;
+ char LACE, DBLSCAN, TEXT;
+ unsigned char seq;
+ int uplim, lowlim;
+
+ /* identity */
+ gv = &md->gv;
+ TEXT = (gv->depth == 4);
+
+ if (!et_mondefok(gv)) {
+ printf("mondef not ok\n");
+ return (0);
+ }
+ ba = gp->g_regkva;
+
+ /* provide all needed information in grf device-independant locations */
+ gp->g_data = (caddr_t) gv;
+ gi = &gp->g_display;
+ gi->gd_regaddr = (caddr_t) ztwopa(ba);
+ gi->gd_regsize = 64 * 1024;
+ gi->gd_fbaddr = (caddr_t) kvtop(gp->g_fbkva);
+ gi->gd_fbsize = et_fbsize;
+ gi->gd_colors = 1 << gv->depth;
+ gi->gd_planes = gv->depth;
+ gi->gd_fbwidth = gv->disp_width;
+ gi->gd_fbheight = gv->disp_height;
+ gi->gd_fbx = 0;
+ gi->gd_fby = 0;
+ if (TEXT) {
+ gi->gd_dwidth = md->fx * md->cols;
+ gi->gd_dheight = md->fy * md->rows;
+ } else {
+ gi->gd_dwidth = gv->disp_width;
+ gi->gd_dheight = gv->disp_height;
+ }
+ gi->gd_dx = 0;
+ gi->gd_dy = 0;
+
+ /* get display mode parameters */
+
+ HBS = gv->hblank_start;
+ HBE = gv->hblank_stop;
+ HSS = gv->hsync_start;
+ HSE = gv->hsync_stop;
+ HT = gv->htotal;
+ VBS = gv->vblank_start;
+ VSS = gv->vsync_start;
+ VSE = gv->vsync_stop;
+ VBE = gv->vblank_stop;
+ VT = gv->vtotal;
+
+ if (TEXT)
+ HDE = ((gv->disp_width + md->fx - 1) / md->fx) - 1;
+ else
+ HDE = (gv->disp_width + 3) / 8 - 1; /* HBS; */
+ VDE = gv->disp_height - 1;
+
+ /* figure out whether lace or dblscan is needed */
+
+ uplim = gv->disp_height + (gv->disp_height / 4);
+ lowlim = gv->disp_height - (gv->disp_height / 4);
+ LACE = (((VT * 2) > lowlim) && ((VT * 2) < uplim)) ? 1 : 0;
+ DBLSCAN = (((VT / 2) > lowlim) && ((VT / 2) < uplim)) ? 1 : 0;
+
+ /* adjustments */
+
+ if (LACE)
+ VDE /= 2;
+
+ WSeq(ba, SEQ_ID_MEMORY_MODE, (TEXT || (gv->depth == 1)) ? 0x06 : 0x0e);
+
+ WGfx(ba, GCT_ID_READ_MAP_SELECT, 0x00);
+ WSeq(ba, SEQ_ID_MAP_MASK, (gv->depth == 1) ? 0x01 : 0xff);
+ WSeq(ba, SEQ_ID_CHAR_MAP_SELECT, 0x00);
+
+ /* Set clock */
+
+ et_CompFQ( gv->pixel_clock, &num0, &denom0);
+
+ vgaw(ba, GREG_MISC_OUTPUT_W, 0xe3 | ((num0 & 3) << 2));
+ WCrt(ba, CRT_ID_6845_COMPAT, (num0 & 4) ? 0x0a : 0x08);
+ seq=RSeq(ba, SEQ_ID_CLOCKING_MODE);
+ switch(denom0) {
+ case 0:
+ WSeq(ba, SEQ_ID_AUXILIARY_MODE, 0xb4);
+ WSeq(ba, SEQ_ID_CLOCKING_MODE, seq & 0xf7);
+ break;
+ case 1:
+ WSeq(ba, SEQ_ID_AUXILIARY_MODE, 0xf4);
+ WSeq(ba, SEQ_ID_CLOCKING_MODE, seq & 0xf7);
+ break;
+ case 2:
+ WSeq(ba, SEQ_ID_AUXILIARY_MODE, 0xf5);
+ WSeq(ba, SEQ_ID_CLOCKING_MODE, seq & 0xf7);
+ break;
+ case 3:
+ WSeq(ba, SEQ_ID_AUXILIARY_MODE, 0xf5);
+ WSeq(ba, SEQ_ID_CLOCKING_MODE, seq | 0x08);
+ break;
+ }
+ /* load display parameters into board */
+
+ WCrt(ba, CRT_ID_HOR_TOTAL, HT);
+ WCrt(ba, CRT_ID_HOR_DISP_ENA_END, ((HDE >= HBS) ? HBS - 1 : HDE));
+ WCrt(ba, CRT_ID_START_HOR_BLANK, HBS);
+ WCrt(ba, CRT_ID_END_HOR_BLANK, (HBE & 0x1f) | 0x80); /* | 0x80? */
+ WCrt(ba, CRT_ID_START_HOR_RETR, HSS);
+ WCrt(ba, CRT_ID_END_HOR_RETR,
+ (HSE & 0x1f) |
+ ((HBE & 0x20) ? 0x80 : 0x00));
+ WCrt(ba, CRT_ID_VER_TOTAL, VT);
+ WCrt(ba, CRT_ID_OVERFLOW,
+ 0x10 |
+ ((VT & 0x100) ? 0x01 : 0x00) |
+ ((VDE & 0x100) ? 0x02 : 0x00) |
+ ((VSS & 0x100) ? 0x04 : 0x00) |
+ ((VBS & 0x100) ? 0x08 : 0x00) |
+ ((VT & 0x200) ? 0x20 : 0x00) |
+ ((VDE & 0x200) ? 0x40 : 0x00) |
+ ((VSS & 0x200) ? 0x80 : 0x00));
+
+ WCrt(ba, CRT_ID_MAX_ROW_ADDRESS,
+ 0x40 | /* TEXT ? 0x00 ??? */
+ (DBLSCAN ? 0x80 : 0x00) |
+ ((VBS & 0x200) ? 0x20 : 0x00) |
+ (TEXT ? ((md->fy - 1) & 0x1f) : 0x00));
+
+ WCrt(ba, CRT_ID_MODE_CONTROL,
+ ((TEXT || (gv->depth == 1)) ? 0xc3 : 0xab));
+
+ /* text cursor */
+
+ if (TEXT) {
+#if ET_ULCURSOR
+ WCrt(ba, CRT_ID_CURSOR_START, (md->fy & 0x1f) - 2);
+ WCrt(ba, CRT_ID_CURSOR_END, (md->fy & 0x1f) - 1);
+#else
+ WCrt(ba, CRT_ID_CURSOR_START, 0x00);
+ WCrt(ba, CRT_ID_CURSOR_END, md->fy & 0x1f);
+#endif
+ WCrt(ba, CRT_ID_CURSOR_LOC_HIGH, 0x00);
+ WCrt(ba, CRT_ID_CURSOR_LOC_LOW, 0x00);
+ }
+
+ WCrt(ba, CRT_ID_UNDERLINE_LOC, ((md->fy - 1) & 0x1f)
+ | ((TEXT || (gv->depth == 1)) ? 0x00 : 0x60));
+
+ WCrt(ba, CRT_ID_START_ADDR_HIGH, 0x00);
+ WCrt(ba, CRT_ID_START_ADDR_LOW, 0x00);
+
+ WCrt(ba, CRT_ID_START_VER_RETR, VSS);
+ WCrt(ba, CRT_ID_END_VER_RETR, (VSE & 0x0f) | 0x30);
+ WCrt(ba, CRT_ID_VER_DISP_ENA_END, VDE);
+ WCrt(ba, CRT_ID_START_VER_BLANK, VBS);
+ WCrt(ba, CRT_ID_END_VER_BLANK, VBE);
+
+ 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)
+ );
+
+ /* depth dependent stuff */
+
+ WGfx(ba, GCT_ID_GRAPHICS_MODE,
+ ((TEXT || (gv->depth == 1)) ? 0x00 : 0x40));
+ WGfx(ba, GCT_ID_MISC, (TEXT ? 0x04 : 0x01));
+
+ vgaw(ba, VDAC_MASK, 0xff);
+ vgar(ba, VDAC_MASK);
+ vgar(ba, VDAC_MASK);
+ vgar(ba, VDAC_MASK);
+ vgar(ba, VDAC_MASK);
+ switch (gv->depth) {
+ case 1:
+ case 4: /* text */
+ switch(etdtype) {
+ case SIERRA11483:
+ case SIERRA15025:
+ case MUSICDAC:
+ vgaw(ba, VDAC_MASK, 0);
+ break;
+ case MERLINDAC:
+ setMerlinDACmode(ba, 0);
+ break;
+ }
+ HDE = gv->disp_width / 16;
+ break;
+ case 8:
+ switch(etdtype) {
+ case SIERRA11483:
+ case SIERRA15025:
+ case MUSICDAC:
+ vgaw(ba, VDAC_MASK, 0);
+ break;
+ case MERLINDAC:
+ setMerlinDACmode(ba, 0);
+ break;
+ }
+ HDE = gv->disp_width / 8;
+ break;
+ case 15:
+ switch(etdtype) {
+ case SIERRA11483:
+ case SIERRA15025:
+ case MUSICDAC:
+ vgaw(ba, VDAC_MASK, 0xa0);
+ break;
+ case MERLINDAC:
+ setMerlinDACmode(ba, 0xa0);
+ break;
+ }
+ HDE = gv->disp_width / 4;
+ break;
+ case 16:
+ switch(etdtype) {
+ case SIERRA11483:
+ vgaw(ba, VDAC_MASK, 0); /* illegal mode! */
+ break;
+ case SIERRA15025:
+ vgaw(ba, VDAC_MASK, 0xe0);
+ break;
+ case MUSICDAC:
+ vgaw(ba, VDAC_MASK, 0xc0);
+ break;
+ case MERLINDAC:
+ setMerlinDACmode(ba, 0xe0);
+ break;
+ }
+ HDE = gv->disp_width / 4;
+ break;
+ case 24:
+ switch(etdtype) {
+ case SIERRA11483:
+ vgaw(ba, VDAC_MASK, 0); /* illegal mode! */
+ break;
+ case SIERRA15025:
+ vgaw(ba, VDAC_MASK, 0xe1);
+ break;
+ case MUSICDAC:
+ vgaw(ba, VDAC_MASK, 0xe0);
+ break;
+ case MERLINDAC:
+ setMerlinDACmode(ba, 0xf0);
+ break;
+ }
+ HDE = (gv->disp_width / 8) * 3;
+ break;
+ case 32:
+ switch(etdtype) {
+ case SIERRA11483:
+ case MUSICDAC:
+ vgaw(ba, VDAC_MASK, 0); /* illegal mode! */
+ break;
+ case SIERRA15025:
+ vgaw(ba, VDAC_MASK, 0x61);
+ break;
+ case MERLINDAC:
+ setMerlinDACmode(ba, 0xb0);
+ break;
+ }
+ HDE = gv->disp_width / 2;
+ break;
+ }
+ WAttr(ba, ACT_ID_ATTR_MODE_CNTL, (TEXT ? 0x0a : 0x01));
+ WAttr(ba, 0x20 | ACT_ID_COLOR_PLANE_ENA,
+ (gv->depth == 1) ? 0x01 : 0x0f);
+
+ WCrt(ba, CRT_ID_OFFSET, HDE);
+
+ /* text initialization */
+ if (TEXT) {
+ et_inittextmode(gp);
+ }
+
+ WSeq(ba, SEQ_ID_CLOCKING_MODE, 0x01);
+
+ /* Pass-through */
+ RegOffpass(ba);
+
+ return (1);
+}
+
+
+void
+et_inittextmode(gp)
+ struct grf_softc *gp;
+{
+ struct grfettext_mode *tm = (struct grfettext_mode *) gp->g_data;
+ volatile unsigned char *ba = gp->g_regkva;
+ unsigned char *fb = gp->g_fbkva;
+ unsigned char *c, *f, y;
+ unsigned short z;
+
+
+ /* load text font into beginning of display memory. Each character
+ * cell is 32 bytes long (enough for 4 planes) */
+
+ SetTextPlane(ba, 0x02);
+ et_memset(fb, 0, 256 * 32);
+ c = (unsigned char *) (fb) + (32 * tm->fdstart);
+ f = tm->fdata;
+ for (z = tm->fdstart; z <= tm->fdend; z++, c += (32 - tm->fy))
+ for (y = 0; y < tm->fy; y++)
+ *c++ = *f++;
+
+ /* clear out text/attr planes (three screens worth) */
+
+ SetTextPlane(ba, 0x01);
+ et_memset(fb, 0x07, tm->cols * tm->rows * 3);
+ SetTextPlane(ba, 0x00);
+ et_memset(fb, 0x20, tm->cols * tm->rows * 3);
+
+ /* print out a little init msg */
+
+ c = (unsigned char *) (fb) + (tm->cols - 16);
+ strcpy(c, "TSENG");
+ c[6] = 0x20;
+
+ /* set colors (B&W) */
+
+ switch(ettype) {
+ case MERLIN:
+ vgaw(ba, MERLIN_VDAC_INDEX, 0);
+ for (z = 0; z < 256; z++) {
+ y = (z & 1) ? ((z > 7) ? 2 : 1) : 0;
+
+ vgaw(ba, MERLIN_VDAC_COLORS, etconscolors[y][0]);
+ vgaw(ba, MERLIN_VDAC_COLORS, etconscolors[y][1]);
+ vgaw(ba, MERLIN_VDAC_COLORS, etconscolors[y][2]);
+ }
+ break;
+ default:
+ vgaw(ba, VDAC_ADDRESS_W, 0);
+ 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);
+ }
+ break;
+ }
+}
+
+
+void
+et_memset(d, c, l)
+ unsigned char *d;
+ unsigned char c;
+ int l;
+{
+ for (; l > 0; l--)
+ *d++ = c;
+}
+
+
+static int
+et_getControllerType(gp)
+ struct grf_softc * gp;
+{
+ unsigned char *ba = gp->g_regkva; /* register base */
+ unsigned char *mem = gp->g_fbkva; /* memory base */
+ unsigned char *mmu = mem + MMU_APERTURE0; /* MMU aperture 0 base */
+
+ *mem = 0;
+
+ /* make ACL visible */
+ WCrt(ba, CRT_ID_VIDEO_CONFIG1, 0xfb);
+ WIma(ba, IMA_PORTCONTROL, 0x01);
+
+ *((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);
+}
+
+
+static int
+et_getDACType(gp)
+ struct grf_softc * gp;
+{
+ unsigned char *ba = gp->g_regkva;
+ union {
+ int tt;
+ char cc[4];
+ } check;
+
+ /* 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)); 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 Sierra SC 11483 */
+ /* shift color values by 2 */
+ etcmap_shift = 2;
+
+ vgaw(ba, VDAC_MASK, 0xff);
+ return(SIERRA11483);
+}
+
+#endif /* NGRFET */
diff --git a/sys/arch/amiga/dev/grf_etreg.h b/sys/arch/amiga/dev/grf_etreg.h
new file mode 100644
index 00000000000..41e82d8ab80
--- /dev/null
+++ b/sys/arch/amiga/dev/grf_etreg.h
@@ -0,0 +1,385 @@
+/* $NetBSD: grf_etreg.h,v 1.1 1996/05/19 21:05:34 veego Exp $ */
+
+/*
+ * Copyright (c) 1996 Tobias Abt
+ * Copyright (c) 1995 Ezra Story
+ * Copyright (c) 1995 Kari Mettinen
+ * Copyright (c) 1994 Markus Wild
+ * Copyright (c) 1994 Lutz Vieweg
+ * 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 Lutz Vieweg.
+ * 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 _GRF_ETREG_H
+#define _GRF_ETREG_H
+
+/*
+ * Written & Copyright by Kari Mettinen, Ezra Story.
+ *
+ * This is derived from Cirrus driver source
+ */
+
+/* Extension to grfvideo_mode to support text modes.
+ * This can be passed to both text & gfx functions
+ * without worry. If gv.depth == 4, then the extended
+ * 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;
+};
+
+
+/* Tseng boards types, stored in ettype in grf_et.c.
+ * used to decide how to handle Pass-through, etc.
+ */
+
+#define OMNIBUS 2181
+#define DOMINO 2167
+#define MERLIN 2117
+
+/* VGA controller types */
+#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 */
+
+/* read VGA register */
+#define vgar(ba, reg) (*(((volatile unsigned char *)ba)+reg))
+
+/* write VGA register */
+#define vgaw(ba, reg, val) \
+ *(((volatile unsigned char *)ba)+reg) = ((unsigned char)val)
+
+/*
+ * defines for the used register addresses (mw)
+ *
+ * NOTE: there are some registers that have different addresses when
+ * in mono or color mode. We only support color mode, and thus
+ * some addresses won't work in mono-mode!
+ *
+ * General and VGA-registers taken from retina driver. Fixed a few
+ * bugs in it. (SR and GR read address is Port + 1, NOT Port)
+ *
+ */
+
+/* General Registers: */
+#define GREG_STATUS0_R 0x03C2
+#define GREG_STATUS1_R 0x03DA
+#define GREG_MISC_OUTPUT_R 0x03CC
+#define GREG_MISC_OUTPUT_W 0x03C2
+#define GREG_FEATURE_CONTROL_R 0x03CA
+#define GREG_FEATURE_CONTROL_W 0x03DA
+#define GREG_POS 0x0102
+#define GREG_HERCULESCOMPAT 0x03BF
+#define GREG_VIDEOSYSENABLE 0x03C3
+#define GREG_DISPMODECONTROL 0x03D8
+#define GREG_COLORSELECT 0x03D9
+#define GREG_ATNTMODECONTROL 0x03DE
+#define GREG_SEGMENTSELECT 0x03CD
+
+/* ETW32 special */
+#define W32mappedRegs 0xfff00
+
+/* MMU */
+#define MMU_APERTURE0 0x80000
+#define MMU_APERTURE1 0xa0000
+#define MMU_APERTURE2 0xc0000
+
+/* Accellerator */
+
+/* Attribute Controller: */
+#define ACT_ADDRESS 0x03C0
+#define ACT_ADDRESS_R 0x03C1
+#define ACT_ADDRESS_W 0x03C0
+#define ACT_ADDRESS_RESET 0x03DA
+#define ACT_ID_PALETTE0 0x00
+#define ACT_ID_PALETTE1 0x01
+#define ACT_ID_PALETTE2 0x02
+#define ACT_ID_PALETTE3 0x03
+#define ACT_ID_PALETTE4 0x04
+#define ACT_ID_PALETTE5 0x05
+#define ACT_ID_PALETTE6 0x06
+#define ACT_ID_PALETTE7 0x07
+#define ACT_ID_PALETTE8 0x08
+#define ACT_ID_PALETTE9 0x09
+#define ACT_ID_PALETTE10 0x0A
+#define ACT_ID_PALETTE11 0x0B
+#define ACT_ID_PALETTE12 0x0C
+#define ACT_ID_PALETTE13 0x0D
+#define ACT_ID_PALETTE14 0x0E
+#define ACT_ID_PALETTE15 0x0F
+#define ACT_ID_ATTR_MODE_CNTL 0x10
+#define ACT_ID_OVERSCAN_COLOR 0x11
+#define ACT_ID_COLOR_PLANE_ENA 0x12
+#define ACT_ID_HOR_PEL_PANNING 0x13
+#define ACT_ID_COLOR_SELECT 0x14
+#define ACT_ID_MISCELLANEOUS 0x16
+
+/* Graphics Controller: */
+#define GCT_ADDRESS 0x03CE
+#define GCT_ADDRESS_R 0x03CF
+#define GCT_ADDRESS_W 0x03CF
+#define GCT_ID_SET_RESET 0x00
+#define GCT_ID_ENABLE_SET_RESET 0x01
+#define GCT_ID_COLOR_COMPARE 0x02
+#define GCT_ID_DATA_ROTATE 0x03
+#define GCT_ID_READ_MAP_SELECT 0x04
+#define GCT_ID_GRAPHICS_MODE 0x05
+#define GCT_ID_MISC 0x06
+#define GCT_ID_COLOR_XCARE 0x07
+#define GCT_ID_BITMASK 0x08
+
+/* Sequencer: */
+#define SEQ_ADDRESS 0x03C4
+#define SEQ_ADDRESS_R 0x03C5
+#define SEQ_ADDRESS_W 0x03C5
+#define SEQ_ID_RESET 0x00
+#define SEQ_ID_CLOCKING_MODE 0x01
+#define SEQ_ID_MAP_MASK 0x02
+#define SEQ_ID_CHAR_MAP_SELECT 0x03
+#define SEQ_ID_MEMORY_MODE 0x04
+#define SEQ_ID_STATE_CONTROL 0x06
+#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
+*/
+
+/* CRT Controller: */
+#define CRT_ADDRESS 0x03D4
+#define CRT_ADDRESS_R 0x03D5
+#define CRT_ADDRESS_W 0x03D5
+#define CRT_ID_HOR_TOTAL 0x00
+#define CRT_ID_HOR_DISP_ENA_END 0x01
+#define CRT_ID_START_HOR_BLANK 0x02
+#define CRT_ID_END_HOR_BLANK 0x03
+#define CRT_ID_START_HOR_RETR 0x04
+#define CRT_ID_END_HOR_RETR 0x05
+#define CRT_ID_VER_TOTAL 0x06
+#define CRT_ID_OVERFLOW 0x07
+#define CRT_ID_PRESET_ROW_SCAN 0x08
+#define CRT_ID_MAX_ROW_ADDRESS 0x09
+#define CRT_ID_CURSOR_START 0x0A
+#define CRT_ID_CURSOR_END 0x0B
+#define CRT_ID_START_ADDR_HIGH 0x0C
+#define CRT_ID_START_ADDR_LOW 0x0D
+#define CRT_ID_CURSOR_LOC_HIGH 0x0E
+#define CRT_ID_CURSOR_LOC_LOW 0x0F
+#define CRT_ID_START_VER_RETR 0x10
+#define CRT_ID_END_VER_RETR 0x11
+#define CRT_ID_VER_DISP_ENA_END 0x12
+#define CRT_ID_OFFSET 0x13
+#define CRT_ID_UNDERLINE_LOC 0x14
+#define CRT_ID_START_VER_BLANK 0x15
+#define CRT_ID_END_VER_BLANK 0x16
+#define CRT_ID_MODE_CONTROL 0x17
+#define CRT_ID_LINE_COMPARE 0x18
+
+#define CRT_ID_SEGMENT_COMP 0x30
+#define CRT_ID_GENERAL_PURPOSE 0x31
+#define CRT_ID_RASCAS_CONFIG 0x32
+#define CTR_ID_EXT_START 0x33
+#define CRT_ID_6845_COMPAT 0x34
+#define CRT_ID_OVERFLOW_HIGH 0x35
+#define CRT_ID_VIDEO_CONFIG1 0x36
+#define CRT_ID_VIDEO_CONFIG2 0x37
+#define CRT_ID_HOR_OVERFLOW 0x3f
+
+/* IMAGE port */
+#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
+
+/* Pass-through */
+#define PASS_ADDRESS 0x8000
+#define PASS_ADDRESS_W 0x8000
+
+/* Video DAC */
+#define VDAC_ADDRESS 0x03c8
+#define VDAC_ADDRESS_W 0x03c8
+#define VDAC_ADDRESS_R 0x03c7
+#define VDAC_STATE 0x03c7
+#define VDAC_DATA 0x03c9
+#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 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)
+
+#define WSeq(ba, idx, val) \
+ do { vgaw(ba, SEQ_ADDRESS, idx); vgaw(ba, SEQ_ADDRESS_W , val); } while (0)
+
+#define WCrt(ba, idx, val) \
+ do { vgaw(ba, CRT_ADDRESS, idx); vgaw(ba, CRT_ADDRESS_W , val); } while (0)
+
+#define WIma(ba, idx, val) \
+ do { vgaw(ba, IMA_ADDRESS, idx); vgaw(ba, IMA_ADDRESS_W , val); } while (0)
+
+#define WAttr(ba, idx, val) \
+ do { \
+ if(vgar(ba, GREG_STATUS1_R));\
+ vgaw(ba, ACT_ADDRESS_W, idx);\
+ vgaw(ba, ACT_ADDRESS_W, val);\
+ } while (0)
+
+#define SetTextPlane(ba, m) \
+ do { \
+ WGfx(ba, GCT_ID_READ_MAP_SELECT, m & 3 );\
+ WSeq(ba, SEQ_ID_MAP_MASK, (1 << (m & 3)));\
+ } while (0)
+
+#define setMerlinDACmode(ba, mode) \
+ do { \
+ vgaw(ba, VDAC_MASK, mode | (vgar(ba, VDAC_MASK) & 0x0f));\
+ } while (0)
+
+/* Special wakeup/passthrough registers on graphics boards
+ *
+ * The methods have diverged a bit for each board, so
+ * WPass(P) has been converted into a set of specific
+ * 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);
+}
+
+
+static inline void RegOnpass(volatile void *ba) {
+ 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);
+}
+
+
+static inline void RegOffpass(volatile void *ba) {
+ 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);
+}
+
+static inline unsigned char RAttr(volatile void * ba, short idx) {
+ if(vgar(ba, GREG_STATUS1_R));
+ vgaw(ba, ACT_ADDRESS_W, idx);
+ return vgar (ba, ACT_ADDRESS_R);
+}
+
+static inline unsigned char RSeq(volatile void * ba, short idx) {
+ vgaw (ba, SEQ_ADDRESS, idx);
+ return vgar (ba, SEQ_ADDRESS_R);
+}
+
+static inline unsigned char RCrt(volatile void * ba, short idx) {
+ vgaw (ba, CRT_ADDRESS, idx);
+ return vgar (ba, CRT_ADDRESS_R);
+}
+
+static inline unsigned char RGfx(volatile void * ba, short idx) {
+ vgaw(ba, GCT_ADDRESS, idx);
+ return vgar (ba, GCT_ADDRESS_R);
+}
+
+int et_mode __P((register struct grf_softc *gp, u_long cmd, void *arg, u_long a2, int a3));
+int et_load_mon __P((struct grf_softc *gp, struct grfettext_mode *gv));
+int grfet_cnprobe __P((void));
+void grfet_iteinit __P((struct grf_softc *gp));
+
+#endif /* _GRF_ETREG_H */
diff --git a/sys/arch/amiga/dev/grf_rh.c b/sys/arch/amiga/dev/grf_rh.c
index aafc22f54d3..b24b5794a0d 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.6 1996/05/04 13:54:26 niklas Exp $ */
-/* $NetBSD: grf_rh.c,v 1.15 1996/05/01 09:59:26 veego Exp $ */
+/* $OpenBSD: grf_rh.c,v 1.7 1996/05/29 10:15:10 niklas Exp $ */
+/* $NetBSD: grf_rh.c,v 1.17 1996/05/19 21:05:37 veego Exp $ */
/*
* Copyright (c) 1994 Markus Wild
@@ -56,7 +56,7 @@ enum mode_type { MT_TXTONLY, MT_GFXONLY, MT_BOTH };
int rh_mondefok __P((struct MonDef *));
-u_short CompFQ __P((u_int fq));
+u_short rh_CompFQ __P((u_int fq));
int rh_load_mon __P((struct grf_softc *gp, struct MonDef *md));
int rh_getvmode __P((struct grf_softc *gp, struct grfvideo_mode *vm));
int rh_setvmode __P((struct grf_softc *gp, unsigned int mode,
@@ -664,7 +664,7 @@ RZ3SetHWCloc (gp, x, y)
}
u_short
-CompFQ(fq)
+rh_CompFQ(fq)
u_int fq;
{
/* yuck... this sure could need some explanation.. */
@@ -722,15 +722,15 @@ rh_mondefok(mdp)
struct MonDef *mdp;
{
switch(mdp->DEP) {
- case 8:
- case 16:
- case 24:
+ case 8:
+ case 16:
+ case 24:
return(1);
- case 4:
+ case 4:
if (mdp->FX == 4 || (mdp->FX >= 7 && mdp->FX <= 16))
return(1);
/*FALLTHROUGH*/
- default:
+ default:
return(0);
}
}
@@ -788,40 +788,40 @@ rh_load_mon(gp, md)
FW =0;
if (md->DEP == 4) { /* XXX some text-mode! */
switch (md->FX) {
- case 4:
+ case 4:
FW = 0;
break;
- case 7:
+ case 7:
FW = 1;
break;
- case 8:
+ case 8:
FW = 2;
break;
- case 9:
+ case 9:
FW = 3;
break;
- case 10:
+ case 10:
FW = 4;
break;
- case 11:
+ case 11:
FW = 5;
break;
- case 12:
+ case 12:
FW = 6;
break;
- case 13:
+ case 13:
FW = 7;
break;
- case 14:
+ case 14:
FW = 8;
break;
- case 15:
+ case 15:
FW = 9;
break;
- case 16:
+ case 16:
FW = 11;
break;
- default:
+ default:
return(0);
break;
}
@@ -1003,9 +1003,9 @@ rh_load_mon(gp, md)
WCrt(ba, CRT_ID_MONITOR_POWER, 0x00);
{
- unsigned short tmp = CompFQ(md->FQ);
+ unsigned short tmp = rh_CompFQ(md->FQ);
WPLL(ba, 2 , tmp);
- tmp = CompFQ(rh_memclk);
+ tmp = rh_CompFQ(rh_memclk);
WPLL(ba,10 , tmp);
WPLL(ba,14 , 0x22);
}
@@ -1494,6 +1494,12 @@ grfrhattach(pdp, dp, auxp)
(char *)&gp[1] - (char *)&gp->g_display);
} else {
gp->g_regkva = (volatile caddr_t)zap->va;
+
+ gp->g_regkva[0x3c8]=0;
+ gp->g_regkva[0x3c9]=30;
+ gp->g_regkva[0x3c9]=30;
+ gp->g_regkva[0x3c9]=00;
+
gp->g_fbkva = (volatile caddr_t)zap->va + LM_OFFSET;
gp->g_unit = GRF_RETINAIII_UNIT;
gp->g_mode = rh_mode;
@@ -1617,38 +1623,38 @@ rh_mode(gp, cmd, arg, a2, a3)
int a3;
{
switch (cmd) {
- case GM_GRFON:
+ case GM_GRFON:
rh_setvmode (gp, rh_default_gfx + 1, MT_GFXONLY);
return(0);
- case GM_GRFOFF:
+ case GM_GRFOFF:
rh_setvmode (gp, rh_default_mon + 1, MT_TXTONLY);
return(0);
- case GM_GRFCONFIG:
+ case GM_GRFCONFIG:
return(0);
- case GM_GRFGETVMODE:
+ case GM_GRFGETVMODE:
return(rh_getvmode (gp, (struct grfvideo_mode *) arg));
- case GM_GRFSETVMODE:
+ case GM_GRFSETVMODE:
return(rh_setvmode (gp, *(unsigned *) arg,
(gp->g_flags & GF_GRFON) ? MT_GFXONLY : MT_TXTONLY));
- case GM_GRFGETNUMVM:
+ case GM_GRFGETNUMVM:
*(int *)arg = rh_mon_max;
return(0);
#ifdef BANKEDDEVPAGER
- case GM_GRFGETBANK:
- case GM_GRFGETCURBANK:
- case GM_GRFSETBANK:
+ case GM_GRFGETBANK:
+ case GM_GRFGETCURBANK:
+ case GM_GRFSETBANK:
return(EINVAL);
#endif
- case GM_GRFIOCTL:
+ case GM_GRFIOCTL:
return(rh_ioctl (gp, a2, arg));
- default:
+ default:
break;
}
@@ -1662,29 +1668,32 @@ rh_ioctl (gp, cmd, data)
void *data;
{
switch (cmd) {
- case GRFIOCGSPRITEPOS:
+ case GRFIOCGSPRITEPOS:
return(rh_getspritepos (gp, (struct grf_position *) data));
- case GRFIOCSSPRITEPOS:
+ case GRFIOCSSPRITEPOS:
return(rh_setspritepos (gp, (struct grf_position *) data));
- case GRFIOCSSPRITEINF:
+ case GRFIOCSSPRITEINF:
return(rh_setspriteinfo (gp, (struct grf_spriteinfo *) data));
- case GRFIOCGSPRITEINF:
+ case GRFIOCGSPRITEINF:
return(rh_getspriteinfo (gp, (struct grf_spriteinfo *) data));
- case GRFIOCGSPRITEMAX:
+ case GRFIOCGSPRITEMAX:
return(rh_getspritemax (gp, (struct grf_position *) data));
- case GRFIOCGETCMAP:
+ case GRFIOCGETCMAP:
return(rh_getcmap (gp, (struct grf_colormap *) data));
- case GRFIOCPUTCMAP:
+ case GRFIOCPUTCMAP:
return(rh_putcmap (gp, (struct grf_colormap *) data));
- case GRFIOCBITBLT:
+ case GRFIOCBITBLT:
return(rh_bitblt (gp, (struct grf_bitblt *) data));
+
+ case GRFIOCBLANK:
+ return (rh_blank(gp, (int *)data));
}
return(EINVAL);
@@ -2048,4 +2057,21 @@ rh_bitblt (gp, bb)
return(0);
}
+
+
+int
+rh_blank(gp, on)
+ struct grf_softc *gp;
+ int *on;
+{
+ int r;
+
+ r = RSeq(gp->g_regkva, SEQ_ID_CLOCKING_MODE);
+ r &= 0xdf; /* set Bit 5 to 0 */
+
+ WSeq(gp->g_regkva, SEQ_ID_CLOCKING_MODE, r | (*on ? 0x00 : 0x20));
+
+ return(0);
+}
+
#endif /* NGRF */
diff --git a/sys/arch/amiga/dev/grf_rhreg.h b/sys/arch/amiga/dev/grf_rhreg.h
index 9e47b1d000c..d4dd0d0526f 100644
--- a/sys/arch/amiga/dev/grf_rhreg.h
+++ b/sys/arch/amiga/dev/grf_rhreg.h
@@ -1,5 +1,5 @@
-/* $OpenBSD: grf_rhreg.h,v 1.2 1996/05/02 06:43:49 niklas Exp $ */
-/* $NetBSD: grf_rhreg.h,v 1.6 1996/04/21 21:11:19 veego Exp $ */
+/* $OpenBSD: grf_rhreg.h,v 1.3 1996/05/29 10:15:13 niklas Exp $ */
+/* $NetBSD: grf_rhreg.h,v 1.7 1996/05/19 21:05:41 veego Exp $ */
/*
* Copyright (c) 1994 Markus Wild
@@ -695,6 +695,7 @@ int rh_getspriteinfo __P((struct grf_softc *gp, struct grf_spriteinfo *info));
int rh_setspriteinfo __P((struct grf_softc *gp, struct grf_spriteinfo *info));
int rh_getspritemax __P((struct grf_softc *gp, struct grf_position *pos));
int rh_bitblt __P((struct grf_softc *gp, struct grf_bitblt *bb));
+int rh_blank __P((struct grf_softc *, int *));
struct ite_softc;
void rh_init __P((struct ite_softc *));
diff --git a/sys/arch/amiga/dev/grf_rt.c b/sys/arch/amiga/dev/grf_rt.c
index a398ab52fd4..0a28eed7381 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.5 1996/05/04 13:54:29 niklas Exp $ */
-/* $NetBSD: grf_rt.c,v 1.26 1996/05/01 09:59:28 veego Exp $ */
+/* $OpenBSD: grf_rt.c,v 1.6 1996/05/29 10:15:15 niklas Exp $ */
+/* $NetBSD: grf_rt.c,v 1.27 1996/05/19 21:05:45 veego Exp $ */
/*
* Copyright (c) 1993 Markus Wild
@@ -305,40 +305,40 @@ rt_load_mon(gp, md)
FW = 0;
if (md->DEP == 4) {
switch (md->FX) {
- case 4:
+ case 4:
FW = 0;
break;
- case 7:
+ case 7:
FW = 1;
break;
- case 8:
+ case 8:
FW = 2;
break;
- case 9:
+ case 9:
FW = 3;
break;
- case 10:
+ case 10:
FW = 4;
break;
- case 11:
+ case 11:
FW = 5;
break;
- case 12:
+ case 12:
FW = 6;
break;
- case 13:
+ case 13:
FW = 7;
break;
- case 14:
+ case 14:
FW = 8;
break;
- case 15:
+ case 15:
FW = 9;
break;
- case 16:
+ case 16:
FW = 11;
break;
- default:
+ default:
return(0);
break;
};
@@ -456,111 +456,111 @@ rt_load_mon(gp, md)
WCrt (ba, CRT_ID_PRESET_ROW_SCAN, 0x00);
if (md->DEP == 4) {
- WCrt (ba, CRT_ID_MAX_SCAN_LINE, (( (md->FLG & MDF_DBL)/ MDF_DBL * 0x80)
- | 0x40
- | ((md->VBS & 0x200)/0x200 * 0x20)
- | ((md->FY-1) & 0x1f)));
+ WCrt (ba, CRT_ID_MAX_SCAN_LINE, (( (md->FLG & MDF_DBL)/ MDF_DBL * 0x80)
+ | 0x40
+ | ((md->VBS & 0x200)/0x200 * 0x20)
+ | ((md->FY-1) & 0x1f)));
}
else {
- WCrt (ba, CRT_ID_MAX_SCAN_LINE, (( (md->FLG & MDF_DBL)/ MDF_DBL * 0x80)
- | 0x40
- | ((md->VBS & 0x200)/0x200 * 0x20)
- | (0 & 0x1f)));
+ WCrt (ba, CRT_ID_MAX_SCAN_LINE, (( (md->FLG & MDF_DBL)/ MDF_DBL * 0x80)
+ | 0x40
+ | ((md->VBS & 0x200)/0x200 * 0x20)
+ | (0 & 0x1f)));
}
- WCrt (ba, CRT_ID_CURSOR_START, (md->FY & 0x1f) - 2);
- WCrt (ba, CRT_ID_CURSOR_END, (md->FY & 0x1f) - 1);
+ WCrt (ba, CRT_ID_CURSOR_START, (md->FY & 0x1f) - 2);
+ WCrt (ba, CRT_ID_CURSOR_END, (md->FY & 0x1f) - 1);
- WCrt (ba, CRT_ID_START_ADDR_HIGH, 0x00);
- WCrt (ba, CRT_ID_START_ADDR_LOW, 0x00);
+ WCrt (ba, CRT_ID_START_ADDR_HIGH, 0x00);
+ WCrt (ba, CRT_ID_START_ADDR_LOW, 0x00);
- WCrt (ba, CRT_ID_CURSOR_LOC_HIGH, 0x00);
- WCrt (ba, CRT_ID_CURSOR_LOC_LOW, 0x00);
+ WCrt (ba, CRT_ID_CURSOR_LOC_HIGH, 0x00);
+ WCrt (ba, CRT_ID_CURSOR_LOC_LOW, 0x00);
- WCrt (ba, CRT_ID_START_VER_RETR, md->VSS & 0xff);
- WCrt (ba, CRT_ID_END_VER_RETR, (md->VSE & 0x0f) | 0x80 | 0x20);
- WCrt (ba, CRT_ID_VER_DISP_ENA_END, VDE & 0xff);
+ WCrt (ba, CRT_ID_START_VER_RETR, md->VSS & 0xff);
+ WCrt (ba, CRT_ID_END_VER_RETR, (md->VSE & 0x0f) | 0x80 | 0x20);
+ WCrt (ba, CRT_ID_VER_DISP_ENA_END, VDE & 0xff);
if (md->DEP == 4)
- WCrt (ba, CRT_ID_OFFSET, (HDE / 2) & 0xff);
+ WCrt (ba, CRT_ID_OFFSET, (HDE / 2) & 0xff);
else
- WCrt (ba, CRT_ID_OFFSET, (md->TX / 8) & 0xff);
+ WCrt (ba, CRT_ID_OFFSET, (md->TX / 8) & 0xff);
- WCrt (ba, CRT_ID_UNDERLINE_LOC, (md->FY-1) & 0x1f);
- WCrt (ba, CRT_ID_START_VER_BLANK, md->VBS & 0xff);
- WCrt (ba, CRT_ID_END_VER_BLANK, md->VBE & 0xff);
+ WCrt (ba, CRT_ID_UNDERLINE_LOC, (md->FY-1) & 0x1f);
+ WCrt (ba, CRT_ID_START_VER_BLANK, md->VBS & 0xff);
+ WCrt (ba, CRT_ID_END_VER_BLANK, md->VBE & 0xff);
/* byte mode + wrap + select row scan counter + cms */
- WCrt (ba, CRT_ID_MODE_CONTROL, 0xe3);
- WCrt (ba, CRT_ID_LINE_COMPARE, 0xff);
+ WCrt (ba, CRT_ID_MODE_CONTROL, 0xe3);
+ WCrt (ba, CRT_ID_LINE_COMPARE, 0xff);
/* enable extended end bits + those bits */
- WCrt (ba, CRT_ID_EXT_HOR_TIMING1, ( 0x20
- | ((md->FLG & MDF_LACE) / MDF_LACE * 0x10)
- | ((md->HT & 0x100) / 0x100 * 0x01)
- | (((HDE-1) & 0x100) / 0x100 * 0x02)
- | ((md->HBS & 0x100) / 0x100 * 0x04)
- | ((md->HSS & 0x100) / 0x100 * 0x08)));
-
+ WCrt (ba, CRT_ID_EXT_HOR_TIMING1, ( 0x20
+ | ((md->FLG & MDF_LACE) / MDF_LACE * 0x10)
+ | ((md->HT & 0x100) / 0x100 * 0x01)
+ | (((HDE-1) & 0x100) / 0x100 * 0x02)
+ | ((md->HBS & 0x100) / 0x100 * 0x04)
+ | ((md->HSS & 0x100) / 0x100 * 0x08)));
+
if (md->DEP == 4)
- WCrt (ba, CRT_ID_EXT_START_ADDR, (((HDE / 2) & 0x100)/0x100 * 16));
+ WCrt (ba, CRT_ID_EXT_START_ADDR, (((HDE / 2) & 0x100)/0x100 * 16));
else
- WCrt (ba, CRT_ID_EXT_START_ADDR, (((md->TX / 8) & 0x100)/0x100 * 16));
+ WCrt (ba, CRT_ID_EXT_START_ADDR, (((md->TX / 8) & 0x100)/0x100 * 16));
- WCrt (ba, CRT_ID_EXT_HOR_TIMING2, ( ((md->HT & 0x200)/ 0x200 * 0x01)
- | (((HDE-1) & 0x200)/ 0x200 * 0x02)
- | ((md->HBS & 0x200)/ 0x200 * 0x04)
- | ((md->HSS & 0x200)/ 0x200 * 0x08)
- | ((md->HBE & 0xc0) / 0x40 * 0x10)
- | ((md->HSE & 0x60) / 0x20 * 0x40)));
-
- WCrt (ba, CRT_ID_EXT_VER_TIMING, ( ((md->VSE & 0x10) / 0x10 * 0x80)
- | ((md->VBE & 0x300)/ 0x100 * 0x20)
- | 0x10
- | ((md->VSS & 0x400)/ 0x400 * 0x08)
- | ((md->VBS & 0x400)/ 0x400 * 0x04)
- | ((VDE & 0x400)/ 0x400 * 0x02)
- | ((md->VT & 0x400)/ 0x400 * 0x01)));
-
- WGfx (ba, GCT_ID_SET_RESET, 0x00);
- WGfx (ba, GCT_ID_ENABLE_SET_RESET, 0x00);
- WGfx (ba, GCT_ID_COLOR_COMPARE, 0x00);
- WGfx (ba, GCT_ID_DATA_ROTATE, 0x00);
- WGfx (ba, GCT_ID_READ_MAP_SELECT, 0x00);
- WGfx (ba, GCT_ID_GRAPHICS_MODE, 0x00);
+ WCrt (ba, CRT_ID_EXT_HOR_TIMING2, ( ((md->HT & 0x200)/ 0x200 * 0x01)
+ | (((HDE-1) & 0x200)/ 0x200 * 0x02)
+ | ((md->HBS & 0x200)/ 0x200 * 0x04)
+ | ((md->HSS & 0x200)/ 0x200 * 0x08)
+ | ((md->HBE & 0xc0) / 0x40 * 0x10)
+ | ((md->HSE & 0x60) / 0x20 * 0x40)));
+
+ WCrt (ba, CRT_ID_EXT_VER_TIMING, ( ((md->VSE & 0x10) / 0x10 * 0x80)
+ | ((md->VBE & 0x300)/ 0x100 * 0x20)
+ | 0x10
+ | ((md->VSS & 0x400)/ 0x400 * 0x08)
+ | ((md->VBS & 0x400)/ 0x400 * 0x04)
+ | ((VDE & 0x400)/ 0x400 * 0x02)
+ | ((md->VT & 0x400)/ 0x400 * 0x01)));
+
+ WGfx (ba, GCT_ID_SET_RESET, 0x00);
+ WGfx (ba, GCT_ID_ENABLE_SET_RESET, 0x00);
+ WGfx (ba, GCT_ID_COLOR_COMPARE, 0x00);
+ WGfx (ba, GCT_ID_DATA_ROTATE, 0x00);
+ WGfx (ba, GCT_ID_READ_MAP_SELECT, 0x00);
+ WGfx (ba, GCT_ID_GRAPHICS_MODE, 0x00);
if (md->DEP == 4)
- WGfx (ba, GCT_ID_MISC, 0x04);
+ WGfx (ba, GCT_ID_MISC, 0x04);
else
- WGfx (ba, GCT_ID_MISC, 0x05);
- WGfx (ba, GCT_ID_COLOR_XCARE, 0xff);
- WGfx (ba, GCT_ID_BITMASK, 0xff);
+ WGfx (ba, GCT_ID_MISC, 0x05);
+ WGfx (ba, GCT_ID_COLOR_XCARE, 0xff);
+ WGfx (ba, GCT_ID_BITMASK, 0xff);
/* reset the Attribute Controller flipflop */
vgar (ba, GREG_STATUS1_R);
- WAttr (ba, ACT_ID_PALETTE0, 0x00);
- WAttr (ba, ACT_ID_PALETTE1, 0x01);
- WAttr (ba, ACT_ID_PALETTE2, 0x02);
- WAttr (ba, ACT_ID_PALETTE3, 0x03);
- WAttr (ba, ACT_ID_PALETTE4, 0x04);
- WAttr (ba, ACT_ID_PALETTE5, 0x05);
- WAttr (ba, ACT_ID_PALETTE6, 0x06);
- WAttr (ba, ACT_ID_PALETTE7, 0x07);
- WAttr (ba, ACT_ID_PALETTE8, 0x08);
- WAttr (ba, ACT_ID_PALETTE9, 0x09);
- WAttr (ba, ACT_ID_PALETTE10, 0x0a);
- WAttr (ba, ACT_ID_PALETTE11, 0x0b);
- WAttr (ba, ACT_ID_PALETTE12, 0x0c);
- WAttr (ba, ACT_ID_PALETTE13, 0x0d);
- WAttr (ba, ACT_ID_PALETTE14, 0x0e);
- WAttr (ba, ACT_ID_PALETTE15, 0x0f);
+ WAttr (ba, ACT_ID_PALETTE0, 0x00);
+ WAttr (ba, ACT_ID_PALETTE1, 0x01);
+ WAttr (ba, ACT_ID_PALETTE2, 0x02);
+ WAttr (ba, ACT_ID_PALETTE3, 0x03);
+ WAttr (ba, ACT_ID_PALETTE4, 0x04);
+ WAttr (ba, ACT_ID_PALETTE5, 0x05);
+ WAttr (ba, ACT_ID_PALETTE6, 0x06);
+ WAttr (ba, ACT_ID_PALETTE7, 0x07);
+ WAttr (ba, ACT_ID_PALETTE8, 0x08);
+ WAttr (ba, ACT_ID_PALETTE9, 0x09);
+ WAttr (ba, ACT_ID_PALETTE10, 0x0a);
+ WAttr (ba, ACT_ID_PALETTE11, 0x0b);
+ WAttr (ba, ACT_ID_PALETTE12, 0x0c);
+ WAttr (ba, ACT_ID_PALETTE13, 0x0d);
+ WAttr (ba, ACT_ID_PALETTE14, 0x0e);
+ WAttr (ba, ACT_ID_PALETTE15, 0x0f);
vgar (ba, GREG_STATUS1_R);
if (md->DEP == 4)
- WAttr (ba, ACT_ID_ATTR_MODE_CNTL, 0x08);
+ WAttr (ba, ACT_ID_ATTR_MODE_CNTL, 0x08);
else
- WAttr (ba, ACT_ID_ATTR_MODE_CNTL, 0x09);
+ WAttr (ba, ACT_ID_ATTR_MODE_CNTL, 0x09);
- WAttr (ba, ACT_ID_OVERSCAN_COLOR, 0x00);
- WAttr (ba, ACT_ID_COLOR_PLANE_ENA, 0x0f);
- WAttr (ba, ACT_ID_HOR_PEL_PANNING, 0x00);
+ WAttr (ba, ACT_ID_OVERSCAN_COLOR, 0x00);
+ WAttr (ba, ACT_ID_COLOR_PLANE_ENA, 0x0f);
+ WAttr (ba, ACT_ID_HOR_PEL_PANNING, 0x00);
WAttr (ba, ACT_ID_COLOR_SELECT, 0x00);
vgar (ba, GREG_STATUS1_R);
@@ -588,9 +588,9 @@ rt_load_mon(gp, md)
registers, thus it works similar to the WD33C93
select/data mechanism */
vgaw (ba, VDAC_REG_SELECT, 0x00);
-
+
{
-
+
short x = 15;
const unsigned char * col = md->PAL;
do {
@@ -779,6 +779,7 @@ int rt_getspritemax __P((struct grf_softc *, struct grf_position *));
int rt_getcmap __P((struct grf_softc *, struct grf_colormap *));
int rt_putcmap __P((struct grf_softc *, struct grf_colormap *));
int rt_bitblt __P((struct grf_softc *, struct grf_bitblt *));
+int rt_blank __P((struct grf_softc *, int *));
struct cfattach grfrt_ca = {
sizeof(struct grf_softc), grfrtmatch, grfrtattach
@@ -901,82 +902,82 @@ grfrtprint(auxp, pnp)
static int
rt_getvmode (gp, vm)
- struct grf_softc *gp;
- struct grfvideo_mode *vm;
+ struct grf_softc *gp;
+ struct grfvideo_mode *vm;
{
- struct MonDef *md;
+ struct MonDef *md;
- if (vm->mode_num && vm->mode_num > retina_mon_max)
- return EINVAL;
+ if (vm->mode_num && vm->mode_num > retina_mon_max)
+ return (EINVAL);
+
+ if (! vm->mode_num)
+ vm->mode_num = (current_mon - monitor_defs) + 1;
+
+ md = monitor_defs + (vm->mode_num - 1);
+ strncpy (vm->mode_descr, monitor_descr[vm->mode_num - 1],
+ sizeof (vm->mode_descr));
+ vm->pixel_clock = md->FQ;
+ vm->disp_width = md->MW;
+ vm->disp_height = md->MH;
+ vm->depth = md->DEP;
+
+ /*
+ * From observation of the monitor definition table above, I guess that
+ * the horizontal timings are in units of longwords. Hence, I get the
+ * pixels by multiplication with 32 and division by the depth.
+ * The text modes, apparently marked by depth == 4, are even more wierd.
+ * According to a comment above, they are computed from a depth==8 mode
+ * (thats for us: * 32 / 8) by applying another factor of 4 / font width.
+ * Reverse applying the latter formula most of the constants cancel
+ * themselves and we are left with a nice (* font width).
+ * That is, internal timings are in units of longwords for graphics
+ * modes, or in units of characters widths for text modes.
+ * We better don't WRITE modes until this has been real live checked.
+ * - Ignatios Souvatzis
+ */
- if (! vm->mode_num)
- vm->mode_num = (current_mon - monitor_defs) + 1;
-
- md = monitor_defs + (vm->mode_num - 1);
- strncpy (vm->mode_descr, monitor_descr[vm->mode_num - 1],
- sizeof (vm->mode_descr));
- vm->pixel_clock = md->FQ;
- vm->disp_width = md->MW;
- vm->disp_height = md->MH;
- vm->depth = md->DEP;
-
- /*
- * From observation of the monitor definition table above, I guess that
- * the horizontal timings are in units of longwords. Hence, I get the
- * pixels by multiplication with 32 and division by the depth.
- * The text modes, apparently marked by depth == 4, are even more wierd.
- * According to a comment above, they are computed from a depth==8 mode
- * (thats for us: * 32 / 8) by applying another factor of 4 / font width.
- * Reverse applying the latter formula most of the constants cancel
- * themselves and we are left with a nice (* font width).
- * That is, internal timings are in units of longwords for graphics
- * modes, or in units of characters widths for text modes.
- * We better don't WRITE modes until this has been real live checked.
- * - Ignatios Souvatzis
- */
-
- if (md->DEP == 4) {
- vm->hblank_start = md->HBS * 32 / md->DEP;
- vm->hblank_stop = md->HBE * 32 / md->DEP;
- vm->hsync_start = md->HSS * 32 / md->DEP;
- vm->hsync_stop = md->HSE * 32 / md->DEP;
- vm->htotal = md->HT * 32 / md->DEP;
- } else {
- vm->hblank_start = md->HBS * md->FX;
- vm->hblank_stop = md->HBE * md->FX;
- vm->hsync_start = md->HSS * md->FX;
- vm->hsync_stop = md->HSE * md->FX;
- vm->htotal = md->HT * md->FX;
- }
- vm->vblank_start = md->VBS;
- vm->vblank_stop = md->VBE;
- vm->vsync_start = md->VSS;
- vm->vsync_stop = md->VSE;
- vm->vtotal = md->VT;
-
- return 0;
+ if (md->DEP == 4) {
+ vm->hblank_start = md->HBS * 32 / md->DEP;
+ vm->hblank_stop = md->HBE * 32 / md->DEP;
+ vm->hsync_start = md->HSS * 32 / md->DEP;
+ vm->hsync_stop = md->HSE * 32 / md->DEP;
+ vm->htotal = md->HT * 32 / md->DEP;
+ } else {
+ vm->hblank_start = md->HBS * md->FX;
+ vm->hblank_stop = md->HBE * md->FX;
+ vm->hsync_start = md->HSS * md->FX;
+ vm->hsync_stop = md->HSE * md->FX;
+ vm->htotal = md->HT * md->FX;
+ }
+ vm->vblank_start = md->VBS;
+ vm->vblank_stop = md->VBE;
+ vm->vsync_start = md->VSS;
+ vm->vsync_stop = md->VSE;
+ vm->vtotal = md->VT;
+
+ return (0);
}
static int
rt_setvmode (gp, mode, txtonly)
- struct grf_softc *gp;
- unsigned mode;
- int txtonly;
+ struct grf_softc *gp;
+ unsigned mode;
+ int txtonly;
{
- int error;
+ int error;
- if (!mode || mode > retina_mon_max)
- return EINVAL;
+ if (!mode || mode > retina_mon_max)
+ return (EINVAL);
- if (txtonly && monitor_defs[mode-1].DEP == 8)
- return EINVAL;
+ if (txtonly && monitor_defs[mode-1].DEP == 8)
+ return (EINVAL);
- current_mon = monitor_defs + (mode - 1);
+ current_mon = monitor_defs + (mode - 1);
- error = rt_load_mon (gp, current_mon) ? 0 : EINVAL;
+ error = rt_load_mon (gp, current_mon) ? 0 : EINVAL;
- return error;
+ return (error);
}
@@ -992,51 +993,50 @@ rt_mode(gp, cmd, arg, a2, a3)
u_long a2;
int a3;
{
- /* implement these later... */
+ /* implement these later... */
- switch (cmd)
- {
- case GM_GRFON:
- rt_setvmode (gp, retina_default_gfx + 1, 0);
- return 0;
+ switch (cmd) {
+ case GM_GRFON:
+ rt_setvmode (gp, retina_default_gfx + 1, 0);
+ return (0);
- case GM_GRFOFF:
- rt_setvmode (gp, retina_default_mon + 1, 0);
- return 0;
+ case GM_GRFOFF:
+ rt_setvmode (gp, retina_default_mon + 1, 0);
+ return (0);
- case GM_GRFCONFIG:
- return 0;
+ case GM_GRFCONFIG:
+ return (0);
- case GM_GRFGETVMODE:
- return rt_getvmode (gp, (struct grfvideo_mode *) arg);
+ case GM_GRFGETVMODE:
+ return (rt_getvmode (gp, (struct grfvideo_mode *) arg));
- case GM_GRFSETVMODE:
- return rt_setvmode (gp, *(unsigned *) arg, 1);
+ case GM_GRFSETVMODE:
+ return (rt_setvmode (gp, *(unsigned *) arg, 1));
- case GM_GRFGETNUMVM:
- *(int *)arg = retina_mon_max;
- return 0;
+ case GM_GRFGETNUMVM:
+ *(int *)arg = retina_mon_max;
+ return (0);
#ifdef BANKEDDEVPAGER
- case GM_GRFGETBANK:
- *(int *)arg = rt_getbank (gp, a2, a3);
- return 0;
+ case GM_GRFGETBANK:
+ *(int *)arg = rt_getbank (gp, a2, a3);
+ return (0);
- case GM_GRFGETCURBANK:
- *(int *)arg = rt_getcurbank (gp);
- return 0;
+ case GM_GRFGETCURBANK:
+ *(int *)arg = rt_getcurbank (gp);
+ return (0);
- case GM_GRFSETBANK:
- return rt_setbank (gp, arg);
+ case GM_GRFSETBANK:
+ return (rt_setbank (gp, arg));
#endif
- case GM_GRFIOCTL:
- return rt_ioctl (gp, a2, arg);
+ case GM_GRFIOCTL:
+ return (rt_ioctl (gp, a2, arg));
- default:
- break;
- }
-
- return EINVAL;
+ default:
+ break;
+ }
+
+ return (EINVAL);
}
int
@@ -1045,34 +1045,36 @@ rt_ioctl (gp, cmd, data)
u_long cmd;
void *data;
{
- switch (cmd)
- {
- case GRFIOCGSPRITEPOS:
- return rt_getspritepos (gp, (struct grf_position *) data);
+ switch (cmd) {
+ case GRFIOCGSPRITEPOS:
+ return (rt_getspritepos (gp, (struct grf_position *) data));
- case GRFIOCSSPRITEPOS:
- return rt_setspritepos (gp, (struct grf_position *) data);
+ case GRFIOCSSPRITEPOS:
+ return (rt_setspritepos (gp, (struct grf_position *) data));
- case GRFIOCSSPRITEINF:
- return rt_setspriteinfo (gp, (struct grf_spriteinfo *) data);
+ case GRFIOCSSPRITEINF:
+ return (rt_setspriteinfo (gp, (struct grf_spriteinfo *) data));
- case GRFIOCGSPRITEINF:
- return rt_getspriteinfo (gp, (struct grf_spriteinfo *) data);
+ case GRFIOCGSPRITEINF:
+ return (rt_getspriteinfo (gp, (struct grf_spriteinfo *) data));
- case GRFIOCGSPRITEMAX:
- return rt_getspritemax (gp, (struct grf_position *) data);
+ case GRFIOCGSPRITEMAX:
+ return (rt_getspritemax (gp, (struct grf_position *) data));
- case GRFIOCGETCMAP:
- return rt_getcmap (gp, (struct grf_colormap *) data);
+ case GRFIOCGETCMAP:
+ return (rt_getcmap (gp, (struct grf_colormap *) data));
- case GRFIOCPUTCMAP:
- return rt_putcmap (gp, (struct grf_colormap *) data);
+ case GRFIOCPUTCMAP:
+ return (rt_putcmap (gp, (struct grf_colormap *) data));
- case GRFIOCBITBLT:
- return rt_bitblt (gp, (struct grf_bitblt *) data);
- }
+ case GRFIOCBITBLT:
+ return (rt_bitblt (gp, (struct grf_bitblt *) data));
+
+ case GRFIOCBLANK:
+ return (rt_blank(gp, (int *)data));
+ }
- return EINVAL;
+ return (EINVAL);
}
#ifdef BANKEDDEVPAGER
@@ -1082,293 +1084,293 @@ rt_ioctl (gp, cmd, data)
int
rt_getbank (gp, offs, prot)
- struct grf_softc *gp;
- u_long offs;
- int prot;
+ struct grf_softc *gp;
+ u_long offs;
+ int prot;
{
- /* XXX */
- if (offs < 0 || offs >= 4*1024*1024)
- return -1;
- else
- return offs >> 16;
+ /* XXX */
+ if (offs < 0 || offs >= 4*1024*1024)
+ return (-1);
+ else
+ return (offs >> 16);
}
+
int
rt_getcurbank (gp)
- struct grf_softc *gp;
+ struct grf_softc *gp;
{
- struct grfinfo *gi = &gp->g_display;
- volatile unsigned char *ba;
- int bank;
+ struct grfinfo *gi = &gp->g_display;
+ volatile unsigned char *ba;
+ int bank;
- ba = gp->g_regkva;
- bank = RSeq (ba, SEQ_ID_PRIM_HOST_OFF_LO) | (RSeq (ba, SEQ_ID_PRIM_HOST_OFF_HI) << 8);
+ ba = gp->g_regkva;
+ bank = RSeq (ba, SEQ_ID_PRIM_HOST_OFF_LO) |
+ (RSeq (ba, SEQ_ID_PRIM_HOST_OFF_HI) << 8);
- /* bank register is multiple of 64 byte, make this multiple of 64k */
- bank >>= 10;
- return bank;
+ /* bank register is multiple of 64 byte, make this multiple of 64k */
+ bank >>= 10;
+ return (bank);
}
+
int
rt_setbank (gp, bank)
- struct grf_softc *gp;
- int bank;
+ struct grf_softc *gp;
+ int bank;
{
- volatile unsigned char *ba;
+ volatile unsigned char *ba;
- ba = gp->g_regkva;
- /* bank register is multiple of 64 byte, make this multiple of 64k */
- bank <<= 10;
- WSeq (ba, SEQ_ID_PRIM_HOST_OFF_LO, (unsigned char) bank);
- bank >>= 8;
- WSeq (ba, SEQ_ID_PRIM_HOST_OFF_HI, (unsigned char) bank);
+ ba = gp->g_regkva;
+ /* bank register is multiple of 64 byte, make this multiple of 64k */
+ bank <<= 10;
+ WSeq (ba, SEQ_ID_PRIM_HOST_OFF_LO, (unsigned char) bank);
+ bank >>= 8;
+ WSeq (ba, SEQ_ID_PRIM_HOST_OFF_HI, (unsigned char) bank);
- return 0;
+ return (0);
}
-#endif
+#endif /* BANKEDDEVPAGER */
+
int
rt_getcmap (gfp, cmap)
- struct grf_softc *gfp;
- struct grf_colormap *cmap;
+ struct grf_softc *gfp;
+ struct grf_colormap *cmap;
{
- volatile unsigned char *ba;
- u_char red[256], green[256], blue[256], *rp, *gp, *bp;
- short x;
- int error;
-
- if (cmap->count == 0 || cmap->index >= 256)
- return 0;
-
- if (cmap->index + cmap->count > 256)
- cmap->count = 256 - cmap->index;
-
- ba = gfp->g_regkva;
- /* first read colors out of the chip, then copyout to userspace */
- vgaw (ba, VDAC_REG_SELECT, cmap->index);
- x = cmap->count - 1;
- rp = red + cmap->index;
- gp = green + cmap->index;
- bp = blue + cmap->index;
- do
- {
- *rp++ = vgar (ba, VDAC_REG_DATA);
- *gp++ = vgar (ba, VDAC_REG_DATA);
- *bp++ = vgar (ba, VDAC_REG_DATA);
- }
- while (x--);
+ volatile unsigned char *ba;
+ u_char red[256], green[256], blue[256], *rp, *gp, *bp;
+ short x;
+ int error;
+
+ if (cmap->count == 0 || cmap->index >= 256)
+ return (0);
+
+ if (cmap->index + cmap->count > 256)
+ cmap->count = 256 - cmap->index;
+
+ ba = gfp->g_regkva;
+ /* first read colors out of the chip, then copyout to userspace */
+ vgaw (ba, VDAC_REG_SELECT, cmap->index);
+ x = cmap->count - 1;
+ rp = red + cmap->index;
+ gp = green + cmap->index;
+ bp = blue + cmap->index;
+ do {
+ *rp++ = vgar (ba, VDAC_REG_DATA);
+ *gp++ = vgar (ba, VDAC_REG_DATA);
+ *bp++ = vgar (ba, VDAC_REG_DATA);
+ }
+ while (x--);
- if (!(error = copyout (red + cmap->index, cmap->red, cmap->count))
- && !(error = copyout (green + cmap->index, cmap->green, cmap->count))
- && !(error = copyout (blue + cmap->index, cmap->blue, cmap->count)))
- return 0;
+ if (!(error = copyout (red + cmap->index, cmap->red, cmap->count))
+ && !(error = copyout (green + cmap->index, cmap->green, cmap->count))
+ && !(error = copyout (blue + cmap->index, cmap->blue, cmap->count)))
+ return (0);
- return error;
+ return (error);
}
int
rt_putcmap (gfp, cmap)
- struct grf_softc *gfp;
- struct grf_colormap *cmap;
+ struct grf_softc *gfp;
+ struct grf_colormap *cmap;
{
- volatile unsigned char *ba;
- u_char red[256], green[256], blue[256], *rp, *gp, *bp;
- short x;
- int error;
+ volatile unsigned char *ba;
+ u_char red[256], green[256], blue[256], *rp, *gp, *bp;
+ short x;
+ int error;
- if (cmap->count == 0 || cmap->index >= 256)
- return 0;
+ if (cmap->count == 0 || cmap->index >= 256)
+ return 0;
- if (cmap->index + cmap->count > 256)
- cmap->count = 256 - cmap->index;
+ if (cmap->index + cmap->count > 256)
+ cmap->count = 256 - cmap->index;
- /* first copy the colors into kernelspace */
- if (!(error = copyin (cmap->red, red + cmap->index, cmap->count))
- && !(error = copyin (cmap->green, green + cmap->index, cmap->count))
- && !(error = copyin (cmap->blue, blue + cmap->index, cmap->count)))
- {
- ba = gfp->g_regkva;
- vgaw (ba, VDAC_REG_SELECT, cmap->index);
- x = cmap->count - 1;
- rp = red + cmap->index;
- gp = green + cmap->index;
- bp = blue + cmap->index;
- do
+ /* first copy the colors into kernelspace */
+ if (!(error = copyin (cmap->red, red + cmap->index, cmap->count))
+ && !(error = copyin (cmap->green, green + cmap->index, cmap->count))
+ && !(error = copyin (cmap->blue, blue + cmap->index, cmap->count)))
{
- vgaw (ba, VDAC_REG_DATA, *rp++);
- vgaw (ba, VDAC_REG_DATA, *gp++);
- vgaw (ba, VDAC_REG_DATA, *bp++);
- }
- while (x--);
- return 0;
- }
- else
- return error;
+ ba = gfp->g_regkva;
+ vgaw (ba, VDAC_REG_SELECT, cmap->index);
+ x = cmap->count - 1;
+ rp = red + cmap->index;
+ gp = green + cmap->index;
+ bp = blue + cmap->index;
+ do {
+ vgaw (ba, VDAC_REG_DATA, *rp++);
+ vgaw (ba, VDAC_REG_DATA, *gp++);
+ vgaw (ba, VDAC_REG_DATA, *bp++);
+ }
+ while (x--);
+ return (0);
+ } else
+ return (error);
}
+
int
rt_getspritepos (gp, pos)
- struct grf_softc *gp;
- struct grf_position *pos;
+ struct grf_softc *gp;
+ struct grf_position *pos;
{
- volatile unsigned char *ba;
-
- ba = gp->g_regkva;
- pos->x = vgar (ba, SEQ_ID_CURSOR_X_LOC_LO) | (vgar (ba, SEQ_ID_CURSOR_X_LOC_HI) << 8);
- pos->y = vgar (ba, SEQ_ID_CURSOR_Y_LOC_LO) | (vgar (ba, SEQ_ID_CURSOR_Y_LOC_HI) << 8);
- return 0;
+ volatile unsigned char *ba;
+
+ ba = gp->g_regkva;
+ pos->x = vgar (ba, SEQ_ID_CURSOR_X_LOC_LO) |
+ (vgar (ba, SEQ_ID_CURSOR_X_LOC_HI) << 8);
+ pos->y = vgar (ba, SEQ_ID_CURSOR_Y_LOC_LO) |
+ (vgar (ba, SEQ_ID_CURSOR_Y_LOC_HI) << 8);
+ return (0);
}
int
rt_setspritepos (gp, pos)
- struct grf_softc *gp;
- struct grf_position *pos;
+ struct grf_softc *gp;
+ struct grf_position *pos;
{
- volatile unsigned char *ba;
-
- ba = gp->g_regkva;
- vgaw (ba, SEQ_ID_CURSOR_X_LOC_LO, pos->x & 0xff);
- vgaw (ba, SEQ_ID_CURSOR_X_LOC_HI, (pos->x >> 8) & 0x07);
- vgaw (ba, SEQ_ID_CURSOR_Y_LOC_LO, pos->y & 0xff);
- vgaw (ba, SEQ_ID_CURSOR_Y_LOC_HI, (pos->y >> 8) & 0x07);
- return 0;
+ volatile unsigned char *ba;
+
+ ba = gp->g_regkva;
+ vgaw (ba, SEQ_ID_CURSOR_X_LOC_LO, pos->x & 0xff);
+ vgaw (ba, SEQ_ID_CURSOR_X_LOC_HI, (pos->x >> 8) & 0x07);
+ vgaw (ba, SEQ_ID_CURSOR_Y_LOC_LO, pos->y & 0xff);
+ vgaw (ba, SEQ_ID_CURSOR_Y_LOC_HI, (pos->y >> 8) & 0x07);
+ return (0);
}
/* assume an at least 2M retina (XXX), sprite is last in memory.
- According to the bogus docs, the cursor can be at most 128 lines
- in height, and the x-hostspot can be placed at most at pos 31,
- this gives width of a long */
+ * According to the bogus docs, the cursor can be at most 128 lines
+ * in height, and the x-hostspot can be placed at most at pos 31,
+ * this gives width of a long
+ */
#define SPRITE_ADDR (2*1024*1024 - 128*4)
int
rt_getspriteinfo (gp, info)
- struct grf_softc *gp;
- struct grf_spriteinfo *info;
+ struct grf_softc *gp;
+ struct grf_spriteinfo *info;
{
- volatile caddr_t ba, fb;
+ volatile caddr_t ba, fb;
- ba = gp->g_regkva;
- fb = gp->g_fbkva;
- if (info->set & GRFSPRSET_ENABLE)
- info->enable = vgar (ba, SEQ_ID_CURSOR_CONTROL) & 0x01;
- if (info->set & GRFSPRSET_POS)
- rt_getspritepos (gp, &info->pos);
- if (info->set & GRFSPRSET_HOT)
- {
- info->hot.x = vgar (ba, SEQ_ID_CURSOR_X_INDEX) & 0x1f;
- info->hot.y = vgar (ba, SEQ_ID_CURSOR_Y_INDEX) & 0x7f;
- }
- if (info->set & GRFSPRSET_CMAP)
- {
- struct grf_colormap cmap;
- int index;
- cmap.index = 0;
- cmap.count = 256;
- rt_getcmap (gp, &cmap);
- index = vgar (ba, SEQ_ID_CURSOR_COLOR0);
- info->cmap.red[0] = cmap.red[index];
- info->cmap.green[0] = cmap.green[index];
- info->cmap.blue[0] = cmap.blue[index];
- index = vgar (ba, SEQ_ID_CURSOR_COLOR1);
- info->cmap.red[1] = cmap.red[index];
- info->cmap.green[1] = cmap.green[index];
- info->cmap.blue[1] = cmap.blue[index];
- }
- if (info->set & GRFSPRSET_SHAPE)
- {
- int saved_bank_lo = RSeq (ba, SEQ_ID_PRIM_HOST_OFF_LO);
- int saved_bank_hi = RSeq (ba, SEQ_ID_PRIM_HOST_OFF_HI);
- int last_bank = SPRITE_ADDR >> 6;
- int last_bank_lo = last_bank & 0xff;
- int last_bank_hi = last_bank >> 8;
- u_char mask;
- WSeq (ba, SEQ_ID_PRIM_HOST_OFF_LO, last_bank_lo);
- WSeq (ba, SEQ_ID_PRIM_HOST_OFF_HI, last_bank_hi);
- copyout (fb, info->image, 128*4);
- mask = RSeq (ba, SEQ_ID_CURSOR_PIXELMASK);
- WSeq (ba, SEQ_ID_PRIM_HOST_OFF_LO, saved_bank_lo);
- WSeq (ba, SEQ_ID_PRIM_HOST_OFF_HI, saved_bank_hi);
- copyout (&mask, info->mask, 1);
- info->size.x = 32; /* ??? */
- info->size.y = (RSeq (ba, SEQ_ID_CURSOR_CONTROL) & 6) << 4;
- }
+ ba = gp->g_regkva;
+ fb = gp->g_fbkva;
+ if (info->set & GRFSPRSET_ENABLE)
+ info->enable = vgar (ba, SEQ_ID_CURSOR_CONTROL) & 0x01;
+ if (info->set & GRFSPRSET_POS)
+ rt_getspritepos (gp, &info->pos);
+ if (info->set & GRFSPRSET_HOT) {
+ info->hot.x = vgar (ba, SEQ_ID_CURSOR_X_INDEX) & 0x1f;
+ info->hot.y = vgar (ba, SEQ_ID_CURSOR_Y_INDEX) & 0x7f;
+ }
+ if (info->set & GRFSPRSET_CMAP) {
+ struct grf_colormap cmap;
+ int index;
+ cmap.index = 0;
+ cmap.count = 256;
+ rt_getcmap (gp, &cmap);
+ index = vgar (ba, SEQ_ID_CURSOR_COLOR0);
+ info->cmap.red[0] = cmap.red[index];
+ info->cmap.green[0] = cmap.green[index];
+ info->cmap.blue[0] = cmap.blue[index];
+ index = vgar (ba, SEQ_ID_CURSOR_COLOR1);
+ info->cmap.red[1] = cmap.red[index];
+ info->cmap.green[1] = cmap.green[index];
+ info->cmap.blue[1] = cmap.blue[index];
+ }
+ if (info->set & GRFSPRSET_SHAPE) {
+ int saved_bank_lo = RSeq (ba, SEQ_ID_PRIM_HOST_OFF_LO);
+ int saved_bank_hi = RSeq (ba, SEQ_ID_PRIM_HOST_OFF_HI);
+ int last_bank = SPRITE_ADDR >> 6;
+ int last_bank_lo = last_bank & 0xff;
+ int last_bank_hi = last_bank >> 8;
+ u_char mask;
+ WSeq (ba, SEQ_ID_PRIM_HOST_OFF_LO, last_bank_lo);
+ WSeq (ba, SEQ_ID_PRIM_HOST_OFF_HI, last_bank_hi);
+ copyout (fb, info->image, 128*4);
+ mask = RSeq (ba, SEQ_ID_CURSOR_PIXELMASK);
+ WSeq (ba, SEQ_ID_PRIM_HOST_OFF_LO, saved_bank_lo);
+ WSeq (ba, SEQ_ID_PRIM_HOST_OFF_HI, saved_bank_hi);
+ copyout (&mask, info->mask, 1);
+ info->size.x = 32; /* ??? */
+ info->size.y = (RSeq (ba, SEQ_ID_CURSOR_CONTROL) & 6) << 4;
+ }
- return 0;
+ return (0);
}
+
int
rt_setspriteinfo (gp, info)
- struct grf_softc *gp;
- struct grf_spriteinfo *info;
+ struct grf_softc *gp;
+ struct grf_spriteinfo *info;
{
- volatile caddr_t ba, fb;
- u_char control;
+ volatile caddr_t ba, fb;
+ u_char control;
- ba = gp->g_regkva;
- fb = gp->g_fbkva;
- control = vgar (ba, SEQ_ID_CURSOR_CONTROL);
- if (info->set & GRFSPRSET_ENABLE)
- {
- if (info->enable)
- control |= 1;
- else
- control &= ~1;
- vgaw (ba, SEQ_ID_CURSOR_CONTROL, control);
- }
- if (info->set & GRFSPRSET_POS)
- rt_setspritepos (gp, &info->pos);
- if (info->set & GRFSPRSET_HOT)
- {
- vgaw (ba, SEQ_ID_CURSOR_X_INDEX, info->hot.x & 0x1f);
- vgaw (ba, SEQ_ID_CURSOR_Y_INDEX, info->hot.y & 0x7f);
- }
- if (info->set & GRFSPRSET_CMAP)
- {
- /* hey cheat a bit here.. XXX */
- vgaw (ba, SEQ_ID_CURSOR_COLOR0, 0);
- vgaw (ba, SEQ_ID_CURSOR_COLOR1, 1);
- }
- if (info->set & GRFSPRSET_SHAPE)
- {
- int saved_bank_lo = RSeq (ba, SEQ_ID_PRIM_HOST_OFF_LO);
- int saved_bank_hi = RSeq (ba, SEQ_ID_PRIM_HOST_OFF_HI);
- int last_bank = SPRITE_ADDR >> 6;
- int last_bank_lo = last_bank & 0xff;
- int last_bank_hi = last_bank >> 8;
- u_char mask;
- WSeq (ba, SEQ_ID_PRIM_HOST_OFF_LO, last_bank_lo);
- WSeq (ba, SEQ_ID_PRIM_HOST_OFF_HI, last_bank_hi);
- copyin (info->image, fb, 128*4);
- WSeq (ba, SEQ_ID_PRIM_HOST_OFF_LO, saved_bank_lo);
- WSeq (ba, SEQ_ID_PRIM_HOST_OFF_HI, saved_bank_hi);
- copyin (info->mask, &mask, 1);
- WSeq (ba, SEQ_ID_CURSOR_PIXELMASK, mask);
- /* info->size.x = 32; *//* ??? */
-
- info->size.y = (RSeq (ba, SEQ_ID_CURSOR_CONTROL) & 6) << 4;
- control = (control & ~6) | ((info->size.y >> 4) & 6);
- vgaw (ba, SEQ_ID_CURSOR_CONTROL, control);
-
- /* sick intel bull-addressing.. */
- WSeq (ba, SEQ_ID_CURSOR_STORE_LO, SPRITE_ADDR & 0x0f);
- WSeq (ba, SEQ_ID_CURSOR_STORE_HI, 0);
- WSeq (ba, SEQ_ID_CURSOR_ST_OFF_LO, (SPRITE_ADDR >> 4) & 0xff);
- WSeq (ba, SEQ_ID_CURSOR_ST_OFF_HI, ((SPRITE_ADDR >> 4) >> 8) & 0xff);
- }
+ ba = gp->g_regkva;
+ fb = gp->g_fbkva;
+ control = vgar (ba, SEQ_ID_CURSOR_CONTROL);
+ if (info->set & GRFSPRSET_ENABLE) {
+ if (info->enable)
+ control |= 1;
+ else
+ control &= ~1;
+ vgaw (ba, SEQ_ID_CURSOR_CONTROL, control);
+ }
+ if (info->set & GRFSPRSET_POS)
+ rt_setspritepos (gp, &info->pos);
+ if (info->set & GRFSPRSET_HOT) {
+ vgaw (ba, SEQ_ID_CURSOR_X_INDEX, info->hot.x & 0x1f);
+ vgaw (ba, SEQ_ID_CURSOR_Y_INDEX, info->hot.y & 0x7f);
+ }
+ if (info->set & GRFSPRSET_CMAP) {
+ /* hey cheat a bit here.. XXX */
+ vgaw (ba, SEQ_ID_CURSOR_COLOR0, 0);
+ vgaw (ba, SEQ_ID_CURSOR_COLOR1, 1);
+ }
+ if (info->set & GRFSPRSET_SHAPE) {
+ int saved_bank_lo = RSeq (ba, SEQ_ID_PRIM_HOST_OFF_LO);
+ int saved_bank_hi = RSeq (ba, SEQ_ID_PRIM_HOST_OFF_HI);
+ int last_bank = SPRITE_ADDR >> 6;
+ int last_bank_lo = last_bank & 0xff;
+ int last_bank_hi = last_bank >> 8;
+ u_char mask;
+ WSeq (ba, SEQ_ID_PRIM_HOST_OFF_LO, last_bank_lo);
+ WSeq (ba, SEQ_ID_PRIM_HOST_OFF_HI, last_bank_hi);
+ copyin (info->image, fb, 128*4);
+ WSeq (ba, SEQ_ID_PRIM_HOST_OFF_LO, saved_bank_lo);
+ WSeq (ba, SEQ_ID_PRIM_HOST_OFF_HI, saved_bank_hi);
+ copyin (info->mask, &mask, 1);
+ WSeq (ba, SEQ_ID_CURSOR_PIXELMASK, mask);
+ /* info->size.x = 32; *//* ??? */
+
+ info->size.y = (RSeq (ba, SEQ_ID_CURSOR_CONTROL) & 6) << 4;
+ control = (control & ~6) | ((info->size.y >> 4) & 6);
+ vgaw (ba, SEQ_ID_CURSOR_CONTROL, control);
+
+ /* sick intel bull-addressing.. */
+ WSeq (ba, SEQ_ID_CURSOR_STORE_LO, SPRITE_ADDR & 0x0f);
+ WSeq (ba, SEQ_ID_CURSOR_STORE_HI, 0);
+ WSeq (ba, SEQ_ID_CURSOR_ST_OFF_LO, (SPRITE_ADDR >> 4) & 0xff);
+ WSeq (ba, SEQ_ID_CURSOR_ST_OFF_HI, ((SPRITE_ADDR >> 4) >> 8) & 0xff);
+ }
- return 0;
+ return (0);
}
+
int
rt_getspritemax (gp, pos)
- struct grf_softc *gp;
- struct grf_position *pos;
+ struct grf_softc *gp;
+ struct grf_position *pos;
{
- pos->x = 32;
- pos->y = 128;
+ pos->x = 32;
+ pos->y = 128;
- return 0;
+ return (0);
}
@@ -1378,11 +1380,10 @@ rt_getspritemax (gp, pos)
int
rt_bitblt (gp, bb)
- struct grf_softc *gp;
- struct grf_bitblt *bb;
+ struct grf_softc *gp;
+ struct grf_bitblt *bb;
{
- return EINVAL;
-
+ return (EINVAL);
#if 0
volatile caddr_t ba, fb;
@@ -1454,4 +1455,19 @@ rt_bitblt (gp, bb)
}
+int
+rt_blank(gp, on)
+ struct grf_softc *gp;
+ int *on;
+{
+ int r;
+
+ r = RSeq(gp->g_regkva, SEQ_ID_CLOCKING_MODE);
+ r &= 0xdf; /* set Bit 5 to 0 */
+
+ WSeq(gp->g_regkva, SEQ_ID_CLOCKING_MODE, r | (*on ? 0x00 : 0x20));
+
+ return(0);
+}
+
#endif /* NGRF */
diff --git a/sys/arch/amiga/dev/grf_ul.c b/sys/arch/amiga/dev/grf_ul.c
index c67a9c9c428..ba6b06d66e2 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.8 1996/05/04 13:54:31 niklas Exp $ */
-/* $NetBSD: grf_ul.c,v 1.16 1996/05/01 09:59:29 veego Exp $ */
+/* $OpenBSD: grf_ul.c,v 1.9 1996/05/29 10:15:17 niklas Exp $ */
+/* $NetBSD: grf_ul.c,v 1.17 1996/05/09 20:31:25 is Exp $ */
#define UL_DEBUG
@@ -907,6 +907,7 @@ ul_blank(gp, onoff, dev)
dev_t dev;
{
struct gspregs *gsp;
+
gsp = (struct gspregs *)gp->g_regkva;
gsp->ctrl = (gsp->ctrl & ~(INCR | INCW)) | LBL;
gsp->hstadrh = 0xC000;
diff --git a/sys/arch/amiga/dev/grfabs_cc.c b/sys/arch/amiga/dev/grfabs_cc.c
index 9a097ee7cd4..0a74231f536 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.2 1996/05/02 06:43:55 niklas Exp $ */
-/* $NetBSD: grfabs_cc.c,v 1.11 1996/04/21 21:11:28 veego Exp $ */
+/* $OpenBSD: grfabs_cc.c,v 1.3 1996/05/29 10:15:20 niklas Exp $ */
+/* $NetBSD: grfabs_cc.c,v 1.12 1996/05/19 21:05:50 veego Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
@@ -1843,7 +1843,7 @@ cc_init_ntsc_aga()
aga_this_data->bplcon0 = 0x0240 | USE_CON3; /* color composite
* enable,
* shres. */
- aga_this_data->std_start_x = 0x4f /*STANDARD_VIEW_X*/;
+ aga_this_data->std_start_x = 0x40 /*STANDARD_VIEW_X*/;
aga_this_data->std_start_y = 0x2b /*STANDARD_VIEW_Y*/;
aga_this_data->vbl_handler = (vbl_handler_func *) cc_mode_vbl_handler;
aga_this_data->beamcon0 = SPECIAL_BEAMCON ^ VSYNCTRUE;
@@ -1856,12 +1856,12 @@ cc_init_ntsc_aga()
/* static, so I can patch and play */
-int AGA_htotal = 0x79;
-int AGA_hsstrt = 0xe;
-int AGA_hsstop = 0x1c;
-int AGA_hbstrt = 0x8;
+int AGA_htotal = 0x71;
+int AGA_hsstrt = 0xc;
+int AGA_hsstop = 0x16;
+int AGA_hbstrt = 0x5;
int AGA_hbstop = 0x1e;
-int AGA_vtotal = 0x1ec;
+int AGA_vtotal = 0x1c1;
int AGA_vsstrt = 0x3;
int AGA_vsstop = 0x6;
int AGA_vbstrt = 0x0;
diff --git a/sys/arch/amiga/dev/grfvar.h b/sys/arch/amiga/dev/grfvar.h
index 14c30895992..1214823a31e 100644
--- a/sys/arch/amiga/dev/grfvar.h
+++ b/sys/arch/amiga/dev/grfvar.h
@@ -1,5 +1,5 @@
-/* $OpenBSD: grfvar.h,v 1.2 1996/05/02 06:43:59 niklas Exp $ */
-/* $NetBSD: grfvar.h,v 1.13 1996/04/21 21:11:33 veego Exp $ */
+/* $OpenBSD: grfvar.h,v 1.3 1996/05/29 10:15:23 niklas Exp $ */
+/* $NetBSD: grfvar.h,v 1.14 1996/05/19 21:05:54 veego Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -109,5 +109,6 @@ enum grfunits {
GRF_RETINAIII_UNIT,
GRF_CL5426_UNIT,
GRF_ULOWELL_UNIT,
- GRF_CV64_UNIT
+ GRF_CV64_UNIT,
+ GRF_ET4000_UNIT
};
diff --git a/sys/arch/amiga/dev/idesc.c b/sys/arch/amiga/dev/idesc.c
index 77d9e5598ea..abfb8e53299 100644
--- a/sys/arch/amiga/dev/idesc.c
+++ b/sys/arch/amiga/dev/idesc.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: idesc.c,v 1.4 1996/05/02 06:44:01 niklas Exp $ */
-/* $NetBSD: idesc.c,v 1.20 1996/04/28 06:36:16 mhitch Exp $ */
+/* $OpenBSD: idesc.c,v 1.5 1996/05/29 10:15:24 niklas Exp $ */
+/* $NetBSD: idesc.c,v 1.21 1996/05/12 02:26:03 mhitch Exp $ */
/*
* Copyright (c) 1994 Michael L. Hitch
@@ -536,15 +536,6 @@ ide_scsidone(dev, stat)
if (xs == NULL)
panic("ide_scsidone");
#endif
-#if 1
- /*
- * XXX Support old-style instrumentation for now.
- * IS THIS REALLY THE RIGHT PLACE FOR THIS? --thorpej
- */
- if (xs->sc_link && xs->sc_link->device_softc &&
- ((struct device *)(xs->sc_link->device_softc))->dv_unit < dk_ndrive)
- ++dk_xfer[((struct device *)(xs->sc_link->device_softc))->dv_unit];
-#endif
/*
* is this right?
*/
diff --git a/sys/arch/amiga/dev/ite.c b/sys/arch/amiga/dev/ite.c
index 177e93306d3..abc4eda5ce4 100644
--- a/sys/arch/amiga/dev/ite.c
+++ b/sys/arch/amiga/dev/ite.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: ite.c,v 1.6 1996/05/02 06:44:09 niklas Exp $ */
-/* $NetBSD: ite.c,v 1.39 1996/04/21 21:11:52 veego Exp $ */
+/* $OpenBSD: ite.c,v 1.7 1996/05/29 10:15:27 niklas Exp $ */
+/* $NetBSD: ite.c,v 1.41 1996/05/19 19:03:06 is Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -61,6 +61,7 @@
#include <amiga/amiga/cc.h>
#include <amiga/amiga/kdassert.h>
#include <amiga/amiga/color.h> /* DEBUG */
+#include <amiga/amiga/custom.h> /* DEBUG */
#include <amiga/amiga/device.h>
#include <amiga/amiga/isr.h>
#include <amiga/dev/iteioctl.h>
@@ -69,6 +70,8 @@
#include <amiga/dev/grfioctl.h>
#include <amiga/dev/grfvar.h>
+#include <machine/cpu.h> /* for is_draco() */
+
#include <sys/conf.h>
#include <machine/conf.h>
@@ -322,6 +325,9 @@ itecninit(cd)
iteinit(cd->cn_dev);
ip->flags |= ITE_ACTIVE | ITE_ISCONS;
+#ifdef DRACO
+ if (!is_draco())
+#endif
init_bell();
}
@@ -2181,7 +2187,11 @@ iteputchar(c, ip)
}
break;
case BEL:
- if (kbd_tty && kbd_ite && kbd_ite->tp == kbd_tty)
+ if (kbd_tty && kbd_ite && kbd_ite->tp == kbd_tty
+#ifdef DRACO
+ && !is_draco()
+#endif
+ )
ite_bell();
break;
case SO:
diff --git a/sys/arch/amiga/dev/ite_cv.c b/sys/arch/amiga/dev/ite_cv.c
index 8157fc796e7..0edbb26a527 100644
--- a/sys/arch/amiga/dev/ite_cv.c
+++ b/sys/arch/amiga/dev/ite_cv.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: ite_cv.c,v 1.2 1996/05/02 06:44:12 niklas Exp $ */
-/* $NetBSD: ite_cv.c,v 1.2 1996/04/21 21:11:59 veego Exp $ */
+/* $OpenBSD: ite_cv.c,v 1.3 1996/05/29 10:15:28 niklas Exp $ */
+/* $NetBSD: ite_cv.c,v 1.3 1996/05/19 21:05:58 veego Exp $ */
/*
* Copyright (c) 1995 Michael Teske
@@ -34,9 +34,8 @@
*/
/*
- * The text console is based on ite_cl.c and ite_rh.c by
+ * This code is based on ite_cl.c and ite_rh.c by
* Ezra Story, Kari Mettinen, Markus Wild, Lutz Vieweg.
- * The gfx console is based on ite_cc.c from Christian E. Hopps.
*/
#include "grfcv.h"
@@ -68,20 +67,6 @@ static void cv_putc __P((struct ite_softc *, int, int, int, int));
static void cv_clear __P((struct ite_softc *, int, int, int, int));
static void cv_scroll __P((struct ite_softc *, int, int, int, int));
-#define MAXROWS 200
-#define MAXCOLS 200
-static unsigned short cv_rowc[MAXROWS];
-
-#ifndef CV_DONT_USE_CONBUFFER
-
-/*
- * Console buffer to avoid the slow reading from gfx mem.
- * this takes up 40k but it makes scrolling 3 times faster.
- * I'd like to alocate it dynamically.
- */
-static unsigned short console_buffer[MAXCOLS*MAXROWS];
-#endif
-
/*
* called from grf_cv to return console priority
*/
@@ -133,27 +118,61 @@ cv_ite_deinit(ip)
}
+static unsigned short cv_rowc[MAXCOLS*(MAXROWS+1)];
+
+/*
+ * Console buffer to avoid the slow reading from gfx mem.
+ */
+
+static unsigned short *console_buffer;
+
void
cv_ite_init(ip)
register struct ite_softc *ip;
{
struct grfcvtext_mode *md;
int i;
+ static char first = 1;
+ volatile unsigned short *fb = (volatile unsigned short *)ip->grf->g_fbkva;
+ unsigned short *buffer;
+
ip->priv = ip->grf->g_data;
md = (struct grfcvtext_mode *) ip->grf->g_data;
ip->cols = md->cols;
ip->rows = md->rows;
- if (ip->rows > MAXROWS)
- panic ("ite_cv.c: Too many rows!");
+
+ /* alloc buffers */
+
+#if 0 /* XXX malloc seems not to work in early init :( */
+ if (cv_rowc)
+ free(cv_rowc, M_DEVBUF);
+
+ /* alloc all in one */
+ cv_rowc = malloc(sizeof(short) * (ip->rows + 1) * (ip->cols + 2),
+ M_DEVBUF, M_WAITOK);
+ if (!cv_rowc)
+ panic("No buffers for ite_cv!");
+#endif
+
+ console_buffer = cv_rowc + ip->rows + 1;
+
for (i = 0; i < ip->rows; i++)
cv_rowc[i] = i * ip->cols;
-#ifndef CV_DONT_USE_CONBUFFER
- for (i = 0; i < MAXCOLS*MAXROWS; i++)
- console_buffer[i] = 0x2007;
-#endif
+
+ if (first) {
+ for (i = 0; i < ip->rows * ip->cols; i++)
+ console_buffer[i] = 0x2007;
+ first = 0;
+ } else { /* restore console */
+ buffer = console_buffer;
+ for (i = 0; i < ip->rows * ip->cols; i++) {
+ *fb++ = *buffer++;
+ *fb++;
+ }
+ }
}
@@ -204,11 +223,10 @@ cv_putc(ip, c, dy, dx, mode)
cp = fb + ((cv_rowc[dy] + dx) << 2); /* *4 */
*cp++ = (unsigned char) c;
*cp = (unsigned char) attr;
-#ifndef CV_DONT_USE_CONBUFFER
+
cp = (unsigned char *) &console_buffer[cv_rowc[dy]+dx];
*cp++ = (unsigned char) c;
*cp = (unsigned char) attr;
-#endif
}
@@ -229,17 +247,15 @@ cv_clear(ip, sy, sx, h, w)
dst = (unsigned short *) (ip->grf->g_fbkva + (((sy * ip->cols) + sx) << 2));
- for (len = w*h; len > 0 ; len--) {
+ for (len = w * h; len > 0 ; len--) {
*dst = 0x2007;
dst +=2;
}
-#ifndef CV_DONT_USE_CONBUFFER
dst = &console_buffer[(sy * ip->cols) + sx];
- for (len = w*h; len > 0 ; len--) {
+ for (len = w * h; len > 0 ; len--) {
*dst++ = 0x2007;
}
-#endif
}
void
@@ -254,100 +270,70 @@ cv_scroll(ip, sy, sx, count, dir)
int i;
int len;
- src = (unsigned short *)(ip->grf->g_fbkva + ((sy * ip->cols) << 2));
+ src = (unsigned short *)(ip->grf->g_fbkva + (cv_rowc[sy] << 2));
switch (dir) {
case SCROLL_UP:
- dst = src - ((count * ip->cols)<<1);
-#ifdef CV_DONT_USE_CONBUFFER
- for (i = 0; i < (ip->bottom_margin + 1 - sy) * ip->cols; i++) {
- *dst++ = *src++; /* copy only plane 0 and 1 */
- dst++; src++;
- }
-#else
- len = (ip->bottom_margin + 1 - sy) * ip->cols;
- src = &console_buffer[sy*ip->cols];
-#if 0
+ dst = src - ((cv_rowc[count])<<1);
+
+ len = cv_rowc[(ip->bottom_margin + 1 - sy)];
+ src = &console_buffer[cv_rowc[sy]];
+
if (count > sy) { /* boundary checks */
dst2 = console_buffer;
- len -= (count - sy) * ip->cols;
- src += (count - sy) * ip->cols;
- } else
-#endif
- dst2 = &console_buffer[(sy-count)*ip->cols];
+ dst = (unsigned short *)(ip->grf->g_fbkva);
+ len -= cv_rowc[(count - sy)];
+ src += cv_rowc[(count - sy)];
+ } else
+ dst2 = &console_buffer[cv_rowc[(sy-count)]];
+
bcopy (src, dst2, len << 1);
for (i = 0; i < len; i++) {
*dst++ = *dst2++;
dst++;
}
-#endif
break;
case SCROLL_DOWN:
- dst = src + ((count * ip->cols)<<1);
-#ifdef CV_DONT_USE_CONBUFFER
- len= (ip->bottom_margin + 1 - (sy + count)) * ip->cols;
- dst += len << 1;
- src += len << 1;
- for (i = 0; i < len; i++) {
- *dst-- = *src--;
- dst--; src--;
- }
-#else
- len = (ip->bottom_margin + 1 - (sy + count)) * ip->cols;
- src = &console_buffer[sy*ip->cols];
- dst2 = &console_buffer[(sy+count)*ip->cols];
+ dst = src + ((cv_rowc[count]) << 1);
+
+ len = cv_rowc[(ip->bottom_margin + 1 - (sy + count))];
+ src = &console_buffer[cv_rowc[sy]];
+ dst2 = &console_buffer[cv_rowc[(sy + count)]];
+
+ if (len < 0)
+ return; /* do some boundary check */
+
bcopy (src, dst2, len << 1);
for (i = 0; i < len; i++) {
*dst++ = *dst2++;
dst++;
}
-#endif
break;
case SCROLL_RIGHT:
dst = src + ((sx+count)<<1);
-#ifdef CV_DONT_USE_CONBUFFER
- src += sx << 1;
- len = (ip->cols - (sx + count));
- dst += (len-1) << 1;
- src += (len-1) << 1;
-
- for (i = 0; i < len ; i++) {
- *dst-- = *src--;
- dst--; src--;
- }
-#else
- src = &console_buffer[sy*ip->cols + sx];
+ src = &console_buffer[cv_rowc[sy] + sx];
len = ip->cols - (sx + count);
- dst2 = &console_buffer[sy*ip->cols + sx + count];
+ dst2 = &console_buffer[cv_rowc[sy] + sx + count];
bcopy (src, dst2, len << 1);
for (i = 0; i < len; i++) {
*dst++ = *dst2++;
dst++;
}
-#endif
break;
case SCROLL_LEFT:
dst = src + ((sx - count)<<1);
-#ifdef CV_DONT_USE_CONBUFFER
- src += sx << 1;
- for (i = 0; i < (ip->cols - sx) ; i++) {
- *dst++ = *src++;
- dst++; src++;
- }
-#else
- src = &console_buffer[sy*ip->cols + sx];
+ src = &console_buffer[cv_rowc[sy] + sx];
len = ip->cols - sx;
- dst2 = &console_buffer[sy*ip->cols + sx - count];
+ dst2 = &console_buffer[cv_rowc[sy] + sx - count];
bcopy (src, dst2, len << 1);
for (i = 0; i < len; i++) {
*dst++ = *dst2++;
dst++;
}
-#endif
}
}
diff --git a/sys/arch/amiga/dev/ite_et.c b/sys/arch/amiga/dev/ite_et.c
new file mode 100644
index 00000000000..d2e275b55e1
--- /dev/null
+++ b/sys/arch/amiga/dev/ite_et.c
@@ -0,0 +1,257 @@
+/* $NetBSD: ite_et.c,v 1.1 1996/05/19 21:06:00 veego Exp $ */
+
+/*
+ * Copyright (c) 1995 Ezra Story
+ * Copyright (c) 1995 Kari Mettinen
+ * Copyright (c) 1994 Markus Wild
+ * Copyright (c) 1994 Lutz Vieweg
+ * 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 Lutz Vieweg.
+ * 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 "grfet.h"
+#if NGRFET > 0
+
+#include <sys/param.h>
+#include <sys/conf.h>
+#include <sys/proc.h>
+#include <sys/device.h>
+#include <sys/ioctl.h>
+#include <sys/tty.h>
+#include <sys/systm.h>
+#include <dev/cons.h>
+#include <machine/cpu.h>
+#include <amiga/amiga/device.h>
+#include <amiga/dev/grfioctl.h>
+#include <amiga/dev/grfvar.h>
+#include <amiga/dev/grf_etreg.h>
+#include <amiga/dev/itevar.h>
+
+#ifdef TSENGCONSOLE
+int et_console = 1;
+#else
+int et_console = 0;
+#endif
+
+void et_init __P((struct ite_softc *ip));
+void et_cursor __P((struct ite_softc *ip, int flag));
+void et_deinit __P((struct ite_softc *ip));
+void et_putc __P((struct ite_softc *ip, int c, int dy, int dx, int mode));
+void et_clear __P((struct ite_softc *ip, int sy, int sx, int h, int w));
+void et_scroll __P((struct ite_softc *ip, int sy, int sx, int count,
+ int dir));
+
+
+/*
+ * Called to determine ite status. Because the connection between the
+ * console & ite in this driver is rather intimate, we return CN_DEAD
+ * if the cl_console is not active.
+ */
+int
+grfet_cnprobe(void)
+{
+ static int done;
+ int rv;
+
+ if (et_console && (done == 0))
+ rv = CN_INTERNAL;
+ else
+ rv = CN_DEAD;
+
+ done = 1;
+ return(rv);
+}
+
+
+void
+grfet_iteinit(gp)
+ struct grf_softc *gp;
+{
+ gp->g_iteinit = et_init;
+ gp->g_itedeinit = et_deinit;
+ gp->g_iteclear = et_clear;
+ gp->g_iteputc = et_putc;
+ gp->g_itescroll = et_scroll;
+ gp->g_itecursor = et_cursor;
+}
+
+
+void
+et_init(ip)
+ struct ite_softc *ip;
+{
+ struct grfettext_mode *md;
+
+ ip->priv = ip->grf->g_data;
+ md = (struct grfettext_mode *) ip->priv;
+
+ ip->cols = md->cols;
+ ip->rows = md->rows;
+}
+
+
+void
+et_cursor(ip, flag)
+ struct ite_softc *ip;
+ int flag;
+{
+ volatile u_char *ba = ip->grf->g_regkva;
+
+ switch (flag) {
+ case DRAW_CURSOR:
+ /*WCrt(ba, CRT_ID_CURSOR_START, & ~0x20); */
+ case MOVE_CURSOR:
+ flag = ip->curx + ip->cury * ip->cols;
+ WCrt(ba, CRT_ID_CURSOR_LOC_LOW, flag & 0xff);
+ WCrt(ba, CRT_ID_CURSOR_LOC_HIGH, (flag >> 8) & 0xff);
+ WCrt(ba, CTR_ID_EXT_START, (flag >> (16-2)) & 0x0c);
+
+ ip->cursorx = ip->curx;
+ ip->cursory = ip->cury;
+ break;
+ case ERASE_CURSOR:
+ /*WCrt(ba, CRT_ID_CURSOR_START, | 0x20); */
+ case START_CURSOROPT:
+ case END_CURSOROPT:
+ default:
+ break;
+ }
+}
+
+
+void
+et_deinit(ip)
+ struct ite_softc *ip;
+{
+ ip->flags &= ~ITE_INITED;
+}
+
+
+void
+et_putc(ip, c, dy, dx, mode)
+ struct ite_softc *ip;
+ int c;
+ int dy;
+ int dx;
+ int mode;
+{
+ volatile unsigned char *ba = ip->grf->g_regkva;
+ unsigned char *fb = ip->grf->g_fbkva;
+ unsigned char attr;
+ unsigned char *cp;
+
+ attr =(unsigned char) ((mode & ATTR_INV) ? (0x70) : (0x07));
+ if (mode & ATTR_UL) attr = 0x01; /* ???????? */
+ if (mode & ATTR_BOLD) attr |= 0x08;
+ if (mode & ATTR_BLINK) attr |= 0x80;
+
+ cp = fb + ((dy * ip->cols) + dx);
+ SetTextPlane(ba,0x00);
+ *cp = (unsigned char) c;
+ SetTextPlane(ba,0x01);
+ *cp = (unsigned char) attr;
+}
+
+
+void
+et_clear(ip, sy, sx, h, w)
+ struct ite_softc *ip;
+ int sy;
+ int sx;
+ int h;
+ int w;
+{
+ /* cl_clear and cl_scroll both rely on ite passing arguments
+ * which describe continuous regions. For a VT200 terminal,
+ * this is safe behavior.
+ */
+ unsigned char *src, *dst;
+ volatile unsigned char *ba = ip->grf->g_regkva;
+ int len;
+
+ dst = ip->grf->g_fbkva + (sy * ip->cols) + sx;
+ src = dst + (ip->rows*ip->cols);
+ len = w*h;
+
+ SetTextPlane(ba, 0x00);
+ bcopy(src, dst, len);
+ SetTextPlane(ba, 0x01);
+ bcopy(src, dst, len);
+}
+
+
+void
+et_scroll(ip, sy, sx, count, dir)
+ struct ite_softc *ip;
+ int sy;
+ int sx;
+ int count;
+ int dir;
+{
+ unsigned char *fb;
+ volatile unsigned char *ba = ip->grf->g_regkva;
+
+ fb = ip->grf->g_fbkva + sy * ip->cols;
+ SetTextPlane(ba, 0x00);
+
+ switch (dir) {
+ case SCROLL_UP:
+ bcopy(fb, fb - (count * ip->cols),
+ (ip->bottom_margin + 1 - sy) * ip->cols);
+ break;
+ case SCROLL_DOWN:
+ bcopy(fb, fb + (count * ip->cols),
+ (ip->bottom_margin + 1 - (sy + count)) * ip->cols);
+ break;
+ case SCROLL_RIGHT:
+ bcopy(fb+sx, fb+sx+count, ip->cols - (sx + count));
+ break;
+ case SCROLL_LEFT:
+ bcopy(fb+sx, fb+sx-count, ip->cols - sx);
+ break;
+ }
+
+ SetTextPlane(ba, 0x01);
+
+ switch (dir) {
+ case SCROLL_UP:
+ bcopy(fb, fb - (count * ip->cols),
+ (ip->bottom_margin + 1 - sy) * ip->cols);
+ break;
+ case SCROLL_DOWN:
+ bcopy(fb, fb + (count * ip->cols),
+ (ip->bottom_margin + 1 - (sy + count)) * ip->cols);
+ break;
+ case SCROLL_RIGHT:
+ bcopy(fb+sx, fb+sx+count, ip->cols - (sx + count));
+ break;
+ case SCROLL_LEFT:
+ bcopy(fb+sx, fb+sx-count, ip->cols - sx);
+ break;
+ }
+}
+#endif /* NGRFET */
diff --git a/sys/arch/amiga/dev/ite_ul.c b/sys/arch/amiga/dev/ite_ul.c
index 1bfd57a1825..b9bc4aa9995 100644
--- a/sys/arch/amiga/dev/ite_ul.c
+++ b/sys/arch/amiga/dev/ite_ul.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ite_ul.c,v 1.2 1995/12/27 08:09:51 chopps Exp $ */
+/* $NetBSD: ite_ul.c,v 1.4 1996/05/10 13:02:35 is Exp $ */
/*
* Copyright (c) 1995 Ignatios Souvatzis
diff --git a/sys/arch/amiga/dev/kbd.c b/sys/arch/amiga/dev/kbd.c
index fc6fa59d678..14a18256161 100644
--- a/sys/arch/amiga/dev/kbd.c
+++ b/sys/arch/amiga/dev/kbd.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: kbd.c,v 1.3 1996/05/02 06:44:16 niklas Exp $ */
-/* $NetBSD: kbd.c,v 1.18 1996/04/21 21:12:05 veego Exp $ */
+/* $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 $ */
/*
* Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
@@ -49,6 +49,9 @@
#include <machine/cpu.h>
#include <amiga/amiga/device.h>
#include <amiga/amiga/custom.h>
+#ifdef DRACO
+#include <amiga/amiga/drcustom.h>
+#endif
#include <amiga/amiga/cia.h>
#include <amiga/dev/itevar.h>
#include <amiga/dev/kbdreg.h>
@@ -63,12 +66,16 @@
struct kbd_softc {
int k_event_mode; /* if true, collect events, else pass to ite */
struct evvar k_events; /* event queue state */
+#ifdef DRACO
+ u_char k_rlprfx; /* MF-II rel. prefix has been seen */
+#endif
};
struct kbd_softc kbd_softc;
int kbdmatch __P((struct device *, void *, void *));
void kbdattach __P((struct device *, struct device *, void *));
void kbdintr __P((int));
+void kbdstuffchar __P((u_char));
struct cfattach kbd_ca = {
sizeof(struct device), kbdmatch, kbdattach
@@ -96,7 +103,28 @@ kbdattach(pdp, dp, auxp)
struct device *pdp, *dp;
void *auxp;
{
- printf("\n");
+#ifdef DRACO
+ /*
+ * XXX Must be kept in sync with kbdenable() switch.
+ * XXX This should be probed, but this way we dont need to initialize
+ * the keyboards.
+ */
+ switch (is_draco()) {
+ case 0:
+ case 1:
+ case 2:
+ printf(": CIA A type Amiga\n");
+ break;
+ case 3:
+ case 4:
+ default:
+ printf(": QuickLogic type MF-II\n");
+ break;
+ }
+#else
+ printf(": CIA A type Amiga\n");
+#endif
+
}
/* definitions for amiga keyboard encoding. */
@@ -108,14 +136,57 @@ kbdenable()
{
int s;
+#ifdef DRACO
+ u_char c;
+#endif
/*
* collides with external ints from SCSI, watch out for this when
* enabling/disabling interrupts there !!
*/
s = spltty();
+#ifdef DRACO
+ switch (is_draco()) {
+ case 0:
+ custom.intena = INTF_SETCLR | INTF_PORTS;
+
+ 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:
+ /* XXX: tobedone: conditionally enable that one */
+ /* XXX: for now, just enable DraCo ports and CIA */
+ *draco_intena |= DRIRQ_INT2;
+ ciaa.icr = CIA_ICR_IR_SC | CIA_ICR_SP;
+ /* SP interrupt enable */
+ ciaa.cra &= ~(1<<6); /* serial line == input */
+ break;
+
+ case 3:
+ ciaa.icr = CIA_ICR_SP; /* CIA SP interrupt disable */
+ ciaa.cra &= ~(1<<6); /* serial line == input */
+ /* FALLTHROUGH */
+ case 4:
+ default:
+ /* XXX: for now: always enable own keyboard */
+
+ while (draco_ioct->io_status & DRSTAT_KBDRECV) {
+ c = draco_ioct->io_kbddata;
+ draco_ioct->io_kbdrst = 0;
+ printf(".");
+ DELAY(2000);
+ }
+
+ draco_ioct->io_control &= ~DRCNTRL_KBDINTENA;
+ break;
+ }
+#else
custom.intena = INTF_SETCLR | INTF_PORTS;
ciaa.icr = CIA_ICR_IR_SC | CIA_ICR_SP; /* SP interrupt enable */
ciaa.cra &= ~(1<<6); /* serial line == input */
+#endif
kbd_softc.k_event_mode = 0;
kbd_softc.k_events.ev_io = 0;
splx(s);
@@ -220,14 +291,12 @@ kbdintr(mask)
int mask;
{
u_char c;
- struct kbd_softc *k = &kbd_softc;
- struct firm_event *fe;
- int put;
#ifdef KBDRESET
static int reset_warn;
#endif
- /* now only invoked from generic CIA interrupt handler if there *is*
+ /*
+ * now only invoked from generic CIA interrupt handler if there *is*
* a keyboard interrupt pending
*/
@@ -260,48 +329,85 @@ kbdintr(mask)
return;
}
#endif
- /* if not in event mode, deliver straight to ite to process key stroke */
- if (! k->k_event_mode) {
- ite_filter (c, ITEFILT_TTY);
- return;
- }
-
- /* Keyboard is generating events. Turn this keystroke into an
- * event and put it in the queue. If the queue is full, the
- * keystroke is lost (sorry!).
- */
-
- put = k->k_events.ev_put;
- fe = &k->k_events.ev_q[put];
- put = (put + 1) % EV_QSIZE;
- if (put == k->k_events.ev_get) {
- log(LOG_WARNING, "keyboard event queue overflow\n"); /* ??? */
- return;
- }
- fe->id = KEY_CODE(c);
- fe->value = KEY_UP(c) ? VKEY_UP : VKEY_DOWN;
- fe->time = time;
- k->k_events.ev_put = put;
- EV_WAKEUP(&k->k_events);
+ kbdstuffchar(c);
}
+
+#ifdef DRACO
+/* maps MF-II keycodes to Amiga keycodes */
+
+u_char drkbdtab[] = {
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x50,
+ 0x45, 0xff, 0xff, 0xff, 0xff, 0x42, 0x00, 0x51,
+
+ 0xff, 0x64, 0x60, 0x30, 0x63, 0x10, 0x01, 0x52,
+ 0xff, 0x66, 0x31, 0x21, 0x20, 0x11, 0x02, 0x53,
+
+ 0xff, 0x33, 0x32, 0x22, 0x12, 0x04, 0x03, 0x54,
+ 0xff, 0x40, 0x34, 0x23, 0x14, 0x13, 0x05, 0x55,
+
+ 0xff, 0x36, 0x35, 0x25, 0x24, 0x15, 0x06, 0x56,
+ 0xff, 0x67, 0x37, 0x26, 0x16, 0x07, 0x08, 0x57,
+ /* --- */
+ 0xff, 0x38, 0x27, 0x17, 0x18, 0x0a, 0x09, 0x58,
+ 0xff, 0x39, 0x3a, 0x28, 0x29, 0x19, 0x0b, 0x59,
+
+ 0xff, 0xff, 0x2a, 0x2b, 0x1a, 0x0c, 0x4b, 0xff,
+ 0x65, 0x61, 0x44, 0x1b, 0xff, 0xff, 0x6f, 0xff,
+
+ 0x4d, 0x4f, 0xff, 0x4c, 0x0d, 0xff, 0x41, 0x46,
+ 0xff, 0x1d, 0x4e, 0x2d, 0x3d, 0x4a, 0x5f, 0x62,
+
+ 0x0f, 0x3c, 0x1e, 0x2e, 0x2f, 0x3e, 0x5a, 0x5b,
+ 0xff, 0x43, 0x1f, 0xff, 0x5e, 0x3f, 0x5c, 0xff,
+ /* --- */
+ 0xff, 0xff, 0xff, 0xff, 0x5d
+};
+#endif
int
-kbdgetcn()
+kbdgetcn ()
{
- int s = spltty ();
+ int s;
u_char ints, mask, c, in;
- for (ints = 0; ! ((mask = ciaa.icr) & CIA_ICR_SP); ints |= mask) ;
+#ifdef DRACO
+ /*
+ * XXX todo: if CIA DraCo, get from cia if cia kbd
+ * installed.
+ */
+ if (is_draco()) {
+ c = 0;
+ s = spltty ();
+ while ((draco_ioct->io_status & DRSTAT_KBDRECV) == 0);
+ in = draco_ioct->io_kbddata;
+ draco_ioct->io_kbdrst = 0;
+ if (in == 0xF0) { /* release prefix */
+ c = 0x80;
+ while ((draco_ioct->io_status & DRSTAT_KBDRECV) == 0);
+ in = draco_ioct->io_kbddata;
+ draco_ioct->io_kbdrst = 0;
+ }
+ splx(s);
+#ifdef DRACORAWKEYDEBUG
+ printf("<%02x>", in);
+#endif
+ return (in>=sizeof(drkbdtab) ? 0xff : drkbdtab[in]|c);
+ }
+#endif
+ s = spltty();
+ for (ints = 0; ! ((mask = ciaa.icr) & CIA_ICR_SP);
+ ints |= mask) ;
in = ciaa.sdr;
c = ~in;
-
+
/* ack */
ciaa.cra |= (1 << 6); /* serial line output */
- ciaa.sdr = 0xff; /* ack */
+ ciaa.sdr = 0xff; /* ack */
/* wait 200 microseconds */
- DELAY(2000); /* XXXX only works as long as DELAY doesn't use a timer and waits.. */
+ DELAY(2000); /* XXXX only works as long as DELAY doesn't
+ * use a timer and waits.. */
ciaa.cra &= ~(1 << 6);
ciaa.sdr = in;
@@ -314,3 +420,64 @@ kbdgetcn()
return c;
}
+
+void
+kbdstuffchar(c)
+ u_char c;
+{
+ struct firm_event *fe;
+ struct kbd_softc *k = &kbd_softc;
+ int put;
+
+ /*
+ * If not in event mode, deliver straight to ite to process
+ * key stroke
+ */
+
+ if (! k->k_event_mode) {
+ ite_filter (c, ITEFILT_TTY);
+ return;
+ }
+
+ /*
+ * Keyboard is generating events. Turn this keystroke into an
+ * event and put it in the queue. If the queue is full, the
+ * keystroke is lost (sorry!).
+ */
+
+ put = k->k_events.ev_put;
+ fe = &k->k_events.ev_q[put];
+ put = (put + 1) % EV_QSIZE;
+ if (put == k->k_events.ev_get) {
+ log(LOG_WARNING, "keyboard event queue overflow\n");
+ /* ??? */
+ return;
+ }
+ fe->id = KEY_CODE(c);
+ fe->value = KEY_UP(c) ? VKEY_UP : VKEY_DOWN;
+ fe->time = time;
+ k->k_events.ev_put = put;
+ EV_WAKEUP(&k->k_events);
+}
+
+
+#ifdef DRACO
+void
+drkbdintr()
+{
+ u_char in;
+ struct kbd_softc *k = &kbd_softc;
+
+ in = draco_ioct->io_kbddata;
+ draco_ioct->io_kbdrst = 0;
+
+ if (in == 0xF0)
+ k->k_rlprfx = 0x80;
+ else {
+ kbdstuffchar(in>=sizeof(drkbdtab) ? 0xff :
+ drkbdtab[in] | k->k_rlprfx);
+ k->k_rlprfx = 0;
+ }
+}
+
+#endif
diff --git a/sys/arch/amiga/dev/ms.c b/sys/arch/amiga/dev/ms.c
index 39bee0431f9..4e14bef5f3e 100644
--- a/sys/arch/amiga/dev/ms.c
+++ b/sys/arch/amiga/dev/ms.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: ms.c,v 1.2 1996/05/02 06:44:21 niklas Exp $ */
-/* $NetBSD: ms.c,v 1.9 1996/04/24 11:41:16 is Exp $ */
+/* $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 $ */
/*
* based on:
@@ -115,7 +115,6 @@ msmatch(pdp, match, auxp)
return 0;
}
-
void
msattach(pdp, dp, auxp)
struct device *pdp, *dp;
@@ -123,7 +122,6 @@ msattach(pdp, dp, auxp)
{
printf("\n");
}
-
/*
* Amiga mice are hooked up to one of the two "game" ports, where
@@ -144,6 +142,7 @@ ms_enable(dev)
struct ms_softc *ms;
ms = (struct ms_softc *)getsoftc(ms_cd, minor(dev));
+
/*
* use this as flag to the "interrupt" to tell it when to
* shut off (when it's reset to 0).
@@ -193,6 +192,7 @@ msintr(arg)
unit = (int)arg;
ms = (struct ms_softc *)getsoftc(ms_cd, unit);
+
horc = ((u_char *) &count) + 1;
verc = (u_char *) &count;
@@ -385,6 +385,7 @@ msread(dev, uio, flags)
struct ms_softc *ms;
ms = (struct ms_softc *)getsoftc(ms_cd, minor(dev));
+
return(ev_read(&ms->ms_events, uio, flags));
}
@@ -432,5 +433,6 @@ msselect(dev, rw, p)
struct ms_softc *ms;
ms = (struct ms_softc *)getsoftc(ms_cd, minor(dev));
+
return(ev_select(&ms->ms_events, rw, p));
}
diff --git a/sys/arch/amiga/dev/sbic.c b/sys/arch/amiga/dev/sbic.c
index 37308102c96..cf83fabaecb 100644
--- a/sys/arch/amiga/dev/sbic.c
+++ b/sys/arch/amiga/dev/sbic.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: sbic.c,v 1.6 1996/05/04 14:12:29 niklas Exp $ */
-/* $NetBSD: sbic.c,v 1.24 1996/05/01 16:58:41 mhitch Exp $ */
+/* $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 $ */
/*
* Copyright (c) 1994 Christian E. Hopps
@@ -560,13 +560,6 @@ sbic_scsidone(acb, stat)
}
#endif
/*
- * XXX Support old-style instrumentation for now.
- * IS THIS REALLY THE RIGHT PLACE FOR THIS? --thorpej
- */
- if (slp->device_softc &&
- ((struct device *)(slp->device_softc))->dv_unit < dk_ndrive)
- ++dk_xfer[((struct device *)(slp->device_softc))->dv_unit];
- /*
* is this right?
*/
xs->status = stat;
diff --git a/sys/arch/amiga/dev/sci.c b/sys/arch/amiga/dev/sci.c
index 49de4b4cd19..ea12bc58ce2 100644
--- a/sys/arch/amiga/dev/sci.c
+++ b/sys/arch/amiga/dev/sci.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: sci.c,v 1.3 1996/05/02 06:44:28 niklas Exp $ */
-/* $NetBSD: sci.c,v 1.16 1996/04/21 21:12:24 veego Exp $ */
+/* $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 $ */
/*
* Copyright (c) 1994 Michael L. Hitch
@@ -218,13 +218,6 @@ sci_scsidone(dev, stat)
panic("sci_scsidone");
#endif
/*
- * XXX Support old-style instrumentation for now.
- * IS THIS REALLY THE RIGHT PLACE FOR THIS? --thorpej
- */
- if (xs->sc_link->device_softc &&
- ((struct device *)(xs->sc_link->device_softc))->dv_unit < dk_ndrive)
- ++dk_xfer[((struct device *)(xs->sc_link->device_softc))->dv_unit];
- /*
* is this right?
*/
xs->status = stat;
diff --git a/sys/arch/amiga/dev/scsidefs.h b/sys/arch/amiga/dev/scsidefs.h
index f7b68799266..e69de29bb2d 100644
--- a/sys/arch/amiga/dev/scsidefs.h
+++ b/sys/arch/amiga/dev/scsidefs.h
@@ -1,390 +0,0 @@
-/* $NetBSD: scsidefs.h,v 1.4 1994/10/26 02:04:49 cgd Exp $ */
-
-/*
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Van Jacobson of Lawrence Berkeley Laboratory.
- *
- * 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.
- *
- * @(#)scsidefs.h 7.3 (Berkeley) 2/5/91
- */
-
-/*
- * Common SCSI definitions
- */
-
-/* psns/pctl phase lines as bits */
-#define PHASE_MSG 0x04
-#define PHASE_CD 0x02 /* =1 if 'command' */
-#define PHASE_IO 0x01 /* =1 if data inbound */
-/* Phase lines as values */
-#define PHASE 0x07 /* mask for psns/pctl phase */
-#define DATA_OUT_PHASE 0x00
-#define DATA_IN_PHASE 0x01
-#define CMD_PHASE 0x02
-#define STATUS_PHASE 0x03
-#define BUS_FREE_PHASE 0x04
-#define ARB_SEL_PHASE 0x05 /* Fuji chip combines arbitration with sel. */
-#define MESG_OUT_PHASE 0x06
-#define MESG_IN_PHASE 0x07
-
-/* SCSI Messages */
-
-#define MSG_CMD_COMPLETE 0x00
-#define MSG_EXT_MESSAGE 0x01
-#define MSG_SAVE_DATA_PTR 0x02
-#define MSG_RESTORE_PTR 0x03
-#define MSG_DISCONNECT 0x04
-#define MSG_INIT_DETECT_ERROR 0x05
-#define MSG_ABORT 0x06
-#define MSG_REJECT 0x07
-#define MSG_NOOP 0x08
-#define MSG_PARITY_ERROR 0x09
-#define MSG_BUS_DEVICE_RESET 0x0C
-#define MSG_IDENTIFY 0x80
-#define MSG_IDENTIFY_DR 0xc0 /* (disconnect/reconnect allowed) */
-#define MSG_SYNC_REQ 0x01
-
-/* SCSI Commands */
-
-#define CMD_TEST_UNIT_READY 0x00
-#define CMD_REQUEST_SENSE 0x03
-#define CMD_INQUIRY 0x12
-#define CMD_SEND_DIAGNOSTIC 0x1D
-
-#define CMD_REWIND 0x01
-#define CMD_FORMAT_UNIT 0x04
-#define CMD_READ_BLOCK_LIMITS 0x05
-#define CMD_REASSIGN_BLOCKS 0x07
-#define CMD_READ 0x08
-#define CMD_WRITE 0x0A
-#define CMD_WRITE_FILEMARK 0x10
-#define CMD_SPACE 0x11
-#define CMD_MODE_SELECT 0x15
-#define CMD_RELEASE_UNIT 0x17
-#define CMD_ERASE 0x19
-#define CMD_MODE_SENSE 0x1A
-#define CMD_LOADUNLOAD 0x1B
-#define CMD_RECEIVE_DIAG 0x1C
-#define CMD_SEND_DIAG 0x1D
-#define CMD_P_A_MEDIA_REMOVAL 0x1E
-#define CMD_READ_CAPACITY 0x25
-#define CMD_READ_EXT 0x28
-#define CMD_WRITE_EXT 0x2A
-#define CMD_READ_DEFECT_DATA 0x37
-#define SD_MANUFAC_DEFECTS 0x14000000
-#define SD_GROWN_DEFECTS 0x0c000000
-#define CMD_READ_BUFFER 0x3B
-#define CMD_WRITE_BUFFER 0x3C
-#define CMD_READ_FULL 0xF0
-#define CMD_MEDIA_TEST 0xF1
-#define CMD_ACCESS_LOG 0xF2
-#define CMD_WRITE_FULL 0xFC
-#define CMD_MANAGE_PRIMARY 0xFD
-#define CMD_EXECUTE_DATA 0xFE
-
-/* SCSI status bits */
-
-#define STS_CHECKCOND 0x02 /* Check Condition (ie., read sense) */
-#define STS_CONDMET 0x04 /* Condition Met (ie., search worked) */
-#define STS_BUSY 0x08
-#define STS_INTERMED 0x10 /* Intermediate status sent */
-#define STS_EXT 0x80 /* Extended status valid */
-
-/* command descriptor blocks */
-
-struct scsi_cdb6 {
- u_char cmd; /* command code */
- u_char lun: 3, /* logical unit on ctlr */
- lbah: 5; /* msb of read/write logical block addr */
- u_char lbam; /* middle byte of l.b.a. */
- u_char lbal; /* lsb of l.b.a. */
- u_char len; /* transfer length */
- u_char xtra;
-};
-
-struct scsi_cdb10 {
- u_char cmd; /* command code */
- u_char lun: 3, /* logical unit on ctlr */
- : 4,
- rel: 1; /* l.b.a. is relative addr if =1 */
- u_char lbah; /* msb of read/write logical block addr */
- u_char lbahm; /* high middle byte of l.b.a. */
- u_char lbalm; /* low middle byte of l.b.a. */
- u_char lbal; /* lsb of l.b.a. */
- u_char reserved;
- u_char lenh; /* msb transfer length */
- u_char lenl; /* lsb transfer length */
- u_char xtra;
-};
-
-/* basic sense data */
-
-struct scsi_sense {
- u_char valid: 1, /* l.b.a. is valid */
- class: 3,
- code: 4;
- u_char vu: 4, /* vendor unique */
- lbah: 4;
- u_char lbam;
- u_char lbal;
-};
-
-struct scsi_xsense {
- u_char valid: 1, /* l.b.a. is valid */
- class: 3,
- code: 4;
- u_char segment;
- u_char filemark: 1,
- eom: 1,
- ili: 1, /* illegal length indicator */
- rsvd: 1,
- key: 4;
- u_char info1;
- u_char info2;
- u_char info3;
- u_char info4;
- u_char len; /* additional sense length */
-};
-
-/* inquiry data */
-struct scsi_inquiry {
- u_char type;
- u_char qual;
- u_char version;
- u_char rsvd;
- u_char len;
- char class[3];
- char vendor_id[8];
- char product_id[16];
- char rev[4];
-};
-
-struct scsi_format_parms { /* physical BFI format */
- u_short reserved;
- u_short list_len;
- struct defect {
- unsigned cyl : 24;
- unsigned head : 8;
- long bytes_from_index;
- } defect[127];
-} format_parms;
-
-struct scsi_reassign_parms {
- u_short reserved;
- u_short list_len; /* length in bytes of defects only */
- struct new_defect {
- unsigned lba; /* logical block address */
- } new_defect[2];
-} reassign_parms;
-
-struct scsi_modesel_hdr {
- u_char rsvd1;
- u_char media_type;
- u_char rsvd2;
- u_char block_desc_len;
- u_int density : 8;
- u_int number_blocks :24;
- u_int rsvd3 : 8;
- u_int block_length :24;
-};
-
-struct scsi_modesense_hdr {
- u_char len;
- u_char media_type;
- u_char wp : 1;
- u_char rsvd1 : 7;
- u_char block_desc_len;
- u_int density : 8;
- u_int number_blocks :24;
- u_int rsvd2 : 8;
- u_int block_length :24;
-};
-
-/*
- * Mode Select / Mode sense "pages"
- */
-
-/*
- * Page One - Error Recovery Parameters
- */
-struct scsi_err_recovery {
- u_char page_savable : 1; /* save parameters */
- u_char reserved : 1;
- u_char page_code : 6; /* = 0x01 */
- u_char page_length; /* = 6 */
- u_char awre : 1; /* auto write realloc enabled */
- u_char arre : 1; /* auto read realloc enabled */
- u_char tb : 1; /* transfer block */
- u_char rc : 1; /* read continuous */
- u_char eec : 1; /* enable early correction */
- u_char per : 1; /* post error */
- u_char dte : 1; /* disable transfer on error */
- u_char dcr : 1; /* disable correction */
- u_char retry_count;
- u_char correction_span;
- u_char head_offset_count;
- u_char strobe_offset_count;
- u_char recovery_time_limit;
-};
-
-/*
- * Page Two - Disconnect / Reconnect Control Parameters
- */
-struct scsi_disco_reco {
- u_char page_savable : 1; /* save parameters */
- u_char rsvd : 1;
- u_char page_code : 6; /* = 0x02 */
- u_char page_length; /* = 10 */
- u_char buffer_full_ratio; /* write, how full before reconnect? */
- u_char buffer_empty_ratio; /* read, how full before reconnect? */
-
- u_short bus_inactivity_limit; /* how much bus time for busy */
- u_short disconnect_time_limit; /* min to remain disconnected */
- u_short connect_time_limit; /* min to remain connected */
- u_short reserved_1;
-};
-
-/*
- * Page Three - Direct Access Device Format Parameters
- */
-struct scsi_format {
- u_char page_savable : 1; /* save parameters */
- u_char rsvd : 1;
- u_char page_code : 6; /* = 0x03 */
- u_char page_length; /* = 22 */
- u_short tracks_per_zone; /* Handling of Defects Fields */
- u_short alt_sect_zone;
- u_short alt_tracks_zone;
- u_short alt_tracks_vol;
- u_short sect_track; /* Track Format Field */
- u_short data_sect; /* Sector Format Fields */
- u_short interleave;
- u_short track_skew_factor;
- u_short cyl_skew_factor;
- u_char ssec : 1; /* Drive Type Field */
- u_char hsec : 1;
- u_char rmb : 1;
- u_char surf : 1;
- u_char ins : 1;
- u_char reserved_1 : 3;
- u_char reserved_2;
- u_char reserved_3;
- u_char reserved_4;
-};
-
-/*
- * Page Four - Rigid Disk Drive Geometry Parameters
- */
-struct scsi_geometry {
- u_char page_savable : 1; /* save parameters */
- u_char rsvd : 1;
- u_char page_code : 6; /* = 0x04 */
- u_char page_length; /* = 18 */
- u_char cyl_ub; /* number of cylinders */
- u_char cyl_mb;
- u_char cyl_lb;
- u_char heads; /* number of heads */
- u_char precomp_cyl_ub; /* cylinder to start precomp */
- u_char precomp_cyl_mb;
- u_char precomp_cyl_lb;
- u_char current_cyl_ub; /* cyl to start reduced current */
- u_char current_cyl_mb;
- u_char current_cyl_lb;
- u_short step_rate; /* drive step rate */
- u_char landing_cyl_ub; /* landing zone cylinder */
- u_char landing_cyl_mb;
- u_char landing_cyl_lb;
- u_char reserved_1;
- u_char reserved_2;
- u_char reserved_3;
-};
-
-/*
- * Page 0x38 - Cache Control Parameters
- */
-struct scsi_cache {
- u_char page_savable : 1; /* save parameters */
- u_char rsvd : 1;
- u_char page_code : 6; /* = 0x38 */
- u_char page_length; /* = 14 */
- u_char rsvd_1 : 1;
- u_char wie : 1; /* write index enable */
- u_char rsvd_2 : 1;
- u_char ce : 1; /* cache enable */
- u_char table_size : 4;
- u_char prefetch_threshold;
- u_char maximum_threshold;
- u_char maximumprefetch_multiplier;
- u_char minimum_threshold;
- u_char minimum_prefetch_multiplier;
- u_char reserved[8];
-};
-
-/*
- * Driver ioctl's for various scsi operations.
- */
-#ifndef _IOCTL_
-#include <sys/ioctl.h>
-#endif
-
-/*
- * Control for SCSI "format" mode.
- *
- * "Format" mode allows a privileged process to issue direct SCSI
- * commands to a drive (it is intended primarily to allow on-line
- * formatting). SDIOCSFORMAT with a non-zero arg will put the drive
- * into format mode; a zero arg will take it out. When in format
- * mode, only the process that issued the SDIOCFORMAT can read or
- * write the drive.
- *
- * In format mode, process is expected to
- * - do SDIOCSCSICOMMAND to supply cdb for next SCSI op
- * - do read or write as appropriate for cdb
- * - if i/o error, optionally do SDIOCSENSE to get completion
- * status and sense data from last scsi operation.
- */
-
-struct scsi_fmt_cdb {
- int len; /* cdb length (in bytes) */
- u_char cdb[28]; /* cdb to use on next read/write */
-};
-
-struct scsi_fmt_sense {
- u_int status; /* completion status of last op */
- u_char sense[28]; /* sense data (if any) from last op */
-};
-
-#define SDIOCSFORMAT _IOW('S', 0x1, int)
-#define SDIOCGFORMAT _IOR('S', 0x2, int)
-#define SDIOCSCSICOMMAND _IOW('S', 0x3, struct scsi_fmt_cdb)
-#define SDIOCSENSE _IOR('S', 0x4, struct scsi_fmt_sense)
diff --git a/sys/arch/amiga/dev/siop.c b/sys/arch/amiga/dev/siop.c
index fa6348db5e8..127d1fc25d1 100644
--- a/sys/arch/amiga/dev/siop.c
+++ b/sys/arch/amiga/dev/siop.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: siop.c,v 1.7 1996/05/02 06:44:34 niklas Exp $ */
-/* $NetBSD: siop.c,v 1.32 1996/04/28 06:28:24 mhitch Exp $ */
+/* $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 $ */
/*
* Copyright (c) 1994 Michael L. Hitch
@@ -377,13 +377,6 @@ siop_scsidone(acb, stat)
slp = xs->sc_link;
sc = slp->adapter_softc;
/*
- * XXX Support old-style instrumentation for now.
- * IS THIS REALLY THE RIGHT PLACE FOR THIS? --thorpej
- */
- if (slp->device_softc &&
- ((struct device *)(slp->device_softc))->dv_unit < dk_ndrive)
- ++dk_xfer[((struct device *)(slp->device_softc))->dv_unit];
- /*
* is this right?
*/
xs->status = stat;
diff --git a/sys/arch/amiga/dev/zbus.c b/sys/arch/amiga/dev/zbus.c
index 44defa3449b..f068f0cad08 100644
--- a/sys/arch/amiga/dev/zbus.c
+++ b/sys/arch/amiga/dev/zbus.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: zbus.c,v 1.5 1996/05/07 10:10:19 niklas Exp $ */
-/* $NetBSD: zbus.c,v 1.17 1996/03/28 18:41:49 is Exp $ */
+/* $OpenBSD: zbus.c,v 1.6 1996/05/29 10:15:45 niklas Exp $ */
+/* $NetBSD: zbus.c,v 1.19 1996/05/19 21:06:09 veego Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
@@ -115,6 +115,8 @@ static struct aconfdata aconftab[] = {
{ "grfcl", 2193, 1}, /* Spectrum regs */
{ "grfcl", 2195, 5}, /* Piccolo mem */
{ "grfcl", 2195, 6}, /* Piccolo regs */
+ { "grfcl", 2195, 10}, /* Piccolo SD64 mem */
+ { "grfcl", 2195, 11}, /* Piccolo SD64 regs */
/* MacroSystemsUS */
{ "wesc", 2203, 19}, /* Warp engine */
/* phase 5 digital products */
@@ -128,7 +130,13 @@ static struct aconfdata aconftab[] = {
/* Resource Management Force */
{ "qn", 2011, 2 }, /* QuickNet Ethernet */
/* ??? */
- { "empsc", 2171, 21 } /* Emplant SCSI */
+ { "empsc", 2171, 21 }, /* 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 */
};
static int naconfent = sizeof(aconftab) / sizeof(struct aconfdata);
@@ -142,13 +150,21 @@ static struct preconfdata preconftab[] = {
{18260, 16, 0}, /* Retina BLT Z3 */
{18260, 19, 0}, /* Altais */
{2167, 11, 0}, /* Picasso-II mem*/
- {2167, 12, 0}, /* regs */
+ {2167, 12, 0}, /* Picasso-II regs */
{2193, 2, 0}, /* Spectrum mem */
{2193, 1, 0}, /* Spectrum regs */
{2195, 5, 0}, /* Piccolo mem */
{2195, 6, 0}, /* Piccolo regs */
+ {2195, 10, 0}, /* Piccolo SD64 mem */
+ {2195, 11, 0}, /* Piccolo SD64 regs */
{1030, 0, 0}, /* Ulwl board */
- {8512, 34, 0} /* Cybervison 64 */
+ {8512, 34, 0}, /* Cybervison 64 */
+ {8512, 34, 0}, /* Cybervison 64 */
+ {2181, 0, 0}, /* oMniBus mem or regs */
+ {2167, 1, 0}, /* Domino mem */
+ {2167, 2, 0}, /* Domino regs */
+ {2117, 3, 0}, /* Merlin mem */
+ {2117, 4, 0} /* Merlin regs */
};
static int npreconfent = sizeof(preconftab) / sizeof(struct preconfdata);
@@ -251,9 +267,9 @@ zbusattach(pdp, dp, auxp)
if (amiga_realconfig && pcp < epcp && pcp->vaddr)
za.va = pcp->vaddr;
else {
- za.va = (void *) (isztwopa(za.pa) ? ztwomap(za.pa) :
- zbusmap(za.pa, za.size));
-/* ??????? */
+ za.va = (void *) (isztwopa(za.pa) ? ztwomap(za.pa)
+ : zbusmap(za.pa, za.size));
+/* ??????? */
/*
* save value if early console init
*/
diff --git a/sys/arch/amiga/include/cpu.h b/sys/arch/amiga/include/cpu.h
index bdf3bc6c976..8ddb9c5b888 100644
--- a/sys/arch/amiga/include/cpu.h
+++ b/sys/arch/amiga/include/cpu.h
@@ -1,5 +1,5 @@
-/* $OpenBSD: cpu.h,v 1.7 1996/05/02 07:57:23 niklas Exp $ */
-/* $NetBSD: cpu.h,v 1.31 1996/04/27 20:55:08 veego Exp $ */
+/* $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 $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -228,12 +228,27 @@ void configure __P((void));
int is_a1200 __P((void));
int is_a3000 __P((void));
int is_a4000 __P((void));
+#ifdef DRACO
+int is_draco __P((void));
+#endif
/*
* Prototypes from clock.c
*/
u_long clkread __P((void));
+#ifdef DRACO
+/*
+ * Prototypes from kbd.c
+ */
+void drkbdintr __P((void));
+
+/*
+ * Prototypes from drsc.c
+ */
+void drsc_handler __P((void));
+#endif
+
/*
* Prototypes from locore.s
*/
@@ -256,6 +271,7 @@ void proc_trampoline __P((void));
void savectx __P((struct pcb *));
void switch_exit __P((struct proc *));
void DCIAS __P((vm_offset_t));
+void DCIA __P((void));
void DCIS __P((void));
void DCIU __P((void));
void ICIA __P((void));
@@ -265,7 +281,7 @@ void TBIA __P((void));
void TBIS __P((vm_offset_t));
void TBIAS __P((void));
void TBIAU __P((void));
-#ifdef M68040
+#if defined(M68040) || defined(M68060)
void DCFA __P((void));
void DCFP __P((vm_offset_t));
void DCFL __P((vm_offset_t));
@@ -299,10 +315,12 @@ void physaccess __P((caddr_t, caddr_t, int, int));
void physunaccess __P((caddr_t, int));
void setredzone __P((u_int *, caddr_t));
+#ifdef GENERIC
/*
* Prototypes from swapgeneric.c:
*/
void setconf __P((void));
+#endif
/*
* Prototypes from pmap.c:
diff --git a/sys/arch/amiga/include/fbio.h b/sys/arch/amiga/include/fbio.h
new file mode 100644
index 00000000000..2f6dd29abbb
--- /dev/null
+++ b/sys/arch/amiga/include/fbio.h
@@ -0,0 +1,42 @@
+/* $NetBSD: fbio.h,v 1.1 1996/05/19 20:06:12 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.
+ */
+
+/*
+ * FBIO compatible video control.
+ */
+#define FBVIDEO_OFF 0
+#define FBVIDEO_ON 1
+
+#define FBIOSVIDEO _IOW('F', 7, int)
+#define FBIOGVIDEO _IOR('F', 8, int)
diff --git a/sys/arch/amiga/include/kcore.h b/sys/arch/amiga/include/kcore.h
new file mode 100644
index 00000000000..e303289aaef
--- /dev/null
+++ b/sys/arch/amiga/include/kcore.h
@@ -0,0 +1,8 @@
+/* $NetBSD: kcore.h,v 1.1 1996/05/12 02:47:46 mhitch Exp $ */
+
+#ifndef _MACHINE_KCORE_H_
+#define _MACHINE_KCORE_H_
+
+#include <m68k/kcore.h>
+
+#endif
diff --git a/sys/arch/amiga/include/mtpr.h b/sys/arch/amiga/include/mtpr.h
index 914a48df312..5d85d6e656b 100644
--- a/sys/arch/amiga/include/mtpr.h
+++ b/sys/arch/amiga/include/mtpr.h
@@ -1,4 +1,4 @@
-/* $NetBSD: mtpr.h,v 1.9 1995/03/28 18:15:09 jtc Exp $ */
+/* $NetBSD: mtpr.h,v 1.10 1996/05/09 20:31:53 is Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -55,6 +55,9 @@
* <amiga/amiga/mtpr.h> ?
*/
#include <amiga/amiga/custom.h>
+#ifdef DRACO
+#include <amiga/amiga/drcustom.h>
+#endif
extern unsigned char ssir;
@@ -63,8 +66,16 @@ extern unsigned char ssir;
#define SIR_CBACK 0x4 /* walk the sicallback-chain */
#define siroff(x) ssir &= ~(x)
+#ifdef DRACO
+#define setsoftint() (is_draco()? (*draco_intfrc |= DRIRQ_SOFT) :\
+ (custom.intreq = INTF_SETCLR|INTF_SOFTINT))
+#define clrsoftint() (is_draco()? (*draco_intfrc &= ~DRIRQ_SOFT) :\
+ (custom.intreq = INTF_SOFTINT))
+#else
#define setsoftint() (custom.intreq = INTF_SETCLR|INTF_SOFTINT)
#define clrsoftint() (custom.intreq = INTF_SOFTINT)
+#endif
+
#define setsoftnet() (ssir |= SIR_NET, setsoftint())
#define setsoftclock() (ssir |= SIR_CLOCK, setsoftint())
#define setsoftcback() (ssir |= SIR_CBACK, setsoftint())