97 lines
2.9 KiB
Diff
97 lines
2.9 KiB
Diff
|
From 29f69ac618fd5ace9ed9aae7839b5cfdc1fb5130 Mon Sep 17 00:00:00 2001
|
||
|
From: Shivaprasad G Bhat <sbhat@linux.ibm.com>
|
||
|
Date: Wed, 1 Apr 2020 09:25:52 -0500
|
||
|
Subject: [PATCH 14/17] devtree: Add capabilites to the OPAL Firmware
|
||
|
|
||
|
On OpenPower systems, the presence of the "/ibm,opal" entry in the device tree
|
||
|
signifies machines are running under OPAL firmware (i.e skiboot). Under this
|
||
|
node OPAL exports certain available interfaces. And also this node have a
|
||
|
compatible property listing "ibm,opal-v<X> which denotes the OPAL compatability.
|
||
|
|
||
|
This change adds a function to parse information about those OPAL firmware
|
||
|
capabilities and add it to skiboot firmware node. With a current OpenPower
|
||
|
machine, we get something like this:
|
||
|
|
||
|
*-firmware:0
|
||
|
description: skiboot
|
||
|
product: OPAL firmware
|
||
|
physical id: 2
|
||
|
version: 5.4.3-35bf9d9
|
||
|
capabilities: opal-v2 opal-v3 prd ipmi
|
||
|
|
||
|
|
||
|
Signed-off-by: Pridhiviraj Paidipeddi <ppaidipe@linux.vnet.ibm.com>
|
||
|
Signed-off-by: Shivaprasad G Bhat <sbhat@linux.ibm.com>
|
||
|
---
|
||
|
src/core/device-tree.cc | 42 +++++++++++++++++++++++++++++++++++++++++
|
||
|
1 file changed, 42 insertions(+)
|
||
|
|
||
|
diff --git a/src/core/device-tree.cc b/src/core/device-tree.cc
|
||
|
index af665a4d8e1a..e7227e1f74b7 100644
|
||
|
--- a/src/core/device-tree.cc
|
||
|
+++ b/src/core/device-tree.cc
|
||
|
@@ -219,11 +219,48 @@ static void scan_devtree_bootrom(hwNode & core)
|
||
|
}
|
||
|
}
|
||
|
|
||
|
+static hwNode *add_base_opal_node(hwNode & core)
|
||
|
+{
|
||
|
+ vector < string >:: iterator it;
|
||
|
+ vector < string > compat;
|
||
|
+ string basepath = DEVICETREE "/ibm,opal";
|
||
|
+ hwNode opal("firmware");
|
||
|
+
|
||
|
+ if (!exists(basepath))
|
||
|
+ return NULL;
|
||
|
+
|
||
|
+ pushd(basepath);
|
||
|
+
|
||
|
+ opal.setProduct("OPAL firmware");
|
||
|
+ opal.setDescription("skiboot");
|
||
|
+
|
||
|
+ compat = get_strings(basepath + "/compatible");
|
||
|
+ for (it = compat.begin(); it != compat.end(); ++it) {
|
||
|
+ if (matches(*it, "^ibm,opal-v"))
|
||
|
+ opal.addCapability((*it).erase(0,4));
|
||
|
+ }
|
||
|
+
|
||
|
+ if (exists(basepath + "/ipmi/compatible") &&
|
||
|
+ matches(get_string(basepath + "/ipmi/compatible"), "^ibm,opal-ipmi"))
|
||
|
+ opal.addCapability("ipmi");
|
||
|
+
|
||
|
+ if (exists(basepath + "/diagnostics/compatible") &&
|
||
|
+ matches(get_string(basepath + "/diagnostics/compatible"), "^ibm,opal-prd"))
|
||
|
+ opal.addCapability("prd");
|
||
|
+
|
||
|
+ popd();
|
||
|
+
|
||
|
+ opal.claim();
|
||
|
+ return core.addChild(opal);
|
||
|
+}
|
||
|
+
|
||
|
static void scan_devtree_firmware_powernv(hwNode & core)
|
||
|
{
|
||
|
int n;
|
||
|
struct dirent **namelist;
|
||
|
|
||
|
+ hwNode *opal = add_base_opal_node(core);
|
||
|
+
|
||
|
if (!exists(DEVICETREE "/ibm,firmware-versions"))
|
||
|
return;
|
||
|
|
||
|
@@ -245,6 +282,11 @@ static void scan_devtree_firmware_powernv(hwNode & core)
|
||
|
fwnode.setDescription(sname);
|
||
|
fwnode.setVersion(hw::strip(get_string(fullpath)));
|
||
|
fwnode.claim();
|
||
|
+ if (opal && sname == "skiboot") {
|
||
|
+ opal->merge(fwnode);
|
||
|
+ free(namelist[i]);
|
||
|
+ continue;
|
||
|
+ }
|
||
|
core.addChild(fwnode);
|
||
|
}
|
||
|
free(namelist[i]);
|
||
|
--
|
||
|
2.17.1
|
||
|
|