diff options
author | Thierry Deval <tdeval@cvs.openbsd.org> | 2001-12-05 23:58:42 +0000 |
---|---|---|
committer | Thierry Deval <tdeval@cvs.openbsd.org> | 2001-12-05 23:58:42 +0000 |
commit | 41bc9e864940c498f11169f1b63c082c057d8534 (patch) | |
tree | 2183e20ba9a198c0a2f432da175beb4a12b4bae0 /sys/arch/mvmeppc | |
parent | 03573bfb57ddd4be432cfa80b3e1fa1405abcc13 (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/mvmeppc')
-rw-r--r-- | sys/arch/mvmeppc/mvmeppc/autoconf.c | 44 | ||||
-rw-r--r-- | sys/arch/mvmeppc/mvmeppc/conf.c | 39 |
2 files changed, 75 insertions, 8 deletions
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, }; /* |