summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Filippov <a.filippov@yadro.com>2019-12-18 12:06:47 +0300
committerAlexander Filippov <a.filippov@yadro.com>2019-12-20 10:23:22 +0300
commitfa9a6bec4bbf062f0fd670357fb7ee0731c3f241 (patch)
tree40d996d2bdedb2e736847c0186cedefc09e25f45
parent59d5657643c1cd24de579867abff1dcfa54d3803 (diff)
downloadopenpower-pnor-code-mgmt-fa9a6bec4bbf062f0fd670357fb7ee0731c3f241.tar.gz
openpower-pnor-code-mgmt-fa9a6bec4bbf062f0fd670357fb7ee0731c3f241.zip
Fix ECC usage of being cleaned partitions
Reset procedure of PNOR works improperly for our P8 based VESNIN hardware and makes the host unbootable. The problem is in incorrect partition cleaning. Hostboot for P8 has no support for CLEARECC bit and PNOR flash has no partitions with flag 'C'. P9 based hardware is not affected until PNOR has partitions with ECC flag only. This commit modifies the reset procedure to make it use the flag 'E' (ECC) instead of 'C' (CLEARECC). * The flag 'E' means that the partition requires ECC. * The flag 'C' means that the partition might be cleaned by hostboot when ECC is wrong. For details see: https://github.com/open-power/hostboot/blob/75c0908b91275dc10bd17cb0f10b452f32ce0b91/src/include/usr/pnor/pnor_const.H#L128 Tested: All PNOR partitions with enabled flags 'E' and 'F' should be cleaned with ECC. Change-Id: I632e90c8e256df3445fc3d1f45c830d155a1d208 Signed-off-by: Alexander Filippov <a.filippov@yadro.com>
-rw-r--r--static/item_updater_static.cpp4
-rw-r--r--test/test_item_updater_static.cpp59
2 files changed, 61 insertions, 2 deletions
diff --git a/static/item_updater_static.cpp b/static/item_updater_static.cpp
index b79028bc7..e867a83a7 100644
--- a/static/item_updater_static.cpp
+++ b/static/item_updater_static.cpp
@@ -147,7 +147,7 @@ std::vector<PartClear> getPartsToClear(const std::string& info)
// Each line looks like
// ID=06 MVPD 0x0012d000..0x001bd000 (actual=0x00090000) [E--P--F-C-]
// Flag 'F' means REPROVISION
- // Flag 'C' means CLEARECC
+ // Flag 'E' means ECC required
auto pos = line.find('[');
if (pos == std::string::npos)
{
@@ -178,7 +178,7 @@ std::vector<PartClear> getPartsToClear(const std::string& info)
}
line = line.substr(0, pos); // The part name
- bool ecc = flags.find('C') != std::string::npos;
+ bool ecc = flags.find('E') != std::string::npos;
ret.emplace_back(line, ecc);
}
}
diff --git a/test/test_item_updater_static.cpp b/test/test_item_updater_static.cpp
index d4385c2c2..80c2fd2a6 100644
--- a/test/test_item_updater_static.cpp
+++ b/test/test_item_updater_static.cpp
@@ -127,3 +127,62 @@ TEST(TestItemUpdaterStatic, getPartsToClearNotOK)
EXPECT_EQ("ATTR_PERM", parts[0].first);
EXPECT_TRUE(parts[0].second);
}
+
+TEST(TestItemUpdaterStatic, getPartsToClearP8BasedOK)
+{
+ // NOTE: P8 doesn't support CLEARECC flags.
+ constexpr auto info = R"(
+Flash info:
+-----------
+Name = /dev/mtd6
+Total size = 64MB Flags E:ECC, P:PRESERVED, R:READONLY, B:BACKUP
+Erase granule = 64KB F:REPROVISION, V:VOLATILE, C:CLEARECC
+
+TOC@0x00000000 Partitions:
+-----------
+ID=00 part 0x00000000..0x00001000 (actual=0x00001000) [----R-----]
+ID=01 HBEL 0x00008000..0x0002c000 (actual=0x00024000) [E-----F---]
+ID=02 GUARD 0x0002c000..0x00031000 (actual=0x00005000) [E--P--F---]
+ID=03 HBD 0x00031000..0x0008b000 (actual=0x0005a000) [E---R-----]
+ID=04 HBD_RW 0x0008b000..0x00091000 (actual=0x00006000) [E---------]
+ID=05 DJVPD 0x00091000..0x000d9000 (actual=0x00048000) [E-----F---]
+ID=06 MVPD 0x000d9000..0x00169000 (actual=0x00090000) [E-----F---]
+ID=07 CVPD 0x00169000..0x001b1000 (actual=0x00048000) [E-----F---]
+ID=08 HBI 0x001b1000..0x00751000 (actual=0x005a0000) [EL--R-----]
+ID=09 SBEC 0x00751000..0x007e1000 (actual=0x00090000) [E-I-R-----]
+ID=10 SBE 0x007e1000..0x00829000 (actual=0x00048000) [E-I-R-----]
+ID=11 WINK 0x00829000..0x00949000 (actual=0x00120000) [EL--R-----]
+ID=12 HBRT 0x00949000..0x00ca9000 (actual=0x00360000) [EL--R-----]
+ID=13 PAYLOAD 0x00ca9000..0x00d29000 (actual=0x00080000) [----R-----]
+ID=14 BOOTKERNEL 0x00d29000..0x01ca9000 (actual=0x00f80000) [----R-----]
+ID=15 ATTR_TMP 0x01ca9000..0x01cb1000 (actual=0x00008000) [------F---]
+ID=16 ATTR_PERM 0x01cb1000..0x01cb9000 (actual=0x00008000) [E-----F---]
+ID=17 OCC 0x01cb9000..0x01dd9000 (actual=0x00120000) [E---R-----]
+ID=18 TEST 0x01dd9000..0x01de2000 (actual=0x00009000) [E---------]
+ID=19 NVRAM 0x01de2000..0x01e72000 (actual=0x00090000) [---P--F---]
+ID=20 FIRDATA 0x01e72000..0x01e75000 (actual=0x00003000) [E-----F---]
+ID=21 BMC_INV 0x01e75000..0x01e7e000 (actual=0x00009000) [------F---]
+ID=22 CAPP 0x01e7e000..0x01ea2000 (actual=0x00024000) [E---R-----]
+ID=23 SECBOOT 0x01ea2000..0x01ec6000 (actual=0x00024000) [E--P------]
+ID=24 IMA_CATALOG 0x01ec6000..0x01ecf000 (actual=0x00009000) [E---R-F---]
+ID=25 HBB 0x01f60000..0x01ff0000 (actual=0x00090000) [EL--R-----]
+ID=26 VERSION 0x01ff7000..0x01ff8000 (actual=0x00001000) [----R-----]
+ID=27 BACKUP_PART 0x01ff8000..0x02000000 (actual=0x00000000) [----RB----]
+ID=28 OTHER_SIDE 0x02000000..0x02008000 (actual=0x00000000) [----RB----]
+ )";
+
+ auto parts = utils::getPartsToClear(info);
+ EXPECT_EQ(11, parts.size());
+
+ EXPECT_EQ("HBEL", parts[0].first);
+ EXPECT_TRUE(parts[0].second);
+
+ EXPECT_EQ("GUARD", parts[1].first);
+ EXPECT_TRUE(parts[1].second);
+
+ EXPECT_EQ("NVRAM", parts[7].first);
+ EXPECT_FALSE(parts[7].second);
+
+ EXPECT_EQ("IMA_CATALOG", parts[10].first);
+ EXPECT_TRUE(parts[10].second);
+}
OpenPOWER on IntegriCloud