diff options
author | Mengze Liao <liaomz@cn.ibm.com> | 2018-02-28 16:13:17 +0800 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2018-11-01 16:10:24 -0500 |
commit | 61bcb01d6fd51dec3f1d86bd9e942fe86fe2b855 (patch) | |
tree | da62b371e8e6e2bf4dc1776c1bfc3577ca3f9779 /src/usr/isteps/istep10/sensor_based_bifurcation.C | |
parent | 4c1c0fa7007888c5a3f7161a3c33d8c397b9b0eb (diff) | |
download | talos-hostboot-61bcb01d6fd51dec3f1d86bd9e942fe86fe2b855.tar.gz talos-hostboot-61bcb01d6fd51dec3f1d86bd9e942fe86fe2b855.zip |
Add PCIe dynamic bifurcation function for barreleye G2
Adds support to query the BMC (via sensor) to determine the
bifurcation settings of the PCI slots.
Resolves #125
Change-Id: Ibb4333140c6209a4a04c5f1a8adf3bd278899a8b
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/52992
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Matt Derksen <mderkse1@us.ibm.com>
Reviewed-by: DHRUVARAJ SUBHASH CHANDRAN <dhruvaraj@in.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/usr/isteps/istep10/sensor_based_bifurcation.C')
-rw-r--r-- | src/usr/isteps/istep10/sensor_based_bifurcation.C | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/src/usr/isteps/istep10/sensor_based_bifurcation.C b/src/usr/isteps/istep10/sensor_based_bifurcation.C new file mode 100644 index 000000000..cfa3d0415 --- /dev/null +++ b/src/usr/isteps/istep10/sensor_based_bifurcation.C @@ -0,0 +1,112 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/isteps/istep10/sensor_based_bifurcation.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2016,2018 */ +/* [+] 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 */ +/******************************************************************************/ +// Includes +/******************************************************************************/ +#include <stdint.h> +#include <fapi2/target.H> +#include <targeting/targplatutil.H> +#include "ipmi/ipmisensor.H" + +#include <trace/interface.H> +#include <initservice/taskargs.H> +#include <errl/errlentry.H> +#include <isteps/hwpisteperror.H> +#include <errl/errludtarget.H> +#include <initservice/isteps_trace.H> +#include <initservice/initserviceif.H> + + + +namespace ISTEP_10 +{ + +errlHndl_t _queryIopsToBifurcateAndPhbsToDisable( + TARGETING::ConstTargetHandle_t const i_pecTarget, + bool& o_iopBifurcate, + TARGETING::ATTR_PROC_PCIE_PHB_ACTIVE_type& o_disabledPhbsMask) +{ + TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + ENTER_MRK "_queryIopsToBifurcateAndPhbsToDisable: PEC target " + "HUID = 0x%08X.", i_pecTarget ? + i_pecTarget->getAttr<TARGETING::ATTR_HUID>() : 0); + + errlHndl_t pError = NULL; + o_iopBifurcate = false; + o_disabledPhbsMask = 0; + + // In order to match the original template, I keep the do-while + // which is unnecessary. + do { + TARGETING::ATTR_PEC_PCIE_LANE_MASK_BIFURCATED_type laneMaskBifurcated = {0}; + assert(i_pecTarget->tryGetAttr< + TARGETING::ATTR_PEC_PCIE_LANE_MASK_BIFURCATED>( + laneMaskBifurcated),"Failed to get " + "ATTR_PEC_PCIE_LANE_MASK_BIFURCATED attribute"); + if (laneMaskBifurcated[0] || laneMaskBifurcated[1] || laneMaskBifurcated[2] + || laneMaskBifurcated[3]) { + TARGETING::Target* sys = nullptr; + TARGETING::targetService().getTopLevelTarget(sys); + assert(sys != nullptr); + uint32_t sensorNum = TARGETING::UTIL::getSensorNumber(sys, + TARGETING::SENSOR_NAME_PCI_BIFURCATED); + + if (sensorNum != 0xFF) + { + SENSOR::getSensorReadingData bifurcatedData; + SENSOR::SensorBase bifurcatedSensor( + TARGETING::SENSOR_NAME_BIFURCATED, sys); + pError = bifurcatedSensor.readSensorData(bifurcatedData); + if (NULL == pError) { + if ((bifurcatedData.event_status & 0x02) == 0x02) { + o_iopBifurcate = true; + } + } + else + { + errlCommit(pError, ISTEP_COMP_ID); + } + } + } + // Extension point to return bifurcated IOPs and PHBs to disable. + // Assuming no extensions are added, the function returns no IOPs to + // bifurcate and no PHBs to disable + + // If implemented, this function should only return error on software code + // bug. Any other condition should result in IOPs not being bifurcated and + // host taking care of that condition. + + } while(0); + + TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace, + EXIT_MRK "_queryIopsToBifurcateAndPhbsToDisable: EID = 0x%08X, " + "PLID = 0x%08X, RC = 0x%08X.", + ERRL_GETEID_SAFE(pError),ERRL_GETPLID_SAFE(pError), + ERRL_GETRC_SAFE(pError)); + + return pError; +} + +}; |