Subject: Re: How to get the firmware node into the device properties early?
To: Martin Husemann <firstname.lastname@example.org>
From: Eduardo Horvath <eeh@NetBSD.org>
Date: 09/13/2006 15:43:39
On Wed, 13 Sep 2006, Martin Husemann wrote:
> On Tue, Sep 12, 2006 at 10:29:52PM -0400, der Mouse wrote:
> > Depending on why you want this, this may not matter, but...it may not
> > have one.
> Sorry, should have mentionened this: this is just to identify the boot device,
> so anything not present in the OF tree doesn't matter to me.
> If there is no magic trick, I'll go with code like I sketched (which works,
> mostly due to the set of potential boot devices being limited, but
> unfortunately does not automatically scale to newer machines), but I thought
> I'd better ask wether I overlooked something to solve it more elegant.
I'm sorry, what are you trying to do again?
If you just want to pin down the boot device, you probably should get
the ihandle of the boot device and then do an ihandle>phandle to find
the phandle. You should then be able to compare phandles and find
the boot device. (For SCSI and IDE disks you need to do a bit more
work and check the address on the boot stick or get the unit address
from the ihandle since they are pseudo devices and don't specify
the SCSI bus address.)
The trick, of course, is to get the device's phandle associated
with its device node. I was working on overhauling the device
tree structure quite a while ago to allow associating this
information, and the locator information, with the device node
so it would be available for the *match() and *attach() routines.
I abandoned this after getting lots of resistance from a few
vocal developers, but most of it's probably still on some ancient