diff options
-rw-r--r-- | src/include/usr/sbeio/sbe_psudd.H | 11 | ||||
-rw-r--r-- | src/include/usr/sbeio/sbe_utils.H | 59 | ||||
-rw-r--r-- | src/usr/sbeio/makefile | 1 | ||||
-rw-r--r-- | src/usr/sbeio/sbe_utils.C | 124 | ||||
-rw-r--r-- | src/usr/scan/scandd.C | 95 | ||||
-rw-r--r-- | src/usr/scan/scandd.H | 12 |
6 files changed, 185 insertions, 117 deletions
diff --git a/src/include/usr/sbeio/sbe_psudd.H b/src/include/usr/sbeio/sbe_psudd.H index d4fd7e642..5b2983c39 100644 --- a/src/include/usr/sbeio/sbe_psudd.H +++ b/src/include/usr/sbeio/sbe_psudd.H @@ -517,17 +517,6 @@ class SbePsu */ static const uint64_t MAX_PSU_SHORT_TIMEOUT_NS=90*NS_PER_SEC; //=90sec - - enum SBE_TARGET_TYPES { - - SBE_TARGET_TYPE_PROC = 0x00, - SBE_TARGET_TYPE_EX = 0x01, - SBE_TARGET_TYPE_PERV = 0x02, - SBE_TARGET_TYPE_MCS = 0x03, - SBE_TARGET_TYPE_TOTAL , - SBE_TARGET_TYPE_UNKNOWN = 0xFF - }; - /** * @brief get SBE FFDC buffer size * diff --git a/src/include/usr/sbeio/sbe_utils.H b/src/include/usr/sbeio/sbe_utils.H new file mode 100644 index 000000000..848586e62 --- /dev/null +++ b/src/include/usr/sbeio/sbe_utils.H @@ -0,0 +1,59 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/sbeio/sbe_utils.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2017 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* IBM_PROLOG_END_TAG */ +#ifndef __SBE_UTILS_H +#define __SBE_UTILS_H + +#include <targeting/common/commontargeting.H> + +/** + * @file sbe_utils.H + * @brief Common sbeio utilities for both PSU and FIFO + */ + +namespace SBEIO +{ + + enum SBE_TARGET_TYPES { + SBE_TARGET_TYPE_PROC = 0x00, + SBE_TARGET_TYPE_EX = 0x01, + SBE_TARGET_TYPE_PERV = 0x02, + SBE_TARGET_TYPE_MCS = 0x03, + SBE_TARGET_TYPE_TOTAL , + SBE_TARGET_TYPE_UNKNOWN = 0xFF + }; + + /// @brief translates HB target types to SBE target type groups + /// @param[in] i_hbTarget includes the HB target type + /// @return SBEIO::SBE_TARGET_TYPES returns SBE_TARGET_TYPE_UNKNOWN in error + SBE_TARGET_TYPES translateToSBETargetType(TARGETING::Target * i_hbTarget); + + /// @brief returns a ChipletID for a give target + /// @param[in] i_hbTarget includes the HB target type + /// @return: ChipletID for i_hbTarget target + uint8_t getChipletIDForSBE(TARGETING::Target * i_hbTarget); + +} + +#endif // __SBE_UTILS_H
\ No newline at end of file diff --git a/src/usr/sbeio/makefile b/src/usr/sbeio/makefile index d5b2326bc..54cc6f04e 100644 --- a/src/usr/sbeio/makefile +++ b/src/usr/sbeio/makefile @@ -34,6 +34,7 @@ EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/procedures/hwp/ffdc EXTRAINCDIR += ${ROOTPATH}/src/import/chips/p9/procedures/hwp/perv OBJS += sbe_psudd.o +OBJS += sbe_utils.o OBJS += sbe_coreStateControl.o OBJS += sbe_psuQuiesce.o OBJS += sbe_stashKeyAddr.o diff --git a/src/usr/sbeio/sbe_utils.C b/src/usr/sbeio/sbe_utils.C new file mode 100644 index 000000000..1bad658a7 --- /dev/null +++ b/src/usr/sbeio/sbe_utils.C @@ -0,0 +1,124 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/sbeio/sbe_utils.C $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2017 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* IBM_PROLOG_END_TAG */ +/** +* @file sbe_psudd.C +* @brief SBE PSU device driver +*/ + +#include <sbeio/sbe_utils.H> +extern trace_desc_t* g_trac_sbeio; + +#define VIRTUAL_CHIPLET_ID_BASE_MCS_TARGET_TYPE (0x80) + +namespace SBEIO +{ + /// @brief translates HB target types to SBE target type groups + /// @param[in] i_hbTarget includes the HB target type + /// @return SBE_TARGET_TYPES returns SBE_TARGET_TYPE_UNKNOWN in error + SBE_TARGET_TYPES translateToSBETargetType(TARGETING::Target *i_hbTarget) + { + TRACDCOMP( g_trac_sbeio, + ENTER_MRK "entering translateToSBETargetType()"); + SBE_TARGET_TYPES sbeType; + sbeType = SBE_TARGET_TYPE_UNKNOWN; + + switch( i_hbTarget->getAttr<TARGETING::ATTR_TYPE>()) + { + case(TARGETING::TYPE_PROC): + { + sbeType = SBE_TARGET_TYPE_PROC; + break; + } + case(TARGETING::TYPE_EX): + { + sbeType = SBE_TARGET_TYPE_EX; + break; + } + case(TARGETING::TYPE_PERV): + case(TARGETING::TYPE_XBUS): + case(TARGETING::TYPE_MCBIST): + case(TARGETING::TYPE_OBUS): + case(TARGETING::TYPE_PCI): + case(TARGETING::TYPE_L2): + case(TARGETING::TYPE_L3): + case(TARGETING::TYPE_L4): + case(TARGETING::TYPE_CORE): + { + sbeType = SBE_TARGET_TYPE_PERV; + break; + } + case(TARGETING::TYPE_MCS): + { + sbeType = SBE_TARGET_TYPE_MCS; + break; + } + default: + TRACFCOMP( g_trac_sbeio, + ERR_MRK "translateToSBETargetType:>" + " Not supported Target type =%.8X ", + i_hbTarget->getAttr<TARGETING::ATTR_TYPE>() ); + break; + } + TRACDCOMP( g_trac_sbeio, EXIT_MRK "exiting translateToSBETargetType()"); + return sbeType; + } + + /// @brief returns a ChipletID for a give target + /// @param[in] i_hbTarget includes the HB target type + /// @return: ChipletID for i_hbTarget target + uint8_t getChipletIDForSBE(TARGETING::Target * i_hbTarget) + { + uint8_t l_chipletID = 0; + TRACDCOMP( g_trac_sbeio, ENTER_MRK "entering getChipletIDForSBE()"); + + //based on the Host to SBE Interface specification ver 0.70+ + switch( i_hbTarget->getAttr<TARGETING::ATTR_TYPE>()) + { + case(TARGETING::TYPE_PROC): + { //not all targets will have CHIPLET_IDs + l_chipletID = 0; + break; + } + //MCS has a virtual Chiplet ID + case (TARGETING::TYPE_MCS): + { + l_chipletID = VIRTUAL_CHIPLET_ID_BASE_MCS_TARGET_TYPE + + static_cast<uint8_t>(i_hbTarget-> + getAttr<TARGETING::ATTR_CHIP_UNIT>()); + break; + } + default: + { + l_chipletID = static_cast<uint8_t>(i_hbTarget-> + getAttr<TARGETING::ATTR_CHIPLET_ID>()); + break; + } + } + + TRACDCOMP( g_trac_sbeio, EXIT_MRK "exiting getChipletIDForSBE()"); + return l_chipletID; + } + +}
\ No newline at end of file diff --git a/src/usr/scan/scandd.C b/src/usr/scan/scandd.C index ffc1fabf1..21f34939a 100644 --- a/src/usr/scan/scandd.C +++ b/src/usr/scan/scandd.C @@ -165,101 +165,6 @@ DEVICE_REGISTER_ROUTE( DeviceFW::WILDCARD, TARGETING::TYPE_MCS, scanPerformOp ); - -/// @brief translates HB target types to SBE target type groups -/// @param[in] i_hbTarget includes the HB target type -/// @return SBEIO::SBE_TARGET_TYPES returns SBE_TARGET_TYPE_UNKNOWN in error -SbePsu::SBE_TARGET_TYPES translateToSBETargetType(TARGETING::Target *i_hbTarget) -{ - - TRACDCOMP( g_trac_scandd, - ENTER_MRK "entering translateToSBETargetType()"); - SbePsu::SBE_TARGET_TYPES sbeType; - sbeType = SbePsu::SBE_TARGET_TYPE_UNKNOWN; - - - switch( i_hbTarget->getAttr<TARGETING::ATTR_TYPE>()){ - - case(TARGETING::TYPE_PROC): - { - sbeType = SbePsu::SBE_TARGET_TYPE_PROC; - break; - } - - case(TARGETING::TYPE_EX): - { - sbeType = SbePsu::SBE_TARGET_TYPE_EX; - break; - } - - case(TARGETING::TYPE_PERV): - case(TARGETING::TYPE_XBUS): - case(TARGETING::TYPE_MCBIST): - case(TARGETING::TYPE_OBUS): - case(TARGETING::TYPE_PCI): - case(TARGETING::TYPE_L2): - case(TARGETING::TYPE_L3): - case(TARGETING::TYPE_L4): - case(TARGETING::TYPE_CORE): - { - sbeType = SbePsu::SBE_TARGET_TYPE_PERV; - break; - } - case(TARGETING::TYPE_MCS): - { - sbeType = SbePsu::SBE_TARGET_TYPE_MCS; - break; - } - default: - TRACFCOMP( g_trac_scandd, - ERR_MRK "translateToSBETargetType:>" - " Not supported Target type =%.8X ", - i_hbTarget->getAttr<TARGETING::ATTR_TYPE>() ); - break; - } - - TRACDCOMP( g_trac_scandd, EXIT_MRK "exiting translateToSBETargetType()"); - return sbeType; -} - -/// @brief returns a ChipletID for a give target -/// @param[in] i_hbTarget includes the HB target type -/// @return: ChipletID for i_hbTarget target -uint8_t getChipletIDForSBE(TARGETING::Target * i_hbTarget) -{ - uint8_t l_chipletID = 0; - - TRACDCOMP( g_trac_scandd, ENTER_MRK "entering getChipletIDForSBE()"); - - //based on the Host to SBE Interface specification ver 0.70+ - switch( i_hbTarget->getAttr<TARGETING::ATTR_TYPE>()) - { - case(TARGETING::TYPE_PROC): - { //not all targets will have CHIPLET_IDs - l_chipletID = 0; - break; - } - //MCS has a virtual Chiplet ID - case (TARGETING::TYPE_MCS): - { - l_chipletID = VIRTUAL_CHIPLET_ID_BASE_MCS_TARGET_TYPE - + static_cast<uint8_t>(i_hbTarget-> - getAttr<TARGETING::ATTR_CHIP_UNIT>()); - break; - } - default: - { - l_chipletID = static_cast<uint8_t>(i_hbTarget-> - getAttr<TARGETING::ATTR_CHIPLET_ID>()); - break; - } - } - - TRACDCOMP( g_trac_scandd, EXIT_MRK "exiting getChipletIDForSBE()"); - return l_chipletID; -} - - /// @brief Sends Put Ring from Image message to SBE via PSU errlHndl_t sbeScanPerformOp( TARGETING::Target * i_target, RingId_t i_ringID, diff --git a/src/usr/scan/scandd.H b/src/usr/scan/scandd.H index d20c5a12a..f00f55c72 100644 --- a/src/usr/scan/scandd.H +++ b/src/usr/scan/scandd.H @@ -37,6 +37,7 @@ // ---------------------------------------------- #include <errl/errlentry.H> #include <sbeio/sbe_psudd.H> +#include <sbeio/sbe_utils.H> #include <p9_ring_id.h> #include <hw_access_def.H> @@ -89,17 +90,6 @@ errlHndl_t scanDoPibScan( DeviceFW::OperationType i_opType, uint64_t i_ringlength, uint64_t i_flags ); -/// @brief translates HB target types to SBE target type groups -/// @param[in] i_hbTarget includes the HB target type -/// @return SBEIO::SBE_TARGET_TYPES returns SBE_TARGET_TYPE_UNKNOWN in error -SBEIO::SbePsu::SBE_TARGET_TYPES - translateToSBETargetType(TARGETING::Target * i_hbTarget); - -/// @brief returns a ChipletID for a give target -/// @param[in] i_hbTarget includes the HB target type -/// @return: ChipletID for i_hbTarget target -uint8_t getChipletIDForSBE(TARGETING::Target * i_hbTarget); - }; // end SCAN namespace |