summaryrefslogtreecommitdiffstats
path: root/src/usr/isteps/istep13
diff options
context:
space:
mode:
authorAndres Lugo-Reyes <aalugore@us.ibm.com>2016-09-09 11:03:48 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2016-09-16 15:13:38 -0400
commitfd1f3c1e7f18f9129b1aa2508d7efdb5c9fbc759 (patch)
treeba5d31dc7aecc9bef11a85ff48f66377e141b43e /src/usr/isteps/istep13
parentee80760493969da7eeadb82732ea8bf67468f44e (diff)
downloadtalos-hostboot-fd1f3c1e7f18f9129b1aa2508d7efdb5c9fbc759.tar.gz
talos-hostboot-fd1f3c1e7f18f9129b1aa2508d7efdb5c9fbc759.zip
Interface to send processor voltage change requests to HWSV
This commit contains an altered implementation of hbVddrMsg that is capable of sending voltage change requests related to the processor to HWSV. It also contains the MRW parsing code to retrieve processor I2C information and relay that data to the FSP so POWR can actually change the voltage. Change-Id: Ifcdbd9ebe0eb300a61ee17cc8be6751cee4ff228 Depends-on: I3a478e4a70421d73bcaf7c9746d6569192be4d10 RTC:158500 CMVC-Prereq: 1002713 CMVC-Prereq: 1005080 CMVC-Prereq: 1005149 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/28490 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com> Reviewed-by: Matt Derksen <v2cibmd@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/isteps/istep13')
-rw-r--r--src/usr/isteps/istep13/hbVddrMsg.C817
-rw-r--r--src/usr/isteps/istep13/hbVddrMsg.H309
-rw-r--r--src/usr/isteps/istep13/makefile2
-rw-r--r--src/usr/isteps/istep13/openpower_vddr.C365
-rw-r--r--src/usr/isteps/istep13/platform_vddr.H51
5 files changed, 0 insertions, 1544 deletions
diff --git a/src/usr/isteps/istep13/hbVddrMsg.C b/src/usr/isteps/istep13/hbVddrMsg.C
deleted file mode 100644
index eb747925d..000000000
--- a/src/usr/isteps/istep13/hbVddrMsg.C
+++ /dev/null
@@ -1,817 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/usr/isteps/istep13/hbVddrMsg.C $ */
-/* */
-/* OpenPOWER HostBoot Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2012,2016 */
-/* [+] Google Inc. */
-/* [+] International Business Machines Corp. */
-/* */
-/* */
-/* Licensed under the Apache License, Version 2.0 (the "License"); */
-/* you may not use this file except in compliance with the License. */
-/* You may obtain a copy of the License at */
-/* */
-/* http://www.apache.org/licenses/LICENSE-2.0 */
-/* */
-/* Unless required by applicable law or agreed to in writing, software */
-/* distributed under the License is distributed on an "AS IS" BASIS, */
-/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
-/* implied. See the License for the specific language governing */
-/* permissions and limitations under the License. */
-/* */
-/* IBM_PROLOG_END_TAG */
-#include <sys/task.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/msg.h>
-#include <sys/mm.h>
-#include <errl/errlentry.H>
-#include <errl/errlmanager.H>
-#include <trace/interface.H>
-#include <trace/trace.H>
-#include <mbox/mbox_queues.H>
-#include <mbox/mboxif.H>
-
-#include "hbVddrMsg.H"
-#include <initservice/initserviceif.H>
-#include <pnor/pnorif.H>
-#include "platform_vddr.H"
-#include <istepHelperFuncs.H>
-#include <targeting/common/target.H>
-
-
-using namespace ERRORLOG;
-
-using namespace TARGETING;
-
-// Trace definition
-trace_desc_t* g_trac_volt = NULL;
-TRAC_INIT(&g_trac_volt, "HB_VDDR", 1024);
-
-///////////////////////////////////////////////////////////////////////////////
-// HBVddrMsg::HBVddrMsg()
-///////////////////////////////////////////////////////////////////////////////
-HBVddrMsg::HBVddrMsg()
-{
- TRACDCOMP( g_trac_volt, ENTER_MRK "HBVddrMsg::HBVddrMsg()" );
- TRACDCOMP( g_trac_volt, EXIT_MRK "HBVddrMsg::HBVddrMsg()" );
-};
-
-///////////////////////////////////////////////////////////////////////////////
-// HBVddrMsg::~HBVddrMsg()
-///////////////////////////////////////////////////////////////////////////////
-HBVddrMsg::~HBVddrMsg()
-{
- TRACDCOMP( g_trac_volt, ENTER_MRK "HBVddrMsg::~HBVddrMsg()" );
- TRACDCOMP( g_trac_volt, EXIT_MRK "HBVddrMsg::~HBVddrMsg()" );
-};
-
-
-///////////////////////////////////////////////////////////////////////////////
-// compareVids
-///////////////////////////////////////////////////////////////////////////////
-
-bool compareVids(
- HBVddrMsg::hwsvPowrMemVoltDomainRequest_t i_lhs,
- HBVddrMsg::hwsvPowrMemVoltDomainRequest_t i_rhs)
-{
- bool lhsLogicallyBeforeRhs = (i_lhs.domain < i_rhs.domain);
-
- if (i_lhs.domain == i_rhs.domain)
- {
- lhsLogicallyBeforeRhs = ( static_cast<uint16_t>(i_lhs.domainId)
- < static_cast<uint16_t>(i_rhs.domainId) );
- }
-
- return lhsLogicallyBeforeRhs;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// areVidsEqual
-///////////////////////////////////////////////////////////////////////////////
-
-bool areVidsEqual(
- HBVddrMsg::hwsvPowrMemVoltDomainRequest_t i_lhs,
- HBVddrMsg::hwsvPowrMemVoltDomainRequest_t i_rhs)
-{
- return( ( i_lhs.domain
- == i_rhs.domain)
- && ( static_cast<uint16_t>(i_lhs.domainId)
- == static_cast<uint16_t>(i_rhs.domainId)) );
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// isUnusedVoltageDomain
-///////////////////////////////////////////////////////////////////////////////
-
-bool isUnusedVoltageDomain(
- HBVddrMsg::hwsvPowrMemVoltDomainRequest_t i_vid)
-{
- return (!i_vid.voltageMillivolts);
-}
-
-//******************************************************************************
-// addMemoryVoltageDomains (templated)
-//******************************************************************************
-
-template<
- const ATTRIBUTE_ID MSS_DOMAIN_PROGRAM,
- const ATTRIBUTE_ID VOLTAGE_ATTR_STATIC,
- const ATTRIBUTE_ID VOLTAGE_ATTR_DYNAMIC,
- const ATTRIBUTE_ID VOLTAGE_DOMAIN_ID_ATTR >
-void HBVddrMsg::addMemoryVoltageDomains(
- const TARGETING::Target* const i_pMcbist,
- HBVddrMsg::RequestContainer& io_domains) const
-{
- assert(
- (i_pMcbist != NULL),
- "HBVddrMsg::addMemoryVoltageDomains: Code bug! Caller passed NULL "
- "MCBIST target handle.");
-
- assert(
- ( ( i_pMcbist->getAttr<TARGETING::ATTR_CLASS>()
- == TARGETING::CLASS_UNIT)
- && ( i_pMcbist->getAttr<TARGETING::ATTR_TYPE>()
- == TARGETING::TYPE_MCBIST)),
- "HBVddrMsg::addMemoryVoltageDomains: Code bug! Caller passed non-"
- "MCBIST target handle of class = 0x%08X and type of 0x%08X.",
- i_pMcbist->getAttr<TARGETING::ATTR_CLASS>(),
- i_pMcbist->getAttr<TARGETING::ATTR_TYPE>());
-
- TARGETING::Target* pSysTarget = nullptr;
- TARGETING::targetService().getTopLevelTarget(pSysTarget);
-
- assert(
- (pSysTarget != nullptr),
- "HBVddrMsg::addMemoryVoltageDomains: Code bug! System target was "
- "NULL.");
-
- typename AttributeTraits< MSS_DOMAIN_PROGRAM >::Type
- domainProgram = pSysTarget->getAttr< MSS_DOMAIN_PROGRAM >();
-
-
- // Initialized by constructor to invalid defaults
- HBVddrMsg::hwsvPowrMemVoltDomainRequest_t entry;
-
- switch(VOLTAGE_DOMAIN_ID_ATTR)
- {
- case TARGETING::ATTR_VDDR_ID:
- entry.domain = MEM_VOLTAGE_DOMAIN_VDDR;
- break;
- case TARGETING::ATTR_VCS_ID:
- entry.domain = MEM_VOLTAGE_DOMAIN_VCS;
- break;
- case TARGETING::ATTR_VPP_ID:
- entry.domain = MEM_VOLTAGE_DOMAIN_VPP;
- break;
- case TARGETING::ATTR_AVDD_ID:
- entry.domain = MEM_VOLTAGE_DOMAIN_AVDD;
- break;
- case TARGETING::ATTR_VDD_ID:
- entry.domain = MEM_VOLTAGE_DOMAIN_VDD;
- break;
- default:
- assert(
- 0,
- "HBVddrMsg::addMemoryVoltageDomains: Code Bug! Unsupported "
- "voltage domain of 0x%08X.",
- VOLTAGE_DOMAIN_ID_ATTR);
- break;
- }
-
- // There is no reasonable check to validate if a voltage ID we're reading
- // is valid so it has to be assumed good
- entry.domainId = i_pMcbist->getAttr< VOLTAGE_DOMAIN_ID_ATTR >();
-
- // There is no reasonable check to validate if a voltage we're
- // reading is valid so it has to be assumed good for the cases below
- if(domainProgram == MSS_PROGRAM_TYPE::STATIC)
- {
- typename
- TARGETING::AttributeTraits< VOLTAGE_ATTR_STATIC >::Type
- voltageMillivolts
- = i_pMcbist->getAttr< VOLTAGE_ATTR_STATIC >();
-
- entry.voltageMillivolts = static_cast<uint32_t>(voltageMillivolts);
- io_domains.push_back(entry);
- }
- else if(domainProgram == MSS_PROGRAM_TYPE::DYNAMIC)
- {
- typename
- TARGETING::AttributeTraits< VOLTAGE_ATTR_DYNAMIC >::Type
- voltageMillivolts
- = i_pMcbist->getAttr< VOLTAGE_ATTR_DYNAMIC >();
-
- entry.voltageMillivolts = static_cast<uint32_t>(voltageMillivolts);
- io_domains.push_back(entry);
- }
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// HBVddrMsg::createVddrData
-///////////////////////////////////////////////////////////////////////////////
-
-void HBVddrMsg::createVddrData(
- VDDR_MSG_TYPE i_requestType,
- RequestContainer& io_request) const
-{
- TRACFCOMP( g_trac_volt, ENTER_MRK "HBVddrMsg::createVddrData" );
-
- // Go through all the mcbist targets and gather their domains, domain
- // specific IDs, and domain specific voltages
- io_request.clear();
-
- do{
-
- TARGETING::TargetHandleList l_mcbistTargetList;
-
- // get all functional MCBIST targets
- getAllChiplets(l_mcbistTargetList, TYPE_MCBIST);
-
- for (const auto & pMcbist: l_mcbistTargetList)
- {
- if(i_requestType == HB_VDDR_ENABLE)
- {
- (void)addMemoryVoltageDomains<
- TARGETING::ATTR_MSS_VDD_PROGRAM,
- TARGETING::ATTR_MSS_VOLT_VDD_MILLIVOLTS,
- TARGETING::ATTR_MSS_VOLT_VDD_OFFSET_MILLIVOLTS,
- TARGETING::ATTR_VDD_ID>(
- pMcbist,
- io_request);
-
- (void)addMemoryVoltageDomains<
- TARGETING::ATTR_MSS_AVDD_PROGRAM,
- TARGETING::ATTR_MSS_VOLT_AVDD_MILLIVOLTS,
- TARGETING::ATTR_MSS_VOLT_AVDD_OFFSET_MILLIVOLTS,
- TARGETING::ATTR_AVDD_ID>(
- pMcbist,
- io_request);
-
- (void)addMemoryVoltageDomains<
- TARGETING::ATTR_MSS_VCS_PROGRAM,
- TARGETING::ATTR_MSS_VOLT_VCS_MILLIVOLTS,
- TARGETING::ATTR_MSS_VOLT_VCS_OFFSET_MILLIVOLTS,
- TARGETING::ATTR_VCS_ID>(
- pMcbist,
- io_request);
-
- (void)addMemoryVoltageDomains<
- TARGETING::ATTR_MSS_VPP_PROGRAM,
- TARGETING::ATTR_MSS_VOLT_VPP_MILLIVOLTS,
- TARGETING::ATTR_MSS_VOLT_VPP_OFFSET_MILLIVOLTS,
- TARGETING::ATTR_VPP_ID>(
- pMcbist,
- io_request);
- }
-
- (void)addMemoryVoltageDomains<
- TARGETING::ATTR_MSS_VDDR_PROGRAM,
- TARGETING::ATTR_MSS_VOLT_VDDR_MILLIVOLTS,
- TARGETING::ATTR_MSS_VOLT_VDDR_OFFSET_MILLIVOLTS,
- TARGETING::ATTR_VDDR_ID>(
- pMcbist,
- io_request);
- }
-
- if (l_mcbistTargetList.size() > 1)
- {
- // Take out the duplicate records in io_request by first
- // sorting and then removing the duplicates
- std::sort(io_request.begin(), io_request.end(), compareVids);
- std::vector<hwsvPowrMemVoltDomainRequest_t>::iterator
- pInvalidEntries = std::unique(
- io_request.begin(),
- io_request.end(),
- areVidsEqual);
- io_request.erase(pInvalidEntries,io_request.end());
- }
-
- if( ( (i_requestType == HB_VDDR_ENABLE) ||
- (i_requestType == HB_VDDR_POST_DRAM_INIT_ENABLE) )
- && (!l_mcbistTargetList.empty()) )
- {
- // Inhibit sending any request to turn on a domain with no voltage.
- // When disabling we don't need to do this because the voltage is
- // ignored.
- io_request.erase(
- std::remove_if(io_request.begin(), io_request.end(),
- isUnusedVoltageDomain),io_request.end());
- }
-
- } while(0);
-
- TRACFCOMP( g_trac_volt, EXIT_MRK "HBVddrMsg::createVddrData" );
- return;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// HBVddrMsg::sendMsg
-///////////////////////////////////////////////////////////////////////////////
-errlHndl_t HBVddrMsg::sendMsg(VDDR_MSG_TYPE i_msgType) const
-{
- errlHndl_t l_err = NULL;
-
- TRACFCOMP(g_trac_volt, ENTER_MRK
- "hbVddrMsg::sendMsg msg_type =0x%08X",i_msgType);
-
- do
- {
- RequestContainer l_request;
- if (TARGETING::is_vpo())
- {
- TRACFCOMP(g_trac_volt,
- "hbVddrMsg::sendMsg skipped because of VPO environment");
- break;
- }
-
- if ( ! ( (i_msgType == HB_VDDR_ENABLE) ||
- (i_msgType == HB_VDDR_DISABLE) ||
- (i_msgType == HB_VDDR_POST_DRAM_INIT_ENABLE) ) )
- {
- TRACFCOMP(g_trac_volt, ERR_MRK "hbVddrMsg::send msg with non-"
- "valid msg type%08X",i_msgType);
- /*@
- * @errortype
- * @moduleid fapi::MOD_VDDR_SEND_MSG
- * @reasoncode fapi::RC_INCORRECT_MSG_TYPE
- * @userdata1 i_msgType
- * @userdata2 0
- *
- * @devdesc HB got an incorrect type message. HB did not
- * provide the correct message type in the istep.
- * Userdata1 shows the message type passed in
- */
- createErrLog(l_err, fapi::MOD_VDDR_SEND_MSG,
- fapi::RC_INCORRECT_MSG_TYPE, i_msgType);
- break;
- }
- createVddrData(i_msgType, l_request);
-
- size_t l_dataCount = l_request.size();
-
- // Only send a message if there is data to send
- // Skip sending message if VPO
- if ( l_dataCount )
- {
- uint32_t l_msgSize = l_dataCount *
- sizeof(hwsvPowrMemVoltDomainRequest_t);
-
- // Create the message to send to HWSV
- msg_t* l_msg = msg_allocate();
- l_msg->type = i_msgType;
- l_msg->data[0] = 0;
- l_msg->data[1] = l_msgSize;
-
- TRACFCOMP(g_trac_volt, INFO_MRK "hbVddrMsg::l_dataCount=%d, "
- "l_msgSize=%d",
- l_dataCount, l_msgSize);
- void* l_data = malloc(l_msgSize);
-
- hwsvPowrMemVoltDomainRequest_t* l_ptr =
- reinterpret_cast<hwsvPowrMemVoltDomainRequest_t*>(l_data);
-
- for (size_t j = 0; j<l_dataCount; ++j)
- {
- l_ptr->domain=l_request.at(j).domain;
- l_ptr->domainId=l_request.at(j).domainId;
- l_ptr->voltageMillivolts=l_request.at(j).voltageMillivolts;
-
- TRACFCOMP(g_trac_volt, ENTER_MRK "hbVddrMsg::sendMsg "
- "Voltage domain type = 0x%08X, "
- "Voltage domain ID = 0x%04X, "
- "Voltage (mV) = %d, index = %d",
- l_ptr->domain,
- l_ptr->domainId, l_ptr->voltageMillivolts,j);
- l_ptr++;
- }
-
- l_msg->extra_data = l_data;
-
- TRACFBIN(g_trac_volt, "l_data", l_data, l_msgSize);
- l_err = MBOX::sendrecv( MBOX::FSP_VDDR_MSGQ, l_msg );
- if (l_err)
- {
- TRACFCOMP(g_trac_volt,
- ERR_MRK "Failed sending VDDR message to FSP");
- }
- else
- {
- l_err=processMsg(l_msg);
- }
-
- // If sendrecv returns error then it may not have freed the
- // extra_data, else need to free the response message extra_data
- free(l_msg->extra_data);
- l_msg->extra_data = NULL;
-
- msg_free(l_msg);
- l_msg = NULL;
- }
- } while(0);
-
- TRACFCOMP(g_trac_volt, EXIT_MRK "hbEnableVddr::sendMsg");
- return l_err;
-}
-
-//
-// calloutMcbistChildDimms : HW callout for the failing DIMMs
-//
-void calloutMcbistChildDimms( errlHndl_t & io_errl,
- const TARGETING::Target * i_mcbist)
-{
- TRACFCOMP(g_trac_volt, ENTER_MRK "calloutMcbistChildDimms");
-
- TARGETING::TargetHandleList l_dimmList;
-
- // Get child dimms
- getChildAffinityTargets( l_dimmList,
- i_mcbist,
- CLASS_NA,
- TYPE_DIMM );
-
- if( !l_dimmList.empty())
- {
- // iterate over the DIMMs and call them out
- for (const auto & l_dimm : l_dimmList)
- {
- TRACFCOMP( g_trac_volt, INFO_MRK
- "HBVddrMsg::calloutMcbistChildDimms Target HUID = 0x%08X" ,
- TARGETING::get_huid(l_dimm) );
-
- io_errl->addHwCallout( l_dimm,
- HWAS::SRCI_PRIORITY_LOW,
- HWAS::NO_DECONFIG,
- HWAS::GARD_NULL );
- }
- }
- else
- {
- TRACFCOMP(g_trac_volt, "Mcbist [ 0x%08X ] No child DIMMs found!",
- TARGETING::get_huid(i_mcbist));
- }
-
- TRACFCOMP(g_trac_volt, EXIT_MRK "calloutMcbistChildDimms");
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// HBVddrMsg::processVDDRmsg
-///////////////////////////////////////////////////////////////////////////////
-errlHndl_t HBVddrMsg::processVDDRmsg(msg_t* i_recvMsg) const
-{
- TRACFCOMP(g_trac_volt, ENTER_MRK "HBVddrMsg::processVDDRmsg");
- errlHndl_t l_errLog = NULL;
-
- //check to see if an error occurred from the powr Enable/Disable functions
- //and is inside the message
- uint32_t l_msgSize = i_recvMsg->data[1];
- uint16_t l_elementCount = l_msgSize/sizeof(hwsvPowrMemVoltDomainReply_t);
- const uint8_t* l_extraData = NULL;
- l_extraData=static_cast<uint8_t*>(i_recvMsg->extra_data);
-
- do{
- if (l_extraData==NULL)
- {
- //an error occurred in obtaining the extra data from the response msg
- TRACFCOMP( g_trac_volt, ERR_MRK
- "HBVddrMsg::processVDDRmsg: l_extraData = NULL");
- //create an errorlog
- /*@
- * @errortype
- * @moduleid fapi::MOD_VDDR_PROC_VDDR_MSG
- * @reasoncode fapi::RC_VDDR_EMPTY_MSG
- * @userdata1 0
- * @userdata2 0
- *
- * @devdesc The hwsv returned a message where the extra data
- * was null. This should not happen so need to
- * tell HostBoot to stop the ipl
- */
- createErrLog(l_errLog, fapi::MOD_VDDR_PROC_VDDR_MSG,
- fapi::RC_VDDR_EMPTY_MSG);
- break;
- }
-
- MEM_VOLTAGE_DOMAIN domain = MEM_VOLTAGE_DOMAIN_UNKNOWN;
- TARGETING::ATTR_VDDR_ID_type l_domainId =0x0;
- uint32_t l_errPlid =0x0;
-
- TRACFCOMP( g_trac_volt, INFO_MRK "HBVddrMsg::processVDDRmsg: "
- "l_elementCount=%d, l_msgSize =%d",
- l_elementCount, l_msgSize);
- const hwsvPowrMemVoltDomainReply_t* l_ptr=
- reinterpret_cast<const hwsvPowrMemVoltDomainReply_t*>(l_extraData);
-
- for (size_t i=0; i<l_elementCount; ++i)
- {
- domain = l_ptr->domain;
- l_domainId = l_ptr->domainId;
- l_errPlid = l_ptr->plid;
-
- TRACFCOMP( g_trac_volt, INFO_MRK "HBVddrMsg::processVDDRmsg: "
- "domain = 0x%08X, l_domainId=0x%08X, l_errPlid=0x%08X",
- domain,l_domainId,l_errPlid);
- if (l_errPlid == 0x0)
- {
- TRACFCOMP( g_trac_volt, INFO_MRK "HBVddrMsg::processVDDRmsg: "
- "no plid error found for domain = 0x%08X, "
- "l_domainId=0x%08X", domain, l_domainId);
- }
- else
- {
- //error occurred so break out of the loop and indicate
- //an error was present
- TRACFCOMP( g_trac_volt, ERR_MRK
- "HBVddrMsg::processVDDRmsg: error occurred "
- "on the powr function called in hwsv");
- //create an errorlog
- /*@
- * @errortype
- * @moduleid fapi::MOD_VDDR_PROC_VDDR_MSG
- * @reasoncode fapi::RC_VDDR_POWR_ERR
- * @userdata1 l_errPlid
- * @userdata2 0
- *
- * @devdesc The hwsv returned a message where there was
- * an error when the powr function was called.
- * userdata1 contains the errorlog plid from
- * hwsv generated by the powr function
- */
- createErrLog(l_errLog, fapi::MOD_VDDR_PROC_VDDR_MSG,
- fapi::RC_VDDR_POWR_ERR, l_errPlid);
-
- l_errLog->addProcedureCallout(
- HWAS::EPUB_PRC_MEMORY_PLUGGING_ERROR,
- HWAS::SRCI_PRIORITY_MED );
-
- // Find the MCBIST associated with this Domain ID
- TARGETING::TargetHandleList mcbistTargetList;
- TARGETING::ATTR_VDDR_ID_type l_attr_domainId = 0x0;
-
- getAllChiplets(mcbistTargetList, TYPE_MCBIST);
-
- bool l_domain_found;
- for (const auto & pMcbist: mcbistTargetList)
- {
- l_domain_found = true;
- switch(domain)
- {
- // Add hw callouts for child DIMMs
- case MEM_VOLTAGE_DOMAIN_VDDR:
- l_attr_domainId =
- pMcbist->getAttr< TARGETING::ATTR_VDDR_ID >();
- break;
- case MEM_VOLTAGE_DOMAIN_VCS:
- l_attr_domainId =
- pMcbist->getAttr< TARGETING::ATTR_VCS_ID>();
- break;
- case MEM_VOLTAGE_DOMAIN_VPP:
- l_attr_domainId =
- pMcbist->getAttr< TARGETING::ATTR_VPP_ID>();
- break;
- case MEM_VOLTAGE_DOMAIN_AVDD:
- l_attr_domainId =
- pMcbist->getAttr< TARGETING::ATTR_AVDD_ID>();
- break;
- case MEM_VOLTAGE_DOMAIN_VDD:
- l_attr_domainId =
- pMcbist->getAttr< TARGETING::ATTR_VDD_ID>();
- break;
- default:
- // Mark this Dimm as Not found
- l_domain_found = false;
- TRACFCOMP( g_trac_volt, ERR_MRK
- "[ ERROR ] unsupported Domain %d", domain );
- break;
- }
-
- // Add Callout MCBIST dimms
- if((l_domain_found) && ( l_attr_domainId == l_domainId ))
- {
- TRACFCOMP( g_trac_volt, INFO_MRK
- "HBVddrMsg::processVDDRmsg MCBIST Target HUID = 0x%08X"
- " matches failing domain 0x%08X and ID = 0x%08X",
- TARGETING::get_huid(pMcbist), domain, l_domainId );
-
- calloutMcbistChildDimms(l_errLog, pMcbist);
- }
- }
-
- l_errLog->plid(l_errPlid);
- break;
- }
-
- l_ptr++;
- }
- }while(0);
- TRACFCOMP(g_trac_volt, EXIT_MRK "HBVddrMsg::processVDDRmsg");
- return l_errLog;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// HBVddrMsg::processMsg
-///////////////////////////////////////////////////////////////////////////////
-errlHndl_t HBVddrMsg::processMsg(msg_t* i_Msg) const
-{
- TRACFCOMP(g_trac_volt, ENTER_MRK "HBVddrMsg::processMsg");
- errlHndl_t l_errLog = NULL;
-
- do
- {
- //check to see if the data[0] =0 or contains a value.
- //A value of 0 means its a response to a request and a value not equal
- //to zero means that its an error coming back
-
- uint16_t l_value1=i_Msg->data[0];
- if (l_value1 ==0)
- {
- //process a response to a request
- uint32_t l_msgType =i_Msg->type;
- TRACFCOMP( g_trac_volt, INFO_MRK
- "HBVddrMsg::processMsg l_msgType=x%08X",l_msgType );
- if ( (l_msgType == HB_VDDR_ENABLE) ||
- (l_msgType == HB_VDDR_DISABLE)||
- (l_msgType == HB_VDDR_POST_DRAM_INIT_ENABLE) )
- {
- //process a VDDR message
- l_errLog=processVDDRmsg(i_Msg);
- if (l_errLog)
- {
- break;
- }
- }
- else
- {
- TRACFCOMP( g_trac_volt, ERR_MRK
- "HBVddrMsg::processMsg recv'd a non valid type");
- //generate errorLog;
- /*@
- * @errortype
- * @moduleid fapi::MOD_VDDR_PROC_MSG
- * @reasoncode fapi::RC_INCORRECT_MSG_TYPE
- * @userdata1 0
- * @userdata2 0
- *
- * @devdesc HB got an incorrect type message.
- * HWSV did not populate the message correctly
- * or mbox corrupted the message
- */
- createErrLog(l_errLog, fapi::MOD_VDDR_PROC_MSG,
- fapi::RC_INCORRECT_MSG_TYPE);
- }
- }
- else
- {
- //an error occurred so should stop the IPL
- TRACFCOMP( g_trac_volt, ERR_MRK
- "HBVddrMsg::RecvMsgHndlr recv'd an error message" );
-
- //generate an errorlog
- /*@
- * @errortype
- * @moduleid fapi::MOD_VDDR_PROC_MSG
- * @reasoncode fapi::RC_VDDR_ERROR_MSG
- * @userdata1 error PLID from hwsv
- * @userdata2 0
- *
- * @devdesc The hwsv found an error while processing the
- * message so it sent an error message back to
- * indicate to HostBoot to stop the IPL.
- * Userdata1 will have the error PLID from hwsv's
- * errorlog
- */
- createErrLog(l_errLog, fapi::MOD_VDDR_PROC_MSG,
- fapi::RC_VDDR_ERROR_MSG, i_Msg->data[1]);
- l_errLog->plid(i_Msg->data[1]);
- }
-
- }while(0);
-
- TRACFCOMP(g_trac_volt, EXIT_MRK "HBVddrMsg::processMsg");
- return l_errLog;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// HBVddrMsg::createErrLog
-///////////////////////////////////////////////////////////////////////////////
-void HBVddrMsg::createErrLog(errlHndl_t& io_err,
- fapi::hwpfModuleId i_mod,
- fapi::hwpfReasonCode i_rc,
- uint32_t i_userData1) const
-{
- if (io_err == NULL)
- {
- io_err = new ErrlEntry(ERRL_SEV_UNRECOVERABLE,
- i_mod,
- i_rc,
- i_userData1,
- 0);
-
- }
- return;
-}
-
-// External interfaces
-errlHndl_t platform_enable_vddr()
-{
- errlHndl_t l_err = NULL;
-
- TARGETING::Target* pSysTarget = nullptr;
- TARGETING::targetService().getTopLevelTarget(pSysTarget);
- assert(
- (pSysTarget != nullptr),
- "platform_enable_vddr: Code bug! System target was NULL.");
-
- // only enable vddr if system supports dynamic voltage and MBOX available
- if((pSysTarget->getAttr< TARGETING::ATTR_SUPPORTS_DYNAMIC_MEM_VOLT >() == 1)
- && (INITSERVICE::spBaseServicesEnabled()))
- {
- HBVddrMsg l_hbVddr;
-
- l_err = l_hbVddr.sendMsg(HBVddrMsg::HB_VDDR_ENABLE);
- if (l_err)
- {
- TRACFCOMP(g_trac_volt,
- "ERROR 0x%.8X: call_host_enable_vddr to sendMsg"
- " returns error",
- l_err->reasonCode());
- }
- else
- {
- TRACFCOMP( g_trac_volt,
- "SUCCESS : host_enable_vddr()" );
- }
- }
- else // no FSP/mbox services available
- {
- TRACFCOMP(g_trac_volt,"call_host_enable_vddr"
- " no-op because mbox not available or system"
- " does not support dynamic voltages");
- }
-
- return l_err;
-}
-
-errlHndl_t platform_disable_vddr()
-{
- errlHndl_t l_err = NULL;
- if(INITSERVICE::spBaseServicesEnabled())
- {
- HBVddrMsg l_hbVddr;
-
- l_err = l_hbVddr.sendMsg(HBVddrMsg::HB_VDDR_DISABLE);
- if (l_err)
- {
- TRACFCOMP(g_trac_volt,
- "ERROR 0x%.8X: call_host_disable_vddr to sendMsg"
- " returns error",
- l_err->reasonCode());
- }
- else
- {
- TRACFCOMP( g_trac_volt,
- "SUCCESS : host_disable_vddr()" );
- }
- }
- else // no FSP/mbox services available
- {
- TRACFCOMP(g_trac_volt,"call_host_disable_vddr"
- "no-op because mbox not available");
- }
-
- return l_err;
-}
-
-errlHndl_t platform_adjust_vddr_post_dram_init()
-{
- errlHndl_t l_err = NULL;
- if(INITSERVICE::spBaseServicesEnabled())
- {
- HBVddrMsg l_hbVddr;
-
- l_err = l_hbVddr.sendMsg(HBVddrMsg::HB_VDDR_POST_DRAM_INIT_ENABLE);
- if (l_err)
- {
- TRACFCOMP(g_trac_volt,
- "ERROR 0x%.8X: call_host_adjust_vddr_post_dram_init to "
- "sendMsg returns error",
- l_err->reasonCode());
- }
- else
- {
- TRACFCOMP( g_trac_volt,
- "SUCCESS : host_adjust_vddr_post_dram_init()" );
- }
- }
- else // no FSP/mbox services available
- {
- TRACFCOMP(g_trac_volt,"call_host_adjust_vddr_post_dram_init()"
- "no-op because mbox not available");
- }
-
- return l_err;
-}
-
diff --git a/src/usr/isteps/istep13/hbVddrMsg.H b/src/usr/isteps/istep13/hbVddrMsg.H
deleted file mode 100644
index 1f491b7b5..000000000
--- a/src/usr/isteps/istep13/hbVddrMsg.H
+++ /dev/null
@@ -1,309 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/usr/isteps/istep13/hbVddrMsg.H $ */
-/* */
-/* OpenPOWER HostBoot Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2012,2016 */
-/* [+] International Business Machines Corp. */
-/* */
-/* */
-/* Licensed under the Apache License, Version 2.0 (the "License"); */
-/* you may not use this file except in compliance with the License. */
-/* You may obtain a copy of the License at */
-/* */
-/* http://www.apache.org/licenses/LICENSE-2.0 */
-/* */
-/* Unless required by applicable law or agreed to in writing, software */
-/* distributed under the License is distributed on an "AS IS" BASIS, */
-/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
-/* implied. See the License for the specific language governing */
-/* permissions and limitations under the License. */
-/* */
-/* IBM_PROLOG_END_TAG */
-
-#ifndef __HB_VDDR_MSG_H
-#define __HB_VDDR_MSG_H
-
-/*****************************************************************************/
-// I n c l u d e s
-/*****************************************************************************/
-#include <sys/task.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/mm.h>
-#include <sys/msg.h>
-#include <sys/sync.h>
-#include <stdint.h>
-
-#include <util/singleton.H>
-#include <errl/errlentry.H>
-#include <kernel/timemgr.H>
-#include <hbotcompid.H>
-#include <hwas/common/hwasCallout.H>
-#include <mbox/mbox_queues.H>
-#include <mbox/mboxif.H>
-#include <targeting/common/targetservice.H>
-#include <targeting/common/utilFilter.H>
-#include <isteps/hwpf_reasoncodes.H>
-#include <attributeenums.H>
-
-/*****************************************************************************/
-// Forward class declarations
-/*****************************************************************************/
-class HBVddrMsg;
-
-/**
- * @brief HBVddrMsg
- * This class provides interfaces to send and process messages to and from
- * hwsv with respect to powr. It also indicates when to stop the IPL via
- * errorlogs
- */
-class HBVddrMsg
-{
-
-public:
-
- /**
- * @brief Enum specifying a memory voltage domain type
- */
- enum MEM_VOLTAGE_DOMAIN
- {
- // For unknown / uninitialized values
- MEM_VOLTAGE_DOMAIN_UNKNOWN = 0x00,
-
- // Valid values
- MEM_VOLTAGE_DOMAIN_VDD = 0x01,
- MEM_VOLTAGE_DOMAIN_AVDD = 0x02,
- MEM_VOLTAGE_DOMAIN_VCS = 0x03,
- MEM_VOLTAGE_DOMAIN_VPP = 0x04,
- MEM_VOLTAGE_DOMAIN_VDDR = 0x05, // aka VMEM
-
- // Good range markers - Need to be adjusted if the above change
- MEM_VOLTAGE_DOMAIN_MIN_VALUE = MEM_VOLTAGE_DOMAIN_VDD,
- MEM_VOLTAGE_DOMAIN_MAX_VALUE = MEM_VOLTAGE_DOMAIN_VDDR,
- };
-
- /**
- * @struct hwsvPowrMemVoltDomainRequest_t
- *
- * @brief Structure containing a memory voltage domain type, ID, and
- * voltage in mV
- */
- struct hwsvPowrMemVoltDomainRequest_t
- {
- MEM_VOLTAGE_DOMAIN domain;
- TARGETING::ATTR_VDDR_ID_type domainId;
- TARGETING::ATTR_MSS_VOLT_VDDR_MILLIVOLTS_type voltageMillivolts;
-
- hwsvPowrMemVoltDomainRequest_t()
- : domain(MEM_VOLTAGE_DOMAIN_UNKNOWN),
- domainId(0x0000),
- voltageMillivolts(0x00000000)
- {
- }
-
- } __attribute__ ((packed));
-
- /**
- * @struct hwsvPowrMemVoltDomainReply_t
- *
- * @brief Structure containing a memory voltage domain type, ID, and error
- * log PLID as returned by the FSP POWR function when it tried to set
- * the implied voltage regulator to the specified voltage.
- */
- struct hwsvPowrMemVoltDomainReply_t
- {
- MEM_VOLTAGE_DOMAIN domain;
- TARGETING::ATTR_VDDR_ID_type domainId;
- uint32_t plid;
-
- hwsvPowrMemVoltDomainReply_t()
- : domain(MEM_VOLTAGE_DOMAIN_UNKNOWN),
- domainId(0x0000),
- plid(0x00000000)
- {
- }
-
- } __attribute__ ((packed));
-
- /**
- * @enum VDDR_MSG_TYPE
- *
- * @brief Message enum to determine how the msg should be processed
- *
- */
- enum VDDR_MSG_TYPE
- {
- HB_VDDR_ENABLE = 0x40000041,
- HB_VDDR_DISABLE = 0x40000042,
- HB_VDDR_POST_DRAM_INIT_ENABLE = 0x40000043,
- };
-
- /**
- * @brief typedefs for containers for structures
- */
- typedef std::vector<hwsvPowrMemVoltDomainReply_t> ResponseContainer;
- typedef std::vector<hwsvPowrMemVoltDomainRequest_t> RequestContainer;
-
- /**
- * @brief Default constructor
- */
- HBVddrMsg();
-
- /**
- * @brief Destructor
- *
- * Releases all resources owned by the handle.
- *
- * @return None
- *
- */
- ~HBVddrMsg();
-
- /**
- * @brief Accumulates memory voltage domain type/ID/voltage records and
- * appends them to the provided container
- *
- * @par Detailed Description:
- * This function will accumulates memory voltage domain type/ID/voltage
- * records and appends them to the provided container. If an "enable"
- * request, adds records from all memory voltage domains. If a
- * "disable" message, only adds records from the VDDR (a.k.a. VMEM)
- * voltage domain.
- *
- * @param[in] i_requestType
- * Type of data accumulation request
- *
- * @param[in/out] io_request
- * On input, a container to hold the memory voltage domain programming
- * records. On output, the container holds the relevant records.
- *
- * @return N/A
- */
- void createVddrData(
- VDDR_MSG_TYPE i_requestType,
- RequestContainer& io_request) const;
-
- /**
- * @brief Uses the internal mailbox to send a message to the FSP
- *
- *
- * @par Detailed Description:
- * This function will call into mailbox FSP code using the
- * FSP_VDDR_MSGQ as the message queue..
- *
- * @param[in] i_msgType
- * HBVddrMsg::VDDR_MSG_TYPE passed in to define the
- * message policy.
- *
- * @return errlHndl_t
- * return errl == NULL -> success
- * return errl != NULL -> failure
- */
- errlHndl_t sendMsg(VDDR_MSG_TYPE i_msgType) const;
-
-private:
-
- /**
- * @brief For a given mcbist and memory voltage domain, adds a
- * voltage programming request record to the input list
- *
- * @tparam MSS_DOMAIN_PROGRAM
- * ID of the attribute to read to determine how we program this domain.
- * Value of the attribute should be one of these:
- * MSS_PROGRAM_TYPE::POWERON = no additional programming necessary,
- * MSS_PROGRAM_TYPE::STATIC = use static value,
- * MSS_PROGRAM_TYPE::DYNAMIC = use dynamic value
- *
- * @tparam VOLTAGE_ATTR_STATIC
- * ID of the attribute which should be read to obtain the given memory
- * voltage domain's offset voltage to program. In this case the offset
- * voltage acts as the actual voltage. Should be one of the
- * TARGETING::ATTR_MSS_VOLT_*_MILLIVOLTS attribute IDs, where
- * * = VMEM, VPP, VCS, VDD, or AVDD. Only used when the memory voltage
- * domain's programming equals static. Otherwise the parameter, below,
- * controls how the voltage, if any, is programmed.
- *
- * @tparam VOLTAGE_ATTR_DYNAMIC
- * ID of the attribute which should be read to obtain the given memory
- * voltage domain's voltage to program. Only applied if the memory
- * voltage domain's programming equals dynamic. Should be one of the
- * TARGETING::ATTR_MSS_VOLT_*_OFFSET_MILLIVOLTS attribute IDs,
- * where * = VMEM, VPP, VCS, VDD, or AVDD.
- *
- * @note: This function does not ensure that all permutations of the above
- * template parameters are valid.
- *
- * @param[in] i_pMcbist
- * Handle to a MCBIST target. Function will assert if NULL or
- * not a MCBIST target.
- *
- * @param[in,out] io_domains
- * On input, an existing list of 0 or more voltage domain records. On
- * output, that same list with up to 1 additional voltage domain
- * record.
- *
- * @return N/A
- */
- template<
- const TARGETING::ATTRIBUTE_ID MSS_DOMAIN_PROGRAM,
- const TARGETING::ATTRIBUTE_ID VOLTAGE_ATTR_STATIC,
- const TARGETING::ATTRIBUTE_ID VOLTAGE_ATTR_DYNAMIC,
- const TARGETING::ATTRIBUTE_ID VOLTAGE_DOMAIN_ID_ATTR >
- void addMemoryVoltageDomains(
- const TARGETING::Target* const i_pMcbist,
- HBVddrMsg::RequestContainer& io_domains) const;
-
-protected:
-
- /**
- * @brief function to process a generic message recieved from the FSP
- *
- * @param[in] i_recvMsg The message from the message queue.
- * It contains the response data from the FSP
- *
- * @return errlHndl_t
- * return errl == NULL -> success
- * return errl != NULL -> failure
- */
- errlHndl_t processMsg(msg_t* i_recvMsg) const;
-
- /**
- * @brief function to process a power Vmem message recieved from the FSP
- *
- * @param[in] i_recvMsg The message from the message queue.
- * It contains the response data from the FSP
- *
- * @param[out] i_passed indicates if powr function succeeded or failed on
- * the FSP.
- *
- * @return errlHndl_t
- * return errl == NULL -> success
- * return errl != NULL -> failure
- */
- errlHndl_t processVDDRmsg(msg_t* i_recvMsg)const;
-
- /**
- * @brief function to create error logs for errors that occured in FSP side
- *
- * @param[in/out] io_err. Error log to generate indicating that an error
- * has has occured on HB or in the powr messages. This error
- * should stop the IPL from processing further.
- *
- * @param[in] i_mod. The module where the error occured
- *
- * @param[in] i_rc. The return code for the error that occured
- *
- * @return None
- */
- void createErrLog(errlHndl_t& io_err,
- fapi::hwpfModuleId i_mod,
- fapi::hwpfReasonCode i_rc,
- uint32_t i_userData1=0x0) const;
-
-};
-
-
-#endif
diff --git a/src/usr/isteps/istep13/makefile b/src/usr/isteps/istep13/makefile
index cad151156..1ba3369a0 100644
--- a/src/usr/isteps/istep13/makefile
+++ b/src/usr/isteps/istep13/makefile
@@ -46,7 +46,6 @@ EXTRAINCDIR += ${PROCEDURES_PATH}/hwp/nest
EXTRAINCDIR += ${PROCEDURES_PATH}/hwp/initfiles
-
# from src/usr/isteps/istep13
OBJS += call_host_disable_memvolt.o
OBJS += call_mem_pll_reset.o
@@ -61,7 +60,6 @@ OBJS += call_mss_draminit_training.o
OBJS += call_mss_draminit_trainadv.o
OBJS += call_mss_draminit_mc.o
-OBJS += $(if $(CONFIG_OPENPOWER_VDDR),openpower_vddr.o,hbVddrMsg.o)
#HWP build tool
include ${ROOTPATH}/procedure.rules.mk
diff --git a/src/usr/isteps/istep13/openpower_vddr.C b/src/usr/isteps/istep13/openpower_vddr.C
deleted file mode 100644
index 5d8b4c8fc..000000000
--- a/src/usr/isteps/istep13/openpower_vddr.C
+++ /dev/null
@@ -1,365 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/usr/isteps/istep13/openpower_vddr.C $ */
-/* */
-/* OpenPOWER HostBoot Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2014,2016 */
-/* [+] Google Inc. */
-/* [+] International Business Machines Corp. */
-/* */
-/* */
-/* Licensed under the Apache License, Version 2.0 (the "License"); */
-/* you may not use this file except in compliance with the License. */
-/* You may obtain a copy of the License at */
-/* */
-/* http://www.apache.org/licenses/LICENSE-2.0 */
-/* */
-/* Unless required by applicable law or agreed to in writing, software */
-/* distributed under the License is distributed on an "AS IS" BASIS, */
-/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
-/* implied. See the License for the specific language governing */
-/* permissions and limitations under the License. */
-/* */
-/* IBM_PROLOG_END_TAG */
-// Rhesus board-specific VDDR support.
-// VDDR is enabled/disabled via a GPIO on the hammock card.
-// A separate GPIO selects between 1.35V and 1.25V output from the VR.
-
-#include <config.h>
-
-#include "platform_vddr.H"
-
-#include <string.h>
-
-#include <isteps/hwpf_reasoncodes.H>
-#include <errl/errlentry.H>
-#include <errl/errlmanager.H>
-
-#include <targeting/common/commontargeting.H>
-#include <targeting/common/util.H>
-#include <targeting/common/utilFilter.H>
-
-#include <kernel/timemgr.H>
-
-#include <usr/devicefw/driverif.H>
-#include <usr/gpio/gpioif.H>
-
-using namespace TARGETING;
-using namespace DeviceFW;
-
-trace_desc_t* g_trac_vddr = NULL;
-TRAC_INIT(&g_trac_vddr, "HB_VDDR", KILOBYTE);
-
-// PCA95X internal register addresses
-enum
-{
-#ifdef CONFIG_PCA95X_8BIT
- PCA95X_GPIO_REG_INPUT = 0x0,
- PCA95X_GPIO_REG_OUTPUT = 0x1,
- PCA95X_GPIO_REG_POLARITY = 0x2,
- PCA95X_GPIO_REG_CONFIG = 0x3,
-#endif
-#ifdef CONFIG_PCA95X_16BIT
- PCA95X_GPIO_REG_INPUT = 0x0,
- PCA95X_GPIO_REG_OUTPUT = 0x2,
- PCA95X_GPIO_REG_POLARITY = 0x4,
- PCA95X_GPIO_REG_CONFIG = 0x6,
-#endif
- PCA95X_GPIO_POLARITY_NORMAL = 0,
- PCA95X_GPIO_POLARITY_INVERTED = 1,
-
-};
-
-#define PCA95X_GPIO_CONFIG_OUTPUT false
-#define PCA95X_GPIO_CONFIG_INPUT true
-
-// GPIO bit numbers (0-7) => port addr 0 pin(0-7)
-// GPIO bit numbers (8-15) => port addr 1 pin(0-7)
-#define GPIO_TO_PORT(gpio) (gpio / 8)
-#define GPIO_TO_BIT(gpio) (gpio % 8)
-
-// Helper function to call provided function pointer on each functional
-// centaur Target.
-
-//******************************************************************************
-// compareTargetsGpioInfos
-//******************************************************************************
-
-bool compareTargetsGpioInfos(
- TARGETING::TargetHandle_t i_pLhs,
- TARGETING::TargetHandle_t i_pRhs)
-{
-
- TARGETING::ATTR_GPIO_INFO_type lhsGpioInfo =
- i_pLhs->getAttr<TARGETING::ATTR_GPIO_INFO>();
- TARGETING::ATTR_GPIO_INFO_type rhsGpioInfo =
- i_pRhs->getAttr<TARGETING::ATTR_GPIO_INFO>();
-
- // Code logically compares left hand side (lhs) target to right hand side
- // (rhs) target with respect to GPIO info and returns true if the left hand
- // side is logically before the right hand side. To make the computation,
- // compare first GPIO info field for each object. If values are not
- // logically equal, return whether the left hand side value was less than
- // the right hand side value. Otherwise break the tie by comparing the
- // next GPIO field in similar fashion. Continue breaking ties until the
- // last field, in which case a tie returns false.
- bool lhsLogicallyBeforeRhs =
- lhsGpioInfo.i2cMasterPath < rhsGpioInfo.i2cMasterPath;
- if(lhsGpioInfo.i2cMasterPath == rhsGpioInfo.i2cMasterPath)
- {
- lhsLogicallyBeforeRhs = lhsGpioInfo.port < rhsGpioInfo.port;
- if(lhsGpioInfo.port == rhsGpioInfo.port)
- {
- lhsLogicallyBeforeRhs = lhsGpioInfo.engine < rhsGpioInfo.engine;
- if(lhsGpioInfo.engine == rhsGpioInfo.engine)
- {
- lhsLogicallyBeforeRhs
- = lhsGpioInfo.devAddr < rhsGpioInfo.devAddr;
- if(lhsGpioInfo.devAddr == rhsGpioInfo.devAddr)
- {
- lhsLogicallyBeforeRhs =
- lhsGpioInfo.vddrPin < rhsGpioInfo.vddrPin;
- }
- }
- }
- }
-
- return lhsLogicallyBeforeRhs;
-}
-
-//******************************************************************************
-// areTargetsGpioInfoEqual
-//******************************************************************************
-
-bool areTargetsGpioInfoEqual(
- TARGETING::TargetHandle_t i_pLhs,
- TARGETING::TargetHandle_t i_pRhs)
-{
-
- TARGETING::ATTR_GPIO_INFO_type lhsGpioInfo =
- i_pLhs->getAttr<TARGETING::ATTR_GPIO_INFO>();
- TARGETING::ATTR_GPIO_INFO_type rhsGpioInfo =
- i_pRhs->getAttr<TARGETING::ATTR_GPIO_INFO>();
-
- return( ( lhsGpioInfo.i2cMasterPath
- == rhsGpioInfo.i2cMasterPath)
- && ( lhsGpioInfo.port
- == rhsGpioInfo.port)
- && ( lhsGpioInfo.engine
- == rhsGpioInfo.engine)
- && ( lhsGpioInfo.devAddr
- == rhsGpioInfo.devAddr)
- && ( lhsGpioInfo.vddrPin
- == rhsGpioInfo.vddrPin) );
-}
-
-static errlHndl_t for_each_vddr_domain_with_functional_memory(
- errlHndl_t (*func)(Target *))
-{
- // Get all functional Centaur targets
- TargetHandleList l_membufTargetList;
- getAllChips(l_membufTargetList, TYPE_MEMBUF);
-
- errlHndl_t l_err = NULL;
-
- // Sort chips in order of GPIO info
- std::sort(l_membufTargetList.begin(), l_membufTargetList.end(),
- compareTargetsGpioInfos);
-
- // Prune out targets with non-unique GPIO info
- std::vector<TARGETING::TargetHandle_t>::iterator
- pInvalidEntries = std::unique(
- l_membufTargetList.begin(),
- l_membufTargetList.end(),
- areTargetsGpioInfoEqual);
- l_membufTargetList.erase(pInvalidEntries,l_membufTargetList.end());
-
- // Invoke callback for one Centaur per unique VDDR domain
- for (const auto & l_membuf_iter: l_membufTargetList)
- {
- Target* l_pCentaur = *l_membuf_iter;
-
- l_err = (*func)(l_pCentaur);
-
- if( l_err )
- {
- break;
- }
- }
-
- return l_err;
-}
-
-static errlHndl_t pca95xGpioSetBit(TARGETING::Target * i_target,
- uint8_t i_reg,
- uint8_t i_gpio,
- bool i_val)
-{
- errlHndl_t err = NULL;
- do
- {
-
- uint64_t cmd = i_reg + GPIO_TO_PORT(i_gpio);
- uint8_t data = 0;
- size_t dataLen = sizeof(data);
-
- // Might want to make this an attribute;
- // However, This is already an OpenPOWER only object
- uint64_t deviceType = GPIO::PCA95X_GPIO;
-
- err = DeviceFW::deviceOp
- ( DeviceFW::READ,
- i_target,
- &data,
- dataLen,
- DEVICE_GPIO_ADDRESS(deviceType, cmd)
- );
-
- if( err )
- {
- break;
- }
-
- uint8_t new_reg_val = data;
- if( i_val )
- {
- new_reg_val |= 1 << GPIO_TO_BIT(i_gpio);
- }
- else
- {
- new_reg_val &= ~(1 << GPIO_TO_BIT(i_gpio));
- }
-
- // Do the write only if actually changing value.
- if( new_reg_val != data )
- {
- data = new_reg_val;
- cmd = i_reg + GPIO_TO_PORT(i_gpio);
-
- err = DeviceFW::deviceOp
- ( DeviceFW::WRITE,
- i_target,
- &data,
- dataLen,
- DEVICE_GPIO_ADDRESS(deviceType, cmd)
- );
-
- if( err )
- {
- break;
- }
- }
-
- } while(0);
-
- return err;
-}
-
-
-static errlHndl_t pca95xGpioWriteBit(TARGETING::Target * i_target,
- uint8_t i_gpio_pin,
- bool i_val)
-{
- assert( i_gpio_pin >= 0 && i_gpio_pin < 16 );
- errlHndl_t err = NULL;
-
- err = pca95xGpioSetBit(i_target,
- PCA95X_GPIO_REG_OUTPUT,
- i_gpio_pin,
- i_val);
-
- // Configure gpio bit as output (if necessary).
- if(!err)
- {
- err = pca95xGpioSetBit(i_target,
- PCA95X_GPIO_REG_CONFIG,
- i_gpio_pin,
- PCA95X_GPIO_CONFIG_OUTPUT);
- }
-
- return err;
-}
-
-static errlHndl_t enableVddrViaGpioPinStrategy(Target *centaur)
-{
- errlHndl_t l_err = NULL;
-
- do
- {
- // Enable the DIMM power.
- TARGETING::ATTR_GPIO_INFO_type gpioInfo =
- centaur->getAttr<TARGETING::ATTR_GPIO_INFO>();
-
- l_err = pca95xGpioWriteBit(centaur, gpioInfo.vddrPin, true);
- if(l_err)
- {
- TRACFCOMP(g_trac_vddr,ERR_MRK " "
- "Failed to assert pca95x GPIO for Centaur HUID = 0x%08x "
- "and pin %d.",
- TARGETING::get_huid(centaur),gpioInfo.vddrPin);
- break;
- }
-
- TRACFCOMP(g_trac_vddr,INFO_MRK " "
- "Enabled VDDR for Centaur HUID = 0x%08x (asserted pca95x GPIO "
- "pin %d).",
- TARGETING::get_huid(centaur),
- gpioInfo.vddrPin);
-
- } while(0);
-
- return l_err;
-}
-
-static errlHndl_t disableVddrViaGpioPinStrategy(Target *centaur)
-{
- errlHndl_t l_err = NULL;
-
- do
- {
- // Disable the DIMM power.
- TARGETING::ATTR_GPIO_INFO_type gpioInfo =
- centaur->getAttr<TARGETING::ATTR_GPIO_INFO>();
-
- l_err = pca95xGpioWriteBit(centaur,gpioInfo.vddrPin, false);
- if(l_err)
- {
- TRACFCOMP(g_trac_vddr,ERR_MRK " "
- "Failed to deassert pca95x GPIO for Centaur HUID = 0x%08x "
- "and pin %d.",
- TARGETING::get_huid(centaur),gpioInfo.vddrPin);
- break;
- }
-
- TRACFCOMP(g_trac_vddr,INFO_MRK " "
- "Disabled VDDR for Centaur HUID = 0x%08x (deasserted pca95x GPIO "
- "pin %d).",
- TARGETING::get_huid(centaur),
- gpioInfo.vddrPin);
-
- } while(0);
-
- return l_err;
-}
-
-// External interfaces
-errlHndl_t platform_enable_vddr()
-{
- return for_each_vddr_domain_with_functional_memory(
- enableVddrViaGpioPinStrategy);
-}
-
-errlHndl_t platform_disable_vddr()
-{
- return for_each_vddr_domain_with_functional_memory(
- disableVddrViaGpioPinStrategy);
-}
-
-errlHndl_t platform_adjust_vddr_post_dram_init()
-{
- // Not supported on OpenPOWER
- return NULL;
-}
-
diff --git a/src/usr/isteps/istep13/platform_vddr.H b/src/usr/isteps/istep13/platform_vddr.H
deleted file mode 100644
index 81520bb9a..000000000
--- a/src/usr/isteps/istep13/platform_vddr.H
+++ /dev/null
@@ -1,51 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: src/usr/isteps/istep13/platform_vddr.H $ */
-/* */
-/* OpenPOWER HostBoot Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2014,2016 */
-/* [+] Google Inc. */
-/* [+] International Business Machines Corp. */
-/* */
-/* */
-/* Licensed under the Apache License, Version 2.0 (the "License"); */
-/* you may not use this file except in compliance with the License. */
-/* You may obtain a copy of the License at */
-/* */
-/* http://www.apache.org/licenses/LICENSE-2.0 */
-/* */
-/* Unless required by applicable law or agreed to in writing, software */
-/* distributed under the License is distributed on an "AS IS" BASIS, */
-/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
-/* implied. See the License for the specific language governing */
-/* permissions and limitations under the License. */
-/* */
-/* IBM_PROLOG_END_TAG */
-// platform specific VDDR support.
-
-#ifndef PLATFORM_VDDR_H__
-#define PLATFORM_VDDR_H__
-
-#include <usr/errl/errlentry.H>
-
-/**
- * @brief Enable vddr on DIMMS
- * @return NULL | error handle on error
- */
-errlHndl_t platform_enable_vddr();
-
-/**
- * @brief Adjust vddr on DIMMS with POST DRAM INITs
- * @return NULL | error handle on error
- */
-errlHndl_t platform_adjust_vddr_post_dram_init();
-
-/**
- * @brief Disable vddr on DIMMS
- * @return NULL | error handle on error
- */
-errlHndl_t platform_disable_vddr();
-
-#endif // PLATFORM_VDDR_H__
OpenPOWER on IntegriCloud