[Skiboot] [PATCH v2] DT: Add "version" property under ibm, firmware-versions node

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Thu Jan 18 18:00:43 AEDT 2018


First line of VERSION section in PNOR contains firmware version.
Use that to add "version" property under firmware versions dt node.

Sample output:
--------------
root at xxx2:/proc/device-tree/ibm,firmware-versions# lsprop
version          "witherspoon-ibm-OP9_v1.19_1.94"
....
...

Suggested-by: Stewart Smith <stewart at linux.vnet.ibm.com>
Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
---
 core/flash.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/core/flash.c b/core/flash.c
index 2744496c0..3ea82f382 100644
--- a/core/flash.c
+++ b/core/flash.c
@@ -156,6 +156,7 @@ out:
 
 static void __flash_dt_add_fw_version(struct dt_node *fw_version, char* data)
 {
+	static bool first = true;
 	char *prop;
 	int version_len, i;
 	int len = strlen(data);
@@ -164,6 +165,25 @@ static void __flash_dt_add_fw_version(struct dt_node *fw_version, char* data)
 				      "petitboot", "occ", "capp-ucode", "sbe",
 				      "machine-xml"};
 
+	if (first) {
+		first = false;
+
+		/* Increment past "key-" */
+		if (memcmp(data, "open-power", strlen("open-power")) == 0)
+			prop = data + strlen("open-power");
+		else
+			prop = strchr(data, '-');
+		if (!prop) {
+			prlog(PR_DEBUG,
+			      "FLASH: Invalid fw version format (%s)\n", data);
+			return;
+		}
+		prop++;
+
+		dt_add_property_string(fw_version, "version", prop);
+		return;
+	}
+
 	/*
 	 * PNOR version strings are not easily consumable. Split them into
 	 * property, value.
-- 
2.14.3



More information about the Skiboot mailing list