diff options
-rw-r--r-- | src/usr/hwpf/hwp/activate_powerbus/activate_powerbus.C | 2 | ||||
-rw-r--r-- | src/usr/sbe/sbe_update.C | 159 | ||||
-rw-r--r-- | src/usr/sbe/sbe_update.H | 10 |
3 files changed, 112 insertions, 59 deletions
diff --git a/src/usr/hwpf/hwp/activate_powerbus/activate_powerbus.C b/src/usr/hwpf/hwp/activate_powerbus/activate_powerbus.C index 239eb51ec..e7b3385dc 100644 --- a/src/usr/hwpf/hwp/activate_powerbus/activate_powerbus.C +++ b/src/usr/hwpf/hwp/activate_powerbus/activate_powerbus.C @@ -325,7 +325,7 @@ void * call_host_slave_sbe_update( void * io_pArgs ) // Call to check state of Processor SBE SEEPROMs and // make any necessary updates - // l_errl = SBE::updateProcessorSbeSeeproms(); + l_errl = SBE::updateProcessorSbeSeeproms(); TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_host_slave_sbe_update exit" ); diff --git a/src/usr/sbe/sbe_update.C b/src/usr/sbe/sbe_update.C index 5cef20df1..e08c8a069 100644 --- a/src/usr/sbe/sbe_update.C +++ b/src/usr/sbe/sbe_update.C @@ -5,7 +5,7 @@ /* */ /* IBM CONFIDENTIAL */ /* */ -/* COPYRIGHT International Business Machines Corp. 2013 */ +/* COPYRIGHT International Business Machines Corp. 2013,2014 */ /* */ /* p1 */ /* */ @@ -293,7 +293,8 @@ namespace SBE { TRACFCOMP( g_trac_sbe, INFO_MRK"updateProcessorSbeSeeproms(): Restart " - "Needed (%d). Calling preReIplCheck()"); + "Needed (%d). Calling preReIplCheck()", + l_restartNeeded); err = preReIplCheck(sbeStates_vector); @@ -669,8 +670,8 @@ namespace SBE o_actImgSize = static_cast<size_t>(tmpImgSize); TRACUCOMP( g_trac_sbe, "procCustomizeSbeImg(): " - "p8_xip_customize success=%d, procIOMask=0x%X ", - "o_actImgSize=0x%X, rc_fapi=0x%X, ", + "p8_xip_customize success=%d, procIOMask=0x%X " + "o_actImgSize=0x%X, rc_fapi=0x%X", procedure_success, procIOMask, o_actImgSize, uint32_t(rc_fapi)); @@ -966,12 +967,12 @@ namespace SBE TARGETING::get_huid(i_target)); break; } - TRACDBIN(g_trac_sbe, "MVPD:SB", &io_sb_keyword, vpdSize); + TRACDBIN(g_trac_sbe, "MVPD:SB:r", &io_sb_keyword, vpdSize); } else //write { - TRACDBIN(g_trac_sbe, "MVPD:SB", &io_sb_keyword, vpdSize); + TRACDBIN(g_trac_sbe, "MVPD:SB:w", &io_sb_keyword, vpdSize); err = deviceWrite( i_target, reinterpret_cast<void*>( &io_sb_keyword ), @@ -1759,37 +1760,51 @@ namespace SBE bool current_side_isDirty = false; bool alt_side_isDirty = false; + bool pnor_check_dirty = false; + bool crc_check_dirty = false; + bool isSimics_check = false; do{ - - /**************************************************************/ /* Compare SEEPROM 0 with PNOR and Customized Image CRC -- */ /* -- dirty or clean? */ /**************************************************************/ - if ( - ( // Standard Checks: - - // Check PNOR and SEEPROM 0 Version - (0 != memcmp(&(io_sbeState.pnorVersion), + // Check PNOR and SEEPROM 0 Version + if ( 0 != memcmp(&(io_sbeState.pnorVersion), &(io_sbeState.seeprom_0_ver.image_version), - SBE_IMAGE_VERSION_SIZE)) - || - // Check CRC and SEEPROM 0 CRC - (0 != memcmp(&(io_sbeState.customizedImage_crc), - &(io_sbeState.seeprom_0_ver.data_crc), - SBE_DATA_CRC_SIZE)) - ) - && - ( // Simics Check: - // Look for simics specific version - consider clean if found - ( io_sbeState.seeprom_0_ver.struct_version != - SBE_SEEPROM_STRUCT_SIMICS_VERSION) - ) - ) + SBE_IMAGE_VERSION_SIZE) ) + { + pnor_check_dirty = true; + } + + // Check CRC and SEEPROM 0 CRC + if ( io_sbeState.customizedImage_crc != + io_sbeState.seeprom_0_ver.data_crc ) + { + crc_check_dirty = true; + } + + // Check if in simics + // @todo RTC 94883 - Update this check with a magic instruction + if ( io_sbeState.seeprom_0_ver.struct_version == + SBE_SEEPROM_STRUCT_SIMICS_VERSION ) + { + isSimics_check = true; + } + + + if ( (pnor_check_dirty || crc_check_dirty ) + && !isSimics_check ) { seeprom_0_isDirty = true; + TRACFCOMP( g_trac_sbe, INFO_MRK"SBE Update tgt=0x%X: Seeprom0 " + "dirty: pnor=%d, crc=%d (custom=0x%X/s0=0x%X), " + "isSimics=%d", + TARGETING::get_huid(io_sbeState.target), + pnor_check_dirty, crc_check_dirty, + io_sbeState.customizedImage_crc, + io_sbeState.seeprom_0_ver.data_crc, isSimics_check); } @@ -1798,35 +1813,76 @@ namespace SBE /* Compare SEEPROM 1 with PNOR and Customized Image CRC -- */ /* -- dirty or clean? */ /**************************************************************/ - if ( - ( // Standard Checks: - - // Check PNOR and SEEPROM 1 Version - (0 != memcmp(&(io_sbeState.pnorVersion), - &(io_sbeState.seeprom_1_ver.image_version), - SBE_IMAGE_VERSION_SIZE)) - || - // Check CRC and SEEPROM 1 CRC - (0 != memcmp(&(io_sbeState.customizedImage_crc), - &(io_sbeState.seeprom_1_ver.data_crc), - SBE_DATA_CRC_SIZE)) - ) - && - ( // Simics Check: - // Look for simics specific version - consider clean if found - ( io_sbeState.seeprom_1_ver.struct_version != - SBE_SEEPROM_STRUCT_SIMICS_VERSION) - ) - ) + // reset dirty variables + pnor_check_dirty = false; + crc_check_dirty = false; + isSimics_check = false; + + // Check PNOR and SEEPROM 1 Version + if ( 0 != memcmp(&(io_sbeState.pnorVersion), + &(io_sbeState.seeprom_1_ver.image_version), + SBE_IMAGE_VERSION_SIZE) ) + { + pnor_check_dirty = true; + } + + // Check CRC and SEEPROM 1 CRC + if ( io_sbeState.customizedImage_crc != + io_sbeState.seeprom_1_ver.data_crc ) + { + crc_check_dirty = true; + } + + // Check if in simics + // @todo RTC 94883 - Update this check with a magic instruction + if ( io_sbeState.seeprom_1_ver.struct_version == + SBE_SEEPROM_STRUCT_SIMICS_VERSION ) + { + isSimics_check = true; + } + + if ( (pnor_check_dirty || crc_check_dirty ) + && !isSimics_check ) { seeprom_1_isDirty = true; + TRACFCOMP( g_trac_sbe, INFO_MRK"SBE Update tgt=0x%X: Seeprom1 " + "dirty: pnor=%d, crc=%d (custom=0x%X/s0=0x%X), " + "isSimics=%d", + TARGETING::get_huid(io_sbeState.target), + pnor_check_dirty, crc_check_dirty, + io_sbeState.customizedImage_crc, + io_sbeState.seeprom_1_ver.data_crc, isSimics_check); + } + + + // Extra information for unit testing + if ( seeprom_0_isDirty || seeprom_1_isDirty ) + { + TRACFBIN( g_trac_sbe, + "PNOR Version", + &(io_sbeState.pnorVersion), + SBE_IMAGE_VERSION_SIZE ) ; + + TRACFBIN( g_trac_sbe, + "Seeprom0: Image Version", + &(io_sbeState.seeprom_0_ver.image_version), + SBE_IMAGE_VERSION_SIZE ) ; + + TRACFBIN( g_trac_sbe, + "Seeprom1: Image Version", + &(io_sbeState.seeprom_1_ver.image_version), + SBE_IMAGE_VERSION_SIZE ) ; + + TRACFBIN( g_trac_sbe, + "MVPD SB", + &(io_sbeState.mvpdSbKeyword), + sizeof(mvpdSbKeyword_t)); } /**************************************************************/ /* Determine what side to update */ /**************************************************************/ - // Set cur and alt isDirty values if( io_sbeState.cur_seeprom_side == SBE_SEEPROM0 ) { @@ -1893,7 +1949,7 @@ namespace SBE memcpy( &(io_sbeState.new_seeprom_ver.data_crc), &(io_sbeState.customizedImage_crc), - SBE_DATA_CRC_SIZE); + sizeof(io_sbeState.new_seeprom_ver.data_crc)); // If there was an ECC fail on either SEEPROM, do a read-back // Check when writing this information to the SEEPROM @@ -1901,7 +1957,6 @@ namespace SBE io_sbeState.seeprom_0_ver_ECC_fail || io_sbeState.seeprom_1_ver_ECC_fail); - TRACDBIN( g_trac_sbe, "getTargetUpdateActions() - New SBE Version Info", &(io_sbeState.new_seeprom_ver), @@ -1919,7 +1974,7 @@ namespace SBE { memcpy(&(io_sbeState.mvpdSbKeyword.seeprom_0_data_crc), &(io_sbeState.customizedImage_crc), - SBE_DATA_CRC_SIZE); + sizeof(io_sbeState.mvpdSbKeyword.seeprom_0_data_crc)); memcpy(&(io_sbeState.mvpdSbKeyword.seeprom_0_short_version), &(io_sbeState.pnorVersion), @@ -1929,7 +1984,7 @@ namespace SBE { memcpy(&(io_sbeState.mvpdSbKeyword.seeprom_1_data_crc), &(io_sbeState.customizedImage_crc), - SBE_DATA_CRC_SIZE); + sizeof(io_sbeState.mvpdSbKeyword.seeprom_1_data_crc)); memcpy(&(io_sbeState.mvpdSbKeyword.seeprom_1_short_version), &(io_sbeState.pnorVersion), diff --git a/src/usr/sbe/sbe_update.H b/src/usr/sbe/sbe_update.H index 810cdc765..9c602203f 100644 --- a/src/usr/sbe/sbe_update.H +++ b/src/usr/sbe/sbe_update.H @@ -5,7 +5,7 @@ /* */ /* IBM CONFIDENTIAL */ /* */ -/* COPYRIGHT International Business Machines Corp. 2013 */ +/* COPYRIGHT International Business Machines Corp. 2013,2014 */ /* */ /* p1 */ /* */ @@ -37,8 +37,6 @@ namespace SBE /******************************************/ /* Constants */ /******************************************/ - // Size of CRC used for version checking - const size_t SBE_DATA_CRC_SIZE = 4; // 4 bytes (32 bits) // Using only first 20 bytes of 64-byte sbe_image_version const size_t SBE_MVPD_SHORT_IMAGE_VERSION_SIZE = 20; @@ -144,8 +142,8 @@ namespace SBE struct sbeSeepromVersionInfo_t { uint32_t struct_version; + uint32_t data_crc; uint8_t image_version[SBE_IMAGE_VERSION_SIZE]; - uint8_t data_crc[SBE_DATA_CRC_SIZE]; } PACKED; // This line forces a compile fail if struct is NOT 8-byte-alaigned @@ -180,10 +178,10 @@ namespace SBE { uint8_t flags; // 1 byte for various flags - uint8_t seeprom_0_data_crc[SBE_DATA_CRC_SIZE]; + uint32_t seeprom_0_data_crc; uint8_t seeprom_0_short_version[SBE_MVPD_SHORT_IMAGE_VERSION_SIZE]; - uint8_t seeprom_1_data_crc[SBE_DATA_CRC_SIZE]; + uint32_t seeprom_1_data_crc; uint8_t seeprom_1_short_version[SBE_MVPD_SHORT_IMAGE_VERSION_SIZE]; } PACKED; |