summaryrefslogtreecommitdiffstats
path: root/src/import/chips/p9/procedures/utils
diff options
context:
space:
mode:
authorDan Crowell <dcrowell@us.ibm.com>2017-05-05 11:03:17 -0500
committerChristian R. Geddes <crgeddes@us.ibm.com>2017-05-12 21:20:13 -0400
commit2718fd2c8746f4391e8a252dfc29484396a0f1e9 (patch)
tree77178921e8a4651b9a0559a76ea06009e4709d66 /src/import/chips/p9/procedures/utils
parentbc30c5b420fb71ac5fe36251f192545d3442e817 (diff)
downloadtalos-hostboot-2718fd2c8746f4391e8a252dfc29484396a0f1e9.tar.gz
talos-hostboot-2718fd2c8746f4391e8a252dfc29484396a0f1e9.zip
Fixes required to build P9 STOP API with skiboot
This commit contains code changes which are needed to build P9 STOP API for skiboot/opal firmware. Fixes are mostly around detecting skiboot environment using __SKIBOOT__ and including files required for the build. Fixes related to using C compiler instead of C++ Fixes related to mixed code and declaration and other compiler error/warnings Resolves #100 Change-Id: I49b0cb5918373c0b1a0e795fded2d245bf2aa3f7 Signed-off-by: Akshay Adiga <akshay.adiga@linux.vnet.ibm.com> Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/40151 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com> Reviewed-by: Stuart Z. Jacobs <sjacobs@us.ibm.com> Reviewed-by: Prem Shanker Jha <premjha2@in.ibm.com> Reviewed-by: Juan R. Medina <jrmedina@us.ibm.com> Reviewed-by: Gregory S. Still <stillgs@us.ibm.com> Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/40155 Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
Diffstat (limited to 'src/import/chips/p9/procedures/utils')
-rwxr-xr-xsrc/import/chips/p9/procedures/utils/stopreg/p9_stop_api.C103
-rwxr-xr-xsrc/import/chips/p9/procedures/utils/stopreg/p9_stop_api.H4
-rwxr-xr-xsrc/import/chips/p9/procedures/utils/stopreg/p9_stop_data_struct.H4
-rwxr-xr-xsrc/import/chips/p9/procedures/utils/stopreg/p9_stop_util.C9
4 files changed, 59 insertions, 61 deletions
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 1d34ca490..26a14bbfa 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
@@ -83,12 +83,13 @@ const uint32_t MAX_SPR_SUPPORTED =
* @note for register of scope core, function shall force io_threadId to
* zero.
*/
-StopReturnCode_t validateSprImageInputs( void* const i_pImage,
+static StopReturnCode_t validateSprImageInputs( void* const i_pImage,
const CpuReg_t i_regId,
const uint32_t i_coreId,
uint32_t* i_pThreadId,
bool* i_pThreadLevelReg )
{
+ uint32_t index = 0;
StopReturnCode_t l_rc = STOP_SAVE_SUCCESS;
bool sprSupported = false;
*i_pThreadLevelReg = false;
@@ -134,8 +135,6 @@ StopReturnCode_t validateSprImageInputs( void* const i_pImage,
break;
}
- uint32_t index = 0;
-
for( index = 0; index < MAX_SPR_SUPPORTED; ++index )
{
if( i_regId == (CpuReg_t )g_sprRegister[index].sprId )
@@ -180,8 +179,8 @@ StopReturnCode_t validateSprImageInputs( void* const i_pImage,
* @param[in] i_data 16 bit immediate data
* @return returns 32 bit number representing ori instruction.
*/
-uint32_t getOriInstruction( const uint16_t i_Rs, const uint16_t i_Ra,
- const uint16_t i_data )
+static uint32_t getOriInstruction( const uint16_t i_Rs, const uint16_t i_Ra,
+ const uint16_t i_data )
{
uint32_t oriInstOpcode = 0;
oriInstOpcode = 0;
@@ -198,7 +197,7 @@ uint32_t getOriInstruction( const uint16_t i_Rs, const uint16_t i_Ra,
/**
* @brief generates 32 bit key used for SPR lookup in core section.
*/
-uint32_t genKeyForSprLookup( const CpuReg_t i_regId )
+static uint32_t genKeyForSprLookup( const CpuReg_t i_regId )
{
return getOriInstruction( 0, 0, (uint16_t) i_regId );
}
@@ -212,8 +211,8 @@ uint32_t genKeyForSprLookup( const CpuReg_t i_regId )
* @param[in] i_Rb source register number for xor operation
* @return returns 32 bit number representing xor immediate instruction.
*/
-uint32_t getXorInstruction( const uint16_t i_Ra, const uint16_t i_Rs,
- const uint16_t i_Rb )
+static uint32_t getXorInstruction( const uint16_t i_Ra, const uint16_t i_Rs,
+ const uint16_t i_Rb )
{
uint32_t xorRegInstOpcode;
xorRegInstOpcode = XOR_CONST << 1;
@@ -234,8 +233,8 @@ uint32_t getXorInstruction( const uint16_t i_Ra, const uint16_t i_Rs,
* @param[in] i_data 16 bit immediate data
* @return returns 32 bit number representing oris immediate instruction.
*/
-uint32_t getOrisInstruction( const uint16_t i_Rs, const uint16_t i_Ra,
- const uint16_t i_data )
+static uint32_t getOrisInstruction( const uint16_t i_Rs, const uint16_t i_Ra,
+ const uint16_t i_data )
{
uint32_t orisInstOpcode;
orisInstOpcode = 0;
@@ -254,7 +253,7 @@ uint32_t getOrisInstruction( const uint16_t i_Rs, const uint16_t i_Ra,
* @param[in] i_Spr represents spr where data is to be moved.
* @return returns 32 bit number representing mtspr instruction.
*/
-uint32_t getMtsprInstruction( const uint16_t i_Rs, const uint16_t i_Spr )
+static uint32_t getMtsprInstruction( const uint16_t i_Rs, const uint16_t i_Spr )
{
uint32_t mtsprInstOpcode = 0;
uint32_t temp = (( i_Spr & 0x03FF ) << 11);
@@ -276,8 +275,8 @@ uint32_t getMtsprInstruction( const uint16_t i_Rs, const uint16_t i_Spr )
* @param[in] i_me bit position up to which mask should be 1.
* @return returns 32 bit number representing rldicr instruction.
*/
-uint32_t getRldicrInstruction( const uint16_t i_Ra, const uint16_t i_Rs,
- const uint16_t i_sh, uint16_t i_me )
+static uint32_t getRldicrInstruction( const uint16_t i_Ra, const uint16_t i_Rs,
+ const uint16_t i_sh, uint16_t i_me )
{
uint32_t rldicrInstOpcode = 0;
rldicrInstOpcode = 0;
@@ -292,24 +291,6 @@ uint32_t getRldicrInstruction( const uint16_t i_Ra, const uint16_t i_Rs,
//-----------------------------------------------------------------------------
/**
- * @brief generates instruction for mtmsrd instruction.
- * @param[in] i_Rs source register number
- * @return returns 32 bit number representing mtmsrd instruction.
- * @note moves contents of register i_Rs to MSR register.
- */
-uint32_t getMtmsrdInstruction( const uint16_t i_Rs )
-{
- uint32_t mtmsrdInstOpcode = 0;
- mtmsrdInstOpcode = 0;
- mtmsrdInstOpcode = OPCODE_31 << 26;
- mtmsrdInstOpcode |= i_Rs << 21 | ( MTMSRD_CONST1 << 1 );
-
- return SWIZZLE_4_BYTE(mtmsrdInstOpcode);
-}
-
-//-----------------------------------------------------------------------------
-
-/**
* @brief looks up entry for given SPR in given thread/core section.
* @param[in] i_pThreadSectLoc start of given thread section or core section.
* @param[in] i_lookUpKey search key for lookup of given SPR entry.
@@ -320,14 +301,14 @@ uint32_t getMtmsrdInstruction( const uint16_t i_Rs )
* @return STOP_SAVE_SUCCESS if entry is found, STOP_SAVE_FAIL in case of
* an error.
*/
-StopReturnCode_t lookUpSprInImage( uint32_t* i_pThreadSectLoc,
- const uint32_t i_lookUpKey,
- const bool i_isCoreReg,
- void** io_pSprEntryLoc )
+static StopReturnCode_t lookUpSprInImage( uint32_t* i_pThreadSectLoc,
+ const uint32_t i_lookUpKey,
+ const bool i_isCoreReg,
+ void** io_pSprEntryLoc )
{
StopReturnCode_t l_rc = STOP_SAVE_FAIL;
- uint32_t temp = i_isCoreReg ? uint32_t(CORE_RESTORE_CORE_AREA_SIZE) :
- uint32_t(CORE_RESTORE_THREAD_AREA_SIZE);
+ uint32_t temp = i_isCoreReg ? (uint32_t)(CORE_RESTORE_CORE_AREA_SIZE) :
+ (uint32_t)(CORE_RESTORE_THREAD_AREA_SIZE);
uint32_t* i_threadSectEnd = i_pThreadSectLoc + temp;
uint32_t bctr_inst = SWIZZLE_4_BYTE(BLR_INST);
*io_pSprEntryLoc = NULL;
@@ -371,9 +352,9 @@ StopReturnCode_t lookUpSprInImage( uint32_t* i_pThreadSectLoc,
* @param[in] i_regData data needs to be written to SPR entry.
* @return STOP_SAVE_SUCCESS if update works, STOP_SAVE_FAIL otherwise.
*/
-StopReturnCode_t updateSprEntryInImage( uint32_t* i_pSprEntryLocation,
- const CpuReg_t i_regId,
- const uint64_t i_regData )
+static StopReturnCode_t updateSprEntryInImage( uint32_t* i_pSprEntryLocation,
+ const CpuReg_t i_regId,
+ const uint64_t i_regData )
{
StopReturnCode_t l_rc = STOP_SAVE_SUCCESS;
uint32_t tempInst = 0;
@@ -591,7 +572,7 @@ StopReturnCode_t p9_stop_save_cpureg( void* const i_pImage,
* @note Function does not validate that the given SCOM address really
* belongs to the given section.
*/
-StopReturnCode_t validateScomImageInputs( void* const i_pImage,
+static StopReturnCode_t validateScomImageInputs( void* const i_pImage,
const uint32_t i_scomAddress,
const uint8_t i_chipletId,
const ScomOperation_t i_operation,
@@ -684,9 +665,9 @@ StopReturnCode_t validateScomImageInputs( void* const i_pImage,
* @return STOP_SAVE_SUCCESS if existing entry is updated, STOP_SAVE_FAIL
* otherwise.
*/
-StopReturnCode_t editScomEntry( uint32_t i_scomAddr, uint64_t i_scomData,
- ScomEntry_t* i_pEntryLocation,
- uint32_t i_operation )
+static StopReturnCode_t editScomEntry( uint32_t i_scomAddr, uint64_t i_scomData,
+ ScomEntry_t* i_pEntryLocation,
+ uint32_t i_operation )
{
StopReturnCode_t l_rc = STOP_SAVE_SUCCESS;
@@ -745,8 +726,8 @@ StopReturnCode_t editScomEntry( uint32_t i_scomAddr, uint64_t i_scomData,
* place of NOP, at the end of table or as first entry of the cache
* sub-section(L2, L3 or EQ ).
*/
-StopReturnCode_t updateScomEntry( uint32_t i_scomAddr, uint64_t i_scomData,
- ScomEntry_t* i_scomEntry )
+static StopReturnCode_t updateScomEntry( uint32_t i_scomAddr, uint64_t i_scomData,
+ ScomEntry_t* i_scomEntry )
{
StopReturnCode_t l_rc = STOP_SAVE_SUCCESS;
@@ -783,6 +764,17 @@ StopReturnCode_t p9_stop_save_scom( void* const i_pImage,
uint32_t entryLimit = 0;
uint8_t chipletId = 0;
+ uint32_t nopInst;
+ ScomEntry_t* pEntryLocation = NULL;
+ ScomEntry_t* pNopLocation = NULL;
+ ScomEntry_t* pTableEndLocationtable = NULL;
+ uint32_t swizzleAddr;
+ uint64_t swizzleData;
+ uint32_t swizzleAttn;
+ uint32_t swizzleEntry;
+ uint32_t index = 0;
+ uint32_t swizzleBlr = SWIZZLE_4_BYTE(BLR_INST);
+
do
{
chipletId = i_scomAddress >> 24;
@@ -865,17 +857,14 @@ StopReturnCode_t p9_stop_save_scom( void* const i_pImage,
break;
}
- uint32_t nopInst = getOriInstruction( 0, 0, 0 );
-
- ScomEntry_t* pEntryLocation = NULL;
- ScomEntry_t* pNopLocation = NULL;
- ScomEntry_t* pTableEndLocationtable = NULL;
- uint32_t swizzleAddr = SWIZZLE_4_BYTE(i_scomAddress);
- uint64_t swizzleData = SWIZZLE_8_BYTE(i_scomData);
- uint32_t swizzleAttn = SWIZZLE_4_BYTE(ATTN_OPCODE);
- uint32_t swizzleEntry = SWIZZLE_4_BYTE(SCOM_ENTRY_START);
- uint32_t index = 0;
- uint32_t swizzleBlr = SWIZZLE_4_BYTE(BLR_INST);
+ nopInst = getOriInstruction( 0, 0, 0 );
+ pEntryLocation = NULL;
+ pNopLocation = NULL;
+ pTableEndLocationtable = NULL;
+ 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 )
{
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 69f94fc98..79abd0006 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
@@ -27,6 +27,10 @@
#include <stdint.h>
+#ifdef __SKIBOOT__
+ #include <skiboot.h>
+#endif
+
///
/// @file p9_stop_api.H
/// @brief describes STOP API which create/manipulate STOP image.
diff --git a/src/import/chips/p9/procedures/utils/stopreg/p9_stop_data_struct.H b/src/import/chips/p9/procedures/utils/stopreg/p9_stop_data_struct.H
index 8a5c2b4ed..2201021ec 100755
--- a/src/import/chips/p9/procedures/utils/stopreg/p9_stop_data_struct.H
+++ b/src/import/chips/p9/procedures/utils/stopreg/p9_stop_data_struct.H
@@ -41,6 +41,10 @@
#include "p9_hcd_memmap_base.H"
+#ifdef __SKIBOOT__
+ #include <skiboot.h>
+#endif
+
#ifdef __FAPI_2_
#include <fapi2.H>
#endif
diff --git a/src/import/chips/p9/procedures/utils/stopreg/p9_stop_util.C b/src/import/chips/p9/procedures/utils/stopreg/p9_stop_util.C
index 9e9874ad9..f745a1738 100755
--- a/src/import/chips/p9/procedures/utils/stopreg/p9_stop_util.C
+++ b/src/import/chips/p9/procedures/utils/stopreg/p9_stop_util.C
@@ -48,13 +48,16 @@ namespace stopImageSection
* @param o_fusedMode points to fuse mode information.
* @return STOP_SAVE_SUCCESS if functions succeeds, error code otherwise.
*/
-StopReturnCode_t isFusedMode( void* const i_pImage, bool* o_fusedMode )
+static StopReturnCode_t isFusedMode( void* const i_pImage, bool* o_fusedMode )
{
- *o_fusedMode = false;
StopReturnCode_t l_rc = STOP_SAVE_SUCCESS;
+ *o_fusedMode = false;
do
{
+ HomerSection_t* pHomerDesc = ( HomerSection_t* ) i_pImage;
+ HomerImgDesc_t* pHomer = (HomerImgDesc_t*)( pHomerDesc->interrruptHandler );
+
if( !i_pImage )
{
MY_ERR( "invalid pointer to HOMER image");
@@ -62,8 +65,6 @@ StopReturnCode_t isFusedMode( void* const i_pImage, bool* o_fusedMode )
break;
}
- HomerSection_t* pHomerDesc = ( HomerSection_t* ) i_pImage;
- HomerImgDesc_t* pHomer = (HomerImgDesc_t*)( pHomerDesc->interrruptHandler );
if( SWIZZLE_8_BYTE(CPMR_MAGIC_NUMBER) != pHomer->cpmrMagicWord )
{
OpenPOWER on IntegriCloud