30
30
31
31
// *HWP HWP Owner : David Du <[email protected] >
32
32
// *HWP Backup HWP Owner : Greg Still <[email protected] >
33
- // *HWP FW Owner : Sangeetha T S <sangeet2 @in.ibm.com>
33
+ // *HWP FW Owner : Amit Tendolkar <amit.tendolkar @in.ibm.com>
34
34
// *HWP Team : PM
35
35
// *HWP Consumed by : HB:PERV
36
- // *HWP Level : 2
36
+ // *HWP Level : 3
37
37
38
38
//------------------------------------------------------------------------------
39
39
// Includes
40
40
//------------------------------------------------------------------------------
41
-
42
41
#include <p9_misc_scom_addresses.H>
43
42
#include <p9_quad_scom_addresses.H>
44
43
#include <p9_hcd_common.H>
45
44
#include <p9_common_clk_ctrl_state.H>
46
- #include "p9_hcd_l2_stopclocks.H"
47
- #include "p9_hcd_cache_stopclocks.H"
45
+ #include <p9_hcd_l2_stopclocks.H>
46
+ #include <p9_hcd_cache_stopclocks.H>
47
+ #include <p9_quad_scom_addresses_fld.H>
48
48
49
49
//------------------------------------------------------------------------------
50
50
// Constant Definitions
51
51
//------------------------------------------------------------------------------
52
-
53
52
enum P9_HCD_CACHE_STOPCLOCKS_CONSTANTS
54
53
{
55
54
CACHE_CLK_STOP_POLLING_HW_NS_DELAY = 10000 ,
@@ -62,7 +61,7 @@ enum P9_HCD_CACHE_STOPCLOCKS_CONSTANTS
62
61
//------------------------------------------------------------------------------
63
62
// Procedure: Quad Clock Stop
64
63
//------------------------------------------------------------------------------
65
-
64
+ // See doxygen in header file
66
65
fapi2 ::ReturnCode
67
66
p9_hcd_cache_stopclocks (
68
67
const fapi2 ::Target < fapi2 ::TARGET_TYPE_EQ > & i_target ,
@@ -99,7 +98,7 @@ p9_hcd_cache_stopclocks(
99
98
// region including PBIEQ clock domain is being stopped, which
100
99
// incidentally should always be the case for MPIPL
101
100
l_data64 .flush < 0 > ( );
102
- l_data64 .setBit < 30 > ( );
101
+ l_data64 .setBit < EQ_QPPM_QCCR_PB_PURGE_REQ > ( );
103
102
// Set bit 30 in EQ_QPPM_QCCR_SCOM2(100F01BF) Reg, Pulse to the
104
103
// Powerbus logic in the Cache clock domain to request them to purge
105
104
// their async buffers in preparation to power off the Quad
@@ -113,9 +112,8 @@ p9_hcd_cache_stopclocks(
113
112
// Acknowledgement from Powerbus that the buffers are empty
114
113
// and can safely be fenced & clocked off.
115
114
FAPI_TRY (fapi2 ::getScom (i_target , EQ_QPPM_QCCR_SCOM , l_data64 ));
116
- bool l_poll_data = l_data64 .getBit < 31 > ( );
117
115
118
- if (l_poll_data == 1 )
116
+ if (l_data64 . getBit < EQ_QPPM_QCCR_PB_PURGE_DONE_LVL > ( ) )
119
117
{
120
118
break ;
121
119
}
@@ -131,18 +129,19 @@ p9_hcd_cache_stopclocks(
131
129
fapi2 ::QPPM_QCCR_PB_PURGE_DONE_LVL_TIMEOUT ()
132
130
.set_TARGET (i_target )
133
131
.set_EQPPMQCCR (l_data64 ),
134
- "QPPM_QCCR_PB_PURGE_DONE_LVL Reg bit 31 not set." );
132
+ "QPPM_QCCR_PB_PURGE_DONE_LVL Reg bit _QPPM_QCCR_PB_PURGE_DONE_LVL not set." );
135
133
134
+ // Clear purge request
136
135
l_data64 .flush < 0 > ( );
137
- l_data64 .setBit < 30 > ( );
136
+ l_data64 .setBit < EQ_QPPM_QCCR_PB_PURGE_REQ > ( );
138
137
FAPI_TRY (fapi2 ::putScom (i_target , EQ_QPPM_QCCR_SCOM1 , l_data64 ));
139
138
}
140
139
141
140
FAPI_TRY (FAPI_ATTR_GET (fapi2 ::ATTR_VDM_ENABLED , l_chip ,
142
141
l_attr_vdm_enabled ));
143
142
FAPI_TRY (FAPI_ATTR_GET (fapi2 ::ATTR_CHIP_UNIT_POS , l_perv ,
144
143
l_attr_chip_unit_pos ));
145
- // l_attr_chip_unit_pos = l_attr_chip_unit_pos - p9hcd::PERV_TO_QUAD_POS_OFFSET;
144
+ // l_attr_chip_unit_pos = l_attr_chip_unit_pos - p9hcd::PERV_TO_QUAD_POS_OFFSET;
146
145
l_attr_chip_unit_pos = l_attr_chip_unit_pos - 0x10 ;
147
146
148
147
if (i_select_regions & p9hcd ::CLK_REGION_EX0_L3 )
@@ -161,10 +160,9 @@ p9_hcd_cache_stopclocks(
161
160
FAPI_DBG ("Check PM_RESET_STATE_INDICATOR via GPMMR[15]" );
162
161
FAPI_TRY (getScom (i_target , EQ_PPM_GPMMR_SCOM , l_data64 ));
163
162
164
- if (!l_data64 .getBit < 15 > ( ))
163
+ if (!l_data64 .getBit < EQ_PPM_GPMMR_RESET_STATE_INDICATOR > ( ))
165
164
{
166
165
FAPI_DBG ("Gracefully turn off power management, if fail, continue anyways" );
167
- /// @todo RTC158181 suspend_pm()
168
166
}
169
167
170
168
FAPI_DBG ("Check cache clock controller status" );
@@ -182,15 +180,15 @@ p9_hcd_cache_stopclocks(
182
180
FAPI_DBG ("Check PERV fence status for access to CME via CPLT_CTRL1[4]" );
183
181
FAPI_TRY (getScom (i_target , EQ_CPLT_CTRL1 , l_temp64 ));
184
182
185
- if (l_data64 .getBit < 4 > ( ) == 0 && l_temp64 .getBit < 4 > ( ) == 0 )
183
+ if (l_data64 .getBit < EQ_CLOCK_STAT_SL_STATUS_PERV > ( ) == 0 &&
184
+ l_temp64 .getBit < EQ_CPLT_CTRL1_TC_PERV_REGION_FENCE > ( ) == 0 )
186
185
{
187
- /// @todo RTC158181 disable l2 snoop? disable lco? assert refresh quiesce?
188
186
FAPI_DBG ("Assert L3 pscom masks via RING_FENCE_MASK_LATCH_REG[4-9]" );
189
187
FAPI_TRY (putScom (i_target , EQ_RING_FENCE_MASK_LATCH_REG , l_l3mask_pscom ));
190
188
}
191
189
192
190
FAPI_DBG ("Assert chiplet fence via NET_CTRL0[18]" );
193
- FAPI_TRY (putScom (i_target , EQ_NET_CTRL0_WOR , MASK_SET (18 )));
191
+ FAPI_TRY (putScom (i_target , EQ_NET_CTRL0_WOR , MASK_SET (EQ_NET_CTRL0_FENCE_EN )));
194
192
195
193
// -------------------------------
196
194
// Stop L2 clocks
@@ -247,17 +245,21 @@ p9_hcd_cache_stopclocks(
247
245
248
246
FAPI_TRY (getScom (i_target , EQ_CPLT_STAT0 , l_data64 ));
249
247
}
250
- while ((l_data64 .getBit < 8 > ( ) != 1 ) && ((-- l_loops1ms ) != 0 ));
248
+ while ((! l_data64 .getBit < EQ_CPLT_STAT0_CC_CTRL_OPCG_DONE_DC > ( )) && ((-- l_loops1ms ) != 0 ));
251
249
252
250
FAPI_ASSERT ((l_loops1ms != 0 ),
253
- fapi2 ::PMPROC_CACHECLKSTOP_TIMEOUT ().set_EQCPLTSTAT (l_data64 ),
251
+ fapi2 ::PMPROC_CACHECLKSTOP_TIMEOUT ()
252
+ .set_TARGET (i_target )
253
+ .set_EQCPLTSTAT (l_data64 ),
254
254
"Cache Clock Stop Timeout" );
255
255
256
256
FAPI_DBG ("Check cache clocks stopped" );
257
257
FAPI_TRY (getScom (i_target , EQ_CLOCK_STAT_SL , l_data64 ));
258
258
259
259
FAPI_ASSERT ((((~l_data64 ) & l_region_clock ) == 0 ),
260
- fapi2 ::PMPROC_CACHECLKSTOP_FAILED ().set_EQCLKSTAT (l_data64 ),
260
+ fapi2 ::PMPROC_CACHECLKSTOP_FAILED ()
261
+ .set_TARGET (i_target )
262
+ .set_EQCLKSTAT (l_data64 ),
261
263
"Cache Clock Stop Failed" );
262
264
FAPI_DBG ("Cache clocks stopped now" );
263
265
@@ -266,7 +268,7 @@ p9_hcd_cache_stopclocks(
266
268
// -------------------------------
267
269
268
270
FAPI_DBG ("Assert vital fence via CPLT_CTRL1[3]" );
269
- FAPI_TRY (putScom (i_target , EQ_CPLT_CTRL1_OR , MASK_SET (3 )));
271
+ FAPI_TRY (putScom (i_target , EQ_CPLT_CTRL1_OR , MASK_SET (EQ_CPLT_CTRL1_TC_VITL_REGION_FENCE )));
270
272
271
273
l_region_fence = l_region_clock ;
272
274
@@ -356,4 +358,3 @@ fapi_try_exit:
356
358
FAPI_INF ("<<p9_hcd_cache_stopclocks" );
357
359
return fapi2 ::current_err ;
358
360
}
359
-
0 commit comments