diff options
author | spashabk-in <shakeebbk@in.ibm.com> | 2016-12-13 03:10:42 -0600 |
---|---|---|
committer | Sachin Gupta <sgupta2m@in.ibm.com> | 2017-01-16 04:50:40 -0500 |
commit | 197375d2fe4c13b0f1bc4f7389c6f53330e9c3be (patch) | |
tree | 823de0632db2a9565c2b76183d7960312fd58112 /src/import/chips/p9/procedures/hwp | |
parent | 49371ca5b793a66a182d1145e3f10b20271164bb (diff) | |
download | talos-sbe-197375d2fe4c13b0f1bc4f7389c6f53330e9c3be.tar.gz talos-sbe-197375d2fe4c13b0f1bc4f7389c6f53330e9c3be.zip |
p9_stopclocks SBE/PPE related changes
- Remove dependency on IS_SCOMMABLE attribute
- SCOM alternatives for CFAM regsiters
- Miscellaneous updates to compile it on ppe
Change-Id: I984e934ca7fb5e139dbcdc92949c25cc7d19f120
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/33762
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Reviewed-by: RAJA DAS <rajadas2@in.ibm.com>
Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com>
Reviewed-by: SRINIVAS V. POLISETTY <srinivan@in.ibm.com>
Dev-Ready: Sangram Alapati <sangram@us.ibm.com>
Reviewed-by: Joseph J. McGill <jmcgill@us.ibm.com>
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/34919
Diffstat (limited to 'src/import/chips/p9/procedures/hwp')
4 files changed, 205 insertions, 31 deletions
diff --git a/src/import/chips/p9/procedures/hwp/perv/p9_common_stopclocks.C b/src/import/chips/p9/procedures/hwp/perv/p9_common_stopclocks.C index 2ead7460..c05df2bb 100644 --- a/src/import/chips/p9/procedures/hwp/perv/p9_common_stopclocks.C +++ b/src/import/chips/p9/procedures/hwp/perv/p9_common_stopclocks.C @@ -153,7 +153,119 @@ fapi_try_exit: return fapi2::current_err; } +#ifdef __PPE__ +/// @brief p9_common_stopclock_is_scommable - Read Clock STAT SL,NSL,ARY +/// Read ATTR_PG +/// Compare Region Anding(SL,NSL,ARY) with ATTR_PG +///@param[in] i_target_cplt - chiplet target +///@param[out] o_isScommable - is chiplet scommable +fapi2::ReturnCode p9_common_stopclock_is_scommable( + const fapi2::Target<fapi2::TARGET_TYPE_PERV>& i_target_cplt, + uint8_t& o_isScommable) +{ + fapi2::buffer<uint64_t> l_sl_clock_status_act; + fapi2::buffer<uint64_t> l_nsl_clock_status_act; + fapi2::buffer<uint64_t> l_ary_clock_status_act; + fapi2::buffer<uint16_t> l_sl_regions_act; + fapi2::buffer<uint16_t> l_nsl_regions_act; + fapi2::buffer<uint16_t> l_ary_regions_act; + fapi2::buffer<uint16_t> l_read_attr; + fapi2::buffer<uint16_t> l_attr_regions; + FAPI_DBG("p9_stopclock_is_scommable: Entering ..."); + + FAPI_DBG("Read Clock Stat SL"); + FAPI_TRY(fapi2::getScom(i_target_cplt, PERV_CLOCK_STAT_SL, + l_sl_clock_status_act)); + FAPI_DBG("CLOCK_STAT_SL Value : %#018lX", l_sl_clock_status_act); + + FAPI_DBG("Read Clock Stat NSL"); + FAPI_TRY(fapi2::getScom(i_target_cplt, PERV_CLOCK_STAT_NSL, + l_nsl_clock_status_act)); + FAPI_DBG("CLOCK_STAT_NSL Value : %#018lX", l_nsl_clock_status_act); + + FAPI_DBG("Read Clock Stat ARY"); + FAPI_TRY(fapi2::getScom(i_target_cplt, PERV_CLOCK_STAT_ARY, + l_ary_clock_status_act)); + FAPI_DBG("CLOCK_STAT_ARY Value : %#018lX", l_ary_clock_status_act); + + FAPI_DBG("Extract Regions bits excluding PLL from Clock Stat SL/NSL/ARY"); + l_sl_clock_status_act.extractToRight<4, 10>(l_sl_regions_act); + l_nsl_clock_status_act.extractToRight<4, 10>(l_nsl_regions_act); + l_ary_clock_status_act.extractToRight<4, 10>(l_ary_regions_act); + FAPI_DBG("Region bits from Clock status registers\n\t SL = %#06lX, " + "NSL = %#06lX, ARY = %#06lX", l_sl_regions_act, + l_nsl_regions_act, l_ary_regions_act); + + FAPI_DBG("Reading ATTR_PG"); + FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_PG, i_target_cplt, l_read_attr)); + FAPI_DBG("ATTR_PG Value : %#010lX", l_read_attr); + + FAPI_DBG("Extract Regions bits excluding PLL from ATTR_PG"); + l_read_attr.extractToRight<4, 10>(l_attr_regions); + FAPI_DBG("Regions bits from ATTR_PG Value : %#06lX", l_attr_regions); + + FAPI_DBG("Compare region(ANDing Regions bits from SL/NSL/ARY register)" + " with ATTR_PG"); + + if ((l_sl_regions_act & l_nsl_regions_act & l_ary_regions_act) + == l_attr_regions) + { + FAPI_DBG("o_isScommable is True"); + o_isScommable = true; + } + else + { + FAPI_DBG("o_isScommable is False"); + o_isScommable = false; + } + + FAPI_DBG("p9_stopclock_is_scommable: Exiting ..."); + +fapi_try_exit: + return fapi2::current_err; +} +/* + * @brief - Check if the chiplet is accesible for scom, + * valid for all chiplets except TP + * + * @param[in] - i_target - Pervasive target + * @param[out] - o_o_isAccesible - If the the chiplet is accesible + * */ +fapi2::ReturnCode p9_common_stopclock_chiplet_accesible( + const fapi2::Target<fapi2::TARGET_TYPE_PERV>& i_target, + uint8_t& o_isAccesible) +{ + fapi2::buffer<uint64_t> l_data64; + //Reading NET_CTRL0 for chiplets except TP/EQ/EC and call function + //target_is_scommable + FAPI_TRY(fapi2::getScom(i_target, PERV_NET_CTRL0, l_data64)); + FAPI_DBG("Read NET_CTRL0 Reg Value and Observe bit0(cplt_en) set," + "bit1(ep_rst) clear, bit16(vtl_thld) clear : %#018lX", + l_data64); + + if ((l_data64.getBit(PERV_1_NET_CTRL0_CHIPLET_ENABLE)) + && !(l_data64.getBit(PERV_1_NET_CTRL0_PCB_EP_RESET)) + && !(l_data64.getBit(PERV_1_NET_CTRL0_VITAL_THOLD))) + { + FAPI_DBG("Read NET_CTRL0 Reg Value and required bits met -- " + "cplt_en is set, ep_rst is clear, vtl_thld is clear :" + "Target Chiplet is acessible"); + o_isAccesible = 1; + } + else + { + FAPI_DBG("Read NET_CTRL0 Reg Value and min one of them required bits" + "is not met -- cplt_en is not set, ep_rst is not clear, " + "vtl_thld is not clear : Target Chiplet is not acessible"); + o_isAccesible = 0; + } + +fapi_try_exit: + return fapi2::current_err; +} +#endif +#ifndef __PPE__ /// @brief Stopping PIB & NET domain clocks in PERV chiplet using CBS /// /// @param[in] i_target_chip Reference to TARGET_CHIP target @@ -265,3 +377,4 @@ fapi2::ReturnCode p9_common_stopclocks_poll_cbs_cmd_complete(const fapi2::Target fapi_try_exit: return fapi2::current_err; } +#endif diff --git a/src/import/chips/p9/procedures/hwp/perv/p9_common_stopclocks.H b/src/import/chips/p9/procedures/hwp/perv/p9_common_stopclocks.H index cda78126..5b270248 100644 --- a/src/import/chips/p9/procedures/hwp/perv/p9_common_stopclocks.H +++ b/src/import/chips/p9/procedures/hwp/perv/p9_common_stopclocks.H @@ -57,4 +57,13 @@ fapi2::ReturnCode p9_common_stopclocks_pib_net_clkstop( fapi2::ReturnCode p9_common_stopclocks_poll_cbs_cmd_complete( const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target_chip); +#ifdef __PPE__ +fapi2::ReturnCode p9_common_stopclock_is_scommable( + const fapi2::Target<fapi2::TARGET_TYPE_PERV>& i_target_cplt, + uint8_t& o_isScommable); + +fapi2::ReturnCode p9_common_stopclock_chiplet_accesible( + const fapi2::Target<fapi2::TARGET_TYPE_PERV>& i_target, + uint8_t& o_isAccesible); +#endif #endif diff --git a/src/import/chips/p9/procedures/hwp/perv/p9_stopclocks.C b/src/import/chips/p9/procedures/hwp/perv/p9_stopclocks.C index 54b61956..6d454b63 100644 --- a/src/import/chips/p9/procedures/hwp/perv/p9_stopclocks.C +++ b/src/import/chips/p9/procedures/hwp/perv/p9_stopclocks.C @@ -44,7 +44,11 @@ #include <p9_tp_stopclocks.H> #include <p9_hcd_core_stopclocks.H> #include <p9_hcd_cache_stopclocks.H> -#include <p9_check_chiplet_states.H> +#ifdef __PPE__ + #include <p9_common_stopclocks.H> +#else + #include <p9_check_chiplet_states.H> +#endif #include <p9_hcd_common.H> //------------------------------------------------------------------------------ @@ -89,7 +93,7 @@ fapi2::ReturnCode p9_stopclocks(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP fapi2::buffer<uint64_t> l_nsl_clock_status; fapi2::buffer<uint64_t> l_ary_clock_status; - uint8_t l_cplt_scomable; + uint8_t l_cplt_scomable = 0; bool pcb_is_bypassed = false; bool pcb_clks_are_off = false; @@ -106,14 +110,17 @@ fapi2::ReturnCode p9_stopclocks(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP bool tp_ep_rst = true; bool tp_vitl_clk_off = true; bool tp_mesh_clk_en = false; +#ifdef __PPE__ + uint8_t l_tp_chiplet_accesible = 0; +#endif FAPI_INF("p9_stopclocks : Entering ..."); - FAPI_DBG("p9_stopclocks : Input arguments received are \n\t i_stop_nest = %s\n\t i_stop_mc = %s\n\t i_stop_xbus = %s\n\t i_stop_obus = %s\n\t i_stop_pcie = %s\n\t i_stop_tp = %s\n\t i_stop_pib = %s\n\t i_stop_vitl = %s\n", - btos(i_stop_nest_clks), btos(i_stop_mc_clks), btos(i_stop_xbus_clks), btos(i_stop_obus_clks), btos(i_stop_pcie_clks), - btos(i_stop_tp_clks), btos(i_stop_pib_clks), btos(i_stop_vitl_clks)); - FAPI_DBG("p9_stopclocks : Input QUAD arguments received are \n\t i_stop_cache = %s\n\t i_stop_core = %s\n\t i_eq_clk_regions = %#018lx \n\t i_ex_select = %#018lx\n", - btos(i_stop_cache_clks), btos(i_stop_core_clks), (uint64_t)i_eq_clk_regions, (uint64_t)i_ex_select); + FAPI_DBG("p9_stopclocks : Input arguments received are \n\t i_stop_nest = %d\n\t i_stop_mc = %d\n\t i_stop_xbus = %d\n\t i_stop_obus = %d\n\t i_stop_pcie = %d\n\t i_stop_tp = %d\n\t i_stop_pib = %d\n\t i_stop_vitl = %d\n", + i_stop_nest_clks, i_stop_mc_clks, i_stop_xbus_clks, i_stop_obus_clks, i_stop_pcie_clks, + i_stop_tp_clks, i_stop_pib_clks, i_stop_vitl_clks); + FAPI_DBG("p9_stopclocks : Input QUAD arguments received are \n\t i_stop_cache = %d\n\t i_stop_core = %d\n\t i_eq_clk_regions = %#018lx \n\t i_ex_select = %#018lx\n", + i_stop_cache_clks, i_stop_core_clks, (uint64_t)i_eq_clk_regions, (uint64_t)i_ex_select); FAPI_DBG("p9_stopclocks : Check to see if the Perv Vital clocks are OFF"); #ifdef __PPE__ @@ -166,8 +173,8 @@ fapi2::ReturnCode p9_stopclocks(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP tp_vitl_clk_off = l_cfam_data.getBit<PERV_PERV_CTRL0_CLEAR_TP_VITL_CLKOFF_DC>(); tp_mesh_clk_en = l_cfam_data.getBit<PERV_PERV_CTRL0_TP_PLLCHIPLET_FORCE_OUT_EN_DC>(); #endif - FAPI_DBG("Read PERV_CTRL0 Reg Value and observe CPLT_EN = %s, EP_RST = %s, VITL_CLKOFF = %s", btos(tp_cplt_en), - btos(tp_ep_rst), btos(tp_vitl_clk_off)); + FAPI_DBG("Read PERV_CTRL0 Reg Value and observe CPLT_EN = %d, EP_RST = %d, VITL_CLKOFF = %d", tp_cplt_en, + tp_ep_rst, tp_vitl_clk_off); if (tp_cplt_en && !(tp_ep_rst) && !(tp_vitl_clk_off)) { @@ -199,6 +206,10 @@ fapi2::ReturnCode p9_stopclocks(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP { pcb_clks_are_off = false; } + +#ifdef __PPE__ + l_tp_chiplet_accesible = true; +#endif } else { @@ -210,56 +221,87 @@ fapi2::ReturnCode p9_stopclocks(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP if ( (pcb_is_bypassed == false) && (pcb_clks_are_off == false) ) { FAPI_DBG("p9_stopclocks : Call p9_check_chiplet_states to get the state of chip"); +#ifndef __PPE__ FAPI_TRY(p9_check_chiplet_states(i_target_chip)); +#endif //To get the chiplet state from Attributes - for (auto l_target_cplt : i_target_chip.getChildren<fapi2::TARGET_TYPE_PERV> + for (const auto& l_target_cplt : i_target_chip.getChildren<fapi2::TARGET_TYPE_PERV> (static_cast<fapi2::TargetFilter>(fapi2::TARGET_FILTER_TP | fapi2::TARGET_FILTER_ALL_MC | fapi2::TARGET_FILTER_ALL_NEST | fapi2::TARGET_FILTER_ALL_OBUS | fapi2::TARGET_FILTER_ALL_PCI | fapi2::TARGET_FILTER_XBUS), fapi2::TARGET_STATE_FUNCTIONAL)) { - FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_TARGET_IS_SCOMMABLE, l_target_cplt, l_cplt_scomable)); + uint8_t l_attr_unit_pos = 0; + FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_CHIP_UNIT_POS, l_target_cplt, l_attr_unit_pos)); - if(!(l_cplt_scomable)) + if (l_attr_unit_pos == 0x01) { - uint8_t l_attr_unit_pos = 0; - FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_CHIP_UNIT_POS, l_target_cplt, l_attr_unit_pos)); +#ifdef __PPE__ - if (l_attr_unit_pos == 0x01) + if(l_tp_chiplet_accesible) { - tp_cplt_scomable = false; + FAPI_TRY(p9_common_stopclock_is_scommable(l_target_cplt, l_cplt_scomable)); } - else if (l_attr_unit_pos == 0x02 || l_attr_unit_pos == 0x03 || l_attr_unit_pos == 0x04 || l_attr_unit_pos == 0x05) + else + { + l_cplt_scomable = false; + } + +#else + FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_TARGET_IS_SCOMMABLE, l_target_cplt, l_cplt_scomable)); +#endif + tp_cplt_scomable = l_cplt_scomable; + } + else + { +#ifdef __PPE__ + uint8_t l_chiplet_accessible = 0; + FAPI_TRY(p9_common_stopclock_chiplet_accesible(l_target_cplt, l_chiplet_accessible)); + + if(l_chiplet_accessible) + { + FAPI_TRY(p9_common_stopclock_is_scommable(l_target_cplt, l_cplt_scomable)); + } + else + { + l_cplt_scomable = false; + } + +#else + FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_TARGET_IS_SCOMMABLE, l_target_cplt, l_cplt_scomable)); +#endif + + if (l_attr_unit_pos == 0x02 || l_attr_unit_pos == 0x03 || l_attr_unit_pos == 0x04 || l_attr_unit_pos == 0x05) { - nest_cplt_scomable = false; + nest_cplt_scomable = l_cplt_scomable; } else if (l_attr_unit_pos == 0x06) { - xbus_cplt_scomable = false; + xbus_cplt_scomable = l_cplt_scomable; } else if (l_attr_unit_pos == 0x07 || l_attr_unit_pos == 0x08 ) { - mc_cplt_scomable = false; + mc_cplt_scomable = l_cplt_scomable; } else if (l_attr_unit_pos == 0x09 || l_attr_unit_pos == 0x0A || l_attr_unit_pos == 0x0B || l_attr_unit_pos == 0x0C) { - obus_cplt_scomable = false; + obus_cplt_scomable = l_cplt_scomable; } else if (l_attr_unit_pos == 0x0D || l_attr_unit_pos == 0x0E || l_attr_unit_pos == 0x0F ) { - pcie_cplt_scomable = false; + pcie_cplt_scomable = l_cplt_scomable; } } } - FAPI_DBG("p9_stopclocks : Chiplet scomable states \n\t tp_cplt_scomable = %s\n\t nest_cplt_scomable = %s\n\t xbus_cplt_scomable = %s\n\t mc_cplt_scomable = %s\n\t obus_cplt_scomable = %s\n\t pcie_cplt_scomable = %s\n", - btos(tp_cplt_scomable), btos(nest_cplt_scomable), btos(xbus_cplt_scomable), btos(mc_cplt_scomable), - btos(obus_cplt_scomable), btos(pcie_cplt_scomable)); + FAPI_DBG("p9_stopclocks : Chiplet scomable states \n\t tp_cplt_scomable = %d\n\t nest_cplt_scomable = %d\n\t xbus_cplt_scomable = %d\n\t mc_cplt_scomable = %d\n\t obus_cplt_scomable = %d\n\t pcie_cplt_scomable = %d\n", + tp_cplt_scomable, nest_cplt_scomable, xbus_cplt_scomable, mc_cplt_scomable, + obus_cplt_scomable, pcie_cplt_scomable); // Core stopclocks if(i_stop_core_clks) { - for (auto l_target_core : i_target_chip.getChildren<fapi2::TARGET_TYPE_CORE>(fapi2::TARGET_STATE_FUNCTIONAL)) + for (const auto& l_target_core : i_target_chip.getChildren<fapi2::TARGET_TYPE_CORE>(fapi2::TARGET_STATE_FUNCTIONAL)) { FAPI_INF("p9_stopclocks : Calling p9_hcd_core_stopclocks"); FAPI_TRY(p9_hcd_core_stopclocks(l_target_core)); @@ -269,7 +311,7 @@ fapi2::ReturnCode p9_stopclocks(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP // L2 & Cache stopclocks if(i_stop_cache_clks) { - for (auto l_target_eq : i_target_chip.getChildren<fapi2::TARGET_TYPE_EQ>(fapi2::TARGET_STATE_FUNCTIONAL)) + for (const auto& l_target_eq : i_target_chip.getChildren<fapi2::TARGET_TYPE_EQ>(fapi2::TARGET_STATE_FUNCTIONAL)) { FAPI_INF("p9_stopclocks : Calling p9_hcd_cache_stopclocks"); FAPI_TRY(p9_hcd_cache_stopclocks(l_target_eq, i_eq_clk_regions, i_ex_select)); @@ -307,8 +349,8 @@ fapi2::ReturnCode p9_stopclocks(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP } else if(i_stop_tp_clks || i_stop_pib_clks) { - FAPI_ERR("p9_stopclocks : Invalid condition to stop TP chiplet clocks\n\t TP_CPLT_SCOMABLE= %s, PCB_IS_BYPASSED=%s, PCB_CLKS_ARE_OFF=%s TP_MESH_CLK_EN=%s", - btos(tp_cplt_scomable), btos(pcb_is_bypassed), btos(pcb_clks_are_off), btos(tp_mesh_clk_en)); + FAPI_ERR("p9_stopclocks : Invalid condition to stop TP chiplet clocks\n\t TP_CPLT_SCOMABLE= %d, PCB_IS_BYPASSED=%d, PCB_CLKS_ARE_OFF=%d TP_MESH_CLK_EN=%d", + tp_cplt_scomable, pcb_is_bypassed, pcb_clks_are_off, tp_mesh_clk_en); } // Vital stopclocks diff --git a/src/import/chips/p9/procedures/hwp/perv/p9_tp_stopclocks.C b/src/import/chips/p9/procedures/hwp/perv/p9_tp_stopclocks.C index b2c05fc6..3df6e743 100644 --- a/src/import/chips/p9/procedures/hwp/perv/p9_tp_stopclocks.C +++ b/src/import/chips/p9/procedures/hwp/perv/p9_tp_stopclocks.C @@ -74,14 +74,18 @@ fapi2::ReturnCode p9_tp_stopclocks(const fapi2::Target<fapi2::TARGET_TYPE_PROC_C goto fapi_try_exit; } +#ifdef __PPE__ + if(i_stop_pib_clks) { -#ifdef __PPE__ FAPI_ERR("p9_tp_stopclocks: Calling TP stopclocks for PIB & NET regions in SBE mode is INVALID\n\t --> Skipping TP Stopclocks for PIB/NET regions..! <--"); goto fapi_try_exit; -#endif } +#endif + +#ifndef __PPE__ + if(i_stop_pib_clks) { FAPI_DBG("p9_tp_stopclocks: Raise chiplet fence"); @@ -101,6 +105,8 @@ fapi2::ReturnCode p9_tp_stopclocks(const fapi2::Target<fapi2::TARGET_TYPE_PROC_C l_data32_root_ctrl0)); } +#endif + if(i_stop_tp_clks && i_stop_pib_clks) { FAPI_DBG("p9_tp_stopclocks: TP regions selected is REGIONS_ALL_EXCEPT_PLL"); @@ -142,6 +148,8 @@ fapi2::ReturnCode p9_tp_stopclocks(const fapi2::Target<fapi2::TARGET_TYPE_PROC_C fapi2::TARGET_STATE_FUNCTIONAL)[0])); } +#ifndef __PPE__ + if(i_stop_pib_clks) { FAPI_INF("p9_tp_stopclocks: Raise OOB Mux"); @@ -159,6 +167,8 @@ fapi2::ReturnCode p9_tp_stopclocks(const fapi2::Target<fapi2::TARGET_TYPE_PROC_C l_data32_root_ctrl0)); } +#endif + FAPI_INF("p9_tp_stopclocks: Exiting ..."); fapi_try_exit: |