NetBSD on Mr.Coffee JavaStation

What is Mr.Coffee

Mr.Coffee is a code name for JavaStation-1, Sun's first attempt at a Java Station. It's a sun4m architecture machine based on SPARCStation-4 design with some modifications. It uses microSPARC-II processor.

Mr.Coffee uses PC keyboard and mouse. NetBSD/sparc does not support them currently, though the work is in progress to write necessary glue code.

TCX framebuffer is supported, so you can currently run Xsun(1) in "output only" mode ;-).

Different PROM versions

Mr.Coffee machines come with two two different OpenBoot versions. Older machines use OpenBoot 2.30 and are supported by NetBSD/sparc since summer 2000. However my understanding is that most machines come with OpenFirmware-style OpenBoot 3.x and NetBSD/sparc had no support for those.

The rest of this page is a collection of technical notes about these OFW machines and what is necessary to get NetBSD/sparc running on them. This is a work in progress. I currently have NetBSD running on an OFW machine, but there are still few issues to sort out and code is not yet integrated into -current.

Give me the ok prompt

Get inside your box and set jumper J0904 1-2 to IN. Now power on the machine (you can either hook up a keyboard/display or use serial console). It will enter POST on serial console (my 3.11.2 box is quite verbose). Then you'll see something like this:
ttya initialized
Release 3.11.1 Version 1 created 1998/03/18 20:10
Probing Memory Bank #0 32 Megabytes
Probing Memory Bank #1 32 Megabytes
Ethernet address 8:0:20:87:b4:c4

JavaStation
OpenBoot 3.11.1, 64 MB memory installed, Serial #8893636.
Ethernet address 8:0:20:87:b4:c4, Host ID: 8087b4c4.


Type any key to interrupt automatic startup
6
at this point type any key and you'll be greated with ok prompt.

What's different?

OpenBoot 3.x is an implementation of IEEE 1275 OpenFirmware.

Hint for those familiar with OBP2: use dev instead of cd and use .properties instead of .attributes to navigate device tree.

OpenFirmware does not provide "romvec" interface of older boot proms, instead client is passed an OF entry point named client interface handler (in %o3). Fortunately, OpenFirmware support was already imported into NetBSD/sparc from sparc64 port, and though it was not really tested before it turned out to be fairly complete and well integrated.

Another difference is that client program (boot.net, secondary boot in our case) must be a real a.out or ELF executable with accurate segment sizes! Bogus header we snap on in stand/boot will cause a crash (see port-sparc/12548).

What's wrong?

The problem with OFW in these machines is that it's screwed in few important places. I'd rather not share with anyone those few strong words I have for its engineers.

PROM location

To quote SPARC supplement:

When a client program begins execution, an Open Firmware implementations use of any virtual address space outside of the ranges 0xffd0.0000-0xffef.ffff and 0xfe00.0000-0xfeff.ffff shall have ceased, except for the virtual address space and associated memory that is allocated for the client programs code and data, as specified in the client program header.

The problem with Mr.Coffee PROM is that it occupies address space f000.0000-f007.ffff outright intruding into the address space we want to use for kernel!

NetBSD/sparc KERNBASE is 0xf0000000 so we have an address conflict. We can't move OFW, so we have to move kernel. In principle it should be possible to move kernel to f008.0000 and stay within F0 region, but it will also require a re-layout of the kernel and some more work to get initial mapping of the kernel into high virtual addresses. Since that's too radical for me, I moved kernel to region EF, but it turned out that some code in kernel had alignment assumptions about NUREG and NKREG, so I moved kernel to region E8. [NB: boot.net has to be recompiled accordingly with include/loadfile_machdep.h matching the new KERNBASE]

I'm not sure if this is a good thing to propagate to the main tree, so for -current integration it might be neccessary to redo this part. Alternatively JavaStation will require a custom kernel. We'll see.

No CPU node in the device tree

NetBSD gets a lot of interesting info from CPU node.

No iommu node in the device tree

On sun4m the sbus is sitting under iommu. Unfortunately device tree does not have a node describing iommu and the sbus node is right under the root. Thus we have to insinuate the iommu node if we see sbus node under root on sun4m.

The other place where we have to work around this omission is in bootpath_build to make bootpath match the attachment hierarchy.

No model property on eeprom (clock0) node

NetBSD uses model name to detect mk48t08 chip.

Confusing interrupt properties on le node

le node (ehternet) has correct old style intr property of 0x26 0x0, but new style interrupts property contains zero. I changed sbus_get_intr to fall back to intr property if interrupts exists but is zero (Sbus interrupt levels are 1 to 7).

How to cope with these deficiencies

At first I tried to sprinkle a lot of workarounds in the kernel code, but then I read FCode manuals and came up with a better solution. Now boot.net patches the PROM to correct most of the glitches so that kernel can see what it expects to see. The only problem that can't be corrected this way is the lack of iommu node, but the workaround for this problem is quite clean and non-intrusive.

Keyboard support etc

wscons is an undocumented mess (see kern/9770 :).

It might be easier to write an emulation layer on top of i8042 to make it look like sun keyboard/mouse. But in the long run (i.e. for Krups) wscons seems the way to go.

more to follow...


This page is maintained by Valeriy E. Ushakov
$Id: mrcoffee.html,v 1.9 2003/02/10 01:34:12 uwe Exp $