summaryrefslogtreecommitdiffstats
path: root/src/usr/hwpf/hwp/build_winkle_images/p8_slw_build/p8_pore_api.h
blob: 0656f0a1c727c93bed8a9326e0179b279ca0426c (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
/*  IBM_PROLOG_BEGIN_TAG
 *  This is an automatically generated prolog.
 *
 *  $Source: src/usr/hwpf/hwp/build_winkle_images/proc_slw_build/p8_pore_api.h $
 *
 *  IBM CONFIDENTIAL
 *
 *  COPYRIGHT International Business Machines Corp. 2012
 *
 *  p1
 *
 *  Object Code Only (OCO) source materials
 *  Licensed Internal Code Source Materials
 *  IBM HostBoot Licensed Internal Code
 *
 *  The source code for this program is not published or other-
 *  wise divested of its trade secrets, irrespective of what has
 *  been deposited with the U.S. Copyright Office.
 *
 *  Origin: 30
 *
 *  IBM_PROLOG_END_TAG
 */
/* $Id: p8_pore_api.h,v 1.2 2012/04/11 16:58:29 cmolsen Exp $ */
/* $Source: /afs/awd/projects/eclipz/KnowledgeBase/.cvsroot/eclipz/chips/p8/working/procedures/utils/p8_pore_api.h,v $ */
/*------------------------------------------------------------------------------*/
/* *! (C) Copyright International Business Machines Corp. 2010                  */
/* *! All Rights Reserved -- Property of IBM                                    */
/* *! *** IBM Confidential ***                                                  */
/*------------------------------------------------------------------------------*/
/* *! TITLE p8_pore_api                                                        */
/* *! DESCRIPTION : PORE APIs                                                   */
/* *! OWNER NAME :  Nicole Schwartz  Email: nschwart@us.ibm.com                 */
/* *! BACKUP NAME :                                                             */
/* *! ADDITIONAL COMMENTS :                                                     */

/*------------------------------------------------------------------------------*/
/* Don't forget to create CVS comments when you check in your changes!          */
/*------------------------------------------------------------------------------*/

#ifndef _P8P_PORE_API_H
#define _P8P_PORE_API_H

/**
 * Contains all external APIs used by firmware to generate/modify the P7+
 *  PORE image.
 */


#include "p8_pore_api_custom.h"
/*#include <p7p_pore_image.h>*/
#include "p8_pore_api_const.h"

typedef struct {
  char ringName[50];
  uint32_t ringAddress;
  uint32_t clockControlData;
  uint32_t length;
} p8_pore_ringInfoStruct;


/**
 * Generate a set of PORE instructions that will initialize a scan ring.
 *
 * @param i_ringAddr    host    Address of scan ring
 * @param i_ringBitLen  host    Number of bits in the scan ring
 * @param i_ring        host    Pointer to initialized ring data, left-aligned binary
 * @param i_flush       host    Pointer to ring data for flush state, left-aligned binary
 * @param i_maxStreamLenInWords  host    Max space available for resulting PORE image in 32-bit words
 * @param o_streamLenInWords  host    Actual size of PORE image in 32-bit words
 * @param o_streamOutput  BigEndian    Pointer to allocated local memory to write PORE image into, this is
 *    the location to write the ring data into
 *
 * @return uint32_t  Error return codes
 *     P8_PORE_SUCCESS_RC       : No errors
 *     P8_PORE_IMAGE_TOO_BIG_RC : size of PORE image exceeded allowed space
 *     P8_PORE_XXX_RC           : other errors...
 */
uint32_t p8_pore_gen_scan( uint32_t i_ringAddr,
			    uint32_t i_ringBitLen,
			    uint32_t* i_ring,
			    uint32_t* i_flush,
			    uint32_t i_maxStreamLenInWords,
			    uint32_t* o_streamLenInWords,
			    uint32_t* o_streamOutput );

/**
 * Generate or update a set of PORE instructions that will initialize a scom register.
 *
 * @param i_scomAddr    host    Address of scom register
 * @param i_scomData    host    Two 32-bit words of scom register data
 * @param i_operation   host    Should data be appended or existing data updated
 *     P8_PORE_SCOM_APPEND  : add scom instructions to the end of the existing image
 *     P8_PORE_SCOM_OR      : overlay scom data onto existing instruction by bitwise OR
 *     P8_PORE_SCOM_AND     : overlay scom data onto existing instruction by bitwise AND
 *     P8_PORE_SCOM_REPLACE : replace existing instructions with new data
 *     P8_PORE_SCOM_NOOP    : replace existing instructions with NOOP, i_scomData is junk
 * @param i_maxStreamLenInWords  host    Max space available for resulting PORE image in 32-bit words
 * @param o_streamOutput  BigEndian    Pointer to allocated local memory to write PORE image into
 *
 * @return uint32_t  Error return codes
 *     P8_PORE_SUCCESS_RC       : No errors
 *     P8_PORE_IMAGE_TOO_BIG_RC : size of PORE image exceeded allowed space
 *     P8_PORE_BAD_ARG_RC       : some input argument is nonsensical
 *     P8_PORE_ADDR_NOT_FOUND   : could not find existing scom for overlay (AND/OR) operation
 *     P8_PORE_XXX_RC           : other errors...
 */
uint32_t p8_pore_gen_scom( uint32_t i_scomAddr,
			    uint32_t i_scomData[2],
			    uint32_t i_operation,
			    uint32_t i_maxStreamLenInWords,
			    uint32_t* o_streamOutput );

/**
 * Generate or update a set of PORE instructions that will initialize an
 *  architected register in the processor, ie. SPR or GPR.  It is assumed that
 *  all updates will replace any existing data for that register.  If the data
 *  does not already exist then it will be appended.
 *
 * @param i_regName     host    Constant that determines which SPR to write (see p8_pore_const.h)
 * @param i_regData     host    Two 32-bit words of register data
 * @param i_coreIndex   host    Core to operate on
 * @param i_threadIndex   host    Thread to operate on, used for HSPRG0 and LPCR
 * @param i_maxStreamLenInWords  host    Max space available for resulting PORE image in 32-bit words
 * @param o_streamOutput  BigEndian    Pointer to allocated local memory to write PORE image into
 *
 * @return uint32_t  Error return codes
 *     P8_PORE_SUCCESS_RC       : No errors
 *     P8_PORE_IMAGE_TOO_BIG_RC : size of PORE image exceeded allowed space
 *     P8_PORE_XXX_RC           : other errors...
 */
uint32_t p8_pore_gen_cpureg( uint32_t i_regName,
			      uint32_t i_regData[2],
			      uint32_t i_coreIndex,
			      uint32_t i_threadIndex,
			      uint32_t i_maxStreamLenInWords,
			      uint32_t* o_streamOutput );

/**
 * Generate a set of PORE instructions that will perform a branch operation
 *  to a relative address offset
 *
 * @param i_offset      host    Relative offset to branch to
 * @param i_maxStreamLenInWords  host    Max space available for resulting PORE instruction(s) in 32-bit words
 * @param i_branchType  host    Set to 0 for relative branch (BRA), set to 1 for branch to subroutine (BSR)
 * @param o_streamLenInWords  host    Actual size of PORE instruction(s) in 32-bit words
 * @param o_streamOutput  BigEndian    Pointer to allocated local memory to write PORE image into
 *
 * @return uint32_t  Error return codes
 *     P8_PORE_SUCCESS_RC       : No errors
 *     P8_PORE_IMAGE_TOO_BIG_RC : size of PORE image exceeded allowed space
 *     P8_PORE_XXX_RC           : other errors...
 */
uint32_t p8_pore_gen_relbranch( uint32_t i_offset,
				 uint32_t i_maxStreamLenInWords,
				 uint32_t i_branchType,
				 uint32_t* o_streamLenInWords,
				 uint32_t* o_streamOutput );

/**
 * Generate a set of PORE instructions that will perform a branch operation
 *  to an absolute address.
 *
 * @param i_address  host    Absolute address to branch to
 * @param i_maxStreamLenInWords  host    Max space available for resulting PORE instruction(s) in 32-bit words
 * @param o_streamLenInWords  host    Actual size of PORE instruction(s) in 32-bit words
 * @param o_streamOutput  host    Pointer to allocated local memory to write PORE image into
 *
 * @return uint32_t  Error return codes
 *     P8_PORE_SUCCESS_RC       : No errors
 *     P8_PORE_IMAGE_TOO_BIG_RC : size of PORE image exceeded allowed space
 *     P8_PORE_XXX_RC           : other errors...
 */
uint32_t p8_pore_gen_absbranch( uint32_t i_address,
				 uint32_t i_maxStreamLenInWords,
				 uint32_t* o_streamLenInWords,
				 uint32_t* o_streamOutput );

/**
 * Generate a set of PORE instructions that are invalid and will cause an
 *  error.  It is used to populate a region of memory that the PORE shouldn't
 *  execute.
 *
 * @param i_maxStreamLenInWords  host    Max space available for resulting PORE instruction(s) in 32-bit words
 * @param o_streamOutput  BigEndian    Pointer to allocated local memory to write PORE image into
 *
 * @return uint32_t  Error return codes
 *     P8_PORE_SUCCESS_RC       : No errors
 *     P8_PORE_IMAGE_TOO_BIG_RC : size of PORE image exceeded allowed space
 *     P8_PORE_XXX_RC           : other errors...
 */
uint32_t p8_pore_fill_invalid( uint32_t i_maxStreamLenInWords,
				uint32_t* o_streamOutput );

/**
 * Generate a set of PORE instructions that are return statements.  It is used
 *  to populate a region of memory that the PORE should return from.
 *
 * @param i_maxStreamLenInWords  host    Max space available for resulting PORE instruction(s) in 32-bit words
 * @param o_streamOutput  BigEndian    Pointer to allocated local memory to write PORE image into
 *
 * @return uint32_t  Error return codes
 *     P8_PORE_SUCCESS_RC       : No errors
 *     P8_PORE_IMAGE_TOO_BIG_RC : size of PORE image exceeded allowed space
 *     P8_PORE_XXX_RC           : other errors...
 */
uint32_t p8_pore_fill_return( uint32_t i_maxStreamLenInWords,
			       uint32_t* o_streamOutput );

/**
 * Generate a WAIT PORE instruction.
 *
 * @param i_wait  host    Number of pcb_nclk cycles to wait
 * @param i_maxStreamLenInWords  host    Max space available for resulting PORE instruction(s) in 32-bit words
 * @param o_streamLenInWords  host    Actual size of PORE instruction(s) in 32-bit words
 * @param o_streamOutput  BigEndian    Pointer to allocated local memory to write PORE image into
 *
 * @return uint32_t  Error return codes
 *     P8_PORE_SUCCESS_RC       : No errors
 *     P8_PORE_IMAGE_TOO_BIG_RC : size of PORE image exceeded allowed space
 *     P8_PORE_XXX_RC           : other errors...
 */
uint32_t p8_pore_gen_wait( uint32_t i_wait,
			    uint32_t i_maxStreamLenInWords,
			    uint32_t* o_streamLenInWords,
			    uint32_t* o_streamOutput );


#endif /* _P8_PORE_H */

/*
*************** Do not edit this area ***************
This section is automatically updated by CVS when you check in this file.
Be sure to create CVS comments when you commit so that they can be included here.

$Log: p8_pore_api.h,v $
Revision 1.2  2012/04/11 16:58:29  cmolsen
Removed #define of __PORE_INLINE_ASSEMBLER_C__

Revision 1.1  2011/08/25 12:28:04  yjkim
initial checkin

Revision 1.8  2010/08/31 14:47:15  schwartz
Changed comments about scom operations to include SCOM in the name

Revision 1.7  2010/08/30 23:27:16  schwartz
Added TRACE statements to include specified number of arguments
Defined branch type constants
Added constant for last scom op used to check if operation input to gen_scan is valid
Added mult spr error constant
Added p7p_pore_gen_wait API
Changed additional C++ style comments to C style
Initialized all variables to 0
Removed FTRACE statements
Added additional information to trace statements
Updated gen_scom to use the defined operation constants
Updated branch gen_relbranch to use defined branch type constants
Added rc check for calls to p7p_pore_gen_cpureg_status and p7p_pore_span_128byte_boundary subroutines

Revision 1.6  2010/08/26 03:57:02  schwartz
Changed comments to C-style
Changed "" to <> for #includes
Moved RINGINFO struct and RINGINDEX constant into separate object file, includes created static_data.h file
Put p7p_pore in front of #defines
Removed ring length from ringInfoStruct
Renamed scom operators to have SCOM in the name
Fixed gen_scan to use SCANRD and SCANWR pore instructions
Fixed compiler warnings

Revision 1.5  2010/07/01 21:42:11  schwartz
Included format (host or big endian) in parameter definitions

Revision 1.4  2010/06/23 23:09:05  schwartz
Updated ordering of include statements so p7p_pore_api_custom.h is first
Updated definition of gen_cpureg to include coreIndex and threadIndex

Revision 1.3  2010/05/24 02:32:07  schwartz
Fixed errors that appear when using -Werrors flag
Added in cvs logging (hopefully)


*/

OpenPOWER on IntegriCloud