diff options
author | Dan Crowell <dcrowell@us.ibm.com> | 2013-09-12 13:46:07 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2013-10-11 11:03:38 -0500 |
commit | d5adce60c0cc910171c2938e581f187a2083cba7 (patch) | |
tree | 4f7e0470c1d8fd3808f1e47746c8732184b221f3 /src/usr/pnor/pnorrp.H | |
parent | 6d19bd7f6660d4a0f739e883e2f5d0434419a135 (diff) | |
download | talos-hostboot-d5adce60c0cc910171c2938e581f187a2083cba7.tar.gz talos-hostboot-d5adce60c0cc910171c2938e581f187a2083cba7.zip |
PNOR ECC Support
Adding ECC support to the PNOR Resource Provider as well as the
makefiles that create the images.
Also fixed a bug in the PNOR DD for writes across erase blocks.
Change-Id: I31ff6817cd35728badcd23a48fa73e51727142b9
RTC: 66213
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/6203
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Reviewed-by: Michael Baiocchi <baiocchi@us.ibm.com>
Tested-by: Jenkins Server
Reviewed-by: ADAM R. MUHLE <armuhle@us.ibm.com>
Diffstat (limited to 'src/usr/pnor/pnorrp.H')
-rw-r--r-- | src/usr/pnor/pnorrp.H | 54 |
1 files changed, 30 insertions, 24 deletions
diff --git a/src/usr/pnor/pnorrp.H b/src/usr/pnor/pnorrp.H index bc15249d6..d246360b0 100644 --- a/src/usr/pnor/pnorrp.H +++ b/src/usr/pnor/pnorrp.H @@ -5,7 +5,7 @@ /* */ /* IBM CONFIDENTIAL */ /* */ -/* COPYRIGHT International Business Machines Corp. 2011,2012 */ +/* COPYRIGHT International Business Machines Corp. 2011,2013 */ /* */ /* p1 */ /* */ @@ -29,6 +29,7 @@ #include <builtins.h> #include <errl/errlentry.H> #include <vmmconst.h> +#include <map> /** * PNOR Resource Provider @@ -90,7 +91,7 @@ class PnorRP LAST_VADDR = BASE_VADDR + TOTAL_SIZE, /**< End of our VA range */ /** Real number of bytes required to read 1 logical page */ - PAGESIZE_PLUS_ECC = PAGESIZE * (9/8), // 8 bytes of data + 1 byte of ECC + PAGESIZE_PLUS_ECC = ((PAGESIZE * 9)/8), // 8B data + 1B of ECC SUPPORTED_FFS_VERSION = 0x1, /**< Supported FFS Version */ FFS_TABLE_BASE_ADDR = 0x0, /**< Currently only have FFS table */ @@ -106,10 +107,20 @@ class PnorRP uint32_t flashAddr; /**< Address in flash */ uint32_t size; /**< Actual size of content in bytes (not including ECC) */ uint8_t chip; /**< Chip Select */ - uint8_t miscFlags; /**<chip select, ECC Protect, sideless flags */ + uint8_t version; /**< Version Checking */ + uint16_t integrity; /**< Data Integrity */ + uint8_t misc; /**< Misc Flags */ } PACKED; /** + * Flash statistics + */ + struct FlashStats_t { + uint8_t numWrites; /**< Number of writes to this page */ + uint8_t numCEs; /**< Number of ECC corrections made */ + }; + + /** * Cached copy of section data */ SectionData_t iv_TOC[NUM_SIDES][PNOR::NUM_SECTIONS+1]; @@ -132,6 +143,18 @@ class PnorRP uint64_t iv_startupRC; /** + * Track some information related to flash wear and health + * indexed by physical page number inside PNOR + */ + std::map<uint64_t,FlashStats_t> iv_stats; + + /** + * Remember that we got a UE and we are shutting down + */ + bool iv_shutdownUE; + + + /** * @brief Initialize the daemon, called by constructor */ void initDaemon(); @@ -155,13 +178,16 @@ class PnorRP * @param[in] i_chip Which PNOR chip * @param[in] i_ecc true=apply ECC after reading * @param[out] o_dest Buffer to copy data into + * @param[out] o_fatalError true=fatal error encountered, but no + * log could be created * * @return Error from device */ errlHndl_t readFromDevice( uint64_t i_offset, uint64_t i_chip, bool i_ecc, - void* o_dest ); + void* o_dest, + bool& o_fatalError ); /** * @brief Write 1 logical page of data to the PNOR device @@ -207,26 +233,6 @@ class PnorRP PNOR::SectionId& o_id ); /** - * @brief Apply ECC algorithm to data - * - * @param[in] i_orig Original data to write - * @param[in] o_ecc Data after applying ECC - */ - void applyECC( void* i_orig, - void* o_ecc ); - - /** - * @brief Apply ECC algorithm to data, assumes size of 1 page - * - * @param[in] i_orig Original data that was read - * @param[in] o_data Data after removing ECC - * - * @return Error if ECC is incorrect - */ - errlHndl_t stripECC( void* i_orig, - void* o_data ); - - /** * @brief Returns true if the initial startup failed for some reason * @param[out] Return code * @return true if startup failed |