From c0217d002a0a211551048766461f35d718ce1618 Mon Sep 17 00:00:00 2001 From: Roland Veloz Date: Thu, 29 Mar 2018 13:34:55 -0500 Subject: Added support, in Istep 08, to facilitate the testing of SMP wrap Adding support, in Istep 08 to make HWP calls for many various components. In the various istep 8 call_proc_* and istep 10 call_proc*, I was able to consolidate the HWP call into a single single function. The consolidated code for these calls exists in the file nest/nestHwpHelperFuncs. Also added a function to capture errors in file isteps/istepHelperFuncs. Change-Id: I64f73d64950a52d2923f1c3fe280c55dffd1d742 RTC:190096 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/56518 Reviewed-by: Prachi Gupta Tested-by: Jenkins Server Tested-by: Jenkins OP Build CI Reviewed-by: Christian R. Geddes Reviewed-by: Daniel M. Crowell --- src/usr/isteps/nest/nestHwpHelperFuncs.H | 155 +++++++++++++++++++++++++++++++ 1 file changed, 155 insertions(+) create mode 100644 src/usr/isteps/nest/nestHwpHelperFuncs.H (limited to 'src/usr/isteps/nest/nestHwpHelperFuncs.H') diff --git a/src/usr/isteps/nest/nestHwpHelperFuncs.H b/src/usr/isteps/nest/nestHwpHelperFuncs.H new file mode 100644 index 000000000..fb35700b7 --- /dev/null +++ b/src/usr/isteps/nest/nestHwpHelperFuncs.H @@ -0,0 +1,155 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/isteps/nest/nestHwpHelperFuncs.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2015,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 */ + +#ifndef _NEST_HWP_HELPER_FUNCS_H +#define _NEST_HWP_HELPER_FUNCS_H + +/******************************************************************************/ +// Includes +/******************************************************************************/ +// Integral and component ID support +#include // uint32_t +#include // compId_t + +// Error handling support +#include // ISTEP_ERROR::IStepError + +namespace ISTEP +{ + +/** + * @brief There seemed to be a lot of duplicated code (cut and paste) in + * different files. I provide an interface to this duplicated code and + * consolidated it here, so if the protocol ever changes there is only + * one place to make changes. + * + * @note To take advantage of this consolidation, follow these guidelines + * 1) Make sure that one of these methods will suffice for your needs + * 2) Add an enum to HWP_CALL_TYPE that is specific to your needs (in + * this .H file). This enum is the key to calling the correct HWP + * call you wish to perform (in this .H file). + * 3) Add a string representation of the HWP call to + * hwpCallToStringMap (in .C file). + * 4) Update method fapiHWPCallWrapper to accommodate and actually + * make the new HWP call (in .C file). + * NOTE: Don't forget to update include directives as well + * 5) Finally call the method with the correct parameters in the file + * that you wish to make the HWP call + */ + +/** + * @brief Enum specifying which HWP to call + */ +enum HWP_CALL_TYPE +{ + P9_CHIPLET_ENABLE_RIDI = 0, // Although it says chiplet, this uses proc chip + P9_CHIPLET_FABRIC_SCOMINIT, // Although it says chiplet, this uses proc chip + P9_CHIPLET_SCOMINIT, // Although it says chiplet, this uses proc chip + P9_FBC_EFF_CONFIG_LINKS_T_F, // process electrical(T), process optical(F) + P9_FBC_EFF_CONFIG_LINKS_F_T, // process electrical(F), process optical(T) + P9_IO_OBUS_SCOMINIT, + P9_NPU_SCOMINIT, + P9_PSI_SCOMINIT, + P9_SYS_CHIPLET_SCOMINIT, // Although it says chiplet, this uses proc chip + P9_XBUS_ENABLE_RIDI, +}; + +/** + * @brief + * Handy utility to convert an enumeration to its equivalent string. + * This is a mapping of the HWP enumeration to its string representation + * + * @param[in] i_hwpCall + * @see fapiHWPCallWrapper + * + * @return + * Returned is the string equivalent of the enumeration supplied. If the + * enumeration supplied is not valid, then an empty string is returned + * + * @note + * Do not attempt to delete the returned string, it is immutable + */ +const char * hwpCallToString( HWP_CALL_TYPE i_hwpCall ); + +/** + * @brief + * This function is the function where the actual HWP calls are made. + * Currently this function iterates over chips and chiplets and calls + * the appropriate HWP call for that particular type. + * + * @param[in] i_hwpCall + * An enumeration that specifies which HWP will be called + * + * @param[out] o_stepError + * @param[in] i_componentId + * @see hostboot/src/usr/isteps/istepHelperFuncs.H:captureError + * + * @param[in] i_targetType + * The targe type that determines to whether iterate over chips or chiplets + * + * @pre + * i_hwpCall is a valid HWP_CALL_TYPE. See enum HWP_CALL_TYPE above + * to determine which types are valid + * + * @post + * The HWP call, for the given i_hwpCall, is executed. If any error + * occurs, the details of the error will be contained in o_stepError. + * + * @note + * If i_hwpCall is not a valid value the code will be halted via an assert. + */ +void fapiHWPCallWrapper(HWP_CALL_TYPE i_hwpCall, + ISTEP_ERROR::IStepError &o_stepError, + compId_t i_componentId, + TARGETING::TYPE i_targetType); + +/** + * @brief + * This functions "handles" the call to fapiHWPCallWrapper. If that call + * succeeds then true is returned else false is returned. If + * fapiHWPCallWrapper fails this function will print an error message + * stating so. + * + * This is mainly a pass-thru function call to method fapiHWPCallWrapper. + * It's main purpose is to return whether method fapiHWPCallWrapper + * succeded or failed and print an error message upon failure. + * + * @param[in] i_hwpCall + * @param[out] o_stepError + * @param[in] i_componentId + * @param[in] i_targetType + * @see fapiHWPCallWrapper + * + * @return true if call succeeds, false otherwise + */ +bool fapiHWPCallWrapperHandler(HWP_CALL_TYPE i_hwpCall, + ISTEP_ERROR::IStepError &o_stepError, + compId_t i_componentId, + TARGETING::TYPE i_targetType); + +}; // end namespace ISTEP + +#endif + -- cgit v1.2.1