-/* $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.
* @(#)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"
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;
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), },
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");
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)
/* swap size and dumplo set during autoconfigure */
if (swaponroot)
rootdev = dumpdev;
-
}
gets(cp)