Skip to content

Commit

Permalink
Add support for OBUS PLL buckets
Browse files Browse the repository at this point in the history
Add MRW support for ATTR_FREQ_O_MHZ attribute
Add MACRO functions for ATTR_OB[0-3]_PLL_BUCKET attribute

Change-Id: I75d02192bc09c9814fccadadb6aed69606508a58
RTC: 176188
CMVC-Prereq: 1039767
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/48890
Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
  • Loading branch information
Dzuy Nguyen authored and dcrowell77 committed Dec 1, 2017
1 parent 6bc72e2 commit c71ed1c
Show file tree
Hide file tree
Showing 13 changed files with 451 additions and 98 deletions.
32 changes: 32 additions & 0 deletions src/include/usr/fapi2/attribute_service.H
Expand Up @@ -429,6 +429,14 @@ ReturnCode platGetMBvpdAttr(
sizeof(T));
}

/// @brief Function to be called by GETMACRO_OB[0,1,2,3]_PLL_BUCKET
/// functions
/// @param[in] i_fapiTarget FAPI2 Target pointer
/// @param[out] o_bucket_val corresponding number in PLL frequency list
/// @param[in] i_index The index number of the OBUS (0,1,2,3)
ReturnCode getPllBucket(const Target<TARGET_TYPE_ALL>& i_fapiTarget,
uint8_t &o_bucket_val,
const uint8_t i_index);

// -----------------------------------------------------------------------------
// End TODO: End to be supported functions
Expand Down Expand Up @@ -461,6 +469,29 @@ fapiToTargeting::ID, sizeof(VAL), &(VAL))
platAttrSvc::setTargetingAttr(PTARGET, (const TARGETING::ATTRIBUTE_ID)\
fapiToTargeting::ID, sizeof(VAL), &(VAL))

//------------------------------------------------------------------------------
// MACRO to route ATTR_OB[0..3]_PLL_BUCKET access to the correct HB function
//------------------------------------------------------------------------------
#define ATTR_OB0_PLL_BUCKET_GETMACRO(ID,PTARGET,VAL) \
AttrOverrideSync::getAttrOverrideFunc(ID, PTARGET, &VAL)\
? fapi2::ReturnCode() : \
fapi2::platAttrSvc::getPllBucket(PTARGET, VAL, 0)

#define ATTR_OB1_PLL_BUCKET_GETMACRO(ID,PTARGET,VAL) \
AttrOverrideSync::getAttrOverrideFunc(ID, PTARGET, &VAL)\
? fapi2::ReturnCode() : \
fapi2::platAttrSvc::getPllBucket(PTARGET, VAL, 1)

#define ATTR_OB2_PLL_BUCKET_GETMACRO(ID,PTARGET,VAL) \
AttrOverrideSync::getAttrOverrideFunc(ID, PTARGET, &VAL)\
? fapi2::ReturnCode() : \
fapi2::platAttrSvc::getPllBucket(PTARGET, VAL, 2)

#define ATTR_OB3_PLL_BUCKET_GETMACRO(ID,PTARGET,VAL) \
AttrOverrideSync::getAttrOverrideFunc(ID, PTARGET, &VAL)\
? fapi2::ReturnCode() : \
fapi2::platAttrSvc::getPllBucket(PTARGET, VAL, 3)

//------------------------------------------------------------------------------
// MACRO to route ATTR_NAME access to the correct Hostboot function
//------------------------------------------------------------------------------
Expand Down Expand Up @@ -1424,4 +1455,5 @@ fapiToTargeting::ID, sizeof(VAL), &(VAL))
fapi2::platAttrSvc::\
platGetMBvpdAttr<fapi2::ATTR_CEN_VPD_MT_DATA_CONTROL_BYTE_Type>(ID, TARGET, VAL)


#endif // ATTRIBUTESERVICE_H_
6 changes: 5 additions & 1 deletion src/include/usr/fapi2/hwpf_fapi2_reasoncodes.H
Expand Up @@ -61,7 +61,8 @@ namespace fapi2
MOD_FAPI2_BAD_DQ_BITMAP = 0x12,
MOD_FAPI2_GET_CHIP_CFAM_TARGET = 0x13,
MOD_FAPI2_GET_ATTR_CEN_VPD_VERSION = 0x14,
MOD_FAPI2_GET_MB_VPD_ATTR = 0x15
MOD_FAPI2_GET_MB_VPD_ATTR = 0x15,
MOD_FAPI2_GET_PLL_BUCKET = 0x16,
};

/**
Expand Down Expand Up @@ -140,6 +141,9 @@ namespace fapi2

// DIMM SPD generated errors
RC_BAD_DQ_MFG_MODE_BITS = HWPF_COMP_ID | 0x30,
// PLL_BUCKET generated errors
RC_NO_MATCHING_FREQ = HWPF_COMP_ID | 0x31,
RC_FREQ_LIST_NOT_FOUND = HWPF_COMP_ID | 0x32,

};

Expand Down
3 changes: 3 additions & 0 deletions src/include/usr/util/util_reasoncodes.H
Expand Up @@ -51,6 +51,7 @@ namespace Util
UTIL_MCL_REL_MEM = 0x11, // MasterContainerLidMgr::releaseMem
UTIL_MCL_PROCESS_COMP = 0x12, // MasterContainerLidMgr::processComponent
UTIL_MCL_VERIFY_EXT = 0x13, // MasterContainerLidMgr::verifyExtend
UTIL_MOD_GET_OBUS_PLL_BUCKET = 0x14, // UtilCommonAttr::getObusPllBucket
};

enum ReasonCode
Expand Down Expand Up @@ -80,6 +81,8 @@ namespace Util
UTIL_MM_BLOCK_UNMAP_FAILED = UTIL_COMP_ID | 0x17,
UTIL_MCL_SIZE_MISMATCH = UTIL_COMP_ID | 0x18,
UTIL_MCL_COMPID_MISMATCH = UTIL_COMP_ID | 0x19,
UTIL_ERC_NO_FREQ_LIST = UTIL_COMP_ID | 0x1A,
UTIL_ERC_NO_MATCHING_FREQ = UTIL_COMP_ID | 0x1B,
};
};

Expand Down
60 changes: 60 additions & 0 deletions src/include/usr/util/utilcommonattr.H
@@ -0,0 +1,60 @@
/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
/* $Source: src/include/usr/util/utilcommonattr.H $ */
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2017 */
/* [+] 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. */
/* You may obtain a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
/* implied. See the License for the specific language governing */
/* permissions and limitations under the License. */
/* */
/* IBM_PROLOG_END_TAG */
#ifndef UTILCOMMONATTR_H
#define UTILCOMMONATTR_H

/**
* @file utilcommonattr.H
*
* @brief Common attribute interfaces shared between components
*
*/

/*****************************************************************************/
// I n c l u d e s
/*****************************************************************************/
#include <stdint.h>
#include <errl/errlentry.H>

#include <targeting/common/target.H>

namespace Util
{

/**
* @brief Get the OBUS PLL bucket that corresponds to index and target
* @param[in] i_chipTarget Target pointer to chip
* @param[out] i_o_bucket_val corresponding number in PLL frequency list
* @param[in] i_index The index number of the OBUS (0,1,2,3)
*
* @return errlHndl_t Error log if unable to get bucket value
*/
errlHndl_t getObusPllBucket(TARGETING::Target * i_chipTarget,
uint8_t &o_bucket_val,
const uint8_t i_index);

}; // namespace Util

#endif // UTILCOMMONATTR_H
30 changes: 30 additions & 0 deletions src/usr/fapi2/attribute_service.C
Expand Up @@ -61,6 +61,7 @@
#include <targeting/common/utilFilter.H>
#include <targeting/common/util.H>
#include <../memory/lib/shared/mss_const.H>
#include <util/utilcommonattr.H>

#include <secureboot/service.H>

Expand Down Expand Up @@ -1792,6 +1793,35 @@ ReturnCode platGetMBvpdAttr(
return rc;
}

//******************************************************************************
// fapi::platAttrSvc::getPllBucket function
//******************************************************************************
ReturnCode getPllBucket(const Target<TARGET_TYPE_ALL>& i_fapiTarget,
uint8_t & o_bucket_val,
const uint8_t i_index)
{
fapi2::ReturnCode l_rc;
errlHndl_t l_errl = nullptr;

TARGETING::Target * l_chipTarget = nullptr;
l_errl = getTargetingTarget(i_fapiTarget, l_chipTarget);
if(l_errl)
{
FAPI_ERR("getPllBucket: Error from getTargetingTarget");
l_rc.setPlatDataPtr(reinterpret_cast<void *> (l_errl));
}
else
{
l_errl = Util::getObusPllBucket(l_chipTarget, o_bucket_val, i_index);
if (l_errl)
{
FAPI_ERR("getPllBucket: Error from getObusPllBucket");
l_rc.setPlatDataPtr(reinterpret_cast<void *> (l_errl));
}
}
return l_rc;
}

} // End platAttrSvc namespace

} // End fapi2 namespace
131 changes: 131 additions & 0 deletions src/usr/fapi2/test/fapi2PllBucketTest.H
@@ -0,0 +1,131 @@
/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
/* $Source: src/usr/fapi2/test/fapi2PllBucketTest.H $ */
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2016,2017 */
/* [+] 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. */
/* You may obtain a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
/* implied. See the License for the specific language governing */
/* permissions and limitations under the License. */
/* */
/* IBM_PROLOG_END_TAG */
#ifndef __PLL_BUCKET_TEST_H__
#define __PLL_BUCKET_TEST_H__

/**
* @file fapi2PllBucketTest.H
*
* @brief Test case for WOF access code
*/

#include <stdio.h>
#include <cxxtest/TestSuite.H>
#include <errl/errlmanager.H>
#include <errl/errlentry.H>
#include <fapi2.H>
#include <devicefw/userif.H>
#include <utilFilter.H>

using namespace TARGETING;

class PllBucketTest: public CxxTest::TestSuite
{
public:

/**
* @brief Test OB[0,1,2,3]_PLL_BUCKET access attribute
*
*/
void testPllBucket (void)
{
FAPI_INF("testPllBucket: ENTER");

fapi2::ReturnCode l_rc;

TARGETING::TargetHandleList l_chipList;
TARGETING::getAllChips(l_chipList, TARGETING::TYPE_PROC);
TARGETING::Target * l_target = NULL;

for (uint8_t i = 0; i < l_chipList.size(); i++)
{
if(TARGETING::MODEL_NIMBUS ==
l_chipList[i]->getAttr<TARGETING::ATTR_MODEL>())
{
uint8_t l_bucket[4] = {255, 255, 255, 255};
l_target = l_chipList[i];
fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>
fapi2_procTarget(l_target);

//Perform test on OB0
FAPI_DBG("test OB0_PLL_BUCKET on chip HUID: %.8X",
TARGETING::get_huid(l_target));

FAPI_ATTR_GET(fapi2::ATTR_OB0_PLL_BUCKET,
l_target,
l_bucket[0]);
if(l_bucket[0] == 255)
{
TS_FAIL("testPllBucket: OB0_PLL_BUCKET failed, got: %d",
l_bucket[0]);
}

//Perform test on OB1
FAPI_DBG("test OB1_PLL_BUCKET on chip HUID: %.8X",
TARGETING::get_huid(l_target));

FAPI_ATTR_GET(fapi2::ATTR_OB1_PLL_BUCKET,
l_target,
l_bucket[1]);
if(l_bucket[1] == 255)
{
TS_FAIL("testPllBucket: OB1_PLL_BUCKET failed, got: %d",
l_bucket[1]);
}

//Perform test on OB2
FAPI_DBG("test OB2_PLL_BUCKET on chip HUID: %.8X",
TARGETING::get_huid(l_target));

FAPI_ATTR_GET(fapi2::ATTR_OB2_PLL_BUCKET,
l_target,
l_bucket[2]);
if(l_bucket[2] == 255)
{
TS_FAIL("testPllBucket: OB2_PLL_BUCKET failed, got: %d",
l_bucket[2]);
}

//Perform test on OB3
FAPI_DBG("test OB3_PLL_BUCKET on chip HUID: %.8X",
TARGETING::get_huid(l_target));

FAPI_ATTR_GET(fapi2::ATTR_OB3_PLL_BUCKET,
l_target,
l_bucket[3]);
if(l_bucket[3] == 255)
{
TS_FAIL("testPllBucket: OB3_PLL_BUCKET failed, got: %d",
l_bucket[3]);
}
}
}
FAPI_INF("testPllBucket: EXIT.");

} // testPllBucket

};

#endif
25 changes: 16 additions & 9 deletions src/usr/hdat/hdatutil.C
Expand Up @@ -27,6 +27,7 @@
#include <i2c/eepromif.H>
#include <stdio.h>
#include <p9_frequency_buckets.H>
#include <util/utilcommonattr.H>

#define UINT16_IN_LITTLE_ENDIAN(x) (((x) >> 8) | ((x) << 8))
#define HDAT_VPD_RECORD_START_TAG 0x84
Expand Down Expand Up @@ -2003,14 +2004,20 @@ errlHndl_t hdatUpdateSMPLinkInfoData(hdatHDIFDataArray_t * i_SMPInfoFullPcrdHdrP
do{
for(auto & l_SMPInfoEle : l_SMPLinkInfoCntr)
{
uint8_t l_obusChipletPos =
uint8_t l_obusChipletPos =
(uint8_t) l_SMPInfoEle.hdatSMPLinkBrickID / NUM_BRICKS_PER_OBUS;
uint32_t l_obusPllFreqBucket = 0;
uint8_t l_obusPllFreqBucket = 0;
switch( l_obusChipletPos){
case 0: { l_obusPllFreqBucket = i_pProcTarget->getAttr<ATTR_OB0_PLL_BUCKET>(); break;}
case 1: { l_obusPllFreqBucket = i_pProcTarget->getAttr<ATTR_OB1_PLL_BUCKET>(); break;}
case 2: { l_obusPllFreqBucket = i_pProcTarget->getAttr<ATTR_OB2_PLL_BUCKET>(); break;}
case 3: { l_obusPllFreqBucket = i_pProcTarget->getAttr<ATTR_OB3_PLL_BUCKET>(); break;}
case 0:
case 1:
case 2:
case 3:
{
l_errl = Util::getObusPllBucket(i_pProcTarget,
l_obusPllFreqBucket,
l_obusChipletPos);
break;
}
default :{
HDAT_ERR(" Invalid obus Brick ID ");

Expand All @@ -2034,7 +2041,7 @@ errlHndl_t hdatUpdateSMPLinkInfoData(hdatHDIFDataArray_t * i_SMPInfoFullPcrdHdrP
HDAT_ERR(" Error in getting the PLL Freq bucket");
break;
}

if(l_obusPllFreqBucket >= OBUS_PLL_FREQ_BUCKETS)
{
HDAT_ERR(" Invalid obus Freq bucket ");
Expand Down Expand Up @@ -2069,7 +2076,7 @@ errlHndl_t hdatUpdateSMPLinkInfoData(hdatHDIFDataArray_t * i_SMPInfoFullPcrdHdrP
else if(l_chipModel == TARGETING::MODEL_CUMULUS)
{
if(l_chipECLevel == 0x10)
{
{
l_freqList = const_cast<uint32_t *>(OBUS_PLL_FREQ_LIST_P9C_10);
}
}
Expand All @@ -2093,7 +2100,7 @@ errlHndl_t hdatUpdateSMPLinkInfoData(hdatHDIFDataArray_t * i_SMPInfoFullPcrdHdrP

//PLL bucket is 1 based (1,2,3), subtract 1 for 0 based array
uint32_t l_pllfreq = *(l_freqList+l_obusPllFreqBucket -1);

switch( l_pllfreq ){
case 1250:{l_SMPInfoEle.hdatSMPLinkSpeed = HDAT_OBUS_FREQ_20GBPS; break; };
case 1563:{l_SMPInfoEle.hdatSMPLinkSpeed = HDAT_OBUS_FREQ_25GBPS; break; };
Expand Down

0 comments on commit c71ed1c

Please sign in to comment.