28
28
#include <map>
29
29
#include <vector>
30
30
#include <trace/interface.H>
31
- #include <sys/misc.h>
32
31
#include <errl/errlentry.H>
33
32
#include <errl/errlmanager.H>
34
- #include <errl/errludtarget.H>
35
33
#include <targeting/attrsync.H>
36
34
#include <targeting/namedtarget.H>
37
35
#include <targeting/common/utilFilter.H>
54
52
#include <fapi2/plat_hwp_invoker.H>
55
53
#include <fapi2/target.H>
56
54
57
- #include <p9_cpu_special_wakeup.H>
58
55
#include <p9_query_core_access_state.H>
59
56
#include <p9_query_cache_access_state.H>
60
57
#include <p9_hcd_core_stopclocks.H>
61
58
#include <p9_hcd_cache_stopclocks.H>
59
+ #include <p9_pm_ocb_init.H>
60
+ #include <p9_pm_ocb_indir_setup_linear.H>
61
+ #include <p9_pm_ocb_indir_access.H>
62
62
#include <p9_hcd_common.H>
63
63
#include <p9_quad_power_off.H>
64
64
@@ -72,22 +72,17 @@ namespace ISTEP_06
72
72
73
73
#ifdef CONFIG_PRINT_SYSTEM_INFO
74
74
75
- //Loop through list of targets and print out HUID and other key attributes if
76
- //the target has it
75
+ //Loop through list of targets and print out HUID and other key attributes if the target has it
77
76
void print_target_list (TARGETING ::TargetHandleList i_targetList )
78
77
{
79
78
80
- for (auto & l_targ : i_targetList )
81
- {
82
- char * l_targetString =
83
- l_targ -> getAttr < TARGETING ::ATTR_PHYS_PATH > ().toString ();
84
79
85
- TRACFCOMP ( ISTEPS_TRACE ::g_trac_isteps_trace , "%s" , l_targetString );
86
80
87
- free (l_targetString );
81
+ for (auto & l_targ : i_targetList )
82
+ {
83
+ TRACFCOMP ( ISTEPS_TRACE ::g_trac_isteps_trace , "%s" , l_targ -> getAttr < TARGETING ::ATTR_PHYS_PATH > ().toString ());
88
84
89
- //Every target has a HUID so it is safe to assume this will return okay
90
- //from getAttr
85
+ //Every target has a HUID so it is safe to assume this will return okay from getAttr
91
86
uint32_t l_huid = get_huid (l_targ );
92
87
93
88
//if output says DEAD then the attribute is not defined
@@ -97,8 +92,8 @@ void print_target_list(TARGETING::TargetHandleList i_targetList)
97
92
uint32_t l_fapi_pos = 0xDEAD ;
98
93
uint32_t l_chip_unit = 0xDEAD ;
99
94
100
- //The rest of these attributes may or may not exist on the target, so
101
- //only add them to the string if the attribute exists
95
+ //The rest of these attributes may or may not exist on the target, so only add them to the
96
+ //string if the attribute exists
102
97
TARGETING ::AttributeTraits < TARGETING ::ATTR_HWAS_STATE > ::Type hwasState ;
103
98
if (l_targ -> tryGetAttr < TARGETING ::ATTR_HWAS_STATE > (hwasState ))
104
99
{
@@ -169,76 +164,23 @@ void print_system_info(void)
169
164
}
170
165
#endif
171
166
172
- /**
173
- * @brief Walk through the cores and ensure special wakeup is disabled
174
- * from all srcs.
175
- *
176
- * @param[in/out] ISTEP_ERROR::IStepError
177
- * Pass in the istep error so we can add errors to it
178
- *
179
- * @return bool
180
- * True if no errors were found
181
- * False if at least 1 error was found
182
- */
183
- bool deassertSpecialWakeupOnCores (ISTEP_ERROR ::IStepError & io_istepError )
184
- {
185
- errlHndl_t l_err = nullptr ;
186
- bool l_success = true;
187
- // First disable special wakeup of all types for all cores
188
- TARGETING ::TargetHandleList l_coreTargetList ;
189
- TARGETING ::getAllChiplets (l_coreTargetList , TARGETING ::TYPE_CORE , true);
190
-
191
- for (const auto & l_core : l_coreTargetList )
192
- {
193
- for (uint8_t l_src = 0 ; l_src < p9specialWakeup ::SPW_ALL ; l_src ++ )
194
- {
195
- FAPI_INVOKE_HWP (l_err , p9_cpu_special_wakeup_core , l_core ,
196
- p9specialWakeup ::SPCWKUP_DISABLE ,
197
- p9specialWakeup ::PROC_SPCWKUP_ENTITY (l_src ));
198
- if ( l_err )
199
- {
200
- TRACFCOMP (ISTEPS_TRACE ::g_trac_isteps_trace ,
201
- "ERROR : returned from p9_cpu_special_wakeup_core for core 0x%x for src 0x%x" , TARGETING ::get_huid (l_core ), l_src );
202
- l_success = false;
203
- break ;
204
- }
205
- else
206
- {
207
- TRACFCOMP (ISTEPS_TRACE ::g_trac_isteps_trace ,
208
- "disabled special wakeup for core 0x%x for src 0x%x" , TARGETING ::get_huid (l_core ), l_src );
209
- }
210
- }
211
- if (l_err )
212
- {
213
- // capture the target data in the elog
214
- ERRORLOG ::ErrlUserDetailsTarget (l_core ).addToLog ( l_err );
215
- // add the err to the istep error
216
- io_istepError .addErrorDetails (l_err );
217
- //commit the error log (this will delete the err)
218
- errlCommit (l_err , ISTEP_COMP_ID );
219
- }
220
- }
221
-
222
- return l_success ;
223
- }
224
-
225
- /**
226
- * @brief loop through slave quads, make sure clocks are stopped
227
- * (core and cache) and power them down
228
- *
229
- * @return errlHndl_t
230
- */
167
+ //loop through slave quads, make sure clocks are stopped (core and cache) and power them down
231
168
errlHndl_t powerDownSlaveQuads ()
232
169
{
233
170
TARGETING ::Target * l_sys_target = nullptr ;
234
171
TARGETING ::targetService ().getTopLevelTarget (l_sys_target );
235
- errlHndl_t l_err = nullptr ;
172
+ errlHndl_t l_err = NULL ;
173
+ const uint8_t SIZE_OF_RING_DATA_PER_EQ = 0x40 ;
174
+ const uint8_t NUM_ENTRIES_IN_RING_DATA = 0x8 ;
175
+ const uint32_t OCC_SRAM_RING_STASH_BAR = 0xFFF3FC00 ;
236
176
bool l_isMasterEq = false;
177
+ uint64_t l_ringData [8 ] = {0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 };
178
+ uint32_t l_ocb_buff_length_act = 0 ;
179
+ uint8_t l_quad_pos ;
180
+ uint32_t l_ringStashAddr ;
237
181
TARGETING ::TargetHandleList l_eqTargetList ;
238
182
getAllChiplets (l_eqTargetList , TARGETING ::TYPE_EQ , true);
239
- uint64_t EX_0_CME_SCOM_SICR_SCOM1 = 0x1001203E ;
240
- uint64_t CME_SCOM_SICR_PM_EXIT_C0_MASK = 0x0800000000000000 ;
241
- size_t MASK_SIZE = sizeof (CME_SCOM_SICR_PM_EXIT_C0_MASK );
183
+
242
184
243
185
//Need to know who master is so we can skip them
244
186
uint8_t l_masterCoreId = TARGETING ::getMasterCore ()-> getAttr < TARGETING ::ATTR_CHIP_UNIT > ( );
@@ -248,6 +190,8 @@ errlHndl_t powerDownSlaveQuads()
248
190
{
249
191
l_isMasterEq = false;
250
192
fapi2 ::Target < fapi2 ::TARGET_TYPE_EQ > l_fapi_eq_target (l_eq_target );
193
+ fapi2 ::Target < fapi2 ::TARGET_TYPE_PROC_CHIP > l_chip =
194
+ l_fapi_eq_target .getParent < fapi2 ::TARGET_TYPE_PROC_CHIP > ();
251
195
TARGETING ::TargetHandleList l_coreTargetList ;
252
196
TARGETING ::getChildChiplets ( l_coreTargetList ,
253
197
l_eq_target ,
@@ -266,23 +210,6 @@ errlHndl_t powerDownSlaveQuads()
266
210
//If this is the master quad, we have already power cycled so we dont need this
267
211
if (l_isMasterEq )
268
212
{
269
- //TODO RTC:171340 Need to clear PM_EXIT bit in EX_0_CME_SCOM_SICR_SCOM1 reg for MPIPL
270
- //deassert pm exit flag on master core (both ex targs to be safe)
271
- TARGETING ::TargetHandleList l_exChildren ;
272
- TARGETING ::getChildChiplets ( l_exChildren ,
273
- l_eq_target ,
274
- TARGETING ::TYPE_EX ,
275
- true);
276
-
277
- for (const auto & l_ex_child : l_exChildren )
278
- {
279
- // Clear bit 4 of CME_SCOM_SICR which sets PM_EXIT
280
- l_err = deviceWrite (l_ex_child ,
281
- & CME_SCOM_SICR_PM_EXIT_C0_MASK ,
282
- MASK_SIZE ,
283
- DEVICE_SCOM_ADDRESS (EX_0_CME_SCOM_SICR_SCOM1 )); //0x1001203E
284
- }
285
- //continue to next EQ
286
213
TRACFCOMP (ISTEPS_TRACE ::g_trac_isteps_trace ,
287
214
"Found master, jumping to next EQ" );
288
215
continue ;
@@ -389,14 +316,41 @@ errlHndl_t powerDownSlaveQuads()
389
316
//Power down slave quad
390
317
FAPI_INVOKE_HWP (l_err ,
391
318
p9_quad_power_off ,
392
- l_fapi_eq_target );
319
+ l_fapi_eq_target ,
320
+ l_ringData );
393
321
if (l_err )
394
322
{
395
323
TRACFCOMP (ISTEPS_TRACE ::g_trac_isteps_trace ,
396
324
"Error powering off EQ %d" , l_eq_target -> getAttr < TARGETING ::ATTR_CHIP_UNIT > ());
397
325
//Break from do-while
398
326
break ;
399
327
}
328
+
329
+ FAPI_ATTR_GET (fapi2 ::ATTR_CHIP_UNIT_POS , l_fapi_eq_target , l_quad_pos );
330
+
331
+ l_ringStashAddr = OCC_SRAM_RING_STASH_BAR + (SIZE_OF_RING_DATA_PER_EQ * l_quad_pos );
332
+
333
+ // Setup use OCB channel 0 for placing ring data in SRAM
334
+ FAPI_INVOKE_HWP (l_err , p9_pm_ocb_indir_setup_linear , l_chip ,
335
+ p9ocb ::OCB_CHAN0 ,
336
+ p9ocb ::OCB_TYPE_LINSTR ,
337
+ l_ringStashAddr ); // Bar
338
+
339
+ FAPI_INVOKE_HWP (l_err , p9_pm_ocb_indir_access ,
340
+ l_chip ,
341
+ p9ocb ::OCB_CHAN0 ,
342
+ p9ocb ::OCB_PUT ,
343
+ NUM_ENTRIES_IN_RING_DATA ,
344
+ true,
345
+ l_ringStashAddr ,
346
+ l_ocb_buff_length_act ,
347
+ l_ringData );
348
+
349
+ for (int x = 0 ; x < NUM_ENTRIES_IN_RING_DATA ; x ++ )
350
+ {
351
+ FAPI_DBG ("Wrote %lx to OCC SRAM addr: 0x%lx" , l_ringData [x ], l_ringStashAddr + (x * 8 ));
352
+ }
353
+
400
354
}while (0 );
401
355
402
356
if (l_err )
@@ -416,11 +370,11 @@ void* host_discover_targets( void *io_pArgs )
416
370
TRACDCOMP ( ISTEPS_TRACE ::g_trac_isteps_trace ,
417
371
"host_discover_targets entry" );
418
372
419
- errlHndl_t l_err = nullptr ;
373
+ errlHndl_t l_err = NULL ;
420
374
ISTEP_ERROR ::IStepError l_stepError ;
421
375
422
376
// Check whether we're in MPIPL mode
423
- TARGETING ::Target * l_pTopLevel = nullptr ;
377
+ TARGETING ::Target * l_pTopLevel = NULL ;
424
378
TARGETING ::targetService ().getTopLevelTarget ( l_pTopLevel );
425
379
assert (l_pTopLevel , "host_discover_targets: no TopLevelTarget" );
426
380
@@ -431,12 +385,9 @@ void* host_discover_targets( void *io_pArgs )
431
385
"information has already been loaded from memory"
432
386
"when the targeting service started" );
433
387
434
- //Make sure that all special wakeups are disabled
435
- if (deassertSpecialWakeupOnCores (l_stepError ))
436
- {
437
- //Need to power down the slave quads
438
- l_err = powerDownSlaveQuads ();
439
- }
388
+ //Need to power down the slave quads
389
+ l_err = powerDownSlaveQuads ();
390
+
440
391
}
441
392
else
442
393
{
@@ -450,7 +401,7 @@ void* host_discover_targets( void *io_pArgs )
450
401
// Now that all targets have completed presence detect and vpd access,
451
402
// invalidate PNOR::CENTAUR_VPD sections where all the targets sharing a
452
403
// VPD_REC_NUM are invalid.
453
- if (nullptr == l_err ) //discoverTargets worked
404
+ if (NULL == l_err ) //discoverTargets worked
454
405
{
455
406
l_err = VPD ::validateSharedPnorCache ();
456
407
}
0 commit comments