[Skiboot] [PATCH 2/2] p9_stop_api: PM: Added support for version control in SCOM restore entries.
Stewart Smith
stewart at linux.vnet.ibm.com
Fri Dec 1 08:16:39 AEDT 2017
From: Prem Shanker Jha <premjha2 at in.ibm.com>
- 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 <fsp-CI-jenkins+hostboot at us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot at us.ibm.com>
Tested-by: Hostboot CI <hostboot-ci+hostboot at us.ibm.com>
Reviewed-by: RANGANATHPRASAD G. BRAHMASAMUDRA <prasadbgr at in.ibm.com>
Reviewed-by: Gregory S. Still <stillgs at us.ibm.com>
Dev-Ready: Gregory S. Still <stillgs at us.ibm.com>
Reviewed-by: Jennifer A. Stofer <stofer at us.ibm.com>
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/48859
Reviewed-by: Hostboot Team <hostboot at us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot at us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot at us.ibm.com>
Reviewed-by: Christian R. Geddes <crgeddes at us.ibm.com>
(cherry picked from hostboot commit 47c3bbe42264514a25e00820cac1c8488aed9073)
Signed-off-by: Stewart Smith <stewart at linux.vnet.ibm.com>
---
libpore/p9_stop_api.C | 68 ++++++++++++++++++++++++++++++++++++++++++++++++---
libpore/p9_stop_api.H | 9 +++++++
2 files changed, 73 insertions(+), 4 deletions(-)
diff --git a/libpore/p9_stop_api.C b/libpore/p9_stop_api.C
index 33a3bf39f2f9..cbbdfdd5de57 100644
--- a/libpore/p9_stop_api.C
+++ b/libpore/p9_stop_api.C
@@ -748,6 +748,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,
@@ -765,14 +800,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;
@@ -862,11 +906,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 ) )
@@ -881,7 +925,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;
}
@@ -916,6 +963,8 @@ StopReturnCode_t p9_stop_save_scom( void* const i_pImage,
l_rc = updateScomEntry ( swizzleAddr,
swizzleData, pScomAppend );
+
+ pEditScomHeader = pScomAppend;
}
break;
@@ -934,6 +983,8 @@ StopReturnCode_t p9_stop_save_scom( void* const i_pImage,
l_rc = updateScomEntry( swizzleAddr,
swizzleData, scomReplace );
+
+ pEditScomHeader = scomReplace;
}
break;
@@ -947,6 +998,8 @@ StopReturnCode_t p9_stop_save_scom( void* const i_pImage,
swizzleData,
pEntryLocation,
i_operation );
+
+ pEditScomHeader = pEntryLocation;
}
else
{
@@ -997,6 +1050,8 @@ StopReturnCode_t p9_stop_save_scom( void* const i_pImage,
swizzleData,
editAppend,
tempOperation );
+
+ pEditScomHeader = editAppend;
}
break;
@@ -1004,7 +1059,6 @@ StopReturnCode_t p9_stop_save_scom( void* const i_pImage,
l_rc = STOP_SAVE_SCOM_INVALID_OPERATION;
break;
}
-
}
while(0);
@@ -1014,6 +1068,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/libpore/p9_stop_api.H b/libpore/p9_stop_api.H
index 79abd0006856..6416771d1809 100644
--- a/libpore/p9_stop_api.H
+++ b/libpore/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
--
2.14.3
More information about the Skiboot
mailing list