summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Jeffery <andrew@aj.id.au>2018-03-02 12:00:42 +1030
committerAndrew Jeffery <andrew@aj.id.au>2018-03-24 13:59:32 +1030
commit0f9fbd6861ed70919c219969d0168947f1760653 (patch)
tree3522a691aed8a52d403ee811d1aa4ab8813a93cd
parent9b25b59188703da3350ab36319e6af707d4e88ae (diff)
downloadphosphor-mboxd-0f9fbd6861ed70919c219969d0168947f1760653.zip
phosphor-mboxd-0f9fbd6861ed70919c219969d0168947f1760653.tar.gz
pnor_partition_table: Fixes for flag handling in writeUserData()
This is a collection of small fixes: * Always initialise the field for PARTITION_ECC_PROTECTED so it doesn't contain garbage * Provide a warning when we encounter a flag we don't understand * Ignore empty flags so we don't trigger the unknown flag warning * Unset the READONLY bit if we encounter READWRITE, implementing last-configuration-wins rather than sticky-readonly Change-Id: I3dd45139716fe241f9d3e7997e1269d13de638ca Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
-rw-r--r--pnor_partition_table.cpp18
-rw-r--r--test/vpnor/Makefile.am.include2
2 files changed, 16 insertions, 4 deletions
diff --git a/pnor_partition_table.cpp b/pnor_partition_table.cpp
index 19bee87..67b32f1 100644
--- a/pnor_partition_table.cpp
+++ b/pnor_partition_table.cpp
@@ -222,17 +222,26 @@ static inline void writeUserdata(pnor_partition& part, uint32_t version,
std::istringstream stream(data);
std::string flag{};
auto perms = 0;
+ auto state = 0;
+ MSG_DBG("Parsing ToC flags '%s'\n", data.c_str());
while (std::getline(stream, flag, ','))
{
+ if (flag == "")
+ continue;
+
if (flag == "ECC")
{
- part.data.user.data[0] = PARTITION_ECC_PROTECTED;
+ state |= PARTITION_ECC_PROTECTED;
}
else if (flag == "READONLY")
{
perms |= PARTITION_READONLY;
}
+ else if (flag == "READWRITE")
+ {
+ perms &= ~PARTITION_READONLY;
+ }
else if (flag == "PRESERVED")
{
perms |= PARTITION_PRESERVED;
@@ -249,10 +258,15 @@ static inline void writeUserdata(pnor_partition& part, uint32_t version,
{
perms |= PARTITION_CLEARECC;
}
+ else
+ {
+ MSG_INFO("Found unimplemented partition property: %s\n",
+ flag.c_str());
+ }
}
+ part.data.user.data[0] = state;
part.data.user.data[1] = perms;
-
part.data.user.data[1] |= version;
}
diff --git a/test/vpnor/Makefile.am.include b/test/vpnor/Makefile.am.include
index 4defe01..2a39ae1 100644
--- a/test/vpnor/Makefile.am.include
+++ b/test/vpnor/Makefile.am.include
@@ -121,6 +121,4 @@ check_PROGRAMS += \
%reldir%/toc_no_end \
%reldir%/toc_no_version \
%reldir%/toc_flags
-
-XFAIL_TESTS += %reldir%/toc_flags
endif
OpenPOWER on IntegriCloud