OpenBSD 3.4 and SIMH
Obsolete…
I have a driver patch that appears to fix the problem with the root filesystem on an MSCP disk. I still feel that I’m missing something obvious, but for better or worse, here it is.
Here is the patch to /sys/arch/vax/mscp/mscp_disk.c:
--- mscp_disk.c.orig Mon Feb 24 15:02:13 2003
+++ mscp_disk.c Tue Feb 25 10:28:17 2003
@@ -609,8 +609,16 @@
/* Poll away */
i = bus_space_read_2(mi->mi_iot, mi->mi_iph, 0);
- if (tsleep(&rx->ra_dev.dv_unit, PRIBIO, "rxonline", 100*100))
- rx->ra_state = DK_CLOSED;
+ if (tsleep(&rx->ra_dev.dv_unit, PRIBIO, "rxonline", 100*100)) {
+ if (rx->ra_state != DK_OPEN)
+ rx->ra_state = DK_CLOSED;
+ }
+ if (rx->ra_state == DK_CLOSED) {
+ if (tsleep(&rx->ra_dev.dv_unit, PRIBIO, "rxonline", 100*100)) {
+ if (rx->ra_state != DK_OPEN)
+ rx->ra_state = DK_CLOSED;
+ }
+ }
if (rx->ra_state == DK_CLOSED)
return MSCP_FAILED;
@@ -870,7 +878,6 @@
struct rx_softc *rx = (struct rx_softc *)usc;
struct disklabel *dl;
- wakeup((caddr_t)&usc->dv_unit);
if ((mp->mscp_status & M_ST_MASK) != M_ST_SUCCESS) {
printf("%s: attempt to bring on line failed: ", usc->dv_xname);
mscp_printevent(mp);
@@ -891,6 +898,7 @@
dl->d_rpm = 300;
}
rrmakelabel(dl, rx->ra_mediaid);
+ wakeup((caddr_t)&usc->dv_unit);
return (MSCP_DONE);
}
A few words about this patch; no doubt something a lot more elegant is possible. The driver posts an ONLINE command, goes to sleep for ten seconds, and expects to be awoken by the interrupt handler inside of that time period. There are two race conditions that probably break SIMH. First, if the interrupt is delivered before the driver is waiting for it, bringing the disk online will fail. A possible remedy is to check the disk status flags that are set by the interrupt handler, however leads to the second race condition - the interrupt handler wakes up the driver before performing its bookkeeping.
The elapsed time between trying to bring the disk online and failing is far too short for the driver to time out, but the simple faces for the two potential race conditions doesn’t fix the problem either. However, rronline() is called twice from the interrupt handler and adding another tsleep/test block appears to make the driver work.
Clearly, this is not quite a proper fix, but it works for my purposes. Since I don’t have physical Vax hardware, I don’t know if this patch will break OpenBSD on a real Vax.
Here’s a recipe on getting OpenBSD up and running:
Configure SIMH to use the boot floppy floppy34.fs as DUA1
Start SIMH/vax, boot off dua1, and follow the normal installation procedure.
After the installation completes, boot off dua1 again, choose S(hell), and set up a chrooted environment:
# assumed disk partitioning: # ra0a: / # ra0b: (swap) # ra0d: /usr mount /dev/ra0a /mnt mount /dev/ra0d /mnt/usr cd /mnt ./usr/sbin/chroot /mnt # manually bring up the network ifconfig qe0 up 192.168.20.20 # ftp and unpack the kernel sources cd /usr/src ftp .... (get sys.tar.gz and mscp_disk.c.diff) tar xfz sys.tar.gz rm sys.tar.gz cd sys/arch/vax/mscp patch < /usr/src/mscp_disk.c.diff # rebuild and install the GENERIC kernel cd /sys/arch/vax/conf config GENERIC cd ../compile/GENERIC # the next step will probably take a few hours make depend && make cp /bsd /bsd.dist cp bsd /bsd
After this step, it should be possible to reboot DUA0 in the usual way.
