<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Jeremy,<div class=""><br class=""></div><div class="">Please create a ticket on <a href="http://ezix.org" class="">http://ezix.org</a> </div><div class=""><br class=""></div><div class="">cheers,</div><div class="">Lyonel.</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On 8 Jun 2015, at 06:42, Jeremy Kerr <<a href="mailto:jk@ozlabs.org" class="">jk@ozlabs.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">OPAL-firmware-based Power machines expose a firmware device tree node in<br class="">/ibm,opal, containing version information and available interfaces.<br class=""><br class="">This change adds a function to parse information about OPAL firmware and<br class="">add it to lshw's machine information. With a current OpenPower machine,<br class="">we get something like this:<br class=""><br class="">     *-firmware<br class="">          product: OPAL firmware<br class="">          physical id: 1<br class="">          version: skiboot-5.0.2<br class="">          capabilities: opal-v2 opal-v3 prd ipmi<br class=""><br class="">Signed-off-by: Jeremy Kerr <<a href="mailto:jk@ozlabs.org" class="">jk@ozlabs.org</a>><br class=""><br class="">---<br class="">Lionel: I only saw your email address in the lshw sources - let me know<br class="">if I should send this elsewhere<br class=""><br class="">---<br class=""> src/core/<a href="http://device-tree.cc" class="">device-tree.cc</a> |   59 ++++++++++++++++++++++++++++++++++++++++<br class=""> 1 file changed, 59 insertions(+)<br class=""><br class="">diff --git a/src/core/<a href="http://device-tree.cc" class="">device-tree.cc</a> b/src/core/<a href="http://device-tree.cc" class="">device-tree.cc</a><br class="">index 8908fd1..73a98a9 100644<br class="">--- a/src/core/<a href="http://device-tree.cc" class="">device-tree.cc</a><br class="">+++ b/src/core/<a href="http://device-tree.cc" class="">device-tree.cc</a><br class="">@@ -168,6 +168,64 @@ static void scan_devtree_bootrom(hwNode & core)<br class="">   }<br class=""> }<br class=""><br class="">+static void scan_devtree_opal_firmware(hwNode & core)<br class="">+{<br class="">+  vector < string >::iterator it;<br class="">+  vector < string > compat;<br class="">+  struct dirent **namelist;<br class="">+  int i, n;<br class="">+<br class="">+  if (!exists(DEVICETREE "/ibm,opal"))<br class="">+    return;<br class="">+<br class="">+  hwNode opal("firmware", hw::memory);<br class="">+<br class="">+  opal.setProduct("OPAL firmware");<br class="">+  if (exists(DEVICETREE "/ibm,opal/firmware/version"))<br class="">+    opal.setVersion(get_string(DEVICETREE "/ibm,opal/firmware/version"));<br class="">+<br class="">+  compat = get_strings(DEVICETREE "/ibm,opal/compatible");<br class="">+<br class="">+  for (it = compat.begin(); it != compat.end(); ++it) {<br class="">+    if (matches(*it, "^ibm,opal-v2"))<br class="">+      opal.addCapability("opal-v2");<br class="">+    if (matches(*it, "^ibm,opal-v3"))<br class="">+      opal.addCapability("opal-v3");<br class="">+  }<br class="">+<br class="">+  /* collect compatible strings from firmware sub-nodes */<br class="">+  compat.clear();<br class="">+  pushd(DEVICETREE "/ibm,opal");<br class="">+  n = scandir(".", &namelist, selectdir, alphasort);<br class="">+  popd();<br class="">+  for (i = 0; i < n; i++) {<br class="">+    string path = string(DEVICETREE "/ibm,opal/")<br class="">+                        + string(namelist[i]->d_name)<br class="">+                        + string("/compatible");<br class="">+<br class="">+    vector < string > tmp = get_strings(path);<br class="">+    compat.insert(compat.end(), tmp.begin(), tmp.end());<br class="">+<br class="">+    free(namelist[i]);<br class="">+  }<br class="">+<br class="">+  if (n >= 0)<br class="">+    free(namelist);<br class="">+<br class="">+  /* check our collected compatible strings for known capabilities */<br class="">+  for (it = compat.begin(); it != compat.end(); ++it) {<br class="">+<br class="">+    if (*it == "ibm,opal-prd")<br class="">+      opal.addCapability("prd");<br class="">+<br class="">+    if (*it == "ibm,opal-ipmi")<br class="">+      opal.addCapability("ipmi");<br class="">+  }<br class="">+<br class="">+  opal.claim();<br class="">+  core.addChild(opal);<br class="">+}<br class="">+<br class=""><br class=""> static string cpubusinfo(int cpu)<br class=""> {<br class="">@@ -696,6 +754,7 @@ bool scan_device_tree(hwNode & n)<br class="">       scan_devtree_root(*core);<br class="">       scan_devtree_memory_powernv(*core);<br class="">       scan_devtree_cpu(*core);<br class="">+      scan_devtree_opal_firmware(*core);<br class="">       n.addCapability("powernv", "Non-virtualized");<br class="">       n.addCapability("opal", "OPAL firmware");<br class="">     }<br class=""></div></blockquote></div><br class=""></div></body></html>