Subject: Re: root on raidframe
To: Robert Elz <kre@munnari.OZ.AU>
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
List: port-sparc
Date: 09/20/2001 14:58:42
--+HP7ph2BbKc20aGI
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Thu, Sep 20, 2001 at 05:32:19PM +0700, Robert Elz wrote:
>   | raidframe should overwrite the root device with raid0a.
>   | It works this way on i386 and alpha, at last.
>   | Greg explicitely added code to raidframe to do this, if I read it properly
>   | the magic happens in rf_netbsdkintf.c:rf_buildroothack()
> 
> Yes, I see - that sets booted_device ... unfortunately the sparc port doesn't
> use booted_device in the call to setroot() the way that most of the other
> ports do, instead it uses the data struct it used to parse the boot path
> in the call to setroot() - see arch/sparc/sparc/autoconf.c:cpu_rootconf()
> 
> The RAIDframe code setting booted_device on the sparc isn't going to
> achieve anything useful (why booted_device is being set at all on the
> sparc I'm not sure, it doesn't seem to be used for anything I could see).

OK, now I see what's happening. It looks like cpu_rootconf()'s bootdv (bp->dev)
is the same thing as booted_device, if we take care of setting booted_device
in the floppy case.
Wouldn't the attached patch solve this ?
PS: I didn't test it, I'll do when I'm back home, unless someone tells me
it won't work :)

--
Manuel Bouyer, LIP6, Universite Paris VI.           Manuel.Bouyer@lip6.fr
--

--+HP7ph2BbKc20aGI
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=diff

Index: autoconf.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/sparc/sparc/autoconf.c,v
retrieving revision 1.151
diff -u -r1.151 autoconf.c
--- autoconf.c	2001/09/10 21:19:24	1.151
+++ autoconf.c	2001/09/20 12:56:06
@@ -841,14 +841,17 @@
 cpu_rootconf()
 {
 	struct bootpath *bp;
-	struct device *bootdv;
 	int bootpartition;
 
 	bp = nbootpath == 0 ? NULL : &bootpath[nbootpath-1];
-	bootdv = bp == NULL ? NULL : bp->dev;
-	bootpartition = bootdv == NULL ? 0 : bp->val[2];
+	if (bp == NULL)
+		bootpartition = 0;
+	else if (booted_device != bp->dev)
+		bootpartition = 0;
+	else
+		bootpartition = bp->val[2];
 
-	setroot(bootdv, bootpartition);
+	setroot(booted_device, bootpartition);
 }
 
 /*
@@ -1689,7 +1692,7 @@
 				strcpy(bootpath[nbootpath].name, "fd");
 				nbootpath++;
 			}
-			bp->dev = dev;
+			booted_device = bp->dev = dev;
 			bootpath_store(1, bp + 1);
 			return;
 		}

--+HP7ph2BbKc20aGI--