Skip to content

Commit d4f2330

Browse files
CHRISTINA L. GRAVESdcrowell77
authored andcommitted
p9_query_cache_access_state L2
Change-Id: I199168d2e28635331aa0a1902f5491569a878105 Original-Change-Id: I929f613a0574a982f414a79ca8cbc1580d36118e Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/30918 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Reviewed-by: Gregory S. Still <stillgs@us.ibm.com> Reviewed-by: Thi N. Tran <thi@us.ibm.com> Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com> Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/36070 Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
1 parent 47ab5a5 commit d4f2330

File tree

3 files changed

+287
-0
lines changed

3 files changed

+287
-0
lines changed
Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
/* IBM_PROLOG_BEGIN_TAG */
2+
/* This is an automatically generated prolog. */
3+
/* */
4+
/* $Source: src/import/chips/p9/procedures/hwp/pm/p9_query_cache_access_state.C $ */
5+
/* */
6+
/* OpenPOWER HostBoot Project */
7+
/* */
8+
/* Contributors Listed Below - COPYRIGHT 2016,2017 */
9+
/* [+] International Business Machines Corp. */
10+
/* */
11+
/* */
12+
/* Licensed under the Apache License, Version 2.0 (the "License"); */
13+
/* you may not use this file except in compliance with the License. */
14+
/* You may obtain a copy of the License at */
15+
/* */
16+
/* http://www.apache.org/licenses/LICENSE-2.0 */
17+
/* */
18+
/* Unless required by applicable law or agreed to in writing, software */
19+
/* distributed under the License is distributed on an "AS IS" BASIS, */
20+
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
21+
/* implied. See the License for the specific language governing */
22+
/* permissions and limitations under the License. */
23+
/* */
24+
/* IBM_PROLOG_END_TAG */
25+
///
26+
/// @file p9_query_cache_access_state.C
27+
/// @brief Check the stop level for the EX caches and sets boolean scomable parameters
28+
///
29+
// *HWP HWP Owner: Christina Graves <clgraves@us.ibm.com>
30+
// *HWP Backup HWP Owner: Greg Still <stillgs@us.ibm.com>
31+
// *HWP FW Owner: Sangeetha T S <sangeet2@in.ibm.com>
32+
// *HWP Team: PM
33+
// *HWP Level: 2
34+
// *HWP Consumed by: FSP:HS:SBE
35+
///
36+
///
37+
///
38+
/// @verbatim
39+
/// High-level procedure flow:
40+
/// - For the quad target, read the Stop State History register in the PPM
41+
/// and use the actual stop level to determine if the quad has power and is being
42+
/// clocked.
43+
/// @endverbatim
44+
///
45+
//------------------------------------------------------------------------------
46+
47+
48+
// ----------------------------------------------------------------------
49+
// Includes
50+
// ----------------------------------------------------------------------
51+
52+
#include <p9_quad_scom_addresses.H>
53+
#include <p9_query_cache_access_state.H>
54+
55+
// ----------------------------------------------------------------------
56+
// Constants
57+
// ----------------------------------------------------------------------
58+
59+
const uint32_t eq_clk_l2_pos[] = {8, 9};
60+
const uint32_t eq_clk_l3_pos[] = {6, 7};
61+
const uint32_t SSH_REG_STOP_LEVEL = 8;
62+
const uint32_t SSH_REG_STOP_LEVEL_LEN = 4;
63+
64+
// ----------------------------------------------------------------------
65+
// Procedure Function
66+
// ----------------------------------------------------------------------
67+
68+
fapi2::ReturnCode
69+
p9_query_cache_access_state(
70+
const fapi2::Target<fapi2::TARGET_TYPE_EQ>& i_target,
71+
bool& o_l2_is_scomable,
72+
bool& o_l2_is_scannable,
73+
bool& o_l3_is_scomable,
74+
bool& o_l3_is_scannable)
75+
{
76+
fapi2::buffer<uint64_t> l_qsshsrc;
77+
uint32_t l_quadStopLevel = 0;
78+
fapi2::buffer<uint64_t> l_data64;
79+
bool l_is_scomable = 1;
80+
uint8_t l_chpltNumber = 0;
81+
uint32_t l_exPos = 0;
82+
uint8_t l_execution_platform = 0;
83+
uint32_t l_stop_state_reg = 0;
84+
const fapi2::Target<fapi2::TARGET_TYPE_SYSTEM> FAPI_SYSTEM;
85+
86+
FAPI_INF("> p9_query_cache_access_state...");
87+
88+
//Get the stop state from the SSHRC in the EQPPM
89+
//First figure out whether we should use the C_PPM_SSHFSP (if FSP platform) or C_PPM_SSHHYP (if HOST platform)
90+
FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_EXECUTION_PLATFORM, FAPI_SYSTEM, l_execution_platform),
91+
"Error: Failed to get platform");
92+
93+
if (l_execution_platform == 0x02)
94+
{
95+
l_stop_state_reg = C_PPM_SSHFSP;
96+
}
97+
else
98+
{
99+
l_stop_state_reg = C_PPM_SSHHYP;
100+
}
101+
102+
FAPI_TRY(fapi2::getScom(i_target, l_stop_state_reg, l_qsshsrc), "Error reading data from QPPM SSHSRC");
103+
104+
//A unit is scommable if clocks are running
105+
//A unit is scannable if the unit is powered up
106+
107+
//Extract the core stop state
108+
l_qsshsrc.extractToRight<uint32_t>(l_quadStopLevel, SSH_REG_STOP_LEVEL, SSH_REG_STOP_LEVEL_LEN);
109+
110+
FAPI_DBG("EQ Stop State: EQ(%d)", l_quadStopLevel);
111+
112+
//Set all attribtes to 1, then clear them based on the stop state
113+
o_l2_is_scomable = 1;
114+
o_l2_is_scannable = 1;
115+
o_l3_is_scomable = 1;
116+
o_l3_is_scannable = 1;
117+
118+
// STOP8 - Half Quad Deep Sleep
119+
// VSU, ISU are powered off
120+
// IFU, LSU are powered off
121+
// PC, Core EPS are powered off
122+
// L20-EX0 is clocked off if both cores are >= 8
123+
// L20-EX1 is clocked off if both cores are >= 8
124+
if (l_quadStopLevel >= 8)
125+
{
126+
o_l2_is_scomable = 0;
127+
}
128+
129+
// STOP9 - Fast Winkle (lab use only)
130+
// Both cores and cache are clocked off
131+
if (l_quadStopLevel >= 9)
132+
{
133+
o_l3_is_scomable = 0;
134+
}
135+
136+
// STOP11 - Deep Winkle
137+
// Both cores and cache are powered off
138+
if (l_quadStopLevel >= 11)
139+
{
140+
o_l2_is_scannable = 0;
141+
o_l3_is_scannable = 0;
142+
}
143+
144+
//Read clock status to confirm stop state history is accurate
145+
//If we trust the stop state history, this could be removed to save on code size
146+
//Compare Hardware status vs stop state status. If there is a mismatch the HW value overrides the stop state
147+
148+
FAPI_TRY(fapi2::getScom(i_target, EQ_CLOCK_STAT_SL, l_data64), "Error reading data from EQ_CLOCK_STAT_SL");
149+
150+
FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_CHIP_UNIT_POS, i_target, l_chpltNumber),
151+
"Error: Failed to get the position of the EX:0x%08X", i_target);
152+
l_exPos = l_chpltNumber % 2;
153+
154+
l_is_scomable = !l_data64.getBit(eq_clk_l2_pos[l_exPos]);
155+
156+
if (o_l2_is_scomable != l_is_scomable)
157+
{
158+
FAPI_INF("Clock status didn't match stop state, overriding is_scomable status");
159+
o_l2_is_scomable = l_is_scomable;
160+
}
161+
162+
l_is_scomable = !l_data64.getBit(eq_clk_l3_pos[l_exPos]);
163+
164+
if (o_l3_is_scomable != l_is_scomable)
165+
{
166+
FAPI_INF("Clock status didn't match stop state, overriding is_scomable status");
167+
o_l3_is_scomable = l_is_scomable;
168+
}
169+
170+
fapi_try_exit:
171+
FAPI_INF("< p9_query_cache_access_state...");
172+
return fapi2::current_err;
173+
}
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
/* IBM_PROLOG_BEGIN_TAG */
2+
/* This is an automatically generated prolog. */
3+
/* */
4+
/* $Source: src/import/chips/p9/procedures/hwp/pm/p9_query_cache_access_state.H $ */
5+
/* */
6+
/* OpenPOWER HostBoot Project */
7+
/* */
8+
/* Contributors Listed Below - COPYRIGHT 2016,2017 */
9+
/* [+] International Business Machines Corp. */
10+
/* */
11+
/* */
12+
/* Licensed under the Apache License, Version 2.0 (the "License"); */
13+
/* you may not use this file except in compliance with the License. */
14+
/* You may obtain a copy of the License at */
15+
/* */
16+
/* http://www.apache.org/licenses/LICENSE-2.0 */
17+
/* */
18+
/* Unless required by applicable law or agreed to in writing, software */
19+
/* distributed under the License is distributed on an "AS IS" BASIS, */
20+
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
21+
/* implied. See the License for the specific language governing */
22+
/* permissions and limitations under the License. */
23+
/* */
24+
/* IBM_PROLOG_END_TAG */
25+
/// @file p9_query_cache_access_state.H
26+
/// @brief Check the stop level for the EX caches and sets boolean scomable parameters
27+
///
28+
// *HWP HWP Owner: Christina Graves <clgraves@us.ibm.com>
29+
// *HWP Backup HWP Owner: Greg Still <stillgs@us.ibm.com>
30+
// *HWP FW Owner: Sangeetha T S <sangeet2@in.ibm.com>
31+
// *HWP Team: PM
32+
// *HWP Level: 2
33+
// *HWP Consumed by: FSP:HS:SBE
34+
///
35+
///-----------------------------------------------------------------------------
36+
37+
#ifndef _p9_query_cache_access_state_H_
38+
#define _p9_query_cache_access_state_H_
39+
40+
//------------------------------------------------------------------------------
41+
// Includes
42+
//------------------------------------------------------------------------------
43+
44+
#include <fapi2.H>
45+
#include <p9_pm.H>
46+
#include <p9_quad_scom_addresses.H>
47+
48+
//------------------------------------------------------------------------------
49+
// Constant definitions
50+
//------------------------------------------------------------------------------
51+
52+
// function pointer typedef definition for HWP call support
53+
typedef fapi2::ReturnCode (*p9_query_cache_access_state_FP_t) (
54+
const fapi2::Target<fapi2::TARGET_TYPE_EQ>&,
55+
bool&,
56+
bool&,
57+
bool&,
58+
bool&);
59+
60+
extern "C"
61+
{
62+
63+
//------------------------------------------------------------------------------
64+
// Function prototype
65+
//------------------------------------------------------------------------------
66+
67+
/// @brief Check the stop level for the EX caches and sets boolean scomable parameters
68+
///
69+
/// @param[in] i_target EX target
70+
///
71+
/// @param[out] o_l2_is_scomable L2 cache has clocks running and is scomable
72+
/// @param[out[ o_l2_is_scannable L2 cache is powered up and has valid latch state
73+
/// @param[out] o_l3_is_scomable L3 cache has clocks running and is scomable
74+
/// @param[out[ o_l2_is_scannable L3 cache is powered up and has valid latch state
75+
///
76+
/// @return FAPI2_RC_SUCCESS if success, else error code.
77+
78+
fapi2::ReturnCode
79+
p9_query_cache_access_state(
80+
const fapi2::Target<fapi2::TARGET_TYPE_EQ>& i_target,
81+
bool& o_l2_is_scomable,
82+
bool& o_l2_is_scannable,
83+
bool& o_l3_is_scomable,
84+
bool& o_l3_is_scannable);
85+
86+
} // extern "C"
87+
88+
#endif // _p9_query_cache_access_state_H_
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# IBM_PROLOG_BEGIN_TAG
2+
# This is an automatically generated prolog.
3+
#
4+
# $Source: src/import/chips/p9/procedures/hwp/pm/p9_query_cache_access_state.mk $
5+
#
6+
# OpenPOWER HostBoot Project
7+
#
8+
# Contributors Listed Below - COPYRIGHT 2016,2017
9+
# [+] International Business Machines Corp.
10+
#
11+
#
12+
# Licensed under the Apache License, Version 2.0 (the "License");
13+
# you may not use this file except in compliance with the License.
14+
# You may obtain a copy of the License at
15+
#
16+
# http://www.apache.org/licenses/LICENSE-2.0
17+
#
18+
# Unless required by applicable law or agreed to in writing, software
19+
# distributed under the License is distributed on an "AS IS" BASIS,
20+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
21+
# implied. See the License for the specific language governing
22+
# permissions and limitations under the License.
23+
#
24+
# IBM_PROLOG_END_TAG
25+
PROCEDURE=p9_query_cache_access_state
26+
$(call BUILD_PROCEDURE)

0 commit comments

Comments
 (0)