summaryrefslogtreecommitdiffstats
path: root/src/usr/pnor/pnorrp.C
diff options
context:
space:
mode:
authorPrachi Gupta <pragupta@us.ibm.com>2014-12-10 10:12:03 -0600
committerA. Patrick Williams III <iawillia@us.ibm.com>2015-01-29 16:38:34 -0600
commit37f68a01d02d98f995ab3f46035f1db42ac75576 (patch)
tree9fff119447e156192723e89856a6e96f65c27c7d /src/usr/pnor/pnorrp.C
parentf51150123d9a0fe86c63d9681dc819cb97db7c1d (diff)
downloadtalos-hostboot-37f68a01d02d98f995ab3f46035f1db42ac75576.tar.gz
talos-hostboot-37f68a01d02d98f995ab3f46035f1db42ac75576.zip
check and fix ecc errors for a given section in PNOR
Change-Id: I99ffe4f8bca0e22c72099105ab4fe8aaf7872d8e RTC: 100967 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/14985 Tested-by: Jenkins Server Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Reviewed-by: STEPHEN M. CPREK <smcprek@us.ibm.com> Reviewed-by: Brian H. Horton <brianh@linux.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/pnor/pnorrp.C')
-rw-r--r--src/usr/pnor/pnorrp.C66
1 files changed, 65 insertions, 1 deletions
diff --git a/src/usr/pnor/pnorrp.C b/src/usr/pnor/pnorrp.C
index 03f1a74d6..299a063f4 100644
--- a/src/usr/pnor/pnorrp.C
+++ b/src/usr/pnor/pnorrp.C
@@ -38,7 +38,7 @@
#include <initservice/initserviceif.H>
#include "pnordd.H"
#include "ffs.h" //Common header file with BuildingBlock.
-#include "common/ffs_hb.H" //Hostboot definition of user data in ffs_entry struct.
+#include "common/ffs_hb.H"//Hostboot definition of user data in ffs_entry struct
#include <pnor/ecc.H>
#include <kernel/console.H>
#include <endian.h>
@@ -124,6 +124,15 @@ errlHndl_t PNOR::flush( PNOR::SectionId i_section)
} while (0);
return l_err;
}
+
+/**
+ * @brief check and fix correctable ECC for a given pnor section
+ */
+errlHndl_t PNOR::fixECC(PNOR::SectionId i_section)
+{
+ return Singleton<PnorRP>::instance().fixECC(i_section);
+}
+
/**
* STATIC
* @brief Static Initializer
@@ -923,3 +932,58 @@ errlHndl_t PnorRP::clearSection(PNOR::SectionId i_section)
return l_errl;
}
+
+/**
+ * @brief check and fix correctable ECC errors for a given section
+ */
+errlHndl_t PnorRP::fixECC (PNOR::SectionId i_section)
+{
+ errlHndl_t l_err = NULL;
+ uint8_t* l_buffer = new uint8_t [PAGESIZE] ();
+ do {
+ TRACFCOMP(g_trac_pnor, ENTER_MRK"PnorRP::fixECC");
+
+ //get info from the TOC
+ uint8_t* l_virtAddr = reinterpret_cast<uint8_t*>
+ (iv_TOC[i_section].virtAddr);
+ uint32_t l_size = iv_TOC[i_section].size;
+ bool l_ecc = iv_TOC[i_section].integrity&FFS_INTEG_ECC_PROTECT;
+
+ if (!l_ecc)
+ {
+ TRACFCOMP(g_trac_pnor, "PnorRP::fixECC: section is not"
+ " ecc protected");
+ /*@
+ * @errortype ERRL_SEV_INFORMATIONAL
+ * @moduleid PNOR::MOD_PNORRP_FIXECC
+ * @reasoncode PNOR::RC_NON_ECC_PROTECTED_SECTION
+ * @userdata1 Section ID
+ * @userdata2 0
+ *
+ * @devdesc Non ECC protected section is passed to fixECC
+ */
+ l_err = new ERRORLOG::ErrlEntry(
+ ERRORLOG::ERRL_SEV_INFORMATIONAL,
+ PNOR::MOD_PNORRP_FIXECC,
+ PNOR::RC_NON_ECC_PROTECTED_SECTION,
+ i_section,
+ 0,true);
+ break;
+ }
+
+ uint32_t l_numOfPages = (l_size)/PAGESIZE;
+
+ //loop over number of pages in a section
+ for (uint32_t i = 0; i < l_numOfPages; i++)
+ {
+ TRACDCOMP(g_trac_pnor, "PnorRP::fixECC: memcpy virtAddr:0x%X",
+ l_virtAddr);
+ memcpy(l_buffer, l_virtAddr, PAGESIZE);
+ l_virtAddr += PAGESIZE;
+ }
+ } while (0);
+
+ delete [] l_buffer;
+ TRACFCOMP(g_trac_pnor, EXIT_MRK"PnorRP::fixECC");
+ return l_err;
+}
OpenPOWER on IntegriCloud