From 47c3bbe42264514a25e00820cac1c8488aed9073 Mon Sep 17 00:00:00 2001 From: Prem Shanker Jha Date: Thu, 26 Oct 2017 01:44:57 -0500 Subject: PM: Added support for version control in SCOM restore entries. - adds version info in SCOM restore entry header - adds version specific details in SCOM restore entry header - retains old behavior of SGPE Hcode's base version Key_Cronus_Test=NO_TEST CQ:HW423686 HW-Image-Prereq: Ie1611b009e95192a0dad3a47af14ef8a36dd454b Change-Id: I43e7e067b59513db1c99ce913009a9a3ef5de90b Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/48856 Tested-by: FSP CI Jenkins Tested-by: Jenkins Server Tested-by: Hostboot CI Reviewed-by: RANGANATHPRASAD G. BRAHMASAMUDRA Reviewed-by: Gregory S. Still Dev-Ready: Gregory S. Still Reviewed-by: Jennifer A. Stofer Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/48859 Reviewed-by: Hostboot Team Tested-by: Jenkins OP Build CI Tested-by: Jenkins OP HW Reviewed-by: Christian R. Geddes --- .../p9/procedures/utils/stopreg/p9_stop_api.C | 68 ++++++++++++++++++++-- .../p9/procedures/utils/stopreg/p9_stop_api.H | 9 +++ 2 files changed, 73 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/import/chips/p9/procedures/utils/stopreg/p9_stop_api.C b/src/import/chips/p9/procedures/utils/stopreg/p9_stop_api.C index 26a14bbfa..7242c423c 100755 --- a/src/import/chips/p9/procedures/utils/stopreg/p9_stop_api.C +++ b/src/import/chips/p9/procedures/utils/stopreg/p9_stop_api.C @@ -750,6 +750,41 @@ static StopReturnCode_t updateScomEntry( uint32_t i_scomAddr, uint64_t i_scomDat return l_rc; } +//----------------------------------------------------------------------------- +/** + * @brief populates SCOM restore entry header with version and layout info. + * @param[in] i_scomEntry points to SCOM restore entry + * @param[in] i_section section of SCOM restore area + * @param[in] i_imageVer SGPE image version + */ + +static void updateEntryHeader( ScomEntry_t* i_scomEntry , + const ScomSection_t i_section, + uint32_t i_imageVer ) +{ + uint32_t l_temp = 0; + uint32_t l_entryLimit = 0; + + if( i_imageVer >= STOP_API_VER_CONTROL ) + { + if( P9_STOP_SECTION_CORE_SCOM == i_section ) + { + l_entryLimit = MAX_CORE_SCOM_ENTRIES; + } + else + { + l_entryLimit = MAX_EQ_SCOM_ENTRIES + MAX_L2_SCOM_ENTRIES + + MAX_L3_SCOM_ENTRIES; + } + + l_temp |= ( STOP_API_VER & 0x7 ) << 28; + l_temp |= ( 0x000000ff & l_entryLimit ); + i_scomEntry->scomEntryHeader = SWIZZLE_4_BYTE(l_temp); + + MY_INF("SCOM Restore Header 0x%08x", l_temp ); + } +} + //----------------------------------------------------------------------------- StopReturnCode_t p9_stop_save_scom( void* const i_pImage, @@ -767,14 +802,23 @@ StopReturnCode_t p9_stop_save_scom( void* const i_pImage, uint32_t nopInst; ScomEntry_t* pEntryLocation = NULL; ScomEntry_t* pNopLocation = NULL; + ScomEntry_t* pEditScomHeader = NULL; ScomEntry_t* pTableEndLocationtable = NULL; uint32_t swizzleAddr; uint64_t swizzleData; uint32_t swizzleAttn; - uint32_t swizzleEntry; + uint32_t entrySwzHeader = 0; uint32_t index = 0; uint32_t swizzleBlr = SWIZZLE_4_BYTE(BLR_INST); + //Reads SGPE image version info from QPMR Header in HOMER + //For backward compatibility, for base version of SGPE Hcode, + //STOP API retains default behavior but adds version specific + //details in each entry in later versions. + + uint32_t imageVer = *(uint32_t*)((uint8_t*)i_pImage + QPMR_HOMER_OFFSET + QPMR_BUILD_VER_BYTE); + imageVer = SWIZZLE_4_BYTE(imageVer); + do { chipletId = i_scomAddress >> 24; @@ -864,11 +908,11 @@ StopReturnCode_t p9_stop_save_scom( void* const i_pImage, swizzleAddr = SWIZZLE_4_BYTE(i_scomAddress); swizzleData = SWIZZLE_8_BYTE(i_scomData); swizzleAttn = SWIZZLE_4_BYTE(ATTN_OPCODE); - swizzleEntry = SWIZZLE_4_BYTE(SCOM_ENTRY_START); for( index = 0; index < entryLimit; ++index ) { uint32_t entrySwzAddress = pScomEntry[index].scomEntryAddress; + entrySwzHeader = SWIZZLE_4_BYTE(pScomEntry[index].scomEntryHeader); if( ( swizzleAddr == entrySwzAddress ) && ( !pEntryLocation ) ) @@ -883,7 +927,10 @@ StopReturnCode_t p9_stop_save_scom( void* const i_pImage, pNopLocation = &pScomEntry[index]; } - if( swizzleEntry == pScomEntry[index].scomEntryHeader ) + // if entry is either 0xDEADDEAD or has SCOM entry limit in LSB of header + // place is already occupied + if( ( SCOM_ENTRY_START == entrySwzHeader ) || + ( entrySwzHeader & 0x000000FF ) ) { continue; } @@ -918,6 +965,8 @@ StopReturnCode_t p9_stop_save_scom( void* const i_pImage, l_rc = updateScomEntry ( swizzleAddr, swizzleData, pScomAppend ); + + pEditScomHeader = pScomAppend; } break; @@ -936,6 +985,8 @@ StopReturnCode_t p9_stop_save_scom( void* const i_pImage, l_rc = updateScomEntry( swizzleAddr, swizzleData, scomReplace ); + + pEditScomHeader = scomReplace; } break; @@ -949,6 +1000,8 @@ StopReturnCode_t p9_stop_save_scom( void* const i_pImage, swizzleData, pEntryLocation, i_operation ); + + pEditScomHeader = pEntryLocation; } else { @@ -999,6 +1052,8 @@ StopReturnCode_t p9_stop_save_scom( void* const i_pImage, swizzleData, editAppend, tempOperation ); + + pEditScomHeader = editAppend; } break; @@ -1006,7 +1061,6 @@ StopReturnCode_t p9_stop_save_scom( void* const i_pImage, l_rc = STOP_SAVE_SCOM_INVALID_OPERATION; break; } - } while(0); @@ -1016,6 +1070,12 @@ StopReturnCode_t p9_stop_save_scom( void* const i_pImage, "0x%08x", i_operation, chipletId , i_scomAddress ); } + else + { + //Update SCOM Restore entry with version and memory layout + //info + updateEntryHeader( pEditScomHeader, i_section, imageVer ); + } return l_rc; } diff --git a/src/import/chips/p9/procedures/utils/stopreg/p9_stop_api.H b/src/import/chips/p9/procedures/utils/stopreg/p9_stop_api.H index 79abd0006..6416771d1 100755 --- a/src/import/chips/p9/procedures/utils/stopreg/p9_stop_api.H +++ b/src/import/chips/p9/procedures/utils/stopreg/p9_stop_api.H @@ -117,6 +117,15 @@ typedef enum P9_STOP_SECTION_MAX = 5 } ScomSection_t; +/** + * @brief versions pertaining relvant to STOP API. + */ +typedef enum +{ + STOP_API_VER = 0x00, + STOP_API_VER_CONTROL = 0x02, +} VersionList_t; + #ifdef __cplusplus extern "C" { #endif -- cgit v1.2.1