Subject: Re: MI SONIC Ethernet driver for mac68k
To: None <ivan.carrillo@gmail.com>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: port-mac68k
Date: 05/31/2007 20:58:41
ivan.carrillo@gmail.com wrote:

> > Is there "sn0 at obio0" line during configure before the panic?
> >
> 
> Yes, there's a line that reads:
> 
> sn0 at obio0: integrated SONIC Ethernet adapter
> 
> > Could you also try a stock -current kernel in NetBSD-daily?
> > ftp://ftp.NetBSD.org/pub/NetBSD-daily/HEAD/200705270002Z/mac68k/binary/kernel/
> >
> 
> Tried it and it seems to work fine (seems to boot faster too!).

Hmm. Maybe the card is not initialized properly and random RX DMA
might corrupt kernel text memory.

-current if_sn_obio.c has the following code on initialization:
---
	/*
	 * Kind of kludge this.  Comm-slot cards do not really
	 * have a visible type, as far as I can tell at this time,
	 * so assume that MacOS had it properly configured and use
	 * that configuration.
	 */
	switch (current_mac_model->machineid) {
	case MACH_MACLC575:
	case MACH_MACP580:
	case MACH_MACQ630:
		NIC_PUT(sc, SNR_CR, CR_RST);	wbflush();
		i = NIC_GET(sc, SNR_DCR);
		sc->snr_dcr |= (i & 0xfff0);
		sc->bitmode = (i & DCR_DW) ? 1 : 0;
		break;
	default:
		break;
	}
---
but it doesn't seem to work always on my LC630.
If a kernel is booted from MacOS without any network access
after powercycle the DCR_DW and DCR_EXTBUS (0x8000) are not set
(then card is initialized into 16 bit mode). But on booting from
MacOS with any network access (getting a kernel via fetch etc.)
the DCR is set and the card is initialized properly.

I guess LC575, P(erforma?)580, and Q630 (including LC630) can only
have the Apple CS network cards and all of them should be 32 bit,
so I've changed my patch to do so. Could you try this one?

http://www.ceres.dti.ne.jp/~tsutsui/netbsd/mac68k-MI-sonic-20070531.diff
http://www.ceres.dti.ne.jp/~tsutsui/netbsd/netbsd-mac68k-MI-sonic-20070531.gz
(these also contain fpu changes)

> Network throughput still seems somewhat slow, I'm getting max at
> around 130KB/s (in os 8.1 I get over 270KB/s).

The MI SONIC driver (sys/dev/ic/dp83932.c) should have better
performance than -current mac68k homegrown version because
the former does direct DMA from/to mbufs and less memory copies.
---
Izumi Tsutsui