summaryrefslogtreecommitdiff
path: root/sys/arch/sparc64/sparc64/autoconf.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/sparc64/sparc64/autoconf.c')
-rw-r--r--sys/arch/sparc64/sparc64/autoconf.c44
1 files changed, 37 insertions, 7 deletions
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;