From 4bf4a26d8c082f8577d2182d96741e626d173411 Mon Sep 17 00:00:00 2001 From: Mark Pizzutillo Date: Thu, 30 May 2019 14:45:25 -0500 Subject: [PATCH] Remove pmic_bias files to move to lab directory Clearing pmic_bias_tool to remove makefile issues. Code restored in next commit. Change-Id: I4284a9b3c28d4bec99ebd75f32cdae376e20a4e1 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/78094 Tested-by: FSP CI Jenkins Tested-by: Jenkins Server Tested-by: Hostboot CI Reviewed-by: Louis Stermole Reviewed-by: STEPHEN GLANCY Reviewed-by: Jennifer A Stofer Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/78177 Reviewed-by: Daniel M. Crowell Tested-by: Daniel M. Crowell --- .../hwp/pmic/lib/utils/pmic_bias_utils.C | 336 ------------------ .../hwp/pmic/lib/utils/pmic_bias_utils.H | 183 ---------- .../common/procedures/hwp/pmic/pmic_bias.C | 112 ------ .../common/procedures/hwp/pmic/pmic_bias.H | 71 ---- 4 files changed, 702 deletions(-) delete mode 100644 src/import/chips/ocmb/common/procedures/hwp/pmic/lib/utils/pmic_bias_utils.C delete mode 100644 src/import/chips/ocmb/common/procedures/hwp/pmic/lib/utils/pmic_bias_utils.H delete mode 100644 src/import/chips/ocmb/common/procedures/hwp/pmic/pmic_bias.C delete mode 100644 src/import/chips/ocmb/common/procedures/hwp/pmic/pmic_bias.H diff --git a/src/import/chips/ocmb/common/procedures/hwp/pmic/lib/utils/pmic_bias_utils.C b/src/import/chips/ocmb/common/procedures/hwp/pmic/lib/utils/pmic_bias_utils.C deleted file mode 100644 index b4b59e165bf..00000000000 --- a/src/import/chips/ocmb/common/procedures/hwp/pmic/lib/utils/pmic_bias_utils.C +++ /dev/null @@ -1,336 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/import/chips/ocmb/common/procedures/hwp/pmic/lib/utils/pmic_bias_utils.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2019 */ -/* [+] 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 pmic_bias_utils.C -/// @brief Procedure definition to bias PMIC -/// -// *HWP HWP Owner: Mark Pizzutillo -// *HWP HWP Backup: Louis Stermole -// *HWP Team: Memory -// *HWP Level: 2 -// *HWP Consumed by: FSP:HB - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace mss -{ -namespace pmic -{ - -/// -/// @brief Set the voltage of a rail (post-rounding) -/// -/// @param[in] i_pmic_target PMIC target -/// @param[in] i_rail rail to set -/// @param[in] i_target_voltage voltage to set to -/// @param[in] i_range_selection range (0 or 1) of the rail -/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS iff success -/// -fapi2::ReturnCode set_new_rail_voltage( - const fapi2::Target& i_pmic_target, - const mss::pmic::rail i_rail, - const uint32_t i_target_voltage, - const uint8_t i_range_selection) -{ - using CONSTS = mss::pmic::consts; - using FIELDS = pmicFields; - - FAPI_ASSERT(i_range_selection < CONSTS::NUM_RANGES, - fapi2::PMIC_VOLTAGE_RANGE_SETTING_OUT_OF_RANGE() - .set_TARGET(i_pmic_target) - .set_RAIL(i_rail) - .set_RANGE_SETTING(i_range_selection), - "set_new_rail_voltage(): The voltage setting provided for PMIC %s on rail %u was out of range (Valid: 0,1). Given: %u", - mss::c_str(i_pmic_target), uint8_t(i_rail), i_range_selection); - - { - // Make sure voltage falls within range - static const uint32_t MIN_VOLT = mss::pmic::VOLT_RANGE_MINS[i_rail][i_range_selection]; - static const uint32_t MAX_VOLT = mss::pmic::VOLT_RANGE_MAXES[i_rail][i_range_selection]; - - FAPI_ASSERT((i_target_voltage >= MIN_VOLT) && (i_target_voltage <= MAX_VOLT), - fapi2::PMIC_BIAS_VOLTAGE_OUT_OF_RANGE() - .set_TARGET(i_pmic_target) - .set_VOLTAGE(i_target_voltage) - .set_MIN(MIN_VOLT) - .set_MAX(MAX_VOLT) - .set_RAIL(i_rail), - "set_new_rail_voltage(): After rounding the bias voltage, " - "the resulting voltage %lumV was out of range LOW: %lumV HIGH: %lumV for PMIC %s on rail %u", - i_target_voltage, MIN_VOLT, MAX_VOLT, mss::c_str(i_pmic_target), uint8_t(i_rail)); - { - // Convert to bit mapping and write back - const uint32_t l_offset_from_min = i_target_voltage - MIN_VOLT; - const uint8_t l_voltage_bitmap = l_offset_from_min / CONSTS::VOLT_STEP; - - // Shift and write back - fapi2::buffer l_voltage_write_back; - - l_voltage_write_back.insertFromRight(l_voltage_bitmap); - - FAPI_TRY(mss::pmic::i2c::reg_write(i_pmic_target, mss::pmic::VOLT_SETTING_ACTIVE_REGS[i_rail], l_voltage_write_back), - "set_voltage_percent: Error writing 0x%02hhX of PMIC %s", mss::pmic::VOLT_SETTING_ACTIVE_REGS[i_rail], - mss::c_str(i_pmic_target)); - } - } - - return fapi2::FAPI2_RC_SUCCESS; -fapi_try_exit: - return fapi2::current_err; -} - -/// -/// @brief Round a target rail voltage to the nearest step of 5mV to create the voltage bitmap -/// -/// @param[in] i_target_voltage_unrounded unrounded voltage -/// @return float rounded voltage -/// -uint32_t round_rail_target_voltage(const uint32_t i_target_voltage_unrounded) -{ - using CONSTS = mss::pmic::consts; - - // Round to nearest unit by converting to a MV integer - const uint32_t l_target_multiple = CONSTS::VOLT_STEP; - - const uint32_t l_target_voltage = mss::round_to_nearest_multiple(i_target_voltage_unrounded, l_target_multiple); - - // Inform the user. This will be especially useful for debugging - FAPI_INF("Voltage rounded to %luV", l_target_voltage); - - return l_target_voltage; -} - -/// -/// @brief Checks if bias percentage is within the MAX_BIAS threshold -/// -/// @param[in] i_percent percentage to check -/// @param[in] i_force force change (would force evaluation to true) -/// @return true if in range, false if not -/// -bool bias_percent_within_threshold(const float i_percent, const bool i_force) -{ - return i_force || ((i_percent < mss::pmic::PERCENT_MAX_BIAS) && (i_percent > (-1) * mss::pmic::PERCENT_MAX_BIAS)); -} - -/// -/// @brief Get the current rail voltage of a JEDEC PMIC -/// -/// @param[in] i_pmic_target PMIC target -/// @param[in] i_rail rail to read from -/// @param[out] o_current_rail_voltage voltage calculated for rail -/// @param[out] o_range_selection range selection of that voltage -/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS iff success, else error -/// @note not templated as the arguments may differ for other chips (if we ever use others) -/// -fapi2::ReturnCode get_current_rail_voltage(const fapi2::Target& - i_pmic_target, - const mss::pmic::rail i_rail, - uint32_t& o_current_rail_voltage, - uint8_t& o_range_selection) -{ - fapi2::buffer l_voltage_setting_reg_contents; - fapi2::buffer l_voltage_range_reg_contents; - - using REGS = pmicRegs; - using FIELDS = pmicFields; - using CONSTS = mss::pmic::consts; - - // Get voltage for rail - FAPI_TRY(mss::pmic::i2c::reg_read(i_pmic_target, mss::pmic::VOLT_SETTING_ACTIVE_REGS[i_rail], - l_voltage_setting_reg_contents), - "set_voltage_percent: Error reading 0x%02hhX of PMIC %s", mss::pmic::VOLT_SETTING_ACTIVE_REGS[i_rail], - mss::c_str(i_pmic_target)); - - // Get voltage range selections - FAPI_TRY(mss::pmic::i2c::reg_read_reverse_buffer(i_pmic_target, REGS::R2B, l_voltage_range_reg_contents), - "set_voltage_percent: Error reading 0x%02hhX of PMIC %s", REGS::R2B, mss::c_str(i_pmic_target)); - { - // Identify range - const uint8_t l_range_selection = l_voltage_range_reg_contents.getBit(mss::pmic::VOLT_RANGE_FLDS[i_rail]); - uint8_t l_voltage_setting = 0; - - l_voltage_setting_reg_contents.extractToRight - (l_voltage_setting); - - // Get current voltage using: range_min + (step * setting) - o_current_rail_voltage = mss::pmic::VOLT_RANGE_MINS[i_rail][l_range_selection] + (CONSTS::VOLT_STEP * - l_voltage_setting); - o_range_selection = l_range_selection; - } - return fapi2::FAPI2_RC_SUCCESS; - -fapi_try_exit: - return fapi2::current_err; -} - -/// -/// @brief Set the voltage percent on the specified rail of a JEDEC-compliant PMIC -/// -/// @param[in] i_pmic_target PMIC to bias -/// @param[in] i_rail rail to bias -/// @param[in] i_percent percentage change -/// @param[in] i_force override 10% change limit -/// @return fapi2::ReturnCode fapi2::FAPI2_RC_SUCCESS iff success -/// -fapi2::ReturnCode set_voltage_percent( - const fapi2::Target& i_pmic_target, - const mss::pmic::rail i_rail, - const float i_percent, - const bool i_force) -{ - static constexpr float PERCENT_CONVERSION = 100; - - // Make sure less than 10% if not overriding or within threshold - FAPI_ASSERT(bias_percent_within_threshold(i_percent, i_force), - fapi2::PMIC_BIAS_VOLTAGE_PAST_THRESHOLD() - .set_TARGET(i_pmic_target) - .set_PERCENT(i_percent) - .set_RAIL(i_rail), - "set_voltage_percent(): Bias percentage %f%% provided to PMIC %s exceed the maximum of 10%%. Use -f to override", - i_percent, mss::c_str(i_pmic_target)); - { - uint32_t l_current_rail_voltage; - uint8_t l_range_selection; - - FAPI_TRY(mss::pmic::get_current_rail_voltage(i_pmic_target, i_rail, l_current_rail_voltage, l_range_selection), - "set_voltage_percent: Error getting current rail voltage for rail # %u of PMIC %s", i_rail, mss::c_str(i_pmic_target)); - { - // Obtain target voltage by percent offset - const uint32_t l_target_voltage_unrounded = l_current_rail_voltage * ((PERCENT_CONVERSION + i_percent) / - PERCENT_CONVERSION); - - const uint32_t l_target_voltage = mss::pmic::round_rail_target_voltage(l_target_voltage_unrounded); - - FAPI_TRY(set_new_rail_voltage(i_pmic_target, i_rail, l_target_voltage, l_range_selection), - "set_voltage_percent(): Error setting voltage on PMIC %s", mss::c_str(i_pmic_target)); - } - } - -fapi_try_exit: - return fapi2::current_err; -} - -/// -/// @brief Set the voltage of a JEDEC_COMPLIANT pmic's rail -/// -/// @param[in] i_pmic_target PMIC to bias -/// @param[in] i_rail rail to bias -/// @param[in] i_value value to set to -/// @param[in] i_force override 10% change limit -/// @return fapi2::ReturnCode fapi2::FAPI2_RC_SUCCESS iff success -/// -fapi2::ReturnCode set_voltage_value( - const fapi2::Target& i_pmic_target, - const mss::pmic::rail i_rail, - const float i_value, - const bool i_force) -{ - static constexpr float V_TO_MV_CONVERSION = 1000; - static constexpr float PERCENT_CONVERSION = 100; - - const uint32_t l_value_mv = i_value * V_TO_MV_CONVERSION; - - uint32_t l_current_rail_voltage = 0; - uint8_t l_range_selection; - - // Get range selection and voltage - FAPI_TRY(mss::pmic::get_current_rail_voltage(i_pmic_target, i_rail, l_current_rail_voltage, l_range_selection), - "set_voltage_percent: Error getting current rail voltage for rail # %u of PMIC %s", i_rail, mss::c_str(i_pmic_target)); - { - // Calculate percent change - // Float to avoid integer division - const float l_percent_change = (((l_current_rail_voltage / static_cast(l_value_mv)) - 1)) * PERCENT_CONVERSION; - - // Make sure less than 10% if not overriding or within threshold - FAPI_ASSERT(bias_percent_within_threshold(l_percent_change, i_force), - fapi2::PMIC_BIAS_VOLTAGE_PAST_THRESHOLD() - .set_TARGET(i_pmic_target) - .set_PERCENT(l_percent_change) - .set_RAIL(i_rail), - "set_voltage_value(): Bias percentage %f%% provided to PMIC %s exceed the maximum of 10%%. Use -f to override", - l_percent_change, mss::c_str(i_pmic_target)); - - { - const uint32_t l_target_voltage = mss::pmic::round_rail_target_voltage(l_value_mv); - - // Verify new valid voltage and write to PMIC - FAPI_TRY(set_new_rail_voltage(i_pmic_target, i_rail, l_target_voltage, l_range_selection), - "set_voltage_value(): Error setting voltage on PMIC %s", mss::c_str(i_pmic_target)); - } - } - - return fapi2::FAPI2_RC_SUCCESS; - -fapi_try_exit: - return fapi2::current_err; -} - -/// -/// @brief bias procedure for JEDEC compliant chips -/// -/// @param[in] i_pmic_target - the pmic_target -/// @param[in] i_setting setting to change (swa_volt, swb_volt, etc.) -/// @param[in] i_amount amount to change by -/// @param[in] i_unit percentage or value -/// @param[in] i_force ignore 10% change limit -/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS iff success -/// @note not templated by vendor. As long as the TI -/// -fapi2::ReturnCode bias_chip( - const fapi2::Target& i_pmic_target, - const mss::pmic::setting i_setting, - const float i_amount, - const mss::pmic::unit i_unit, - const bool i_force) -{ - using CONSTS = mss::pmic::consts; - - if (i_unit == mss::pmic::unit::PERCENT) - { - FAPI_TRY(set_voltage_percent(i_pmic_target, - static_cast(i_setting % CONSTS::NUMBER_OF_RAILS), - i_amount, i_force)); - } - else // value - { - FAPI_TRY(set_voltage_value(i_pmic_target, - static_cast(i_setting % CONSTS::NUMBER_OF_RAILS), - i_amount, i_force)); - } - -fapi_try_exit: - return fapi2::current_err; -} - -} // pmic -} // mss diff --git a/src/import/chips/ocmb/common/procedures/hwp/pmic/lib/utils/pmic_bias_utils.H b/src/import/chips/ocmb/common/procedures/hwp/pmic/lib/utils/pmic_bias_utils.H deleted file mode 100644 index 64fd9fdcf70..00000000000 --- a/src/import/chips/ocmb/common/procedures/hwp/pmic/lib/utils/pmic_bias_utils.H +++ /dev/null @@ -1,183 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/import/chips/ocmb/common/procedures/hwp/pmic/lib/utils/pmic_bias_utils.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2019 */ -/* [+] 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 pmic_bias_utils.H -/// @brief Procedure definition to bias PMIC -/// -// *HWP HWP Owner: Mark Pizzutillo -// *HWP HWP Backup: Louis Stermole -// *HWP Team: Memory -// *HWP Level: 2 -// *HWP Consumed by: FSP:HB - -#ifndef __PMIC_BIAS_UTILS_H__ -#define __PMIC_BIAS_UTILS_H__ - -#include -#include -#include -#include -#include -#include - -namespace mss -{ -namespace pmic -{ - -/// -/// @brief Rail settings that the bias procedure can modify -/// -enum setting -{ - // We order these by rail in groups of 4 so they match with the rail enums, - // so the rail can be derived from just a % 4 when we have more settings to change (see current) - SWA_VOLT = 0, - SWB_VOLT = 1, - SWC_VOLT = 2, - SWD_VOLT = 3, - // SWA_CURRENT = 4, - // SWB_CURRENT = 5, - // .. - // .. - NO_SETTING = 8, -}; - -/// -/// @brief Different methods of biasing -/// -enum unit -{ - NO_UNIT = 0, // default value that we can use for error checking - VALUE = 1, - PERCENT = 2, -}; - -// Max bias % change that the procedure will allow without override flag -static constexpr float PERCENT_MAX_BIAS = 10.0; - -//-------- JEDEC SPECIFIC HELPER FUNCS ---------// - -/// -/// @brief Set the voltage of a rail (post-rounding) -/// -/// @param[in] i_pmic_target PMIC target -/// @param[in] i_rail rail to set -/// @param[in] i_target_voltage voltage to set to -/// @param[in] i_range_selection range (0 or 1) of the rail -/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS iff success -/// -fapi2::ReturnCode set_new_rail_voltage( - const fapi2::Target& i_pmic_target, - const mss::pmic::rail i_rail, - const uint32_t i_target_voltage, - const uint8_t i_range_selection); - -/// -/// @brief round a target rail voltage to the nearest step of 5mV to create the voltage bitmap -/// -/// @param[in] l_target_voltage_unrounded unrounded voltage -/// @return uint32_t rounded voltage -/// -uint32_t round_rail_target_voltage(const uint32_t l_target_voltage_unrounded); - -/// -/// @brief Checks if bias percentage is within the MAX_BIAS threshold -/// -/// @param[in] i_percent percentage to check -/// @param[in] i_force force change (would force evaluation to true) -/// @return true if in range, false if not -/// -bool bias_percent_within_threshold(const float i_percent, const bool i_force); - -/// -/// @brief Get the current rail voltage of a JEDEC PMIC -/// -/// @param[in] i_pmic_target PMIC target -/// @param[in] i_rail rail to read from -/// @param[out] o_current_rail_voltage voltage calculated for rail -/// @param[out] o_range_selection range selection of that voltage -/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS iff success, else error -/// @note not templated as the arguments may differ for other chips (if we ever use others) -/// -fapi2::ReturnCode get_current_rail_voltage(const fapi2::Target& - i_pmic_target, - const mss::pmic::rail i_rail, - uint32_t& o_current_rail_voltage, - uint8_t& o_range_selection); - -//-------------- HELPER FUNCTIONS --------------// - -/// -/// @brief Set the voltage percent on the specified rail of a PMIC device -/// -/// @param[in] i_pmic_target PMIC target -/// @param[in] i_rail rail to bias -/// @param[in] i_percent percentage change -/// @param[in] i_force override 10% change limit -/// @return fapi2::ReturnCode fapi2::FAPI2_RC_SUCCESS iff success -/// -fapi2::ReturnCode set_voltage_percent(const fapi2::Target& i_pmic_target, - const mss::pmic::rail i_rail, - const float i_percent, - const bool i_force); - -/// -/// @brief Set the voltage of a rail by a value -/// -/// @param[in] i_pmic_target PMIC to bias -/// @param[in] i_rail rail to bias -/// @param[in] i_value value to set to -/// @param[in] i_force override 10% change limit -/// @return fapi2::ReturnCode fapi2::FAPI2_RC_SUCCESS iff success -/// -fapi2::ReturnCode set_voltage_value(const fapi2::Target& i_pmic_target, - const mss::pmic::rail i_rail, - const float i_value, - const bool i_force); - -//------------------- BIAS FUNCTIONS -----------------// - -/// -/// @brief Bias a chip with the given settings -/// -/// @param[in] i_pmic_target - the pmic_target -/// @param[in] i_setting setting to change (swa_volt, swb_volt, etc.) -/// @param[in] i_amount amount to change by -/// @param[in] i_unit percentage or value -/// @param[in] i_force ignore 10% change limit -/// @return fapi2::ReturnCode FAPI2_RC_SUCCESS iff success -/// -fapi2::ReturnCode bias_chip(const fapi2::Target& i_pmic_target, - const mss::pmic::setting i_setting, - const float i_amount, - const mss::pmic::unit i_unit, - const bool i_force); - -} // pmic -} // mss - -#endif diff --git a/src/import/chips/ocmb/common/procedures/hwp/pmic/pmic_bias.C b/src/import/chips/ocmb/common/procedures/hwp/pmic/pmic_bias.C deleted file mode 100644 index c0b65f3babf..00000000000 --- a/src/import/chips/ocmb/common/procedures/hwp/pmic/pmic_bias.C +++ /dev/null @@ -1,112 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/import/chips/ocmb/common/procedures/hwp/pmic/pmic_bias.C $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2019 */ -/* [+] 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 pmic_bias.C -/// @brief Procedure definition to bias PMIC -/// -// *HWP HWP Owner: Mark Pizzutillo -// *HWP HWP Backup: Louis Stermole -// *HWP Team: Memory -// *HWP Level: 2 -// *HWP Consumed by: FSP:HB - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -extern "C" -{ - /// - /// @brief Bias procedure for PMIC devices - /// - /// @param[in] i_ocmb_target explorer target - /// @param[in] i_id the PMIC to change (PMIC0,PMIC1) - /// @param[in] i_setting setting to change (swa_volt, swb_volt, etc.) - /// @param[in] i_amount amount to change by - /// @param[in] i_unit percentage or value - /// @param[in] i_force ignore 10% change limit - /// @return fapi2::ReturnCode FAPI2_RC_SUCCESS iff success - /// - fapi2::ReturnCode pmic_bias(const fapi2::Target& i_ocmb_target, - const mss::pmic::id i_id, - const mss::pmic::setting i_setting, - const float i_amount, - const mss::pmic::unit i_unit, - const bool i_force) - { - // Check that our inputs are valid - FAPI_ASSERT(i_id != mss::pmic::id::UNKNOWN_ID, - fapi2::PMIC_NO_PMIC_SPECIFIED() - .set_TARGET(i_ocmb_target) - .set_PMIC_ID(uint8_t(i_id)), - "pmic_bias(): PMIC ID %u was unknown for bias procedure call on OCMB %s", - uint8_t(i_id), i_ocmb_target); - - FAPI_ASSERT(i_setting != mss::pmic::setting::NO_SETTING, - fapi2::PMIC_NO_SETTING_SPECIFIED() - .set_TARGET(i_ocmb_target) - .set_SETTING_ID(uint8_t(i_setting)), - "pmic_bias(): PMIC setting ID %u was unknown for bias procedure call on OCMB %s", - uint8_t(i_setting), i_ocmb_target); - - FAPI_ASSERT(i_unit != mss::pmic::unit::NO_UNIT, - fapi2::PMIC_NO_UNIT_SPECIFIED() - .set_TARGET(i_ocmb_target) - .set_UNIT_ID(uint8_t(i_unit)), - "pmic_bias(): Biasing unit ID %u was unknown for bias procedure call on OCMB %s", - uint8_t(i_unit), i_ocmb_target); - - for (const auto& l_pmic : mss::find_targets(i_ocmb_target)) - { - // If matching ID (pmic0, pmic1), then we will bias it - if ((mss::index(l_pmic) % mss::pmic::consts::NUM_UNIQUE_PMICS) == i_id) - { - // Poll to make sure PBULK reports good, then we can be sure we can write/read registers - FAPI_TRY(mss::pmic::poll_for_pbulk_good(l_pmic), - "pmic_enable: poll for pbulk good either failed, or returned not good status on PMIC %s", - mss::c_str(l_pmic)); - - FAPI_INF("Performing BIAS on PMIC %s", mss::c_str(l_pmic)); - - // Now call the bias function - FAPI_TRY(mss::pmic::bias_chip(l_pmic, i_setting, i_amount, i_unit, i_force), - "Error biasing PMIC %s", mss::c_str(l_pmic)); - } - } - - return fapi2::FAPI2_RC_SUCCESS; - fapi_try_exit: - return fapi2::current_err; - } -} // extern C diff --git a/src/import/chips/ocmb/common/procedures/hwp/pmic/pmic_bias.H b/src/import/chips/ocmb/common/procedures/hwp/pmic/pmic_bias.H deleted file mode 100644 index 75a2465b342..00000000000 --- a/src/import/chips/ocmb/common/procedures/hwp/pmic/pmic_bias.H +++ /dev/null @@ -1,71 +0,0 @@ -/* IBM_PROLOG_BEGIN_TAG */ -/* This is an automatically generated prolog. */ -/* */ -/* $Source: src/import/chips/ocmb/common/procedures/hwp/pmic/pmic_bias.H $ */ -/* */ -/* OpenPOWER HostBoot Project */ -/* */ -/* Contributors Listed Below - COPYRIGHT 2019 */ -/* [+] 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 pmic_bias.H -/// @brief Procedure definition to bias PMIC -/// -// *HWP HWP Owner: Mark Pizzutillo -// *HWP HWP Backup: Louis Stermole -// *HWP Team: Memory -// *HWP Level: 1 -// *HWP Consumed by: FSP:HB - -#ifndef __PMIC_BIAS_H__ -#define __PMIC_BIAS_H__ - -#include -#include -#include - -typedef fapi2::ReturnCode (*pmic_bias_FP_t) (const fapi2::Target&, - const mss::pmic::id i_id, - const mss::pmic::setting, - const float, - const mss::pmic::unit, - const bool); - -extern "C" -{ - /// - /// @brief Bias procedure for PMIC devices - /// - /// @param[in] i_ocmb_target explorer target - /// @param[in] i_id the PMIC to change (PMIC0,PMIC1) - /// @param[in] i_setting setting to change (swa_volt, swb_volt, etc.) - /// @param[in] i_amount amount to change by - /// @param[in] i_unit percentage or value - /// @param[in] i_force ignore 10% change limit - /// @return fapi2::ReturnCode FAPI2_RC_SUCCESS iff success - /// - fapi2::ReturnCode pmic_bias(const fapi2::Target& i_ocmb_target, - const mss::pmic::id i_id = mss::pmic::id::PMIC0, - const mss::pmic::setting i_setting = mss::pmic::setting::NO_SETTING, - const float i_amount = 0, - const mss::pmic::unit i_unit = mss::pmic::unit::NO_UNIT, - const bool i_force = false); -} - -#endif