summaryrefslogtreecommitdiffstats
path: root/import/chips/p9/common/pmlib/include/pstate_pgpe_cme_api.h
blob: 489458c167ac4fe2832d2f32224aa0de77f0e518 (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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: import/chips/p9/common/pmlib/include/pstate_pgpe_cme_api.h $  */
/*                                                                        */
/* OpenPOWER HCODE Project                                                */
/*                                                                        */
/* COPYRIGHT 2016,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                                                     */
#ifndef __PSTATE_PGPE_CME_API_H__
#define __PSTATE_PGPE_CME_API_H__

#define DPLL_REFCLK_DIVIDER         16667

#define PMCR_UPPERPS_MASK  0xFF00000000000000
#define PMCR_LOWERPS_MASK  0x00FF000000000000
#define PMCR_PSTATE_SHIFT_AMOUNT SHIFT64(15)

#define PIG_PAYLOAD_MASK            0x0fff000000000000
#define PIG_INTR_FIELD_MASK         0x7000000000000000
#define PIG_INTR_GRANTED_MASK       0x0000000080000000

// PIR defines
#define PIR_INSTANCE_EVEN_ODD_MASK  (uint32_t)(0x00000001)
#define PIR_INSTANCE_NUM_MASK       (uint32_t)(0x0000000F)

//Bit0 WR: 0
//Bit1 Multicast: 1
//Bit 2:4 Multicast Type: 101
//Bit 5:7 Mutlicast Grp: 001
#define PCB_MULTICAST_GRP1          0x69000000
#define PCB_MULTICAST_GRP4          0x6c000000

#define QUAD_FROM_CORE(c) \
    ((c&0x1C) >> 2)

#define QUAD_FROM_CME_INSTANCE_NUM(num) \
    ((num&0xE) >> 1)


//PMCR GA1 Definition
enum PMCR_DEFS
{
    PMCR_UPPER_PS_START         = 0,
    PMCR_UPPER_PS_LENGTH        = 8,
    PMCR_LOWER_PS_START         = 8,
    PMCR_LOWER_PS_LENGTH        = 8,
    PMCR_VERSION_START          = 60,
    PMCR_VERSION_LENGTH         = 4
};

//PMSR GA1 Definition
enum PMSR_DEFS
{
    PMSR_GLOBAL_ACTUAL_PSTATE_START     = 0,
    PMSR_GLOBAl_ACTUAL_PSTATE_LENGTH    = 8,
    PMSR_LOCAL_ACTUAL_PSTATE_START      = 8,
    PMSR_LOCAL_ACTUAL_PSTATE_LENGTH     = 8,
    PMSR_PMIN_START                     = 16,
    PMSR_PMIN_LENGTH                    = 8,
    PMSR_PMAX_START                     = 24,
    PMSR_PMAX_LENGTH                    = 8,
    PMSR_PMCR_DISABLED                  = 32,
    PMSR_SAFE_MODE                      = 33,
    PMSR_IVRM_ALLOWED                   = 34,
    PMSR_IVRM_ENABLED                   = 35,
    PMSR_UPDATE_IN_PROGRESS             = 58,
    PMSR_INVALID_PMCR_VERSION           = 59,
    PMSR_VERSION_START                  = 60,
    PMSR_VERSION_LENGTH                 = 4
};

//
// CME<->PGPE API
//
enum MESSAGE_ID_DB0
{
    MSGID_DB0_VALID_START                   = 0, //This is for error checking
    //This is used when sending DB3 with payloads in DB0.
    //The reason is DB3 register has less bits than DB0.
    MSGID_DB0_DB3_PAYLOAD                   = 0,
    MSGID_DB0_RESERVED                      = 1,
    MSGID_DB0_GLOBAL_ACTUAL_BROADCAST       = 2,
    MSGID_DB0_START_PSTATE_BROADCAST        = 3,
    MSGID_DB0_STOP_PSTATE_BROADCAST         = 4,
    MSGID_DB0_CLIP_BROADCAST                = 5,
    MSGID_DB0_PMSR_UPDT                     = 6,
    MSGID_DB0_REGISTER_DONE                 = 7,
    MSGID_DB0_VALID_END                     = 7 //This is for error checking
};

enum MESSAGE_ID_DB3
{
    MSGID_DB3_INVALID                   = 0,
    MSGID_DB3_HIGH_PRIORITY_PSTATE      = 0x01,
    MSGID_DB3_ENTER_SAFE_MODE           = 0x02,
    MSGID_DB3_REPLAY_DB0                = 0x03,
    MSGID_DB3_DISABLE_SGPE_HANDOFF      = 0x04,
    MSGID_DB3_SUSPEND_STOP_ENTRY        = 0x05,
    MSGID_DB3_UNSUSPEND_STOP_ENTRY      = 0x06,
    MSGID_DB3_CLIP_BROADCAST            = 0x07,
    MSGID_DB3_IMMEDIATE_HALT            = 0xF1,
    MSGID_DB3_RESTORE_STATE_AND_HALT    = 0xF2,
};

enum MESSAGEID_PCB_TYPE4_ACK_TYPES
{
    MSGID_PCB_TYPE4_ACK_ERROR                    = 0,
    MSGID_PCB_TYPE4_ACK_PSTATE_PROTO_ACK         = 1,
    MSGID_PCB_TYPE4_ACK_PSTATE_SUSPENDED         = 2,
    MSGID_PCB_TYPE4_QUAD_MGR_AVAILABLE           = 3,
    MSGID_PCB_TYPE4_NACK_DROOP_PRESENT           = 4,
    MSGID_PCB_TYPE4_SUSPEND_ENTRY_ACK            = 5,
    MSGID_PCB_TYPE4_UNSUSPEND_ENTRY_ACK          = 6
};

enum DB0_CLIP_BCAST_FIELDS
{
    DB0_CLIP_BCAST_TYPE_PMIN      = 0,
    DB0_CLIP_BCAST_TYPE_PMAX      = 1
};

enum DB0_PMSR_UPDT_COMMANDS
{
    DB0_PMSR_UPDT_SET_PSTATES_SUSPENDED     = 0x1,
    DB0_PMSR_UPDT_CLEAR_PSTATES_SUSPENDED   = 0x2
};

//
//PGPE-CME Doorbell0(Global Actual Broadcast)
//
typedef union pgpe_db0_glb_bcast_t
{
    uint64_t value;
    struct
    {
#ifdef _BIG_ENDIAN
        uint64_t  msg_id : 8;
        uint64_t  global_actual : 8;
        uint64_t  quad0_ps: 8;
        uint64_t  quad1_ps: 8;
        uint64_t  quad2_ps: 8;
        uint64_t  quad3_ps: 8;
        uint64_t  quad4_ps: 8;
        uint64_t  quad5_ps: 8;
#else
        uint64_t  quad5_ps: 8;
        uint64_t  quad4_ps: 8;
        uint64_t  quad3_ps: 8;
        uint64_t  quad2_ps: 8;
        uint64_t  quad1_ps: 8;
        uint64_t  quad0_ps: 8;
        uint64_t  global_actual : 8;
        uint64_t  msg_id : 8;
#endif
    } fields;
} pgpe_db0_glb_bcast_t;

//
//PGPE-CME Doorbell0(Start Pstate Broaadcast)
//
typedef union pgpe_db0_start_ps_bcast
{
    uint64_t value;
    struct
    {
#ifdef _BIG_ENDIAN
        uint64_t msg_id : 8;
        uint64_t global_actual : 8;
        uint64_t quad0_ps : 8;
        uint64_t quad1_ps : 8;
        uint64_t quad2_ps : 8;
        uint64_t quad3_ps : 8;
        uint64_t quad4_ps : 8;
        uint64_t quad5_ps : 8;
#else
        uint64_t quad5_ps : 8;
        uint64_t quad4_ps : 8;
        uint64_t quad3_ps : 8;
        uint64_t quad2_ps : 8;
        uint64_t quad1_ps : 8;
        uint64_t quad0_ps : 8;
        uint64_t global_actual : 8;
        uint64_t msg_id : 8;
#endif
    } fields;
} pgpe_db0_start_ps_bcast_t;

//
//PGPE-CME Doorbell0(Pstate Stop Broaadcast)
//
typedef union pgpe_db0_stop_ps_bcast
{
    uint64_t value;
    struct
    {
#ifdef _BIG_ENDIAN
        uint64_t msg_id : 8;
        uint64_t reserved : 56;
#else
        uint64_t reserved : 56;
        uint64_t msg_id : 8;
#endif
    } fields;
} pgpe_db0_stop_ps_bcast_t;

//
//PGPE-CME Doorbell0(Clip Broadcast)
//
typedef union pgpe_db0_clip_bcast
{
    uint64_t value;
    struct
    {
#ifdef _BIG_ENDIAN
        uint64_t msg_id : 8;
        uint64_t clip_type : 8;
        uint64_t quad0_clip : 8;
        uint64_t quad1_clip : 8;
        uint64_t quad2_clip : 8;
        uint64_t quad3_clip : 8;
        uint64_t quad4_clip : 8;
        uint64_t quad5_clip : 8;
#else
        uint64_t quad5_clip : 8;
        uint64_t quad4_clip : 8;
        uint64_t quad3_clip : 8;
        uint64_t quad2_clip : 8;
        uint64_t quad1_clip : 8;
        uint64_t quad0_clip : 8;
        uint64_t clip_type: 8;
        uint64_t msg_id : 8;
#endif
    } fields;
} pgpe_db0_clip_bcast_t;

//
//PGPE-CME Doorbell0(PMSR Update)
//
typedef union pgpe_db0_pmsr_updt
{
    uint64_t value;
    struct
    {
#ifdef _BIG_ENDIAN
        uint64_t msg_id : 8;
        uint64_t command : 8;
        uint64_t reserved: 48;
#else
        uint64_t reserved: 48;
        uint64_t command : 8;
        uint64_t msg_id : 8;
#endif
    } fields;
} pgpe_db0_pmsr_updt_t;

//
//PGPE-CME Doorbell0(Pstate Abort)
//
typedef union pgpe_db0_pstate_register_done
{
    uint64_t value;
    struct
    {
#ifdef _BIG_ENDIAN
        uint64_t msg_id : 8;
        uint64_t reserved: 56;
#else
        uint64_t reserved: 56;
        uint64_t msg_id : 8;
#endif
    } fields;
} pgpe_db0_pstate_register_done_t;


#endif //__PSTATE_PGPE_CME_API_H__
OpenPOWER on IntegriCloud