diff options
Diffstat (limited to 'include/nvgpu/pmuif/gpmuifpmgr.h')
| -rw-r--r-- | include/nvgpu/pmuif/gpmuifpmgr.h | 443 |
1 files changed, 443 insertions, 0 deletions
diff --git a/include/nvgpu/pmuif/gpmuifpmgr.h b/include/nvgpu/pmuif/gpmuifpmgr.h new file mode 100644 index 0000000..a0e6c82 --- /dev/null +++ b/include/nvgpu/pmuif/gpmuifpmgr.h | |||
| @@ -0,0 +1,443 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2016-2018, NVIDIA CORPORATION. All rights reserved. | ||
| 3 | * | ||
| 4 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
| 5 | * copy of this software and associated documentation files (the "Software"), | ||
| 6 | * to deal in the Software without restriction, including without limitation | ||
| 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
| 8 | * and/or sell copies of the Software, and to permit persons to whom the | ||
| 9 | * Software is furnished to do so, subject to the following conditions: | ||
| 10 | * | ||
| 11 | * The above copyright notice and this permission notice shall be included in | ||
| 12 | * all copies or substantial portions of the Software. | ||
| 13 | * | ||
| 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
| 17 | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
| 19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
| 20 | * DEALINGS IN THE SOFTWARE. | ||
| 21 | */ | ||
| 22 | |||
| 23 | #ifndef NVGPU_PMUIF_GPMUIFPMGR_H | ||
| 24 | #define NVGPU_PMUIF_GPMUIFPMGR_H | ||
| 25 | |||
| 26 | #include "ctrl/ctrlpmgr.h" | ||
| 27 | #include "gpmuifboardobj.h" | ||
| 28 | #include <nvgpu/flcnif_cmn.h> | ||
| 29 | |||
| 30 | struct nv_pmu_pmgr_i2c_device_desc { | ||
| 31 | struct nv_pmu_boardobj super; | ||
| 32 | u8 dcb_index; | ||
| 33 | u16 i2c_address; | ||
| 34 | u32 i2c_flags; | ||
| 35 | u8 i2c_port; | ||
| 36 | }; | ||
| 37 | |||
| 38 | #define NV_PMU_PMGR_I2C_DEVICE_DESC_TABLE_MAX_DEVICES (32U) | ||
| 39 | |||
| 40 | struct nv_pmu_pmgr_i2c_device_desc_table { | ||
| 41 | u32 dev_mask; | ||
| 42 | struct nv_pmu_pmgr_i2c_device_desc | ||
| 43 | devices[NV_PMU_PMGR_I2C_DEVICE_DESC_TABLE_MAX_DEVICES]; | ||
| 44 | }; | ||
| 45 | |||
| 46 | struct nv_pmu_pmgr_pwr_device_desc { | ||
| 47 | struct nv_pmu_boardobj super; | ||
| 48 | u32 power_corr_factor; | ||
| 49 | }; | ||
| 50 | |||
| 51 | #define NV_PMU_PMGR_PWR_DEVICE_INA3221_CH_NUM 0x03U | ||
| 52 | |||
| 53 | struct nv_pmu_pmgr_pwr_device_desc_ina3221 { | ||
| 54 | struct nv_pmu_pmgr_pwr_device_desc super; | ||
| 55 | u8 i2c_dev_idx; | ||
| 56 | struct ctrl_pmgr_pwr_device_info_rshunt | ||
| 57 | r_shuntm_ohm[NV_PMU_PMGR_PWR_DEVICE_INA3221_CH_NUM]; | ||
| 58 | u16 configuration; | ||
| 59 | u16 mask_enable; | ||
| 60 | u32 event_mask; | ||
| 61 | u16 curr_correct_m; | ||
| 62 | s16 curr_correct_b; | ||
| 63 | }; | ||
| 64 | |||
| 65 | union nv_pmu_pmgr_pwr_device_desc_union { | ||
| 66 | struct nv_pmu_boardobj board_obj; | ||
| 67 | struct nv_pmu_pmgr_pwr_device_desc pwr_dev; | ||
| 68 | struct nv_pmu_pmgr_pwr_device_desc_ina3221 ina3221; | ||
| 69 | }; | ||
| 70 | |||
| 71 | struct nv_pmu_pmgr_pwr_device_ba_info { | ||
| 72 | bool b_initialized_and_used; | ||
| 73 | }; | ||
| 74 | |||
| 75 | struct nv_pmu_pmgr_pwr_device_desc_table_header { | ||
| 76 | struct nv_pmu_boardobjgrp_e32 super; | ||
| 77 | struct nv_pmu_pmgr_pwr_device_ba_info ba_info; | ||
| 78 | }; | ||
| 79 | |||
| 80 | NV_PMU_MAKE_ALIGNED_STRUCT(nv_pmu_pmgr_pwr_device_desc_table_header, | ||
| 81 | sizeof(struct nv_pmu_pmgr_pwr_device_desc_table_header)); | ||
| 82 | NV_PMU_MAKE_ALIGNED_UNION(nv_pmu_pmgr_pwr_device_desc_union, | ||
| 83 | sizeof(union nv_pmu_pmgr_pwr_device_desc_union)); | ||
| 84 | |||
| 85 | struct nv_pmu_pmgr_pwr_device_desc_table { | ||
| 86 | union nv_pmu_pmgr_pwr_device_desc_table_header_aligned hdr; | ||
| 87 | union nv_pmu_pmgr_pwr_device_desc_union_aligned | ||
| 88 | devices[CTRL_PMGR_PWR_DEVICES_MAX_DEVICES]; | ||
| 89 | }; | ||
| 90 | |||
| 91 | union nv_pmu_pmgr_pwr_device_dmem_size { | ||
| 92 | union nv_pmu_pmgr_pwr_device_desc_table_header_aligned pwr_device_hdr; | ||
| 93 | union nv_pmu_pmgr_pwr_device_desc_union_aligned pwr_device; | ||
| 94 | }; | ||
| 95 | |||
| 96 | struct nv_pmu_pmgr_pwr_channel { | ||
| 97 | struct nv_pmu_boardobj super; | ||
| 98 | u8 pwr_rail; | ||
| 99 | u8 ch_idx; | ||
| 100 | u32 volt_fixedu_v; | ||
| 101 | u32 pwr_corr_slope; | ||
| 102 | s32 pwr_corr_offsetm_w; | ||
| 103 | u32 curr_corr_slope; | ||
| 104 | s32 curr_corr_offsetm_a; | ||
| 105 | u32 dependent_ch_mask; | ||
| 106 | }; | ||
| 107 | |||
| 108 | #define NV_PMU_PMGR_PWR_CHANNEL_MAX_CHANNELS 16U | ||
| 109 | |||
| 110 | #define NV_PMU_PMGR_PWR_CHANNEL_MAX_CHRELATIONSHIPS 16U | ||
| 111 | |||
| 112 | struct nv_pmu_pmgr_pwr_channel_sensor { | ||
| 113 | struct nv_pmu_pmgr_pwr_channel super; | ||
| 114 | u8 pwr_dev_idx; | ||
| 115 | u8 pwr_dev_prov_idx; | ||
| 116 | }; | ||
| 117 | |||
| 118 | struct nv_pmu_pmgr_pwr_channel_pmu_compactible { | ||
| 119 | u8 pmu_compactible_data[56]; | ||
| 120 | }; | ||
| 121 | |||
| 122 | union nv_pmu_pmgr_pwr_channel_union { | ||
| 123 | struct nv_pmu_boardobj board_obj; | ||
| 124 | struct nv_pmu_pmgr_pwr_channel pwr_channel; | ||
| 125 | struct nv_pmu_pmgr_pwr_channel_sensor sensor; | ||
| 126 | struct nv_pmu_pmgr_pwr_channel_pmu_compactible pmu_pwr_channel; | ||
| 127 | }; | ||
| 128 | |||
| 129 | #define NV_PMU_PMGR_PWR_MONITOR_TYPE_NO_POLLING 0x02U | ||
| 130 | |||
| 131 | struct nv_pmu_pmgr_pwr_monitor_pstate { | ||
| 132 | u32 hw_channel_mask; | ||
| 133 | }; | ||
| 134 | |||
| 135 | union nv_pmu_pmgr_pwr_monitor_type_specific { | ||
| 136 | struct nv_pmu_pmgr_pwr_monitor_pstate pstate; | ||
| 137 | }; | ||
| 138 | |||
| 139 | struct nv_pmu_pmgr_pwr_chrelationship_pmu_compactible { | ||
| 140 | u8 pmu_compactible_data[28]; | ||
| 141 | }; | ||
| 142 | |||
| 143 | union nv_pmu_pmgr_pwr_chrelationship_union { | ||
| 144 | struct nv_pmu_boardobj board_obj; | ||
| 145 | struct nv_pmu_pmgr_pwr_chrelationship_pmu_compactible pmu_pwr_chrelationship; | ||
| 146 | }; | ||
| 147 | |||
| 148 | struct nv_pmu_pmgr_pwr_channel_header { | ||
| 149 | struct nv_pmu_boardobjgrp_e32 super; | ||
| 150 | u8 type; | ||
| 151 | union nv_pmu_pmgr_pwr_monitor_type_specific type_specific; | ||
| 152 | u8 sample_count; | ||
| 153 | u16 sampling_periodms; | ||
| 154 | u16 sampling_period_low_powerms; | ||
| 155 | u32 total_gpu_power_channel_mask; | ||
| 156 | u32 physical_channel_mask; | ||
| 157 | }; | ||
| 158 | |||
| 159 | struct nv_pmu_pmgr_pwr_chrelationship_header { | ||
| 160 | struct nv_pmu_boardobjgrp_e32 super; | ||
| 161 | }; | ||
| 162 | |||
| 163 | NV_PMU_MAKE_ALIGNED_STRUCT(nv_pmu_pmgr_pwr_channel_header, | ||
| 164 | sizeof(struct nv_pmu_pmgr_pwr_channel_header)); | ||
| 165 | NV_PMU_MAKE_ALIGNED_STRUCT(nv_pmu_pmgr_pwr_chrelationship_header, | ||
| 166 | sizeof(struct nv_pmu_pmgr_pwr_chrelationship_header)); | ||
| 167 | NV_PMU_MAKE_ALIGNED_UNION(nv_pmu_pmgr_pwr_chrelationship_union, | ||
| 168 | sizeof(union nv_pmu_pmgr_pwr_chrelationship_union)); | ||
| 169 | NV_PMU_MAKE_ALIGNED_UNION(nv_pmu_pmgr_pwr_channel_union, | ||
| 170 | sizeof(union nv_pmu_pmgr_pwr_channel_union)); | ||
| 171 | |||
| 172 | struct nv_pmu_pmgr_pwr_channel_desc { | ||
| 173 | union nv_pmu_pmgr_pwr_channel_header_aligned hdr; | ||
| 174 | union nv_pmu_pmgr_pwr_channel_union_aligned | ||
| 175 | channels[NV_PMU_PMGR_PWR_CHANNEL_MAX_CHANNELS]; | ||
| 176 | }; | ||
| 177 | |||
| 178 | struct nv_pmu_pmgr_pwr_chrelationship_desc { | ||
| 179 | union nv_pmu_pmgr_pwr_chrelationship_header_aligned hdr; | ||
| 180 | union nv_pmu_pmgr_pwr_chrelationship_union_aligned | ||
| 181 | ch_rels[NV_PMU_PMGR_PWR_CHANNEL_MAX_CHRELATIONSHIPS]; | ||
| 182 | }; | ||
| 183 | |||
| 184 | union nv_pmu_pmgr_pwr_monitor_dmem_size { | ||
| 185 | union nv_pmu_pmgr_pwr_channel_header_aligned channel_hdr; | ||
| 186 | union nv_pmu_pmgr_pwr_channel_union_aligned channel; | ||
| 187 | union nv_pmu_pmgr_pwr_chrelationship_header_aligned ch_rels_hdr; | ||
| 188 | union nv_pmu_pmgr_pwr_chrelationship_union_aligned ch_rels; | ||
| 189 | }; | ||
| 190 | |||
| 191 | struct nv_pmu_pmgr_pwr_monitor_pack { | ||
| 192 | struct nv_pmu_pmgr_pwr_channel_desc channels; | ||
| 193 | struct nv_pmu_pmgr_pwr_chrelationship_desc ch_rels; | ||
| 194 | }; | ||
| 195 | |||
| 196 | #define NV_PMU_PMGR_PWR_POLICY_MAX_POLICIES 32U | ||
| 197 | |||
| 198 | #define NV_PMU_PMGR_PWR_POLICY_MAX_POLICY_RELATIONSHIPS 32U | ||
| 199 | |||
| 200 | struct nv_pmu_pmgr_pwr_policy { | ||
| 201 | struct nv_pmu_boardobj super; | ||
| 202 | u8 ch_idx; | ||
| 203 | u8 num_limit_inputs; | ||
| 204 | u8 limit_unit; | ||
| 205 | u8 sample_mult; | ||
| 206 | u32 limit_curr; | ||
| 207 | u32 limit_min; | ||
| 208 | u32 limit_max; | ||
| 209 | struct ctrl_pmgr_pwr_policy_info_integral integral; | ||
| 210 | enum ctrl_pmgr_pwr_policy_filter_type filter_type; | ||
| 211 | union ctrl_pmgr_pwr_policy_filter_param filter_param; | ||
| 212 | }; | ||
| 213 | |||
| 214 | struct nv_pmu_pmgr_pwr_policy_hw_threshold { | ||
| 215 | struct nv_pmu_pmgr_pwr_policy super; | ||
| 216 | u8 threshold_idx; | ||
| 217 | u8 low_threshold_idx; | ||
| 218 | bool b_use_low_threshold; | ||
