Add support for:
GENERIC RB_ASKNAME RB_MINIROOT Also revved up the required version of the booter because we need the booter fixes to get this functionality.
This commit is contained in:
parent
594ee04ec1
commit
d9b318b2be
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: autoconf.c,v 1.18 1995/04/20 15:31:23 briggs Exp $ */
|
||||
/* $NetBSD: autoconf.c,v 1.19 1995/07/18 04:10:13 briggs Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
@ -140,94 +140,24 @@ configure()
|
||||
|
||||
if (config_rootfound("mainbus", "mainbus") == 0)
|
||||
panic("No main device!");
|
||||
setroot(); /* Make root dev <== load dev */
|
||||
|
||||
#if GENERIC
|
||||
if ((boothowto & RB_ASKNAME) == 0)
|
||||
setroot();
|
||||
setconf();
|
||||
#else
|
||||
setroot();
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Configure swap area and related system
|
||||
* parameter based on device(s) used.
|
||||
*/
|
||||
swapconf();
|
||||
dumpconf();
|
||||
cold = 0;
|
||||
}
|
||||
|
||||
struct newconf_S {
|
||||
char *name;
|
||||
int req;
|
||||
};
|
||||
|
||||
static int
|
||||
mbprint(aux, name)
|
||||
void *aux;
|
||||
char *name;
|
||||
{
|
||||
struct newconf_S *c = (struct newconf_S *) aux;
|
||||
|
||||
if (name)
|
||||
printf("%s at %s", c->name, name);
|
||||
return(UNCONF);
|
||||
}
|
||||
|
||||
static int
|
||||
root_matchbyname(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
{
|
||||
return (strcmp(cf->cf_driver->cd_name, (char *)aux) == 0);
|
||||
}
|
||||
|
||||
extern int
|
||||
matchbyname(parent, match, aux)
|
||||
struct device *parent;
|
||||
void *match;
|
||||
void *aux;
|
||||
{
|
||||
struct newconf_S *c = (struct newconf_S *) aux;
|
||||
struct device *dv = (struct device *) match;
|
||||
|
||||
/* printf("matchbyname: (%s) and (%s).\n", dv->dv_xname, c->name);
|
||||
*/
|
||||
|
||||
return (strcmp(dv->dv_xname, c->name) == 0);
|
||||
}
|
||||
|
||||
static void
|
||||
mainbus_attach(parent, self, aux)
|
||||
struct device *parent, *self;
|
||||
void *aux;
|
||||
{
|
||||
struct newconf_S conf_data[] = {
|
||||
{"ite0", 1},
|
||||
{"adb0", 1},
|
||||
{"ser0", 0},
|
||||
{"ser1", 0},
|
||||
{"nubus0", 1},
|
||||
{"ncrscsi0", 0},
|
||||
{"ncr96scsi0", 0},
|
||||
{"asc0", 0},
|
||||
{"fpu0", 0},
|
||||
{"floppy0", 0},
|
||||
{NULL, 0}
|
||||
};
|
||||
struct newconf_S *c;
|
||||
int fail=0, warn=0;
|
||||
|
||||
printf("\n");
|
||||
for (c=conf_data ; c->name ; c++) {
|
||||
if (config_found(self, c, mbprint)) {
|
||||
} else {
|
||||
if (c->req) {
|
||||
fail++;
|
||||
}
|
||||
warn++;
|
||||
}
|
||||
}
|
||||
|
||||
if (fail) {
|
||||
printf("Failed to find %d required devices.\n", fail);
|
||||
panic("Can't continue.");
|
||||
}
|
||||
}
|
||||
|
||||
struct cfdriver mainbuscd =
|
||||
{ NULL, "mainbus", root_matchbyname, mainbus_attach,
|
||||
DV_DULL, sizeof(struct device), 1, 0 };
|
||||
|
||||
/*
|
||||
* Configure swap space and related parameters.
|
||||
*/
|
||||
@ -236,21 +166,21 @@ swapconf()
|
||||
register struct swdevt *swp;
|
||||
register int nblks, tblks;
|
||||
|
||||
for (swp = swdevt; swp->sw_dev != NODEV ; swp++)
|
||||
if (bdevsw[major(swp->sw_dev)].d_psize) {
|
||||
tblks += nblks =
|
||||
(*bdevsw[major(swp->sw_dev)].d_psize)(swp->sw_dev);
|
||||
for (swp = swdevt; swp->sw_dev != NODEV ; swp++) {
|
||||
int maj = major(swp->sw_dev);
|
||||
|
||||
if (maj > nblkdev)
|
||||
break;
|
||||
if (bdevsw[maj].d_psize) {
|
||||
nblks = (*bdevsw[maj].d_psize)(swp->sw_dev);
|
||||
if (nblks != -1 &&
|
||||
(swp->sw_nblks == 0 || swp->sw_nblks > nblks))
|
||||
swp->sw_nblks = nblks;
|
||||
swp->sw_nblks = ctod(dtoc(swp->sw_nblks));
|
||||
}
|
||||
if (tblks == 0) {
|
||||
printf("No swap partitions configured?\n");
|
||||
}
|
||||
dumpconf();
|
||||
}
|
||||
|
||||
#define DOSWAP /* change swdevt and dumpdev */
|
||||
u_long bootdev; /* should be dev_t, but not until 32 bits */
|
||||
struct device *bootdv = NULL;
|
||||
|
||||
@ -360,14 +290,15 @@ setroot()
|
||||
{
|
||||
register struct swdevt *swp;
|
||||
register int majdev, mindev, part;
|
||||
dev_t nrootdev, nswapdev;
|
||||
#ifdef DOSWAP
|
||||
dev_t temp;
|
||||
#endif
|
||||
dev_t nrootdev, nswapdev, temp;
|
||||
|
||||
if (boothowto & RB_DFLTROOT)
|
||||
return;
|
||||
findbootdev();
|
||||
if (bootdv == NULL) {
|
||||
panic("ARGH!! No boot device????");
|
||||
printf("ARGH!! No boot device????");
|
||||
delay(10000000);
|
||||
/* panic("ARGH!! No boot device????"); */
|
||||
}
|
||||
switch (bootdv->dv_class) {
|
||||
case DV_DISK:
|
||||
@ -389,19 +320,13 @@ setroot()
|
||||
mindev -= part;
|
||||
|
||||
rootdev = nrootdev;
|
||||
printf("Changing root device to %s%c.\n", bootdv->dv_xname, part + 'a');
|
||||
printf("Changing root device to %s%c.\n", bootdv->dv_xname, part+'a');
|
||||
|
||||
#ifndef DOSWAP
|
||||
swapdev = makedev(majdev, mindev | 1);
|
||||
dumpdev = swapdev;
|
||||
|
||||
#else
|
||||
temp = NODEV;
|
||||
for (swp = swdevt ; swp->sw_dev != NODEV ; swp++) {
|
||||
if (majdev == major(swp->sw_dev) &&
|
||||
mindev == (minor(swp->sw_dev) & ~PARTITIONMASK)) {
|
||||
temp = swdevt[0].sw_dev;
|
||||
printf("swapping %x and %x.\n", swp->sw_dev, temp);
|
||||
swdevt[0].sw_dev = swp->sw_dev;
|
||||
swp->sw_dev = temp;
|
||||
break;
|
||||
@ -412,40 +337,87 @@ setroot()
|
||||
|
||||
if (temp == dumpdev)
|
||||
dumpdev = swdevt[0].sw_dev;
|
||||
|
||||
printf("swapdev = %x, dumpdev = %x.\n", swdevt[0].sw_dev, dumpdev);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
The following four functions should be filled in to work...
|
||||
struct newconf_S {
|
||||
char *name;
|
||||
int req;
|
||||
};
|
||||
|
||||
static int
|
||||
mbprint(aux, name)
|
||||
void *aux;
|
||||
char *name;
|
||||
{
|
||||
struct newconf_S *c = (struct newconf_S *) aux;
|
||||
|
||||
if (name)
|
||||
printf("%s at %s", c->name, name);
|
||||
return(UNCONF);
|
||||
}
|
||||
|
||||
static int
|
||||
root_matchbyname(parent, cf, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *cf;
|
||||
void *aux;
|
||||
{
|
||||
return (strcmp(cf->cf_driver->cd_name, (char *)aux) == 0);
|
||||
}
|
||||
|
||||
extern int
|
||||
matchbyname(parent, match, aux)
|
||||
struct device *parent;
|
||||
void *match;
|
||||
void *aux;
|
||||
{
|
||||
struct newconf_S *c = (struct newconf_S *) aux;
|
||||
struct device *dv = (struct device *) match;
|
||||
|
||||
/* printf("matchbyname: (%s) and (%s).\n", dv->dv_xname, c->name);
|
||||
*/
|
||||
|
||||
caddr_t
|
||||
sctova(sc)
|
||||
register int sc;
|
||||
{
|
||||
return (strcmp(dv->dv_xname, c->name) == 0);
|
||||
}
|
||||
|
||||
caddr_t
|
||||
iomap(pa, size)
|
||||
caddr_t pa;
|
||||
int size;
|
||||
static void
|
||||
mainbus_attach(parent, self, aux)
|
||||
struct device *parent, *self;
|
||||
void *aux;
|
||||
{
|
||||
struct newconf_S conf_data[] = {
|
||||
{"ite0", 1},
|
||||
{"adb0", 1},
|
||||
{"ser0", 0},
|
||||
{"ser1", 0},
|
||||
{"nubus0", 1},
|
||||
{"ncrscsi0", 0},
|
||||
{"ncr96scsi0", 0},
|
||||
{"asc0", 0},
|
||||
{"fpu0", 0},
|
||||
{"floppy0", 0},
|
||||
{NULL, 0}
|
||||
};
|
||||
struct newconf_S *c;
|
||||
int fail=0, warn=0;
|
||||
|
||||
printf("\n");
|
||||
for (c=conf_data ; c->name ; c++) {
|
||||
if (config_found(self, c, mbprint)) {
|
||||
} else {
|
||||
if (c->req) {
|
||||
fail++;
|
||||
}
|
||||
warn++;
|
||||
}
|
||||
}
|
||||
|
||||
if (fail) {
|
||||
printf("Failed to find %d required devices.\n", fail);
|
||||
panic("Can't continue.");
|
||||
}
|
||||
}
|
||||
|
||||
patosc(addr)
|
||||
register caddr_t addr;
|
||||
{
|
||||
}
|
||||
|
||||
vatosc(addr)
|
||||
register caddr_t addr;
|
||||
{
|
||||
}
|
||||
|
||||
caddr_t
|
||||
sctopa(sc)
|
||||
register int sc;
|
||||
{
|
||||
}
|
||||
struct cfdriver mainbuscd =
|
||||
{ NULL, "mainbus", root_matchbyname, mainbus_attach,
|
||||
DV_DULL, sizeof(struct device), 1, 0 };
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: machdep.c,v 1.55 1995/07/08 04:25:13 briggs Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.56 1995/07/18 04:10:27 briggs Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
@ -225,7 +225,7 @@ consinit(void)
|
||||
}
|
||||
}
|
||||
|
||||
#define CURRENTBOOTERVER 106
|
||||
#define CURRENTBOOTERVER 108
|
||||
|
||||
/*
|
||||
* cpu_startup: allocate memory for variable-sized tables,
|
||||
@ -1801,9 +1801,13 @@ getenvvars()
|
||||
/*
|
||||
* For now, we assume that the boot device is off the first controller.
|
||||
*/
|
||||
bootdev = (root_scsi_id << 16) | 4;
|
||||
if (bootdev == 0) {
|
||||
bootdev = (root_scsi_id << 16) | 4;
|
||||
}
|
||||
|
||||
boothowto = getenv("SINGLE_USER");
|
||||
if (boothowto == 0) {
|
||||
boothowto = getenv("SINGLE_USER");
|
||||
}
|
||||
|
||||
/* These next two should give us mapped video & serial */
|
||||
/* We need these for pre-mapping graybars & echo, but probably */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pmap_bootstrap.c,v 1.9 1995/07/08 12:39:12 briggs Exp $ */
|
||||
/* $NetBSD: pmap_bootstrap.c,v 1.10 1995/07/18 04:10:51 briggs Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1991, 1993
|
||||
@ -41,6 +41,7 @@
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/msgbuf.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <machine/pte.h>
|
||||
#include <mac68k/mac68k/clockreg.h>
|
||||
#include <machine/vmparam.h>
|
||||
@ -578,7 +579,7 @@ bootstrap_mac68k(tc)
|
||||
int tc;
|
||||
{
|
||||
extern caddr_t esym;
|
||||
extern u_long videoaddr;
|
||||
extern u_long videoaddr, boothowto;
|
||||
vm_offset_t nextpa;
|
||||
|
||||
if (tc & 0x80000000) {
|
||||
@ -597,6 +598,18 @@ bootstrap_mac68k(tc)
|
||||
}
|
||||
nextpa = load_addr + ((int)esym + NBPG - 1) & PG_FRAME;
|
||||
|
||||
#if MFS
|
||||
if (boothowto & RB_MINIROOT) {
|
||||
int v;
|
||||
boothowto |= RB_DFLTROOT;
|
||||
nextpa = mac68k_round_page(nextpa);
|
||||
if ((v = mfs_initminiroot(nextpa-load_addr)) == 0) {
|
||||
printf("Error loading miniroot.\n");
|
||||
}
|
||||
nextpa += v;
|
||||
}
|
||||
#endif
|
||||
|
||||
pmap_bootstrap(nextpa, load_addr);
|
||||
|
||||
if (mac68k_vidlog)
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: swapgeneric.c,v 1.5 1994/10/26 08:47:15 cgd Exp $ */
|
||||
/* $NetBSD: swapgeneric.c,v 1.6 1995/07/18 04:10:56 briggs Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986 Regents of the University of California.
|
||||
@ -40,22 +40,155 @@
|
||||
#include <sys/buf.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/reboot.h>
|
||||
|
||||
#include <sys/device.h>
|
||||
#include <sys/disklabel.h>
|
||||
|
||||
extern int ffs_mountroot();
|
||||
int (*mountroot)() = ffs_mountroot;
|
||||
#include <machine/pte.h>
|
||||
|
||||
#include "sd.h"
|
||||
#include "cd.h"
|
||||
|
||||
dev_t rootdev = NODEV;
|
||||
dev_t dumpdev = NODEV;
|
||||
|
||||
struct swdevt swdevt[] = {
|
||||
{ makedev(4, 1), 0, 0 }, /* sd0b */
|
||||
{ makedev(4, 9), 0, 0 }, /* sd1b */
|
||||
{ makedev(4, 17), 0, 0 }, /* sd2b */
|
||||
{ makedev(4, 25), 0, 0 }, /* sd3b */
|
||||
{ makedev(4, 33), 0, 0 }, /* sd4b */
|
||||
{ makedev(4, 41), 0, 0 }, /* sd5b */
|
||||
{ makedev(4, 49), 0, 0 }, /* sd6b */
|
||||
{ NODEV, 0, 0 }
|
||||
{ NODEV, 1, 0 },
|
||||
{ NODEV, 0, 0 },
|
||||
};
|
||||
|
||||
#if NSD > 0
|
||||
extern struct cfdriver sdcd;
|
||||
#endif
|
||||
#if NCD > 0
|
||||
extern struct cfdriver cdcd;
|
||||
#endif
|
||||
|
||||
struct genericconf {
|
||||
struct cfdriver *gc_driver;
|
||||
char *gc_name;
|
||||
dev_t gc_root;
|
||||
} genericconf[] = {
|
||||
#if NSD > 0
|
||||
{ &sdcd, "sd", makedev(4,0) },
|
||||
#endif
|
||||
#if NCD > 0
|
||||
{ &cdcd, "cd", makedev(6,0) },
|
||||
#endif
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
extern int ffs_mountroot();
|
||||
int (*mountroot)() = ffs_mountroot;
|
||||
|
||||
setconf()
|
||||
{
|
||||
register struct genericconf *gc = NULL;
|
||||
int unit, swaponroot = 0;
|
||||
char *root_swap;
|
||||
|
||||
if (genericconf[0].gc_driver == 0)
|
||||
goto verybad;
|
||||
|
||||
if (boothowto & RB_MINIROOT)
|
||||
root_swap = "swap";
|
||||
else {
|
||||
if (rootdev != NODEV)
|
||||
goto doswap;
|
||||
root_swap = "root";
|
||||
}
|
||||
|
||||
if (boothowto & RB_ASKNAME) {
|
||||
char name[128];
|
||||
retry:
|
||||
printf("%s device? ", root_swap);
|
||||
gets(name);
|
||||
for (gc = genericconf; gc->gc_driver; gc++)
|
||||
if (gc->gc_name[0] == name[0] &&
|
||||
gc->gc_name[1] == name[1])
|
||||
goto gotit;
|
||||
printf("use one of:");
|
||||
for (gc = genericconf; gc->gc_driver; gc++)
|
||||
printf(" %s%%d", gc->gc_name);
|
||||
printf("\n");
|
||||
goto retry;
|
||||
gotit:
|
||||
if (name[3] == '*') {
|
||||
name[3] = name[4];
|
||||
swaponroot++;
|
||||
}
|
||||
if (name[2] >= '0' && name[2] <= '7' && name[3] == 0) {
|
||||
unit = name[2] - '0';
|
||||
goto found;
|
||||
}
|
||||
printf("bad/missing unit number\n");
|
||||
}
|
||||
unit = 0;
|
||||
for (gc = genericconf; gc->gc_driver; gc++) {
|
||||
if (gc->gc_driver->cd_ndevs > unit &&
|
||||
gc->gc_driver->cd_devs[unit]) {
|
||||
printf("Trying %s on %s0\n", root_swap, gc->gc_name);
|
||||
goto found;
|
||||
}
|
||||
}
|
||||
verybad:
|
||||
printf("no suitable %s -- hit any key to reboot\n", root_swap);
|
||||
cngetc();
|
||||
doboot();
|
||||
printf(" Automatic reboot failed.\n");
|
||||
printf("You may reboot or turn the machine off, now.\n");
|
||||
for(;;);
|
||||
|
||||
found:
|
||||
gc->gc_root = makedev(major(gc->gc_root), unit * MAXPARTITIONS);
|
||||
if ((boothowto & RB_MINIROOT) == 0) {
|
||||
rootdev = gc->gc_root;
|
||||
}
|
||||
doswap:
|
||||
if (gc)
|
||||
swdevt[0].sw_dev = dumpdev =
|
||||
makedev(major(gc->gc_root), minor(gc->gc_root) + 1);
|
||||
else
|
||||
swdevt[0].sw_dev = dumpdev =
|
||||
makedev(major(rootdev), minor(rootdev) + 1);
|
||||
/* swap size and dumplo set during autoconfigure */
|
||||
if (swaponroot)
|
||||
rootdev = dumpdev;
|
||||
}
|
||||
|
||||
gets(cp)
|
||||
char *cp;
|
||||
{
|
||||
register char *lp;
|
||||
register int c;
|
||||
|
||||
lp = cp;
|
||||
for (;;) {
|
||||
cnputc(c=cngetc());
|
||||
switch (c) {
|
||||
case '\n':
|
||||
case '\r':
|
||||
*lp++ = '\0';
|
||||
return;
|
||||
case '\b':
|
||||
case '\177':
|
||||
if (lp > cp) {
|
||||
lp--;
|
||||
cnputc(' ');
|
||||
cnputc('\b');
|
||||
}
|
||||
continue;
|
||||
case '#':
|
||||
lp--;
|
||||
if (lp < cp)
|
||||
lp = cp;
|
||||
continue;
|
||||
case '@':
|
||||
case 'u'&037:
|
||||
lp = cp;
|
||||
cnputc('\n');
|
||||
continue;
|
||||
default:
|
||||
*lp++ = c;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user