Subject: Re: Getting an Allegro acclerator card to work with NetBSD
To: None <marclavi@gmc.ulaval.ca>
From: Ken Nakata <kenn@synap.ne.jp>
List: port-mac68k
Date: 07/24/1998 01:28:58
Thu, 23 Jul 1998 10:15:50 -0500, Marc LaViolette wrote:
> 
> I am the owner of a Mac LCII that is presently running NetBSD. I also have
> an accelarator card for the LCII that should give me an FPU and a 68030 at
> 32 MHZ.
> It works fine under MacOS but is turned off during the boot process of my
> BSD. I contacted Sonnet technologies (the manufacturers of the PDS card)
> and they inform me that the driver they wrote for the Allegro turns off the
> card on reboot.

I think You should ask Sonnet how you probe for the accelerator
because writing a byte to 0xfec00000 or 0xfee00000 might have adverse
side effects on other machines with a NuBus card in slot E.  It's
better to avoid unnecessary writes to these addresses if possible.

> Now the guy from Sonnet told me how to turn on and off the card (see
> below). I was wondering if it would be possible to turn back on the card as
> the kernel is booting. I would do the programming myself if you could
> indicate in what part of the source code this should be done.

CPU type is probed almost immediately after program counter hits
kernel entry point (start in locore.s).  So, you should turn on the
accelerator before NetBSD trys to know on which CPU it's running.
Well, it can be done later for your LCII, but if this care is taken,
your code will be compatible with Allegro on LC as well.

A possible code might be (if I understand Sonnet's explanation
correctly):

	???				| Probe for allegro
	b?? 1f				| Skip if allegro is not present
	moveml	d0-d7/a0-a6,sp@-	| Save all integer registers
	movl	sp,0x0000		| Save sp in reset vector
	lea	2f,a0			| Save where you want accelerator
	movl	a0,0x0004		| to start execution in reset vector
	movb	d0,0xfec00000		| Turn on accelerator
2:					| This is where accelerator
					| starts execution
	moveml	sp@+,d0-d7/a0-a6	| Restore all integer registers
					| and go back to business
1:

Something like this.  I'd insert this right after on-chip cache is
disabled in start.  See src/sys/arch/mac68k/mac68k/locore.s.

Of course, there's no warranty that this code will actually work
although, to me, it looks reasonable.  It may be a good idea to save
old reset vector contents, too.

Good luck,

Ken