Message ID | 1433738560.787668.806027114891.1.gpush@pablo |
---|---|
State | Not Applicable |
Headers | show |
Hi Lyonel, > Lionel: I only saw your email address in the lshw sources - let me know > if I should send this elsewhere ... and I've just noticed the lshw repo on github. Would you prefer me to send a pull-request there instead? (and sorry for the misspelling of your name!) Cheers, Jeremy
On 06/08/2015 10:12 AM, Jeremy Kerr wrote: > OPAL-firmware-based Power machines expose a firmware device tree node in > /ibm,opal, containing version information and available interfaces. > > This change adds a function to parse information about OPAL firmware and > add it to lshw's machine information. With a current OpenPower machine, > we get something like this: > > *-firmware > product: OPAL firmware > physical id: 1 > version: skiboot-5.0.2 > capabilities: opal-v2 opal-v3 prd ipmi > > Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Nice one. I didn't realize firmware component is missing when we enabled support for PowerNV. Patch looks good. Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> > > --- > Lionel: I only saw your email address in the lshw sources - let me know > if I should send this elsewhere So far we have been raising ticket with patch (see [1]). [1] http://www.ezix.org/project/ticket/686 -Vasant
Hi Jeremy, Please create a ticket on http://ezix.org <http://ezix.org/> cheers, Lyonel. > On 8 Jun 2015, at 06:42, Jeremy Kerr <jk@ozlabs.org> wrote: > > OPAL-firmware-based Power machines expose a firmware device tree node in > /ibm,opal, containing version information and available interfaces. > > This change adds a function to parse information about OPAL firmware and > add it to lshw's machine information. With a current OpenPower machine, > we get something like this: > > *-firmware > product: OPAL firmware > physical id: 1 > version: skiboot-5.0.2 > capabilities: opal-v2 opal-v3 prd ipmi > > Signed-off-by: Jeremy Kerr <jk@ozlabs.org> > > --- > Lionel: I only saw your email address in the lshw sources - let me know > if I should send this elsewhere > > --- > src/core/device-tree.cc | 59 ++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 59 insertions(+) > > diff --git a/src/core/device-tree.cc b/src/core/device-tree.cc > index 8908fd1..73a98a9 100644 > --- a/src/core/device-tree.cc > +++ b/src/core/device-tree.cc > @@ -168,6 +168,64 @@ static void scan_devtree_bootrom(hwNode & core) > } > } > > +static void scan_devtree_opal_firmware(hwNode & core) > +{ > + vector < string >::iterator it; > + vector < string > compat; > + struct dirent **namelist; > + int i, n; > + > + if (!exists(DEVICETREE "/ibm,opal")) > + return; > + > + hwNode opal("firmware", hw::memory); > + > + opal.setProduct("OPAL firmware"); > + if (exists(DEVICETREE "/ibm,opal/firmware/version")) > + opal.setVersion(get_string(DEVICETREE "/ibm,opal/firmware/version")); > + > + compat = get_strings(DEVICETREE "/ibm,opal/compatible"); > + > + for (it = compat.begin(); it != compat.end(); ++it) { > + if (matches(*it, "^ibm,opal-v2")) > + opal.addCapability("opal-v2"); > + if (matches(*it, "^ibm,opal-v3")) > + opal.addCapability("opal-v3"); > + } > + > + /* collect compatible strings from firmware sub-nodes */ > + compat.clear(); > + pushd(DEVICETREE "/ibm,opal"); > + n = scandir(".", &namelist, selectdir, alphasort); > + popd(); > + for (i = 0; i < n; i++) { > + string path = string(DEVICETREE "/ibm,opal/") > + + string(namelist[i]->d_name) > + + string("/compatible"); > + > + vector < string > tmp = get_strings(path); > + compat.insert(compat.end(), tmp.begin(), tmp.end()); > + > + free(namelist[i]); > + } > + > + if (n >= 0) > + free(namelist); > + > + /* check our collected compatible strings for known capabilities */ > + for (it = compat.begin(); it != compat.end(); ++it) { > + > + if (*it == "ibm,opal-prd") > + opal.addCapability("prd"); > + > + if (*it == "ibm,opal-ipmi") > + opal.addCapability("ipmi"); > + } > + > + opal.claim(); > + core.addChild(opal); > +} > + > > static string cpubusinfo(int cpu) > { > @@ -696,6 +754,7 @@ bool scan_device_tree(hwNode & n) > scan_devtree_root(*core); > scan_devtree_memory_powernv(*core); > scan_devtree_cpu(*core); > + scan_devtree_opal_firmware(*core); > n.addCapability("powernv", "Non-virtualized"); > n.addCapability("opal", "OPAL firmware"); > }
diff --git a/src/core/device-tree.cc b/src/core/device-tree.cc index 8908fd1..73a98a9 100644 --- a/src/core/device-tree.cc +++ b/src/core/device-tree.cc @@ -168,6 +168,64 @@ static void scan_devtree_bootrom(hwNode & core) } } +static void scan_devtree_opal_firmware(hwNode & core) +{ + vector < string >::iterator it; + vector < string > compat; + struct dirent **namelist; + int i, n; + + if (!exists(DEVICETREE "/ibm,opal")) + return; + + hwNode opal("firmware", hw::memory); + + opal.setProduct("OPAL firmware"); + if (exists(DEVICETREE "/ibm,opal/firmware/version")) + opal.setVersion(get_string(DEVICETREE "/ibm,opal/firmware/version")); + + compat = get_strings(DEVICETREE "/ibm,opal/compatible"); + + for (it = compat.begin(); it != compat.end(); ++it) { + if (matches(*it, "^ibm,opal-v2")) + opal.addCapability("opal-v2"); + if (matches(*it, "^ibm,opal-v3")) + opal.addCapability("opal-v3"); + } + + /* collect compatible strings from firmware sub-nodes */ + compat.clear(); + pushd(DEVICETREE "/ibm,opal"); + n = scandir(".", &namelist, selectdir, alphasort); + popd(); + for (i = 0; i < n; i++) { + string path = string(DEVICETREE "/ibm,opal/") + + string(namelist[i]->d_name) + + string("/compatible"); + + vector < string > tmp = get_strings(path); + compat.insert(compat.end(), tmp.begin(), tmp.end()); + + free(namelist[i]); + } + + if (n >= 0) + free(namelist); + + /* check our collected compatible strings for known capabilities */ + for (it = compat.begin(); it != compat.end(); ++it) { + + if (*it == "ibm,opal-prd") + opal.addCapability("prd"); + + if (*it == "ibm,opal-ipmi") + opal.addCapability("ipmi"); + } + + opal.claim(); + core.addChild(opal); +} + static string cpubusinfo(int cpu) { @@ -696,6 +754,7 @@ bool scan_device_tree(hwNode & n) scan_devtree_root(*core); scan_devtree_memory_powernv(*core); scan_devtree_cpu(*core); + scan_devtree_opal_firmware(*core); n.addCapability("powernv", "Non-virtualized"); n.addCapability("opal", "OPAL firmware"); }
OPAL-firmware-based Power machines expose a firmware device tree node in /ibm,opal, containing version information and available interfaces. This change adds a function to parse information about OPAL firmware and add it to lshw's machine information. With a current OpenPower machine, we get something like this: *-firmware product: OPAL firmware physical id: 1 version: skiboot-5.0.2 capabilities: opal-v2 opal-v3 prd ipmi Signed-off-by: Jeremy Kerr <jk@ozlabs.org> --- Lionel: I only saw your email address in the lshw sources - let me know if I should send this elsewhere --- src/core/device-tree.cc | 59 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+)