diff options
author | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1996-11-12 08:11:09 +0000 |
---|---|---|
committer | Niklas Hallqvist <niklas@cvs.openbsd.org> | 1996-11-12 08:11:09 +0000 |
commit | 0728f78af9be11c17ed1d2d58d69e334d75a9fe4 (patch) | |
tree | c90885c9e6deb785c1d142e193183d02b0cfb4dc /sys/arch/arc | |
parent | d6f715255ddf5d36c86e2c6ef379dd5d4418c27f (diff) |
Use table to map the BIOS bootdev to our name instead of picking out
certain characters out of the BIOS string
Diffstat (limited to 'sys/arch/arc')
-rw-r--r-- | sys/arch/arc/arc/autoconf.c | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/sys/arch/arc/arc/autoconf.c b/sys/arch/arc/arc/autoconf.c index 0c6594f9132..1071f289e98 100644 --- a/sys/arch/arc/arc/autoconf.c +++ b/sys/arch/arc/arc/autoconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.c,v 1.4 1996/11/06 01:38:35 deraadt Exp $ */ +/* $OpenBSD: autoconf.c,v 1.5 1996/11/12 08:11:08 niklas Exp $ */ /* * Copyright (c) 1996 Per Fogelstrom * Copyright (c) 1995 Theo de Raadt @@ -41,7 +41,7 @@ * from: Utah Hdr: autoconf.c 1.31 91/01/21 * * from: @(#)autoconf.c 8.1 (Berkeley) 6/10/93 - * $Id: autoconf.c,v 1.4 1996/11/06 01:38:35 deraadt Exp $ + * $Id: autoconf.c,v 1.5 1996/11/12 08:11:08 niklas Exp $ */ /* @@ -81,7 +81,7 @@ struct device *bootdv = NULL; */ configure() { - (void)splhigh(); /* To be really shure.. */ + (void)splhigh(); /* To be really sure.. */ if(config_rootfound("mainbus", "mainbus") == 0) panic("no mainbus found"); (void)spl0(); @@ -122,6 +122,7 @@ static struct nam2blk { int maj; } nam2blk[] = { { "sd", 0 }, /* 0 = sd */ + { "wd", 4 }, /* 4 = wd */ { "fd", 7 }, /* 7 = floppy (ick!)*/ }; @@ -420,6 +421,11 @@ getdevunit(name, unit) return dev; } +struct devmap { + char *attachment; + char *dev; +}; + /* * Look at the string 'cp' and decode the boot device. * Boot names look like: scsi()disk(n)rdisk()partition(1)\bsd @@ -430,15 +436,27 @@ makebootdev(cp) char *cp; { int unit, part, ctrl; - - bootdev[0] = *cp; + static struct devmap devmap[] = { + { "multi", "fd" }, + { "eisa", "wd" }, + { "scsi", "sd" }, + { NULL, NULL } + }; + struct devmap *dp = &devmap[0]; + + while (dp->attachment) { + if (strncmp (cp, dp->attachment, strlen(dp->attachment)) == 0) + break; + dp++; + } + if (!dp) + return; ctrl = getpno(&cp); - if(*cp++ == ')') { - bootdev[1] = *cp; + if(*cp++ == ')') unit = getpno(&cp); - } - sprintf(&bootdev[2], "%d", ctrl*16 + unit); + sprintf(bootdev, "%s%d", dp->dev, ctrl*16 + unit); } + getpno(cp) char **cp; { |