Skip to content

Commit

Permalink
DT: Add "version" property under ibm, firmware-versions node
Browse files Browse the repository at this point in the history
First line of VERSION section in PNOR contains firmware version.
Use that to add "version" property under firmware versions dt node.

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

Suggested-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
  • Loading branch information
Vasant Hegde authored and stewartsmith committed Feb 15, 2018
1 parent bfdf85c commit 44d352e
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions core/flash.c
Expand Up @@ -156,6 +156,7 @@ static int flash_nvram_write(uint32_t dst, void *src, uint32_t len)

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);
Expand All @@ -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.
Expand Down

0 comments on commit 44d352e

Please sign in to comment.