Subject: Getting an Allegro acclerator card to work with NetBSD
To: None <port-mac68k@NetBSD.ORG>
From: Marc LaViolette <marclavi@gmc.ulaval.ca>
List: port-mac68k
Date: 07/23/1998 10:15:50
Hello port-mac-68k

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.

=46rom what I understand this is what the booter for NetBSD does. It sets up
the mac to boot the BSD kernel then reboots the Mac. I wrote to Nigel
Pearson about maybe doing this in the booter, but after a couple of trials
which did not work we agreed that maybe this belongs in the kernel so that
we could turn on the acclerator card at boot time and turn it off at
shutdown. There seems to be a problem rebooting LC (but not LCII) if the
card is still active (see the texts below which are my correspondance with
him).

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.

Thanks for any help you can give me.

Marc LaViolette
Universite Laval
Quebec, Canada
G1K 7P4

e-mail: marclavi@gmc.ulaval.ca


--------------------cut with an implement of destruction--------------------

>Date: 4/3/1998 9:33
>To: Mike Wilks
>From: Support
>I am trying to get my Allegro to work with the NetBSD operating system
>that has been ported to the Mac. For reason to complicated to explain in
>a short letter the booting process of the NetBSD requiers that the mac
>be booted under MacOS then using a special application that shutdown the
>Mac then reboots under NetBSD. This implies that whatever the extension
>does the PDS interface gets lost when the reboot occurs.
>
>I was thinking of writting the code to recognize and setup your card so
>that it's CPU control the CPU bus. For this I would need tech info about
>your card or possibly your code to put the daughtercard in the right
>state. I have apple's tech info about the LC's PDS and understand how
>the MacOS manager for de PDS works.
>
>Though I realise this is proprietary info, any help you could give me
>would be appriciated. Think of all those LC's out there that could
>become Un*x machine with a working coprocessor.
>
>Thank to any consideration you give this letter
>
>Marc LaViolette
>Universit=C8 Laval
>Quebec Canada
>G1K 7P4
>
>e-mail: marclavi@gmc.ulaval.ca
>--------------------------------------
>
>Hello Marc,
>
>I am not familiar with how the NetBSD boots, but I can give you some
>info into the operation of the Allegro LC.
>
>Since the Mac LC ROMs do not support the 68030, the computer powers on
>and resets using the motherboard 68020. When the Allegro LC runs, it
>installs some system patches (to HWPriv so they handle the 68030s
>caches) and then installs the driver '.Accel_68030_Sonnet_Allegro' into
>memory and calls it to turn on the Allegro. The driver sets up
>everything and then turns on the Allegros 68030. It then turns on
>Allegros small L2 secondary cache.
>
>In order for the LC to restart, the software must disable the Allegro
>and go back to the 68020. A Driver control call is made and the driver
>will shut off the Allegro.
>
>If all that is happening is NetBSD closes the driver (thus shutting off
>the Allegro), then simply patching the driver to ignore future control
>calls would prevent it from shutting off the Allegro. However, you will
>not be able to Restart to MacOS until Allegro is shut off.
>
>If you need to write your own software to control the Allegro, then
>heres what info I can give. To Turn on or off the Allegro, write a byte
>to address 0xFEC00000 (this swaps processors). If the Allegro is being
>turned on, then the 68030 will come out of the Reset exception vector
>(0x00000004) in reset state -- that is caches off, address translations
>off, etc... If switching off the Allegro, the 68020 will come back thru
>the Access Error exception vector (0x00000008). To turn on or off the
>L2 cache, write a byte to address 0xFEE00000. You can disassemble the
>driver to see how I did this semi-complicated procedure.
>
>Hope this helps,
>
>--Mike
>Sonnet Technologies
>


--------------------cut with an implement of destruction--------------------

>Just a few more questions if possible (I guess you saw that one comming :-)=
 )

>The first question is when you say "write a byte to address 0xFEC00000" do
>you mean the byte can contain anything as long as I put it in 0xFEC00000.

Any byte can be written

>I wanted to point out that my Mac was an LCII, so I guess the part about
>the ROMs and the system patches get skipped when it boots. But I am
>guessing the part about disabeling the Allegro before shutdown still
>happens.Because of that I must write some software to add at bootime of
>NetBSD to turn on the Allegro. But I need to make sure the card is
>installed.

Assumptions are correct. It would then be easier to patch the driver so
that the control call to disable it doesnt happen. There isnt a way to
detect its prescense. The only thing you can do is turn it on and see
if the speed increases.

>As you probably know, the Apple recomended way of recognising PDS cards is
>to use the slot manager and a declaration ROM on the card in what they call
>a pseudoslot desing that imitates a Nubus card. Was this done for the
>Allegro. I was thinking about writing a simplified "slot manager" to check
>if there was a valid card (in this case the Allegro) in the slot. I was
>planning on using the board's sResource to make sure it was an Allegro.

No, the card was made as cheap as possible, there is no ROM.

>And lastly, from what I understand is I must turn of the Allegro at reboot
>time to make sure that the LCII will reboot. If I don't I will have to turn
>of the power so the Mac restarts correctly. Is this right?

This is correct only on the Mac LC, since its ROMs have a bug working
with the 68030. The Mac LC II will reboot just fine without turning off
the card.

--Mike
Sonnet Technologies