From appli.se!owner-amiga-mach@appli.appli.se Mon Jan  4 03:45:27 1993
Received: by bruce (5.57/1.34)
	id AA03835; Mon, 4 Jan 93 03:44:19 +1100
Received: by mail.swip.net (5.65c8/1.2)
	id AA00783; Sun, 3 Jan 1993 17:30:03 +0100
Received: by appli.appli.se (/\=-/\ Smail3.1.17.5 #17.26)
	id <m0kzrhH-0000GwC@appli.appli.se>; Fri, 3 Jan 92 17:24 MET
Received: by appli.appli.se (/\=-/\ Smail3.1.17.5 #17.26)
	id <m0kzrhE-0000KiC@appli.appli.se>; Fri, 3 Jan 92 17:24 MET
Return-Path: <@appli.appli.se:niklas@della.appli.se>
Received: by appli.appli.se (/\=-/\ Smail3.1.17.5 #17.26)
	id <m0kzrhA-0000GwC@appli.appli.se>; Fri, 3 Jan 92 17:24 MET
Received: by appli.appli.se (/\=-/\ Smail3.1.17.5 #17.26)
	id <m0kzrh9-0000H3C@appli.appli.se>; Fri, 3 Jan 92 17:24 MET
Received: by della.appli.se (4.1/SMI-4.1)
	id AA22022; Sun, 3 Jan 93 17:25:47 +0100
Date: Sun, 3 Jan 93 17:25:47 +0100
From: niklas@della.appli.se (Niklas Hallqvist)
Message-Id: <9301031625.AA22022@della.appli.se>
To: amiga-mach@appli.se
Subject: Official GVP patches
Sender: owner-amiga-mach@appli.se
Status: OR

Ok, here are the patches to bring GVP support up-to-date.
This patch should go into the official sources!
There are also some generic bug-fixes and a new console
input multiplexing mechanism as well as a small program
called patchSIM which should be used to patch SIM and
takeover.bin so the address region 0x7fff0000-0x80000000
will be accessible from SIM (the hardware is mapped here
in KludgeMach).  Here's how to to do it:

cd mk:amiga
gcc -o patchSIM -fbaserel patchSIM.c
patchSIM SIM
patchSIM takeover.bin

That should leave you with the original files renamed to
SIM~ rsp. takeover.bin~, and the new patched ones in SIM
& takeover.bin.  Note that my patches requires total
recompilation of the sources due to the changes to the inline
spl* functions.  Also observe my changes to the Makefile
making GVP the default SCSI driver, you have to change this to
either -DA3000, -DA2091 or nothing if you don't use a GVP
series II SCSI controller.

Happy Maching!

Niklas

*** mk78/kernel/makefile~	Tue Dec  8 21:32:55 1992
--- mk78/kernel/makefile	Thu Jan 12 07:26:47 1978
***************
*** 1,5 ****
  
! CFLAGS = -I. -I../include -Iamiga -DKERNEL -DMACH_KERNEL -DA2091 -mc68020 -nostdinc
  LDFLAGS = -nostdlib
  
  .c.o:
--- 1,5 ----
  
! CFLAGS = -I. -I../include -Iamiga -DKERNEL -DMACH_KERNEL -DGVP11 -DMASKED_SPL -mc68020 -nostdinc
  LDFLAGS = -nostdlib
  
  .c.o:
*** mk78/kernel/scsi/adapters/scsi_33c93_hdw.c~	Fri Dec 18 18:23:45 1992
--- mk78/kernel/scsi/adapters/scsi_33c93_hdw.c	Sat Jan  2 18:18:39 1993
*************** sbic_set_dmaops(unit, dmaops)
*** 579,584 ****
--- 579,585 ----
  struct script
  sbic_script_any_cmd[] = {	/* started with SEL & XFER */
  	{{SBIC_CSR_S_XFERRED, 0x60}, sbic_get_status},
+ 	{{SBIC_CSR_MIS_1|SCSI_PHASE_DATAI, 0x60}, sbic_dma_in_r},
  },
  
  sbic_script_try_synch[] = {	/* started with SEL */
*************** sbic_probe(reg, ui)
*** 837,843 ****
  	sbic->wd.reset = sbic_reset_scsibus;
  
  #ifdef	MACH_KERNEL
! 	sc->max_dma_data = -1;
  #else
  	sc->max_dma_data = scsi_per_target_virtual;
  #endif
--- 838,844 ----
  	sbic->wd.reset = sbic_reset_scsibus;
  
  #ifdef	MACH_KERNEL
! 	sc->max_dma_data = /*-1*/PMAP_PGBYTES; /* For now... */
  #else
  	sc->max_dma_data = scsi_per_target_virtual;
  #endif
*************** sbic_intr(unit, spllevel)
*** 1333,1348 ****
  		return SBIC_intr(unit,spllevel);
  #endif	/*MAPPABLE*/
  
! 	sbic = sbic_softc[unit];
  	regs = sbic->regs;
  
- 	LOG(5,"\n\tintr");
- 
  	/* drop spurious interrupts */
  	GET_SBIC_asr(regs, asr);
  	if ((asr & SBIC_ASR_INT) == 0)
  		return;
  
    WAIT_CIP (regs);
  
    GET_SBIC_csr (regs, csr);
--- 1334,1350 ----
  		return SBIC_intr(unit,spllevel);
  #endif	/*MAPPABLE*/
  
! 	if (!(sbic = sbic_softc[unit]))
! 	  return;
  	regs = sbic->regs;
  
  	/* drop spurious interrupts */
  	GET_SBIC_asr(regs, asr);
  	if ((asr & SBIC_ASR_INT) == 0)
  		return;
  
+ 	LOG(5,"\n\tintr");
+ 
    WAIT_CIP (regs);
  
    GET_SBIC_csr (regs, csr);
*************** sbic_err_generic(sbic, csr, pha)
*** 2191,2197 ****
  
          case SBIC_CSR_S_XFERRED:
          default:
!           printf ("SBIC phase %x, ignoring\n", csr);
            return;
          }
        break;
--- 2193,2199 ----
  
          case SBIC_CSR_S_XFERRED:
          default:
!           printf ("SBIC csr %x phase %x, ignoring\n", csr, pha);
            return;
          }
        break;
*** mk78/kernel/motorola/m68k/pcb.c~	Sun Sep 13 11:35:10 1992
--- mk78/kernel/motorola/m68k/pcb.c	Sun Oct 25 08:57:39 1992
*************** thread_t switch_context(old, continuatio
*** 126,131 ****
--- 126,133 ----
    if (old->task != new->task)
      PMAP_CONTEXT(vm_map_pmap(old->task->map), new);
  
+   old->swap_func = continuation;
+    
    active_threads[0] = new;
    active_stacks[0] = new->kernel_stack;
  
*************** thread_t switch_context(old, continuatio
*** 132,138 ****
    fp_restore(&new->pcb->fpu_state);
  
    {
!     register void (*old_d0)() asm("d0") = old;
  
      if(continuation)
        {
--- 134,140 ----
    fp_restore(&new->pcb->fpu_state);
  
    {
!     register thread_t old_d0 asm("d0") = old;
  
      if(continuation)
        {
*************** thread_t switch_context(old, continuatio
*** 149,155 ****
        }
      else
        {
!         asm("illegal");
          asm volatile(
            " pea 0f;"
            " moveml d2-d7/a2-a7,%1@;"
--- 151,157 ----
        }
      else
        {
! /*        asm("illegal"); */
          asm volatile(
            " pea 0f;"
            " moveml d2-d7/a2-a7,%1@;"
*************** load_context(thread_t new)
*** 181,186 ****
--- 183,189 ----
      " moveq   #0,d0;" /* No old thread */
      " rts"
      : : "a" (STACK_KS(new->kernel_stack)));
+   /*NOTREACHED*/
  }
  
  
*************** kern_return_t thread_setstatus(thread, f
*** 260,266 ****
        if (count < THREAD_STATE_REGS_COUNT)
          return(KERN_INVALID_ARGUMENT);
  
!       state = (struct sun_thread_state *) tstate;
  
        pcb = thread->pcb;
        regs = pcb->user_regs;
--- 263,269 ----
        if (count < THREAD_STATE_REGS_COUNT)
          return(KERN_INVALID_ARGUMENT);
  
!       state = (struct thread_state_regs *) tstate;
  
        pcb = thread->pcb;
        regs = pcb->user_regs;
*** mk78/kernel/motorola/m68k/machparam.h~	Thu Dec 10 20:37:42 1992
--- mk78/kernel/motorola/m68k/machparam.h	Sun Oct 25 19:17:58 1992
***************
*** 32,45 ****
  #ifndef _m68k_machparam_
  #define _m68k_machparam_
  
  
  /* Set the interrupt priority level and save the old level */
  static inline int spln(unsigned short spl)
  {
!   volatile unsigned short sr;
  
!   asm("movew sr,%0" : "=d" (sr));
!   asm("movew %0,sr" : : "d" (spl | (sr & 0xf8ff)));
    return(sr & 0x700);
  }
  
--- 32,67 ----
  #ifndef _m68k_machparam_
  #define _m68k_machparam_
  
+ #ifdef DEBUG_SPL
  
+ #define spln(x) (my_spln(x, __FILE__, __LINE__))
+ #define splx(x) (spln(x))
+ 
+ #define spl7() spln(0x0700)
+ #define spl6() spln(0x0600)
+ #define spl5() spln(0x0500)
+ #define spl4() spln(0x0400)
+ #define spl3() spln(0x0300)
+ #define spl2() spln(0x0200)
+ #define spl1() spln(0x0100)
+ #define spl0() spln(0x0000)
+ 
+ #else /* DEBUG_SPL */
+ 
+ #ifdef MASKED_SPL
+ 
  /* Set the interrupt priority level and save the old level */
  static inline int spln(unsigned short spl)
  {
!   unsigned short sr;
!   register int scratch;
  
!   asm volatile ("movew sr,%0;"
! 		"movew %0,%1;"
! 		"andiw #0xf8ff,%1;"
! 		"orw %2,%1;"
! 		"movew %1,sr;"
! 		: "=d" (sr), "=d" (scratch) : "d" (spl) : "cc");
    return(sr & 0x700);
  }
  
*************** static inline int spln(unsigned short sp
*** 47,53 ****
  /* Set the interrupt priority level back to the previous level */
  static inline void splx(unsigned short pri)
  {
!   spln(pri);
  }
  
  
--- 69,81 ----
  /* Set the interrupt priority level back to the previous level */
  static inline void splx(unsigned short pri)
  {
!   register int scratch;
! 
!   asm volatile ("movew sr,%0;"
! 		"andiw #0xf8ff,%0;"
! 		"orw %1,%0;"
! 		"movew %0,sr;"
! 		: "=d" (scratch) : "d" (pri) : "cc");
  }
  
  
*************** static inline void splx(unsigned short p
*** 54,62 ****
  /* Generic spl definitions for m68k interrupt priorities */
  static inline int spl7(void)
  {
!   volatile unsigned short sr;
  
!   asm("movew sr,%0; oriw #0x0700,sr" : "=d" (sr));
    return(sr & 0x700);
  }
  
--- 82,98 ----
  /* Generic spl definitions for m68k interrupt priorities */
  static inline int spl7(void)
  {
!   unsigned short sr;
! 
!   asm volatile ("movew sr,%0; oriw #0x0700,sr" : "=d" (sr) : : "cc");
!   return(sr & 0x700);
! }
! 
! static inline int spl0(void)
! {
!   unsigned short sr;
  
!   asm volatile ("movew sr,%0; andiw #0xf8ff,sr" : "=d" (sr) : : "cc");
    return(sr & 0x700);
  }
  
*************** static inline int spl7(void)
*** 67,79 ****
  #define spl2() spln(0x0200)
  #define spl1() spln(0x0100)
  
! static inline int spl0(void)
  {
    unsigned short sr;
  
!   asm("movew sr,%0; andiw #0xf8ff,sr" : "=d" (sr));
!   return(sr & 0x700);
  }
  
  
  #endif _m68k_machparam_
--- 103,138 ----
  #define spl2() spln(0x0200)
  #define spl1() spln(0x0100)
  
! #else /* MASKED_SPL */
! 
! static inline int spln(unsigned short spl)
  {
    unsigned short sr;
  
!   asm volatile ("movew sr,%0;"
! 		"movew %1,sr;"
! 		: "=d" (sr) : "d" (spl) : "cc");
!   return(sr & 0x3700);
  }
  
+ 
+ /* Set the interrupt priority level back to the previous level */
+ static inline void splx(unsigned short pri)
+ {
+   asm volatile ("movew %0,sr" : : "d" (pri) : "cc");
+ }
+ 
+ #define spl7() spln(0x2700)
+ #define spl6() spln(0x2600)
+ #define spl5() spln(0x2500)
+ #define spl4() spln(0x2400)
+ #define spl3() spln(0x2300)
+ #define spl2() spln(0x2200)
+ #define spl1() spln(0x2100)
+ #define spl0() spln(0x2000)
+ 
+ #endif /* MASKED_SPL */
+ 
+ #endif /* DEBUG_SPL */
  
  #endif _m68k_machparam_
*** mk78/kernel/amiga/patchSIM.c~	Sun Jan  3 01:32:38 1993
--- mk78/kernel/amiga/patchSIM.c	Sun Jan  3 01:08:08 1993
***************
*** 0 ****
--- 1,74 ----
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <assert.h>
+ 
+ unsigned char new[] =
+ { 0x7f, 0xff, 0x0, 0x0, 0x80, 0x0, 0x0, 0x0, 0x0, 0x5 };
+ 
+ int
+ main (int argc, char **argv)
+ {
+   assert (argc == 2);
+   {
+     FILE *in, *out;
+     int c, state = 0, countdown = 0, cnt = 28842;
+     char backup[strlen (argv[1]) + 2];
+ 
+     strcat (strcpy (backup, argv [1]), "~");
+     assert (rename (argv [1], backup) == 0);
+     assert (in = fopen (backup, "r"));
+     assert (out = fopen (argv[1], "w"));
+     while ((c = getc (in)) != EOF)
+       {
+ 	if (!countdown)
+ 	  {
+ 	    switch (state)
+ 	      {
+ 	      case 0:
+ 		if (c == 'S')
+ 		  {
+ 		    state = 1;
+ 		    continue;
+ 		  }
+ 		break;
+ 	      case 1:
+ 		if (c == 'I')
+ 		  {
+ 		    state = 2;
+ 		    continue;
+ 		  }
+ 		putc ('S', out);
+ 		break;
+ 	      case 2:
+ 		if (c == 'M')
+ 		  {
+ 		    state = 3;
+ 		    continue;
+ 		  }
+ 		fprintf (out, "SI");
+ 		break;
+ 	      case 3:
+ 		if (c == '!')
+ 		  countdown = 1;
+ 		fprintf (out, "SIM");
+ 		break;
+ 	      }
+ 	    state = 0;
+ 	  }
+ 	else
+ 	  {
+ 	    if (cnt <= 0 && cnt >= -9)
+ 	      {
+ 		putc (new[-cnt--], out);
+ 		continue;
+ 	      }
+ 	    cnt--;
+ 	  }
+ 	putc (c, out);
+       }
+     fclose (in);
+     fclose (out);
+   }
+   return 0;
+ }
*** mk78/kernel/amiga/cons.c~	Tue Dec  8 18:53:22 1992
--- mk78/kernel/amiga/cons.c	Sun Jan  3 12:00:17 1993
***************
*** 29,34 ****
--- 29,35 ----
   *
   * Contributors:
   *      Bryan Ford
+  *	Niklas Hallqvist
   */
  
  #include <mach/boolean.h>
***************
*** 35,65 ****
  #include <machine/machparam.h>
  #include <machine/kd.h>
  #include <machine/uart.h>
  
  
! static boolean_t inited;
  
- 
  /* Called from init.c */
  void
! cninit(void)
  {
!   kdinit();
!   utinit();
!   inited = 1;
  }
  
! 
! /* Send a character from the kernel to both the screen and the serial port */
  void
! cnputc(u_char c)
  {
!   if(inited)
      {
!       if(c == '\n')
          cnputc('\r');
!       ut_cnputc(c);
!       kd_cnputc(c);
      }
  }
  
--- 36,94 ----
  #include <machine/machparam.h>
  #include <machine/kd.h>
  #include <machine/uart.h>
+ #include <device/cirbuf.h>
  
+ #define CONS_BUFSIZE 256
  
! static struct cirbuf phys_cons_buf;
! struct cirbuf *cons_buf = &phys_cons_buf;
! static enum { UNDEFINED, RAW, TTY } state = UNDEFINED;
  
  /* Called from init.c */
  void
! cninit (void)
  {
!   kdinit ();
!   utinit ();
!   state = RAW;
!   /* We can't use cb_alloc here because kalloc isn't initialized yet */
! #if 0
!   cb_alloc (cons_buf, CONS_BUFSIZE);
! #else
!   {
!     register struct cirbuf *cb = cons_buf;
!     register int buf_size = CONS_BUFSIZE;
!     static char buf[CONS_BUFSIZE];
! 
!     cb->c_start = buf;
!     cb->c_end = buf + buf_size;
!     cb->c_cf = buf;
!     cb->c_cl = buf;
!     cb->c_cc = 0;
!     cb->c_hog = buf_size - 1;
!   }
! #endif
  }
  
! /* Send a character from the kernel to both the screen and the serial port
!  */
  void
! cnputc (u_char c)
  {
!   if(state != UNDEFINED)
      {
!       if (c == '\n')
          cnputc('\r');
!       if (state == RAW)
! 	{
! 	  ut_cnputc (c);
! 	  kd_cnputc (c);
! 	}
!       else
! 	{
! 	  ttyoutput (c, &kd_tty);
! 	  ttyoutput (c, &uart_tty);
! 	}
      }
  }
  
*************** cnputc(u_char c)
*** 66,81 ****
  
  /* Get a key from either the keyboard or the serial port */
  int
! cngetc(void)
  {
!   int s, c, c_o;
  
!   if(!inited)
!     return(-1);
! /*  s = spltty();*/
! 
!   while(((c = ut_cnpollc()) < 0) && ((c = kd_cnpollc()) < 0));
! /*  splx(s);*/
!   return(c);
  }
  
--- 95,120 ----
  
  /* Get a key from either the keyboard or the serial port */
  int
! cngetc (void)
  {
!   int c = -1;
! 
!   switch (state)
!     {
!     case UNDEFINED:
!       break;
!     case RAW:
!       while (c < 0)
! 	{
! 	  int s = spltty ();
! 	  c = getc (cons_buf);
! 	  splx (s);
! 	}
!       break;
!     default:
!       panic ("cngetc: state not implemented\n");
!     }
  
!   return c;
  }
  
*** mk78/kernel/amiga/uart.c~	Tue Dec  8 18:53:46 1992
--- mk78/kernel/amiga/uart.c	Sun Jan  3 05:11:09 1993
***************
*** 41,46 ****
--- 41,47 ----
  #include <device/tty.h>
  #include <device/io_req.h>
  #include <device/buf.h>         /* for struct uio (!) */
+ #include <device/cirbuf.h>
  #include <device/errno.h>
  
  #include <sys/ioctl.h>
***************
*** 51,56 ****
--- 52,58 ----
  
  extern void ttrstrt();
  
+ extern struct cirbuf *cons_buf;
  struct tty uart_tty;
  
  /*
*************** utrint ()
*** 260,265 ****
--- 262,268 ----
    if (!(data & SERDATRF_RBF))
      return;
  
+ #if 0
    if ((tp->t_state&(TS_ISOPEN|TS_WOPEN)) == 0)
        return;
  
*************** utrint ()
*** 269,274 ****
--- 272,280 ----
      c = data & 0x7f;
  
    ttyinput(c, tp);
+ #else
+   putc (data & 0xff, cons_buf);
+ #endif
  }
  
  void
*************** ut_cnputc(int c)
*** 328,342 ****
        
        /* rather rude kind of flow-control, but I want to see EVERYTHING on
           my vt100, not just parts of a too fast transmission ;-)) */
        if ((c = ut_cnpollc ()) == 19)
          {
            do c = ut_cnpollc (); while (c != 17);
  	}
        splx (s);
      }
  }
  
! 
  /* Called from cons.c, to poll for a character.  */
  int
  ut_cnpollc(void)
--- 334,355 ----
        
        /* rather rude kind of flow-control, but I want to see EVERYTHING on
           my vt100, not just parts of a too fast transmission ;-)) */
+ #if 0
        if ((c = ut_cnpollc ()) == 19)
          {
            do c = ut_cnpollc (); while (c != 17);
  	}
+ #else
+       if ((c = getc (cons_buf)) == 19)
+         {
+           do c = getc (cons_buf); while (c != 17);
+ 	}
+ #endif
        splx (s);
      }
  }
  
! #if 0
  /* Called from cons.c, to poll for a character.  */
  int
  ut_cnpollc(void)
*************** ut_cnpollc(void)
*** 363,366 ****
--- 376,380 ----
  #endif
      return c;
  }
+ #endif
  
*** mk78/kernel/amiga/kd.c~	Mon Sep 14 15:30:41 1992
--- mk78/kernel/amiga/kd.c	Sun Jan  3 04:38:18 1993
***************
*** 41,48 ****
  #include <device/io_req.h>
  #include <device/device_types.h>
  #include <device/buf.h>
  
- 
  /* Display sizes in characters */
  #define NTSC_WIDTH      80
  #define NTSC_HEIGHT     27
--- 41,48 ----
  #include <device/io_req.h>
  #include <device/device_types.h>
  #include <device/buf.h>
+ #include <device/cirbuf.h>
  
  /* Display sizes in characters */
  #define NTSC_WIDTH      80
  #define NTSC_HEIGHT     27
*************** int screen_width, screen_height;
*** 60,68 ****
  
  int px,py;
  
- 
  struct tty kd_tty;
! 
  
  /*
   * kd_state shows the state of the modifier keys (ctrl, caps lock,
--- 60,67 ----
  
  int px,py;
  
  struct tty kd_tty;
! extern struct cirbuf *cons_buf;
  
  /*
   * kd_state shows the state of the modifier keys (ctrl, caps lock,
*************** xorcurs(void)
*** 236,241 ****
--- 235,242 ----
  int
  kd_putc(int c)
  {
+   u_int s = spltty ();
+ 
    xorcurs();
    switch(c)
      {
*************** kd_putc(int c)
*** 281,286 ****
--- 282,288 ----
          break;
      }
    xorcurs();
+   splx(s);
    return(0);
  }
  
*************** kdintr(void)
*** 784,798 ****
--- 786,806 ----
             */
            for ( ; (c != K_DONE) && (char_idx <= max);
                 c = key_map[scancode][char_idx++]) {
+ #if 0
              (*linesw[tp->t_line].l_rint)(c, tp);
+ #else
+ 	    putc (c, cons_buf);
+ #endif
            }
          }
      }
  
+ #if 0
    {
      int i;
      for(i = 0;i < 50;i++); /* oohhhh... */
    }
+ #endif
  
    ciaa.cra &= ~(1<<6);
    ciaa.sdr = incode;
*************** kdintr(void)
*** 800,811 ****
    splx(o_pri);
  }
  
! 
! /* Called from cons.c, to poll for characters from the keyboard.  Called at spltty.  */
  int
  kd_cnpollc(void)
  {
    int c = -1;
    if(ciaa.icr & (1<<3))
      {
        unsigned char incode, scancode;
--- 808,821 ----
    splx(o_pri);
  }
  
! #if 0
! /* Called from cons.c, to poll for characters from the keyboard.  Called at spltty.  Not anymore!!! */
  int
  kd_cnpollc(void)
  {
    int c = -1;
+   int s = SPLKD();
+ 
    if(ciaa.icr & (1<<3))
      {
        unsigned char incode, scancode;
*************** kd_cnpollc(void)
*** 840,844 ****
--- 850,856 ----
        if((c == K_SCAN) || (up))
          c = -1;
      }
+   splx(s);
    return c;
  }
+ #endif
*** mk78/kernel/amiga/kd.h~	Sun Sep 13 17:52:01 1992
--- mk78/kernel/amiga/kd.h	Sun Jan  3 04:34:43 1993
*************** typedef struct {
*** 505,510 ****
--- 505,514 ----
  
  /* Special routines used by the kernel to perform polled I/O */
  void kd_cnputc(int c);
+ #if 0
  int kd_cnpollc(void);
+ #endif
+ 
+ extern struct tty kd_tty;
  
  #endif _amiga_kd_
*** mk78/kernel/amiga/uart.h~	Sun Sep 13 11:54:05 1992
--- mk78/kernel/amiga/uart.h	Sun Jan  3 04:35:18 1993
*************** extern struct conssw conssw;
*** 52,58 ****
  
  
  /* Special routines used by the kernel to perform polled I/O */
! void kd_cnputc(int c);
! int kd_cnpollc(void);
  
  #endif _amiga_uart_
--- 52,62 ----
  
  
  /* Special routines used by the kernel to perform polled I/O */
! void ut_cnputc(int c);
! #if 0
! int ut_cnpollc(void);
! #endif
! 
! extern struct tty uart_tty;
  
  #endif _amiga_uart_
*** mk78/kernel/amiga/amiga_dma.c~	Tue Dec  8 18:54:26 1992
--- mk78/kernel/amiga/amiga_dma.c	Sun Jan  3 03:59:00 1993
***************
*** 30,37 ****
   *		       Eduardo Horvath
   */
  
! #if defined (A3000) && defined (GVP11)
! #error Both A3000 and GVP11 cant be defined simultaneously
  #endif
  
  #if defined (A3000) || defined (GVP11) || defined (A2091)
--- 30,37 ----
   *		       Eduardo Horvath
   */
  
! #if defined (A3000) + defined (GVP11) + defined (A2091) > 1
! #error Only one of A2091, A3000 and GVP11 can be defined
  #endif
  
  #if defined (A3000) || defined (GVP11) || defined (A2091)
*** mk78/kernel/amiga/conf.c~	Tue Dec  8 19:06:19 1992
--- mk78/kernel/amiga/conf.c	Sat Jan  2 00:15:08 1993
*************** extern int utopen(), utclose(), utread()
*** 43,50 ****
  extern int utgetstat(), utsetstat(), utportdeath();
  #define utname "ut"
  
! /* A3000 SCSI driver */
! #if defined(A3000)||defined(A2091)
  #define rz_name "sd"
  extern int rz_get_status(), rz_set_status(), rz_devinfo();
  extern int rz_open(), rz_close(), rz_read(), rz_write();
--- 43,50 ----
  extern int utgetstat(), utsetstat(), utportdeath();
  #define utname "ut"
  
! /* SCSI driver */
! #if defined (A3000) || defined (A2091) || defined (GVP11)
  #define rz_name "sd"
  extern int rz_get_status(), rz_set_status(), rz_devinfo();
  extern int rz_open(), rz_close(), rz_read(), rz_write();
*************** struct dev_ops	dev_name_list[] =
*** 81,87 ****
  	  nodev,	nulldev,	utportdeath,	0,
  	  nodev },
  
! #ifdef A3000
  	{ rz_name,	rz_open,	rz_close,	rz_read,
  	  rz_write,	rz_get_status,	rz_set_status,	nodev,
  	  nodev,	nulldev,	nulldev,	8,
--- 81,87 ----
  	  nodev,	nulldev,	utportdeath,	0,
  	  nodev },
  
! #if defined (A3000) || defined (A2091) || defined (GVP11)
  	{ rz_name,	rz_open,	rz_close,	rz_read,
  	  rz_write,	rz_get_status,	rz_set_status,	nodev,
  	  nodev,	nulldev,	nulldev,	8,
*** mk78/kernel/amiga/autoconf.c~	Tue Dec  8 19:04:52 1992
--- mk78/kernel/amiga/autoconf.c	Sat Jan  2 11:17:35 1993
*************** void machine_init()
*** 184,198 ****
    /* Probe the sbic based scsi busses (with ints enabled!) */
  #ifdef A3000
    configure_bus_master("sbic", (caddr_t)A3000_SCSI_ADDR, 
! 	               (caddr_t)PHYS_A3000_SCSI_ADDR, 0, "A3000 on board SCSI");
  #endif
  #ifdef A2091
    configure_bus_master("sbic", (caddr_t)A2091_SCSI_ADDR, 
! 	               (caddr_t)PHYS_A2091_SCSI_ADDR, 0, "A2091/A590 SCSI Controller");
  #endif
  #ifdef GVP11
    configure_bus_master("sbic", (caddr_t)GVP11_SCSI_ADDR, 
! 	               (caddr_t)PHYS_GVP11_SCSI_ADDR, 0, "GVP series II (prod. 11) SCSI");
  #endif
  }
  
--- 184,201 ----
    /* Probe the sbic based scsi busses (with ints enabled!) */
  #ifdef A3000
    configure_bus_master("sbic", (caddr_t)A3000_SCSI_ADDR, 
! 	               (caddr_t)PHYS_A3000_SCSI_ADDR, 0,
! 		       "A3000 on board SCSI");
  #endif
  #ifdef A2091
    configure_bus_master("sbic", (caddr_t)A2091_SCSI_ADDR, 
! 	               (caddr_t)PHYS_A2091_SCSI_ADDR, 0,
! 		       "A2091/A590 SCSI Controller");
  #endif
  #ifdef GVP11
    configure_bus_master("sbic", (caddr_t)GVP11_SCSI_ADDR, 
! 	               (caddr_t)PHYS_GVP11_SCSI_ADDR, 0,
! 		       "GVP series II (prod. 11) SCSI");
  #endif
  }
  
*** mk78/kernel/amiga/gvp11.h~	Sat Dec 19 10:24:34 1992
--- mk78/kernel/amiga/gvp11.h	Sun Oct 25 18:53:50 1992
***************
*** 0 ****
--- 1,72 ----
+ /*
+  * Mach Operating System
+  * Copyright (c) 1992 Carnegie Mellon University
+  * All Rights Reserved.
+  *
+  * Permission to use, copy, modify and distribute this software and its
+  * documentation is hereby granted, provided that both the copyright
+  * notice and this permission notice appear in all copies of the
+  * software, derivative works or modified versions, and any portions
+  * thereof, and that both notices appear in supporting documentation.
+  *
+  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+  *
+  * Carnegie Mellon requests users of this software to return to
+  *
+  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
+  *  School of Computer Science
+  *  Carnegie Mellon University
+  *  Pittsburgh PA 15213-3890
+  *
+  * any improvements or extensions that they make and grant Carnegie Mellon
+  * the rights to redistribute these changes.
+  */
+ 
+ /*
+  * This file describes the layout of a GVP series II SCSI controller
+  * (product 11) as understood by Niklas Hallqvist (niklas@appli.se).
+  * Note: this info is not hard facts, but rather guesses.
+  */
+ 
+ #ifndef _amiga_gvp11_h
+ #define _amiga_gvp11_h
+ 
+ #define PHYS_GVP11_DMAC 0xe90000 /* Should be gotten from autoconfig */
+ 
+ struct gvp11_dmac_t {
+   u_short _____________pad0[32];
+   u_short control;
+   u_short _____________pad1[15];
+   u_char  _____________pad2;
+   u_char  wd_address;
+   u_char  _____________pad3;
+   u_char  wd_data;
+   u_short _____________pad4[2];
+   u_short bank;
+   u_short _____________pad5[3];
+   void    *DMA_address;
+   u_short secret1;	/* Initially store 0  here */
+   u_short start_DMA;	/* strobe */
+   u_short stop_DMA;	/* strobe */
+   u_short secret2;	/* Initially store 1  here */
+   u_short secret3;	/*         "       15  "   */
+ };
+ 
+ /* bits in `control' */
+ #define GVP11_DMAC_BUSY		(1<<0)
+ #define GVP11_DMAC_INT_PENDING	(1<<1)
+ #define GVP11_DMAC_INT_ENABLE	(1<<3)
+ #define GVP11_DMAC_DIR_WRITE	(1<<4)
+ 
+ 
+ #ifdef KERNEL
+ #define gvp11_dmac (*((volatile struct gvp11_dmac_t *)VM_GVP11_DMAC))
+ #define phys_gvp11_dmac (*((volatile struct gvp11_dmac_t *)PHYS_GVP11_DMAC))
+ #define GVP11_SCSI_ADDR (&gvp11_dmac._____________pad2)
+ #define PHYS_GVP11_SCSI_ADDR (&phys_gvp11_dmac._____________pad2)
+ #endif
+ 
+ 
+ #endif /* _amiga_gvp11_h */
*** mk78/README.GVP~	Sun Jan  3 12:56:09 1993
--- mk78/README.GVP	Sun Jan  3 12:55:58 1993
***************
*** 0 ****
--- 1,17 ----
+ KludgeMach will run with GVP SCSI driver support if you add -DGVP11
+ to CFLAGS in the Makefile.  You can't (yet) have more than one of
+ the following symbols defined: A2091, A3000 and GVP11, they're
+ mutually exclusive.  Note: GVP has produced many SCSI controllers
+ and they're not quite compatible with each other.  This port is for
+ series II controllers (er_Product = 11, can be checked with the GVPinfo
+ program on the FaaastPrep disk, or another similar program).  Warning!
+ The author has no DEFINITIVE knowledge of GVP products, all he knows
+ is guesses, empirically shown to be seemingly correct.  No guarantees
+ whatsoever exist that this software doesn't thrash any of your SCSI
+ media, so beware...  Allright, having that said, I do want other
+ brave people to try it out, and if you find bugs, buglets or just
+ peculiarities, please inform me.
+ 
+ Niklas Hallqvist
+ niklas@appli.se
+ 

Niklas Hallqvist	Phone: +46-(0)31-40 75 00
Applitron Datasystem	Fax:   +46-(0)31-83 39 50
Molndalsvagen 95	Email: niklas@appli.se
S-412 63  GOTEBORG, Sweden     mcsun!seunet!appli!niklas

