From 7c4bd674700a8c17fd48e5dfd91fa8051f115c20 Mon Sep 17 00:00:00 2001 From: Andre Marin Date: Mon, 18 Jul 2016 13:29:22 -0500 Subject: Fix p9_mss_utils_to_throttle, create throttles API, attribute cleanup Change-Id: I1de9b3172f3b9ccaf228943f84febbdb955ac390 Original-Change-Id: Ibdb563542adb9e4f05dd07d597a9687b1deaf3c8 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/27183 Tested-by: Jenkins Server Tested-by: Hostboot CI Reviewed-by: JACOB L. HARVEY Reviewed-by: STEPHEN GLANCY Reviewed-by: Jennifer A. Stofer Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/31419 Tested-by: FSP CI Jenkins Reviewed-by: Daniel M. Crowell --- .../hwp/memory/lib/power_thermal/throttle.H | 71 ++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 src/import/chips/p9/procedures/hwp/memory/lib/power_thermal/throttle.H diff --git a/src/import/chips/p9/procedures/hwp/memory/lib/power_thermal/throttle.H b/src/import/chips/p9/procedures/hwp/memory/lib/power_thermal/throttle.H new file mode 100644 index 000000000..e0d0f82a8 --- /dev/null +++ b/src/import/chips/p9/procedures/hwp/memory/lib/power_thermal/throttle.H @@ -0,0 +1,71 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/import/chips/p9/procedures/hwp/memory/lib/power_thermal/throttle.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 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 */ +/// +/// @file p9_mss_utils_to_throttle.H +/// @brief throttle API +/// + +// *HWP HWP Owner: Andre Marin +// *HWP HWP Backup: Brian Silver +// *HWP Team: Memory +// *HWP Level: 2 +// *HWP Consumed by: FSP:HB + +#ifndef _MSS_THROTTLE_ +#define _MSS_THROTTLE_ + + +namespace mss +{ + +enum throttle_const : size_t +{ + // Dram data bus utilization is 4X the address bus utilization + DRAM_BUS_UTILS = 4, + PERCENT_CONVERSION = 100, +}; + +/// +/// @brief Calculate N (address operations) allowed within a window of M DRAM clocks +/// @param[in] i_databus_util databus utilization percentage (e.g. 5% = 5) +/// @param[in] i_num_dram_clocks window of M DRAM clocks +/// @return number of throttled commands allowed +/// @note Uses N/M Throttling. +/// Equation: (DRAM data bus utilization Percent / 100 ) = ((N * 4) / M ) +/// Dram data bus utilization is 4X the address bus utilization +/// +inline uint32_t throttled_cmds(const uint8_t i_databus_util, const uint32_t i_num_dram_clocks) +{ + constexpr uint64_t l_divisor = DRAM_BUS_UTILS * PERCENT_CONVERSION; + const uint64_t l_dividend = i_databus_util * i_num_dram_clocks; + const uint64_t l_quotient = l_dividend / l_divisor; + const uint64_t l_remainder = l_dividend % l_divisor; + + return l_quotient + (l_remainder == 0 ? 0 : 1); +} + +}// mss + +#endif -- cgit v1.2.3