summaryrefslogtreecommitdiffstats
path: root/src/import/chips/p9/utils/imageProcs/p9_tor.H
blob: 5c3bde16de6882ae3de615fad5c226c3250066ab (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
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* $Source: src/import/chips/p9/utils/imageProcs/p9_tor.H $               */
/*                                                                        */
/* OpenPOWER sbe 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                                                     */
#ifndef _P9_TOR_H_
#define _P9_TOR_H_

#include "p9_ring_identification.H"
#include "p9_ringId.H"
#include "p9_infrastruct_help.H"

namespace P9_TOR
{

#define NUM_RING_IDS              P9_NUM_RINGS

typedef struct
{
    uint32_t sizeOfThis;
    uint16_t sizeOfCmsk;
    uint16_t sizeOfMeta; // Exact size of meta data. Arbitrary size. Not null terminated.
} RingLayout_t;


//
// Temporary define until in TOR header by Giri.
//
//
// Temporary define until in TOR header by Giri.
//
typedef struct
{
    uint32_t TorNumDdLevels;
    uint32_t reserved;
} TorNumDdLevels_t;

typedef struct
{
    uint32_t TorDdLevelAndOffset;
    uint32_t TorDdBlockSize;
} TorDdLevelBlock_t;

typedef struct
{
    uint32_t TorPpeTypeOffset;
    uint32_t TorPpeBlockSize;
} TorPpeBlock_t;


#define MAX_CPLT_SBE                                  13
#define IMGBUILD_TGR_RING_FOUND                        0
#define IMGBUILD_TGR_RING_BLOCKS_FOUND                 0
#define IMGBUILD_TGR_RING_NOT_FOUND                    1  // Ring is not found in HW image.
#define IMGBUILD_TGR_INVALID_RING_ID                   2  // Ring is invalid or mismatch.
#define IMGBUILD_TGR_AMBIGUOUS_API_PARMS               3  // Ring search in HW iamge got ambiguous condition.
#define IMGBUILD_TGR_SECTION_NOT_FOUND                 4
#define IMGBUILD_TGR_DD_LVL_INFO_NOT_FOUND             5
#define IMGBUILD_TGR_OP_BUFFER_INVALID                 6
#define IMGBUILD_TGR_OP_BUFFER_SIZE_EXCEEDED           7
#define IMGBUILD_INVALID_INSTANCEID                    8
#define IMGBUILD_TGR_IMAGE_DOES_NOT_SUPPORT_CME       10
#define IMGBUILD_TGR_IMAGE_DOES_NOT_SUPPORT_SGPE      11
#define IMGBUILD_TGR_IMAGE_DOES_NOT_SUPPORT_DD_LEVEL  12
#define IMGBUILD_TGR_IMAGE_DOES_NOT_SUPPORT_PPE_LEVEL 13

#define MY_INF(_fmt_, _args_...) printf(_fmt_, ##_args_)
#define MY_ERR(_fmt_, _args_...) printf(_fmt_, ##_args_)
#define MY_DBG(_fmt_, _args_...) printf(_fmt_, ##_args_)


extern const char* ringVariantName[];
extern const char* ppeTypeName[];


typedef enum
RingBlockType   // Different options to extract data using tor_get_ring API
{
    SINGLE_RING      = 0x00,
    DD_LEVEL_RINGS   = 0x01,
    PPE_LEVEL_RINGS  = 0x02,
    CPLT_LEVEL_RINGS = 0x03
} RingBlockType_t;


typedef enum RingType      // Different type of Rings
{
    COMMON   = 0x00,
    INSTANCE = 0x01,
    ALLRING  = 0x02
} RingType_t;



typedef enum RingVariant   // Base variables
{
    BASE     = 0x00,
    CC       = 0x01,
    RL       = 0x02,
    OVERRIDE = 0x03,
    OVERLAY  = 0x04,
    NUM_RING_VARIANTS = 0x05
} RingVariant_t;


//
// PPE types
//
typedef enum PpeType
{
    SBE           = 0x00,     // Ppe type partition in Ringsection
    CME           = 0x01,
    SGPE          = 0x02,
    NUM_PPE_TYPES = 0x03
} PpeType_t;



typedef enum RingSectionId
{
    SECTION_RING    = 0x00,    //.ring section ID
    SECTION_OVRD    = 0x01,    //.Override section ID
    SECTION_OVRL    = 0x02     //.Overlay section ID
} RingSectionId_t;

typedef enum SbeTorId
{
    PERV_CPLT = 0,
    N0_CPLT =   1,
    N1_CPLT =   2,
    N2_CPLT =   3,
    N3_CPLT =   4,
    XB_CPLT =   5,
    MC_CPLT =   6,
    OB_CPLT =   7,
    PCI0_CPLT = 8,
    PCI1_CPLT = 9,
    PCI2_CPLT = 10,
    EQ_CPLT   = 11,
    EC_CPLT   = 12,
    SBEALL  =   13
} SbeTorId_t;
typedef enum CmeTorId
{
    CME0_CPLT    = 0,
    CME1_CPLT    = 1,
    CME2_CPLT    = 2,
    CME3_CPLT    = 3,
    CME4_CPLT    = 4,
    CME5_CPLT    = 5,
    CME6_CPLT    = 6,
    CME7_CPLT    = 7,
    CME8_CPLT    = 8,
    CME9_CPLT    = 9,
    CME10_CPLT   = 10,
    CME11_CPLT   = 11,
    CMEALL       = 12
} CmeTorId_t;
///
/// ****************************************************************************
/// Function declares.
/// ****************************************************************************
///


int get_ring_from_sbe_image ( void*
                              i_ringSectionPtr, // Image pointer
                              uint64_t        i_magic,          // Image Magic Number
                              RingID          i_ringId,         // Unique ring ID
                              uint16_t        i_ddLevel,        // DD level details
                              RingType_t&     io_RingType,      // 0: Common 1: Instance
                              RingVariant_t   i_RingVariant,    // Base, cache contained, Risk level,
                              // Override and Overlay
                              uint8_t&        io_instanceId,    // required Instance
                              RingBlockType_t RingBlockType,    // 0: single ring,  1: ddLevel block
                              void**          io_ringBlockPtr,  // RS4 Container data or block data
                              uint32_t&       io_ringBlockSize, // size of data copied into ring block pointer
                              char*           o_ringName,       // Name of ring
                              uint32_t        dbgl);            // Debug option

int get_ring_from_sgpe_image ( void*
                               i_ringSectionPtr, // Image pointer
                               RingID          i_ringId,         // Unique ring ID
                               uint16_t        i_ddLevel,        // DD level details
                               RingType_t&      io_RingType,       // 0: Common 1: Instance
                               RingVariant_t   i_RingVariant,    // Base, cache contained, Risk level,
                               // Override and Overlay
                               uint8_t&         io_instanceId,    // required Instance
                               RingBlockType_t RingBlockType,    // 0: single ring,  1: ddLevel block
                               void**          io_ringBlockPtr,   // RS4 Container data or block data
                               uint32_t&       io_ringBlockSize, // size of data copied into ring block pointer
                               char*           o_ringName,       // Name of ring
                               uint32_t        dbgl);            // Debug option

int get_ring_from_cme_image ( void*           i_ringSectionPtr, // Image pointer
                              RingID          i_ringId,         // Unique ring ID
                              uint16_t        i_ddLevel,        // DD level details
                              RingType_t&      io_RingType,       // 0: Common 1: Instance
                              RingVariant_t   i_RingVariant,    // Base, cache contained, Risk level,
                              // Override and Overlay
                              uint8_t&        io_instanceId,    // required Instance
                              RingBlockType_t RingBlockType,    // 0: single ring,  1: ddLevel block
                              void**          io_ringBlockPtr,   // RS4 Container data or block data
                              uint32_t&       io_ringBlockSize, // size of data copied into ring block pointer
                              char*           o_ringName,       // Name of ring
                              uint32_t        dbgl);            // Debug option

int tor_get_ring(  void*
                   i_ringSectionPtr, // Ring address Ptr any of .rings, .overrides and .overlays.
                   uint64_t        i_magic,             // Image Magic Number
                   RingID          i_ringId,         // Unique ring ID
                   uint16_t        i_ddLevel,        // DD level info
                   PpeType_t       i_PpeType,        // PPE type : SBE, CME, etc
                   RingType_t&      io_RingType,       // 0: Common 1: Instance
                   RingVariant_t   i_RingVariant,    // Base, Cache etc
                   uint8_t&        io_instanceId,     // chiplet instance ID
                   RingBlockType_t i_RingBlockType,  // 0: single ring,  1: ring block
                   void**          io_ringBlockPtr,  // Addr of ring buffer
                   uint32_t&       io_ringBlockSize, // size of ring data
                   char*           o_ringName        // Ring name
                );

int tor_get_single_ring ( void*
                          i_ringSectionPt,     // Ring address Ptr any of .rings, .overrides and .overlays.
                          uint16_t      i_ddLevel,           // DD level info
                          RingID        i_ringId,            // Unique ring ID
                          PpeType_t     i_PpeType,           // ppe Type
                          RingVariant_t
                          i_RingVariant,       // Base, cache contained, Risk level, Override and Overlay
                          uint8_t       i_instanceId,        // Chiplet Instance ID
                          void**        io_ringBlockPtr,     // Addr of ring buffer
                          uint32_t&     io_ringBlockSize );  // size of ring data


int tor_get_block_of_rings ( void*
                             i_ringSectionPt,  // Ring address Ptr any of .rings, .overrides and .overlays.
                             uint16_t      i_ddLevel,        // DD level
                             PpeType_t     i_PpeType,        // ppe Type
                             RingType_t    i_RingType,       // Common Or Instance
                             RingVariant_t i_RingVariant,    // base,cache,etc
                             uint8_t       i_instanceId,     // Chiplet Instance ID
                             void**        io_ringBlockPtr,  // Addr of ring buffer
                             uint32_t&     io_ringBlockSize  // size of ring data
                           );
};

#endif //_P9_TOR_H_
OpenPOWER on IntegriCloud