From: miod Date: Tue, 26 Aug 2008 18:36:21 +0000 (+0000) Subject: When using the not-documented-but-ought-to 'boot sd(...)file' syntax (e.g. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=f7979b39868f118e79e046da9e3e6faf2bc109fb;p=openbsd When using the not-documented-but-ought-to 'boot sd(...)file' syntax (e.g. when mopbooting the bootblocks because one trashed the ones on disk by accident), be sure to use the proper BDEV_SDx rpb device type value, depending on the type of onboard controller. Crank version. --- diff --git a/sys/arch/vax/boot/boot/boot.c b/sys/arch/vax/boot/boot/boot.c index 160254d2868..62c5ad59e16 100644 --- a/sys/arch/vax/boot/boot/boot.c +++ b/sys/arch/vax/boot/boot/boot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: boot.c,v 1.18 2008/08/10 18:20:07 miod Exp $ */ +/* $OpenBSD: boot.c,v 1.19 2008/08/26 18:36:21 miod Exp $ */ /* $NetBSD: boot.c,v 1.18 2002/05/31 15:58:26 ragge Exp $ */ /*- * Copyright (c) 1982, 1986 The Regents of the University of California. @@ -109,7 +109,7 @@ Xmain(void) transition = ' '; askname = bootrpb.rpb_bootr5 & RB_ASKNAME; - printf("\n\r>> OpenBSD/vax boot [%s] <<\n", "1.14"); + printf("\n\r>> OpenBSD/vax boot [%s] <<\n", "1.15"); printf(">> Press enter to autoboot now, or any other key to abort: "); sluttid = getsecs() + 5; senast = 0; diff --git a/sys/arch/vax/boot/boot/devopen.c b/sys/arch/vax/boot/boot/devopen.c index 5cb9ade2994..879aec9465e 100644 --- a/sys/arch/vax/boot/boot/devopen.c +++ b/sys/arch/vax/boot/boot/devopen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: devopen.c,v 1.3 2002/06/11 09:36:23 hugh Exp $ */ +/* $OpenBSD: devopen.c,v 1.4 2008/08/26 18:36:21 miod Exp $ */ /* $NetBSD: devopen.c,v 1.10 2002/05/24 21:40:59 ragge Exp $ */ /* * Copyright (c) 1997 Ludd, University of Lule}, Sweden. @@ -31,7 +31,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "lib/libsa/stand.h" +#include #include "machine/rpb.h" #include "machine/sid.h" @@ -39,7 +39,7 @@ #define VAX780 1 #include "machine/ka750.h" -#include "arch/vax/bi/bireg.h" +#include #include "vaxstand.h" @@ -77,7 +77,6 @@ devopen(f, fname, file) if (cnvtab[i] == dev) dp = devsw + i; - x = 0; if ((s = index((char *)fname, '('))) { *s++ = 0; @@ -88,17 +87,37 @@ devopen(f, fname, file) if (i == ndevs) { printf("No such device - Configured devices are:\n"); for (dp = devsw, i = 0; i < ndevs; i++, dp++) - if (dp->dv_name) + if (dp->dv_name && (i == 0 || + strcmp(dp->dv_name, (dp[-1]).dv_name) != 0)) printf(" %s", dp->dv_name); printf("\n"); - return -1; + return EINVAL; } + dev = cnvtab[i]; if ((c = index(s, ')')) == 0) goto usage; - *c++ = 0; + /* + * If the user has specified sd(), we need to pick the + * correct BDEV_SDx value, depending on the machine type. + */ + if (dev == BDEV_SD) { + switch (vax_boardtype) { + case VAX_BTYP_46: + case VAX_BTYP_48: + case VAX_BTYP_49: + case VAX_BTYP_1303: + dev = BDEV_SDN; /* asc(4) */ + break; + case VAX_BTYP_60: + dev = BDEV_SDS; /* sii(4) */ + break; + } + } + + x = 0; if (*s) do { a[x++] = atoi(s); while (*s >= '0' && *s <= '9') @@ -124,7 +143,7 @@ devopen(f, fname, file) if (!dp->dv_open) { printf("Can't open device type %d\n", dev); - return(ENODEV); + return ENXIO; } f->f_dev = dp; bootrpb.unit = unit; @@ -201,5 +220,5 @@ devopen(f, fname, file) usage: printf("usage: dev(adapter,controller,unit,partition)file -asd\n"); - return -1; + return EINVAL; } diff --git a/sys/arch/vax/boot/boot/version b/sys/arch/vax/boot/boot/version index b2faa981be9..8bc0f4ed6b7 100644 --- a/sys/arch/vax/boot/boot/version +++ b/sys/arch/vax/boot/boot/version @@ -1,4 +1,4 @@ -$OpenBSD: version,v 1.7 2008/08/12 17:23:21 miod Exp $ +$OpenBSD: version,v 1.8 2008/08/26 18:36:21 miod Exp $ $NetBSD: version,v 1.4 2001/11/09 19:53:15 scw Exp $ NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE. The format of this @@ -14,7 +14,7 @@ is taken as the current. Standalone driver for the Digital Equipment Unibus Network Adapter (DEUNA). This allows 11/750 owners to install from a single TU58 cassette. - Adopt to the RPB changes. Complete change of how network devices are + Adapt to the RPB changes. Complete change of how network devices are handled. No more hacks to find bus addresses. 1.5: Standalone device driver for DEBNx (ni) ethernet controllers. 1.6: Add support for VAX 6000 + VAX 8000. Tweak console routines. @@ -35,3 +35,5 @@ is taken as the current. 1.12: Glass console support on VXT2000{,+}. 1.13: Enable the loadfile code added in revision 1.8. 1.14: Support for VaxStation 3[58][24]0. +1.15: Restore boot sd()... functionality on machines with asc(4) or sii(4) + controllers. diff --git a/sys/arch/vax/stand/boot/boot.c b/sys/arch/vax/stand/boot/boot.c index 160254d2868..62c5ad59e16 100644 --- a/sys/arch/vax/stand/boot/boot.c +++ b/sys/arch/vax/stand/boot/boot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: boot.c,v 1.18 2008/08/10 18:20:07 miod Exp $ */ +/* $OpenBSD: boot.c,v 1.19 2008/08/26 18:36:21 miod Exp $ */ /* $NetBSD: boot.c,v 1.18 2002/05/31 15:58:26 ragge Exp $ */ /*- * Copyright (c) 1982, 1986 The Regents of the University of California. @@ -109,7 +109,7 @@ Xmain(void) transition = ' '; askname = bootrpb.rpb_bootr5 & RB_ASKNAME; - printf("\n\r>> OpenBSD/vax boot [%s] <<\n", "1.14"); + printf("\n\r>> OpenBSD/vax boot [%s] <<\n", "1.15"); printf(">> Press enter to autoboot now, or any other key to abort: "); sluttid = getsecs() + 5; senast = 0; diff --git a/sys/arch/vax/stand/boot/devopen.c b/sys/arch/vax/stand/boot/devopen.c index 5cb9ade2994..879aec9465e 100644 --- a/sys/arch/vax/stand/boot/devopen.c +++ b/sys/arch/vax/stand/boot/devopen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: devopen.c,v 1.3 2002/06/11 09:36:23 hugh Exp $ */ +/* $OpenBSD: devopen.c,v 1.4 2008/08/26 18:36:21 miod Exp $ */ /* $NetBSD: devopen.c,v 1.10 2002/05/24 21:40:59 ragge Exp $ */ /* * Copyright (c) 1997 Ludd, University of Lule}, Sweden. @@ -31,7 +31,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "lib/libsa/stand.h" +#include #include "machine/rpb.h" #include "machine/sid.h" @@ -39,7 +39,7 @@ #define VAX780 1 #include "machine/ka750.h" -#include "arch/vax/bi/bireg.h" +#include #include "vaxstand.h" @@ -77,7 +77,6 @@ devopen(f, fname, file) if (cnvtab[i] == dev) dp = devsw + i; - x = 0; if ((s = index((char *)fname, '('))) { *s++ = 0; @@ -88,17 +87,37 @@ devopen(f, fname, file) if (i == ndevs) { printf("No such device - Configured devices are:\n"); for (dp = devsw, i = 0; i < ndevs; i++, dp++) - if (dp->dv_name) + if (dp->dv_name && (i == 0 || + strcmp(dp->dv_name, (dp[-1]).dv_name) != 0)) printf(" %s", dp->dv_name); printf("\n"); - return -1; + return EINVAL; } + dev = cnvtab[i]; if ((c = index(s, ')')) == 0) goto usage; - *c++ = 0; + /* + * If the user has specified sd(), we need to pick the + * correct BDEV_SDx value, depending on the machine type. + */ + if (dev == BDEV_SD) { + switch (vax_boardtype) { + case VAX_BTYP_46: + case VAX_BTYP_48: + case VAX_BTYP_49: + case VAX_BTYP_1303: + dev = BDEV_SDN; /* asc(4) */ + break; + case VAX_BTYP_60: + dev = BDEV_SDS; /* sii(4) */ + break; + } + } + + x = 0; if (*s) do { a[x++] = atoi(s); while (*s >= '0' && *s <= '9') @@ -124,7 +143,7 @@ devopen(f, fname, file) if (!dp->dv_open) { printf("Can't open device type %d\n", dev); - return(ENODEV); + return ENXIO; } f->f_dev = dp; bootrpb.unit = unit; @@ -201,5 +220,5 @@ devopen(f, fname, file) usage: printf("usage: dev(adapter,controller,unit,partition)file -asd\n"); - return -1; + return EINVAL; } diff --git a/sys/arch/vax/stand/boot/version b/sys/arch/vax/stand/boot/version index b2faa981be9..8bc0f4ed6b7 100644 --- a/sys/arch/vax/stand/boot/version +++ b/sys/arch/vax/stand/boot/version @@ -1,4 +1,4 @@ -$OpenBSD: version,v 1.7 2008/08/12 17:23:21 miod Exp $ +$OpenBSD: version,v 1.8 2008/08/26 18:36:21 miod Exp $ $NetBSD: version,v 1.4 2001/11/09 19:53:15 scw Exp $ NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE. The format of this @@ -14,7 +14,7 @@ is taken as the current. Standalone driver for the Digital Equipment Unibus Network Adapter (DEUNA). This allows 11/750 owners to install from a single TU58 cassette. - Adopt to the RPB changes. Complete change of how network devices are + Adapt to the RPB changes. Complete change of how network devices are handled. No more hacks to find bus addresses. 1.5: Standalone device driver for DEBNx (ni) ethernet controllers. 1.6: Add support for VAX 6000 + VAX 8000. Tweak console routines. @@ -35,3 +35,5 @@ is taken as the current. 1.12: Glass console support on VXT2000{,+}. 1.13: Enable the loadfile code added in revision 1.8. 1.14: Support for VaxStation 3[58][24]0. +1.15: Restore boot sd()... functionality on machines with asc(4) or sii(4) + controllers.