On Sat, Dec 31, 2022, 1:03 PM Paul Ruizendaal <pnr@planet.nl> wrote:

> On 31 Dec 2022, at 15:59, Dan Cross <crossd@gmail.com> wrote:
> On Fri, Dec 30, 2022 at 1:26 PM Paul Ruizendaal <pnr@planet.nl> wrote:
>> [snip]
>> It would seem that the next step for Unix in the area of boot, config and device drivers came with Sun’s OpenBoot in 1988 or so. This also appears to be the first appearance of device trees to describe the hardware to the bios and the kernel. Moreover, it would seem to me that OpenBoot is a spiritual ancestor of the modern Risc-V SBI specification. Maybe by 1988 the IO hardware had become sufficiently complex and/or diverse to warrant a break from tradition?
>> Was there any other notable Unix work on better organising the boot process and the device drivers prior to OpenBoot?

OpenBoot also had device drivers written in 4th for OS agnostic goodness. It never caught on, though the concept lives on in AML in ACPI which aims lower in its abstraction...

> I think that BSD supported autoconfiguration on the VAX well before
> OpenBoot; the OpenBSD man page says it dates from 4.1 (1981) and was
> revamped in 4.4.

That is interesting. Are you referring to this:

Or is auto configuration something else?

Config == what is in the kernel with some strong hints of where to look for root and some devices (depending on the busses involved).

Autoconf == discovering devices during early boot on the system (maybe with hints from config) and connecting them to the right driver (later with a bidding system for self identifying busses). This process allows GENERIC kernels and for hardware changes.

The two are tightly coupled, but happen at different times. Config happens once per build, autoconf happens once per boot (though latter day BSDs will run some subset of this for module loads and device hotplug).


> SBI was/is an attempt to define a common interface to different
> devices using RISC-V CPUs, but it's growing wildly and tending more
> towards UEFI+ACPI than something like OpenBoot, which was much
> simpler.
> In general, the idea of a BIOS isn't terrible: provide an interface
> that decouples the OS and hardware. But in practice, no one has come
> up with a particularly good set of interfaces yet. Ironically,
> BSD-style autoconfig might have been the best yet.

When it comes to abstracting devices, it would seem to me that virtio has gotten quite some traction in the last decade.

Looking at both the systems of 40 years ago and the Risc-V SoC’s of last year, I could imagine something like:

- A simple SBI, like the Berkeley Boot Loader (BBL) without the proxy kernel & host interface
- Devices presented to the OS as virtio devices
- MMU abstraction somewhat similar in idea to that in SYSV/68 [1]

Together this might be a usable Unix BIOS that could have worked in the early 80’s. One could also think of it as a simple hypervisor for only one client. The remaining BBL functionality is not all that different from the content in mch.s on 16-bit Unix (e.g. floating point emulation for CPU’s that don’t have it in hardware). A virtio device is not all that different from the interface presented by e.g. PDP-11 ethernet devices (e.g. DELUA), the MMU abstraction was contemporary.

High end systems could have had device hardware that implemented the virtio interface directly, low end systems could use simpler hardware and use the BIOS to present this interface via software.

[1] From mmu.h in the SYSV/68 source tree:

        @(#)mmu.h       2.26
        This is the header file for the UNIX V/68 generic
        MMU interface. This provides the information that
        is used by the various routines that call:

        mmufork ()
        mmuexec ()
        mmuexit ()
        mmuread ()
        mmuwrite ()
        mmuattach ()
        mmudetach ()
        mmuregs ()
        mmualloc ()
        mmuinit ()
        mmuint ()

        The above routines and secondary routines called
        by them are contained in io/mmu1.c and io/mmu2.c.