diff options
author | Nick Bofferding <bofferdn@us.ibm.com> | 2014-05-13 14:59:42 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2014-06-23 18:18:39 -0500 |
commit | f81a76dc1e804534b3190b4aa64b83f707bd24a3 (patch) | |
tree | 8937c6d2e2cb31c65d02f1d6642e01c9503b884f /src/usr/hwpf/hwp/mc_config | |
parent | 2351fe8a6a86cce8480ee83b9e3eaed107aefe3e (diff) | |
download | talos-hostboot-f81a76dc1e804534b3190b4aa64b83f707bd24a3.tar.gz talos-hostboot-f81a76dc1e804534b3190b4aa64b83f707bd24a3.zip |
Support dynamic VID for AVDD, VPP, VCS, VDD memory voltage domains
- Added AVDD, VPP, VCS, VPP voltage domain ID attributes
- Added offset voltage attributes for all 5 memory voltage domains
- Added VPP base voltage attribute
- Added HWP attributes for all 5 memory voltage domain offset calcs
- Added all new attributes to appropriate targets
- Updated MRW parser to populate voltage domain ID attributes
- Updated MRW parser to populate HWP related optional system attributes
- Updated mss_volt istep to set offset voltages for all domains/membufs
- Updated VID compare/equality operators to handle voltage domain type
- Updated VID populator to add VID programming info from all domains
- Updated VID messages to populate and receive voltage domain type
- Added dynamic VID HWPs, attributes, error XML files
Change-Id: I58f9eb13e4083b192d99308b8314cda0c1078800
RTC: 99246
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/11091
Tested-by: Jenkins Server
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/hwpf/hwp/mc_config')
21 files changed, 2005 insertions, 9 deletions
diff --git a/src/usr/hwpf/hwp/mc_config/makefile b/src/usr/hwpf/hwp/mc_config/makefile index 7d5aad85e..f6cd0e9f2 100644 --- a/src/usr/hwpf/hwp/mc_config/makefile +++ b/src/usr/hwpf/hwp/mc_config/makefile @@ -29,6 +29,8 @@ EXTRAINCDIR += ${ROOTPATH}/src/include/usr/ecmddatabuffer EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/fapi EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/plat EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/hwp +EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/hwp/ +EXTRAINCDIR += ${ROOTPATH}/src/include/usr/hwpf/hwp/utility_procedures/ ## pointer to common HWP files EXTRAINCDIR += ${ROOTPATH}/src/usr/hwpf/hwp/include @@ -61,6 +63,12 @@ OBJS += mss_error_support.o OBJS += mss_eff_pre_config.o OBJS += mss_attr_cleanup.o OBJS += mss_eff_mb_interleave.o +OBJS += mss_volt_vdd_offset.o +OBJS += mss_volt_avdd_offset.o +OBJS += mss_volt_vcs_offset.o +OBJS += mss_volt_vpp_offset.o +OBJS += mss_volt_vddr_offset.o +OBJS += mss_count_active_centaurs.o ## NOTE: add a new directory onto the vpaths when you add a new HWP ##@ VPATH += ${ROOTPATH}/src/usr/hwpf/hwp/??? diff --git a/src/usr/hwpf/hwp/mc_config/mc_config.C b/src/usr/hwpf/hwp/mc_config/mc_config.C index 9d6f9a460..1ad4c3eea 100644 --- a/src/usr/hwpf/hwp/mc_config/mc_config.C +++ b/src/usr/hwpf/hwp/mc_config/mc_config.C @@ -67,6 +67,11 @@ #include "mss_eff_config/opt_memmap.H" #include "mss_attr_cleanup/mss_attr_cleanup.H" #include "mss_eff_mb_interleave/mss_eff_mb_interleave.H" +#include "mss_volt/mss_volt_avdd_offset.H" +#include "mss_volt/mss_volt_vcs_offset.H" +#include "mss_volt/mss_volt_vdd_offset.H" +#include "mss_volt/mss_volt_vddr_offset.H" +#include "mss_volt/mss_volt_vpp_offset.H" namespace MC_CONFIG { @@ -175,10 +180,245 @@ void* call_host_collect_dimm_spd( void *io_pArgs ) return l_stepError.getErrorHandle(); } +/** + * @brief Compares two memory buffer targets based on the voltage domain ID for + * the voltage domain given by the template parameter. Used for sorting + * memory buffer targets within containers. API should be called in well + * controlled conditions where the input restrictions can be guaranteed. + * + * @param[in] i_pMembufLhs + * Left hand side memory buffer target. Must be a memory buffer target, + * and must not be NULL. These conditions are not enforced internally. + * + * @param[in] i_pMembufRhs + * Right hand side memory buffer target. Must be a memory buffer target, + * and must not be NULL. These conditions are not enforced internally. + * + * @tparam VOLTAGE_DOMAIN_ID_ATTR + * Attribute corresponding to voltage domain to compare + * + * @return Bool indicating whether LHS memory buffer target's voltage domain ID + * for the specified domain logically precedes the RHS memory buffer + * target's voltage domain ID for the same domain + */ +template < const TARGETING::ATTRIBUTE_ID VOLTAGE_DOMAIN_ID_ATTR> +bool _compareMembufWrtVoltageDomain( + TARGETING::Target* i_pMembufLhs, + TARGETING::Target* i_pMembufRhs) +{ + typename TARGETING::AttributeTraits< VOLTAGE_DOMAIN_ID_ATTR >::Type + lhsDomain = i_pMembufLhs->getAttr<VOLTAGE_DOMAIN_ID_ATTR>(); + typename TARGETING::AttributeTraits< VOLTAGE_DOMAIN_ID_ATTR >::Type + rhsDomain = i_pMembufRhs->getAttr<VOLTAGE_DOMAIN_ID_ATTR>(); + + return lhsDomain < rhsDomain; +} + +//****************************************************************************** +// setMemoryVoltageDomainOffsetVoltage +//****************************************************************************** + +// TODO via RTC: 110777 +// Optimize setMemoryVoltageDomainOffsetVoltage into templated and non-templated +// pieces to reduce code size + +template< const ATTRIBUTE_ID OFFSET_DISABLEMENT_ATTR, + const ATTRIBUTE_ID OFFSET_VOLTAGE_ATTR, + const ATTRIBUTE_ID VOLTAGE_DOMAIN_ID_ATTR > +errlHndl_t setMemoryVoltageDomainOffsetVoltage() +{ + TRACDCOMP(ISTEPS_TRACE::g_trac_isteps_trace, + "setMemoryVoltageDomainOffsetVoltage enter"); + + errlHndl_t pError = NULL; + + do { + + TARGETING::Target* pSysTarget = NULL; + TARGETING::targetService().getTopLevelTarget(pSysTarget); + assert(pSysTarget != NULL,"System target was NULL."); + + typename AttributeTraits< OFFSET_DISABLEMENT_ATTR >::Type + disableOffsetVoltage = + pSysTarget->getAttr< OFFSET_DISABLEMENT_ATTR >(); + + if(disableOffsetVoltage) + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "INFO: Offset voltage processing disabled for domain type 0x%08X.", + OFFSET_DISABLEMENT_ATTR); + break; + } + + TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "INFO: Offset voltage processing enabled for domain type 0x%08X.", + OFFSET_DISABLEMENT_ATTR); + + typedef fapi::ReturnCode (*pOffsetFn_t)(std::vector<fapi::Target>&); + + struct { + + TARGETING::ATTRIBUTE_ID domain; + pOffsetFn_t fn; + const char* fnName; + + } fnMap[] = { + + {TARGETING::ATTR_AVDD_ID, + mss_volt_avdd_offset,"mss_volt_avdd_offset"}, + {TARGETING::ATTR_VDD_ID , + mss_volt_vdd_offset ,"mss_volt_vdd_offset"}, + {TARGETING::ATTR_VCS_ID , + mss_volt_vcs_offset ,"mss_volt_vcs_offset"}, + {TARGETING::ATTR_VMEM_ID, + mss_volt_vddr_offset,"mss_volt_vddr_offset"}, + {TARGETING::ATTR_VPP_ID , + mss_volt_vpp_offset ,"mss_volt_vpp_offset"} + }; + + size_t recordIndex = 0; + const size_t records = sizeof(fnMap)/sizeof(fnMap[0]); + for(; recordIndex<records; ++recordIndex) + { + if(VOLTAGE_DOMAIN_ID_ATTR == fnMap[recordIndex].domain) + { + break; + } + } + + if(recordIndex >= records) + { + assert(recordIndex < records, + "Code bug! Called setMemoryVoltageDomainOffsetVoltage " + "using unsupported voltage offset attribute type of 0x%08X.", + VOLTAGE_DOMAIN_ID_ATTR); + break; + } + + TARGETING::TargetHandleList membufTargetList; + + // Must pull ALL present memory buffers (not just functional) for these + // computations + getChipResources(membufTargetList, TYPE_MEMBUF, + TARGETING::UTIL_FILTER_PRESENT); + + std::sort(membufTargetList.begin(), membufTargetList.end(), + _compareMembufWrtVoltageDomain< VOLTAGE_DOMAIN_ID_ATTR >); + + std::vector<fapi::Target> membufFapiTargetsList; + typename AttributeTraits< VOLTAGE_DOMAIN_ID_ATTR >::Type lastDomainId + = 0; + + if(!membufTargetList.empty()) + { + lastDomainId = + (*membufTargetList.begin())->getAttr<VOLTAGE_DOMAIN_ID_ATTR>(); + } + + // O(n) algorithm to execute HWPs on groups of memory buffers. As the + // memory buffers are sorted in order of domain ID (several records in a row + // might have same domain ID), walk down the list accumulating targets for + // the HWP until the domain ID changes. The first record is not considered + // a change. At the time the change is detected, run the HWP on the set of + // accumulated targets, clear the list, and accumulate the target with a new + // domain ID as the start of the new list. When we hit end of list, we + // might add this last target to a new accumulation, so we have to go back + // through the loop one more time to process it (being careful not to do + // unholy things to the iterator, etc.) + + // Prevent running the HWP on the first target. Var is used to push us + // through the loop after we exhausted all the targets + bool last = membufTargetList.empty(); + for (TargetHandleList::const_iterator + ppPresentMembuf = membufTargetList.begin(); + ((ppPresentMembuf != membufTargetList.end()) || (last == false)); + ++ppPresentMembuf) + { + // If no valid target to process, this is our last time through the loop + last = (ppPresentMembuf == membufTargetList.end()); + + typename AttributeTraits< VOLTAGE_DOMAIN_ID_ATTR >::Type + currentDomainId = last ? lastDomainId : + (*ppPresentMembuf)->getAttr<VOLTAGE_DOMAIN_ID_ATTR>(); + + // Invoke the HWP if the domain ID in the sorted list change relative to + // prior entry or this is our final time through the loop (and there is + // a list entry to process) + if( ( (currentDomainId != lastDomainId) + || (last)) + && (!membufFapiTargetsList.empty()) ) + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "INFO invoking %s on domain type 0x%08X, ID 0x%08X", + fnMap[recordIndex].fnName, + VOLTAGE_DOMAIN_ID_ATTR, lastDomainId); + + FAPI_INVOKE_HWP( + pError, + fnMap[recordIndex].fn, + membufFapiTargetsList); + + if (pError) + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "ERROR 0x%.8X: %s", + pError->reasonCode(),fnMap[recordIndex].fnName); + break; + } + else + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "SUCCESS : %s",fnMap[recordIndex].fnName ); + } + + membufFapiTargetsList.clear(); + + lastDomainId = currentDomainId; + } + + // If not the last time through loop, there is a new target to + // accumulate + if(!last) + { + const TARGETING::Target* pPresentMembuf = *ppPresentMembuf; + + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "===== add to fapi::Target vector attr type=0x%08X, " + "id=0x%08X, target HUID=0x%08X", + VOLTAGE_DOMAIN_ID_ATTR, + pPresentMembuf->getAttr<VOLTAGE_DOMAIN_ID_ATTR>(), + TARGETING::get_huid(pPresentMembuf)); + + fapi::Target membufFapiTarget(fapi::TARGET_TYPE_MEMBUF_CHIP, + (const_cast<TARGETING::Target*>(pPresentMembuf)) ); + + membufFapiTargetsList.push_back(membufFapiTarget); + } + // Otherwise need to bail, lest we increment the iterator again, which + // is undefined + else + { + break; + } + } + + if(pError) + { + break; + } + + } while(0); + + TRACDCOMP(ISTEPS_TRACE::g_trac_isteps_trace, + "setMemoryVoltageDomainOffsetVoltage exit"); + + return pError; +} + // // Wrapper function to call mss_volt // -void* call_mss_volt( void *io_pArgs ) +void* call_mss_volt( void *io_pArgs ) { errlHndl_t l_err = NULL; @@ -199,7 +439,7 @@ void* call_mss_volt( void *io_pArgs ) { TARGETING::ATTR_VMEM_ID_type l_VmemID = (*l_membuf_iter)->getAttr<ATTR_VMEM_ID>(); - l_VmemList.push_back(l_VmemID); + l_VmemList.push_back(l_VmemID); } std::sort(l_VmemList.begin(), l_VmemList.end()); @@ -232,20 +472,20 @@ void* call_mss_volt( void *io_pArgs ) "target HUID %.8X", l_membuf_target->getAttr<ATTR_VMEM_ID>(), TARGETING::get_huid(l_membuf_target)); - + fapi::Target l_membuf_fapi_target(fapi::TARGET_TYPE_MEMBUF_CHIP, (const_cast<TARGETING::Target*>(l_membuf_target)) ); l_membufFapiTargets.push_back( l_membuf_fapi_target ); } } - + //now have the a list of fapi membufs with just the one VmemId //call the HWP on the list of fapi targets TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "===== mss_volt HWP( vector )" ); FAPI_INVOKE_HWP(l_err, mss_volt, l_membufFapiTargets); - + // process return code. if ( l_err ) { @@ -267,7 +507,73 @@ void* call_mss_volt( void *io_pArgs ) } // endfor + l_err = setMemoryVoltageDomainOffsetVoltage< + TARGETING::ATTR_MSS_CENT_VDD_OFFSET_DISABLE, + TARGETING::ATTR_MEM_VDD_OFFSET_MILLIVOLTS, + TARGETING::ATTR_VDD_ID>(); + if(l_err) + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "ERROR 0x%08X: setMemoryVoltageDomainOffsetVoltage for VDD domain", + l_err->reasonCode()); + l_StepError.addErrorDetails(l_err); + errlCommit(l_err,HWPF_COMP_ID); + } + + l_err = setMemoryVoltageDomainOffsetVoltage< + TARGETING::ATTR_MSS_CENT_AVDD_OFFSET_DISABLE, + TARGETING::ATTR_MEM_AVDD_OFFSET_MILLIVOLTS, + TARGETING::ATTR_AVDD_ID>(); + if(l_err) + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "ERROR 0x%08X: setMemoryVoltageDomainOffsetVoltage for AVDD domain", + l_err->reasonCode()); + l_StepError.addErrorDetails(l_err); + errlCommit(l_err,HWPF_COMP_ID); + } + + l_err = setMemoryVoltageDomainOffsetVoltage< + TARGETING::ATTR_MSS_CENT_VCS_OFFSET_DISABLE, + TARGETING::ATTR_MEM_VCS_OFFSET_MILLIVOLTS, + TARGETING::ATTR_VCS_ID>(); + if(l_err) + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "ERROR 0x%08X: setMemoryVoltageDomainOffsetVoltage for VCS domain", + l_err->reasonCode()); + l_StepError.addErrorDetails(l_err); + errlCommit(l_err,HWPF_COMP_ID); + } + + l_err = setMemoryVoltageDomainOffsetVoltage< + TARGETING::ATTR_MSS_VOLT_VPP_OFFSET_DISABLE, + TARGETING::ATTR_MEM_VPP_OFFSET_MILLIVOLTS, + TARGETING::ATTR_VPP_ID>(); + if(l_err) + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "ERROR 0x%08X: setMemoryVoltageDomainOffsetVoltage for VPP domain", + l_err->reasonCode()); + l_StepError.addErrorDetails(l_err); + errlCommit(l_err,HWPF_COMP_ID); + } + + l_err = setMemoryVoltageDomainOffsetVoltage< + TARGETING::ATTR_MSS_VOLT_VDDR_OFFSET_DISABLE, + TARGETING::ATTR_MEM_VDDR_OFFSET_MILLIVOLTS, + TARGETING::ATTR_VMEM_ID>(); + if(l_err) + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + "ERROR 0x%08X: setMemoryVoltageDomainOffsetVoltage for VDDR domain", + l_err->reasonCode()); + l_StepError.addErrorDetails(l_err); + errlCommit(l_err,HWPF_COMP_ID); + } + TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "call_mss_volt exit" ); + return l_StepError.getErrorHandle(); } diff --git a/src/usr/hwpf/hwp/mc_config/mc_config.H b/src/usr/hwpf/hwp/mc_config/mc_config.H index 59a084a59..12b25b36c 100644 --- a/src/usr/hwpf/hwp/mc_config/mc_config.H +++ b/src/usr/hwpf/hwp/mc_config/mc_config.H @@ -92,7 +92,40 @@ namespace MC_CONFIG */ void* call_host_collect_dimm_spd( void * io_pArgs ); - +/** + * @brief For a given memory voltage domain, program the domain's offset + * voltage if this behavior is enabled, otherwise program 0 + * + * @tparam OFFSET_DISABLEMENT_ATTR + * ID of the attribute to read to determine if a given memory voltage + * domain offset voltage should be applied or not. Should be one of + * the TARGETING::ATTR_*_ID attribute IDs, where * = VMEM, VPP, VCS, + * VDD, or AVDD. + * + * @tparam OFFSET_VOLTAGE_ATTR + * ID of the attribute to receive the given voltage domain's offset voltage + * value. Should be one of the TARGETING::ATTR_MEM_*_OFFSET_MILLIVOLTS + * attribute IDs, where * = VMEM, VPP, VCS, VDD, or AVDD. Only set to + * non-zero when memory voltage domain's offset voltage is enabled. + * + * @tparam VOLTAGE_DOMAIN_ID_ATTR + * ID of the attribute which should be read to obtain the given memory + * voltage domain's ID. IDs are only unique within the same memory voltage + * domain type. Must be one of the ATTR_*_ID attributes, where * = VPP, + * AVDD, VMEM, VDD, VCS. + * + * @note: This function does not ensure that all permutations of the above + * template parameters are valid. + * + * @return Error log handle indicating the status of the request. + * + * @retval NULL Offset voltage successfully programmed or set to 0 + * @retval Failed setting correct offset voltage + */ +template< const TARGETING::ATTRIBUTE_ID OFFSET_DISABLEMENT_ATTR, + const TARGETING::ATTRIBUTE_ID OFFSET_VOLTAGE_ATTR, + const TARGETING::ATTRIBUTE_ID VOLTAGE_DOMAIN_ID_ATTR > +errlHndl_t setMemoryVoltageDomainOffsetVoltage(); /** * @brief mss_volt diff --git a/src/usr/hwpf/hwp/mc_config/mss_volt/memory_mss_volt.xml b/src/usr/hwpf/hwp/mc_config/mss_volt/memory_mss_volt.xml index a72d84c0c..83cf9456e 100644 --- a/src/usr/hwpf/hwp/mc_config/mss_volt/memory_mss_volt.xml +++ b/src/usr/hwpf/hwp/mc_config/mss_volt/memory_mss_volt.xml @@ -22,7 +22,7 @@ <!-- IBM_PROLOG_END_TAG --> <hwpErrors> -<!-- $Id: memory_mss_volt.xml,v 1.2 2014/03/06 00:11:14 jdsloat Exp $ --> +<!-- $Id: memory_mss_volt.xml,v 1.3 2014/06/19 18:41:16 jdsloat Exp $ --> <!-- For file ../../ipl/fapi/mss_volt.C --> <!-- // *! OWNER NAME : Jacob Sloat (jdsloat@us.ibm.com) --> <!-- // *! BACKUP NAME : --> @@ -80,5 +80,26 @@ </deconfigure> </hwpError> + <hwpError> + <rc>RC_MSS_VOLT_OVERIDE_MIXING</rc> + <description>An override is trying to be applied to only a part of the voltage domain. It needs to be applied to the entire domain.</description> + <ffdc>OVERRIDE_TYPE</ffdc> + <ffdc>OVERRIDE_DOMAIN_TYPE</ffdc> + <callout> + <target>MEMB_TARGET</target> + <priority>HIGH</priority> + </callout> + </hwpError> + + <hwpError> + <rc>RC_MSS_VOLT_OVERIDE_UKNOWN</rc> + <description>An uknown override is trying to be applied to the voltage domain. It needs to be none, 1.2 or 1.35V. </description> + <ffdc>OVERRIDE_TYPE</ffdc> + <callout> + <procedure>CODE</procedure> + <priority>HIGH</priority> + </callout> + </hwpError> + </hwpErrors> diff --git a/src/usr/hwpf/hwp/mc_config/mss_volt/memory_mss_volt_avdd_offset.xml b/src/usr/hwpf/hwp/mc_config/mss_volt/memory_mss_volt_avdd_offset.xml new file mode 100644 index 000000000..a66d31391 --- /dev/null +++ b/src/usr/hwpf/hwp/mc_config/mss_volt/memory_mss_volt_avdd_offset.xml @@ -0,0 +1,45 @@ +<!-- IBM_PROLOG_BEGIN_TAG --> +<!-- This is an automatically generated prolog. --> +<!-- --> +<!-- $Source: src/usr/hwpf/hwp/mc_config/mss_volt/memory_mss_volt_avdd_offset.xml $ --> +<!-- --> +<!-- OpenPOWER HostBoot Project --> +<!-- --> +<!-- COPYRIGHT International Business Machines Corp. 2014 --> +<!-- --> +<!-- 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 --> +<hwpErrors> + +<!-- $Id: memory_mss_volt_avdd_offset.xml,v 1.2 2014/06/18 20:26:57 dcadiga Exp $ --> +<!-- For file ../../ipl/fapi/mss_volt_avdd_offset.C --> +<!-- // *! OWNER NAME : Stephen Glancy (sglancy@us.ibm.com) --> +<!-- // *! BACKUP NAME : Jacob Sloat (jdsloat@us.ibm.com) --> + + +<!-- Original Source for RC_MSS_VOLT_TOLERATED_VOLTAGE_VIOLATION memory_errors.xml --> + <hwpError> + <rc>RC_MSS_VOLT_AVDD_OFFSET_VALUE_ERROR</rc> + <description>One or more dynamic AVDD attributes is 0.</description> + <ffdc>AVDD_SLOPE_ACTIVE</ffdc> + <ffdc>AVDD_SLOPE_INACTIVE</ffdc> + <ffdc>AVDD_SLOPE_INTERCEPT</ffdc> + <callout> + <procedure>CODE</procedure> + <priority>HIGH</priority> + </callout> + </hwpError> + +</hwpErrors> + diff --git a/src/usr/hwpf/hwp/mc_config/mss_volt/memory_mss_volt_vcs_offset.xml b/src/usr/hwpf/hwp/mc_config/mss_volt/memory_mss_volt_vcs_offset.xml new file mode 100644 index 000000000..6784a184c --- /dev/null +++ b/src/usr/hwpf/hwp/mc_config/mss_volt/memory_mss_volt_vcs_offset.xml @@ -0,0 +1,45 @@ +<!-- IBM_PROLOG_BEGIN_TAG --> +<!-- This is an automatically generated prolog. --> +<!-- --> +<!-- $Source: src/usr/hwpf/hwp/mc_config/mss_volt/memory_mss_volt_vcs_offset.xml $ --> +<!-- --> +<!-- OpenPOWER HostBoot Project --> +<!-- --> +<!-- COPYRIGHT International Business Machines Corp. 2014 --> +<!-- --> +<!-- 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 --> +<hwpErrors> + +<!-- $Id: memory_mss_volt_vcs_offset.xml,v 1.2 2014/06/18 20:27:01 dcadiga Exp $ --> +<!-- For file ../../ipl/fapi/mss_volt_vcs_offset.C --> +<!-- // *! OWNER NAME : Stephen Glancy (sglancy@us.ibm.com) --> +<!-- // *! BACKUP NAME : Jacob Sloat (jdsloat@us.ibm.com) --> + + +<!-- Original Source for RC_MSS_VOLT_TOLERATED_VOLTAGE_VIOLATION memory_errors.xml --> + <hwpError> + <rc>RC_MSS_VOLT_VCS_OFFSET_VALUE_ERROR</rc> + <ffdc>VCS_SLOPE_ACTIVE</ffdc> + <ffdc>VCS_SLOPE_INACTIVE</ffdc> + <ffdc>VCS_SLOPE_INTERCEPT</ffdc> + <description>One or more dynamic VCS attributes is 0.</description> + <callout> + <procedure>CODE</procedure> + <priority>HIGH</priority> + </callout> + </hwpError> + +</hwpErrors> + diff --git a/src/usr/hwpf/hwp/mc_config/mss_volt/memory_mss_volt_vdd_offset.xml b/src/usr/hwpf/hwp/mc_config/mss_volt/memory_mss_volt_vdd_offset.xml new file mode 100644 index 000000000..d82b37123 --- /dev/null +++ b/src/usr/hwpf/hwp/mc_config/mss_volt/memory_mss_volt_vdd_offset.xml @@ -0,0 +1,45 @@ +<!-- IBM_PROLOG_BEGIN_TAG --> +<!-- This is an automatically generated prolog. --> +<!-- --> +<!-- $Source: src/usr/hwpf/hwp/mc_config/mss_volt/memory_mss_volt_vdd_offset.xml $ --> +<!-- --> +<!-- OpenPOWER HostBoot Project --> +<!-- --> +<!-- COPYRIGHT International Business Machines Corp. 2014 --> +<!-- --> +<!-- 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 --> +<hwpErrors> + +<!-- $Id: memory_mss_volt_vdd_offset.xml,v 1.2 2014/06/18 20:27:05 dcadiga Exp $ --> +<!-- For file ../../ipl/fapi/mss_volt_vdd_offset.C --> +<!-- // *! OWNER NAME : Stephen Glancy (sglancy@us.ibm.com) --> +<!-- // *! BACKUP NAME : Jacob Sloat (jdsloat@us.ibm.com) --> + + +<!-- Original Source for RC_MSS_VOLT_TOLERATED_VOLTAGE_VIOLATION memory_errors.xml --> + <hwpError> + <rc>RC_MSS_VOLT_VDD_OFFSET_VALUE_ERROR</rc> + <ffdc>VDD_SLOPE_ACTIVE</ffdc> + <ffdc>VDD_SLOPE_INACTIVE</ffdc> + <ffdc>VDD_SLOPE_INTERCEPT</ffdc> + <description>One or more dynamic VDD attributes is 0.</description> + <callout> + <procedure>CODE</procedure> + <priority>HIGH</priority> + </callout> + </hwpError> + +</hwpErrors> + diff --git a/src/usr/hwpf/hwp/mc_config/mss_volt/memory_mss_volt_vddr_offset.xml b/src/usr/hwpf/hwp/mc_config/mss_volt/memory_mss_volt_vddr_offset.xml new file mode 100644 index 000000000..d72fa1db0 --- /dev/null +++ b/src/usr/hwpf/hwp/mc_config/mss_volt/memory_mss_volt_vddr_offset.xml @@ -0,0 +1,70 @@ +<!-- IBM_PROLOG_BEGIN_TAG --> +<!-- This is an automatically generated prolog. --> +<!-- --> +<!-- $Source: src/usr/hwpf/hwp/mc_config/mss_volt/memory_mss_volt_vddr_offset.xml $ --> +<!-- --> +<!-- OpenPOWER HostBoot Project --> +<!-- --> +<!-- COPYRIGHT International Business Machines Corp. 2014 --> +<!-- --> +<!-- 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 --> +<hwpErrors> + +<!-- $Id: memory_mss_volt_vddr_offset.xml,v 1.2 2014/06/18 20:27:07 dcadiga Exp $ --> +<!-- For file ../../ipl/fapi/mss_volt_vddr_offset.C --> +<!-- // *! OWNER NAME : Stephen Glancy (sglancy@us.ibm.com) --> +<!-- // *! BACKUP NAME : Jacob Sloat (jdsloat@us.ibm.com) --> + + +<!-- Original Source for RC_MSS_VOLT_TOLERATED_VOLTAGE_VIOLATION memory_errors.xml --> + <hwpError> + <rc>RC_MSS_VOLT_VDDR_OFFSET_DRAM_GEN_MISCOMPARE</rc> + <description>One or more DIMMs has a different generation of DRAM technology level.</description> + <ffdc>DRAM_GEN_MISCOMPARE</ffdc> + <ffdc>DRAM_GEN_START</ffdc> + <ffdc>CEN_MBA_NUM</ffdc> + <ffdc>CEN_TARGET_NUM</ffdc> + <!-- Deconfigure DIMM or Centaur --> + <deconfigure> + <target>CHIP_TARGET</target> + </deconfigure> + </hwpError> + + <hwpError> + <rc>RC_MSS_VOLT_VDDR_OFFSET_VPD_VALUE_ERROR</rc> + <description>one or more VPD voltage attributes is 0.</description> + <ffdc>VPD_MASTER_POWER_SLOPE</ffdc> + <ffdc>VPD_MASTER_POWER_INTERCEPT</ffdc> + <ffdc>CEN_TARGET_NUM</ffdc> + <deconfigure> + <target>CHIP_TARGET</target> + </deconfigure> + </hwpError> + + <hwpError> + <rc>RC_MSS_VOLT_VDDR_OFFSET_VALUE_ERROR</rc> + <ffdc>VDDR_SLOPE_ACTIVE</ffdc> + <ffdc>VDDR_SLOPE_INACTIVE</ffdc> + <ffdc>VDDR_SLOPE_INTERCEPT</ffdc> + <description>One or more dynamic VDDR attributes is 0.</description> + <callout> + <procedure>CODE</procedure> + <priority>HIGH</priority> + </callout> + </hwpError> + + +</hwpErrors> + diff --git a/src/usr/hwpf/hwp/mc_config/mss_volt/memory_mss_volt_vpp_offset.xml b/src/usr/hwpf/hwp/mc_config/mss_volt/memory_mss_volt_vpp_offset.xml new file mode 100644 index 000000000..68356fc6e --- /dev/null +++ b/src/usr/hwpf/hwp/mc_config/mss_volt/memory_mss_volt_vpp_offset.xml @@ -0,0 +1,57 @@ +<!-- IBM_PROLOG_BEGIN_TAG --> +<!-- This is an automatically generated prolog. --> +<!-- --> +<!-- $Source: src/usr/hwpf/hwp/mc_config/mss_volt/memory_mss_volt_vpp_offset.xml $ --> +<!-- --> +<!-- OpenPOWER HostBoot Project --> +<!-- --> +<!-- COPYRIGHT International Business Machines Corp. 2014 --> +<!-- --> +<!-- 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 --> +<hwpErrors> + +<!-- $Id: memory_mss_volt_vpp_offset.xml,v 1.2 2014/06/18 20:27:08 dcadiga Exp $ --> +<!-- For file ../../ipl/fapi/mss_volt_vpp_offset.C --> +<!-- // *! OWNER NAME : Stephen Glancy (sglancy@us.ibm.com) --> +<!-- // *! BACKUP NAME : Jacob Sloat (jdsloat@us.ibm.com) --> + + +<!-- Original Source for RC_MSS_VOLT_TOLERATED_VOLTAGE_VIOLATION memory_errors.xml --> + <hwpError> + <rc>RC_MSS_VOLT_VPP_OFFSET_DRAM_GEN_MISCOMPARE</rc> + <description>One or more DIMMs has a different generation of DRAM technology level.</description> + <ffdc>DRAM_GEN_MISCOMPARE</ffdc> + <ffdc>DRAM_GEN_START</ffdc> + <ffdc>CEN_MBA_NUM</ffdc> + <ffdc>CEN_TARGET_NUM</ffdc> + <!-- Deconfigure DIMM or Centaur --> + <deconfigure> + <target>CHIP_TARGET</target> + </deconfigure> + </hwpError> + + <hwpError> + <rc>RC_MSS_VOLT_VPP_OFFSET_VALUE_ERROR</rc> + <description>One or more dynamic VPP attributes is 0.</description> + <ffdc>VPP_SLOPE</ffdc> + <ffdc>VPP_INTERCEPT</ffdc> + <callout> + <procedure>CODE</procedure> + <priority>HIGH</priority> + </callout> + </hwpError> + +</hwpErrors> + diff --git a/src/usr/hwpf/hwp/mc_config/mss_volt/mss_count_active_centaurs.C b/src/usr/hwpf/hwp/mc_config/mss_volt/mss_count_active_centaurs.C new file mode 100644 index 000000000..6da734b8c --- /dev/null +++ b/src/usr/hwpf/hwp/mc_config/mss_volt/mss_count_active_centaurs.C @@ -0,0 +1,93 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/hwpf/hwp/mc_config/mss_volt/mss_count_active_centaurs.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2014 */ +/* */ +/* 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 */ +// $Id: mss_count_active_centaurs.C,v 1.1 2014/06/16 16:06:23 dcadiga Exp $ +/* File mss_volt_vpp_offset.C created by Stephen Glancy on Tue 20 May 2014. */ + +//------------------------------------------------------------------------------ +// *! (C) Copyright International Business Machines Corp. 2007 +// *! All Rights Reserved -- Property of IBM +// *! *** IBM Confidential *** +//------------------------------------------------------------------------------ +// *! TITLE : mss_volt_vpp_offset.C +// *! DESCRIPTION : Tools for centaur procedures +// *! OWNER NAME : Stephen Glancy (sglancy@us.ibm.com) +// *! BACKUP NAME : Jacob Sloat (jdsloat@us.ibm.com) +// #! ADDITIONAL COMMENTS : +// +// General purpose funcs + +//------------------------------------------------------------------------------ +// Don't forget to create CVS comments when you check in your changes! +//------------------------------------------------------------------------------ +// CHANGE HISTORY: +//------------------------------------------------------------------------------ +// Version:| Author: | Date: | Comment: +//---------|----------|----------|----------------------------------------------- +// 1.1 | sglancy | 05/20/14 | File created + +// This procedure takes a vector of Centaurs and finds the total number of active and inactive centaurs + + +//---------------------------------------------------------------------- +// Includes - FAPI +//---------------------------------------------------------------------- +#include <fapi.H> +#include <mss_count_active_centaurs.H> + +//---------------------------------------------------------------------- +// Constants +//---------------------------------------------------------------------- + + +fapi::ReturnCode mss_count_active_centaurs(std::vector<fapi::Target> & i_targets, uint32_t & var_num_active_centaur, uint32_t &var_num_inactive_centaur) +{ + fapi::ReturnCode l_rc; + //sets up the variables + uint8_t is_functional = 0; + var_num_active_centaur = 0; + var_num_inactive_centaur = 0; + + //loops through and generates the counts + for(uint32_t i=0;i<i_targets.size();i++) { + //gets the functional attribute to check for an active centaur + l_rc = FAPI_ATTR_GET(ATTR_FUNCTIONAL,&i_targets[i],is_functional); + + //found an error + if(l_rc) return l_rc; + + //found an active centaur + if(is_functional == fapi::ENUM_ATTR_FUNCTIONAL_FUNCTIONAL) { + var_num_active_centaur++; + } + //centaur must be inactive + else { + var_num_inactive_centaur++; + } + } + + //debug print + FAPI_INF("RETURNING ACTIVE: %d INACTIVE: %d\n",var_num_active_centaur,var_num_inactive_centaur); + + //return + return l_rc; +} diff --git a/src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt.C b/src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt.C index f6f14b6a2..192c5068a 100644 --- a/src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt.C +++ b/src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt.C @@ -20,7 +20,7 @@ /* permissions and limitations under the License. */ /* */ /* IBM_PROLOG_END_TAG */ -// $Id: mss_volt.C,v 1.13 2014/03/06 00:13:52 jdsloat Exp $ +// $Id: mss_volt.C,v 1.15 2014/06/19 18:44:00 jdsloat Exp $ /* File mss_volt.C created by JEFF SABROWSKI on Fri 21 Oct 2011. */ //------------------------------------------------------------------------------ @@ -54,6 +54,8 @@ // 1.11 | bellows | 07/16/12 | added in Id tag // 1.11 | jdsloat | 10/18/12 | Added check for violation of tolerant voltages of non-functional dimms. // 1.12 | jdsloat | 03/05/14 | RAS review Edits -- Error HW callouts +// 1.13 | jdsloat | 06/05/14 | Added ATTR_MSS_VOLT_VPP being set, as well as ATTR_MSS_VOLT_OVERRIDE +// 1.14 | jdsloat | 06/19/14 | Added error checking associated ATTR_MSS_VOLT_OVERRIDE // This procedure takes a vector of Centaurs behind a voltage domain, // reads in supported DIMM voltages from SPD and determines optimal @@ -73,6 +75,8 @@ const uint32_t MAX_TOLERATED_VOLT = 1500; const uint32_t MAX_TOLERATED_DDR3_VOLT = 1500; const uint32_t MAX_TOLERATED_DDR4_VOLT = 1200; +const uint32_t DDR3_VPP_VOLT = 0000; +const uint32_t DDR4_VPP_VOLT = 2500; fapi::ReturnCode mss_volt(std::vector<fapi::Target> & i_targets_memb) { @@ -84,8 +88,11 @@ fapi::ReturnCode mss_volt(std::vector<fapi::Target> & i_targets_memb) uint8_t l_spd_volts_all_dimms=0x06; //start assuming all voltages supported uint8_t l_dram_ddr3_found_flag=0; uint8_t l_dram_ddr4_found_flag=0; + uint8_t l_volt_override = 0x00; + uint8_t l_volt_override_domain = 0x00; uint32_t l_selected_dram_voltage=0; //this gets written into all centaurs when done. + uint32_t l_selected_dram_voltage_vpp=0; uint32_t l_tolerated_dram_voltage = MAX_TOLERATED_VOLT; //initially set to the max tolerated voltage do @@ -97,6 +104,29 @@ fapi::ReturnCode mss_volt(std::vector<fapi::Target> & i_targets_memb) // Get associated MBA's on this centaur l_rc=fapiGetChildChiplets(i_targets_memb[i], fapi::TARGET_TYPE_MBA_CHIPLET, l_mbaChiplets); if (l_rc) break; + + + l_rc = FAPI_ATTR_GET(ATTR_MSS_VOLT_OVERRIDE, &i_targets_memb[i], l_volt_override); + if (l_rc) break; + + // Note if there is an overrride being applied on the domain + if ( (l_volt_override != fapi::ENUM_ATTR_MSS_VOLT_OVERRIDE_NONE) && (l_volt_override_domain == fapi::ENUM_ATTR_MSS_VOLT_OVERRIDE_NONE) ) + { + l_volt_override_domain = l_volt_override; + } + + // Error if our overides are not the same across the domain + if (l_volt_override_domain != l_volt_override) + { + // this just needs to callout the mismatching memb. + const uint8_t &OVERRIDE_TYPE = l_volt_override; + const uint8_t &OVERRIDE_DOMAIN_TYPE = l_volt_override_domain; + const fapi::Target &MEMB_TARGET = i_targets_memb[i]; + FAPI_ERR("Mismatch volt override request. Domain: 0x%x Current Target Requests: 0x%x", l_volt_override_domain, l_volt_override); + FAPI_SET_HWP_ERROR(l_rc, RC_MSS_VOLT_OVERIDE_MIXING); + fapiLogError(l_rc); + } + // Loop through the 2 MBA's for (uint32_t j=0; j < l_mbaChiplets.size(); j++) { @@ -104,6 +134,7 @@ fapi::ReturnCode mss_volt(std::vector<fapi::Target> & i_targets_memb) // Get a vector of DIMM targets l_rc = fapiGetAssociatedDimms(l_mbaChiplets[j], l_dimm_targets, fapi::TARGET_STATE_PRESENT); if (l_rc) break; + for (uint32_t k=0; k < l_dimm_targets.size(); k++) { l_rc = FAPI_ATTR_GET(ATTR_SPD_DRAM_DEVICE_TYPE, &l_dimm_targets[k], l_spd_dramtype); @@ -212,17 +243,44 @@ fapi::ReturnCode mss_volt(std::vector<fapi::Target> & i_targets_memb) break; } - if (l_dram_ddr3_found_flag && ((l_spd_volts_all_dimms & fapi::ENUM_ATTR_SPD_MODULE_NOMINAL_VOLTAGE_OP1_35) == fapi::ENUM_ATTR_SPD_MODULE_NOMINAL_VOLTAGE_OP1_35)) + + if (l_volt_override != fapi::ENUM_ATTR_MSS_VOLT_OVERRIDE_NONE) + { + if (l_volt_override == fapi::ENUM_ATTR_MSS_VOLT_OVERRIDE_VOLT_135) + { + l_tolerated_dram_voltage = 1350; + FAPI_INF( "mss_volt_overide being applied. MSS_VOLT_OVERRIDE: 1.35V"); + FAPI_INF( "NOTE: Still checking for violations of tolerated voltage. If DIMMs cannot tolerate, the override will not be applied."); + } + if (l_volt_override == fapi::ENUM_ATTR_MSS_VOLT_OVERRIDE_VOLT_120) + { + l_tolerated_dram_voltage = 1200; + FAPI_INF( "mss_volt_overide being applied. MSS_VOLT_OVERRIDE: 1.20V"); + FAPI_INF( "NOTE: Still checking for violations of tolerated voltage. If DIMMs cannot tolerate, the override will not be applied."); + } + else + { + const uint8_t &OVERRIDE_TYPE = l_volt_override; + FAPI_ERR("Unknown volt override request. Override Request: 0x%x", l_volt_override); + FAPI_SET_HWP_ERROR(l_rc, RC_MSS_VOLT_OVERIDE_UKNOWN); + fapiLogError(l_rc); + } + + } + else if (l_dram_ddr3_found_flag && ((l_spd_volts_all_dimms & fapi::ENUM_ATTR_SPD_MODULE_NOMINAL_VOLTAGE_OP1_35) == fapi::ENUM_ATTR_SPD_MODULE_NOMINAL_VOLTAGE_OP1_35)) { l_selected_dram_voltage=1350; + l_selected_dram_voltage_vpp = DDR3_VPP_VOLT; } else if (l_dram_ddr4_found_flag && ((l_spd_volts_all_dimms & fapi::ENUM_ATTR_SPD_MODULE_NOMINAL_VOLTAGE_OP1_2X) == fapi::ENUM_ATTR_SPD_MODULE_NOMINAL_VOLTAGE_OP1_2X)) { l_selected_dram_voltage=1200; + l_selected_dram_voltage_vpp = DDR4_VPP_VOLT; } else if ((l_spd_volts_all_dimms & fapi::ENUM_ATTR_SPD_MODULE_NOMINAL_VOLTAGE_NOTOP1_5) != fapi::ENUM_ATTR_SPD_MODULE_NOMINAL_VOLTAGE_NOTOP1_5) { l_selected_dram_voltage=1500; + l_selected_dram_voltage_vpp = DDR3_VPP_VOLT; } else { @@ -274,6 +332,8 @@ fapi::ReturnCode mss_volt(std::vector<fapi::Target> & i_targets_memb) break; } + + // Must check to see if we violate Tolerent voltages of Non-functional Dimms // If so we must error/deconfigure on the dimm level primarily then centaur level. // Iterate through the list of centaurs @@ -367,6 +427,11 @@ fapi::ReturnCode mss_volt(std::vector<fapi::Target> & i_targets_memb) l_rc = FAPI_ATTR_SET(ATTR_MSS_VOLT, &i_targets_memb[i], l_selected_dram_voltage); FAPI_INF( "mss_volt calculation complete. MSS_VOLT: %d", l_selected_dram_voltage); if (l_rc) break; + + l_rc = FAPI_ATTR_SET(ATTR_MSS_VOLT_VPP, &i_targets_memb[i], l_selected_dram_voltage_vpp); + FAPI_INF( "mss_volt calculation complete. MSS_VOLT_VPP: %d", l_selected_dram_voltage_vpp); + if (l_rc) break; + } }while(0); return l_rc; diff --git a/src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_avdd_offset.C b/src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_avdd_offset.C new file mode 100644 index 000000000..c403ea37b --- /dev/null +++ b/src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_avdd_offset.C @@ -0,0 +1,127 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_avdd_offset.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2014 */ +/* */ +/* 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 */ +// $Id: mss_volt_avdd_offset.C,v 1.6 2014/06/18 20:34:16 dcadiga Exp $ +/* File mss_volt_avdd_offset.C created by Stephen Glancy on Tue 20 May 2014. */ + +//------------------------------------------------------------------------------ +// *! (C) Copyright International Business Machines Corp. 2007 +// *! All Rights Reserved -- Property of IBM +// *! *** IBM Confidential *** +//------------------------------------------------------------------------------ +// *! TITLE : mss_volt_avdd_offset.C +// *! DESCRIPTION : Tools for centaur procedures +// *! OWNER NAME : Stephen Glancy (sglancy@us.ibm.com) +// *! BACKUP NAME : Jacob Sloat (jdsloat@us.ibm.com) +// #! ADDITIONAL COMMENTS : +// +// General purpose funcs + +//------------------------------------------------------------------------------ +// Don't forget to create CVS comments when you check in your changes! +//------------------------------------------------------------------------------ +// CHANGE HISTORY: +//------------------------------------------------------------------------------ +// Version:| Author: | Date: | Comment: +//---------|----------|----------|----------------------------------------------- +// 1.6 | sglancy | 06/18/14 | Updated errors +// 1.5 | sglancy | 06/09/14 | Updated debug statements +// 1.4 | sglancy | 06/04/14 | Updated to include output attribute +// 1.3 | sglancy | 05/30/14 | Formatted code +// 1.2 | sglancy | 05/29/14 | Fixed attributes units and equations +// 1.1 | sglancy | 05/20/14 | File created + +// This procedure takes a vector of Centaurs behind the avdd voltage domain, +// reads in supported DIMM voltages from SPD and determines optimal +// voltage bin for the DIMM voltage domain. +// supported voltage bins: 1.50 V + + +//---------------------------------------------------------------------- +// Includes - FAPI +//---------------------------------------------------------------------- +#include <fapi.H> +#include <mss_volt_avdd_offset.H> +#include <mss_count_active_centaurs.H> + +//---------------------------------------------------------------------- +// Constants +//---------------------------------------------------------------------- + + +fapi::ReturnCode mss_volt_avdd_offset(std::vector<fapi::Target> & i_targets) +{ + //declares variables + fapi::ReturnCode l_rc; + uint32_t var_num_active_centaur = 0; + uint32_t var_num_inactive_centaur = 0; + uint32_t slope_active, slope_inactive, intercept; + uint8_t enable; + + //voltage should not be updated if the disable is set + l_rc = FAPI_ATTR_GET(ATTR_MSS_AVDD_OFFSET_DISABLE,NULL,enable); + if(l_rc) return l_rc; + if(enable == fapi::ENUM_ATTR_MSS_AVDD_OFFSET_DISABLE_DISABLE) { + FAPI_INF("ATTR_MSS_AVDD_OFFSET_DISABLE is set to be disabled. Exiting....."); + return l_rc; + } + + //computes avdd value + //gets the necessary attributes and checks for errors + l_rc = FAPI_ATTR_GET(ATTR_MSS_AVDD_SLOPE_ACTIVE,NULL,slope_active); + if(l_rc) return l_rc; + l_rc = FAPI_ATTR_GET(ATTR_MSS_AVDD_SLOPE_INACTIVE,NULL,slope_inactive); + if(l_rc) return l_rc; + l_rc = FAPI_ATTR_GET(ATTR_MSS_AVDD_SLOPE_INTERCEPT,NULL,intercept); + if(l_rc) return l_rc; + + //checks to make sure that none of the values are zeros. If any of the values are 0's then 0 * any other value = 0 + if((slope_active * slope_inactive * intercept) == 0) { + const uint32_t &AVDD_SLOPE_ACTIVE = slope_active; + const uint32_t &AVDD_SLOPE_INACTIVE = slope_inactive; + const uint32_t &AVDD_SLOPE_INTERCEPT = intercept; + FAPI_SET_HWP_ERROR(l_rc, RC_MSS_VOLT_AVDD_OFFSET_VALUE_ERROR); + FAPI_ERR("One or more dynamic AVDD attributes is 0.\nExiting...."); + return l_rc; + } + + //debug print + FAPI_INF("slope_active: %d uV/centaur slope_inactive: %d uV/centaur slope_intercept: %d mV",slope_active,slope_inactive,intercept); + + //generates the count of active and inactive centaurs + l_rc = mss_count_active_centaurs(i_targets, var_num_active_centaur, var_num_inactive_centaur); + if(l_rc) return l_rc; + FAPI_INF("var_active: %d centaurs var_inactive: %d centaurs",var_num_active_centaur,var_num_inactive_centaur); + + //computes and sets the appropriate attribute + uint32_t param_avdd_voltage_uv = (slope_active * var_num_active_centaur) + (slope_inactive * var_num_inactive_centaur) + 1000 * intercept; + //rounds and converts the voltage offset into mV + uint32_t param_avdd_voltage_mv = (500 + param_avdd_voltage_uv) / 1000; + FAPI_INF("ATTR_MSS_AVDD_OFFSET: %d mV",param_avdd_voltage_mv); + + //sets the output attributes + for(uint32_t i = 0; i< i_targets.size();i++) { + l_rc = FAPI_ATTR_SET(ATTR_MSS_AVDD_OFFSET,&i_targets[i],param_avdd_voltage_mv); + if(l_rc) return l_rc; + }//end for + return l_rc; +} diff --git a/src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_avdd_offset.H b/src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_avdd_offset.H new file mode 100644 index 000000000..a105baf89 --- /dev/null +++ b/src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_avdd_offset.H @@ -0,0 +1,71 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_avdd_offset.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2014 */ +/* */ +/* 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 */ +// $Id: mss_volt_avdd_offset.H,v 1.4 2014/06/18 20:34:28 dcadiga Exp $ +//------------------------------------------------------------------------------ +// *! (C) Copyright International Business Machines Corp. 2011 +// *! All Rights Reserved -- Property of IBM +// *! *** IBM Confidential *** +//------------------------------------------------------------------------------ +// *! TITLE : mss_volt_avdd_offset.H +// *! DESCRIPTION : see additional comments below +// *! OWNER NAME : Stephen Glancy Email: sglancy@us.ibm.com +// *! BACKUP NAME : Jacob Sloat Email: jdsloat@us.ibm.com +// *! ADDITIONAL COMMENTS : +// +// Header file for mss_volt_avdd_offset. +// +//------------------------------------------------------------------------------ +// Don't forget to create CVS comments when you check in your changes! +//------------------------------------------------------------------------------ +// CHANGE HISTORY: +//------------------------------------------------------------------------------ +// Version:| Author: | Date: | Comment: +//---------|----------|----------|----------------------------------------------- +// 1.4 | sglancy | 06/16/14 | Updated to include output attribute +// 1.3 | sglancy | 06/04/14 | Updated to include output attribute +// 1.2 | sglancy | 05/30/14 | changed function to return a value in uV +// 1.1 | sglancy | 05/20/14 | initial drop +#ifndef MSS_VOLT_AVDD_OFFSET_H_ +#define MSS_VOLT_AVDD_OFFSET_H_ + +#include <fapi.H> + +typedef fapi::ReturnCode (*mss_volt_avdd_offset_FP_t)(std::vector<fapi::Target> & i_targets); + +extern "C" +{ + +/** + * @brief mss_volt_avdd_offset procedure. Determines operating avdd voltage for dimms behind a avdd voltage domain + * + * @param[in] std::vector<fapi::Target> l_targets Reference to vector of Centaur Targets in a particular avdd power domain + * + * @return ReturnCode + */ + + fapi::ReturnCode mss_volt_avdd_offset(std::vector<fapi::Target> & i_targets + ); + +} // extern "C" + +#endif // MSS_VOLT_AVDD_OFFSET_H_ diff --git a/src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_vcs_offset.C b/src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_vcs_offset.C new file mode 100644 index 000000000..8b8cd2b44 --- /dev/null +++ b/src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_vcs_offset.C @@ -0,0 +1,149 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_vcs_offset.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2014 */ +/* */ +/* 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 */ +// $Id: mss_volt_vcs_offset.C,v 1.7 2014/06/19 16:06:11 dcadiga Exp $ +/* File mss_volt_vcs_offset.C created by Stephen Glancy on Tue 20 May 2014. */ + +//------------------------------------------------------------------------------ +// *! (C) Copyright International Business Machines Corp. 2007 +// *! All Rights Reserved -- Property of IBM +// *! *** IBM Confidential *** +//------------------------------------------------------------------------------ +// *! TITLE : mss_volt_vcs_offset.C +// *! DESCRIPTION : Tools for centaur procedures +// *! OWNER NAME : Stephen Glancy (sglancy@us.ibm.com) +// *! BACKUP NAME : Jacob Sloat (jdsloat@us.ibm.com) +// #! ADDITIONAL COMMENTS : +// +// General purpose funcs + +//------------------------------------------------------------------------------ +// Don't forget to create CVS comments when you check in your changes! +//------------------------------------------------------------------------------ +// CHANGE HISTORY: +//------------------------------------------------------------------------------ +// Version:| Author: | Date: | Comment: +//---------|----------|----------|----------------------------------------------- +// 1.7 | sglancy | 06/19/14 | Includes update to force the VCS to be 100 mV higher than the VDD +// 1.6 | sglancy | 06/18/14 | Updated errors +// 1.5 | sglancy | 06/09/14 | Updated debug statements +// 1.4 | sglancy | 06/04/14 | Updated to include output attribute +// 1.3 | sglancy | 05/30/14 | Formatted code +// 1.2 | sglancy | 05/29/14 | Fixed attributes units and equations +// 1.1 | sglancy | 05/20/14 | File created + +// This procedure takes a vector of Centaurs behind the vcs voltage domain, +// reads in supported DIMM voltages from SPD and determines optimal +// voltage bin for the DIMM voltage domain. +// supported voltage bins: 1.104 V + + +//---------------------------------------------------------------------- +// Includes - FAPI +//---------------------------------------------------------------------- +#include <fapi.H> +#include <mss_volt_vcs_offset.H> +#include <mss_count_active_centaurs.H> + +//---------------------------------------------------------------------- +// Constants +//---------------------------------------------------------------------- + + +fapi::ReturnCode mss_volt_vcs_offset(std::vector<fapi::Target> & i_targets) +{ + //declares variables + fapi::ReturnCode l_rc; + uint32_t var_num_active_centaur = 0; + uint32_t var_num_inactive_centaur = 0; + uint32_t slope_active, slope_inactive, intercept; + uint8_t enable; + + //voltage should not be updated if the disable is set + l_rc = FAPI_ATTR_GET(ATTR_MSS_VCS_OFFSET_DISABLE,NULL,enable); + //error check + if(l_rc) return l_rc; + if(enable == fapi::ENUM_ATTR_MSS_VCS_OFFSET_DISABLE_DISABLE) { + FAPI_INF("ATTR_MSS_VCS_OFFSET_DISABLE is set to be disabled. Exiting....."); + return l_rc; + } + + //computes vcs value + //gets the necessary attributes and checks for errors + l_rc = FAPI_ATTR_GET(ATTR_MSS_VCS_SLOPE_ACTIVE,NULL,slope_active); + if(l_rc) return l_rc; + l_rc = FAPI_ATTR_GET(ATTR_MSS_VCS_SLOPE_INACTIVE,NULL,slope_inactive); + if(l_rc) return l_rc; + l_rc = FAPI_ATTR_GET(ATTR_MSS_VCS_SLOPE_INTERCEPT,NULL,intercept); + if(l_rc) return l_rc; + + //checks to make sure that none of the values are zeros. If any of the values are 0's then 0 * any other value = 0 + if((slope_active * slope_inactive * intercept) == 0) { + const uint32_t &VCS_SLOPE_ACTIVE = slope_active; + const uint32_t &VCS_SLOPE_INACTIVE = slope_inactive; + const uint32_t &VCS_SLOPE_INTERCEPT = intercept; + FAPI_SET_HWP_ERROR(l_rc, RC_MSS_VOLT_VCS_OFFSET_VALUE_ERROR); + FAPI_ERR("One or more dynamic VCS attributes is 0.\nExiting...."); + return l_rc; + } + + //debug print + FAPI_INF("slope_active: %d uV/centaur slope_inactive: %d uV/centaur slope_intercept: %d mV\n",slope_active,slope_inactive,intercept); + + //generates the list of active and inactive centaurs + l_rc = mss_count_active_centaurs(i_targets, var_num_active_centaur, var_num_inactive_centaur); + if(l_rc) return l_rc; + FAPI_INF("var_active: %d centaurs var_inactive: %d centaurs\n",var_num_active_centaur,var_num_inactive_centaur); + + //computes and sets the appropriate attribute + uint32_t param_vcs_voltage_uv = (slope_active * var_num_active_centaur) + (slope_inactive * var_num_inactive_centaur) + 1000 * intercept; + //rounds and converts the voltage offset into mV + uint32_t param_vcs_voltage_mv = (500 + param_vcs_voltage_uv) / 1000; + FAPI_INF("Post calculation ATTR_MSS_VCS_OFFSET: %d mV",param_vcs_voltage_mv); + + //checks to see if VDD is disabled, if so, skip the required VCS increase check + l_rc = FAPI_ATTR_GET(ATTR_MSS_VDD_OFFSET_DISABLE,NULL,enable); + //error check + if(l_rc) return l_rc; + if(enable == fapi::ENUM_ATTR_MSS_VDD_OFFSET_DISABLE_ENABLE) { + FAPI_INF("ATTR_MSS_VDD_OFFSET_DISABLE is set to be enabled. Checking VCS levels"); + //adjusts the param_vcs_voltage_mv to be at least 100 mV higher than vcs + for(uint32_t i = 0; i< i_targets.size();i++) { + uint32_t param_vdd_voltage_mv = 0; + l_rc = FAPI_ATTR_GET(ATTR_MSS_VDD_OFFSET,&i_targets[i],param_vdd_voltage_mv); + if(l_rc) return l_rc; + //adjusts the voltage accordingly + if(param_vdd_voltage_mv + 100 > param_vcs_voltage_mv) { + param_vcs_voltage_mv = 100 + param_vdd_voltage_mv; + } + } + FAPI_INF("Post adjust ATTR_MSS_VCS_OFFSET: %d mV",param_vcs_voltage_mv); + } + + //sets the output attributes + for(uint32_t i = 0; i< i_targets.size();i++) { + l_rc = FAPI_ATTR_SET(ATTR_MSS_VCS_OFFSET,&i_targets[i],param_vcs_voltage_mv); + if(l_rc) return l_rc; + }//end for + + return l_rc; +} diff --git a/src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_vcs_offset.H b/src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_vcs_offset.H new file mode 100644 index 000000000..073e72ff2 --- /dev/null +++ b/src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_vcs_offset.H @@ -0,0 +1,70 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_vcs_offset.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2014 */ +/* */ +/* 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 */ +// $Id: mss_volt_vcs_offset.H,v 1.4 2014/06/18 20:34:32 dcadiga Exp $ +//------------------------------------------------------------------------------ +// *! (C) Copyright International Business Machines Corp. 2011 +// *! All Rights Reserved -- Property of IBM +// *! *** IBM Confidential *** +//------------------------------------------------------------------------------ +// *! TITLE : mss_volt_vcs_offset.H +// *! DESCRIPTION : see additional comments below +// *! OWNER NAME : Stephen Glancy Email: sglancy@us.ibm.com +// *! BACKUP NAME : Jacob Sloat Email: jdsloat@us.ibm.com +// *! ADDITIONAL COMMENTS : +// +// Header file for mss_volt_vcs_offset. +// +//------------------------------------------------------------------------------ +// Don't forget to create CVS comments when you check in your changes! +//------------------------------------------------------------------------------ +// CHANGE HISTORY: +//------------------------------------------------------------------------------ +// Version:| Author: | Date: | Comment: +//---------|----------|----------|----------------------------------------------- +// 1.4 | sglancy | 06/16/14 | Updated to fix define to be VCS and some formatting fixes +// 1.3 | sglancy | 06/04/14 | Updated to include output attribute +// 1.2 | sglancy | 05/30/14 | changed function to return a value in uV +// 1.1 | sglancy | 05/20/14 | initial drop +#ifndef MSS_VOLT_VCS_OFFSET_H_ +#define MSS_VOLT_VCS_OFFSET_H_ + +#include <fapi.H> + +typedef fapi::ReturnCode (*mss_volt_vcs_offset_FP_t)(std::vector<fapi::Target> &); + +extern "C" +{ + +/** + * @brief mss_volt_vcs_offset procedure. Determines operating vcs voltage for dimms behind a vcs voltage domain + * + * @param[in] std::vector<fapi::Target> l_targets Reference to vector of Centaur Targets in a particular vcs power domain + * + * @return ReturnCode + */ + + fapi::ReturnCode mss_volt_vcs_offset(std::vector<fapi::Target> & i_targets); + +} // extern "C" + +#endif // MSS_VOLT_VCS_OFFSET_H_ diff --git a/src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_vdd_offset.C b/src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_vdd_offset.C new file mode 100644 index 000000000..780487c05 --- /dev/null +++ b/src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_vdd_offset.C @@ -0,0 +1,129 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_vdd_offset.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2014 */ +/* */ +/* 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 */ +// $Id: mss_volt_vdd_offset.C,v 1.6 2014/06/18 20:34:34 dcadiga Exp $ +/* File mss_volt_vdd_offset.C created by Stephen Glancy on Tue 20 May 2014. */ + +//------------------------------------------------------------------------------ +// *! (C) Copyright International Business Machines Corp. 2007 +// *! All Rights Reserved -- Property of IBM +// *! *** IBM Confidential *** +//------------------------------------------------------------------------------ +// *! TITLE : mss_volt_vdd_offset.C +// *! DESCRIPTION : Tools for centaur procedures +// *! OWNER NAME : Stephen Glancy (sglancy@us.ibm.com) +// *! BACKUP NAME : Jacob Sloat (jdsloat@us.ibm.com) +// #! ADDITIONAL COMMENTS : +// +// General purpose funcs + +//------------------------------------------------------------------------------ +// Don't forget to create CVS comments when you check in your changes! +//------------------------------------------------------------------------------ +// CHANGE HISTORY: +//------------------------------------------------------------------------------ +// Version:| Author: | Date: | Comment: +//---------|----------|----------|----------------------------------------------- +// 1.6 | sglancy | 06/18/14 | Updated error flags +// 1.5 | sglancy | 06/09/14 | Updated debug statements +// 1.4 | sglancy | 06/04/14 | Updated to include output attribute +// 1.3 | sglancy | 05/30/14 | Formatted code +// 1.2 | sglancy | 05/29/14 | Fixed attributes units and equations +// 1.1 | sglancy | 05/20/14 | File created + +// This procedure takes a vector of Centaurs behind the vdd voltage domain, +// reads in supported DIMM voltages from SPD and determines optimal +// voltage bin for the DIMM voltage domain. +// supported voltage bins: 0.97V + + +//---------------------------------------------------------------------- +// Includes - FAPI +//---------------------------------------------------------------------- +#include <fapi.H> +#include <mss_volt_vdd_offset.H> +#include <mss_count_active_centaurs.H> + +//---------------------------------------------------------------------- +// Constants +//---------------------------------------------------------------------- + + +fapi::ReturnCode mss_volt_vdd_offset(std::vector<fapi::Target> & i_targets) +{ + //declares variables + fapi::ReturnCode l_rc; + uint32_t var_num_active_centaur = 0; + uint32_t var_num_inactive_centaur = 0; + uint32_t slope_active, slope_inactive, intercept; + uint8_t enable; + + //voltage should not be updated if the disable is set + l_rc = FAPI_ATTR_GET(ATTR_MSS_VDD_OFFSET_DISABLE,NULL,enable); + //error check + if(l_rc) return l_rc; + if(enable == fapi::ENUM_ATTR_MSS_VDD_OFFSET_DISABLE_DISABLE) { + FAPI_INF("ATTR_MSS_VCS_OFFSET_DISABLE is set to be disabled. Exiting....."); + return l_rc; + } + + //computes vdd value + //gets the necessary attributes and checks for errors + l_rc = FAPI_ATTR_GET(ATTR_MSS_VDD_SLOPE_ACTIVE,NULL,slope_active); + if(l_rc) return l_rc; + l_rc = FAPI_ATTR_GET(ATTR_MSS_VDD_SLOPE_INACTIVE,NULL,slope_inactive); + if(l_rc) return l_rc; + l_rc = FAPI_ATTR_GET(ATTR_MSS_VDD_SLOPE_INTERCEPT,NULL,intercept); + if(l_rc) return l_rc; + + //checks to make sure that none of the values are zeros. If any of the values are 0's then 0 * any other value = 0 + if((slope_active * slope_inactive * intercept) == 0) { + const uint32_t &VDD_SLOPE_ACTIVE = slope_active; + const uint32_t &VDD_SLOPE_INACTIVE = slope_inactive; + const uint32_t &VDD_SLOPE_INTERCEPT = intercept; + FAPI_SET_HWP_ERROR(l_rc, RC_MSS_VOLT_VDD_OFFSET_VALUE_ERROR); + FAPI_ERR("One or more dynamic VDD attributes is 0.\nExiting...."); + return l_rc; + } + + //debug print + FAPI_INF("slope_active: %d uV/centaur slope_inactive: %d uV/centaur slope_intercept: %d mV\n",slope_active,slope_inactive,intercept); + + //generates the list of active and inactive centaurs + l_rc = mss_count_active_centaurs(i_targets, var_num_active_centaur, var_num_inactive_centaur); + if(l_rc) return l_rc; + FAPI_INF("var_active: %d centaurs var_inactive: %d centaurs\n",var_num_active_centaur,var_num_inactive_centaur); + + //computes and sets the appropriate attribute + uint32_t param_vdd_voltage_uv = (slope_active * var_num_active_centaur) + (slope_inactive * var_num_inactive_centaur) + 1000 * intercept; + //rounds and converts the voltage offset into mV + uint32_t param_vdd_voltage_mv = (500 + param_vdd_voltage_uv) / 1000; + FAPI_INF("ATTR_MSS_VDD_OFFSET: %d mV",param_vdd_voltage_mv); + + //sets the output attributes + for(uint32_t i = 0; i< i_targets.size();i++) { + l_rc = FAPI_ATTR_SET(ATTR_MSS_VDD_OFFSET,&i_targets[i],param_vdd_voltage_mv); + if(l_rc) return l_rc; + }//end for + + return l_rc; +} diff --git a/src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_vdd_offset.H b/src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_vdd_offset.H new file mode 100644 index 000000000..59b6ea1fb --- /dev/null +++ b/src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_vdd_offset.H @@ -0,0 +1,70 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_vdd_offset.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2014 */ +/* */ +/* 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 */ +// $Id: mss_volt_vdd_offset.H,v 1.4 2014/06/18 20:34:36 dcadiga Exp $ +//------------------------------------------------------------------------------ +// *! (C) Copyright International Business Machines Corp. 2011 +// *! All Rights Reserved -- Property of IBM +// *! *** IBM Confidential *** +//------------------------------------------------------------------------------ +// *! TITLE : mss_volt_vdd_offset.H +// *! DESCRIPTION : see additional comments below +// *! OWNER NAME : Stephen Glancy Email: sglancy@us.ibm.com +// *! BACKUP NAME : Jacob Sloat Email: jdsloat@us.ibm.com +// *! ADDITIONAL COMMENTS : +// +// Header file for mss_volt_vdd_offset. +// +//------------------------------------------------------------------------------ +// Don't forget to create CVS comments when you check in your changes! +//------------------------------------------------------------------------------ +// CHANGE HISTORY: +//------------------------------------------------------------------------------ +// Version:| Author: | Date: | Comment: +//---------|----------|----------|----------------------------------------------- +// 1.4 | sglancy | 06/16/14 | Updated to fix some formatting issues +// 1.3 | sglancy | 06/04/14 | Updated to include output attribute +// 1.2 | sglancy | 05/30/14 | changed function to return a value in uV +// 1.1 | sglancy | 05/20/14 | initial drop +#ifndef MSS_VOLT_VDD_OFFSET_H_ +#define MSS_VOLT_VDD_OFFSET_H_ + +#include <fapi.H> + +typedef fapi::ReturnCode (*mss_volt_vdd_offset_FP_t)(std::vector<fapi::Target> &); + +extern "C" +{ + +/** + * @brief mss_volt_vdd_offset procedure. Determines operating vdd voltage for dimms behind a vdd voltage domain + * + * @param[in] std::vector<fapi::Target> l_targets Reference to vector of Centaur Targets in a particular vdd power domain + * + * @return ReturnCode + */ + + fapi::ReturnCode mss_volt_vdd_offset(std::vector<fapi::Target> & i_targets); + +} // extern "C" + +#endif // MSS_VOLT_VDD_OFFSET_H_ diff --git a/src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_vddr_offset.C b/src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_vddr_offset.C new file mode 100644 index 000000000..607a4671d --- /dev/null +++ b/src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_vddr_offset.C @@ -0,0 +1,243 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_vddr_offset.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2014 */ +/* */ +/* 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 */ +// $Id: mss_volt_vddr_offset.C,v 1.6 2014/06/18 20:34:37 dcadiga Exp $ +/* File mss_volt_vddr_offset.C created by Stephen Glancy on Tue 20 May 2014. */ + +//------------------------------------------------------------------------------ +// *! (C) Copyright International Business Machines Corp. 2007 +// *! All Rights Reserved -- Property of IBM +// *! *** IBM Confidential *** +//------------------------------------------------------------------------------ +// *! TITLE : mss_volt_vddr_offset.C +// *! DESCRIPTION : Tools for centaur procedures +// *! OWNER NAME : Stephen Glancy (sglancy@us.ibm.com) +// *! BACKUP NAME : Jacob Sloat (jdsloat@us.ibm.com) +// #! ADDITIONAL COMMENTS : +// +// General purpose funcs + +//------------------------------------------------------------------------------ +// Don't forget to create CVS comments when you check in your changes! +//------------------------------------------------------------------------------ +// CHANGE HISTORY: +//------------------------------------------------------------------------------ +// Version:| Author: | Date: | Comment: +//---------|----------|----------|----------------------------------------------- +// 1.6 | sglancy | 06/18/14 | Updated to add more debug information into error +// 1.5 | sglancy | 06/09/14 | Updated to change output attribute name and update debug statements +// 1.4 | sglancy | 06/04/14 | Updated to include output attribute +// 1.3 | sglancy | 05/30/14 | Formatted code +// 1.2 | sglancy | 05/29/14 | Fixed attributes units and equations +// 1.1 | sglancy | 05/20/14 | File created + +// This procedure takes a vector of Centaurs behind the vddr voltage domain, +// reads in supported DIMM voltages from SPD and determines optimal +// voltage bin for the DIMM voltage domain. +// supported voltage bins: DDR3 1.35V DDR4 1.20V + + +//---------------------------------------------------------------------- +// Includes - FAPI +//---------------------------------------------------------------------- +#include <fapi.H> +#include <mss_volt_vddr_offset.H> +#include <mss_count_active_centaurs.H> + +//---------------------------------------------------------------------- +// Constants +//---------------------------------------------------------------------- + + +fapi::ReturnCode mss_volt_vddr_offset(std::vector<fapi::Target> & i_targets) +{ + + //declares variables + fapi::ReturnCode l_rc; + uint32_t vpd_master_power_slope, vpd_master_power_intercept, volt_util_active, volt_util_inactive, volt_slope, volt_intercept; + uint32_t var_power_on_vddr = 0; + uint32_t data_bus_util; + uint32_t num_logical_dimms; + uint8_t dram_gen, cur_dram_gen; + uint8_t enable, is_functional; + uint8_t percent_uplift; + uint8_t rank_config[2][2]; + std::vector<fapi::Target> l_mbaChiplets; + + //gets the attributes and computes var_power_on based upon whether the DRAM type is DDR3 or DDR4 + l_rc=fapiGetChildChiplets(i_targets[0], fapi::TARGET_TYPE_MBA_CHIPLET, l_mbaChiplets); + if(l_rc) return l_rc; + l_rc = FAPI_ATTR_GET(ATTR_EFF_DRAM_GEN,&l_mbaChiplets[0],dram_gen); + if(l_rc) return l_rc; + + //checks to make sure that all of the DRAM generation attributes are the same, if not error out + for(uint32_t i = 0; i < i_targets.size();i++) { + //loops through all MBA chiplets to compare the DRAM technology generation attribute + l_mbaChiplets.clear(); + l_rc=fapiGetChildChiplets(i_targets[i], fapi::TARGET_TYPE_MBA_CHIPLET, l_mbaChiplets); + for(uint32_t j=0;j<l_mbaChiplets.size();j++) { + //gets the attributes and computes var_power_on based upon whether the DRAM type is DDR3 or DDR4 + l_rc = FAPI_ATTR_GET(ATTR_EFF_DRAM_GEN,&l_mbaChiplets[j],cur_dram_gen); + if(l_rc) return l_rc; + //values are not equal -> set the fapi RC and exit out + if(cur_dram_gen != dram_gen){ + // this just needs to be deconfiged at the dimm level + const fapi::Target & CHIP_TARGET = i_targets[i]; + const uint8_t &DRAM_GEN_MISCOMPARE = cur_dram_gen; + const uint8_t &DRAM_GEN_START = dram_gen; + const uint32_t &CEN_MBA_NUM = j; + const uint32_t &CEN_TARGET_NUM = i; + FAPI_SET_HWP_ERROR(l_rc, RC_MSS_VOLT_VDDR_OFFSET_DRAM_GEN_MISCOMPARE); + FAPI_ERR("Not all DRAM technology generations are the same.\nExiting...."); + if(l_rc) return l_rc; + }//end if + }//end for + }//end for + + //voltage should not be updated if the disable is set + l_rc = FAPI_ATTR_GET(ATTR_MSS_VDDR_OFFSET_DISABLE,NULL,enable); + //error check + if(l_rc) return l_rc; + if(enable == fapi::ENUM_ATTR_MSS_VDDR_OFFSET_DISABLE_DISABLE){ + FAPI_INF("ATTR_MSS_VDDR_OFFSET_DISABLE is set to be disabled. Exiting....., %d",enable); + return l_rc; + } + + //gets the attributes and computes var_power_on based upon whether the DRAM type is DDR3 or DDR4 + if(dram_gen == fapi::ENUM_ATTR_EFF_DRAM_GEN_DDR3) { + l_rc = FAPI_ATTR_GET(ATTR_MSS_DDR3_VDDR_SLOPE,NULL,volt_slope); + if(l_rc) return l_rc; + l_rc = FAPI_ATTR_GET(ATTR_MSS_DDR3_VDDR_INTERCEPT,NULL,volt_intercept); + if(l_rc) return l_rc; + } + //ddr4 + else { + l_rc = FAPI_ATTR_GET(ATTR_MSS_DDR4_VDDR_SLOPE,NULL,volt_slope); + if(l_rc) return l_rc; + l_rc = FAPI_ATTR_GET(ATTR_MSS_DDR4_VDDR_INTERCEPT,NULL,volt_intercept); + if(l_rc) return l_rc; + } + + //computes the active an inactive attribute values + l_rc = FAPI_ATTR_GET(ATTR_MRW_MAX_DRAM_DATABUS_UTIL,NULL,data_bus_util); + if(l_rc) return l_rc; + l_rc = FAPI_ATTR_GET(ATTR_MRW_DIMM_POWER_CURVE_PERCENT_UPLIFT,NULL,percent_uplift); + if(l_rc) return l_rc; + volt_util_active = data_bus_util; + volt_util_inactive = 0; + + //checks to make sure that none of the values that were read or computed were set to zeros. If any of the values are 0's then 0 * any other value = 0 + if((volt_util_active * volt_slope * volt_intercept) == 0) { + const uint32_t &VDDR_SLOPE_ACTIVE = volt_util_active; + const uint32_t &VDDR_SLOPE_INACTIVE = volt_slope; + const uint32_t &VDDR_SLOPE_INTERCEPT = volt_intercept; + FAPI_SET_HWP_ERROR(l_rc, RC_MSS_VOLT_VDDR_OFFSET_VALUE_ERROR); + FAPI_ERR("One or more dynamic VDD attributes is 0.\nExiting...."); + return l_rc; + } + + //debug print + FAPI_INF("data_bus_util %d per 10k volt_util_active: %d per 10k volt_util_inactive: %d per 10k",data_bus_util,volt_util_active,volt_util_inactive); + + //computes the preliminary VDDR value + for(uint32_t i=0;i<i_targets.size();i++) { + //gets the power slope values and does error checks + l_rc = FAPI_ATTR_GET(ATTR_CDIMM_VPD_MASTER_POWER_SLOPE,&i_targets[i],vpd_master_power_slope); + if(l_rc) return l_rc; + l_rc = FAPI_ATTR_GET(ATTR_CDIMM_VPD_MASTER_POWER_INTERCEPT,&i_targets[i],vpd_master_power_intercept); + if(l_rc) return l_rc; + + //removes leading bits from the VPD MASTER POWER attributes, leaving only the values needed for the power calculations + vpd_master_power_slope &= 0x1FFF; + vpd_master_power_intercept &= 0x1FFF; + + //checks to make sure that the attribute values are non-zero + if((vpd_master_power_slope * vpd_master_power_intercept) == 0 ) { + const fapi::Target & CHIP_TARGET = i_targets[i]; + const uint32_t &VPD_MASTER_POWER_SLOPE = vpd_master_power_slope; + const uint32_t &VPD_MASTER_POWER_INTERCEPT = vpd_master_power_intercept; + const uint32_t &CEN_TARGET_NUM = i; + FAPI_SET_HWP_ERROR(l_rc, RC_MSS_VOLT_VDDR_OFFSET_VPD_VALUE_ERROR); + FAPI_ERR("One or more VPD Power slope attributes is 0.\nExiting...."); + return l_rc; + } + + //gets the functional attribute to check for an active centaur + l_rc = FAPI_ATTR_GET(ATTR_FUNCTIONAL,&i_targets[i],is_functional); + //found an error + if(l_rc) return l_rc; + + //loops through all MBA chiplets to compare the compute the total number of logical dimms on a dimm + l_mbaChiplets.clear(); + l_rc=fapiGetChildChiplets(i_targets[i], fapi::TARGET_TYPE_MBA_CHIPLET, l_mbaChiplets); + num_logical_dimms = 0; + for(uint32_t mba=0;mba<l_mbaChiplets.size();mba++) { + //gets the number of declared ranks + l_rc = FAPI_ATTR_GET(ATTR_EFF_DIMM_RANKS_CONFIGED,&l_mbaChiplets[mba],rank_config); + if(l_rc) return l_rc; + for(uint32_t port=0;port<2;port++) { + for(uint32_t dimm=0;dimm<2;dimm++) { + if(rank_config[port][dimm]) num_logical_dimms++; + } + }//end for + }//end for + + //found an active centaur + //multiply by total number of active logical dimms + if(is_functional == fapi::ENUM_ATTR_FUNCTIONAL_FUNCTIONAL) { + var_power_on_vddr += (vpd_master_power_slope*volt_util_active/10000+vpd_master_power_intercept)*num_logical_dimms; + FAPI_INF("var_power_on_vddr: %d cW vpd_master_power_slope: %d cW volt_util_active: %d per 10k vpd_master_power_intercept %d cW",var_power_on_vddr,vpd_master_power_slope,volt_util_active,vpd_master_power_intercept); + } + //centaur must be inactive + else { + var_power_on_vddr += (vpd_master_power_slope*volt_util_inactive/10000+vpd_master_power_intercept)*num_logical_dimms; + FAPI_INF("var_power_on_vddr: %d cW vpd_master_power_slope: %d cW volt_util_inactive: %d per 10k vpd_master_power_intercept %d cW",var_power_on_vddr,vpd_master_power_slope,volt_util_inactive,vpd_master_power_intercept); + } + }//end for + + //debug print + FAPI_INF("var_power_on_vddr: %d cW percent_uplift: %d %%",var_power_on_vddr,percent_uplift); + //does computes the uplift + var_power_on_vddr = ((100 + percent_uplift) * var_power_on_vddr) / 100; + + //debug print + FAPI_INF("var_power_on_vddr: %d cW volt_slope: %d uV/W volt_intercept: %d mV",var_power_on_vddr,volt_slope,volt_intercept); + + //computes and converts the voltage offset into mV + uint32_t param_vddr_voltage_mv = (500 + var_power_on_vddr*volt_slope/100) / 1000 + volt_intercept; + FAPI_INF("param_vddr_voltage_mv: %d mV",param_vddr_voltage_mv); + //prints a debug statement + if(dram_gen == fapi::ENUM_ATTR_EFF_DRAM_GEN_DDR3) { + FAPI_INF("ATTR_MSS_DDR3_VDDR_OFFSET: %d mV",param_vddr_voltage_mv); + } + else { + FAPI_INF("ATTR_MSS_DDR4_VDDR_OFFSET: %d mV",param_vddr_voltage_mv); + } + + //sets the output attributes + for(uint32_t i = 0; i< i_targets.size();i++) { + l_rc = FAPI_ATTR_SET(ATTR_MSS_VDDR_OFFSET,&i_targets[i],param_vddr_voltage_mv); + if(l_rc) return l_rc; + }//end for + + return l_rc; +} diff --git a/src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_vddr_offset.H b/src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_vddr_offset.H new file mode 100644 index 000000000..30e75a7bf --- /dev/null +++ b/src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_vddr_offset.H @@ -0,0 +1,70 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_vddr_offset.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2014 */ +/* */ +/* 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 */ +// $Id: mss_volt_vddr_offset.H,v 1.4 2014/06/18 20:34:39 dcadiga Exp $ +//------------------------------------------------------------------------------ +// *! (C) Copyright International Business Machines Corp. 2011 +// *! All Rights Reserved -- Property of IBM +// *! *** IBM Confidential *** +//------------------------------------------------------------------------------ +// *! TITLE : mss_volt_vddr_offset.H +// *! DESCRIPTION : see additional comments below +// *! OWNER NAME : Stephen Glancy Email: sglancy@us.ibm.com +// *! BACKUP NAME : Jacob Sloat Email: jdsloat@us.ibm.com +// *! ADDITIONAL COMMENTS : +// +// Header file for mss_volt_vddr_offset. +// +//------------------------------------------------------------------------------ +// Don't forget to create CVS comments when you check in your changes! +//------------------------------------------------------------------------------ +// CHANGE HISTORY: +//------------------------------------------------------------------------------ +// Version:| Author: | Date: | Comment: +//---------|----------|----------|----------------------------------------------- +// 1.4 | sglancy | 06/16/14 | Updated to include output attribute +// 1.3 | sglancy | 06/04/14 | Updated to include output attribute +// 1.2 | sglancy | 05/30/14 | changed function to return a value in uV +// 1.1 | sglancy | 05/20/14 | initial drop +#ifndef MSS_VOLT_VDDR_OFFSET_H_ +#define MSS_VOLT_VDDR_OFFSET_H_ + +#include <fapi.H> + +typedef fapi::ReturnCode (*mss_volt_vddr_offset_FP_t)(std::vector<fapi::Target> &); + +extern "C" +{ + +/** + * @brief mss_volt_vddr_offset procedure. Determines operating vddr voltage for dimms behind a vddr voltage domain + * + * @param[in] std::vector<fapi::Target> l_targets Reference to vector of Centaur Targets in a particular vddr power domain + * + * @return ReturnCode + */ + + fapi::ReturnCode mss_volt_vddr_offset(std::vector<fapi::Target> & i_targets); + +} // extern "C" + +#endif // MSS_VOLT_VDDR_OFFSET_H_ diff --git a/src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_vpp_offset.C b/src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_vpp_offset.C new file mode 100644 index 000000000..79c41c82c --- /dev/null +++ b/src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_vpp_offset.C @@ -0,0 +1,209 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_vpp_offset.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2014 */ +/* */ +/* 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 */ +// $Id: mss_volt_vpp_offset.C,v 1.6 2014/06/18 20:34:41 dcadiga Exp $ +/* File mss_volt_vpp_offset.C created by Stephen Glancy on Tue 20 May 2014. */ + +//------------------------------------------------------------------------------ +// *! (C) Copyright International Business Machines Corp. 2007 +// *! All Rights Reserved -- Property of IBM +// *! *** IBM Confidential *** +//------------------------------------------------------------------------------ +// *! TITLE : mss_volt_vpp_offset.C +// *! DESCRIPTION : Tools for centaur procedures +// *! OWNER NAME : Stephen Glancy (sglancy@us.ibm.com) +// *! BACKUP NAME : Jacob Sloat (jdsloat@us.ibm.com) +// #! ADDITIONAL COMMENTS : +// +// General purpose funcs + +//------------------------------------------------------------------------------ +// Don't forget to create CVS comments when you check in your changes! +//------------------------------------------------------------------------------ +// CHANGE HISTORY: +//------------------------------------------------------------------------------ +// Version:| Author: | Date: | Comment: +//---------|----------|----------|----------------------------------------------- +// 1.6 | sglancy | 06/18/14 | Deletes two unused variables and updated errors +// 1.5 | sglancy | 06/09/14 | Updated debug statements +// 1.4 | sglancy | 06/04/14 | Updated to include output attribute +// 1.3 | sglancy | 05/30/14 | Formatted code +// 1.2 | sglancy | 05/29/14 | Fixed attributes units and equations +// 1.1 | sglancy | 05/20/14 | File created + +// This procedure takes a vector of Centaurs behind the vpp voltage domain, +// reads in supported DIMM voltages from SPD and determines optimal +// voltage bin for the DIMM voltage domain. +// supported voltage bins: DDR3 0V DDR4 2.5V + + +//---------------------------------------------------------------------- +// Includes - FAPI +//---------------------------------------------------------------------- +#include <fapi.H> +#include <mss_volt_vpp_offset.H> +#include <mss_count_active_centaurs.H> + +//---------------------------------------------------------------------- +// Constants +//---------------------------------------------------------------------- + + +fapi::ReturnCode mss_volt_vpp_offset(std::vector<fapi::Target> & i_targets) +{ + //declares variables + fapi::ReturnCode l_rc; + uint32_t num_chips = 0; + uint32_t vpp_slope, vpp_intercept; + uint8_t dram_width, enable, dram_gen; + uint8_t cur_dram_gen; + uint8_t num_spares[2][2][4]; + uint8_t rank_config[2][2]; + std::vector<fapi::Target> l_mbaChiplets; + + //gets the attributes and computes var_power_on based upon whether the DRAM type is DDR3 or DDR4 + l_rc=fapiGetChildChiplets(i_targets[0], fapi::TARGET_TYPE_MBA_CHIPLET, l_mbaChiplets); + if(l_rc) return l_rc; + l_rc = FAPI_ATTR_GET(ATTR_EFF_DRAM_GEN,&l_mbaChiplets[0],dram_gen); + if(l_rc) return l_rc; + + //checks to make sure that all of the DRAM generation attributes are the same, if not error out + for(uint32_t i = 0; i < i_targets.size();i++) { + //loops through all MBA chiplets to compare the DRAM technology generation attribute + l_mbaChiplets.clear(); + l_rc=fapiGetChildChiplets(i_targets[i], fapi::TARGET_TYPE_MBA_CHIPLET, l_mbaChiplets); + for(uint32_t j=0;j<l_mbaChiplets.size();j++) { + //gets the attributes and computes var_power_on based upon whether the DRAM type is DDR3 or DDR4 + l_rc = FAPI_ATTR_GET(ATTR_EFF_DRAM_GEN,&l_mbaChiplets[j],cur_dram_gen); + if(l_rc) return l_rc; + //values are not equal -> set the fapi RC and exit out + if(cur_dram_gen != dram_gen){ + // this just needs to be deconfiged at the dimm level + const fapi::Target & CHIP_TARGET = i_targets[i]; + const uint8_t &DRAM_GEN_MISCOMPARE = cur_dram_gen; + const uint8_t &DRAM_GEN_START = dram_gen; + const uint32_t &CEN_MBA_NUM = j; + const uint32_t &CEN_TARGET_NUM = i; + FAPI_SET_HWP_ERROR(l_rc, RC_MSS_VOLT_VPP_OFFSET_DRAM_GEN_MISCOMPARE); + FAPI_ERR("Not all DRAM technology generations are the same.\nExiting...."); + if(l_rc) return l_rc; + }//end if + }//end for + }//end for + + //checks to see if the DIMMs are DDR3 DIMMs if so, return 0 and exit + if(dram_gen == fapi::ENUM_ATTR_EFF_DRAM_GEN_DDR3) { + uint32_t param_vpp_voltage_mv = 0; + //debug output statement + FAPI_INF("ATTR_MSS_VPP_OFFSET: %d",param_vpp_voltage_mv); + //sets the output attributes + for(uint32_t i = 0; i< i_targets.size();i++) { + l_rc = FAPI_ATTR_SET(ATTR_MSS_VPP_OFFSET,&i_targets[i],param_vpp_voltage_mv); + if(l_rc) return l_rc; + } + return l_rc; + } + + //voltage should not be updated if the disable is set + l_rc = FAPI_ATTR_GET(ATTR_MSS_VPP_OFFSET_DISABLE,NULL,enable); + //error check + if(l_rc) return l_rc; + //add print statement for enable/disable check + + if(enable == fapi::ENUM_ATTR_MSS_VPP_OFFSET_DISABLE_DISABLE) return l_rc; + + //gets the slope and intercepts + l_rc = FAPI_ATTR_GET(ATTR_MSS_VPP_SLOPE,NULL,vpp_slope); + if(l_rc) return l_rc; + l_rc = FAPI_ATTR_GET(ATTR_MSS_VPP_SLOPE_INTERCEPT,NULL,vpp_intercept); + if(l_rc) return l_rc; + //checks to make sure that none of the values are zeros. If any of the values are 0's then 0 * any other value = 0 + if((vpp_slope * vpp_intercept) == 0) { + const uint32_t &VPP_SLOPE = vpp_slope; + const uint32_t &VPP_INTERCEPT = vpp_intercept; + FAPI_SET_HWP_ERROR(l_rc, RC_MSS_VOLT_VPP_OFFSET_VALUE_ERROR); + FAPI_ERR("One or more dynamic VPP attributes is 0.\nExiting...."); + return l_rc; + } + + + //continues computing VPP for DDR4 + //loops through all DIMMs + num_chips=0; + for(uint32_t i=0;i<i_targets.size();i++) { + //resets the number of ranks and spares + l_mbaChiplets.clear(); + l_rc=fapiGetChildChiplets(i_targets[i], fapi::TARGET_TYPE_MBA_CHIPLET, l_mbaChiplets); + //loops through the each MBA chiplet to get the number of ranks and the number of spares + for(uint32_t mba = 0;mba<l_mbaChiplets.size();mba++) { + //gets if the centaur is a x4 or a x8 + l_rc = FAPI_ATTR_GET(ATTR_EFF_DRAM_WIDTH,&l_mbaChiplets[mba],dram_width); + if(l_rc) return l_rc; + l_rc = FAPI_ATTR_GET(ATTR_EFF_NUM_RANKS_PER_DIMM,&l_mbaChiplets[mba],rank_config); + if(l_rc) return l_rc; + l_rc = FAPI_ATTR_GET(ATTR_VPD_DIMM_SPARE,&l_mbaChiplets[mba],num_spares); + if(l_rc) return l_rc; + for(uint32_t port=0;port<2;port++) { + for(uint32_t dimm=0;dimm<2;dimm++) { + //adds the appropriate number of DRAM found per dimm for each rank + if(dram_width == fapi::ENUM_ATTR_EFF_DRAM_WIDTH_X4) num_chips += 18*rank_config[port][dimm]; + else num_chips += 9*rank_config[port][dimm]; + for(uint32_t rank=0;rank<4;rank++) { + //figures out the spares + if(dram_width == fapi::ENUM_ATTR_EFF_DRAM_WIDTH_X4) { + if(num_spares[port][dimm][rank] == fapi::ENUM_ATTR_EFF_DIMM_SPARE_LOW_NIBBLE) { + num_chips += rank_config[port][dimm]; + } + if(num_spares[port][dimm][rank] == fapi::ENUM_ATTR_EFF_DIMM_SPARE_HIGH_NIBBLE) { + num_chips += rank_config[port][dimm]; + } + if(num_spares[port][dimm][rank] == fapi::ENUM_ATTR_EFF_DIMM_SPARE_FULL_BYTE) { + num_chips += 2*rank_config[port][dimm]; + } + } + else { + if(num_spares[port][dimm][rank] == fapi::ENUM_ATTR_EFF_DIMM_SPARE_FULL_BYTE) { + num_chips += rank_config[port][dimm]; + } + } + } + } + } + } + } + + FAPI_INF("vpp_slope: %d uV/DRAM chip vpp_intercept: %d mV num_chips: %d DRAM chips\n",vpp_slope,vpp_intercept,num_chips); + + //does the final computation + uint32_t param_vpp_voltage_uv = vpp_slope*num_chips+1000*vpp_intercept; + //rounds and converts the voltage offset into mV + uint32_t param_vpp_voltage_mv = (500 + param_vpp_voltage_uv) / 1000; + FAPI_INF("ATTR_MSS_VPP_OFFSET: %d mV",param_vpp_voltage_mv); + + //sets the output attributes + for(uint32_t i = 0; i< i_targets.size();i++) { + l_rc = FAPI_ATTR_SET(ATTR_MSS_VPP_OFFSET,&i_targets[i],param_vpp_voltage_mv); + if(l_rc) return l_rc; + }//end for + + return l_rc; +} diff --git a/src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_vpp_offset.H b/src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_vpp_offset.H new file mode 100644 index 000000000..759ef18e6 --- /dev/null +++ b/src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_vpp_offset.H @@ -0,0 +1,70 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/hwpf/hwp/mc_config/mss_volt/mss_volt_vpp_offset.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* COPYRIGHT International Business Machines Corp. 2014 */ +/* */ +/* 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 */ +// $Id: mss_volt_vpp_offset.H,v 1.4 2014/06/18 20:34:43 dcadiga Exp $ +//------------------------------------------------------------------------------ +// *! (C) Copyright International Business Machines Corp. 2011 +// *! All Rights Reserved -- Property of IBM +// *! *** IBM Confidential *** +//------------------------------------------------------------------------------ +// *! TITLE : mss_volt_vpp_offset.H +// *! DESCRIPTION : see additional comments below +// *! OWNER NAME : Stephen Glancy Email: sglancy@us.ibm.com +// *! BACKUP NAME : Jacob Sloat Email: jdsloat@us.ibm.com +// *! ADDITIONAL COMMENTS : +// +// Header file for mss_volt_vpp_offset. +// +//------------------------------------------------------------------------------ +// Don't forget to create CVS comments when you check in your changes! +//------------------------------------------------------------------------------ +// CHANGE HISTORY: +//------------------------------------------------------------------------------ +// Version:| Author: | Date: | Comment: +//---------|----------|----------|----------------------------------------------- +// 1.4 | sglancy | 06/16/14 | Updated to fix formatting +// 1.3 | sglancy | 06/04/14 | Updated to account for output attribute +// 1.2 | sglancy | 05/30/14 | changed function to return a value in uV +// 1.1 | sglancy | 05/20/14 | initial drop +#ifndef MSS_VOLT_VPP_OFFSET_H_ +#define MSS_VOLT_VPP_OFFSET_H_ + +#include <fapi.H> + +typedef fapi::ReturnCode (*mss_volt_vpp_offset_FP_t)(std::vector<fapi::Target> &); + +extern "C" +{ + +/** + * @brief mss_volt_vpp_offset procedure. Determines operating vpp voltage for dimms behind a vpp voltage domain + * + * @param[in] std::vector<fapi::Target> l_targets Reference to vector of Centaur Targets in a particular vpp power domain + * + * @return ReturnCode + */ + + fapi::ReturnCode mss_volt_vpp_offset(std::vector<fapi::Target> & i_targets); + +} // extern "C" + +#endif // MSS_VOLT_VPP_OFFSET_H_ |