|
|
99c779 |
From 3abc9878e862d3401f2e5b3eb9e507f10bad7e2e Mon Sep 17 00:00:00 2001
|
|
|
99c779 |
From: Jack Miller <jack@codezen.org>
|
|
|
99c779 |
Date: Tue, 23 Aug 2016 15:18:47 -0500
|
|
|
99c779 |
Subject: [PATCH 27/43] devtree: Add parsed firmware version info
|
|
|
99c779 |
|
|
|
99c779 |
We have /ibm,firmware-versions node in device tree ..which contains
|
|
|
99c779 |
various firmware version information.
|
|
|
99c779 |
|
|
|
99c779 |
Property name represents firmware component and property value
|
|
|
99c779 |
represents the version.
|
|
|
99c779 |
|
|
|
99c779 |
This patch adds support to parse above information on Power System.
|
|
|
99c779 |
|
|
|
99c779 |
Sample output:
|
|
|
99c779 |
*-firmware:0
|
|
|
99c779 |
description: buildroot
|
|
|
99c779 |
physical id: 1
|
|
|
99c779 |
version: 211bd05
|
|
|
99c779 |
*-firmware:1
|
|
|
99c779 |
description: capp-ucode
|
|
|
99c779 |
physical id: 2
|
|
|
99c779 |
version: 1bb7503
|
|
|
99c779 |
|
|
|
99c779 |
Signed-off-by: Jack Miller <jack@codezen.org>
|
|
|
99c779 |
[Minor code cleanup, updated description - Vasant]
|
|
|
99c779 |
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
|
|
|
99c779 |
---
|
|
|
99c779 |
src/core/device-tree.cc | 34 ++++++++++++++++++++++++++++++++++
|
|
|
99c779 |
1 file changed, 34 insertions(+)
|
|
|
99c779 |
|
|
|
99c779 |
diff --git a/src/core/device-tree.cc b/src/core/device-tree.cc
|
|
|
99c779 |
index d61347b..0bba4e9 100644
|
|
|
99c779 |
--- a/src/core/device-tree.cc
|
|
|
99c779 |
+++ b/src/core/device-tree.cc
|
|
|
99c779 |
@@ -218,6 +218,39 @@ static void scan_devtree_bootrom(hwNode & core)
|
|
|
99c779 |
}
|
|
|
99c779 |
}
|
|
|
99c779 |
|
|
|
99c779 |
+static void scan_devtree_firmware_powernv(hwNode & core)
|
|
|
99c779 |
+{
|
|
|
99c779 |
+ int n;
|
|
|
99c779 |
+ struct dirent **namelist;
|
|
|
99c779 |
+
|
|
|
99c779 |
+ if (!exists(DEVICETREE "/ibm,firmware-versions"))
|
|
|
99c779 |
+ return;
|
|
|
99c779 |
+
|
|
|
99c779 |
+ pushd(DEVICETREE "/ibm,firmware-versions");
|
|
|
99c779 |
+ n = scandir(".", &namelist, selectfile, alphasort);
|
|
|
99c779 |
+ popd();
|
|
|
99c779 |
+
|
|
|
99c779 |
+ if (n <= 0)
|
|
|
99c779 |
+ return;
|
|
|
99c779 |
+
|
|
|
99c779 |
+ for (int i = 0; i < n; i++)
|
|
|
99c779 |
+ {
|
|
|
99c779 |
+ string sname = string(namelist[i]->d_name);
|
|
|
99c779 |
+ string fullpath = string(DEVICETREE) + "/ibm,firmware-versions/" + sname;
|
|
|
99c779 |
+
|
|
|
99c779 |
+ if (sname != "linux,phandle" && sname != "name" && sname != "phandle")
|
|
|
99c779 |
+ {
|
|
|
99c779 |
+ hwNode fwnode("firmware");
|
|
|
99c779 |
+ fwnode.setDescription(sname);
|
|
|
99c779 |
+ fwnode.setVersion(hw::strip(get_string(fullpath)));
|
|
|
99c779 |
+ fwnode.claim();
|
|
|
99c779 |
+ core.addChild(fwnode);
|
|
|
99c779 |
+ }
|
|
|
99c779 |
+ free(namelist[i]);
|
|
|
99c779 |
+ }
|
|
|
99c779 |
+
|
|
|
99c779 |
+ free(namelist);
|
|
|
99c779 |
+}
|
|
|
99c779 |
|
|
|
99c779 |
static string cpubusinfo(int cpu)
|
|
|
99c779 |
{
|
|
|
99c779 |
@@ -1111,6 +1144,7 @@ bool scan_device_tree(hwNode & n)
|
|
|
99c779 |
scan_devtree_root(*core);
|
|
|
99c779 |
scan_devtree_cpu_power(*core);
|
|
|
99c779 |
scan_devtree_memory_powernv(*core);
|
|
|
99c779 |
+ scan_devtree_firmware_powernv(*core);
|
|
|
99c779 |
n.addCapability("powernv", "Non-virtualized");
|
|
|
99c779 |
n.addCapability("opal", "OPAL firmware");
|
|
|
99c779 |
}
|
|
|
99c779 |
--
|
|
|
99c779 |
2.10.2
|
|
|
99c779 |
|