diff options
Diffstat (limited to 'src/usr/sbe')
-rw-r--r-- | src/usr/sbe/sbe_update.C | 95 | ||||
-rw-r--r-- | src/usr/sbe/sbe_update.H | 38 | ||||
-rw-r--r-- | src/usr/sbe/test/sbeupdatetest.H | 24 |
3 files changed, 44 insertions, 113 deletions
diff --git a/src/usr/sbe/sbe_update.C b/src/usr/sbe/sbe_update.C index 9dd9e0a6f..698d41a8c 100644 --- a/src/usr/sbe/sbe_update.C +++ b/src/usr/sbe/sbe_update.C @@ -1214,49 +1214,6 @@ namespace SBE } ///////////////////////////////////////////////////////////////////// - errlHndl_t getSbeBootSeeprom(TARGETING::Target* i_target, - sbeSeepromSide_t& o_bootSide) - { - TRACUCOMP( g_trac_sbe, - ENTER_MRK"getSbeBootSeeprom()" ); - - errlHndl_t err = NULL; - uint64_t scomData = 0x0; - - o_bootSide = SBE_SEEPROM0; - - do{ - - size_t op_size = sizeof(scomData); - err = deviceRead( i_target, - &scomData, - op_size, - DEVICE_SCOM_ADDRESS(SBE_VITAL_REG_0x0005001C) ); - if( err ) - { - TRACFCOMP( g_trac_sbe, ERR_MRK"getSbeBootSeeprom() -Error " - "reading SBE VITAL REG (0x%.8X) from Target :" - "HUID=0x%.8X", - SBE_VITAL_REG_0x0005001C, - TARGETING::get_huid(i_target)); - break; - } - if(scomData & SBE_BOOT_SELECT_MASK) - { - o_bootSide = SBE_SEEPROM1; - } - - }while(0); - - TRACUCOMP( g_trac_sbe, - EXIT_MRK"getSbeBootSeeprom(): o_bootSide=0x%X (reg=0x%X)", - o_bootSide, scomData ); - - return err; - } - - -///////////////////////////////////////////////////////////////////// errlHndl_t getSbeInfoState(sbeTargetState_t& io_sbeState) { @@ -1351,11 +1308,11 @@ namespace SBE if(SEEPROM_0_PERMANENT_VALUE == (io_sbeState.mvpdSbKeyword.flags & PERMANENT_FLAG_MASK)) { - io_sbeState.permanent_seeprom_side = SBE_SEEPROM0; + io_sbeState.permanent_seeprom_side = PNOR::SBE_SEEPROM0; } else // Side 1 must be permanent { - io_sbeState.permanent_seeprom_side = SBE_SEEPROM1; + io_sbeState.permanent_seeprom_side = PNOR::SBE_SEEPROM1; } @@ -1404,21 +1361,21 @@ namespace SBE /* Determine which SEEPROM System Booted On */ /***********************************************/ //Get Current (boot) Side - sbeSeepromSide_t tmp_cur_side = SBE_SEEPROM_INVALID; - err = getSbeBootSeeprom(io_sbeState.target, tmp_cur_side); + PNOR::sbeSeepromSide_t tmp_cur_side = PNOR::SBE_SEEPROM_INVALID; + err = PNOR::getSbeBootSeeprom(io_sbeState.target, tmp_cur_side); if(err) { TRACFCOMP( g_trac_sbe, ERR_MRK"getSbeInfoState() - Error returned from getSbeBootSeeprom()"); break; } io_sbeState.cur_seeprom_side = tmp_cur_side; - if (io_sbeState.cur_seeprom_side == SBE_SEEPROM0) + if (io_sbeState.cur_seeprom_side == PNOR::SBE_SEEPROM0) { - io_sbeState.alt_seeprom_side = SBE_SEEPROM1; + io_sbeState.alt_seeprom_side = PNOR::SBE_SEEPROM1; } - else if ( io_sbeState.cur_seeprom_side == SBE_SEEPROM1) + else if ( io_sbeState.cur_seeprom_side == PNOR::SBE_SEEPROM1) { - io_sbeState.alt_seeprom_side = SBE_SEEPROM0; + io_sbeState.alt_seeprom_side = PNOR::SBE_SEEPROM0; } else { @@ -2055,7 +2012,7 @@ namespace SBE /* Determine what side to update */ /**************************************************************/ // Set cur and alt isDirty values - if( io_sbeState.cur_seeprom_side == SBE_SEEPROM0 ) + if( io_sbeState.cur_seeprom_side == PNOR::SBE_SEEPROM0 ) { current_side_isDirty = seeprom_0_isDirty; alt_side_isDirty = seeprom_1_isDirty; @@ -2222,14 +2179,14 @@ namespace SBE io_sbeState.seeprom_side_to_update = EEPROM::SBE_PRIMARY; // Update MVPD PERMANENT flag: make cur=perm - ( io_sbeState.cur_seeprom_side == SBE_SEEPROM0 ) ? + ( io_sbeState.cur_seeprom_side == PNOR::SBE_SEEPROM0 ) ? // clear bit 0 io_sbeState.mvpdSbKeyword.flags &= ~PERMANENT_FLAG_MASK : //set bit 0 io_sbeState.mvpdSbKeyword.flags |= PERMANENT_FLAG_MASK; // Update MVPD RE-IPL SEEPROM flag: re-IPL on ALT: - ( io_sbeState.alt_seeprom_side == SBE_SEEPROM0 ) ? + ( io_sbeState.alt_seeprom_side == PNOR::SBE_SEEPROM0 ) ? // clear bit 1 io_sbeState.mvpdSbKeyword.flags &= ~REIPL_SEEPROM_MASK : //set bit 1 @@ -2295,18 +2252,18 @@ namespace SBE // Set Update side to alt io_sbeState.seeprom_side_to_update = - ( io_sbeState.alt_seeprom_side == SBE_SEEPROM0 ) + ( io_sbeState.alt_seeprom_side == PNOR::SBE_SEEPROM0 ) ? EEPROM::SBE_PRIMARY : EEPROM::SBE_BACKUP ; // Update MVPD PERMANENT flag: make cur=perm - ( io_sbeState.cur_seeprom_side == SBE_SEEPROM0 ) ? + ( io_sbeState.cur_seeprom_side == PNOR::SBE_SEEPROM0 ) ? // clear bit 0 io_sbeState.mvpdSbKeyword.flags &= ~PERMANENT_FLAG_MASK : //set bit 0 io_sbeState.mvpdSbKeyword.flags |= PERMANENT_FLAG_MASK; // Update MVPD RE-IPL SEEPROM flag: re-IPL on ALT: - ( io_sbeState.alt_seeprom_side == SBE_SEEPROM0 ) ? + ( io_sbeState.alt_seeprom_side == PNOR::SBE_SEEPROM0 ) ? // clear bit 1 io_sbeState.mvpdSbKeyword.flags &= ~REIPL_SEEPROM_MASK : //set bit 1 @@ -2341,13 +2298,13 @@ namespace SBE // Set Update side to alt io_sbeState.seeprom_side_to_update = - ( io_sbeState.alt_seeprom_side == SBE_SEEPROM0 ) + ( io_sbeState.alt_seeprom_side == PNOR::SBE_SEEPROM0 ) ? EEPROM::SBE_PRIMARY : EEPROM::SBE_BACKUP ; // MVPD flag Update // Update MVPD flag make cur=perm - ( io_sbeState.cur_seeprom_side == SBE_SEEPROM0 ) ? + ( io_sbeState.cur_seeprom_side == PNOR::SBE_SEEPROM0 ) ? // clear bit 0 io_sbeState.mvpdSbKeyword.flags &= ~PERMANENT_FLAG_MASK : // set bit 0 @@ -2401,11 +2358,11 @@ namespace SBE // Set Update side to alt io_sbeState.seeprom_side_to_update = - ( io_sbeState.alt_seeprom_side == SBE_SEEPROM0 ) + ( io_sbeState.alt_seeprom_side == PNOR::SBE_SEEPROM0 ) ? EEPROM::SBE_PRIMARY : EEPROM::SBE_BACKUP ; // Update MVPD RE-IPL SEEPROM flag: re-IPL on ALT: - ( io_sbeState.alt_seeprom_side == SBE_SEEPROM0 ) ? + ( io_sbeState.alt_seeprom_side == PNOR::SBE_SEEPROM0 ) ? // clear bit 1 io_sbeState.mvpdSbKeyword.flags &= ~REIPL_SEEPROM_MASK : // set bit 1 @@ -2416,7 +2373,7 @@ namespace SBE if ( g_istep_mode ) { // Update MVPD PERMANENT flag: make alt=perm - (io_sbeState.alt_seeprom_side == SBE_SEEPROM0 ) ? + (io_sbeState.alt_seeprom_side == PNOR::SBE_SEEPROM0 ) ? // clear bit 0 io_sbeState.mvpdSbKeyword.flags &= ~PERMANENT_FLAG_MASK : //set bit 0 @@ -2498,11 +2455,11 @@ namespace SBE // Set Update side to alt io_sbeState.seeprom_side_to_update = - ( io_sbeState.alt_seeprom_side == SBE_SEEPROM0 ) + ( io_sbeState.alt_seeprom_side == PNOR::SBE_SEEPROM0 ) ? EEPROM::SBE_PRIMARY : EEPROM::SBE_BACKUP ; // Update MVPD RE-IPL SEEPROM flag: re-IPL on ALT: - ( io_sbeState.alt_seeprom_side == SBE_SEEPROM0 ) ? + ( io_sbeState.alt_seeprom_side == PNOR::SBE_SEEPROM0 ) ? // clear bit 1 io_sbeState.mvpdSbKeyword.flags &= ~REIPL_SEEPROM_MASK : // set bit 1 @@ -2534,7 +2491,7 @@ namespace SBE // Set Update side to alt io_sbeState.seeprom_side_to_update = - ( io_sbeState.alt_seeprom_side == SBE_SEEPROM0 ) + ( io_sbeState.alt_seeprom_side == PNOR::SBE_SEEPROM0 ) ? EEPROM::SBE_PRIMARY : EEPROM::SBE_BACKUP ; TRACFCOMP( g_trac_sbe, INFO_MRK"SBE Update tgt=0x%X: " @@ -3244,12 +3201,12 @@ namespace SBE // Compare against 'current' Master side in case there is // an issue with the other side - if (io_sbeStates_v[i].cur_seeprom_side == SBE_SEEPROM0) + if (io_sbeStates_v[i].cur_seeprom_side == PNOR::SBE_SEEPROM0) { ver_ptr = &(io_sbeStates_v[i].seeprom_0_ver.image_version); } - else // SBE_SEEPROM1 + else // PNOR::SBE_SEEPROM1 { ver_ptr = &(io_sbeStates_v[i].seeprom_1_ver.image_version); @@ -3389,12 +3346,12 @@ namespace SBE else { // Not Master, so get 'current' version - if (io_sbeStates_v[i].cur_seeprom_side == SBE_SEEPROM0) + if (io_sbeStates_v[i].cur_seeprom_side == PNOR::SBE_SEEPROM0) { ver_ptr = &(io_sbeStates_v[i].seeprom_0_ver.image_version); } - else // SBE_SEEPROM1 + else // PNOR::SBE_SEEPROM1 { ver_ptr = &(io_sbeStates_v[i].seeprom_1_ver.image_version); diff --git a/src/usr/sbe/sbe_update.H b/src/usr/sbe/sbe_update.H index aa880b2d4..e49c58289 100644 --- a/src/usr/sbe/sbe_update.H +++ b/src/usr/sbe/sbe_update.H @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2013,2014 */ +/* Contributors Listed Below - COPYRIGHT 2013,2015 */ +/* [+] 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. */ @@ -53,10 +55,6 @@ namespace SBE const uint64_t SBE_IMAGE_SEEPROM_ADDRESS = 0x400; // 1KB const uint64_t SBE_VERSION_SEEPROM_ADDRESS = 0x300; // 1KB - 256B - //Used to read SBE Boot Side from processor - const uint64_t SBE_VITAL_REG_0x0005001C = 0x005001C; - const uint64_t SBE_BOOT_SELECT_MASK = 0x0080000000000000; - // PNOR SBE and SBEC Partition constants const uint32_t MAX_SBE_ENTRIES = 9; const uint32_t SBETOC_EYECATCH = 0x53424500; //'SBE\0' @@ -106,14 +104,6 @@ namespace SBE MVPDOP_WRITE, // Write version data to MVPD }; - // Used to keep track of perm/temp, and cur/alt - enum sbeSeepromSide_t - { - SBE_SEEPROM0 = 0x00, // corresponds to EEPROM::SBE_PRIMARY - SBE_SEEPROM1 = 0x01, // corresponts to EEPROM::SBE_BACKUP - SBE_SEEPROM_INVALID = 0xFF, - }; - // Actions can be combined enum sbeUpdateActions_t { @@ -127,7 +117,6 @@ namespace SBE UNSUPPORTED_SITUATION = 0x80000000, }; - /******************************************/ /* Structs */ /******************************************/ @@ -207,9 +196,9 @@ namespace SBE bool seeprom_0_ver_ECC_fail; bool seeprom_1_ver_ECC_fail; - sbeSeepromSide_t cur_seeprom_side; // aka 'booted' side - sbeSeepromSide_t alt_seeprom_side; - sbeSeepromSide_t permanent_seeprom_side; + PNOR::sbeSeepromSide_t cur_seeprom_side; // aka 'booted' side + PNOR::sbeSeepromSide_t alt_seeprom_side; + PNOR::sbeSeepromSide_t permanent_seeprom_side; // Customized Image Information for this Target size_t customizedImage_size; @@ -329,21 +318,6 @@ namespace SBE void* io_imgPtr, size_t& o_actImgSize); - - /** - * @brief Determines which Seeprom was used to boot the SBE - * - * @param[in] i_target Target processor to customize - * - * @param[out] o_bootSide The Seeprom the SBE booted from - * - * @return errlHndl_t Error log handle on failure. - */ - - errlHndl_t getSbeBootSeeprom(TARGETING::Target* i_target, - sbeSeepromSide_t& o_bootSide); - - /** * @brief Collects Version information from a specific SEEPROM * diff --git a/src/usr/sbe/test/sbeupdatetest.H b/src/usr/sbe/test/sbeupdatetest.H index d2351418b..5e2570631 100644 --- a/src/usr/sbe/test/sbeupdatetest.H +++ b/src/usr/sbe/test/sbeupdatetest.H @@ -580,7 +580,7 @@ class SBEUpdateTest: public CxxTest::TestSuite { // Inputs uint8_t i_situation; - sbeSeepromSide_t i_cur; // current_seeprom_side + PNOR::sbeSeepromSide_t i_cur; // current_seeprom_side uint8_t i_flags; // mvpdSbKeyword.flags // Expected Output @@ -596,7 +596,7 @@ class SBEUpdateTest: public CxxTest::TestSuite // - update alt=1 // - make cur=perm // - re-IPL - { 0xE0, SBE_SEEPROM0, 0x80, + { 0xE0, PNOR::SBE_SEEPROM0, 0x80, static_cast<sbeUpdateActions_t> (DO_UPDATE|IPL_RESTART|UPDATE_MVPD|UPDATE_SBE), EEPROM::SBE_BACKUP, 0x40 }, @@ -606,7 +606,7 @@ class SBEUpdateTest: public CxxTest::TestSuite // - update alt=0 // - make cur=perm // - re-IPL - { 0xC0, SBE_SEEPROM1, 0x00, + { 0xC0, PNOR::SBE_SEEPROM1, 0x00, static_cast<sbeUpdateActions_t> (DO_UPDATE|IPL_RESTART|UPDATE_MVPD|UPDATE_SBE), EEPROM::SBE_PRIMARY, 0x80 }, @@ -616,7 +616,7 @@ class SBEUpdateTest: public CxxTest::TestSuite // - update alt=0 // - make cur=perm // - Continue IPL - { 0xA0, SBE_SEEPROM1, 0x00, + { 0xA0, PNOR::SBE_SEEPROM1, 0x00, static_cast<sbeUpdateActions_t> (DO_UPDATE|UPDATE_MVPD|UPDATE_SBE), EEPROM::SBE_PRIMARY, 0x80 }, @@ -625,7 +625,7 @@ class SBEUpdateTest: public CxxTest::TestSuite // Arbitrarily set cur side to 1 (therefore perm set to 0) // - No updates // - Continue IPL - { 0x80, SBE_SEEPROM1, 0x00, + { 0x80, PNOR::SBE_SEEPROM1, 0x00, static_cast<sbeUpdateActions_t>(CLEAR_ACTIONS), EEPROM::LAST_CHIP_TYPE, 0x00 }, @@ -633,7 +633,7 @@ class SBEUpdateTest: public CxxTest::TestSuite // Arbitrarily set cur side to 0 (therefore perm set to 0) // - update alt=1 // - re-IPL - { 0x60, SBE_SEEPROM0, 0x00, + { 0x60, PNOR::SBE_SEEPROM0, 0x00, static_cast<sbeUpdateActions_t> (DO_UPDATE|IPL_RESTART|UPDATE_MVPD|UPDATE_SBE), EEPROM::SBE_BACKUP, 0x40 }, @@ -644,14 +644,14 @@ class SBEUpdateTest: public CxxTest::TestSuite // Arbitrarily set cur side to 1 (therefore perm set to 1) // - update alt=0 // - re-IPL - { 0x40, SBE_SEEPROM1, 0x80, + { 0x40, PNOR::SBE_SEEPROM1, 0x80, static_cast<sbeUpdateActions_t> (DO_UPDATE|IPL_RESTART|UPDATE_MVPD|UPDATE_SBE), EEPROM::SBE_PRIMARY, 0x80 }, // Repeat previous case to make sure global variables are used // correctly to save MBOX value - { 0x40, SBE_SEEPROM1, 0x80, + { 0x40, PNOR::SBE_SEEPROM1, 0x80, static_cast<sbeUpdateActions_t> (DO_UPDATE|IPL_RESTART|UPDATE_MVPD|UPDATE_SBE), EEPROM::SBE_PRIMARY, 0x80 }, @@ -660,7 +660,7 @@ class SBEUpdateTest: public CxxTest::TestSuite // Arbitrarily set cur side to 0 (therefore perm set to 0) // - update alt=1 // - Continue IPL - { 0x20, SBE_SEEPROM0, 0x00, + { 0x20, PNOR::SBE_SEEPROM0, 0x00, static_cast<sbeUpdateActions_t>(DO_UPDATE|UPDATE_SBE), EEPROM::SBE_BACKUP, 0x00 }, @@ -670,7 +670,7 @@ class SBEUpdateTest: public CxxTest::TestSuite // - Continue IPL // NOTE: this will test that right-most-bit is ignored: // so techincally case 0x01, which should be = case 0x00 - { 0x01, SBE_SEEPROM0, 0x00, + { 0x01, PNOR::SBE_SEEPROM0, 0x00, static_cast<sbeUpdateActions_t>(CLEAR_ACTIONS), EEPROM::LAST_CHIP_TYPE, 0x00 }, #endif // SBE_UPDATE_SEQUENTIAL @@ -708,8 +708,8 @@ class SBEUpdateTest: public CxxTest::TestSuite sbeState.cur_seeprom_side = testData[i].i_cur; sbeState.alt_seeprom_side = - ( ( testData[i].i_cur == SBE_SEEPROM0 ) - ? SBE_SEEPROM1 : SBE_SEEPROM0 ); + ( ( testData[i].i_cur == PNOR::SBE_SEEPROM0 ) + ? PNOR::SBE_SEEPROM1 : PNOR::SBE_SEEPROM0 ); sbeState.mvpdSbKeyword.flags = testData[i].i_flags; |