OpenFirmware devices and hotplug events

Dave Hansen haveblue at
Thu Mar 18 03:16:28 EST 2004

On Tue, 2004-03-16 at 22:46, Nathan Lynch wrote:
> Greg KH wrote:
> > It looks like a portion of the device-tree is in sysfs today, with the
> > different busses, right?  It shouldn't be that big of a leap.
> One sticking point is that sysfs attribute "show" methods are restricted
> to returning no more than PAGE_SIZE bytes (according to
> Documentation/filesystems/sysfs.txt).  Assuming that we map Open
> Firmware properties to sysfs attributes, the device tree representation
> can easily have attributes in excess of PAGE_SIZE.  Some of these are
> actually important -- the "ibm,drc-indexes" property enumerates
> resources (e.g. CPUs, memory) that may be acquired from the hypervisor.
>   I believe Anton had one of these that was over 600K the other day...

The thing to remember here is that we're not suggesting that the entire
/proc/device-tree be copied, verbatim, to sysfs.  The "ibm,drc-indexes"
is a single node in the OpenFirmware tree, but why does it need to be
one in the sysfs tree?  If it enumerates CPUs and memory, then each unit
of enumeration would be a likely cantidate for a sysfs entry.

> Another possible issue: how stringent is the requirement that
> attributes' show methods return only ascii text?  Many (if not most) of
> the properties that exist in an OF device tree are just binary blobs,
> and that's how they are exported to userspace through /proc/device-tree.

I think that the ASCII requirement is much more stringent for things
that the kernel itself produces.  For instance, since the kernel is
generating the device number itself, the device number is exported as
ASCII.  If a device has a binary property that doesn't make sense for a
human to read, and userspace wants to deal with it in binary, then I'd
say that it's a pretty strong case to have the kernel leave it the hell
alone and simply pass it along.  However, beware of files that aggregate
different kinds of data like "ibm,drc-indexes" that you mentioned
above.  Those need to be broken up.

Another idea would be to have sysfs enumerate the structure of the
OpenFirmware tree, but have a device driver or separate filesystem
actually deal with getting data in and out.  Sysfs would describe where
and what to look for, but some other mechanism would be responsible for
actually dishing the data out.  Remember, sysfs is generally there to

-- dave

** Sent via the linuxppc64-dev mail list. See

More information about the Linuxppc64-dev mailing list