Skip to content

Commit

Permalink
HB Improvements: Fix compiler warnings on modern compilers
Browse files Browse the repository at this point in the history
Resolve warnings when compiling with gcc 4.8. Compiling HB with GCC 7.3.

Change-Id: Id180af6b174d34009c451a23fc3ec1803fa0130a
RTC: 202716
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/73418
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: STEPHEN GLANCY <sglancy@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com>
Reviewed-by: ANDRE A. MARIN <aamarin@us.ibm.com>
Tested-by: HWSV CI <hwsv-ci+hostboot@us.ibm.com>
Reviewed-by: Gregory S. Still <stillgs@us.ibm.com>
Reviewed-by: Prem Shanker Jha <premjha2@in.ibm.com>
Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com>
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/73429
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
  • Loading branch information
LF-Luis authored and crgeddes committed Mar 26, 2019
1 parent c2a9006 commit ab6efc5
Show file tree
Hide file tree
Showing 10 changed files with 205 additions and 118 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2016,2018 */
/* Contributors Listed Below - COPYRIGHT 2016,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -3653,7 +3653,8 @@ extern "C" {
fapi2::CEN_MSS_ACCESS_DELAY_REG_SCHMOO_BAD_MBA_POS(),
"Bad position from ATTR_CHIP_UNIT_POS (%d)", l_mbapos);

FAPI_ASSERT(l_dram_width == fapi2::ENUM_ATTR_CEN_EFF_DRAM_WIDTH_X4 || fapi2::ENUM_ATTR_CEN_EFF_DRAM_WIDTH_X8,
FAPI_ASSERT(l_dram_width == fapi2::ENUM_ATTR_CEN_EFF_DRAM_WIDTH_X4 ||
l_dram_width == fapi2::ENUM_ATTR_CEN_EFF_DRAM_WIDTH_X8,
fapi2::CEN_MSS_ACCESS_DELAY_REG_SCHMOO_BAD_DRAM_WIDTH().
set_DRAM_WIDTH(l_dram_width),
"Bad dram width from ATTR_EFF_DRAM_WIDTH (%d)", l_dram_width);
Expand Down
8 changes: 5 additions & 3 deletions src/import/chips/centaur/procedures/hwp/memory/p9c_mss_volt.C
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2016,2018 */
/* Contributors Listed Below - COPYRIGHT 2016,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -144,6 +144,8 @@ fapi2::ReturnCode p9c_mss_volt(const std::vector<fapi2::Target<fapi2::TARGET_TYP
// note: only support DDR3=1.35V and DDR4=1.2xV

// Mixed Dimms, Deconfig the DDR4.
// note: Running DDR4 at DDR3 voltage will damage the DDR4, so deconfig the
// DDR3 DIMMs.
if (l_dram_ddr3_found_flag && l_dram_ddr4_found_flag)
{
// Iterate through the list of centaurs
Expand All @@ -162,9 +164,9 @@ fapi2::ReturnCode p9c_mss_volt(const std::vector<fapi2::Target<fapi2::TARGET_TYP
{
FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_CEN_SPD_DRAM_DEVICE_TYPE, l_dimm, l_spd_dramtype));

FAPI_ASSERT(l_spd_dramtype = ! fapi2::ENUM_ATTR_CEN_SPD_DRAM_DEVICE_TYPE_DDR4,
FAPI_ASSERT(l_spd_dramtype == fapi2::ENUM_ATTR_CEN_SPD_DRAM_DEVICE_TYPE_DDR4,
fapi2::CEN_MSS_VOLT_DDR_TYPE_MIXING_UNSUPPORTED().
set_DIMM_DDR4_TARGET(l_dimm).
set_DIMM_DDR3_TARGET(l_dimm).
set_DEVICE_TYPE(l_spd_dramtype),
"mss_volt: DDR3 and DDR4 mixing not allowed");
}//end of dimms loop
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,17 @@ extern "C"
const fapi2::Target<fapi2::TARGET_TYPE_MEMBUF_CHIP>& i_mbTarget,
uint32_t& o_val)
{
union l_KeywordUnion
{
uint32_t vpdMemoryDataVersion;
MBvpdVMKeyword mBvpdVMKeyword;
};

fapi2::ReturnCode l_fapi2rc;
DimmType l_dimmType = DimmType::ISDIMM;
fapi2::MBvpdRecord l_record = fapi2::MBVPD_RECORD_SPDX;
uint32_t l_vpdMemoryDataVersion = VM_KEYWORD_DEFAULT_VALUE;
size_t l_bufSize = sizeof(l_vpdMemoryDataVersion);
l_KeywordUnion l_vpdMDataUnion = {VM_KEYWORD_DEFAULT_VALUE};
size_t l_bufSize = sizeof(l_vpdMDataUnion.vpdMemoryDataVersion);

FAPI_DBG("getMBvpdMemoryDataVersion: entry ");

Expand Down Expand Up @@ -116,7 +122,7 @@ extern "C"
l_fapi2rc = getMBvpdField(l_record,
fapi2::MBVPD_KEYWORD_VM,
i_mbTarget,
reinterpret_cast<uint8_t*>(&l_vpdMemoryDataVersion),
reinterpret_cast<uint8_t*>(&l_vpdMDataUnion.vpdMemoryDataVersion),
l_bufSize);

if (l_fapi2rc)
Expand All @@ -127,30 +133,33 @@ extern "C"
}

// Check that sufficient size was returned.
FAPI_ASSERT(l_bufSize >= sizeof(l_vpdMemoryDataVersion),
FAPI_ASSERT(l_bufSize >= sizeof(l_vpdMDataUnion.vpdMemoryDataVersion),
fapi2::CEN_MBVPD_INSUFFICIENT_VPD_RETURNED().
set_KEYWORD(fapi2::MBVPD_KEYWORD_VM).
set_RETURNED_SIZE(l_bufSize).
set_CHIP_TARGET(i_mbTarget),
"getMBvpdMemoryDataVersion:"
" less keyword data returned than expected %d < %d",
l_bufSize, sizeof(l_vpdMemoryDataVersion));

// Check if the format byte in the value returned is in between valid range
FAPI_ASSERT(( ((MBvpdVMKeyword*)(&l_vpdMemoryDataVersion))->iv_version <= VM_SUPPORTED_HIGH_VER ) &&
( ((MBvpdVMKeyword*)(&l_vpdMemoryDataVersion))->iv_version != VM_NOT_SUPPORTED ),
l_bufSize, sizeof(l_vpdMDataUnion.vpdMemoryDataVersion));

// Check if the format byte in the value returned is in between valid
// range
FAPI_ASSERT(( l_vpdMDataUnion.mBvpdVMKeyword.iv_version <=
VM_SUPPORTED_HIGH_VER ) &&
( l_vpdMDataUnion.mBvpdVMKeyword.iv_version !=
VM_NOT_SUPPORTED ),
fapi2::CEN_MBVPD_INVALID_VM_DATA_RETURNED().
set_KEYWORD(fapi2::MBVPD_KEYWORD_VM).
set_RETURNED_VALUE(l_vpdMemoryDataVersion).
set_RETURNED_VALUE(l_vpdMDataUnion.vpdMemoryDataVersion).
set_RECORD_NAME(l_record).
set_DIMM_TYPE(l_dimmType).
set_CHIP_TARGET(i_mbTarget),
"getMBvpdMemoryDataVersion:"
" keyword data returned is invalid : %d ",
l_vpdMemoryDataVersion);
l_vpdMDataUnion.vpdMemoryDataVersion);

// return value
o_val = static_cast<uint32_t>(be16toh(l_vpdMemoryDataVersion));
o_val = static_cast<uint32_t>(be16toh(l_vpdMDataUnion.vpdMemoryDataVersion));

FAPI_DBG("getMBvpdMemoryDataVersion: Memory Data version=0x%08x",
o_val);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<!-- -->
<!-- OpenPOWER HostBoot Project -->
<!-- -->
<!-- Contributors Listed Below - COPYRIGHT 2016,2018 -->
<!-- Contributors Listed Below - COPYRIGHT 2016,2019 -->
<!-- [+] International Business Machines Corp. -->
<!-- -->
<!-- -->
Expand Down Expand Up @@ -53,11 +53,11 @@
<description>Mixing of DDR3 and DDR4 not supported.</description>
<ffdc>DEVICE_TYPE</ffdc>
<callout>
<target>DIMM_DDR4_TARGET</target>
<target>DIMM_DDR3_TARGET</target>
<priority>HIGH</priority>
</callout>
<deconfigure>
<target>DIMM_DDR4_TARGET</target>
<target>DIMM_DDR3_TARGET</target>
</deconfigure>
</hwpError>
<hwpError>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2015,2018 */
/* Contributors Listed Below - COPYRIGHT 2015,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -313,9 +313,10 @@ fapi_try_exit:
/// @param[out] o_setting bc07 settings
/// @return FAPI2_RC_SUCCESS iff okay
///
static fapi2::ReturnCode rank_presence_helper(const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target,
const uint64_t i_num_package_ranks,
uint64_t& o_setting)
static inline fapi2::ReturnCode rank_presence_helper(
const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target,
const uint64_t i_num_package_ranks,
uint64_t& o_setting )
{
switch(i_num_package_ranks)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2016,2018 */
/* Contributors Listed Below - COPYRIGHT 2016,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -219,10 +219,11 @@ fapi_try_exit:
/// @return FAPI2_RC_SUCCESS if and only if ok
///
template< >
fapi2::ReturnCode make_ccs_helper( const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target,
const mrs_data<fapi2::TARGET_TYPE_MCBIST>& i_data,
const uint64_t i_rank,
ccs::instruction_t<fapi2::TARGET_TYPE_MCBIST>& io_inst )
inline fapi2::ReturnCode make_ccs_helper(
const fapi2::Target<fapi2::TARGET_TYPE_DIMM>& i_target,
const mrs_data<fapi2::TARGET_TYPE_MCBIST>& i_data,
const uint64_t i_rank,
ccs::instruction_t<fapi2::TARGET_TYPE_MCBIST>& io_inst )
{
FAPI_TRY( i_data.iv_func(i_target, io_inst, i_rank),
"Failed making a CCS instruction for mrs_data<TARGET_TYPE_MCBIST> specialization. MR%d rank %d on %s",
Expand Down
4 changes: 2 additions & 2 deletions src/import/chips/p9/procedures/hwp/memory/lib/phy/phy_cntrl.H
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2016,2018 */
/* Contributors Listed Below - COPYRIGHT 2016,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -422,7 +422,7 @@ fapi_try_exit:
/// @note Since the these indicators are a summary of all DLLs, all must be started to make
/// them valid.
///
static mss::states dll_cal_status_helper( const bool l_good,
static inline mss::states dll_cal_status_helper( const bool l_good,
const bool l_error,
const bool l_error_fine )
{
Expand Down
20 changes: 9 additions & 11 deletions src/import/chips/p9/procedures/hwp/pm/p9_hcode_image_build.C
Original file line number Diff line number Diff line change
Expand Up @@ -2544,9 +2544,6 @@ fapi2::ReturnCode buildParameterBlock( void* const i_pHomer, CONST_FAPI2_PROC& i

fapi2::current_err = fapi2::FAPI2_RC_SUCCESS;

// use the heap for this large struct
PstateSuperStructure * pStateSupStruct = nullptr;

if( i_imgType.pgpePstateParmBlockBuild )
{

Expand All @@ -2569,14 +2566,15 @@ fapi2::ReturnCode buildParameterBlock( void* const i_pHomer, CONST_FAPI2_PROC& i
uint32_t sizePStateBlock = 0;
uint32_t wofTableSize = i_sizeBuf1;

// Allocate struct onto heap and initialize its memory to zeroes
pStateSupStruct = new PstateSuperStructure();
// Allocate struct onto stack
PstateSuperStructure stateSupStruct;
// Clearing i_pBuf1
memset(i_pBuf1,0x00,i_sizeBuf1);

//Building P-State Parameter block info by calling a HWP
FAPI_DBG("Generating P-State Parameter Block" );
FAPI_EXEC_HWP( retCode, p9_pstate_parameter_block, i_procTgt,
pStateSupStruct, (uint8_t*)i_pBuf1, wofTableSize );
&stateSupStruct, (uint8_t*)i_pBuf1, wofTableSize );
FAPI_TRY(retCode);

//Check if WOF Table is copied properly even if WOF is disabled.
Expand All @@ -2601,7 +2599,7 @@ fapi2::ReturnCode buildParameterBlock( void* const i_pHomer, CONST_FAPI2_PROC& i
//parameter block individually.

FAPI_DBG("Copying Local P-State Parameter Block into CPMR" );
memcpy( pLocalPState, &(pStateSupStruct->localppb), sizePStateBlock );
memcpy( pLocalPState, &(stateSupStruct.localppb), sizePStateBlock );

ALIGN_DBWORD( sizeAligned, sizePStateBlock )
uint32_t localPStateBlock = sizeAligned;
Expand All @@ -2625,7 +2623,8 @@ fapi2::ReturnCode buildParameterBlock( void* const i_pHomer, CONST_FAPI2_PROC& i
"Size of Global Parameter Block Exceeds Max Size Allowed" );

FAPI_DBG("GPPBB pgpeRunningOffset 0x%08x", pgpeRunningOffset );
memcpy( &pPpmr->pgpeSramImage[pgpeRunningOffset], &(pStateSupStruct->globalppb), sizePStateBlock );
memcpy( &pPpmr->pgpeSramImage[pgpeRunningOffset],
&(stateSupStruct.globalppb), sizePStateBlock );

ALIGN_DBWORD( sizeAligned, sizePStateBlock )
FAPI_DBG("GPSPB Actual size 0x%08x After Alignment 0x%08x", sizePStateBlock, sizeAligned );
Expand Down Expand Up @@ -2663,7 +2662,8 @@ fapi2::ReturnCode buildParameterBlock( void* const i_pHomer, CONST_FAPI2_PROC& i
io_ppmrHdr.g_ppmr_oppb_length = sizeAligned;
FAPI_DBG("OPPB ppmrRunningOffset 0x%08x", io_ppmrHdr.g_ppmr_oppb_offset);

memcpy( &pPpmr->occParmBlock, &(pStateSupStruct->occppb), sizePStateBlock );
memcpy( &pPpmr->occParmBlock, &(stateSupStruct.occppb),
sizePStateBlock );

//-------------------------- OCC P-State Parameter Block Ends ------------------------------

Expand Down Expand Up @@ -2720,8 +2720,6 @@ fapi2::ReturnCode buildParameterBlock( void* const i_pHomer, CONST_FAPI2_PROC& i
fapi_try_exit:
FAPI_INF("<< buildParameterBlock");

delete pStateSupStruct;

return fapi2::current_err;
}

Expand Down

0 comments on commit ab6efc5

Please sign in to comment.