OpenFirmware devices and hotplug events

Nathan Lynch nathanl at austin.ibm.com
Thu Mar 18 05:35:46 EST 2004


Dave Hansen wrote:
> Could someone elaborate a little more about "ibm,drc-indexes"?  I was
> imagining that it is just metadata, and likely to be best represented as
> properties for other devices, not a device itself.

A "drc index" is a token (a 32-bit int, iirc) that identifies a resource
that can be acquired from or released to the hypervisor.  An
ibm,drc-indexes property is just a list of such tokens.  There is an
ibm,drc-indexes property at each level of the device tree where
resources can be added or removed.  For instance, there is one in
/proc/device-tree/cpus.  There is also an ibm,drc-indexes property at
the root of the device tree; this one is for memory nodes.  I believe
PCI host bridges also have the property for logical slots.

Each OF node (or "device") that can be released to the hypervisor has an
ibm,my-drc-index property.  The value of this property should correspond
to an element in the ibm,drc-indexes property of the device's parent node.

So, for example, on my 2-way partition on a 32 cpu p690, we have:

# xxd /proc/device-tree/cpus/PowerPC,POWER4 at 2/ibm,my-drc-index
0000000: 0000 1000
# xxd /proc/device-tree/cpus/PowerPC,POWER4 at b/ibm,my-drc-index
0000000: 0000 1001
# xxd /proc/device-tree/cpus/ibm,drc-indexes
0000000: 0000 0020 0000 1000 0000 1001 0000 1002  ... ............
0000010: 0000 1003 0000 1004 0000 1005 0000 1006  ................
0000020: 0000 1007 0000 1008 0000 1009 0000 100a  ................
0000030: 0000 100b 0000 100c 0000 100d 0000 100e  ................
0000040: 0000 100f 0000 1010 0000 1011 0000 1012  ................
0000050: 0000 1013 0000 1014 0000 1015 0000 1016  ................
0000060: 0000 1017 0000 1018 0000 1019 0000 101a  ................
0000070: 0000 101b 0000 101c 0000 101d 0000 101e  ................
0000080: 0000 101f                                ....

The first 32-bit quantity (0x20) in ibm,drc-indexes is the total number
of indexes, btw.

So when we want to add a cpu to the kernel's resource pool, we go down
the list of drc indexes, making a query to the hv for each index that we
don't already own to see if it's available.

Does this clear things up?

Nathan

** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc64-dev mailing list