Subject: OpenBoot commands
To: NetBSD/Sparc64 Mailing-list <port-sparc64@netbsd.org>
From: ali \(Anders Lindgren\) <dat94ali@ludat.lth.se>
List: port-sparc64
Date: 11/02/2001 15:52:24
I am digging around in .../sparc64/{dev,sparc64}/ trying
to extract some low-level stuff that calls PROM functions[0],
in order to write a simple console-device on a SUN Ultra1.
After some hours of digging and trying to figure locore.s[1]
etc out, I have become more and more confused over what
state the machine actually is in when my OS[2] starts.
The NetBSD source-code is very helpful and very well written,
but since I don't know NetBSD internals well, I am pretty much
reading it out of context. I'd be very happy if someone could clarify a
few points, even though in my case this isn't directly NetBSD-related.

o I get the impression the PROM does a great deal of device-
  and memory-mapping with the MMU pre-boot. I just want to
  find out where the memory-regions are, so I can map my
  kernel's virtual memory and start doing my stuff.
  Do I need to do any of this device-tree walking? The only device
  I plan on using a.t.m is the keyboard and screen via the PROM
  console. I can't find  any proper docs on what the kernel must do on
  startup, and I'd rather not buy the IEEE OpenFirmware standard document
  on my limited student budget. I just want my kernel to boot. :)
  Can I just ignore whatever the PROM does and do whatever I
  please? (I guess this is a long way of asking "what state is
  the machine in when control is transferred to my kernel").
  The SPARCv9 architecture manual and Ultra1 programmer ref. manual
  include pretty much nothing on these issues.

o Are the calls to openfirmware (the function in locore.s) blocking
  as they appear to be? Do I need to catch keyboard interrupts or
  are they swallowed by the PROM's console-driver?

o Where can I find out what functions the PROM console has (things
  like moving the cursor, clearing the screen, mouse events(?) etc)?

I am under the impression I can build a simple console-device by
just doing PROM read()s and write()s if I just map the PROM into
my virtual address space (does it expect to be mapped to a certain
address btw?), but I need to figure out what magic the PROM has
done before I get to play and how those functions work.

MTIA,
ali - desperately wants a "debug printf" in his little OS.
:wq


[0] Basically, I am trying to make a simple console-device using
    PROM functions in much the same way pcons works.
[1] I'm not overly good at SPARC assembly; thank god it's pretty
    well commented. Nice work. :)
[2] Writing a little kernel that will boot on its own.