#!/bin/rc # # command: /bin/boddle /n/cd/sys/src/9/next eltec # srcdir: /n/cd/sys/src/9/next # version: 889686630 # date: Thu Mar 12 07:10:30 GMT 1998 # myname=$0 doextract=no fn usage{ echo $myname: usage: $myname '[-X] [src-directory]' >[1=2] exit usage } fn sigint{ rm -rf 889686630 exit interrupt } while(~ $1 -*){ switch($1){ case -X doextract=yes case -* usage } shift } switch($#*){ case 0 srcdir=/n/cd/sys/src/9/next case 1 srcdir=$1 case * usage } if(! ~ $doextract yes){ echo This shell file contains a bundle of diffs representing changes echo to original source files in the Plan 9 distribution. It will run echo against the files in echo ' ' $srcdir echo '(unless overridden by the optional source directory argument)' echo and create a directory 889686630 containing the updated files. echo It will NOT automatically update the original files. echo echo Invoke with argument -X to perform the actual extraction. exit 0 } rm -rf 889686630 mkdir 889686630 target=889686630/bbmalloc.c echo -n '889686630/bbmalloc.c: ' if(! test -f $srcdir/bbmalloc.c || ! test -r $srcdir/bbmalloc.c){ echo $srcdir/bbmalloc.c unreadable exit unreadable } sum=`{sum < $srcdir/bbmalloc.c} if(! ~ 970837ac1857 $sum(1)^$sum(2)){ echo $srcdir/bbmalloc.c is not the original distribution file exit original } cp $srcdir/bbmalloc.c 889686630/bbmalloc.c ed 889686630/bbmalloc.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM bbmalloc.c' 84,96d 73,75c void bbdflush(void *p, int n) { USED(p, n); flushcpucache(); . 71c USED(p); flushcpucache(); } . 69c flushvirtpage(void *p) . 33,35d wq //GO.SYSIN DD VADIM bbmalloc.c sum=`{sum < 889686630/bbmalloc.c} if(~ e148e5911597 $sum(1)^$sum(2)) echo if not{ echo 889686630/bbmalloc.c checksum error creating updated file exit checksum } target=889686630/clock.c echo -n '889686630/clock.c: ' if(! test -f $srcdir/clock.c || ! test -r $srcdir/clock.c){ echo $srcdir/clock.c unreadable exit unreadable } sum=`{sum < $srcdir/clock.c} if(! ~ 8aed6b321052 $sum(1)^$sum(2)){ echo $srcdir/clock.c is not the original distribution file exit original } cp $srcdir/clock.c 889686630/clock.c ed 889686630/clock.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM clock.c' 67,68c if((ur->sr&SUPER) == 0) { *(ulong*)(USTKTOP-BY2WD) += TK2MS(1); . 60c sccclock(); kproftimer(ur->pc); if((ur->sr&SPL(7))==0 && p && p->state==Running) { . 58d 55a . 52a } . 51c if (p->state==Running) { . 45,46d 38,43d 36c ulong nrun = 0; . 26,29c vicenable(2); *SS0 = (1<<6); /* 50Hz clock, restrict SLSEL0* access to kernel */ i = *SS1; *SS1 = i|(1<<5); /* restrict SLSEL1* access to kernel */ . 24c int i; . 22c clockinit(void) . 20d 15c ms *= 1200; /* guessed */ . 8a #define SS0 ((uchar*)VIC+0xC3) #define SS1 ((uchar*)VIC+0xCB) . wq //GO.SYSIN DD VADIM clock.c sum=`{sum < 889686630/clock.c} if(~ 1fa4d3701019 $sum(1)^$sum(2)) echo if not{ echo 889686630/clock.c checksum error creating updated file exit checksum } target=889686630/dat.h echo -n '889686630/dat.h: ' if(! test -f $srcdir/dat.h || ! test -r $srcdir/dat.h){ echo $srcdir/dat.h unreadable exit unreadable } sum=`{sum < $srcdir/dat.h} if(! ~ bcfc9c0a3404 $sum(1)^$sum(2)){ echo $srcdir/dat.h is not the original distribution file exit original } cp $srcdir/dat.h 889686630/dat.h ed 889686630/dat.h >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM dat.h' 166a /* * LANCE CSR3 (bus control bits) */ #define BSWP 0x4 /* Byte swap */ #define ACON 0x2 /* ALE Control */ #define BCON 0x1 /* Byte Control */ /* * system dependent lance stuff * filled by lancesetup() */ struct Lance { ushort lognrrb; /* log2 number of receive ring buffers */ ushort logntrb; /* log2 number of xmit ring buffers */ ushort nrrb; /* number of receive ring buffers */ ushort ntrb; /* number of xmit ring buffers */ ushort *rap; /* lance address register */ ushort *rdp; /* lance data register */ ushort busctl; /* bus control bits */ uchar ea[6]; /* our ether addr */ int sep; /* separation between shorts in lance ram as seen by host */ ushort *lanceram; /* start of lance ram as seen by host */ Lancemem *lm; /* start of lance ram as seen by lance */ Etherpkt *rp; /* receive buffers (host address) */ Etherpkt *tp; /* transmit buffers (host address) */ Etherpkt *lrp; /* receive buffers (lance address) */ Etherpkt *ltp; /* transmit buffers (lance address) */ }; extern uchar *intrreg; extern FPsave *initfpp; extern ulong vectors[]; . 164,165d 156a ulong svpsr; . 137c #define kunmap(k) /* do nothing */ . 133c typedef void KMap; . 131c * Fake the kmap as the kernel memory is transparently translated . 129a . 93a ulong mmuvme; /* MMU entry for VME mapping */ . 81d 66a struct Label { ulong sp; ulong pc; ushort sr; }; . 30,36d 22a /* * machine dependent definitions used by ../port/dat.h */ . 3a typedef struct Lance Lance; typedef struct Lancemem Lancemem; . wq //GO.SYSIN DD VADIM dat.h sum=`{sum < 889686630/dat.h} if(~ fe75ab5f4709 $sum(1)^$sum(2)) echo if not{ echo 889686630/dat.h checksum error creating updated file exit checksum } target=889686630/devrtc.c echo -n '889686630/devrtc.c: ' if(! test -f $srcdir/devrtc.c || ! test -r $srcdir/devrtc.c){ echo $srcdir/devrtc.c unreadable exit unreadable } sum=`{sum < $srcdir/devrtc.c} if(! ~ 7ff0e07c4990 $sum(1)^$sum(2)){ echo $srcdir/devrtc.c is not the original distribution file exit original } cp $srcdir/devrtc.c 889686630/devrtc.c ed 889686630/devrtc.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM devrtc.c' 347,348c rtc->mday = day + 1; rtc->mon = d; return; . 344c d2m = yrsize(rtc->year); . 339c rtc->year = d; . 328c rtc->hour = d; . 326c rtc->min = d % 60; . 324c rtc->sec = hms % 60; . 305c sec2rtc(ulong secs, Rtc *rtc) . 293,296c secs += (rtc->mday-1) * SEC2DAY; secs += rtc->hour * SEC2HOUR; secs += rtc->min * SEC2MIN; secs += rtc->sec; . 289,290c d2m = yrsize(rtc->year); for(i = 1; i < rtc->mon; i++) . 281c for(i = 1970; i < rtc->year; i++){ . 270c rtc2sec(Rtc *rtc) . 237a #define bcd2dec(bcd) (((((bcd)>>4) & 0x0F) * 10) + ((bcd) & 0x0F)) #define dec2bcd(dec) ((((dec)/10)<<4)|((dec)%10)) void setrtc(Rtc *rtc) { struct RTCdev *dev; dev = nvr.rtc; dev->control |= RTCWRITE; wbflush(); dev->year = dec2bcd(rtc->year % 100); dev->mon = dec2bcd(rtc->mon); dev->mday = dec2bcd(rtc->mday); dev->hour = dec2bcd(rtc->hour); dev->min = dec2bcd(rtc->min); dev->sec = dec2bcd(rtc->sec); wbflush(); dev->control &= ~RTCWRITE; wbflush(); } long rtctime(void) { struct RTCdev *dev; Rtc rtc; dev = nvr.rtc; dev->control |= RTCREAD; wbflush(); rtc.sec = bcd2dec(dev->sec) & 0x7F; rtc.min = bcd2dec(dev->min & 0x7F); rtc.hour = bcd2dec(dev->hour & 0x3F); rtc.mday = bcd2dec(dev->mday & 0x3F); rtc.mon = bcd2dec(dev->mon & 0x3F); rtc.year = bcd2dec(dev->year); dev->control &= ~RTCREAD; wbflush(); if (rtc.mon < 1 || rtc.mon > 12) return 0; /* * the world starts Jan 1 1970 */ if(rtc.year < 70) rtc.year += 2000; else rtc.year += 1900; return rtc2sec(&rtc); } . 199,221c error(Egreg); return 0; /* not reached */ . 184,197c switch(c->qid.path){ case Qrtc: if(offset!=0) error(Ebadarg); /* * read the time */ cp = ep = buf; ep += n; while(cp < ep){ if(*cp>='0' && *cp<='9') break; cp++; } secs = strtoul(cp, 0, 0); /* * convert to bcd */ sec2rtc(secs, &rtc); /* * write it */ qlock(&rtclock); setrtc(&rtc); qunlock(&rtclock); return n; case Qnvram: if(offset > NVWRITE) return 0; if(n > NVWRITE - offset) n = NVWRITE - offset; qlock(&rtclock); memmove(nvr.ram+offset, buf, n); qunlock(&rtclock); return n; . 179,181c Rtc rtc; ulong secs; . 164,173c switch(c->qid.path){ case Qrtc: qlock(&rtclock); t = rtctime(); do{ ot = t; t = rtctime(); /* make sure there's no skew */ }while(t != ot); qunlock(&rtclock); n = readnum(offset, buf, n, t, 12); return n; case Qnvram: if(offset > NVREAD) return 0; if(n > NVREAD - offset) n = NVREAD - offset; qlock(&rtclock); memmove(buf, nvr.ram+offset, n); qunlock(&rtclock); return n; } error(Egreg); return 0; /* not reached */ . 112,155d 67a . 56a nvr.rtc = (RTCdev*)(CLOCK+RTCOFF); nvr.ram = (uchar*)CLOCK; . 48,51d 41,44d 39a #define NRTC (sizeof(rtcdir)/sizeof(rtcdir[0])) void setrtc(Rtc*); long rtctime(void); . 38a "nvram", {Qnvram, 0}, 0, 0666, . 36,37c QLock rtclock; /* mutex on clock operations */ static Dirtab rtcdir[]={ . 30c static struct { uchar *ram; RTCdev *rtc; }nvr; . 28a ulong rtc2sec(Rtc *); void sec2rtc(ulong, Rtc *); . 24a int wday; . 20c typedef struct Rtc Rtc; struct Rtc . 18a #define RTCOFF 0x7F8 #define RTCREAD (0x40) #define RTCWRITE (0x80) #define NVREAD (2048-8) /* minus RTC */ #define NVWRITE (2048-8) /* minus RTC */ . 16,17c uchar control; /* read or write the device */ uchar sec; uchar min; uchar hour; uchar wday; uchar mday; uchar mon; uchar year; . 11,14c /* * Mostek MK48T02 * This driver is actually portable. */ typedef struct RTCdev RTCdev; struct RTCdev . wq //GO.SYSIN DD VADIM devrtc.c sum=`{sum < 889686630/devrtc.c} if(~ 283e87925994 $sum(1)^$sum(2)) echo if not{ echo 889686630/devrtc.c checksum error creating updated file exit checksum } target=889686630/fns.h echo -n '889686630/fns.h: ' if(! test -f $srcdir/fns.h || ! test -r $srcdir/fns.h){ echo $srcdir/fns.h unreadable exit unreadable } sum=`{sum < $srcdir/fns.h} if(! ~ 92c412151757 $sum(1)^$sum(2)){ echo $srcdir/fns.h is not the original distribution file exit original } cp $srcdir/fns.h 889686630/fns.h ed 889686630/fns.h >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM fns.h' 71,72c . 69d 67a void vicinit(void); void vicenable(int); Page* vmepgalloc(Segment*,ulong); void vmepgfree(Page*); #define wbflush() /* mips compatibility */ . 66a void trap(Ureg*); . 63,65c ulong tas(char*); . 56,61c void scsiintr(void); void setled(int); void setvbr(void*); . 48,54c void putcxsegm(int, ulong, int); void putenab(ulong); void systemreset(void); void screeninit(char*, int); . 39,44d 32,36c int kbdstate(IOQ*, int); #define KADDR(a) ((void*)((ulong)(a)|KZERO)) #define PADDR(a) ((ulong)(a)&~KZERO) KMap* kmapvme(ulong); KMap* kmappa(ulong); ulong kmapregion(ulong, ulong); void kunmap(KMap*); void lanceintr(void); void lancesetup(Lance*); void lancetoggle(void); . 28,30c ulong getsrp(void); void* getvbr(void); void intrinit(void); . 26c int fptrap(void); ulong getenab(void); . 18a void flushatcpage(ulong); . 7,17c void clockinit(void); void clockpri(int); void dcflush(void); #define evenaddr(x) /* 68030 doesn't care that much */ void initmmureg(ulong*, ulong*); void fault68030(Ureg*, FFrame*); . 3,5d wq //GO.SYSIN DD VADIM fns.h sum=`{sum < 889686630/fns.h} if(~ 92ee7b9b1507 $sum(1)^$sum(2)) echo if not{ echo 889686630/fns.h checksum error creating updated file exit checksum } target=889686630/io.h echo -n '889686630/io.h: ' if(! test -f $srcdir/io.h || ! test -r $srcdir/io.h){ echo $srcdir/io.h unreadable exit unreadable } sum=`{sum < $srcdir/io.h} if(! ~ 801e49883939 $sum(1)^$sum(2)){ echo $srcdir/io.h is not the original distribution file exit original } cp $srcdir/io.h 889686630/io.h ed 889686630/io.h >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM io.h' 158,174d 147,156c typedef struct CIOdev CIOdev; struct CIOdev { uchar c; #ifndef ELTECBOTCH uchar b; uchar a; #else uchar a; /* Eltec incorrectly exchanged A0 and A1 lines on second CIO */ uchar b; #endif uchar ptr; /* pointer register */ . 136,145c #define SCCADDR ((SCCdev*)SCC1) #define SCC2ADDR ((SCCdev*)SCC2) . 120,134d 115,118c #define KMFREQ 10000000 /* crystal frequency for kbd/mouse 8530 */ #define EIAFREQ 5000000 /* crystal frequency for serial port 8530 */ . 113d 110a uchar ptra; . 109d 53,104d 38,51c #define LANCERDP (ushort*)ETHER #define LANCERAP (ushort*)(ETHER+2) . 36c #define IPINBASE 0xFE400000 #define ETHER (IPINBASE+0x1300) /* Register data port (RDP) */ #define ETHERIRQVEC (IPINBASE+0x1401) /* Register for IRQ vector */ #define ETHERADDR (IPINBASE+0x3081) /* Non volatile RAM */ . 29,34c * The IPIN Cheapernet controller . 12,27d 10c #define EPROM 0xFE800000 /* System EEPROM */ #define CLOCK 0xFEC03000 /* clock and NVRAM (SRAM), not on 8k boundary */ #define VIC 0xFEC01000 /* Clock Tick Timer, not on 8k boundary */ #define SCC1 0xFEC00000 /* SCC for console */ #define STATUS 0XFEC04000 /* 1 nibble status display */ #define SCC2 0xFEC0B000 /* SCC-2, not on 8k boundary */ #define SCSI 0xFEC06000 /* WD33C93 scsi */ #define SCSIADDR 0xFEC07000 /* data buffer offset/start address */ #define SCSIFIFO 0xFEC05000 /* SCSI buffer FIFO register */ #define CIO 0xFEC02000 /* CIO registers */ #define CIO2 0xFEC0C000 /* CIO-2 registers */ #define VMEBASE 0x01000000 /* VME slots start at 16 Mbytes physical */ . 4,7c * Physical addresses for things . 1,2d wq //GO.SYSIN DD VADIM io.h sum=`{sum < 889686630/io.h} if(~ 3aa4060b1604 $sum(1)^$sum(2)) echo if not{ echo 889686630/io.h checksum error creating updated file exit checksum } target=889686630/l.s echo -n '889686630/l.s: ' if(! test -f $srcdir/l.s || ! test -r $srcdir/l.s){ echo $srcdir/l.s unreadable exit unreadable } sum=`{sum < $srcdir/l.s} if(! ~ 0327ec516421 $sum(1)^$sum(2)){ echo $srcdir/l.s is not the original distribution file exit original } cp $srcdir/l.s 889686630/l.s ed 889686630/l.s >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM l.s' 385a #ifdef UNUSED TEXT testaddr+0(SB), $0 MOVL addr+0(FP), A0 LONG $0xF0108000 /* PTEST (A0) */ SUBW $2, A7 MOVW MMUSR, (A7) MOVW (A7), R0 ADDW $2, A7 RTS #endif . 360a GLOBL tpt(SB), $(128*8) . 359a TEXT getvbr+0(SB), $0 MOVL VBR, R0 RTS TEXT setvbr+0(SB), $0 MOVL v+0(FP), A0 MOVL A0, VBR RTS . 351c BSR fault68030(SB) . 322a TEXT sccintrv(SB), $0 /* level 5 */ MOVL $DBMAGIC, -(A7) SUBL $((8+8+1)*BY2WD), A7 MOVEM $0x7FFF, (A7) MOVL $a6base(SB), A6 MOVL USP, A0 MOVL A0, ((8+8)*BY2WD)(A7) MOVL A7, -(A7) BSR sccintr(SB) BRA retintr . 320c MOVL $0, (A7)+ . 314c BSR clock(SB) /* fall through */ retintr: . 305c TEXT clockintrv(SB), $0 /* Level 6 */ . 296,303c BSR scsiintr(SB) BRA retintr . 287c TEXT scsiintrv(SB), $0 /* level 1 */ . 278,285c BSR lanceintr(SB) BRA retintr . 269c TEXT lanceintrv(SB), $0 /* level 2 */ . 250a /* Trap handlers */ . 238a #else CLRL R0 #endif . 235c #ifdef HAVEFP . 231a #endif . 229c #ifdef HAVEFP . 225a #endif . 223c #ifdef HAVEFP . 219a #endif . 218c #ifdef HAVEFP . 214a #else MOVL fp+0(FP), A0 MOVW $0, R0 MOVW R0, (A0) #endif . 213c #ifdef HAVEFP . 161,171c MOVL $TCINIT, -(A7) MOVL (A7), TC ADDW $4, A7 . 157,159c MOVL as+4(FP), R0 MOVL R0, -(A7) MOVL $RP_HIGH_LONG, -(A7) MOVL (A7), SRP /* QUAD move */ ADDW $8, A7 . 155d 151,153c MOVL au+0(FP), R0 MOVL R0, -(A7) MOVL $RP_HIGH_LONG, -(A7) MOVL (A7), URP /* QUAD move */ ADDW $8, A7 . 149c /* * Setup the MMU registers. Called as initmmureg(AU, AS) from mmuinit() * in mmu.c. Setup the root pointers to point to the A level page tables * passed as arguments. Then enable the MMU with 8K pages. */ TEXT initmmureg(SB), $0 . 143,147c /* * User entry point to control cache - e.g. flush */ TEXT cacrtrap(SB), $0 /* WORD $(PUSH|ALL|ICH|DCH) /* CPUSHA */ MOVL $(CCLEAR|CENABLE), R0 MOVL R0, CACR RTE . 141d 138c /* WORD $(PUSH|PAGE|DCH|ICH) /* CPUSHP , (A0) */ MOVL $(CENABLE|CCLEAR), R0 MOVL R0, CACR . 120,134c /* * Flush the CPU cache for a particular page */ . 117c LONG $0xF0103810 /* PFLUSH $0,$0,(A0) */ . 114c LONG $0xF0102400 /* PFLUSHA */ . 111a /* * Flush the MMU ATC entries corresponding to a particular page. */ . 109c LONG $0xF0102400 /* PFLUSHA */ . 106a /* * Flush the data cache. */ TEXT dcflush(SB), $0 MOVL $(DCCLEAR|CENABLE), R0 MOVL R0, CACR RTS /* * Flush the MMU address translation cache. */ . 102,103c MOVL $(CCLEAR|CENABLE), R0 . 99a /* * Flush the instruction and data caches. */ . 95a /* * Tag for profiling code. If callers pc is in range splhi to here * then spl's caller is charged, not splXX(). */ . 89a /* * Takes argument sr and assigns it to the status register */ . 80c /* * m.splpc = pc of caller; R0 = SR ; SR = Supervisor Mode & Intr Mask 111 */ . 73a /* * R0 = SR ; SR = Supervisor Mode & Intr Mask 000 */ . 60c * Take first processor into user mode. Argument passed is the new user * stack pointer. Allocates space on the kernel stack for a UReg. . 51,53d 48,49c /* * Select FC5 space */ MOVL $0x05, R0 MOVL R0, DFC MOVL R0, SFC . 45c ADDL $(MACHSIZE-4), A7 /* * u = 0; */ . 42a /* * Start the stack under the mach0 struct */ . 40a /* * Make a top-level page table that maps 0 and KZERO to phys. 0 * (using `early termination' page table entries to map a big region */ MOVL $tpt-KZERO(SB), A0 /* get phys addr of temporary page table */ MOVL A0, R0 ADDL $((128*4)-1), R0 /* align it */ ANDL $(~((128*4)-1)), R0 MOVL R0, A0 MOVL $PTEVALID, (A0) /* early termination pte: map va(0) to pa(0) so we are stable */ ADDL $(((KZERO>>25)&0xFF)*4), A0 /* KZERO base in level 1 ptab */ MOVL $PTEVALID, (A0) /* map va(KZERO) to pa(0) */ /* * map it */ MOVL R0, -(A7) MOVL $RP_HIGH_LONG, -(A7) MOVL (A7), SRP /* QUAD move */ ADDW $8, A7 MOVL R0, -(A7) MOVL $RP_HIGH_LONG, -(A7) MOVL (A7), URP /* QUAD move */ ADDW $8, A7 /* * Select FC5 space */ MOVL $0x05, R0 MOVL R0, DFC MOVL R0, SFC MOVL $TCINIT, -(A7) MOVL (A7), TC ADDW $4, A7 /* * Make PC relative to KZERO */ MOVL $highbits(SB), A0 JMP (A0) TEXT highbits(SB), $0 /* * Clear TT1 */ MOVL $0, -(A7) MOVL (A7), TT1 ADDW $4, A7 /* * m = *mach0; */ . 34,35c MOVL $edata-KZERO(SB), A0 MOVL $end-KZERO(SB), A1 . 32c * clear BSS (Block Started by Symbol - data segment) . 22,29c /* * TT0 maps VME and I/O space */ MOVL $(TTKERNELMAP), -(A7) MOVL (A7), TT0 ADDW $4, A7 . 18a /* * Disable the Data and Instruction Caches */ . 17c MOVW $(SUPER|SPL(7)), SR /* Intr Mask 111 & Supervisor Mode */ . 10a #undef CENABLE #define CENABLE CDISABLE . 9a #define STATUS 0XFEC04000 /* 1 nibble status display */ #define STEP(x) MOVL $(STATUS), A3; MOVW $(((x)<<4)&0xF0), R3; MOVB R3, (A3) . 0a /* eltec - 68030 by dave */ . wq //GO.SYSIN DD VADIM l.s sum=`{sum < 889686630/l.s} if(~ d98feb808711 $sum(1)^$sum(2)) echo if not{ echo 889686630/l.s checksum error creating updated file exit checksum } target=889686630/main.c echo -n '889686630/main.c: ' if(! test -f $srcdir/main.c || ! test -r $srcdir/main.c){ echo $srcdir/main.c unreadable exit unreadable } sum=`{sum < $srcdir/main.c} if(! ~ 20042e244895 $sum(1)^$sum(2)){ echo $srcdir/main.c is not the original distribution file exit original } cp $srcdir/main.c 889686630/main.c ed 889686630/main.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM main.c' 319a /* * set up the lance */ void lancesetup(Lance *lp) { uchar *nv = (uchar*)ETHERADDR; ulong pa; int i; lp->rap = LANCERAP; lp->rdp = LANCERDP; *(uchar*)ETHERIRQVEC = 29; /* vector 29: autovector 5 (LIRQ5) */ /* * get lance address */ for(i = 0; i < 6; i++) { lp->ea[i] = ((nv[0]&0xf)<<4)|(nv[2]&0xf); nv += 4; } lp->lognrrb = 7; lp->logntrb = 7; lp->nrrb = 1<lognrrb; lp->ntrb = 1<logntrb; lp->sep = 1; lp->busctl = BSWP; /* * Allocate area for lance init block and descriptor rings. */ pa = PADDR(xspanalloc(BY2PG, BY2PG, 0)); lp->lanceram = (ushort*)KADDR(pa); /* As we see it */ lp->lm = (Lancemem*)pa; /* As lance sees it */ memset((void*)KADDR(pa), 0, BY2PG); /* * Allocate space in host memory for the io buffers. */ i = (lp->nrrb+lp->ntrb)*sizeof(Etherpkt); i = (i+(BY2PG-1))/BY2PG; pa = PADDR(xspanalloc(i*BY2PG, BY2PG, 0)); lp->lrp = (Etherpkt*)pa; lp->rp = (Etherpkt*)KADDR(pa); lp->ltp = lp->lrp+lp->nrrb; lp->tp = lp->rp+lp->nrrb; } . 312,313c }else{ . 309a u->p->fpstate = FPinit; . 302,303d 295c u->p->fpstate = FPactive; . 293a if(u->fpsave.size > sizeof u->fpsave.junk) panic("fpsize %d max %d\n", u->fpsave.size, sizeof u->fpsave.junk); . 286c * Save the machine-specific part of the process state. . 266c if(cpuserver) conf.nproc = 500; . 261,263c mbytes = (conf.npage*BY2PG)>>20; mul = 1 + (mbytes+11)/12; if(mul > 2) mul = 2; conf.nproc = 50*mul; if(cpuserver) conf.nswap = conf.npage*2; else conf.nswap = 16*MB/BY2PG; . 255a i = screenbits()-1; /* Calculate % of memory for page pool */ i = 70 - (i*10); conf.upages = (conf.npage*i)/100; if(cpuserver){ i = conf.npage-conf.upages; if(i > (12*MB)/BY2PG) conf.upages += i - ((12*MB)/BY2PG); } if(conf.npage - conf.upages < (2*MB)/BY2PG) conf.upages = conf.npage - (2*MB)/BY2PG; . 252,254c /* * Memory banking is simple, as we don't have very * much of it, and it is physically contiguous. */ conf.base0 = 0; conf.npage0 = 2*MB/BY2PG; conf.base1 = 2*MB; conf.npage1 = 2*MB/BY2PG; conf.npage = conf.npage0 + conf.npage1; . 246,250c mavail = 4*MB; /* Probe ?? */ conf.monitor = 0; /* Humph! */ . 242,244d 236,237c int mul; ulong i; ulong mavail; ulong ktop, mbytes; . 211,230d 204,208c *(uchar*)(VIC+0xE3) = 0xF0; /* reset */ for(;;); . 202a spllo(); print("cpu %d exiting\n", m->machno); while(consactive()) for(i=0; i<1000; i++) ; . 200a int i; USED(ispanic); . 184c av[ac++] = pusharg("/68020/9eltec"); . 159d 127c p->sched.sp = USERADDR+BY2PG-MAXSYSARG*BY2WD; . 122,124d 94a . 90c ksetterm("eltec %s"); . 79,82c print("Eltec Eurocom6\n"); . 76c predawn = 0; . 66c /* * disable the scc (clear master interrupt enable) */ SCCADDR->ptra = 9; wbflush(); onepointseven(); SCCADDR->ptra = 0; wbflush(); onepointseven(); SCC2ADDR->ptra = 9; wbflush(); onepointseven(); SCC2ADDR->ptra = 0; wbflush(); /* * set scc's interrupt vector */ SCCADDR->ptra = 2; wbflush(); onepointseven(); SCCADDR->ptra = 28; /* autovector 4 */ wbflush(); onepointseven(); SCC2ADDR->ptra = 2; wbflush(); onepointseven(); SCC2ADDR->ptra = 28; /* autovector 4 */ wbflush(); onepointseven(); /* tell scc driver its addresses */ sccsetup((void*)SCC1, EIAFREQ, 1); sccsetup((void*)SCC2, EIAFREQ, 1); . 64c /* * disable the lance */ *LANCERAP = 0; *LANCERDP = 0x4; . 58d 46a . 43a clockinit(); . 41d 36a if(conf.monitor == 0) sccspecial(0, &printq, &kbdq, 9600); vicenable(4); /* LIRQ4: scc */ vicenable(5); /* LIRQ5: ether */ pageinit(); . 34,35c setvbr(vectors); if(conf.monitor) screeninit(0, 0); vicinit(); printinit(); . 30,32d 15,21d 13a void onepointseven(void); int predawn = 1; . 12c int cpuserver; Label catch; . 10a #include . 7d wq //GO.SYSIN DD VADIM main.c sum=`{sum < 889686630/main.c} if(~ 7576f4e56772 $sum(1)^$sum(2)) echo if not{ echo 889686630/main.c checksum error creating updated file exit checksum } target=889686630/mem.h echo -n '889686630/mem.h: ' if(! test -f $srcdir/mem.h || ! test -r $srcdir/mem.h){ echo $srcdir/mem.h unreadable exit unreadable } sum=`{sum < $srcdir/mem.h} if(! ~ d520a3102996 $sum(1)^$sum(2)){ echo $srcdir/mem.h is not the original distribution file exit original } cp $srcdir/mem.h 889686630/mem.h ed 889686630/mem.h >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM mem.h' 115d 113c /* * MMU Root pointers - common high bits (32 bits) */ #define LOWER_LIMIT (1<<31) #define RP_HIGH_LONG (LOWER_LIMIT|DESCVALID) . 100,111c #define TCINIT (TCENABLE|TCSRPENABLE|TCFCLDISABLE|TC8KPAGES|\ TCNOSHIFT|TCTIA|TCTIB|TCTIC|TCTID) . 98a #define TCENABLE (1<<31) /* Enable translation by MMU */ #define TCSRPENABLE (1<<25) /* Enable Supervisor Root Pointer */ #define TCFCLDISABLE (0<<24) /* Disable Function Code Lookup */ #define TC8KPAGES (13<<20) /* Set 8K Page size (1101) */ #define TCNOSHIFT (0<<16) /* Use maximum virtual address space */ #define TCTIA (7<<12) /* A Table Index */ #define TCTIB (7<<8) /* B Table Index */ #define TCTIC (5<<4) /* C Table Index */ #define TCTID 0 /* D Table Index */ . 92,97c * MMU Translation control register . 90a /* transparently map supervisor r/w/rw accesses at and beyond 0xF0000000 */ #define TTKERNELMAP (TTENABLE|TTNOCACHE|TTRDWR|TTFCBASE(5)|TTFCMASK(0)|TTLOGICAL(0xF0)|TTMASK(0x0F)) . 89a /* * Transparent translation registers TT0 and TT1 */ #define TTENABLE (1<<15) /* enable TTx */ #define TTDISABLE (0<<15) /* disable TTx */ #define TTNOCACHE (1<<10) /* disable caching of TTx memory */ #define TTCACHE (0<<10) /* enable caching of TTx'd memory */ #define TTRDWR (1<<8) /* transparent for read & write */ #define TTFCMASK(x) ((x)<<0) /* mask to ignore the function code */ #define TTFCBASE(x) ((x)<<4) #define TTLOGICAL(n) (n<<24) /* logical address base */ #define TTMASK(n) (n<<16) /* mask for LAB to allow > 16MB */ . 87,88c #define UVME 0xA1000000 /* virtual address of VME slot 0 mapped by segattach */ #define UVMETOP 0xA2000000 /* end of VME mapping segment */ . 84,85c #define UZERO 0x00000000 /* base of user address space */ #define UTZERO (UZERO+BY2PG) /* first address in user text */ #define TSTKTOP 0x04000000 /* end of new stack in sysexec */ #define TSTKSIZ 32 #define USTKTOP (TSTKTOP-TSTKSIZ*BY2PG) /* byte just beyond user stack */ #define KZERO 0x04000000 /* base of kernel address space */ #define KTZERO (KZERO+BY2PG*2) /* first address in kernel text */ #define USTKSIZE (4*1024*1024) /* size of user stack */ #define MACHSIZE 4096 #define KIO 0x06000000 /* 128MB virtual is I/O space */ #define KIOTOP (KIO+VMESLOTSIZE) /* 16Mbytes is enough for I/O */ #define KVME KIOTOP /* base for mapping VME cards */ #define KVMETOP (KVME+3*VMESLOTSIZE) /* enough to map three I/O cards */ . 82c * Address spaces . 80a #define PPN(x) ((x)&~(BY2PG-1)) /* Physical page number */ #define VMESLOTSIZE (1<<25) /* must be aligned on A-level page table boundary */ . 77,79c #define SEGMAPSIZE 128 . 68,75c #define DESCVALID 2 /* Valid 4 byte */ #define PTEVALID 1 /* Page descriptor */ #define PTERONLY (1<<2) /* Read only */ #define PTEWRITE (0<<2) /* Read Write */ #define PTEACCESS (1<<3) /* PTE has been accessed */ #define PTENOCACHE (1<<6) /* Don't cache this page */ #define PTEUNCACHED PTENOCACHE #define PTEMODIFY (1<<4) /* Page has been changed */ #define INVALIDPTE 0 /* An invalid PTE */ /* The sections of the short format table descriptor that contain the addr */ #define PTEAMASK 0xFFFFFFF0 #define PTEBMASK 0xFFFFFFF0 /* The section of the page descriptor that contains the page address */ #define PAGEMASK 0xFFFFFF00 /* definitions for ../port/alarm.h */ #define PTEMAPMEM (1024*1024) . 65a * MMU regions */ #define INVALIDSEGM (MONSTART-BY2SEGM) /* highest seg of VA reserved as invalid */ #define INVALIDPMEG (conf.npmeg-1) #define IOSEGSIZE (MB + 2*MB) /* 1 meg for screen plus overhead */ #define IOSEGM (INVALIDSEGM - IOSEGSIZE) /* . 61,63c #define BY2SEGM (1<<17) . 54c #define UREGVARSZ (23*BY2WD) /* size of variable part of Ureg */ . 52c #define USERADDR 0x0F000000 . 40a #define CCLEAR (DCCLEAR|ICCLEAR) /*#define CENABLE (WALLOCATE|ICENABLE|DCENABLE)*/ #define CENABLE ICENABLE #define CDISABLE 0 . 38,39c #define WALLOCATE (1<<13) /* write allocate */ #define ICENABLE 0x01 /* enable caches */ #define DCENABLE (1<<8) #define ICFREEZE (1<<1) /* freeze caches */ #define DCFREEZE (1<<9) #define ICCLRENT (1<<2) /* clear an entry */ #define DCCLRENT (1<<10) #define ICCLEAR (1<<3) /* clear caches */ #define DCCLEAR (1<<11) #define ICBURST (1<<4) /* burst enable */ #define DCBURST (1<<12) . 36c * CACR - D* = data cache I* = instruction cache . 25,27c #define TK2SEC(t) ((t)/HZ) /* ticks to seconds */ #define TK2MS(t) ((((ulong)(t))*1000)/HZ) /* ticks to milliseconds */ #define MS2TK(t) ((((ulong)(t))*HZ)/1000) /* milliseconds to ticks */ . 23c #define HZ 50 /* clock frequency */ . 21d wq //GO.SYSIN DD VADIM mem.h sum=`{sum < 889686630/mem.h} if(~ 31a4f9d25473 $sum(1)^$sum(2)) echo if not{ echo 889686630/mem.h checksum error creating updated file exit checksum } target=889686630/mkfile echo -n '889686630/mkfile: ' if(! test -f $srcdir/mkfile || ! test -r $srcdir/mkfile){ echo $srcdir/mkfile unreadable exit unreadable } sum=`{sum < $srcdir/mkfile} if(! ~ 64c3bb431270 $sum(1)^$sum(2)){ echo $srcdir/mkfile is not the original distribution file exit original } cp $srcdir/mkfile 889686630/mkfile ed 889686630/mkfile >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM mkfile' 69c $LD -a -o 9 -l -b 0x0F002020 -3 $prereq -lgnot -lc > nm . 60c $LD -l -s -o init.out -R4 -3 initcode.$O . 57a clock.$O screen.$O fault68030.$O main.$O: /$objtype/include/ureg.h . 54,56c screen.$O devbit.$O: /sys/include/gnot.h . 51c $LD -o $target -l -T0x04004020 -R0x4 -3 $OBJ $CONF.$O -lgnot -lg -lauth -lc . 49c 9$CONF: $OBJ $CONF.c /$objtype/lib/libgnot.a /$objtype/lib/libg.a . 45c auth.$O\ . 40c vic.$O\ . 36d 29,30d 25a alloc.$O\ segment.$O\ swap.$O\ . 22c fault68030.$O\ . 16,17d 1,2c CONF=eltec CONFLIST=eltec elteccpu . wq //GO.SYSIN DD VADIM mkfile sum=`{sum < 889686630/mkfile} if(~ 3d6e4a041199 $sum(1)^$sum(2)) echo if not{ echo 889686630/mkfile checksum error creating updated file exit checksum } target=889686630/mmu.c echo -n '889686630/mmu.c: ' if(! test -f $srcdir/mmu.c || ! test -r $srcdir/mmu.c){ echo $srcdir/mmu.c unreadable exit unreadable } sum=`{sum < $srcdir/mmu.c} if(! ~ b8a17a936625 $sum(1)^$sum(2)){ echo $srcdir/mmu.c is not the original distribution file exit original } cp $srcdir/mmu.c 889686630/mmu.c ed 889686630/mmu.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM mmu.c' 360,361c lock(pg); if(--pg->ref == 0) { lock(&vmealloc); pg->next = vmealloc.free; vmealloc.free = pg; unlock(&vmealloc); } unlock(pg); . 358c vmepgfree(Page *pg) . 356a #define NVMEPG 128 struct { Lock; int init; Page *free; } vmealloc; static Page vmepages[NVMEPG]; Page* vmepgalloc(Segment*, ulong va) { Page *pg; static int doneinit; lock(&vmealloc); if(!vmealloc.init) { vmealloc.init = 1; for(pg = vmepages; pg < &vmepages[NVMEPG]; pg++) { pg->next = vmealloc.free; vmealloc.free = pg; } } pg = vmealloc.free; if(pg) vmealloc.free = pg->next; else panic("vmepgalloc"); unlock(&vmealloc); if(pg) { pg->ref = 1; pg->va = va; pg->pa = va & 0x0FFFFFFF; pg->modref = 0; pg->next = 0; } return pg; } . 354c return (KMap *)k; . 348,352c k = kmapalloc.vme; if(kmapalloc.vme+VMESLOTSIZE >= KVMETOP || AS[AOFF(k)] != 0) { unlock(&kmapalloc); return 0; } kmapalloc.vme += VMESLOTSIZE; AS[AOFF(k)] = PPN(pa)|PTEWRITE|PTENOCACHE|PTEVALID; /* `early termination' entry: 32 Mbytes */ flushatc(); /* i can't remember whether it caches failures */ . 342,343c KMap * kmapvme(ulong pa) . 339c return (KMap *)k; . 333,337c k = kmapalloc.io; kmapalloc.io += BY2PG; if(kmapalloc.io >= KIOTOP) panic("kmappa"); putkmmu(k, pa|PTENOCACHE); . 329a KMap *k; ulong va; int i, j; i = (n+(BY2PG-1))/BY2PG; va = 0; for(j=0; jmmuptr); memset((uchar*)c, 0, 32*sizeof(ulong)); . 264a . 260,261c p->mmuA[1] = (ulong)(p->mmuptr) | DESCVALID; AU[1] = p->mmuA[1]; AS[1] = p->mmuA[1]; . 257,258c p->mmuA[0] = (ulong)(p->mmuptr) | DESCVALID; AU[0] = p->mmuA[0]; AS[0] = p->mmuA[0]; . 253,255c b = (ulong*)KADDR((AU[AOFF(tlbvirt)] & PTEAMASK)); if(b == (ulong*)KZERO){ b = (ulong*)KADDR(p->mmuptr); . 228c flushpage((ulong)pg->va); . 222c s = splhi(); . 216c /*print("putmmu v=%lux p=%lux\n", tlbvirt, tlbphys);*/ if(tlbvirt >= UVME && tlbvirt < UVMETOP) { /* VME slots */ p->mmuvme = vmemap0; AU[AOFF(UVME)] = p->mmuvme; AS[AOFF(UVME)] = p->mmuvme; return; } . 185c AU[1] = 0; AS[1] = 0; p->mmuvme = 0; AU[AOFF(UVME)] = 0; AS[AOFF(UVME)] = 0; . 183c AU[0] = 0; AS[0] = 0; . 181a dcflush(); . 149c vmept0 = (ulong*)xspanalloc(128*sizeof(ulong), 128*sizeof(ulong), 0); for(i=0; i<64; i++) vmept0[i+64] = (PPN(VMEBASE + i*(1<<18)))|PTEWRITE|PTENOCACHE|PTEVALID; vmemap0 = PADDR(vmept0) | DESCVALID; . 147c * build a page table for VME mapping, for processes that do the right segattach; * the 16 Mbyte slot is mapped by the second half of a B-level page table. . 143,144c upt = putkmmu(USERADDR, 0); . 140,141c * Create a page table entry for the User area . 136,137c initmmureg((ulong*)PADDR(AU), (ulong*)PADDR(AS)); . 133,134c * Set up new user and kernel root pointers; * set TC to 8K pages, enabled . 130c AS[AOFF(KZERO)] = PPN(0)|PTEWRITE|PTEVALID; /* `early termination' entry */ . 128c * map physical memory to KZERO, assuming that USERADDR is outside this range . 125c AS = (ulong*)xspanalloc(128*sizeof(ulong), 128*sizeof(ulong), 0); AU = (ulong*)xspanalloc(128*sizeof(ulong), 128*sizeof(ulong), 0); . 121,123c * Allocate new A level page tables for both User and Supervisor . 118c int i; . 112c print("%s AS = %lux\n", tag, AS); for(ia = 0; ia < 128; ia++) if(AS[ia]){ print("AS[%d] = %lux\n", ia, AS[ia]); if((AS[ia]&3) != DESCVALID) continue; b = (ulong*)KADDR(AS[ia] & PTEAMASK); for(ib = 0; ib < 128; ib++) if(b[ib]){ print("\tB[%d] = %lux\n", ib, b[ib]); if((b[ib]&3) != DESCVALID) continue; c = (ulong*)KADDR(b[ib] & PTEBMASK); for(ic = 0; ic < 32; ic += 4) print("\t%lux: %lux %lux %lux %lux\n", c+ic, c[ic], c[ic+1], c[ic+2], c[ic+3]); } } delay(4000); . 106c if((b[ib]&3) != DESCVALID) continue; c = (ulong*)KADDR(b[ib] & PTEBMASK); . 100,102c if(AU[ia]){ print("AU[%d] = %lux\n", ia, AU[ia]); if((AU[ia]&3) != DESCVALID) continue; b = (ulong*)KADDR(AU[ia] & PTEAMASK); . 98c print("%s AU = %lux\n", tag, AU); . 85c b[BOFF(virt)] = PADDR(c) | DESCVALID; . 82,83c c = (ulong*)KADDR(b[BOFF(virt)] & PTEBMASK); if(c == (ulong*)KZERO){ . 80c AS[AOFF(virt)] = PADDR(b) | DESCVALID; . 77,78c b = (ulong*)KADDR(AS[AOFF(virt)] & PTEAMASK); if(b == (ulong*)KZERO){ . 61d 57,59c AS[0] = p->mmuA[0]; AS[1] = p->mmuA[1]; AU[0] = p->mmuA[0]; AU[1] = p->mmuA[1]; AU[AOFF(UVME)] = p->mmuvme; AS[AOFF(UVME)] = p->mmuvme; *upt = PPN(p->upage->pa) | PTEVALID; . 53c p->mmuvme = 0; p->mmuptr = 0; . 45d 37c /*print("mapstack %d 0x%lux %d\n", p->pid, p->upage->pa, p->newtlb);*/ . 18,26d 12a ulong vmemap0; /* A level page descriptor for VME slot 0 */ ulong *vmept0; /* B level page table for VME slot 0 */ . 10c void dumpmmu(char*); ulong *AS; /* A level page table (supervisor) */ ulong *AU; /* A level page table (user) */ . 8a struct { ulong io; ulong vme; Lock; } kmapalloc = {KIO, KVME}; . wq //GO.SYSIN DD VADIM mmu.c sum=`{sum < 889686630/mmu.c} if(~ e31e27509020 $sum(1)^$sum(2)) echo if not{ echo 889686630/mmu.c checksum error creating updated file exit checksum } target=889686630/screen.h echo -n '889686630/screen.h: ' if(! test -f $srcdir/screen.h || ! test -r $srcdir/screen.h){ echo $srcdir/screen.h unreadable exit unreadable } sum=`{sum < $srcdir/screen.h} if(! ~ 5dc44a5a209 $sum(1)^$sum(2)){ echo $srcdir/screen.h is not the original distribution file exit original } cp $srcdir/screen.h 889686630/screen.h ed 889686630/screen.h >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM screen.h' 9,11d 0a typedef struct Mouseinfo Mouseinfo; typedef struct Cursorinfo Cursorinfo; struct Mouseinfo{ /* * First three fields are known in some l.s's */ int dx; /* interrupt-time delta */ int dy; int track; /* update cursor on screen */ Mouse; int changed; /* mouse structure changed since last read */ Rendez r; int newbuttons; /* interrupt time access only */ int clock; /* check mouse.track on RTE */ }; struct Cursorinfo{ Cursor; Lock; int visible; /* on screen */ int disable; /* from being used */ Rectangle r; /* location */ }; extern Mouseinfo mouse; extern Cursorinfo cursor; . wq //GO.SYSIN DD VADIM screen.h sum=`{sum < 889686630/screen.h} if(~ 66b1f22f750 $sum(1)^$sum(2)) echo if not{ echo 889686630/screen.h checksum error creating updated file exit checksum } target=889686630/scsi.c echo -n '889686630/scsi.c: ' if(! test -f $srcdir/scsi.c || ! test -r $srcdir/scsi.c){ echo $srcdir/scsi.c unreadable exit unreadable } sum=`{sum < $srcdir/scsi.c} if(! ~ 5416f2225499 $sum(1)^$sum(2)){ echo $srcdir/scsi.c is not the original distribution file exit original } cp $srcdir/scsi.c 889686630/scsi.c ed 889686630/scsi.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM scsi.c' 290,292c Scsibuf *b; b = xalloc(sizeof(Scsibuf)); b->virt = xalloc(n); b->phys = (void*)PADDR(b->virt); return b; . 287,288c Scsibuf * scsialloc(ulong n) . 284d 277,282c status = GET(SCSI_Status); DPRINT("I%2.2x ", status); switch(status){ case 0x00: /* reset by command or power-up */ case 0x01: /* reset by command or power-up */ scsireset0(); break; case 0x21: /* Save Data Pointers message received */ flushdma(-1); PUT(Cmd_phase, 0x41); PUT(Cmd, Select_and_Xfr); break; case 0x16: /* select-and-transfer completed */ flushdma(-1); case 0x42: /* timeout during select */ scsirun(); break; case 0x4b: /* unexpected status phase */ flushdma(-1); dev->asr = Target_LUN; kprint("lun/status 0x%ux\n", dev->data); phase = dev->data; kprint("phase 0x%ux\n", phase); PUT(Tc_hi, 0); dev->data = 0; dev->data = 0; switch(phase){ case 0x50: case 0x60: break; default: phase = 0x46; break; } PUT(Cmd_phase, phase); PUT(Cmd, Select_and_Xfr); break; default: kprint("scsintr 0x%ux\n", status); dev->asr = Target_LUN; kprint("lun/status 0x%ux\n", dev->data); kprint("phase 0x%ux\n", dev->data); switch (status&0xf0) { case 0x00: case 0x10: case 0x20: case 0x40: case 0x80: if(status & 0x08){ n = GET(Tc_hi); n = (n<<8)|dev->data; n = (n<<8)|dev->data; kprint("count 0x%.6ux", n); DPRINT(" count %ld", n); flushdma(n); } scsirun(); break; default: panic("scsi status 0x%2.2ux", status); } kprint("resetting..."); PUT(Own_id, scsiownid); PUT(Cmd, Reset); break; . 274,275c Scsictl *dev = DEV; int status, phase; long n; . 272c scsiintr(void) . 265,268c count -= n; if(p->rflag && count) dbaunload(p->data.ptr, count); p->data.ptr += count; . 253,263c count = p->data.lim - p->data.ptr; if(n > count) { print("scsi dma overflow: req=%ld n=%d\n", count, n); n = count; . 204,251c p = activereq; if(p == 0) . 195,202c if(n < 0) { n = GET(Tc_hi); n = (n<<8)|dev->data; n = (n<<8)|dev->data; . 190,193c static void flushdma(int n) { Scsictl *dev = DEV; Scsi *p; long count; . 188c PUT(Control, 0x49); /* DBA mode, EDI, halt on parity error */ PUT(Control+1, (100*10+79)/80); /* 100 msec at 10MHz */ PUT(Src_id, 0x80); /* enable reselection */ /* dev->ctrl = 0; /* abort any dma in progress */ scsirun(); print("scsi reset0\n"); } . 185,186c static void scsireset0(void) { Scsictl *dev = DEV; . 179,183c scsibusy = 0; activereq = 0; wakeup(&scsirendez); } . 176,177c static void scsirun(void) . 168,170c tsleep(&scsirendez, scsidone, 0, 1000); if(scsibusy) { activereq = 0; scsibusy = 0; kprint("wd33 locked, resetting\n"); PUT(Own_id, scsiownid); PUT(Cmd, Reset); if(++retries > 3) { qunlock(&scsilock); error(Eio); } goto Retry; } DPRINT(">\n"); if(p->data.ptr > p->data.lim) panic("scsi buf overflow"); p->status = GET(Target_LUN); p->status |= dev->data<<8; . 161,166c qlock(&scsilock); Retry: activereq = p; if(rflag == 0 && nb) dbaload(p->data.ptr, nb); if ((scsiownid & 0x08) && rflag) PUT(Dest_id, 0x40|p->target); else PUT(Dest_id, p->target); PUT(Target_LUN, p->lun); PUT(Tc_hi, nb>>16); dev->data = nb>>8; dev->data = nb; if (scsiownid & 0x08) { n = p->cmd.lim - p->cmd.ptr; DPRINT("len=%d ", n); PUT(Own_id, n); } PUT(CDB, *(p->cmd.ptr)++); while (p->cmd.ptr < p->cmd.lim) dev->data = *p->cmd.ptr++; scsibusy = 1; PUT(Cmd, Select_and_Xfr); /*PUT(Cmd, Select_with_ATN_and_Xfr);*/ . 133,159c nb = p->data.lim - p->data.ptr; DPRINT("scsi %d.%d %2.2ux rf %d nb %ld ", p->target, p->lun, *(p->cmd.ptr), rflag, nb); if((ulong)p->data.ptr & 1 || nb >= 0x10000) { print("scsi: bad datap/count: #%lux #%lux\n", p->data.ptr, nb); print("scsi: base=#%lux ptr=#%lux lim=#%lux\n", p->data.base, p->data.ptr, p->data.lim); p->data.ptr = p->data.lim = p->data.base; error(Eio); . 127,131c debug = scsidebugs[p->target&7]|scsidebugs[scsiownid&7]; . 123,125c Scsictl *dev = DEV; long n, nb; int retries = 0; . 117c return (scsibusy == 0); . 102,110c static void dbaunload(void *buf, long nb) { Scsictl *dev = DEV; ushort *kp; long nw; DPRINT(" (#%lux,%ld)<-dba", buf, nb); dev->ctr = 0; kp = (ushort*)buf; nw = nb/2; while(--nw >= 0) *kp++ = dev->fifo; if(nb & 1) *kp = dev->fifo & 0xff00; dev->ctr = 0; . 98,100c DPRINT(" dba<-(#%lux,%ld)", buf, nb); dev->ctr = 0; kp = (ushort*)buf; nw = nb/2; while(--nw >= 0) dev->fifo = *kp++; if(nb & 1) dev->fifo = *kp & 0xff00; dev->ctr = 0; } . 96c Scsictl *dev = DEV; ushort *kp; long nw; . 93,94c static void dbaload(void *buf, long nb) . 90a Scsictl *dev = DEV; /* dev->ctrl = Sreset; delay(25); dev->ctrl = 0;*/ vicenable(3); /* LIRQ3: scsi */ scsiownid &= 0x0f; /* possibly advanced features */ scsiownid |= 0x00; /* 8-10MHz */ PUT(Own_id, scsiownid); PUT(Cmd, Reset); while(dev->asr & CIP) ; . 88a resetscsi(void) {} void . 79,86c static void nop(void) {} . 69,77c static QLock scsilock; static Rendez scsirendez; static long debug, scsibusy; static Scsi *activereq; . 40,67c enum Aux_status { INT=0x80, LCI=0x40, BSY=0x20, CIP=0x10, PE=0x02, DBR=0x01, }; . 35,38c enum Commands { Reset = 0x00, Assert_ATN = 0x02, Negate_ACK = 0x03, Select_with_ATN = 0x06, Select_with_ATN_and_Xfr = 0x08, Select_and_Xfr = 0x09, Transfer_Info = 0x20, SBT = 0x80, /* modifier for single-byte transfer */ }; . 25,32c enum SBIC_regs { Own_id=0x00, Control=0x01, CDB=0x03, Target_LUN=0x0f, Cmd_phase=0x10, Sync_period=0x11, Tc_hi=0x12, Dest_id=0x15, Src_id=0x16, SCSI_Status=0x17, Cmd=0x18, Data=0x19, . 21,23c #define PUT(a,d) (dev->asr=(a), dev->data=(d)) #define GET(a) (dev->asr=(a), dev->data) . 18,19c #define DEV ((Scsictl*)SCSIFIFO) . 15,16c typedef struct Scsictl { ushort fifo; /* 0000 DBA fifo */ uchar fill0[0x1000-2]; uchar asr; /* 1000 wd33c93 address/status register */ uchar data; /* 1001 wd33c93 data register */ uchar fill1[0x1000-2]; ushort ctr; /* 2000 DBA data counter preset */ } Scsictl; . 12,13c int scsidebugs[8]={0,1,1,0,0,0,0,0}; int scsiownid = 0x08|7; /* enable advanced features */ . 10a #define kprint print . 8a #include "../port/error.h" . 6,7d wq //GO.SYSIN DD VADIM scsi.c sum=`{sum < 889686630/scsi.c} if(~ af9812e46264 $sum(1)^$sum(2)) echo if not{ echo 889686630/scsi.c checksum error creating updated file exit checksum } target=889686630/scsibuf.c echo -n '889686630/scsibuf.c: ' if(! test -f $srcdir/scsibuf.c || ! test -r $srcdir/scsibuf.c){ echo $srcdir/scsibuf.c unreadable exit unreadable } sum=`{sum < $srcdir/scsibuf.c} if(! ~ 73bfbdd11001 $sum(1)^$sum(2)){ echo $srcdir/scsibuf.c is not the original distribution file exit original } cp $srcdir/scsibuf.c 889686630/scsibuf.c ed 889686630/scsibuf.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM scsibuf.c' 41a if(datasize > bufdatasize) panic("scsibuf size"); . 38c scsibuf(ulong datasize) . 27a bufdatasize = datasize; . 21a static ulong bufdatasize; . 16c #define Nbuf 8 . wq //GO.SYSIN DD VADIM scsibuf.c sum=`{sum < 889686630/scsibuf.c} if(~ a03633061115 $sum(1)^$sum(2)) echo if not{ echo 889686630/scsibuf.c checksum error creating updated file exit checksum } target=889686630/segment.h echo -n '889686630/segment.h: ' if(! test -f $srcdir/segment.h || ! test -r $srcdir/segment.h){ echo $srcdir/segment.h unreadable exit unreadable } sum=`{sum < $srcdir/segment.h} if(! ~ 4f500515174 $sum(1)^$sum(2)){ echo $srcdir/segment.h is not the original distribution file exit original } cp $srcdir/segment.h 889686630/segment.h ed 889686630/segment.h >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM segment.h' 6a { SG_PHYSICAL, "vme1", 0xA1000000, SEGMAXSIZE, vmepgalloc, vmepgfree }, { SG_PHYSICAL, "vme2", 0xA2000000, SEGMAXSIZE, vmepgalloc, vmepgfree }, { SG_PHYSICAL, "vme3", 0xA3000000, SEGMAXSIZE, vmepgalloc, vmepgfree }, . 5a { SG_PHYSICAL, "kmem", KZERO, SEGMAXSIZE, 0, 0 }, . 4c Physseg physseg[] = { . wq //GO.SYSIN DD VADIM segment.h sum=`{sum < 889686630/segment.h} if(~ ef959e86448 $sum(1)^$sum(2)) echo if not{ echo 889686630/segment.h checksum error creating updated file exit checksum } target=889686630/trap.c echo -n '889686630/trap.c: ' if(! test -f $srcdir/trap.c || ! test -r $srcdir/trap.c){ echo $srcdir/trap.c unreadable exit unreadable } sum=`{sum < $srcdir/trap.c} if(! ~ acc7197712614 $sum(1)^$sum(2)){ echo $srcdir/trap.c is not the original distribution file exit original } cp $srcdir/trap.c 889686630/trap.c ed 889686630/trap.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM trap.c' 619a . 466c static char okfmt[] = { 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0 }; . 365a } print("\n"); . 360,364c if(u==0) return; i = 0; for(l=(ulong)&l; lvo, ur->pc)); postnote(u->p, 1, buf, NDebug); }else{ /* * Hack to catch bootstrap fault during probe */ if(catch.pc) gotolabel(&catch); print("kernel trap %s pc=0x%lux\n", excname(ur->vo, ur->pc), ur->pc); dumpregs(ur); if(predawn) exit(1); pexit("Suicide", 0); . 132,145c if(user){ . 125d 118a extern int predawn; . 79,93d 76d 60,66c "level 1 autovector (local semaphore)", "level 2 autovector (timer)", "level 3 autovector (scsi)", "level 4 autovector (scc)", "level 5 autovector (ether)", "level 6 autovector (cio)", "level 7 autovector (NMI)", . 11a extern Label catch; . wq //GO.SYSIN DD VADIM trap.c sum=`{sum < 889686630/trap.c} if(~ e587c1699203 $sum(1)^$sum(2)) echo if not{ echo 889686630/trap.c checksum error creating updated file exit checksum } target=889686630/u.h echo -n '889686630/u.h: ' if(! test -f $srcdir/u.h || ! test -r $srcdir/u.h){ echo $srcdir/u.h unreadable exit unreadable } sum=`{sum < $srcdir/u.h} if(! ~ 035a602b285 $sum(1)^$sum(2)){ echo $srcdir/u.h is not the original distribution file exit original } cp $srcdir/u.h 889686630/u.h ed 889686630/u.h >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM u.h' 7c typedef ushort Rune; . wq //GO.SYSIN DD VADIM u.h sum=`{sum < 889686630/u.h} if(~ 3d0dec83285 $sum(1)^$sum(2)) echo if not{ echo 889686630/u.h checksum error creating updated file exit checksum } target=889686630/vec.s echo -n '889686630/vec.s: ' if(! test -f $srcdir/vec.s || ! test -r $srcdir/vec.s){ echo $srcdir/vec.s unreadable exit unreadable } sum=`{sum < $srcdir/vec.s} if(! ~ 4cce88d59839 $sum(1)^$sum(2)){ echo $srcdir/vec.s is not the original distribution file exit original } cp $srcdir/vec.s 889686630/vec.s ed 889686630/vec.s >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM vec.s' 33,39c LONG illegal(SB) /* level 1 autovector (local semaphore) */ LONG clockintrv(SB) /* level 2 autovector (timer) */ LONG scsiintrv(SB) /* level 3 autovector (scsi) */ LONG sccintrv(SB) /* level 4 autovector (scc) */ LONG lanceintrv(SB) /* level 5 autovector (ether) */ LONG illegal(SB) /* level 6 autovector (cio)*/ LONG illegal(SB) /* level 7 autovector (NMI) */ . 5a WORD $0x4420 WORD $0x0000 . 3,4d wq //GO.SYSIN DD VADIM vec.s sum=`{sum < 889686630/vec.s} if(~ 4918e70a9900 $sum(1)^$sum(2)) echo if not{ echo 889686630/vec.s checksum error creating updated file exit checksum } target=889686630/devcio.c echo -n '889686630/devcio.c (new): ' cat > 889686630/devcio.c >[2]/dev/null <<'//GO.SYSIN DD VADIM eltec' /* * driver for the second Z8536 CIO on the Eltec */ #define ELTECBOTCH /* see io.h */ #include "u.h" #include "../port/lib.h" #include "mem.h" #include "dat.h" #include "fns.h" #include "io.h" #include "../port/error.h" #include "devtab.h" #include "z8536.h" #define CIO2A ((CIOdev*)CIO2) enum { Lastreg = 0x2f, }; enum{ Qdir, Qcio, Qa, Qb, Qc, Qctl, }; Dirtab ciotab[]={ "cio", {Qcio}, 1, 0600, "cioa", {Qa}, 1, 0600, "ciob", {Qb}, 1, 0600, "cioc", {Qc}, 1, 0600, "cioctl", {Qctl}, 0, 0600, }; #define Nciotab (sizeof(ciotab)/sizeof(Dirtab)) static void onepointseven(void) { int i; for(i = 0; i < 20; i++) ; } #define CWR(r, v) ciowrreg(dev, (r), (v)) #define CRD(r) ciordreg(dev, (r)) static void ciowrreg(CIOdev *dev, int reg, int val) { dev->ptr = reg; onepointseven(); dev->ptr = val; } static int ciordreg(CIOdev *dev, int reg) { dev->ptr = reg; onepointseven(); return dev->ptr; } void cioreset(void) { CIOdev *dev = CIO2A; uchar c; /* force CIO to state 0 */ c = dev->ptr; USED(c); onepointseven(); dev->ptr = 0; onepointseven(); c = dev->ptr; USED(c); onepointseven(); /* reset */ CWR(MICR, 1); onepointseven(); dev->ptr = 0; CWR(Amode, 0); /* bit mode */ CWR(Bmode, 0); CWR(Apolarity, 0); CWR(Bpolarity, 0); CWR(Cpolarity, 0); CWR(Adir, AllInput); CWR(Bdir, AllInput); CWR(Cdir, AllInput & 0xF); CWR(Aioctl, NormalIO); CWR(Bioctl, NormalIO); CWR(Cioctl, NormalIO); CWR(MCCR, MasterEnable); } void cioinit(void) { } Chan * cioattach(char *spec) { return devattach('x', spec); } Chan * cioclone(Chan *c, Chan *nc) { return devclone(c, nc); } int ciowalk(Chan *c, char *name) { return devwalk(c, name, ciotab, (long)Nciotab, devgen); } void ciostat(Chan *c, char *db) { devstat(c, db, ciotab, (long)Nciotab, devgen); } Chan * cioopen(Chan *c, int omode) { if(c->qid.path == CHDIR){ if(omode != OREAD) error(Eperm); } c->mode = openmode(omode); c->flag |= COPEN; c->offset = 0; return c; } void ciocreate(Chan *c, char *name, int omode, ulong perm) { USED(c, name, omode, perm); error(Eperm); } void cioremove(Chan *c) { USED(c); error(Eperm); } void ciowstat(Chan *c, char *dp) { USED(c, dp); error(Eperm); } void cioclose(Chan *c) { USED(c); } long cioread(Chan *c, void *a, long n, ulong offset) { CIOdev *dev = CIO2A; switch((int)(c->qid.path&~CHDIR)){ case Qdir: return devdirread(c, a, n, ciotab, Nciotab, devgen); case Qcio: if(offset > Lastreg) n = 0; if(n) { *(uchar*)a = CRD(offset); n = 1; } break; case Qa: if(n && offset==0) { *(uchar*)a = dev->a; n = 1; } else n = 0; break; case Qb: if(n && offset==0) { *(uchar*)a = dev->b; n = 1; } else n = 0; break; case Qc: if(n && offset==0) { *(uchar*)a = dev->c & 0xF; n = 1; } else n = 0; break; case Qctl: default: n=0; break; } return n; } long ciowrite(Chan *c, char *a, long n, ulong offset) { CIOdev *dev = CIO2A; char buf[32]; char *field[5]; int m; switch((int)(c->qid.path&~CHDIR)){ case Qcio: if(offset == 0 || offset > Lastreg) error(Ebadarg); if(n) { CWR(offset, *(uchar*)a); n = 1; } break; case Qa: if(n) { dev->a = *(uchar*)a; n = 1; } break; case Qb: if(n) { dev->b = *(uchar*)a; n = 1; } break; case Qc: if(n) { dev->c = *(uchar*)a; n = 1; } break; case Qctl: if(n > sizeof(buf)-1) n = sizeof(buf)-1; memmove(buf, a, n); buf[n] = 0; m = getfields(buf, field, 5, " "); if(m < 1) error(Ebadarg); if(strcmp(field[0], "dir") != 0) error(Ebadarg); if(m < 3) error(Ebadarg); if(strcmp(field[1], "a") == 0) CWR(Adir, strtoul(field[2], 0, 16)); else if(strcmp(field[1], "b") == 0) CWR(Bdir, strtoul(field[2], 0, 16)); else if(strcmp(field[1], "c") == 0) CWR(Cdir, strtoul(field[2], 0, 16)&0xF); else error(Ebadarg); break; default: error(Ebadusefd); } return n; } //GO.SYSIN DD VADIM eltec sum=`{sum < 889686630/devcio.c} if(~ 24a73ba43943 $sum(1)^$sum(2)) echo if not{ echo 889686630/devcio.c checksum error extracting new file exit checksum } target=889686630/devvid.c echo -n '889686630/devvid.c (new): ' cat > 889686630/devvid.c >[2]/dev/null <<'//GO.SYSIN DD VADIM eltec' /* * driver for the VIP1024 VME frame grabber video card */ #include "u.h" #include "../port/lib.h" #include "mem.h" #include "dat.h" #include "fns.h" #include "io.h" #include "../port/error.h" #include "devtab.h" #define VIDBASE 0x01000000 /* physical address of VIP on VME32 */ /* offsets from VIDBASE */ #define VIDBUF 0x0 /* frame store */ #define VIDREG 0x00100000 /* base address of registers */ /* offset from VIDREG */ #define VIDCTL0 0x2800 #define FRAMESIZE (512*512) #define FRAMEBUF(i) (framebuffer + (((i)&3)*FRAMESIZE)) enum { Inlut = 0, Rlut = 1, Glut = 2, Blut = 3, LUTSIZE = 0x800, LUTMAPSIZE = 256, }; typedef struct Video Video; struct Video { uchar ctl0; /* 2800 */ uchar pad0[0x100-1]; uchar ctl1; /* 2900 */ uchar pad1[0x100-1]; uchar mask; /* 2a00 */ uchar pad2[0x100-1]; uchar status; /* 2b00 */ uchar pad3[0x100-1]; uchar snap; /* 2c00 */ uchar pad4[0x100*4-1]; uchar crtca; /* 3000 */ uchar pad5[0x100*4-1]; uchar crtcd; /* 3400 */ uchar pad6[0x100*4-1]; uchar gain; /* 3800 */ uchar pad7[0x100*4-1]; uchar offset; /* 3c00 */ }; enum { /* Control Register 0 */ LutSel = 7, /* LUT table map select (mask) */ Quadbuf = 1<<3, /* =1, four 512x512 frames; =0, one 1Mbyte frame */ Quadno = 3<<4, /* active quadrant */ RASDisable = 1<<7, /* prevent memory refresh */ /* Control Register 1 */ INPsel = 3, /* input selection (mask) */ SelALU = 1<<2, /* Select ALU (select video source) */ KeyEnable = 1<<3, /* select video source */ VideoDisable = 1<<4, /* video output disable */ Continuous = 1<<5, /* =0, snapshot mode */ EurStandard = 1<<6, /* =1, 50Hz, 625 lines; =0, 60Hz, 525 lines */ ExtSync = 1<<7, /* =1, select external sync */ /* Status Register */ VMESlave = 1<<0, /* =0, VME master */ Grabbing = 1<<1, /* still grabbing a frame or frames */ StatusStrap = 1<<2, /* =0, jumper 43-46 is IN */ OddField = 1<<3, /* =1, display frame in odd field */ }; #define CWR(x,v) (vid->x = softvid.x = (v)) #define CRD(x) softvid.x enum{ Qdir, Qcrtc, Qvid0, Qvid1, Qvid2, Qvid3, Qsnap, Qrgb, Qreg, Qctl, }; Dirtab vidtab[]={ "vidcrtc", {Qcrtc}, 16, 0600, "vid0", {Qvid0}, FRAMESIZE, 0600, "vid1", {Qvid1}, FRAMESIZE, 0600, "vid2", {Qvid2}, FRAMESIZE, 0600, "vid3", {Qvid3}, FRAMESIZE, 0600, "vidsnap", {Qsnap}, FRAMESIZE, 0400, "vidrgb", {Qrgb}, LUTMAPSIZE*4, 0600, "vidreg", {Qreg}, sizeof(Video), 0600, "vidctl", {Qctl}, 0, 0600, }; #define Nvidtab (sizeof(vidtab)/sizeof(Dirtab)) enum { USvision, Eurovision, Nformat, Ncrtcreg = 16 }; static uchar crtcparam[Nformat][Ncrtcreg] = { {0x51, 0x40, 0x42, 0x4e, 0x1f, 0x06, 0x1e, 0x1e, 0x07, 0x0f, 0, 0, 0, 0, 0, 0 }, {0x52, 0x40, 0x43, 0x8e, 0x26, 0x00, 0x20, 0x23, 0x07, 0x0f, 0, 0, 0, 0, 0, 0 }, }; static uchar *vidbase; static Video *vidregs; static uchar *framebuffer; static int curquad; static Video softvid; /* driver's copy, for write-only registers */ static uchar softcrtc[Ncrtcreg]; static void initcrtc(int); static void luts(int, int, int, int); static void snap(int); static void setsnap(int); static void setcontin(int); static void vmecpy(void*, void*, long); static void resetstate(void); void vidreset(void) { print("VIP-1024 reset\n"); if(vidbase == 0) { vidbase = (uchar*)VA(kmapvme(VIDBASE)); if(vidbase == 0) return; } vidregs = (Video*)(vidbase+VIDREG+VIDCTL0); framebuffer = (uchar*)(vidbase+VIDBUF); resetstate(); } static void resetstate(void) { Video *vid = vidregs; CWR(ctl0, Quadbuf); curquad = 0; CWR(ctl1, ExtSync|EurStandard|VideoDisable|SelALU); initcrtc(Eurovision); luts(0, Inlut, 0xff, 0xff); luts(0, Rlut, 1, 0); luts(0, Glut, 1, 0); luts(0, Blut, 1, 0); CWR(ctl1, softvid.ctl1 & ~VideoDisable); CWR(gain, 0xc0); CWR(offset, 0x40); CWR(mask,0); } void vidinit(void) { } Chan * vidattach(char *spec) { if(vidbase == 0) error(Enodev); return devattach('v', spec); } Chan * vidclone(Chan *c, Chan *nc) { return devclone(c, nc); } int vidwalk(Chan *c, char *name) { return devwalk(c, name, vidtab, (long)Nvidtab, devgen); } void vidstat(Chan *c, char *db) { devstat(c, db, vidtab, (long)Nvidtab, devgen); } Chan * vidopen(Chan *c, int omode) { if(c->qid.path == CHDIR || c->qid.path == Qsnap){ if(omode != OREAD) error(Eperm); } c->mode = openmode(omode); c->flag |= COPEN; c->offset = 0; return c; } void vidcreate(Chan *c, char *name, int omode, ulong perm) { USED(c, name, omode, perm); error(Eperm); } void vidremove(Chan *c) { USED(c); error(Eperm); } void vidwstat(Chan *c, char *dp) { USED(c, dp); error(Eperm); } void vidclose(Chan *c) { USED(c); } long vidread(Chan *c, void *a, long n, ulong offset) { Video *vid = vidregs; int m; switch((int)(c->qid.path&~CHDIR)){ case Qdir: return devdirread(c, a, n, vidtab, Nvidtab, devgen); case Qcrtc: if(offset >= Ncrtcreg || n < 0) return 0; if(offset+n > Ncrtcreg) { n = Ncrtcreg-offset; if(n < 0) n = 0; } for(m = 0; m < n; m++, offset++) ((uchar*)a)[m] = softcrtc[offset]; break; case Qvid0: case Qvid1: case Qvid2: case Qvid3: if(n < 0) return 0; if(offset+n > FRAMESIZE) { n = FRAMESIZE-offset; if(n < 0) n = 0; } vmecpy(a, FRAMEBUF(c->qid.path-Qvid0)+offset, n); break; case Qsnap: if(n < 0) return 0; if(offset == 0) { snap(curquad); if((softvid.ctl1 & Continuous) == 0) { while(vid->status & Grabbing) ; /* should tsleep? how long does this take? */ } } if(offset+n > FRAMESIZE) { n = FRAMESIZE-offset; if(n < 0) n = 0; } vmecpy(a, FRAMEBUF(curquad)+offset, n); break; case Qreg: if(offset+n > sizeof(Video)) n = sizeof(Video)-offset; if(n < 0) n = 0; softvid.status = vid->status; memmove(a, (uchar*)&softvid+offset, n); break; case Qrgb: case Qctl: default: n=0; break; } return n; } long vidwrite(Chan *c, char *a, long n, ulong offset) { Video *vid = vidregs; char buf[32]; char *field[5]; int m; uchar *p, *q; switch((int)(c->qid.path&~CHDIR)){ case Qcrtc: if(offset >= Ncrtcreg || n < 0) return 0; if(offset+n > Ncrtcreg) { n = Ncrtcreg-offset; if(n < 0) n = 0; } for(m = 0; m < n; m++, offset++) { vid->crtca = offset; vid->crtcd = softcrtc[offset] = ((uchar*)a)[m]; } break; case Qvid0: case Qvid1: case Qvid2: case Qvid3: if(n < 0) return 0; if(offset+n > FRAMESIZE) { n = FRAMESIZE-offset; if(n < 0) n = 0; } vmecpy(FRAMEBUF(c->qid.path-Qvid0)+offset, a, n); break; case Qctl: if(n > sizeof(buf)-1) n = sizeof(buf)-1; memmove(buf, a, n); buf[n] = 0; m = getfields(buf, field, 5, " "); if(m < 1) error(Ebadarg); if(strcmp(field[0], "mode") == 0) { void (*f)(int); if(m < 2) error(Ebadarg); if(strcmp(field[1], "snap") == 0) f = setsnap; else if(strncmp(field[1], "contin", 6) == 0) f = setcontin; else error(Ebadarg); if(m < 3) (*f)(curquad); else (*f)(atoi(field[2])); } else if(strcmp(field[0], "snap") == 0) { if(m < 2) snap(curquad); else snap(atoi(field[1])); } else if(strcmp(field[0], "format") == 0) { if(m < 2) error(Ebadarg); if(strcmp(field[1], "us") == 0) initcrtc(USvision); else if(strcmp(field[1], "eur") == 0) initcrtc(Eurovision); else error(Ebadarg); } else if(strcmp(field[0], "video") == 0) { if(m < 1 || strcmp(field[1], "on") == 0) CWR(ctl1, softvid.ctl1 & ~VideoDisable); else if(strcmp(field[1], "off") == 0) CWR(ctl1, softvid.ctl1 | VideoDisable); } else if(strcmp(field[0], "gain") == 0) { if(m > 1) vid->gain = strtoul(field[1], 0, 0); } else if(strcmp(field[0], "offset") == 0) { if(m > 1) vid->offset = strtoul(field[1], 0, 0); } else if(strcmp(field[0], "reset") == 0) { resetstate(); } else if(*field[0] == 'f') { switch(field[0][1]) { case '0': case '1': case '2': case '3': CWR(ctl1, (softvid.ctl1 & ~(SelALU|KeyEnable)) | (field[0][1]-'0')<<2); break; } } else if(*field[0] == 'i') { switch(field[0][1]) { case '0': case '1': case '2': case '3': CWR(ctl1, (softvid.ctl1 & ~INPsel) | (field[0][1]-'0')); break; } } else if(*field[0] == 'l') { switch(field[0][1]) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': CWR(ctl0, (softvid.ctl0 & ~LutSel) | (field[0][1]-'0')); break; } } else error(Ebadarg); break; case Qreg: if(offset+n > sizeof(Video)) n = offset-sizeof(Video); if(n > 0) { /* BUG: should copy just the register values */ memmove((uchar*)&softvid+offset, a, n); vid->ctl0 = softvid.ctl0; vid->ctl1 = softvid.ctl1; vid->mask = softvid.mask; softvid.status = vid->status; /* status is read only */ vid->gain = softvid.gain; vid->offset = softvid.offset; } break; case Qrgb: if(offset+n > 2048) n = 2048-offset; if(n < 0) n = 0; p = vidbase+VIDREG; q = (uchar*)a; while(--n >= 0) *p++ = *q++; /* device only supports byte access */ break; default: error(Ebadusefd); } return n; } static void initcrtc(int mode) { int i; Video *vid = vidregs; if(mode < 0 || mode >= Nformat) error(Ebadarg); for(i=0; icrtca = i; vid->crtcd = softcrtc[i] = crtcparam[mode][i]; } if(mode == USvision) CWR(ctl1,softvid.ctl1 & ~EurStandard); else CWR(ctl1,softvid.ctl1 | EurStandard); } static void luts(int map, int colour, int ramp, int value) { uchar *p; int i; p = vidbase + VIDREG + (colour*LUTSIZE) + (map*LUTMAPSIZE); for(i=0; istatus & Grabbing) == 0) vid->snap = 0xff; } /* * copy data to/from frame-buffer's memory; * memmove can't be used because the device handles D16 but not D32. * the processor should switch to D8 cycles when the VME source/dest * is on an odd boundary. */ static void vmecpy(void *a, void *b, long count) { ushort *to, *from; int n, odd; if(count <= 0) return; to = (ushort*)a; from = (ushort*)b; odd = count & 1; if((count >>= 1) != 0) { n = (count+7) >> 3; switch(count&7) { /* Duff's device */ case 0: do { *to++ = *from++; case 7: *to++ = *from++; case 6: *to++ = *from++; case 5: *to++ = *from++; case 4: *to++ = *from++; case 3: *to++ = *from++; case 2: *to++ = *from++; case 1: *to++ = *from++; } while(--n > 0); } } if(odd) *(uchar*)to = *(uchar*)from; } //GO.SYSIN DD VADIM eltec sum=`{sum < 889686630/devvid.c} if(~ 14d66e2310924 $sum(1)^$sum(2)) echo if not{ echo 889686630/devvid.c checksum error extracting new file exit checksum } target=889686630/eltec echo -n '889686630/eltec (new): ' cat > 889686630/eltec >[2]/dev/null <<'//GO.SYSIN DD VADIM eltec' dev root / cons c remcon env e pipe | proc p srv s mnt M dup d lance l scc t rtc r ip I tcpinput tcpoutput tcptimer tcpif stil arp a iproute P kprof T scsi S scsi scsibuf wren w cio x stream fcall ip port int cpuserver = 0; long cfslen = 0; ulong cfscode[1]; long fslen = 0; ulong fscode[1]; void consdebug(void) {} void bitdebug(void){} boot terminal il tcp //GO.SYSIN DD VADIM eltec sum=`{sum < 889686630/eltec} if(~ 9183d10f389 $sum(1)^$sum(2)) echo if not{ echo 889686630/eltec checksum error extracting new file exit checksum } target=889686630/elteccpu echo -n '889686630/elteccpu (new): ' cat > 889686630/elteccpu >[2]/dev/null <<'//GO.SYSIN DD VADIM eltec' dev root / cons c remcon env e pipe | proc p srv s mnt M dup d lance l scsi S scsi scsibuf wren w scc t rtc r ip I tcpinput tcpoutput tcptimer tcpif stil arp a iproute P kprof T cio x vid v stream fcall ip reboot port int cpuserver = 1; long cfslen = 0; ulong cfscode[1]; long fslen = 0; ulong fscode[1]; void consdebug(void) {} void bitdebug(void) {} boot cpu il tcp //GO.SYSIN DD VADIM eltec sum=`{sum < 889686630/elteccpu} if(~ a0e48cda400 $sum(1)^$sum(2)) echo if not{ echo 889686630/elteccpu checksum error extracting new file exit checksum } target=889686630/fault68030.c echo -n '889686630/fault68030.c (new): ' cat > 889686630/fault68030.c >[2]/dev/null <<'//GO.SYSIN DD VADIM eltec' #include "u.h" #include "../port/lib.h" #include "mem.h" #include "dat.h" #include "fns.h" #include "ureg.h" #include "../port/error.h" #define FORMAT(ur) ((((ur)->vo)>>12)&0xF) #define OFFSET(ur) (((ur)->vo)&0xFFF) struct FFrame { ushort ireg0; /* internal register */ ushort ssw; /* special status word */ ushort ipsc; /* instr. pipe stage c */ ushort ipsb; /* instr. pipe stage b */ ulong addr; /* data cycle fault address */ ushort ireg1; /* internal register */ ushort ireg2; /* internal register */ ulong dob; /* data output buffer */ ushort ireg3[4]; /* more stuff */ ulong baddr; /* stage b address */ ushort ireg4[26]; /* more more stuff */ }; /* * SSW bits */ #define RW 0x0040 /* read/write for data cycle */ #define FC 0x8000 /* fault on stage C of instruction pipe */ #define FB 0x4000 /* fault on stage B of instruction pipe */ #define RC 0x2000 /* rerun flag for stage C of instruction pipe */ #define RB 0x1000 /* rerun flag for stage B of instruction pipe */ #define DF 0x0100 /* fault/rerun flag for data cycle */ #define RM 0x0080 /* read-modify-write on data cycle */ #define READ 0x0040 #define WRITE 0x0000 #define SIZ 0x0030 /* size code for data cycle */ #define FC2 0x0004 /* address space for data cycle */ #define FC1 0x0002 #define FC0 0x0001 void fault68030(Ureg *ur, FFrame *f) { ulong addr, badvaddr; int user, read, insyscall; char buf[ERRLEN]; if(u == 0){ dumpregs(ur); panic("fault u==0 pc=%lux", ur->pc); } insyscall = u->p->insyscall; u->p->insyscall = 1; addr = 0; /* set */ if(f->ssw & DF) addr = f->addr; else if(FORMAT(ur) == 0xA){ if(f->ssw & (FC|RC)) addr = ur->pc+2; else if(f->ssw & (FB|RB)) addr = ur->pc+4; else panic("prefetch pagefault"); }else if(FORMAT(ur) == 0xB){ if(f->ssw & (FC|RC)) addr = f->baddr-2; else if(f->ssw & (FB|RB)) addr = f->baddr; else panic("prefetch pagefault"); }else panic("prefetch format"); badvaddr = addr; addr &= ~(BY2PG-1); user = !(ur->sr&SUPER); if(user) u->dbgreg = ur; if(f->ssw & DF) read = (f->ssw&READ) && !(f->ssw&RM); else read = f->ssw&(FB|FC|RB|RC); /* print("fault pc=%lux addr=%lux read %d user %d\n", ur->pc, badvaddr, read, user); /**/ if(fault(addr, read) < 0){ if(user){ sprint(buf, "sys: trap: fault %s addr=0x%lux", read? "read" : "write", badvaddr); postnote(u->p, 1, buf, NDebug); notify(ur); return; } dumpregs(ur); panic("fault: 0x%lux", badvaddr); } u->p->insyscall = insyscall; } //GO.SYSIN DD VADIM eltec sum=`{sum < 889686630/fault68030.c} if(~ 7520db062525 $sum(1)^$sum(2)) echo if not{ echo 889686630/fault68030.c checksum error extracting new file exit checksum } target=889686630/remcon.c echo -n '889686630/remcon.c (new): ' cat > 889686630/remcon.c >[2]/dev/null <<'//GO.SYSIN DD VADIM eltec' #include "u.h" #include "../port/lib.h" #include "mem.h" #include "dat.h" #include "fns.h" #include "io.h" #include "../port/error.h" #include "devtab.h" void screeninit(char *s, int b) { USED(s, b); } void screenputs(char *s, int n) { USED(s, n); } int screenbits(void) { return 1; } /* * fake keyboard and mouse */ int mouseputc(IOQ *q, int c) { USED(q, c); return 0; } void mouseclock(void) { } /* * return of 0 means use eia1 */ int kbdinit(void) { return 0; } int kbdintr(void) { return 0; } void buzz(int f, int d) { USED(f, d); } void lights(int l) { *(uchar*)STATUS = l; } //GO.SYSIN DD VADIM eltec sum=`{sum < 889686630/remcon.c} if(~ 5a5b7c87604 $sum(1)^$sum(2)) echo if not{ echo 889686630/remcon.c checksum error extracting new file exit checksum } target=889686630/vic.c echo -n '889686630/vic.c (new): ' cat > 889686630/vic.c >[2]/dev/null <<'//GO.SYSIN DD VADIM eltec' #include "u.h" #include "../port/lib.h" #include "mem.h" #include "dat.h" #include "fns.h" #include "io.h" #define LIRQ(n) ((uchar*)VIC+(0x27+(n-1)*4)) #define LIVBR ((uchar*)VIC+0x57) #define SS0CR0 ((uchar*)VIC+0xC3) #define SS0CR1 ((uchar*)VIC+0xC7) #define SS1CR0 ((uchar*)VIC+0xCB) #define SS1CR1 ((uchar*)VIC+0xCF) #define VMEIICR ((uchar*)VIC+0x03) #define VMEICR(n) ((uchar*)VIC+(0x07+(n-1)*4)) #define DMAICR ((uchar*)VIC+0x23) #define IGCSICR ((uchar*)VIC+0x43) #define ICMSICR ((uchar*)VIC+0x47) #define EGICR ((uchar*)VIC+0x4B) #define EGVBR ((uchar*)VIC+0x5B) #define BTCR ((uchar*)VIC+0xD7) #define BTLR0 ((uchar*)VIC+0xDB) #define BTLR1 ((uchar*)VIC+0xDF) #define ARCR ((uchar*)VIC+0xB3) #define BESR ((uchar*)VIC+0xBB) #define TTR ((uchar*)VIC+0xA3) #define LBTR ((uchar*)VIC+0xA7) #define IFCR ((uchar*)VIC+0xAF) enum { IntrDisable = 0x80, IntrEnable = 0, ActiveHigh = 0x40, ActiveLow = 0, EdgeTrigger = 0x20, LevelTrigger = 0x0, VicSupplies = 0x10, DeviceSupplies = 0, }; /* * map from Local IRQ number to CPU IRQ level; * except where noted, the level is fixed. */ static int lirqipl[] = { 0, /* unused */ 3|EdgeTrigger|VicSupplies, /* LIRQ1: low priority semaphore */ 6|EdgeTrigger|VicSupplies, /* LIRQ2: timer */ 1|ActiveLow|LevelTrigger|VicSupplies, /* LIRQ3: scsi */ 5|DeviceSupplies|ActiveLow|LevelTrigger, /* LIRQ4: SCC */ 2|DeviceSupplies|ActiveLow|EdgeTrigger, /* LIRQ5: LEB (ether) */ 0|DeviceSupplies|ActiveLow|LevelTrigger, /* LIRQ6: CIO timer (user's choice of level) */ 7|VicSupplies|EdgeTrigger|ActiveLow, /* LIRQ7: high priority semaphore; abort */ }; void vicinit(void) { int i; *EGICR = 0xF0; for(i=1; i<=7; i++) *LIRQ(i) = IntrDisable; *LIVBR = 24; /* set vector base for interrupts */ *SS0CR0 = 0x12; /* disable timer, enable D32, user mode access, accel. block transfer */ *SS0CR1 = 0x48; /* timing for Eltec */ *SS1CR0 = 0x16; /* no write posting, D24, user mode access, accel. block transfer */ *SS1CR1 = 0x54; /* timing for Eltec */ *ARCR = 0x60; /* BR3 level */ *VMEIICR = IntrDisable; /* disable VME interrupt */ *DMAICR = 0xF8; /* disable all */ *IGCSICR = 0xF8; /* disable all */ *ICMSICR = 0xF8; /* disable all */ *IFCR = 0xD0; /* size of first RMC* determines AS use; AS* stretch; LBERR*+HALT* on deadlock */ *EGVBR = 64; *LBTR = 0x10; /* DS* high time: two 64MHz periods */ *TTR = 0x2C; *LIRQ(7) = lirqipl[7]; /* enable abort */ for(i=1; i<=7; i++) *VMEICR(i) = IntrDisable; /* disable VME interrupts at all levels */ *BTCR = 0; /* stop any transfer */ *BTLR0 = 0; *BTLR1 = 0; *BESR = 0; /* clear pending bus errors */ *EGICR = 0xF0; /* *EGICR = 0x07; /* enable all error interrupts, IPL7 */ } void vicenable(int ipl) { if(ipl >= 1 && ipl <= 7) *LIRQ(ipl) = lirqipl[ipl] | IntrEnable; } //GO.SYSIN DD VADIM eltec sum=`{sum < 889686630/vic.c} if(~ 1fe2bfa32792 $sum(1)^$sum(2)) echo if not{ echo 889686630/vic.c checksum error extracting new file exit checksum } target=889686630/xscsi.c echo -n '889686630/xscsi.c (new): ' cat > 889686630/xscsi.c >[2]/dev/null <<'//GO.SYSIN DD VADIM eltec' #include "u.h" #include "../port/lib.h" #include "mem.h" #include "dat.h" #include "fns.h" #include "io.h" #define DPRINT if(debug)print int scsidebugs[8]={0,0,1}; int scsiownid = 0x08|7; /* enable advanced features */ typedef struct Scsictl { ushort fifo; /* 0000 DBA fifo */ uchar fill0[0x1000-2]; uchar asr; /* 1000 wd33c93 address/status register */ uchar data; /* 1001 wd33c93 data register */ uchar fill1[0x1000-2]; ushort ctr; /* 2000 DBA data counter preset */ } Scsictl; #define DEV ((Scsictl*)SCSIFIFO) #define PUT(a,d) (dev->asr=(a), dev->data=(d)) #define GET(a) (dev->asr=(a), dev->data) enum SBIC_regs { Own_id=0x00, Control=0x01, CDB=0x03, Target_LUN=0x0f, Cmd_phase=0x10, Tc_hi=0x12, Dest_id=0x15, Src_id=0x16, SCSI_Status=0x17, Cmd=0x18, Data=0x19, }; enum Commands { Reset = 0x00, Assert_ATN = 0x02, Negate_ACK = 0x03, Select_with_ATN = 0x06, Select_with_ATN_and_Xfr = 0x08, Select_and_Xfr = 0x09, Transfer_Info = 0x20, SBT = 0x80, /* modifier for single-byte transfer */ }; enum Aux_status { INT=0x80, LCI=0x40, BSY=0x20, CIP=0x10, PE=0x02, DBR=0x01, }; static QLock scsilock; static Rendez scsirendez; static long debug, scsibusy; static Scsi *activereq; static void nop(void) {} void resetscsi(void) {} void initscsi(void) { Scsictl *dev = DEV; /* dev->ctrl = Sreset; delay(25); dev->ctrl = 0;*/ vicenable(3); /* LIRQ3: scsi */ scsiownid &= 0x0f; /* possibly advanced features */ scsiownid |= 0x80; /* 16MHz */ PUT(Own_id, scsiownid); PUT(Cmd, Reset); while(dev->asr & CIP) ; } static void dbaload(void *buf, long nb) { Scsictl *dev = DEV; ushort *kp; long nw; DPRINT(" dba<-(#%lux,%ld)", buf, nb); dev->ctr = 0; kp = (ushort*)buf; nw = nb/2; while(--nw >= 0) dev->fifo = *kp++; if(nb & 1) dev->fifo = *kp & 0xff00; } static void dbaunload(void *buf, long nb) { Scsictl *dev = DEV; ushort *kp; long nw; DPRINT(" (#%lux,%ld)<-dba", buf, nb); dev->ctr = 0; kp = (ushort*)buf; nw = nb/2; while(--nw >= 0) *kp++ = dev->fifo; if(nb & 1) *kp = dev->fifo & 0xff00; } static int scsidone(void *arg) { USED(arg); return (scsibusy == 0); } int scsiexec(Scsi *p, int rflag) { Scsictl *dev = DEV; long n, nb; debug = scsidebugs[p->target&7]; p->rflag = rflag; nb = p->data.lim - p->data.ptr; DPRINT("scsi %d.%d %2.2ux rf %d nb %ld ", p->target, p->lun, *(p->cmd.ptr), rflag, nb); if((ulong)p->data.ptr & 1 || nb >= 0x10000) { print("scsi: bad datap/count: #%lux #%lux\n", p->data.ptr, nb); print("scsi: base=#%lux ptr=#%lux lim=#%lux\n", p->data.base, p->data.ptr, p->data.lim); p->data.ptr = p->data.lim = p->data.base; return 0x200; } qlock(&scsilock); activereq = p; if(rflag == 0 && nb) dbaload(p->data.ptr, nb); if ((scsiownid & 0x08) && rflag) PUT(Dest_id, 0x40|p->target); else PUT(Dest_id, p->target); PUT(Target_LUN, p->lun); PUT(Tc_hi, nb>>16); dev->data = nb>>8; dev->data = nb; if (scsiownid & 0x08) { n = p->cmd.lim - p->cmd.ptr; DPRINT("len=%d ", n); PUT(Own_id, n); } PUT(CDB, *(p->cmd.ptr)++); while (p->cmd.ptr < p->cmd.lim) dev->data = *p->cmd.ptr++; scsibusy = 1; PUT(Cmd, Select_and_Xfr); /*PUT(Cmd, Select_with_ATN_and_Xfr);*/ DPRINT("S<"); sleep(&scsirendez, scsidone, 0); DPRINT(">\n"); if(p->data.ptr > p->data.lim) panic("scsi buf overflow"); p->status = GET(Target_LUN); p->status |= dev->data<<8; qunlock(&scsilock); debug = 0; return p->status; } static void scsirun(void) { wakeup(&scsirendez); scsibusy = 0; } static void scsireset0(void) { Scsictl *dev = DEV; PUT(Control, 0x49); /* DBA mode, EDI, halt on parity error */ PUT(Control+1, (100*16+79)/80); /* 100 msec at 16MHz */ PUT(Src_id, 0x80); /* enable reselection */ /* dev->ctrl = 0; /* abort any dma in progress */ scsirun(); } static void flushdma(int n) { Scsictl *dev = DEV; Scsi *p; long lim; if(n < 0) { n = GET(Tc_hi); n = (n<<8)|dev->data; n = (n<<8)|dev->data; } p = activereq; if(p == 0) return; lim = p->data.lim - p->data.ptr; if(n > lim) { kprint("scsi dma overflow: lim%ld n%d\n", lim, n); n = lim; } if(p->rflag && n) dbaunload(p->data.ptr, n); p->data.ptr += n; } void scsiintr(void) { Scsictl *dev = DEV; int status, phase; long n; status = GET(SCSI_Status); DPRINT("I%2.2x ", status); switch(status){ case 0x00: /* reset by command or power-up */ case 0x01: /* reset by command or power-up */ scsireset0(); break; case 0x21: /* Save Data Pointers message received */ flushdma(-1); PUT(Cmd_phase, 0x41); PUT(Cmd, Select_and_Xfr); break; case 0x16: /* select-and-transfer completed */ flushdma(-1); case 0x42: /* timeout during select */ scsirun(); break; case 0x4b: /* unexpected status phase */ flushdma(-1); dev->asr = Target_LUN; kprint("lun/status 0x%ux\n", dev->data); phase = dev->data; kprint("phase 0x%ux\n", phase); PUT(Tc_hi, 0); dev->data = 0; dev->data = 0; switch(phase){ case 0x50: case 0x60: break; default: phase = 0x46; break; } PUT(Cmd_phase, phase); PUT(Cmd, Select_and_Xfr); break; default: kprint("scsintr 0x%ux\n", status); dev->asr = Target_LUN; kprint("lun/status 0x%ux\n", dev->data); kprint("phase 0x%ux\n", dev->data); switch (status&0xf0) { case 0x00: case 0x10: case 0x20: case 0x40: case 0x80: if(status & 0x08){ n = GET(Tc_hi); n = (n<<8)|dev->data; n = (n<<8)|dev->data; kprint("count 0x%.6ux", n); DPRINT(" count %ld", n); flushdma(n); } scsirun(); break; default: panic("scsi status 0x%2.2ux", status); } kprint("resetting..."); PUT(Own_id, scsiownid); PUT(Cmd, Reset); break; } } Scsibuf * scsialloc(ulong n) { Scsibuf *b; b = xalloc(sizeof(Scsibuf)); b->virt = xalloc(n); b->phys = (void*)PADDR(b->virt); return b; } //GO.SYSIN DD VADIM eltec sum=`{sum < 889686630/xscsi.c} if(~ 3f6f986a5813 $sum(1)^$sum(2)) echo if not{ echo 889686630/xscsi.c checksum error extracting new file exit checksum } target=889686630/z8536.h echo -n '889686630/z8536.h (new): ' cat > 889686630/z8536.h >[2]/dev/null <<'//GO.SYSIN DD VADIM eltec' /* * Z8536 CIO registers * might not be complete */ enum { /* registers */ MICR = 0, /* master interrupt control */ ClearReset = 0, MasterIEnable = 0x9E, MCCR = 1, /* master configuration control */ MasterEnable = 0x94, Avec = 2, /* port A interrupt vector */ Bvec = 3, /* port B interrupt vector */ Cvec = 4, /* port C (counter/timer) interrupt vector */ Cpolarity = 5, /* data path polarity */ Cdir = 6, /* data path direction */ Cioctl = 7, /* special I/O control */ Acsr = 8, /* port A command and status */ PortIEnable = 0xC0, ClearInt = 0x20, IntPending = 0x90, Bcsr = 9, /* port B command and status */ Ccsr1 = 0xA, /* counter/timer 1 csr */ Ccsr2 = 0xB, /* counter/timer 2 csr */ Ccsr3 = 0xC, /* counter/timer 3 csr */ Adata = 0xD, /* port A data */ Bdata = 0xE, /* port B data */ Cdata = 0xF, /* port C data */ /* A specification */ Amode = 0x20, /* mode specification */ BitPortMode = 6, /* (``or priority encoded vector'') */ Ahand = 0x21, /* handshake specification */ Apolarity = 0x22, /* data path polarity */ Adir = 0x23, /* data direction */ DirOut = 0, DirIn = 1, AllInput = 0xFF, AllOutput = 0x00, Aioctl = 0x24, /* special I/O control */ OnesCatcher = 1, NormalIO = 0, EopOnesCatcher = 0x1F, Apatpol = 0x25, /* pattern polarity */ Invert = 0x1, /* (for each bit) */ Apattrans = 0x26, /* pattern transition */ Apatmask = 0x27, /* pattern mask */ Bmode = 0x28, /* mode specification */ Bhand = 0x29, /* handshake specification */ Bpolarity = 0x2a, /* data path polarity */ EopInvert = 0x3F, /* port B data path polarity register */ Bdir = 0x2b, /* data direction */ Bioctl = 0x2c, /* special I/O control */ Bpatpol = 0x2d, /* pattern polarity */ Bpattrans = 0x2e, /* pattern transition */ Bpatmask = 0x2f, /* pattern mask */ EopOne = 0x3F, /* port B pattern registers */ }; //GO.SYSIN DD VADIM eltec sum=`{sum < 889686630/z8536.h} if(~ 5c1b75ba1867 $sum(1)^$sum(2)) echo if not{ echo 889686630/z8536.h checksum error extracting new file exit checksum }