summaryrefslogtreecommitdiffstats
path: root/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/power_thermal/exp_throttle_traits.H
blob: 0b0d06572a81a13a72ca07728016109e0f1af12e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/power_thermal/exp_throttle_traits.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 exp_throttle_traits.H
/// @brief throttle API
///

// *HWP HWP Owner: Andre Marin <aamarin@us.ibm.com>
// *HWP HWP Backup: Louis Stermole <stermole@us.ibm.com>
// *HWP Team: Memory
// *HWP Level: 3
// *HWP Consumed by: FSP:HB

#ifndef _MSS_EXP_THROTTLE_TRAITS_
#define _MSS_EXP_THROTTLE_TRAITS_

#include <fapi2.H>
#include <generic/memory/lib/utils/power_thermal/gen_throttle_traits.H>

namespace mss
{
namespace power_thermal
{

///
/// @class Traits and policy class for throttle code - specialization for the Explorer mc type
///
template<>
class throttle_traits<mss::mc_type::EXPLORER>
{
    public:
        //////////////////////////////////////////////////////////////
        // Target types
        //////////////////////////////////////////////////////////////
        static constexpr fapi2::TargetType MC_TARGET_TYPE = fapi2::TARGET_TYPE_OCMB_CHIP;
        static constexpr fapi2::TargetType PORT_TARGET_TYPE = fapi2::TARGET_TYPE_MEM_PORT;

        //////////////////////////////////////////////////////////////
        // Traits values
        //////////////////////////////////////////////////////////////
        // MIN_UTIL is  in c%
        static const uint64_t MIN_UTIL = 2500;
        // IDLE_UTIL is  in c%
        static const uint64_t IDLE_UTIL = 0;
        // Minimum throttle allowed for the port and or slot. If we set to 0, we brick the port
        static const uint64_t  MIN_THROTTLE = 1;

        enum size_of_attrs : size_t
        {
            // Thermal power (OCMB+DRAM)
            SIZE_OF_THERMAL_LIMIT_ATTR = 25,
            SIZE_OF_THERMAL_SLOPE_ATTR = 50,
            SIZE_OF_THERMAL_INTERCEPT_ATTR = 50,

            // Power (PMIC)
            SIZE_OF_CURRENT_CURVE_WITH_LIMIT_ATTR = 25,
        };

        enum default_power
        {
            //Values are the worst case defaults for power curves
            //They are the default/ catch-all values from the power curve attributes
            //Shouldn't be used if system is set up correctly and attributes are available
            //This will throttle the DIMMs to ~76% dram data bus utilization
            //(using the mrw regulator current limit of 100 dA cW and thermal power limit here of 2175 cW).
            // Thermal power (OCMB+DRAM)
            TOTAL_SLOPE = 0x462,
            TOTAL_INT = 0x526,
            THERMAL_LIMIT = 0x87F,

            // Power (PMIC)
            POWER_SLOPE = 0x152,
            POWER_INT = 0x94,
            POWER_LIMIT = 0x64,

        };

        enum
        {
            PORTS_PER_MC = 1,
            DIMMS_PER_PORT = 2,
        };

        //Bit positions for different section of the attribute
        //first 32 bits are the encoding, second are for values
        enum DECODE_BUFFER_POS
        {
            ENCODING_START = 0,
            ENCODING_LENGTH = 32,

            // Thermal total power (OCMB+DRAM)
            THERMAL_START = 32,
            THERMAL_LENGTH = 16,

            // Current power (PMIC)
            POWER_LIMIT_START = 32,
            POWER_LIMIT_LENGTH = 8,
            POWER_SLOPE_START = 40,
            POWER_SLOPE_LENGTH = 12,
            POWER_INTERCEPT_START = 52,
            POWER_INTERCEPT_LENGTH = 12,
            POWER_LENGTH = 32,
        };

        //Positions and lengths of the encodings
        enum ATTR_DECODE_INFO
        {
            DIMM_SIZE_START = 0,
            DIMM_SIZE_LEN = 4,

            DRAM_GEN_START = 4,
            DRAM_GEN_LEN = 2,

            DIMM_TYPE_START = 6,
            DIMM_TYPE_LEN = 3,

            DRAM_WIDTH_START = 9,
            DRAM_WIDTH_LEN = 3,

            DRAM_DENSITY_START = 12,
            DRAM_DENSITY_LEN = 3,

            DRAM_STACK_TYPE_START = 15,
            DRAM_STACK_TYPE_LEN = 2,

            DRAM_MFGID_START = 17,
            DRAM_MFGID_LEN = 3,

            DIMM_MODULE_HEIGHT_START = 20,
            DIMM_MODULE_HEIGHT_LEN = 2,

            // Invalid for Explorer but compile will fail without them
            DIMMS_PER_PORT_START = 0,
            DIMMS_PER_PORT_LEN = 1,
        };

        // Definition is in chip folder
        static const std::vector< std::pair<uint8_t , uint8_t> > DIMM_TYPE_MAP;

};
}//power_thermal
}// mss


#endif
OpenPOWER on IntegriCloud