Subject: Re: ethernet/video woes
To: John Wittkoski <jpw@netscape.com>
From: Scott Reynolds <scottr@og.org>
List: port-mac68k
Date: 11/04/1996 11:37:22
On Sat, 2 Nov 1996, John Wittkoski wrote:

> I tried this setup this weekend:
>    Mac II with RasterOps 264 board

I have a CB264.

> Seems to work fine except that I get the following error
> before the screen clear happens:
>    Error -37 trying to open slot 0xd video driver
>    Error -37 processing video card slot 0xd sRsrcID 0x90
>    Warning - error -37 turning off interrupts - booting anyway

I assume it's complaining because it doesn't know how to open the card's
driver, actually.  (That's what that error says to me, at least.)

> Then I install an old Asante MacCon MC3NB ethernet card
> (enet chip is DP83902). It recognizes the card and I can ifconfig
> it, but it totally hangs when I try to send any traffic out the
> port (ping, etc). A break (over serial console) into ddb and 
> a trace gives me:
> [...]
> So, has anyone played with a similar setup recently?

I groveled through the card's interrupt handler until I found what I was
looking for.  I'm certain I have some code around here somewhere that will
handle the interrupt, but it's very CB264-specific, unfortunately, and I
will not be putting it into the source tree.  I'll append it to this
message; it's an older diff but should be pretty trivial to add
regardless.

> P.S. I've also got a Cabletron ethernet card here that uses
> a DP8390 chip, but it's not even recognized at boot time as
> an ethernet card.

In my experience, Cabletron uses mostly standard parts in extremely
non-standard/annoying/EVIL ways, so that you have to use their proprietary
driver.  This is a tactic that IBM used to play pretty heavily with, and
in some sectors, they probably still do to some extent.  (OK, so it's not
really -evil- but it's certainly no way to keep customers these days.)

--scott

Index: dev/grf_mv.c
===================================================================
RCS file: /a/cvsroot/src/sys/arch/mac68k/dev/grf_mv.c,v
retrieving revision 1.11.4.1
diff -c -r1.11.4.1 grf_mv.c
*** grf_mv.c	1996/08/05 20:51:03	1.11.4.1
--- grf_mv.c	1996/09/08 07:21:09
***************
*** 50,59 ****
  #include "grfvar.h"
  
  static void	load_image_data __P((caddr_t data, struct image_data *image));
! static void	grfmv_intr __P((void *vsc, int slot));
  static int	get_vrsrcid __P((nubus_slot *slot));
  
  static char zero = 0;
  
  static int	grfmv_mode __P((struct grf_softc *gp, int cmd, void *arg));
  static caddr_t	grfmv_phys __P((struct grf_softc *gp, vm_offset_t addr));
--- 50,61 ----
  #include "grfvar.h"
  
  static void	load_image_data __P((caddr_t data, struct image_data *image));
! /*static*/ void	grfmv_intr __P((void *vsc, int slot));
  static int	get_vrsrcid __P((nubus_slot *slot));
  
+ #ifndef MYSTERY
  static char zero = 0;
+ #endif
  
  static int	grfmv_mode __P((struct grf_softc *gp, int cmd, void *arg));
  static caddr_t	grfmv_phys __P((struct grf_softc *gp, vm_offset_t addr));
***************
*** 93,109 ****
  }
  
  /*ARGSUSED*/
! static void
  grfmv_intr(vsc, slot)
  	void	*vsc;
  	int	slot;
  {
  	caddr_t			 slotbase;
  	struct grfbus_softc	*sc;
  
  	sc = (struct grfbus_softc *) vsc;
  	slotbase = (caddr_t) sc->sc_slot.virtual_base;
  	slotbase[0xa0000] = zero;
  }
  
  static int
--- 95,156 ----
  }
  
  /*ARGSUSED*/
! /*static*/ void
  grfmv_intr(vsc, slot)
  	void	*vsc;
  	int	slot;
  {
+ #ifdef MYSTERY
+ 	struct grfbus_softc *sc;
+ 	caddr_t slotbase;
+ 
+ 	sc = (struct grfbus_softc *) vsc;
+ 	slotbase = (caddr_t) sc->sc_slot.virtual_base;
+ 	asm volatile("	movl	%0,a0
+ 			movl	a0@(0xff6028),d0
+ 			andl	#0x2,d0
+ 			beq	_mv_intr0
+ 			movql	#0x3,d0
+ 		_mv_intr0:
+ 			movl	a0@(0xff600c),d1
+ 			andl	#0x3,d1
+ 			cmpl	d1,d0
+ 			beq	_mv_intr_fin
+ 			movl	d0,a0@(0xff600c)
+ 			nop
+ 			tstb	d0
+ 			beq	_mv_intr1
+ 			movl	#0x0002,a0@(0xff6040)
+ 			movl	#0x0102,a0@(0xff6044)
+ 			movl	#0x0105,a0@(0xff6048)
+ 			movl	#0x000e,a0@(0xff604c)
+ 			movl	#0x001c,a0@(0xff6050)
+ 			movl	#0x00bc,a0@(0xff6054)
+ 			movl	#0x00c3,a0@(0xff6058)
+ 			movl	#0x0061,a0@(0xff605c)
+ 			movl	#0x0012,a0@(0xff6060)
+ 			bra	_mv_intr_fin
+ 		_mv_intr1:
+ 			movl	#0x0002,a0@(0xff6040)
+ 			movl	#0x0209,a0@(0xff6044)
+ 			movl	#0x020c,a0@(0xff6048)
+ 			movl	#0x000f,a0@(0xff604c)
+ 			movl	#0x0027,a0@(0xff6050)
+ 			movl	#0x00c7,a0@(0xff6054)
+ 			movl	#0x00d7,a0@(0xff6058)
+ 			movl	#0x006b,a0@(0xff605c)
+ 			movl	#0x0029,a0@(0xff6060)
+ 		_mv_intr_fin:
+ 			movl	#0x1,a0@(0xff6014)"
+ 		: : "g" (slotbase) : "a0","d0","d1");
+ #else
  	caddr_t			 slotbase;
  	struct grfbus_softc	*sc;
  
  	sc = (struct grfbus_softc *) vsc;
  	slotbase = (caddr_t) sc->sc_slot.virtual_base;
  	slotbase[0xa0000] = zero;
+ #endif
  }
  
  static int