summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDzuy Nguyen <dzuy@us.ibm.com>2017-11-01 08:54:12 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2017-12-01 15:22:31 -0500
commitc71ed1c414501ce568f914e38b2ddbbc9c258cb6 (patch)
treecb222fe6f89fc1905454576f0a75745cdc70282b /src
parent6bc72e2973d1868fcccf74f696bcb9bf08a62951 (diff)
downloadtalos-hostboot-c71ed1c414501ce568f914e38b2ddbbc9c258cb6.tar.gz
talos-hostboot-c71ed1c414501ce568f914e38b2ddbbc9c258cb6.zip
Add support for OBUS PLL buckets
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>
Diffstat (limited to 'src')
-rw-r--r--src/include/usr/fapi2/attribute_service.H32
-rw-r--r--src/include/usr/fapi2/hwpf_fapi2_reasoncodes.H6
-rw-r--r--src/include/usr/util/util_reasoncodes.H3
-rw-r--r--src/include/usr/util/utilcommonattr.H60
-rw-r--r--src/usr/fapi2/attribute_service.C30
-rw-r--r--src/usr/fapi2/test/fapi2PllBucketTest.H131
-rw-r--r--src/usr/hdat/hdatutil.C25
-rwxr-xr-xsrc/usr/targeting/common/genHwsvMrwXml.pl11
-rwxr-xr-xsrc/usr/targeting/common/xmltohb/attribute_types.xml67
-rw-r--r--src/usr/targeting/common/xmltohb/hb_customized_attrs.xml22
-rw-r--r--src/usr/util/makefile1
-rw-r--r--src/usr/util/runtime/makefile2
-rw-r--r--src/usr/util/utilcommonattr.C159
13 files changed, 451 insertions, 98 deletions
diff --git a/src/include/usr/fapi2/attribute_service.H b/src/include/usr/fapi2/attribute_service.H
index 47538d00c..dfdd23803 100644
--- a/src/include/usr/fapi2/attribute_service.H
+++ b/src/include/usr/fapi2/attribute_service.H
@@ -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
@@ -462,6 +470,29 @@ 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
//------------------------------------------------------------------------------
#define ATTR_NAME_GETMACRO(ID, PTARGET, VAL) \
@@ -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_
diff --git a/src/include/usr/fapi2/hwpf_fapi2_reasoncodes.H b/src/include/usr/fapi2/hwpf_fapi2_reasoncodes.H
index 0018d3c57..b9b963d28 100644
--- a/src/include/usr/fapi2/hwpf_fapi2_reasoncodes.H
+++ b/src/include/usr/fapi2/hwpf_fapi2_reasoncodes.H
@@ -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,
};
/**
@@ -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,
};
diff --git a/src/include/usr/util/util_reasoncodes.H b/src/include/usr/util/util_reasoncodes.H
index 77fd1e628..8b1e90e8a 100644
--- a/src/include/usr/util/util_reasoncodes.H
+++ b/src/include/usr/util/util_reasoncodes.H
@@ -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
@@ -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,
};
};
diff --git a/src/include/usr/util/utilcommonattr.H b/src/include/usr/util/utilcommonattr.H
new file mode 100644
index 000000000..24aa12df7
--- /dev/null
+++ b/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
diff --git a/src/usr/fapi2/attribute_service.C b/src/usr/fapi2/attribute_service.C
index 2bd43d2e4..4a2cb2500 100644
--- a/src/usr/fapi2/attribute_service.C
+++ b/src/usr/fapi2/attribute_service.C
@@ -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>
@@ -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
diff --git a/src/usr/fapi2/test/fapi2PllBucketTest.H b/src/usr/fapi2/test/fapi2PllBucketTest.H
new file mode 100644
index 000000000..72ddf17e1
--- /dev/null
+++ b/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
diff --git a/src/usr/hdat/hdatutil.C b/src/usr/hdat/hdatutil.C
index 07af121f6..6c1549e82 100644
--- a/src/usr/hdat/hdatutil.C
+++ b/src/usr/hdat/hdatutil.C
@@ -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
@@ -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 ");
@@ -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 ");
@@ -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);
}
}
@@ -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; };
diff --git a/src/usr/targeting/common/genHwsvMrwXml.pl b/src/usr/targeting/common/genHwsvMrwXml.pl
index 7c5528117..4642a309e 100755
--- a/src/usr/targeting/common/genHwsvMrwXml.pl
+++ b/src/usr/targeting/common/genHwsvMrwXml.pl
@@ -4123,6 +4123,17 @@ sub generate_proc
print " <default>$obus_ratio</default>\n";
print " </attribute>\n";
+
+ print " <attribute>\n";
+ print " <id>FREQ_O_MHZ</id>\n";
+ print " <default>" .
+ join (",", ( $reqPol->{'obus_freq_mhz'}->{content},
+ $reqPol->{'obus_freq_mhz'}->{content},
+ $reqPol->{'obus_freq_mhz'}->{content},
+ $reqPol->{'obus_freq_mhz'}->{content} )) .
+ "</default>\n";
+ print " </attribute>\n";
+
my $freq_regions = $reqPol->{'system_resclk_freq_regions'};
my $freq_region_index = $reqPol->{'system_resclk_freq_region_index'};
my $l3_value = $reqPol->{'system_resclk_l3_value'};
diff --git a/src/usr/targeting/common/xmltohb/attribute_types.xml b/src/usr/targeting/common/xmltohb/attribute_types.xml
index c82aa1243..66f489f49 100755
--- a/src/usr/targeting/common/xmltohb/attribute_types.xml
+++ b/src/usr/targeting/common/xmltohb/attribute_types.xml
@@ -7523,73 +7523,6 @@ Selects which voltage level to place the Core and ECO domain PFETs upon Winkle e
</hwpfToHbAttrMap>
</attribute>
-<attribute>
- <id>OB0_PLL_BUCKET</id>
- <description>
- Select OBUS0 pll setting from one of the supported frequencies
- </description>
- <simpleType>
- <uint8_t><default>1</default></uint8_t>
- </simpleType>
- <persistency>non-volatile</persistency>
- <readable/>
- <writeable/><!-- Only because SBE needs it -->
- <hwpfToHbAttrMap>
- <id>ATTR_OB0_PLL_BUCKET</id>
- <macro>DIRECT</macro>
- </hwpfToHbAttrMap>
-</attribute>
-
-<attribute>
- <id>OB1_PLL_BUCKET</id>
- <description>
- Select OBUS1 pll setting from one of the supported frequencies
- </description>
- <simpleType>
- <uint8_t><default>1</default></uint8_t>
- </simpleType>
- <persistency>non-volatile</persistency>
- <readable/>
- <writeable/><!-- Only because SBE needs it -->
- <hwpfToHbAttrMap>
- <id>ATTR_OB1_PLL_BUCKET</id>
- <macro>DIRECT</macro>
- </hwpfToHbAttrMap>
-</attribute>
-
-<attribute>
- <id>OB2_PLL_BUCKET</id>
- <description>
- Select OBUS2 pll setting from one of the supported frequencies
- </description>
- <simpleType>
- <uint8_t><default>1</default></uint8_t>
- </simpleType>
- <persistency>non-volatile</persistency>
- <readable/>
- <writeable/><!-- Only because SBE needs it -->
- <hwpfToHbAttrMap>
- <id>ATTR_OB2_PLL_BUCKET</id>
- <macro>DIRECT</macro>
- </hwpfToHbAttrMap>
-</attribute>
-
-<attribute>
- <id>OB3_PLL_BUCKET</id>
- <description>
- Select OBUS3 pll setting from one of the supported frequencies
- </description>
- <simpleType>
- <uint8_t><default>1</default></uint8_t>
- </simpleType>
- <persistency>non-volatile</persistency>
- <readable/>
- <writeable/><!-- Only because SBE needs it -->
- <hwpfToHbAttrMap>
- <id>ATTR_OB3_PLL_BUCKET</id>
- <macro>DIRECT</macro>
- </hwpfToHbAttrMap>
-</attribute>
<attribute>
<id>USE_TCES_FOR_DMAS</id>
diff --git a/src/usr/targeting/common/xmltohb/hb_customized_attrs.xml b/src/usr/targeting/common/xmltohb/hb_customized_attrs.xml
index ca8fdddbd..326320b7d 100644
--- a/src/usr/targeting/common/xmltohb/hb_customized_attrs.xml
+++ b/src/usr/targeting/common/xmltohb/hb_customized_attrs.xml
@@ -98,27 +98,7 @@
<attribute>
<id>ATTR_FREQ_O_MHZ</id>
- <default>1611</default>
- </attribute>
-
- <attribute>
- <id>ATTR_OB0_PLL_BUCKET</id>
- <default>1</default>
- </attribute>
-
- <attribute>
- <id>ATTR_OB1_PLL_BUCKET</id>
- <default>1</default>
- </attribute>
-
- <attribute>
- <id>ATTR_OB2_PLL_BUCKET</id>
- <default>1</default>
- </attribute>
-
- <attribute>
- <id>ATTR_OB3_PLL_BUCKET</id>
- <default>1</default>
+ <default>1611,1611,1611,1611</default>
</attribute>
<attribute>
diff --git a/src/usr/util/makefile b/src/usr/util/makefile
index 4eddf52f1..c59c9852c 100644
--- a/src/usr/util/makefile
+++ b/src/usr/util/makefile
@@ -41,6 +41,7 @@ OBJS += utilsemipersist.o
OBJS += utilrsvdmem.o
OBJS += utilxipimage.o
OBJS += utilmclmgr.o
+OBJS += utilcommonattr.o
SUBDIRS += test.d
SUBDIRS += runtime.d
diff --git a/src/usr/util/runtime/makefile b/src/usr/util/runtime/makefile
index 3f2ea4e4b..dafd52431 100644
--- a/src/usr/util/runtime/makefile
+++ b/src/usr/util/runtime/makefile
@@ -28,6 +28,7 @@ MODULE = util_rt
## pointer to common HWP files
EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/xip/
+EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/common/include
OBJS += utilbase.o
OBJS += utilstream.o
@@ -39,6 +40,7 @@ OBJS += rt_cmds.o
OBJS += util_rt.o
OBJS += utilrsvdmem.o
OBJS += utilxipimage.o
+OBJS += utilcommonattr.o
SUBDIRS += test.d
diff --git a/src/usr/util/utilcommonattr.C b/src/usr/util/utilcommonattr.C
new file mode 100644
index 000000000..193412a7b
--- /dev/null
+++ b/src/usr/util/utilcommonattr.C
@@ -0,0 +1,159 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/util/utilcommonattr.C $ */
+/* */
+/* 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 */
+#include <util/utilcommonattr.H>
+
+#include "utilbase.H"
+#include <util/util_reasoncodes.H>
+#include <errl/errlmanager.H>
+
+#include <p9_frequency_buckets.H>
+namespace Util
+{
+
+errlHndl_t getObusPllBucket(TARGETING::Target * i_chipTarget,
+ uint8_t &o_bucket_val,
+ const uint8_t i_index)
+{
+ errlHndl_t l_errl = nullptr;
+
+ // Get the corresponding FREQ_O_MHZ frequency number
+ TARGETING::ATTR_FREQ_O_MHZ_type l_freq_array;
+ assert(i_chipTarget->
+ tryGetAttr<TARGETING::ATTR_FREQ_O_MHZ>(l_freq_array),
+ "getPllBucket() failed to get ATTR_FREQ_O_MHZ");
+
+ // Get the frequency list from the chip
+ const uint32_t *l_freqList = nullptr;
+
+ TARGETING::ATTR_MODEL_type l_chipModel =
+ i_chipTarget->getAttr<TARGETING::ATTR_MODEL>();
+
+ TARGETING::ATTR_EC_type l_chipECLevel =
+ i_chipTarget->getAttr<TARGETING::ATTR_EC>();
+
+ if(l_chipModel == TARGETING::MODEL_NIMBUS)
+ {
+ switch (l_chipECLevel)
+ {
+ case 0x10:
+ l_freqList = OBUS_PLL_FREQ_LIST_P9N_10;
+ break;
+ case 0x20:
+ l_freqList = OBUS_PLL_FREQ_LIST_P9N_20;
+ break;
+ case 0x21:
+ l_freqList = OBUS_PLL_FREQ_LIST_P9N_21;
+ break;
+ case 0x22:
+ l_freqList = OBUS_PLL_FREQ_LIST_P9N_22;
+ break;
+ default:
+ TRACFCOMP(g_util_trace, "Unknown EC level 0x%x for NIMBUS",
+ l_chipECLevel);
+ break;
+ }
+ }
+ else if(l_chipModel == TARGETING::MODEL_CUMULUS)
+ {
+ if(l_chipECLevel == 0x10)
+ {
+ l_freqList = OBUS_PLL_FREQ_LIST_P9C_10;
+ }
+ else
+ {
+ TRACFCOMP(g_util_trace, "Unknown EC level 0x%x for CUMULUS",
+ l_chipECLevel);
+ }
+ }
+ //else
+ //{
+ // fall-through, will be caught by l_freqList nullptr check
+ //}
+
+ if(l_freqList != nullptr)
+ {
+ // Look up the frequency from the frequency list
+ uint8_t i = 0;
+ for (i = 0; i < OBUS_PLL_FREQ_BUCKETS; i++)
+ {
+ if(l_freqList[i] == l_freq_array[i_index])
+ {
+ o_bucket_val = i;
+ break;
+ }
+ }
+
+ // make an error if we did not find a matching frequency
+ if(i == OBUS_PLL_FREQ_BUCKETS)
+ {
+ TRACFCOMP(g_util_trace, ERR_MRK
+ "getObusPllBucket: Unable to find matching frequency of %d",
+ l_freq_array[i_index])
+ /*@
+ * @errortype
+ * @moduleid UTIL_MOD_GET_OBUS_PLL_BUCKET
+ * @reasoncode UTIL_ERC_NO_MATCHING_FREQ
+ * @userdata1 HB Target HUID
+ * @userdata2 Input frequency
+ * @devdesc No matching frequency for PLL bucket
+ * @custdesc Firmware Error
+ */
+ l_errl = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE,
+ UTIL_MOD_GET_OBUS_PLL_BUCKET,
+ UTIL_ERC_NO_MATCHING_FREQ,
+ TARGETING::get_huid(i_chipTarget),
+ l_freq_array[i_index]);
+ }
+ }
+ else // l_freqList equals nullptr
+ {
+ TRACFCOMP(g_util_trace,
+ ERR_MRK"getObusPllBucket: Unable to find frequency list" \
+ " for model 0x%.8x, chip level 0x%x", l_chipModel, l_chipECLevel);
+
+ /*@
+ * @errortype
+ * @moduleid UTIL_MOD_GET_OBUS_PLL_BUCKET
+ * @reasoncode UTIL_ERC_NO_FREQ_LIST
+ * @userdata1 HB Target HUID
+ * @userdata1[0:31] Chip model
+ * @userdata2[32:63] Chip EC level
+ * @devdesc Unable to find frequency list
+ * @custdesc Firmware Error
+ */
+ l_errl = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE,
+ UTIL_MOD_GET_OBUS_PLL_BUCKET,
+ UTIL_ERC_NO_FREQ_LIST,
+ TARGETING::get_huid(i_chipTarget),
+ TWO_UINT32_TO_UINT64(
+ l_chipModel,
+ l_chipECLevel)
+ );
+ }
+
+ return l_errl;
+}
+
+}
OpenPOWER on IntegriCloud