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