@@ -759,6 +759,7 @@ void IpzVpdParser::performSanityCheck(const types::RecordData& i_recordDetails,
759759 // fails post update.
760760 if (i_isPreCheck)
761761 {
762+ std::cout << " processing pre check" << std::endl;
762763 m_recordData.resize (std::get<1 >(i_recordDetails));
763764 m_eccData.resize (std::get<3 >(i_recordDetails));
764765
@@ -775,14 +776,20 @@ void IpzVpdParser::performSanityCheck(const types::RecordData& i_recordDetails,
775776
776777 auto l_itrToVpd = m_vpdVector.cbegin ();
777778 types::BinaryVector l_updatedVpdVector;
779+
780+ // Copy so that ECC check algo does not correct the data;
781+ types::BinaryVector l_copyUpdatedVpdVector;
778782 if (!i_isPreCheck)
779783 {
784+ std::cout << " Reading vector data post update" << std::endl;
780785 // re-read the updated data
781786 // types::BinaryVector l_tempVpdVector;
782787 vpdSpecificUtility::getVpdDataInVector (
783788 m_vpdFilePath, l_updatedVpdVector, m_vpdStartOffset);
784-
785- l_itrToVpd = l_updatedVpdVector.begin ();
789+
790+ l_copyUpdatedVpdVector.resize (l_updatedVpdVector.size ());
791+ l_copyUpdatedVpdVector = l_updatedVpdVector;
792+ l_itrToVpd = l_copyUpdatedVpdVector.begin ();
786793 }
787794
788795 auto l_status = vpdecc_check_data (
@@ -793,6 +800,15 @@ void IpzVpdParser::performSanityCheck(const types::RecordData& i_recordDetails,
793800
794801 if (l_status != VPD_ECC_OK)
795802 {
803+ if (i_isPreCheck)
804+ {
805+ std::cout << " Check failed pre update" << std::endl;
806+ }
807+ else
808+ {
809+ std::cout << " Check failed post update" << std::endl;
810+ }
811+
796812 // Implies ECC check is not ok for the record, sanity check failed. Dump
797813 // data
798814 std::string l_recordFile =
@@ -810,6 +826,11 @@ void IpzVpdParser::performSanityCheck(const types::RecordData& i_recordDetails,
810826
811827 if (!i_isPreCheck)
812828 {
829+ if (!i_isPreCheck)
830+ {
831+ std::cout << " Check failed post update" << std::endl;
832+ }
833+
813834 types::BinaryVector l_recordData;
814835 l_recordData.resize (std::get<1 >(i_recordDetails));
815836 types::BinaryVector l_eccData;
@@ -845,6 +866,17 @@ void IpzVpdParser::performSanityCheck(const types::RecordData& i_recordDetails,
845866 throw std::runtime_error (
846867 " Pre Sanity check failed for file " + m_vpdFilePath);
847868 }
869+ else if (l_status == VPD_ECC_OK)
870+ {
871+ if (i_isPreCheck)
872+ {
873+ std::cout << " Status returned ok for Pre-check" << std::endl;
874+ }
875+ else
876+ {
877+ std::cout << " Status returned ok for Post-check" << std::endl;
878+ }
879+ }
848880}
849881
850882int IpzVpdParser::writeKeywordOnHardware (
@@ -934,6 +966,32 @@ int IpzVpdParser::writeKeywordOnHardware(
934966 " bytes updated successfully on hardware for " +
935967 l_recordName + " :" + l_keywordName);
936968
969+ std::cout<<" Checking Ecc just after write" <<std::endl;
970+ types::BinaryVector l_updatedVpdVector;
971+ vpdSpecificUtility::getVpdDataInVector (
972+ m_vpdFilePath, l_updatedVpdVector, m_vpdStartOffset);
973+
974+ l_itrToVpd = l_updatedVpdVector.begin ();
975+
976+ auto l_status = vpdecc_check_data (
977+ const_cast <uint8_t *>(&l_itrToVpd[std::get<0 >(l_inputRecordDetails)]),
978+ std::get<1 >(l_inputRecordDetails),
979+ const_cast <uint8_t *>(&l_itrToVpd[std::get<2 >(l_inputRecordDetails)]),
980+ std::get<3 >(l_inputRecordDetails));
981+
982+ if (l_status != VPD_ECC_OK)
983+ {
984+ if (l_status == VPD_ECC_CORRECTABLE_DATA)
985+ {
986+ std::cout<<" One bit corruption happened" <<std::endl;
987+ }
988+ else
989+ {
990+ std::cout<<" ECC check failed just after update" <<std::endl;
991+ }
992+ }
993+
994+
937995#if SANITY_CHECK == 1
938996 // before exiting do a sanity check
939997 performSanityCheck (l_inputRecordDetails, false );
0 commit comments