summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/alpha/alpha/autoconf.c35
-rw-r--r--sys/arch/i386/i386/autoconf.c78
-rw-r--r--sys/arch/i386/i386/conf.c42
-rw-r--r--sys/arch/macppc/macppc/autoconf.c42
-rw-r--r--sys/arch/macppc/macppc/conf.c39
-rw-r--r--sys/arch/mvmeppc/mvmeppc/autoconf.c44
-rw-r--r--sys/arch/mvmeppc/mvmeppc/conf.c39
-rw-r--r--sys/arch/sparc/sparc/autoconf.c44
-rw-r--r--sys/arch/sparc/sparc/conf.c15
-rw-r--r--sys/arch/sparc64/sparc64/autoconf.c44
-rw-r--r--sys/arch/sparc64/sparc64/conf.c5
11 files changed, 337 insertions, 90 deletions
diff --git a/sys/arch/alpha/alpha/autoconf.c b/sys/arch/alpha/alpha/autoconf.c
index b50cbc30ee1..abf0bc3096d 100644
--- a/sys/arch/alpha/alpha/autoconf.c
+++ b/sys/arch/alpha/alpha/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.14 2001/09/30 13:08:45 art Exp $ */
+/* $OpenBSD: autoconf.c,v 1.15 2001/12/05 23:58:41 tdeval Exp $ */
/* $NetBSD: autoconf.c,v 1.16 1996/11/13 21:13:04 cgd Exp $ */
/*
@@ -77,8 +77,8 @@ static struct device *parsedisk __P((char *str, int len, int defpart,
dev_t *devp));
static struct device *getdisk __P((char *str, int len, int defpart,
dev_t *devp));
-static int findblkmajor __P((struct device *dv));
-static char *findblkname __P((int));
+int findblkmajor __P((struct device *dv));
+char *findblkname __P((int));
static int getstr __P((char *cp, int size));
/*
@@ -145,6 +145,7 @@ struct nam2blk {
{ "rd", 6 },
{ "sd", 8 },
{ "wd", 0 },
+ { "raid", 16 },
#if 0
{ "fd", XXX },
#endif
@@ -154,25 +155,25 @@ struct nam2blk {
static struct device fakerdrootdev = { DV_DISK, {}, NULL, 0, "rd0", NULL };
#endif
-static int
+int
findblkmajor(dv)
struct device *dv;
{
char *name = dv->dv_xname;
- register int i;
+ int i;
for (i = 0; i < sizeof(nam2blk)/sizeof(nam2blk[0]); ++i)
- if (strncmp(name, nam2blk[i].name, strlen(nam2blk[0].name))
+ if (strncmp(name, nam2blk[i].name, strlen(nam2blk[i].name))
== 0)
return (nam2blk[i].maj);
return (-1);
}
-static char *
+char *
findblkname(maj)
int maj;
{
- register int i;
+ int i;
for (i = 0; i < sizeof(nam2blk)/sizeof(nam2blk[0]); ++i)
if (maj == nam2blk[i].maj)
@@ -276,7 +277,7 @@ setroot()
{
struct swdevt *swp;
struct device *dv;
- register int len;
+ int len;
dev_t nrootdev, nswapdev = NODEV;
char buf[128], *rootdevname;
dev_t temp;
@@ -295,6 +296,22 @@ setroot()
#endif
/*
+ * (raid) device auto-configuration could have returned
+ * the root device's id in rootdev. Check this case.
+ */
+ if (rootdev != NODEV) {
+ majdev = major(rootdev);
+ unit = DISKUNIT(rootdev);
+ part = DISKPART(rootdev);
+
+ len = sprintf(buf, "%s%d", findblkname(majdev), unit);
+ if (len >= sizeof(buf))
+ panic("setroot: device name too long");
+
+ bootdv = getdisk(buf, len, part, &rootdev);
+ }
+
+ /*
* If 'swap generic' and we couldn't determine root device,
* ask the user.
*/
diff --git a/sys/arch/i386/i386/autoconf.c b/sys/arch/i386/i386/autoconf.c
index 34726fb23d3..23790f336c8 100644
--- a/sys/arch/i386/i386/autoconf.c
+++ b/sys/arch/i386/i386/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.39 2001/12/04 00:00:36 niklas Exp $ */
+/* $OpenBSD: autoconf.c,v 1.40 2001/12/05 23:58:41 tdeval Exp $ */
/* $NetBSD: autoconf.c,v 1.20 1996/05/03 19:41:56 christos Exp $ */
/*-
@@ -63,6 +63,9 @@
#include <dev/cons.h>
+int findblkmajor __P((struct device *dv));
+char *findblkname __P((int));
+
void rootconf __P((void));
void swapconf __P((void));
void setroot __P((void));
@@ -151,30 +154,47 @@ swapconf()
#define DOSWAP /* change swdevt and dumpdev */
-static const char *devname[] = {
- "wd", /* 0 = wd */
- "sw", /* 1 = sw */
- "fd", /* 2 = fd */
- "wt", /* 3 = wt */
- "sd", /* 4 = sd */
- "", /* 5 */
- "", /* 6 */
- "mcd", /* 7 = mcd */
- "", /* 8 */
- "", /* 9 */
- "", /* 10 */
- "", /* 11 */
- "", /* 12 */
- "", /* 13 */
- "", /* 14 */
- "", /* 15 */
- "", /* 16 */
- "rd", /* 17 = rd */
- "", /* 18 */
- "", /* 19 */
- "" /* 20 */
+static struct {
+ char *name;
+ int maj;
+} nam2blk[] = {
+ { "wd", 0 },
+ { "sw", 1 },
+ { "fd", 2 },
+ { "wt", 3 },
+ { "sd", 4 },
+ { "cd", 6 },
+ { "mcd", 7 },
+ { "rd", 17 },
+ { "raid", 19 }
};
+int
+findblkmajor(dv)
+ struct device *dv;
+{
+ char *name = dv->dv_xname;
+ int i;
+
+ for (i = 0; i < sizeof(nam2blk)/sizeof(nam2blk[0]); ++i)
+ if (strncmp(name, nam2blk[i].name, strlen(nam2blk[i].name))
+ == 0)
+ return (nam2blk[i].maj);
+ return (-1);
+}
+
+char *
+findblkname(maj)
+ int maj;
+{
+ int i;
+
+ for (i = 0; i < sizeof(nam2blk)/sizeof(nam2blk[0]); ++i)
+ if (maj == nam2blk[i].maj)
+ return (nam2blk[i].name);
+ return (NULL);
+}
+
dev_t argdev = NODEV;
int nswap;
long dumplo;
@@ -199,8 +219,7 @@ setroot()
(bootdev & B_MAGICMASK) != (u_long)B_DEVMAGIC)
return;
majdev = B_TYPE(bootdev);
- if (majdev > sizeof(devname)/sizeof(devname[0]) ||
- *devname[majdev] == '\0')
+ if (findblkname(majdev) == NULL)
return;
adaptor = B_ADAPTOR(bootdev);
part = B_PARTITION(bootdev);
@@ -214,7 +233,7 @@ setroot()
*/
if (rootdev == orootdev)
return;
- printf("root on %s%d%c\n", devname[majdev], unit, part + 'a');
+ printf("root on %s%d%c\n", findblkname(majdev), unit, part + 'a');
#ifdef DOSWAP
for (swp = swdevt; swp->sw_dev != NODEV; swp++) {
@@ -262,6 +281,10 @@ extern struct cfdriver fd_cd;
#if NRD > 0
extern struct cfdriver rd_cd;
#endif
+#include "raid.h"
+#if NRAID > 0
+extern struct cfdriver raid_cd;
+#endif
struct genericconf {
struct cfdriver *gc_driver;
@@ -286,6 +309,9 @@ struct genericconf {
#if NRD > 0
{ &rd_cd, "rd", 17 },
#endif
+#if NRAID > 0
+ { &raid_cd, "raid", 19 },
+#endif
{ 0 }
};
diff --git a/sys/arch/i386/i386/conf.c b/sys/arch/i386/i386/conf.c
index f2169b81528..839b4593d7f 100644
--- a/sys/arch/i386/i386/conf.c
+++ b/sys/arch/i386/i386/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.82 2001/11/06 23:46:05 drahn Exp $ */
+/* $OpenBSD: conf.c,v 1.83 2001/12/05 23:58:41 tdeval Exp $ */
/* $NetBSD: conf.c,v 1.75 1996/05/03 19:40:20 christos Exp $ */
/*
@@ -446,6 +446,13 @@ static int chrtoblktbl[] = {
/* 45 */ NODEV,
/* 46 */ NODEV,
/* 47 */ 17,
+ /* 48 */ NODEV,
+ /* 49 */ NODEV,
+ /* 50 */ NODEV,
+ /* 51 */ NODEV,
+ /* 52 */ NODEV,
+ /* 53 */ NODEV,
+ /* 54 */ 19,
};
/*
@@ -492,33 +499,26 @@ blktochr(dev)
* disk driver name -> bdev major number table, which follows.
* Note: floppies are not included as those are differentiated by the BIOS.
*/
-static struct {
- char *name;
- int maj;
-} disk_maj[] = {
- { "wd", 0 },
- { "sd", 4 },
-#if 0
- /* XXX It's not clear at all that recognizing these will help us */
- { "cd", 6 },
- { "mcd", 7 }, /* XXX I wonder if any BIOSes support this */
- { "scd", 15 } /* - " - */
-#endif
-};
-
+int findblkmajor __P((struct device *dv));
dev_t dev_rawpart __P((struct device *)); /* XXX */
dev_t
dev_rawpart(dv)
struct device *dv;
{
- int i;
+ int majdev;
+
+ majdev = findblkmajor(dv);
+
+ switch (majdev) {
+ /* add here any device you want to be checksummed on boot */
+ case 0: /* wd */
+ case 4: /* sd */
+ return (MAKEDISKDEV(majdev, dv->dv_unit, RAW_PART));
+ break;
+ default:
+ }
- for (i = 0; i < sizeof disk_maj / sizeof disk_maj[0]; i++)
- if (strcmp(dv->dv_cfdata->cf_driver->cd_name,
- disk_maj[i].name) == 0)
- return (MAKEDISKDEV(disk_maj[i].maj, dv->dv_unit,
- RAW_PART));
return (NODEV);
}
diff --git a/sys/arch/macppc/macppc/autoconf.c b/sys/arch/macppc/macppc/autoconf.c
index 68e3f99af68..573e5ff8a8f 100644
--- a/sys/arch/macppc/macppc/autoconf.c
+++ b/sys/arch/macppc/macppc/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.1 2001/09/01 15:44:20 drahn Exp $ */
+/* $OpenBSD: autoconf.c,v 1.2 2001/12/05 23:58:41 tdeval Exp $ */
/*
* Copyright (c) 1996, 1997 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.1 2001/09/01 15:44:20 drahn Exp $
+ * $Id: autoconf.c,v 1.2 2001/12/05 23:58:41 tdeval Exp $
*/
/*
@@ -66,7 +66,8 @@ struct device *parsedisk __P((char *, int, int, dev_t *));
void setroot __P((void));
void swapconf __P((void));
extern void dumpconf __P((void));
-static int findblkmajor __P((struct device *));
+int findblkmajor __P((struct device *));
+char *findblkname __P((int));
static struct device * getdisk __P((char *, int, int, dev_t *));
struct device * getdevunit __P((char *, int));
static struct devmap * findtype __P((char **));
@@ -214,21 +215,34 @@ static struct nam2blk {
{ "wd", 0 }, /* 0 = wd */
{ "sd", 2 }, /* 2 = sd */
{ "ofdisk", 4 }, /* 4 = ofdisk */
+ { "raid", 19 }, /* 19 = raid */
};
-static int
+int
findblkmajor(dv)
struct device *dv;
{
char *name = dv->dv_xname;
- register int i;
+ int i;
for (i = 0; i < sizeof(nam2blk)/sizeof(nam2blk[0]); ++i)
- if (strncmp(name, nam2blk[i].name, strlen(nam2blk[0].name)) == 0)
+ if (strncmp(name, nam2blk[i].name, strlen(nam2blk[i].name)) == 0)
return (nam2blk[i].maj);
return (-1);
}
+char *
+findblkname(maj)
+ int maj;
+{
+ int i;
+
+ for (i = 0; i < sizeof(nam2blk)/sizeof(nam2blk[0]); i++)
+ if (nam2blk[i].maj == maj)
+ return (nam2blk[i].name);
+ return (NULL);
+}
+
static struct device *
getdisk(str, len, defpart, devp)
char *str;
@@ -319,6 +333,22 @@ printf("bootpath: '%s'\n", bootpath);
if(boothowto & RB_DFLTROOT)
return; /* Boot compiled in */
+ /*
+ * (raid) device auto-configuration could have returned
+ * the root device's id in rootdev. Check this case.
+ */
+ if (rootdev != NODEV) {
+ majdev = major(rootdev);
+ unit = DISKUNIT(rootdev);
+ part = DISKPART(rootdev);
+
+ len = sprintf(buf, "%s%d", findblkname(majdev), unit);
+ if (len >= sizeof(buf))
+ panic("setroot: device name too long");
+
+ bootdv = getdisk(buf, len, part, &rootdev);
+ }
+
/* Lookup boot device from boot if not set by configuration */
if(bootdv == NULL) {
bootdv = parsedisk(bootdev, strlen(bootdev), 0, &temp);
diff --git a/sys/arch/macppc/macppc/conf.c b/sys/arch/macppc/macppc/conf.c
index 46666f1845b..2de543c0c01 100644
--- a/sys/arch/macppc/macppc/conf.c
+++ b/sys/arch/macppc/macppc/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.6 2001/11/06 23:46:05 drahn Exp $ */
+/* $OpenBSD: conf.c,v 1.7 2001/12/05 23:58:41 tdeval Exp $ */
/*
* Copyright (c) 1997 Per Fogelstrom
@@ -296,6 +296,43 @@ static int chrtoblktbl[] = {
/* 15 */ NODEV,
/* 16 */ NODEV,
/* 17 */ 17,
+ /* 18 */ NODEV,
+ /* 19 */ NODEV,
+ /* 20 */ NODEV,
+ /* 21 */ NODEV,
+ /* 22 */ NODEV,
+ /* 23 */ NODEV,
+ /* 24 */ NODEV,
+ /* 25 */ NODEV,
+ /* 26 */ NODEV,
+ /* 27 */ NODEV,
+ /* 28 */ NODEV,
+ /* 29 */ NODEV,
+ /* 30 */ NODEV,
+ /* 31 */ NODEV,
+ /* 32 */ NODEV,
+ /* 33 */ NODEV,
+ /* 34 */ NODEV,
+ /* 35 */ NODEV,
+ /* 36 */ NODEV,
+ /* 37 */ NODEV,
+ /* 38 */ NODEV,
+ /* 39 */ NODEV,
+ /* 40 */ NODEV,
+ /* 41 */ NODEV,
+ /* 42 */ NODEV,
+ /* 43 */ NODEV,
+ /* 44 */ NODEV,
+ /* 45 */ NODEV,
+ /* 46 */ NODEV,
+ /* 47 */ NODEV,
+ /* 48 */ NODEV,
+ /* 49 */ NODEV,
+ /* 50 */ NODEV,
+ /* 51 */ NODEV,
+ /* 52 */ NODEV,
+ /* 53 */ NODEV,
+ /* 54 */ 19,
};
/*
diff --git a/sys/arch/mvmeppc/mvmeppc/autoconf.c b/sys/arch/mvmeppc/mvmeppc/autoconf.c
index 24af8d37edc..0281d7b3b67 100644
--- a/sys/arch/mvmeppc/mvmeppc/autoconf.c
+++ b/sys/arch/mvmeppc/mvmeppc/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.2 2001/09/19 21:32:19 miod Exp $ */
+/* $OpenBSD: autoconf.c,v 1.3 2001/12/05 23:58:41 tdeval Exp $ */
/*
* Copyright (c) 1996, 1997 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.2 2001/09/19 21:32:19 miod Exp $
+ * $Id: autoconf.c,v 1.3 2001/12/05 23:58:41 tdeval Exp $
*/
/*
@@ -66,7 +66,8 @@ struct device *parsedisk __P((char *, int, int, dev_t *));
void setroot __P((void));
void swapconf __P((void));
extern void dumpconf __P((void));
-static int findblkmajor __P((struct device *));
+int findblkmajor __P((struct device *));
+char *findblkname __P((int));
static struct device * getdisk __P((char *, int, int, dev_t *));
struct device * getdevunit __P((char *, int));
static struct devmap * findtype __P((char **));
@@ -214,19 +215,32 @@ static struct nam2blk {
{ "wd", 0 }, /* 0 = wd */
{ "sd", 2 }, /* 2 = sd */
{ "ofdisk", 4 }, /* 4 = ofdisk */
+ { "raid", 19 }, /* 19 = raid */
};
-static int
+int
findblkmajor(dv)
struct device *dv;
{
char *name = dv->dv_xname;
- register int i;
+ int i;
for (i = 0; i < sizeof(nam2blk)/sizeof(nam2blk[0]); ++i)
- if (strncmp(name, nam2blk[i].name, strlen(nam2blk[0].name)) == 0)
+ if (strncmp(name, nam2blk[i].name, strlen(nam2blk[i].name)) == 0)
return (nam2blk[i].maj);
- return (-1);
+ return (-1);
+}
+
+char *
+findblkname(maj)
+ int maj;
+{
+ int i;
+
+ for (i = 0; i < sizeof(nam2blk)/sizeof(nam2blk[0]); ++i)
+ if (nam2blk[i].maj == maj)
+ return (nam2blk[i].name);
+ return (NULL);
}
static struct device *
@@ -319,6 +333,22 @@ setroot()
if(boothowto & RB_DFLTROOT)
return; /* Boot compiled in */
+ /*
+ * (raid) device auto-configuration could have returned
+ * the root device's id in rootdev. Check this case.
+ */
+ if (rootdev != NODEV) {
+ majdev = major(rootdev);
+ unit = DISKUNIT(rootdev);
+ part = DISKPART(rootdev);
+
+ len = sprintf(buf, "%s%d", findblkname(majdev), unit);
+ if (len >= sizeof(buf))
+ panic("setroot: device name too long");
+
+ bootdv = getdisk(buf, len, part, &rootdev);
+ }
+
/* Lookup boot device from boot if not set by configuration */
if(bootdv == NULL) {
bootdv = parsedisk(bootdev, strlen(bootdev), 0, &temp);
diff --git a/sys/arch/mvmeppc/mvmeppc/conf.c b/sys/arch/mvmeppc/mvmeppc/conf.c
index 1d1dab6059b..fa341f13c24 100644
--- a/sys/arch/mvmeppc/mvmeppc/conf.c
+++ b/sys/arch/mvmeppc/mvmeppc/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.8 2001/09/28 02:53:13 mickey Exp $ */
+/* $OpenBSD: conf.c,v 1.9 2001/12/05 23:58:41 tdeval Exp $ */
/*
* Copyright (c) 1997 Per Fogelstrom
@@ -292,6 +292,43 @@ static int chrtoblktbl[] = {
/* 15 */ NODEV,
/* 16 */ NODEV,
/* 17 */ 17,
+ /* 18 */ NODEV,
+ /* 19 */ NODEV,
+ /* 20 */ NODEV,
+ /* 21 */ NODEV,
+ /* 22 */ NODEV,
+ /* 23 */ NODEV,
+ /* 24 */ NODEV,
+ /* 25 */ NODEV,
+ /* 26 */ NODEV,
+ /* 27 */ NODEV,
+ /* 28 */ NODEV,
+ /* 29 */ NODEV,
+ /* 30 */ NODEV,
+ /* 31 */ NODEV,
+ /* 32 */ NODEV,
+ /* 33 */ NODEV,
+ /* 34 */ NODEV,
+ /* 35 */ NODEV,
+ /* 36 */ NODEV,
+ /* 37 */ NODEV,
+ /* 38 */ NODEV,
+ /* 39 */ NODEV,
+ /* 40 */ NODEV,
+ /* 41 */ NODEV,
+ /* 42 */ NODEV,
+ /* 43 */ NODEV,
+ /* 44 */ NODEV,
+ /* 45 */ NODEV,
+ /* 46 */ NODEV,
+ /* 47 */ NODEV,
+ /* 48 */ NODEV,
+ /* 49 */ NODEV,
+ /* 50 */ NODEV,
+ /* 51 */ NODEV,
+ /* 52 */ NODEV,
+ /* 53 */ NODEV,
+ /* 54 */ 19,
};
/*
diff --git a/sys/arch/sparc/sparc/autoconf.c b/sys/arch/sparc/sparc/autoconf.c
index ed269516a4c..d1b05dd2f1e 100644
--- a/sys/arch/sparc/sparc/autoconf.c
+++ b/sys/arch/sparc/sparc/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.43 2001/11/22 09:45:42 art Exp $ */
+/* $OpenBSD: autoconf.c,v 1.44 2001/12/05 23:58:41 tdeval Exp $ */
/* $NetBSD: autoconf.c,v 1.73 1997/07/29 09:41:53 fair Exp $ */
/*
@@ -109,7 +109,8 @@ static int rootnode;
void setroot __P((void));
static char *str2hex __P((char *, int *));
static int getstr __P((char *, int));
-static int findblkmajor __P((struct device *));
+int findblkmajor __P((struct device *));
+char *findblkname __P((int));
static struct device *getdisk __P((char *, int, int, dev_t *));
static int mbprint __P((void *, const char *));
static void crazymap __P((char *, int *));
@@ -1749,28 +1750,41 @@ struct nam2blk {
char *name;
int maj;
} nam2blk[] = {
- { "xy", 3 },
- { "sd", 7 },
+ { "xy", 3 },
+ { "sd", 7 },
{ "xd", 10 },
{ "st", 11 },
{ "fd", 16 },
{ "rd", 17 },
{ "cd", 18 },
+ { "raid", 25 },
};
-static int
+int
findblkmajor(dv)
struct device *dv;
{
char *name = dv->dv_xname;
- register int i;
+ int i;
for (i = 0; i < sizeof(nam2blk)/sizeof(nam2blk[0]); ++i)
- if (strncmp(name, nam2blk[i].name, strlen(nam2blk[0].name)) == 0)
+ if (strncmp(name, nam2blk[i].name, strlen(nam2blk[i].name)) == 0)
return (nam2blk[i].maj);
return (-1);
}
+char *
+findblkname(maj)
+ int maj;
+{
+ int i;
+
+ for (i = 0; i < sizeof(nam2blk)/sizeof(nam2blk[0]); ++i)
+ if (nam2blk[i].maj == maj)
+ return (nam2blk[i].name);
+ return (NULL);
+}
+
static struct device *
getdisk(str, len, defpart, devp)
char *str;
@@ -1885,6 +1899,22 @@ setroot()
bootdv = (bp == NULL) ? NULL : bp->dev;
/*
+ * (raid) device auto-configuration could have returned
+ * the root device's id in rootdev. Check this case.
+ */
+ if (rootdev != NODEV) {
+ majdev = major(rootdev);
+ unit = DISKUNIT(rootdev);
+ part = DISKPART(rootdev);
+
+ len = sprintf(buf, "%s%d", findblkname(majdev), unit);
+ if (len >= sizeof(buf))
+ panic("setroot: device name too long");
+
+ bootdv = getdisk(buf, len, part, &rootdev);
+ }
+
+ /*
* If `swap generic' and we couldn't determine boot device,
* ask the user.
*/
diff --git a/sys/arch/sparc/sparc/conf.c b/sys/arch/sparc/sparc/conf.c
index af5e6f9bae6..1157cb7d2cd 100644
--- a/sys/arch/sparc/sparc/conf.c
+++ b/sys/arch/sparc/sparc/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.29 2001/09/28 02:53:13 mickey Exp $ */
+/* $OpenBSD: conf.c,v 1.30 2001/12/05 23:58:41 tdeval Exp $ */
/* $NetBSD: conf.c,v 1.40 1996/04/11 19:20:03 thorpej Exp $ */
/*
@@ -424,6 +424,19 @@ static int chrtoblktbl[] = {
/*108 */ NODEV,
/*109 */ NODEV,
/*110 */ 8,
+ /*111 */ NODEV,
+ /*112 */ NODEV,
+ /*113 */ NODEV,
+ /*114 */ NODEV,
+ /*115 */ NODEV,
+ /*116 */ NODEV,
+ /*117 */ NODEV,
+ /*118 */ NODEV,
+ /*119 */ NODEV,
+ /*120 */ NODEV,
+ /*121 */ NODEV,
+ /*122 */ NODEV,
+ /*123 */ 25,
};
/*
diff --git a/sys/arch/sparc64/sparc64/autoconf.c b/sys/arch/sparc64/sparc64/autoconf.c
index 1aeaa058937..efefdc85282 100644
--- a/sys/arch/sparc64/sparc64/autoconf.c
+++ b/sys/arch/sparc64/sparc64/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.15 2001/12/05 02:09:33 jason Exp $ */
+/* $OpenBSD: autoconf.c,v 1.16 2001/12/05 23:58:41 tdeval Exp $ */
/* $NetBSD: autoconf.c,v 1.51 2001/07/24 19:32:11 eeh Exp $ */
/*
@@ -121,7 +121,8 @@ void setroot __P((void));
void swapconf __P((void));
void diskconf __P((void));
static struct device *getdisk __P((char *, int, int, dev_t *));
-static int findblkmajor __P((struct device *));
+int findblkmajor __P((struct device *));
+char *findblkname __P((int));
struct device *booted_device;
struct bootpath bootpath[8];
@@ -618,6 +619,22 @@ setroot()
#endif
/*
+ * (raid) device auto-configuration could have returned
+ * the root device's id in rootdev. Check this case.
+ */
+ if (rootdev != NODEV) {
+ majdev = major(rootdev);
+ unit = DISKUNIT(rootdev);
+ part = DISKPART(rootdev);
+
+ len = sprintf(buf, "%s%d", findblkname(majdev), unit);
+ if (len >= sizeof(buf))
+ panic("setroot: device name too long");
+
+ bootdv = getdisk(buf, len, part, &rootdev);
+ }
+
+ /*
* If `swap generic' and we couldn't determine boot device,
* ask the user.
*/
@@ -784,13 +801,14 @@ struct nam2blk {
char *name;
int maj;
} nam2blk[] = {
- { "sd", 7 },
- { "rd", 5 },
+ { "sd", 7 },
+ { "rd", 5 },
{ "wd", 12 },
- { "cd", 18 },
+ { "cd", 18 },
+ { "raid", 25 },
};
-static int
+int
findblkmajor(dv)
struct device *dv;
{
@@ -798,11 +816,23 @@ findblkmajor(dv)
int i;
for (i = 0; i < sizeof(nam2blk)/sizeof(nam2blk[0]); ++i)
- if (strncmp(name, nam2blk[i].name, strlen(nam2blk[0].name)) == 0)
+ if (strncmp(name, nam2blk[i].name, strlen(nam2blk[i].name)) == 0)
return (nam2blk[i].maj);
return (-1);
}
+char *
+findblkname(maj)
+ int maj;
+{
+ int i;
+
+ for (i = 0; i < sizeof(nam2blk)/sizeof(nam2blk[0]); ++i)
+ if (nam2blk[i].maj == maj)
+ return (nam2blk[i].name);
+ return (NULL);
+}
+
static struct device *
getdisk(str, len, defpart, devp)
char *str;
diff --git a/sys/arch/sparc64/sparc64/conf.c b/sys/arch/sparc64/sparc64/conf.c
index 32b393845bf..8f3da467c19 100644
--- a/sys/arch/sparc64/sparc64/conf.c
+++ b/sys/arch/sparc64/sparc64/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.14 2001/12/04 21:12:41 jason Exp $ */
+/* $OpenBSD: conf.c,v 1.15 2001/12/05 23:58:41 tdeval Exp $ */
/* $NetBSD: conf.c,v 1.17 2001/03/26 12:33:26 lukem Exp $ */
/*
@@ -68,10 +68,7 @@
#include "cd.h"
#include "uk.h"
#include "wd.h"
-#ifdef notyet
#include "raid.h"
-#endif
-#define NRAID 0
#ifdef notyet
#include "fb.h"