summaryrefslogtreecommitdiffstats
path: root/src/include/usr/pnor/ecc.H
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/usr/pnor/ecc.H')
-rw-r--r--src/include/usr/pnor/ecc.H25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/include/usr/pnor/ecc.H b/src/include/usr/pnor/ecc.H
index 3f4b7cef6..80c993c96 100644
--- a/src/include/usr/pnor/ecc.H
+++ b/src/include/usr/pnor/ecc.H
@@ -5,7 +5,9 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* COPYRIGHT International Business Machines Corp. 2013,2014 */
+/* Contributors Listed Below - COPYRIGHT 2013,2017 */
+/* [+] International Business Machines Corp. */
+/* */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); */
/* you may not use this file except in compliance with the License. */
@@ -25,6 +27,10 @@
#include <stdint.h>
+#ifdef __HOSTBOOT_MODULE
+#include <assert.h>
+#endif
+
/** @file ecc.H
* @brief Interfaces for the P8 8-byte ECC algorithm.
*/
@@ -78,6 +84,23 @@ namespace ECC
eccStatus removeECC(uint8_t* io_src,
uint8_t* o_dst, size_t i_dstSz);
+#ifdef __HOSTBOOT_MODULE
+ /** Given the size of Data, return the size of Data+ECC
+ *
+ * @param[in] i_sizeWithoutEcc Size in bytes of data without ECC
+ *
+ * @note i_sizeWithoutEcc must be a multiple of 8 bytes or will assert
+ *
+ * @return size of data with ECC
+ */
+ inline size_t sizeWithEcc(const size_t i_sizeWithoutEcc)
+ {
+ bool noRemainder = (i_sizeWithoutEcc % 8) == 0 ? true : false;
+ assert (noRemainder, "PNOR::ECC::sizeWithEcc: input needs to be multiple of 8 bytes");
+ return (i_sizeWithoutEcc * 9) / 8;
+ }
+#endif
+
}
}
OpenPOWER on IntegriCloud