Open Firmware is software that is used after powering a machine to bring the operating system online (most visibly on PowerPC and SPARC systems), all modern Macintosh systems use it. This article looks at the Open Firmware spec, traces its history as a standard, examines how it works and some of its components, and discusses the benefits it offers. The best way to learn more about OF is to practice, to get a Mac, hold down command-option-O-F when you turn it on, and just start typing.
If you do, make sure it’s a NewWorld ROM Mac. Anything that is a Blue and White Power Mac G3, iMac G3, iBook, or PowerBook G3 “Pismo”, or anything greater than these, is a NewWorld Mac with OpenFirmware.
It is very possible to crowbar your machine if you go mucking about in device tree and are not careful.
While Forth as a language seems rather arcane to me personally, the functionality of OF, or some derivate, (based on a more commonplace language) would be great for the long overdue BIOS-replacement. (What does the Itanium platform use?) Perhaps AMD could lead the way.
On the other hand, Wintel probably want DRM on that level, so perhaps it’s just a pipe dream. (OF on the PC platform, same PCI-xxx cards working on multiple CPU architectures, shared (same?) code for the loaders/device enumerators of different OS’s on different architectures, user-familiarity across hardware architectures, ..)
The main reason Forth is used in OpenFirmware (as far as I’m aware) is because Forth works very, very close to the metal. An unbelieveably large portion of Forth itself is usually written in Forth.
It’s almost a type of stack-based machine-code, in that most of the instructions are about moving data and straight-forward logic rather than trying to make it easy for HB’s to control a computer — there are a few Forth CPUs out there which run it natively; one used to be from Motorolla, I think. A typical *full* Forth kernel runs to a few Kilobytes of code, rather than the few Megabytes of a typical “modern” language.
Anyway, these attributes make it extremely attractive for a BIOS: very, very portable (nearly architecture-agnostic), extremely small, and easily able to perform probably the most important task of the BIOS: initialising the hardware. Instead of (e.g) x86 code in an add-on card’s firmware, you can put Forth in, which uses a few OF-standardised functions (I forget the term used in Forth) to find out what it can do, access certain other settings, etc, then do the initialisation, e.g. setting certain memory-registers, sending a few PCI commands, etc, etc. The same card should therefore be able to plug into a OF-capable Sparc, PPC, x86, IA-64, etc, etc mother-board without needing any special firmware upgrade.
The fact that it’s also easily extendable allows a simple command-line, some in-BIOS diags, and several other really convenient bits of code, but these are really just big bonuses. I don’t really see the point of putting a Perl- or Ruby- or C++-alike in the BIOS/Firmware, because you’d only waste space for minimal advantage.
Are you really going to be coding for your BIOS/OF very often?