summaryrefslogtreecommitdiff
path: root/drivers/net/npe/include/IxNpeDlNpeMgr_p.h
blob: b7fb0f02172bcddff32d60452488d689a46122f1 (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
/**
 * @file IxNpeDlNpeMgr_p.h
 *
 * @author Intel Corporation
 * @date 14 December 2001
 * @brief This file contains the private API for the NpeMgr module.
 *
 * 
 * @par
 * IXP400 SW Release version 2.0
 * 
 * -- Copyright Notice --
 * 
 * @par
 * Copyright 2001-2005, Intel Corporation.
 * All rights reserved.
 * 
 * @par
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. Neither the name of the Intel Corporation nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 * 
 * @par
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 * 
 * @par
 * -- End of Copyright Notice --
*/


/**
 * @defgroup IxNpeDlNpeMgr_p IxNpeDlNpeMgr_p
 *
 * @brief The private API for the IxNpeDl NpeMgr module
 * 
 * @{
 */

#ifndef IXNPEDLNPEMGR_P_H
#define IXNPEDLNPEMGR_P_H


/*
 * Put the user defined include files required.
 */
#include "IxNpeDl.h"
#include "IxOsalTypes.h"


/*
 * Function Prototypes
 */


/**
 * @fn void ixNpeDlNpeMgrInit (void)
 * 
 * @brief Initialises the NpeMgr module
 *
 * @param none
 * 
 * This function initialises the NpeMgr module.
 * It should be called before any other function in this module is called.
 * It only needs to be called once, but can be called multiple times safely.
 * The code will ASSERT on failure.
 * 
 * @pre
 *     - It must be called before any other function in this module
 *
 * @post
 *     - NPE Configuration Register memory space will be mapped using
 *       IxOsal. This memory will not be unmapped by this module.
 *
 * @return none
 */ 
void
ixNpeDlNpeMgrInit (void);


/**
 * @fn IX_STATUS ixNpeMhNpeMgrUninit (void)
 *
 * @brief This function will uninitialise the IxNpeDlNpeMgr sub-component.
 *
 * This function will uninitialise the IxNpeDlNpeMgr sub-component.
 * It should only be called once, and only if the IxNpeDlNpeMgr sub-component
 * has already been initialised by calling @ref ixNpeDlNpeMgrInit().
 * No other IxNpeDlNpeMgr sub-component API functions should be called
 * until @ref ixNpeDlNpeMgrInit() is called again.
 * If possible, this function should be called before a soft reboot or unloading
 * a kernel module to perform any clean up operations required for IxNpeMh.
 *
 * @return
 *      - IX_SUCCESS if the operation was successful
 *      - IX_FAIL otherwise
 */

IX_STATUS ixNpeDlNpeMgrUninit (void);


/**
 * @fn IX_STATUS ixNpeDlNpeMgrImageLoad (IxNpeDlNpeId npeId,
                                           UINT32 *imageCodePtr,
                                           BOOL verify)
 * 
 * @brief Loads a image of microcode onto an NPE
 *
 * @param IxNpeDlNpeId [in] npeId     - Id of target NPE
 * @param UINT32* [in] imageCodePtr - pointer to image code in image to be
 *                                      downloaded
 * @param BOOL [in] verify            - if TRUE, verify each word written to
 *                                      NPE memory.
 * 
 * This function loads a image containing blocks of microcode onto a
 * particular NPE. If the <i>verify</i> option is ON, NpeDl will read back each
 * word written and verify that it was written successfully
 * 
 * @pre
 *     - The NPE should be stopped beforehand
 *
 * @post
 *     - The NPE Instruction Pipeline may be flushed clean
 *
 * @return
 *     - IX_SUCCESS if the download was successful
 *     - IX_FAIL if the download failed
 *     - IX_NPEDL_CRITICAL_NPE_ERR if the download failed due to timeout error 
 *       where NPE is not responding
 */ 
IX_STATUS
ixNpeDlNpeMgrImageLoad (IxNpeDlNpeId npeId, UINT32 *imageCodePtr,
			  BOOL verify);


/**
 * @fn IX_STATUS ixNpeDlNpeMgrNpeReset (IxNpeDlNpeId npeId)
 * 
 * @brief sets a NPE to RESET state
 *
 * @param IxNpeDlNpeId [in] npeId - id of target NPE
 * 
 * This function performs a soft NPE reset by writing reset values to the
 * Configuration Bus Execution Control registers, the Execution Context Stack
 * registers, the Physical Register file, and the Context Store registers for 
 * each context number. It also clears inFIFO, outFIFO and Watchpoint FIFO.
 * It does not reset NPE Co-processors.
 * 
 * @pre
 *     - The NPE should be stopped beforehand
 *
 * @post
 *     - NPE NextProgram Counter (NextPC) will be set to a fixed initial value,
 *       such as 0.  This should be explicitly set by downloading State
 *       Information before starting NPE Execution.
 *     - The NPE Instruction Pipeline will be in a clean state.
 *
 * @return
 *     - IX_SUCCESS if the operation was successful
 *     - IX_FAIL if the operation failed
 *     - IX_NPEDL_CRITICAL_NPE_ERR if the operation failed due to NPE hang
 */ 
IX_STATUS
ixNpeDlNpeMgrNpeReset (IxNpeDlNpeId npeId);


/**
 * @fn IX_STATUS ixNpeDlNpeMgrNpeStart (IxNpeDlNpeId npeId)
 * 
 * @brief Starts NPE Execution
 *
 * @param IxNpeDlNpeId [in] npeId - Id of target NPE
 * 
 * Ensures only background Execution Stack Level is Active, clears instruction
 * pipeline, and starts Execution on a NPE by sending a Start NPE command to
 * the NPE. Checks the execution status of the NPE to verify that it is
 * running.
 * 
 * @pre
 *     - The NPE should be stopped beforehand.
 *     - Note that this function does not set the NPE Next Program Counter 
 *       (NextPC), so it should be set beforehand if required by downloading 
 *       appropriate State Information.
 *
 * @post
 *
 * @return
 *     - IX_SUCCESS if the operation was successful
 *     - IX_FAIL otherwise
 */ 
IX_STATUS
ixNpeDlNpeMgrNpeStart (IxNpeDlNpeId npeId);


/**
 * @fn IX_STATUS ixNpeDlNpeMgrNpeStop (IxNpeDlNpeId npeId)
 * 
 * @brief Halts NPE Execution
 *
 * @param IxNpeDlNpeId [in] npeId - id of target NPE
 * 
 * Stops execution on an NPE by sending a Stop NPE command to the NPE.
 * Checks the execution status of the NPE to verify that it has stopped.
 *
 * @pre
 *
 * @post
 *
 * @return 
 *     - IX_SUCCESS if the operation was successful
 *     - IX_FAIL otherwise
 */ 
IX_STATUS
ixNpeDlNpeMgrNpeStop (IxNpeDlNpeId npeId);


/**
 * @fn void ixNpeDlNpeMgrStatsShow (void)
 *
 * @brief This function will display statistics of the IxNpeDl NpeMgr module
 *
 * @return none
 */
void
ixNpeDlNpeMgrStatsShow (void);


/**
 * @fn void ixNpeDlNpeMgrStatsReset (void)
 *
 * @brief This function will reset the statistics of the IxNpeDl NpeMgr module
 *
 * @return none
 */
void
ixNpeDlNpeMgrStatsReset (void);


#endif /* IXNPEDLIMAGEMGR_P_H */

/**
 * @} defgroup IxNpeDlNpeMgr_p
 */