summaryrefslogtreecommitdiffstats
path: root/src/occ_405/cmdh/cmdh_fsp_cmds_datacnfg.h
blob: 0f2c95916bee0d5a0f52bd17172dddf12f8b7fbb (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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/occ/cmdh/cmdh_fsp_cmds_datacnfg.h $                       */
/*                                                                        */
/* OpenPOWER OnChipController Project                                     */
/*                                                                        */
/* Contributors Listed Below - COPYRIGHT 2011,2015                        */
/* [+] 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 _CMDH_FSP_CMDS_DATACNFG_H
#define _CMDH_FSP_CMDS_DATACNFG_H

#include "ssx.h"
#include "cmdh_service_codes.h"
#include "errl.h"
#include "trac.h"
#include "rtls.h"
#include "occ_common.h"
#include "state.h"
#include "cmdh_fsp.h"
//#include "gpsm.h"
#include "cmdh_fsp_cmds.h"
#include "apss.h"

// Enum of the various CnfgData command formats that
// are sent to OCC over the TMGT<->OCC interface.
typedef enum
{
   DATA_FORMAT_FREQ                  = 0x02,
   DATA_FORMAT_SET_ROLE              = 0x03,
   DATA_FORMAT_APSS_CONFIG           = 0x04,
   DATA_FORMAT_MEM_CFG               = 0x05,
   DATA_FORMAT_POWER_CAP             = 0x07,
   DATA_FORMAT_SYS_CNFG              = 0x0f,
   DATA_FORMAT_IPS_CNFG              = 0x11,
   DATA_FORMAT_MEM_THROT             = 0x12,
   DATA_FORMAT_THRM_THRESHOLDS       = 0x13,
   DATA_FORMAT_VOLT_UPLIFT           = 0x20,
   DATA_FORMAT_WOF_CORE_FREQ         = 0x30,
   DATA_FORMAT_WOF_VRM_EFF           = 0x31,
   DATA_FORMAT_CLEAR_ALL             = 0xff,
} eConfigDataFormatVersion;

// Enum of the various Cnfg Data Masks that are used
// to signal that OCC has received cnfg data
typedef enum
{
   DATA_MASK_FREQ_PRESENT          = 0x00000002,
   DATA_MASK_SET_ROLE              = 0x00000004,
   DATA_MASK_APSS_CONFIG           = 0x00000008,
   DATA_MASK_PCAP_PRESENT          = 0x00000010,
   DATA_MASK_SYS_CNFG              = 0x00000020,
   //0x00000040 not assigned.
   DATA_MASK_THRM_THRESHOLDS       = 0x00000080,
   DATA_MASK_IPS_CNFG              = 0x00000100,
   DATA_MASK_MEM_CFG               = 0x00000200,
   DATA_MASK_MEM_THROT             = 0x00000400,
   DATA_MASK_VOLT_UPLIFT           = 0x00000800,
} eConfigDataPriorityMask;

typedef enum
{
    DATA_FRU_PROC               = 0x00,
    DATA_FRU_CENTAUR            = 0x01,
    DATA_FRU_DIMM               = 0x02,
    DATA_FRU_VRM                = 0x03,
    DATA_FRU_MAX,
} eConfigDataFruType;

// Set OCC Role Masks
#define OCC_ROLE_MASTER_MASK        0x01
#define OCC_ROLE_FIR_MASTER_MASK    0x40

// Used by TMGT to send OCC the frequencies for each mode.
typedef struct __attribute__ ((packed))
{
    struct cmdh_fsp_cmd_header;
    uint8_t format;
    uint8_t version;
}cmdh_store_mode_freqs_t;

// Old way used by TMGT to send OCC the frequencies for each mode.
typedef struct __attribute__ ((packed))
{
    struct cmdh_fsp_cmd_header;
    uint8_t format;
    uint8_t version;
    uint8_t mode_count;
}cmdh_store_mode_freqs_old_t;

// Used by TMGT to tell OCC if it is a master or not
typedef struct __attribute__ ((packed))
{
    struct cmdh_fsp_cmd_header;
    uint8_t format;
    uint8_t role;
    uint8_t reserved[2];
}cmdh_set_role_t;

// Used by TMGT to send OCC the APSS ADC Config Data
typedef struct  __attribute__ ((packed))
{
  uint8_t  assignment;
  uint32_t ipmisensorId;
  uint8_t  gnd_select;
  uint32_t gain;
  uint32_t offset;
} apss_cfg_adc_v20_t;  //New for P9

// Used by TMGT to send OCC the GPIO Config Data
typedef struct  __attribute__ ((packed))
{
  uint8_t  mode;
  uint8_t  __reserved;
  uint8_t  assignment[8];
} apss_cfg_gpio_t;

// Used by TMGT to send OCC the full APSS config data.
typedef struct __attribute__ ((packed))
{
    struct cmdh_fsp_cmd_header;
    uint8_t              format;
    uint8_t              version;
    uint8_t              reserved[2];
    apss_cfg_adc_v20_t   adc[MAX_APSS_ADC_CHANNELS];
    apss_cfg_gpio_t      gpio[MAX_APSS_GPIO_PORTS];
}cmdh_apss_config_v20_t; //New for P9


// Used by TMGT to send OCC the PCAP config data.
typedef struct __attribute__ ((packed))
{
    uint16_t soft_min_pcap; // Min node power cap allowed in 1W units (1WU)
    uint16_t hard_min_pcap; // Min guaranteed node power cap in 1WU
    uint16_t sys_max_pcap;  // Max system (max user settable) power cap in 1WU
    uint16_t qpd_pcap;      // Quick Power Drop (Oversubscription) power cap in 1WU
} cmdh_pcap_config_data_t;

// Used by TMGT to send OCC the PCAP config data.
typedef struct __attribute__ ((packed))
{
    struct cmdh_fsp_cmd_header;
    uint8_t              format;
    uint8_t              version;
    cmdh_pcap_config_data_t   pcap_config;
}cmdh_pcap_config_t;

typedef struct __attribute__ ((packed))
{
    uint8_t  system_type;     // General system type
    uint32_t proc_sid;        // Processor Sensor ID
    uint32_t core_sid[MAX_CORES * 2];    // 24 cores. 4 bytes for Temp, followed by 4 bytes for Frequency.
    uint32_t backplane_sid;   // Backplane Sensor ID
    uint32_t apss_sid;        // APSS Sensor ID
} cmdh_sys_config_data_v20_t;

typedef struct __attribute__ ((packed))
{
    struct cmdh_fsp_cmd_header;
    uint8_t              format;
    uint8_t              version;
    cmdh_sys_config_data_v20_t   sys_config;
}cmdh_sys_config_v20_t;

// Used by TMGT to send OCC the IPS config data.
typedef struct __attribute__ ((packed))
{
    uint8_t     iv_ipsEnabled;          // Idle Power Save Enabled (0 or 1)
    uint16_t    iv_delayTimeforEntry;   // Delay Time in seconds to enter Idle Power
    uint8_t     iv_utilizationForEntry; // Utilization threshold percentage to enter Idle Power
    uint16_t    iv_delayTimeforExit;    // Delay Time in seconds to exit Idle Power
    uint8_t     iv_utilizationForExit;  // Utilization threshold percentage to exit Idle Power

} cmdh_ips_config_data_t;

// Used by TMGT to send OCC the IPS config data.
typedef struct __attribute__ ((packed))
{
    struct                  cmdh_fsp_cmd_header;
    uint8_t                 iv_format;
    uint8_t                 iv_version;
    cmdh_ips_config_data_t  iv_ips_config;
}cmdh_ips_config_t;

extern cmdh_ips_config_data_t   G_ips_config_data;

// Used by TMGT to send OCC thermal control thresholds
typedef struct __attribute__ ((packed))
{
    uint8_t              fru_type;
    uint8_t              dvfs;
    uint8_t              error;
    uint8_t              pm_dvfs;
    uint8_t              pm_error;
    uint8_t              error_count;
    uint8_t              max_read_timeout;
}cmdh_thrm_thresholds_set_t;

// Used by TMGT to send OCC thermal control thresholds
typedef struct __attribute__ ((packed))
{
    struct cmdh_fsp_cmd_header;
    uint8_t                    format;
    uint8_t                    version;

    // Weight factor for core DTS used to calculate a core temp
    uint8_t                    proc_core_weight;
    uint8_t                    proc_quad_weight;

    uint8_t                    num_data_sets;
    cmdh_thrm_thresholds_set_t data[DATA_FRU_MAX];
}cmdh_thrm_thresholds_t;


typedef struct __attribute__ ((packed))
{
    uint8_t              fru_type; // 0: proc, 1: centaur, 2: dimm, 3: vrm
//  dvfs/pm_dvfs and error/pm_error fields define the temperature trigger
//  points for DVFS/Throttling and error/FRU callouts, respectively.
//  a 0xFF entry indicates that the coresponding temperature trigger
//  point is undefined.
    uint8_t              dvfs;     // OS Controlled sys/PowerVM nominal
    uint8_t              error;    // OS Controlled sys/PowerVM nominal
    uint8_t              pm_dvfs;  // powerVM sys
    uint8_t              pm_error; // powerVM sys
    uint8_t              max_read_timeout;
}cmdh_thrm_thresholds_set_v20_t;

typedef struct __attribute__ ((packed))
{
    struct cmdh_fsp_cmd_header;
    uint8_t              format;
    uint8_t              version;
    uint8_t              proc_core_weight;
    uint8_t              proc_quad_weight;
    uint8_t              num_data_sets;
    cmdh_thrm_thresholds_set_v20_t data[DATA_FRU_MAX];
}cmdh_thrm_thresholds_v20_t;


// Header data for mem cfg packet
typedef struct __attribute__ ((packed))
{
    struct cmdh_fsp_cmd_header;
    uint8_t                    format;
    uint8_t                    version;
    uint8_t                    num_data_sets;
}cmdh_mem_cfg_header_t;

// Config packet definition used by TMGT to
// send sensor mappings for centaurs and dimms

typedef struct __attribute__ ((packed))
{
    uint32_t                   hw_sensor_id;
    uint32_t                   temp_sensor_id;
    uint8_t                    memory_type;
    uint8_t                    dimm_info1;
    uint8_t                    dimm_info2;
    uint8_t                    dimm_info3;
}cmdh_mem_cfg_data_set_v20_t;

typedef struct __attribute__ ((packed))
{
    cmdh_mem_cfg_header_t       header;
    cmdh_mem_cfg_data_set_v20_t data_set[1];
}cmdh_mem_cfg_v20_t;


// Header data for mem throttle packet
typedef struct __attribute__ ((packed))
{
    struct cmdh_fsp_cmd_header;
    uint8_t                    format;
    uint8_t                    version;
    uint8_t                    num_data_sets;
}cmdh_mem_throt_header_t;


// Provides memory throttle min and max values for Nimbus systems
typedef struct __attribute__ ((packed))
{
    uint8_t  mc_num;            // Physical MC: [0=MC01, 2=MC23]
    uint8_t  port_num;          // Physical port # [0-3]

    uint16_t  min_n_per_port;   // Lowest per port allowed numerator
    uint16_t  min_mem_power;    // Max mem Power @min (x0.1W)

    uint16_t  pcap1_n_per_port; // Static per port numerator @PCAP1
    uint16_t  pcap1_mem_power;  // Max memory power @PCAP1 (x0.1W)

    uint16_t  pcap2_n_per_port; // Static per port numerator @PCAP2
    uint16_t  pcap2_mem_power;  // Max memory power @PCAP2 (x0.1W)

    uint16_t  nom_n_per_port;   // Static per port @Redundant (no ovs)
    uint16_t  nom_n_per_slot;   // Static per slot @Redundant
    uint16_t  nom_mem_power;    // Max memory power @Redundant(x0.1W)

    uint16_t  ovs_n_per_port;   // Static per port @Oversubscription
    uint16_t  ovs_n_per_slot;   // Static per slot @Oversubscription
    uint16_t  ovs_mem_power;    // Max memory power @Oversubscription (x0.1W)
}nimbus_mem_throt_t;

// Provides memory throttle min and max values for Cumulus systems
typedef struct __attribute__ ((packed))
{
    uint8_t   centaur_num;      // Physical centaur# [0-7]
    uint8_t   mba_num;          // Memory Buffer within centaur [0-1]

    uint16_t  min_n_per_mba;    // Lowest per MBA allowed numerator
    uint16_t  min_mem_power;    // Max mem Power @min (x0.1W)

    uint16_t  pcap1_n_per_mba;  // Static per MBA numerator @PCAP1
    uint16_t  pcap1_mem_power;  // Max memory power @PCAP1 (x0.1W)

    uint16_t  pcap2_n_per_mba;  // Static per MBA numerator @PCAP2
    uint16_t  pcap2_mem_power;  // Max memory power @PCAP2 (x0.1W)

    uint16_t  nom_n_per_mba;    // Static per MBA @Redundant (no ovs)
    uint16_t  nom_n_per_chip;   // Static per chip @Redundant
    uint16_t  nom_mem_power;    // Max memory power @Redundant(x0.1W)

    uint16_t  ovs_n_per_mba;    // Static per MBA @Oversubscription
    uint16_t  ovs_n_per_chip;   // Static per chip @Oversubscription
    uint16_t  ovs_mem_power;    // Max memory power @Oversubscription (x0.1W)
}cumulus_mem_throt_t;

typedef union cmdh_mem_throt_data_set
{
    nimbus_mem_throt_t nimbus;
    cumulus_mem_throt_t cumulus;
} cmdh_mem_throt_data_set_t;

// Config packet definition used by TMGT to
// send mem throttle min/max settings.
typedef struct __attribute__ ((packed))
{
    cmdh_mem_throt_header_t      header;
    cmdh_mem_throt_data_set_t    data_set[1];
}cmdh_mem_throt_t;

// Used to mark present the config data TMGT has sent us.
typedef struct data_cnfg
{
    uint32_t                  data_mask;
    cmdh_thrm_thresholds_t    thrm_thresh;
} data_cnfg_t;

// Used by TMGT to send OCC the Vdd and Vcs uplift values
typedef struct __attribute__ ((packed))
{
    struct               cmdh_fsp_cmd_header;
    uint8_t              format;
    uint8_t              version;
    uint8_t              vdd_vid_uplift; //Only positive uplift values are supported
    uint8_t              vcs_vid_uplift; //Only positive uplift values are supported
}cmdh_uplift_config_t;

errlHndl_t DATA_store_cnfgdata (const cmdh_fsp_cmd_t * i_cmd_ptr,
                                    cmdh_fsp_rsp_t * i_rsp_ptr);

uint8_t DATA_request_cnfgdata ();

uint32_t DATA_get_present_cnfgdata ();

errlHndl_t DATA_get_thrm_thresholds(cmdh_thrm_thresholds_t **o_thrm_thresh);

errlHndl_t DATA_get_ips_cnfg(cmdh_ips_config_data_t **o_ips_cnfg);

#endif

OpenPOWER on IntegriCloud