Skip to content

Commit ae07790

Browse files
committed
Update quad power off so HB can call it on Slave Quads
Previously this HWP was only being called by the SBE down the MPIPL but we also need to call it during HB to power down the slave quads. There is a tricky workaround in this HWP where we need to save off some ring data EQ pointers for the PB. On the SBE we just saved the rings in global variables but we cannot do that in HB because the Hcode would not have access to the global varibles. Instead we will write the ring data to the OCC SRAM to do this I will just pass the data out of the hwp via an out param The same ring data is fetch during cache_initf procedure to init Change-Id: I4f20cd8dd9ca1b53604db1bc3020c0d57bbd1172 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/36828 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: PPE CI <ppe-ci+hostboot@us.ibm.com> Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com> Reviewed-by: Matt K. Light <mklight@us.ibm.com> Reviewed-by: RAJA DAS <rajadas2@in.ibm.com> Reviewed-by: YUE DU <daviddu@us.ibm.com> Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com> Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/37978 Reviewed-by: Hostboot Team <hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
1 parent 3f78eca commit ae07790

File tree

3 files changed

+77
-133
lines changed

3 files changed

+77
-133
lines changed

src/import/chips/p9/procedures/hwp/pm/p9_quad_power_off.C

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,11 @@
4949
#include <p9_quad_power_off.H>
5050
#include <p9_block_wakeup_intr.H>
5151

52+
5253
// ----------------------------------------------------------------------
5354
// Function definitions
5455
// ----------------------------------------------------------------------
5556

56-
57-
#ifdef __PPE__
58-
uint64_t G_ring_save[8] = {0, 0, 0, 0, 0, 0, 0, 0};
59-
6057
// {0, 0},
6158
// {5039, 0xE000000000000000}, //3
6259
// {5100, 0xC1E061FFED5F0000}, //29
@@ -67,40 +64,38 @@ uint64_t G_ring_save[8] = {0, 0, 0, 0, 0, 0, 0, 0};
6764
// {6282, 0xE000000000000000}, //3
6865
// {6343, 0xC1E061FFED5F0000}, //29
6966
// {17871, 0} //128
70-
const uint64_t G_ring_index[10] =
67+
68+
static const uint64_t RING_INDEX[10] =
7169
{
7270
0, 5039, 5100, 5664, 5725, 5973, 6034, 6282, 6343, 17871,
7371
};
74-
#endif
75-
7672

7773
// Procedure p9_quad_power_off entry point, comments in header
7874
fapi2::ReturnCode p9_quad_power_off(
79-
const fapi2::Target<fapi2::TARGET_TYPE_EQ>& i_target)
75+
const fapi2::Target<fapi2::TARGET_TYPE_EQ>& i_target,
76+
uint64_t* o_ring_save_data)
8077
{
8178
fapi2::buffer<uint64_t> l_data64;
8279
constexpr uint64_t l_rawData = 0x1100000000000000ULL; // Bit 3 & 7 are set to be manipulated
8380
constexpr uint32_t MAX_CORE_PER_QUAD = 4;
8481
fapi2::ReturnCode rc = fapi2::FAPI2_RC_SUCCESS;
8582
uint32_t l_cnt = 0;
86-
#ifdef __PPE__
87-
uint8_t l_isMpipl = 0;
88-
uint8_t l_isRingSaveMpipl = 0;
89-
const fapi2::Target<fapi2::TARGET_TYPE_SYSTEM> FAPI_SYSTEM;
9083
fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP> l_chip =
9184
i_target.getParent<fapi2::TARGET_TYPE_PROC_CHIP>();
9285

93-
FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_IS_MPIPL, FAPI_SYSTEM, l_isMpipl), "fapiGetAttribute of ATTR_IS_MPIPL failed!");
94-
FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_CHIP_EC_FEATURE_RING_SAVE_MPIPL, l_chip, l_isRingSaveMpipl),
95-
"fapiGetAttribute of ATTR_CHIP_EC_FEATURE_RING_SAVE_MPIPL failed");
96-
#endif
86+
uint8_t l_isMpipl = 0;
87+
uint8_t l_isRingSaveMpipl = 0;
88+
const fapi2::Target<fapi2::TARGET_TYPE_SYSTEM> FAPI_SYSTEM;
9789

9890
FAPI_INF("p9_quad_power_off: Entering...");
9991

10092
// Print chiplet position
10193
FAPI_INF("Quad power off chiplet no.%d", i_target.getChipletNumber());
10294

103-
#ifdef __PPE__
95+
FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_IS_MPIPL, FAPI_SYSTEM, l_isMpipl), "fapiGetAttribute of ATTR_IS_MPIPL failed!");
96+
FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_CHIP_EC_FEATURE_RING_SAVE_MPIPL, l_chip, l_isRingSaveMpipl),
97+
"fapiGetAttribute of ATTR_CHIP_EC_FEATURE_RING_SAVE_MPIPL failed");
98+
10499

105100
if (l_isMpipl && l_isRingSaveMpipl)
106101
{
@@ -123,7 +118,7 @@ fapi2::ReturnCode p9_quad_power_off(
123118
{
124119
uint64_t l_scandata = ((l_spin == 0) || (l_spin == 9)) ? 0x0 : (l_spin & 0x1) ?
125120
0xE000000000000000 : 0xC1E061FFED5F0000;
126-
l_data64.flush<0>().set((G_ring_index[l_spin] - G_ring_index[l_spin - 1]) << 32);
121+
l_data64.flush<0>().set((RING_INDEX[l_spin] - RING_INDEX[l_spin - 1]) << 32);
127122

128123
FAPI_TRY(fapi2::putScom(i_target,
129124
EQ_SCAN_LONG_ROTATE,
@@ -160,7 +155,7 @@ fapi2::ReturnCode p9_quad_power_off(
160155
FAPI_TRY(fapi2::getScom(i_target,
161156
EQ_SCAN64,
162157
l_data64));
163-
G_ring_save[l_spin - 1] = l_scandata & l_data64;
158+
o_ring_save_data[l_spin - 1] = l_scandata & l_data64;
164159
}
165160
}
166161

@@ -170,7 +165,6 @@ fapi2::ReturnCode p9_quad_power_off(
170165
l_data64));
171166
}
172167

173-
#endif
174168

175169
FAPI_DBG("Disabling bits 20/22/24/26 in EQ_QPPM_QPMMR_CLEAR, to gain access"
176170
" to PFET controller, otherwise Quad Power off scom will fail");

src/import/chips/p9/procedures/hwp/pm/p9_quad_power_off.H

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,10 @@
4848
// Constant definitions
4949
//------------------------------------------------------------------------------
5050

51-
#ifdef __PPE__
52-
extern uint64_t G_ring_save[8];
53-
extern const uint64_t G_ring_index[10];
54-
#endif
55-
5651
// function pointer typedef definition for HWP call support
5752
typedef fapi2::ReturnCode (*p9_quad_power_off_FP_t) (
58-
const fapi2::Target<fapi2::TARGET_TYPE_EQ>& i_target);
53+
const fapi2::Target<fapi2::TARGET_TYPE_EQ>& i_target,
54+
uint64_t* o_ring_save_data);
5955

6056
extern "C"
6157
{
@@ -66,12 +62,15 @@ extern "C"
6662
/**
6763
** @brief Power off the EQ including the functional cores associatated with it.
6864
**
69-
** @param[in] i_target Targe type EQ
65+
** @param[in] i_target Targe type EQ
66+
** @param[out] o_ring_save_data The ring data that tells the PB how to find the
67+
** EQ will need to be saved away for when we p-on
7068
**
7169
** @return FAPI2_RC_SUCCESS if success, error otherwise
7270
**/
7371
fapi2::ReturnCode p9_quad_power_off (
74-
const fapi2::Target<fapi2::TARGET_TYPE_EQ>& i_target);
72+
const fapi2::Target<fapi2::TARGET_TYPE_EQ>& i_target,
73+
uint64_t* o_ring_save_data);
7574

7675
} // extern "C"
7776

src/usr/isteps/istep06/host_discover_targets.C

Lines changed: 56 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,8 @@
2828
#include <map>
2929
#include <vector>
3030
#include <trace/interface.H>
31-
#include <sys/misc.h>
3231
#include <errl/errlentry.H>
3332
#include <errl/errlmanager.H>
34-
#include <errl/errludtarget.H>
3533
#include <targeting/attrsync.H>
3634
#include <targeting/namedtarget.H>
3735
#include <targeting/common/utilFilter.H>
@@ -54,11 +52,13 @@
5452
#include <fapi2/plat_hwp_invoker.H>
5553
#include <fapi2/target.H>
5654

57-
#include <p9_cpu_special_wakeup.H>
5855
#include <p9_query_core_access_state.H>
5956
#include <p9_query_cache_access_state.H>
6057
#include <p9_hcd_core_stopclocks.H>
6158
#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>
6262
#include <p9_hcd_common.H>
6363
#include <p9_quad_power_off.H>
6464

@@ -72,22 +72,17 @@ namespace ISTEP_06
7272

7373
#ifdef CONFIG_PRINT_SYSTEM_INFO
7474

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
7776
void print_target_list(TARGETING::TargetHandleList i_targetList)
7877
{
7978

80-
for(auto & l_targ : i_targetList)
81-
{
82-
char * l_targetString =
83-
l_targ->getAttr<TARGETING::ATTR_PHYS_PATH>().toString();
8479

85-
TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "%s", l_targetString);
8680

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());
8884

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
9186
uint32_t l_huid = get_huid(l_targ );
9287

9388
//if output says DEAD then the attribute is not defined
@@ -97,8 +92,8 @@ void print_target_list(TARGETING::TargetHandleList i_targetList)
9792
uint32_t l_fapi_pos = 0xDEAD;
9893
uint32_t l_chip_unit = 0xDEAD;
9994

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
10297
TARGETING::AttributeTraits<TARGETING::ATTR_HWAS_STATE>::Type hwasState;
10398
if(l_targ->tryGetAttr<TARGETING::ATTR_HWAS_STATE>(hwasState))
10499
{
@@ -169,76 +164,23 @@ void print_system_info(void)
169164
}
170165
#endif
171166

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
231168
errlHndl_t powerDownSlaveQuads()
232169
{
233170
TARGETING::Target* l_sys_target = nullptr;
234171
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;
236176
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;
237181
TARGETING::TargetHandleList l_eqTargetList;
238182
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+
242184

243185
//Need to know who master is so we can skip them
244186
uint8_t l_masterCoreId = TARGETING::getMasterCore()->getAttr<TARGETING::ATTR_CHIP_UNIT>();
@@ -248,6 +190,8 @@ errlHndl_t powerDownSlaveQuads()
248190
{
249191
l_isMasterEq = false;
250192
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>();
251195
TARGETING::TargetHandleList l_coreTargetList;
252196
TARGETING::getChildChiplets( l_coreTargetList,
253197
l_eq_target,
@@ -266,23 +210,6 @@ errlHndl_t powerDownSlaveQuads()
266210
//If this is the master quad, we have already power cycled so we dont need this
267211
if(l_isMasterEq)
268212
{
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
286213
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
287214
"Found master, jumping to next EQ");
288215
continue;
@@ -389,14 +316,41 @@ errlHndl_t powerDownSlaveQuads()
389316
//Power down slave quad
390317
FAPI_INVOKE_HWP(l_err,
391318
p9_quad_power_off,
392-
l_fapi_eq_target);
319+
l_fapi_eq_target,
320+
l_ringData);
393321
if(l_err)
394322
{
395323
TRACFCOMP(ISTEPS_TRACE::g_trac_isteps_trace,
396324
"Error powering off EQ %d", l_eq_target->getAttr<TARGETING::ATTR_CHIP_UNIT>());
397325
//Break from do-while
398326
break;
399327
}
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+
400354
}while(0);
401355

402356
if(l_err)
@@ -416,11 +370,11 @@ void* host_discover_targets( void *io_pArgs )
416370
TRACDCOMP( ISTEPS_TRACE::g_trac_isteps_trace,
417371
"host_discover_targets entry" );
418372

419-
errlHndl_t l_err = nullptr;
373+
errlHndl_t l_err = NULL;
420374
ISTEP_ERROR::IStepError l_stepError;
421375

422376
// Check whether we're in MPIPL mode
423-
TARGETING::Target* l_pTopLevel = nullptr;
377+
TARGETING::Target* l_pTopLevel = NULL;
424378
TARGETING::targetService().getTopLevelTarget( l_pTopLevel );
425379
assert(l_pTopLevel, "host_discover_targets: no TopLevelTarget");
426380

@@ -431,12 +385,9 @@ void* host_discover_targets( void *io_pArgs )
431385
"information has already been loaded from memory"
432386
"when the targeting service started");
433387

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+
440391
}
441392
else
442393
{
@@ -450,7 +401,7 @@ void* host_discover_targets( void *io_pArgs )
450401
// Now that all targets have completed presence detect and vpd access,
451402
// invalidate PNOR::CENTAUR_VPD sections where all the targets sharing a
452403
// VPD_REC_NUM are invalid.
453-
if (nullptr == l_err) //discoverTargets worked
404+
if (NULL == l_err) //discoverTargets worked
454405
{
455406
l_err = VPD::validateSharedPnorCache();
456407
}

0 commit comments

Comments
 (0)