blob: c9385d203f36e5349465189735afaec3ddab72c4 [file] [log] [blame]
Matt Ploetz72ce4622015-04-30 08:36:21 -05001From 69e22b2f8c8425b4f2ec8f7adcf164afed7f2ff8 Mon Sep 17 00:00:00 2001
2From: Dan Crowell <dcrowell@us.ibm.com>
3Date: Mon, 27 Apr 2015 13:48:57 -0500
4Subject: [PATCH] Fix handling of ECC protected partitions at runtime
5
6Modify the code to only check ECC on the logical size of the data
7that is read, rather than on the full physical size.
8
9Change-Id: Ia45989e64ef70e63542274ef59df2cc755f8082e
10---
11 src/usr/pnor/runtime/rt_pnor.C | 4 +++-
12 1 file changed, 3 insertions(+), 1 deletion(-)
13
14diff --git a/src/usr/pnor/runtime/rt_pnor.C b/src/usr/pnor/runtime/rt_pnor.C
15index d434f26..6e52999 100644
16--- a/src/usr/pnor/runtime/rt_pnor.C
17+++ b/src/usr/pnor/runtime/rt_pnor.C
18@@ -405,10 +405,12 @@ errlHndl_t RtPnor::readFromDevice (uint64_t i_procId,
19 {
20 TRACFCOMP(g_trac_pnor, "RtPnor::readFromDevice: removing ECC...");
21 // remove the ECC and fix the original data if it is broken
22+ size_t l_eccSize = (l_rc/9)*8;
23+ l_eccSize = std::min( l_eccSize, i_size );
24 PNOR::ECC::eccStatus ecc_stat =
25 PNOR::ECC::removeECC(reinterpret_cast<uint8_t*>(l_dataToRead),
26 reinterpret_cast<uint8_t*>(o_data),
27- l_rc); //actual size of read data
28+ l_eccSize); //logical size of read data
29
30 // create an error if we couldn't correct things
31 if( ecc_stat == PNOR::ECC::UNCORRECTABLE )
32--
331.8.2.2
34