From: deraadt Date: Wed, 31 Jan 1996 05:26:46 +0000 (+0000) Subject: from ragge; X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=0b6e5105a07e46adda7c32d95ef8630c6577ddf6;p=openbsd from ragge; Make use of the new disk struct when attaching disks. Don't rely on UBA's; we do not always want them. --- diff --git a/sys/arch/vax/vax/rootfil.c b/sys/arch/vax/vax/rootfil.c index 38ab448b58f..5f2d3e6e11f 100644 --- a/sys/arch/vax/vax/rootfil.c +++ b/sys/arch/vax/vax/rootfil.c @@ -1,4 +1,4 @@ -/* $NetBSD: rootfil.c,v 1.6 1995/04/12 15:35:04 ragge Exp $ */ +/* $NetBSD: rootfil.c,v 1.7 1996/01/28 12:09:34 ragge Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -50,7 +50,6 @@ #include "mbuf.h" #include "vax/include/pte.h" #include "uda.h" -#include "uba.h" #include "reboot.h" #include "conf.h" #include "vax/include/macros.h" @@ -150,7 +149,6 @@ setroot() #else return; #endif -#if NUBA > 0 } else { register struct uba_device *ubap; @@ -167,7 +165,6 @@ setroot() return; mindev = ubap->ui_unit; printf("mindev %x, majdev %x\n",mindev,majdev); -#endif } mindev = (mindev << PARTITIONSHIFT) + part; orootdev = rootdev; diff --git a/sys/arch/vax/vax/swapgeneric.c b/sys/arch/vax/vax/swapgeneric.c index 00b5c1f1633..613fb771a21 100644 --- a/sys/arch/vax/vax/swapgeneric.c +++ b/sys/arch/vax/vax/swapgeneric.c @@ -1,4 +1,4 @@ -/* $NetBSD: swapgeneric.c,v 1.5 1995/03/30 21:25:41 ragge Exp $ */ +/* $NetBSD: swapgeneric.c,v 1.6 1996/01/28 12:09:37 ragge Exp $ */ /*- * Copyright (c) 1982, 1986 The Regents of the University of California. @@ -35,22 +35,19 @@ * @(#)swapgeneric.c 7.11 (Berkeley) 5/9/91 */ -#include "mba.h" #include "uda.h" - +#include "hp.h" #include "sys/param.h" #include "sys/conf.h" #include "sys/buf.h" #include "sys/systm.h" #include "sys/reboot.h" +#include "sys/device.h" #include "machine/pte.h" #include "machine/mtpr.h" -#if NMBA > 0 -#include "../mba/mbareg.h" -#include "../mba/mbavar.h" -#endif + #include "../uba/ubareg.h" #include "../uba/ubavar.h" @@ -73,7 +70,6 @@ int dmmin, dmmax, dmtext; extern int ffs_mountroot(); int (*mountroot)() = ffs_mountroot; -extern struct mba_driver hpdriver; extern struct uba_driver scdriver; extern struct uba_driver hkdriver; extern struct uba_driver idcdriver; @@ -81,12 +77,24 @@ extern struct uba_driver hldriver; extern struct uba_driver udadriver; extern struct uba_driver kdbdriver; +extern struct cfdriver hpcd; + +struct ngcconf { + struct cfdriver *ng_cf; + dev_t ng_root; +} ngcconf[] = { +#if NHP > 0 + { &hpcd, makedev(0, 0), }, +#endif + { 0 }, +}; + struct genericconf { caddr_t gc_driver; char *gc_name; dev_t gc_root; } genericconf[] = { -/* { (caddr_t)&hpdriver, "hp", makedev(0, 0), }, +/* { (caddr_t)&hpcd, "hp", makedev(0, 0), }, { (caddr_t)&scdriver, "up", makedev(2, 0), }, */ #if NUDA > 0 { (caddr_t)&udadriver, "ra", makedev(9, 0), }, @@ -101,31 +109,70 @@ struct genericconf { setconf() { -#if NMBA > 0 - register struct mba_device *mi; -#endif #if NUDA > 0 register struct uba_device *ui; #endif register struct genericconf *gc; + struct ngcconf *nc; register char *cp, *gp; - int unit, swaponroot = 0; + int unit, swaponroot = 0, i; + char name[128]; if (rootdev != NODEV) goto doswap; unit = 0; + /* + * First try new config devices. + */ + if (boothowto & RB_ASKNAME) { +nretry: + swaponroot = 0; + printf("root device? "); + gets(name); + if (name[strlen(name) - 1] == '*') + name[strlen(name) - 1] = swaponroot++; + for (nc = ngcconf; nc->ng_cf; nc++) + for (i = 0; i < nc->ng_cf->cd_ndevs; i++) + if (nc->ng_cf->cd_devs[i] && + strcmp(name, ((struct device *) + (nc->ng_cf->cd_devs[i]))->dv_xname) == 0) + goto ngotit; +#ifdef notyet + printf("Use one of "); + for (nc = ngcconf; nc->ng_cf; nc++) + printf("%s%%d ", nc->ng_cf->cd_name); + printf("\n"); +#endif + goto gc2; +ngotit: + rootdev = makedev(major(nc->ng_root), i * 8); + goto doswap; + + } else { + for (nc = ngcconf; nc->ng_cf; nc++) + for (i = 0; i < nc->ng_cf->cd_ndevs; i++) + if (nc->ng_cf->cd_devs[i]) { + printf("root on %s%d\n", + nc->ng_cf->cd_name, i); + rootdev = makedev(major(nc->ng_root), + i * 8); + goto doswap; + } + + } + if (boothowto & RB_ASKNAME) { - char name[128]; retry: printf("root device? "); gets(name); +gc2: for (gc = genericconf; gc->gc_driver; gc++) for (cp = name, gp = gc->gc_name; *cp == *gp; cp++) if (*++gp == 0) goto gotit; printf( "use hp%%d, up%%d, ra%%d, rb%%d, rl%%d, hk%%d or kra%%d\n"); - goto retry; + goto nretry; gotit: if (*++cp < '0' || *cp > '9') { printf("bad/missing unit number\n"); @@ -138,18 +185,6 @@ gotit: goto found; } for (gc = genericconf; gc->gc_driver; gc++) { -#if NMBA > 0 - for (mi = mbdinit; mi->mi_driver; mi++) { - if (mi->mi_alive == 0) - continue; - if (mi->mi_unit == unit && mi->mi_driver == - (struct mba_driver *)gc->gc_driver) { - printf("root on %s%d\n", - mi->mi_driver->md_dname, unit); - goto found; - } - } -#endif #if NUDA > 0 for (ui = ubdinit; ui->ui_driver; ui++) { if (ui->ui_alive == 0) @@ -176,7 +211,6 @@ doswap: /* swap size and dumplo set during autoconfigure */ if (swaponroot) rootdev = dumpdev; - } gets(cp)