summaryrefslogtreecommitdiff
path: root/sys/arch/sparc64
diff options
context:
space:
mode:
authorThierry Deval <tdeval@cvs.openbsd.org>2001-12-05 23:58:42 +0000
committerThierry Deval <tdeval@cvs.openbsd.org>2001-12-05 23:58:42 +0000
commit41bc9e864940c498f11169f1b63c082c057d8534 (patch)
tree2183e20ba9a198c0a2f432da175beb4a12b4bae0 /sys/arch/sparc64
parent03573bfb57ddd4be432cfa80b3e1fa1405abcc13 (diff)
Enable rootdev auto-configuration by device drivers during boot.
Add support for "raid" devices (prepare future raidframe changes). OK deraadt@, Reviewed by drahn@, jason@, mickey@ and miod@
Diffstat (limited to 'sys/arch/sparc64')
-rw-r--r--sys/arch/sparc64/sparc64/autoconf.c44
-rw-r--r--sys/arch/sparc64/sparc64/conf.c5
2 files changed, 38 insertions, 11 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;
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"