diff options
Diffstat (limited to 'import/chips/p9/procedures/hwp/nest')
4 files changed, 234 insertions, 33 deletions
diff --git a/import/chips/p9/procedures/hwp/nest/p9_fbc_utils.C b/import/chips/p9/procedures/hwp/nest/p9_fbc_utils.C new file mode 100644 index 00000000..0268cbcd --- /dev/null +++ b/import/chips/p9/procedures/hwp/nest/p9_fbc_utils.C @@ -0,0 +1,123 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: chips/p9/procedures/ipl/sbe/p9_fbc_utils.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* EKB Project */ +/* */ +/* COPYRIGHT 2015 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* IBM_PROLOG_END_TAG */ +/// +/// @file p9_fbc_utils.C +/// @brief Fabric library functions/constants (FAPI2) +/// +/// The functions in this file provide: +/// - Information about the instantaneous state of the fabric +/// - Means to restart the fabric after a checkstop condition +/// +/// @author Joe McGill <jmcgill@us.ibm.com> +/// @author Christy Graves <clgraves@us.ibm.com> +/// + +// +// *HWP HWP Owner: Joe McGill <jmcgill@us.ibm.com> +// *HWP FW Owner: Thi Tran <thi@us.ibm.com> +// *HWP Team: Nest +// *HWP Level: 2 +// *HWP Consumed by: SBE,HB +// + +//------------------------------------------------------------------------------ +// Includes +//------------------------------------------------------------------------------ +#include <p9_fbc_utils.H> +#include <p9_misc_scom_addresses.H> + +extern "C" +{ + +//------------------------------------------------------------------------------ +// Constant definitions +//------------------------------------------------------------------------------ + +// ADU PMisc Register field/bit definitions + const uint32_t ALTD_SND_MODE_DISABLE_CHECKSTOP_BIT = 19; + const uint32_t ALTD_SND_MODE_MANUAL_CLR_PB_STOP_BIT = 21; + const uint32_t ALTD_SND_MODE_PB_STOP_BIT = 22; + +// FBC Mode Register field/bit definitions + const uint32_t PU_FBC_MODE_PB_INITIALIZED_BIT = 0; + +//------------------------------------------------------------------------------ +// Function definitions +//------------------------------------------------------------------------------ + + fapi2::ReturnCode p9_fbc_utils_get_fbc_state( + const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target, + bool& o_is_initialized, + bool& o_is_running) + { + FAPI_DBG("Start"); + + // TODO: HW328175 + // fapi2::buffer<uint64_t> l_fbc_mode_data; + // FAPI_TRY(fapi2::getScom(i_target, PU_FBC_MODE_REG, l_fbc_mode_data), + // "Error reading FBC Mode Register"); + // // fabric is initialized if PB_INITIALIZED bit is one/set + // o_is_initialized = l_fbc_mode_data.getBit<PU_FBC_MODE_PB_INITIALIZED_BIT>(); + + // currently, sampling FBC init from PB Mode register is unreliable + // as init can drop perodically at runtime (based on legacy sleep backoff) + // until this issue is fixed, just return true to caller + o_is_initialized = true; + + // read ADU PMisc Mode Register state + fapi2::buffer<uint64_t> l_pmisc_mode_data; + FAPI_TRY(fapi2::getScom(i_target, PU_SND_MODE_REG, l_pmisc_mode_data), + "Error reading ADU PMisc Mode register"); + + // fabric is running if FBC_STOP bit is zero/clear + o_is_running = !(l_pmisc_mode_data.getBit<ALTD_SND_MODE_PB_STOP_BIT>()); + + fapi_try_exit: + FAPI_DBG("End"); + return fapi2::current_err; + } + + + fapi2::ReturnCode p9_fbc_utils_override_fbc_stop( + const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target) + { + FAPI_DBG("Start"); + + // read ADU PMisc Mode Register state + fapi2::buffer<uint64_t> l_pmisc_mode_data; + FAPI_TRY(fapi2::getScom(i_target, PU_SND_MODE_REG, l_pmisc_mode_data), + "Error reading ADU PMisc Mode register"); + + // set bit to disable checkstop forwarding and write back + l_pmisc_mode_data.setBit<ALTD_SND_MODE_DISABLE_CHECKSTOP_BIT>(); + FAPI_TRY(fapi2::putScom(i_target, PU_SND_MODE_REG, l_pmisc_mode_data), + "Error writing ADU PMisc Mode register to disable checkstop forwarding to FBC"); + + // set bit to manually clear stop control and write back + l_pmisc_mode_data.setBit<ALTD_SND_MODE_MANUAL_CLR_PB_STOP_BIT>(); + FAPI_TRY(fapi2::putScom(i_target, PU_SND_MODE_REG, l_pmisc_mode_data), + "Error writing ADU PMisc Mode register to manually clear FBC stop control"); + + fapi_try_exit: + FAPI_DBG("End"); + return fapi2::current_err; + } + + +} // extern "C" diff --git a/import/chips/p9/procedures/hwp/nest/p9_fbc_utils.H b/import/chips/p9/procedures/hwp/nest/p9_fbc_utils.H new file mode 100644 index 00000000..d472add6 --- /dev/null +++ b/import/chips/p9/procedures/hwp/nest/p9_fbc_utils.H @@ -0,0 +1,84 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: chips/p9/procedures/ipl/sbe/p9_fbc_utils.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* EKB Project */ +/* */ +/* COPYRIGHT 2015 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* The source code for this program is not published or otherwise */ +/* divested of its trade secrets, irrespective of what has been */ +/* deposited with the U.S. Copyright Office. */ +/* */ +/* IBM_PROLOG_END_TAG */ +/// +/// @file p9_fbc_utils.H +/// @brief Fabric library functions/constants (FAPI2) +/// +/// @author Joe McGill <jmcgill@us.ibm.com> +/// @author Christy Graves <clgraves@us.ibm.com> +/// + +// +// *HWP HWP Owner: Joe McGill <jmcgill@us.ibm.com> +// *HWP FW Owner: Thi Tran <thi@us.ibm.com> +// *HWP Team: Nest +// *HWP Level: 2 +// *HWP Consumed by: SBE,HB +// + +#ifndef _P9_FBC_UTILS_H_ +#define _P9_FBC_UTILS_H_ + +//------------------------------------------------------------------------------ +// Includes +//------------------------------------------------------------------------------ +#include <fapi2.H> + +//------------------------------------------------------------------------------ +// Constant definitions +//------------------------------------------------------------------------------ + +// address range definitions +const uint64_t P9_FBC_UTILS_FBC_MAX_ADDRESS = ((1ULL << 56) - 1ULL); +const uint64_t P9_FBC_UTILS_CACHELINE_MASK = 0x7FULL; +const uint64_t P9_FBC_UTILS_LAST_ADDR_IN_CACHELINE = 0x78ULL; + +//------------------------------------------------------------------------------ +// Function prototypes +//------------------------------------------------------------------------------ + +extern "C" { + +/// +/// @brief Read FBC/ADU registers to determine state of fabric init and stop +/// control signals +/// +/// @param[in] i_target Reference to processor chip target +/// @param[out] o_is_initialized State of fabric init signal +/// @param[out] o_is_running State of fabric pervasive stop control +/// @return fapi::ReturnCode, FAPI2_RC_SUCCESS if success, else error code. +/// + fapi2::ReturnCode p9_fbc_utils_get_fbc_state( + const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target, + bool& o_is_initialized, + bool& o_is_running); + +/// +/// @brief Use ADU pMisc Mode register to clear fabric stop signal, overriding +/// a stop condition caused by a checkstop +/// +/// @param[in] i_target Reference to processor chip target +/// @return fapi::ReturnCode, FAPI2_RC_SUCCESS if success, else error code. +/// + fapi2::ReturnCode p9_fbc_utils_override_fbc_stop( + const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target); + +} // extern "C" + +#endif // _P9_FBC_UTILS_H_ diff --git a/import/chips/p9/procedures/hwp/nest/p9_sbe_fabricinit.C b/import/chips/p9/procedures/hwp/nest/p9_sbe_fabricinit.C index 4ca240a1..71f7f918 100755 --- a/import/chips/p9/procedures/hwp/nest/p9_sbe_fabricinit.C +++ b/import/chips/p9/procedures/hwp/nest/p9_sbe_fabricinit.C @@ -1,7 +1,7 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: chips/p9/procedures/hwp/nest/p9_sbe_fabricinit.C $ */ +/* $Source: chips/p9/procedures/ipl/sbe/p9_sbe_fabricinit.C $ */ /* */ /* IBM CONFIDENTIAL */ /* */ @@ -16,7 +16,6 @@ /* deposited with the U.S. Copyright Office. */ /* */ /* IBM_PROLOG_END_TAG */ - /// /// @file p9_sbe_fabricinit.C /// @brief Initialize island-mode fabric configuration (FAPI2) @@ -29,7 +28,7 @@ // *HWP HWP Owner: Joe McGill <jmcgill@us.ibm.com> // *HWP FW Owner: Thi Tran <thi@us.ibm.com> // *HWP Team: Nest -// *HWP Level: 3 +// *HWP Level: 2 // *HWP Consumed by: SBE // @@ -37,18 +36,13 @@ // Includes //------------------------------------------------------------------------------ #include <p9_sbe_fabricinit.H> - +#include <p9_fbc_utils.H> +#include <p9_misc_scom_addresses.H> //------------------------------------------------------------------------------ // Constant definitions //------------------------------------------------------------------------------ -// ADU SCOM register address definitions -// TODO: these are currently incorrect in the FigTree/generated SCOM address header -// including locally defined address constants here for testing purposes -const uint64_t PU_ALTD_CMD_REG = 0x00090001; -const uint64_t PU_ALTD_STATUS_REG = 0x00090003; -const uint64_t PU_SND_MODE_REG = 0x00090021; // FBC SCOM register address definitions // TODO: these are currently not present in the generated SCOM adddress header // including locally defined address constants here for testing purposes @@ -87,12 +81,6 @@ const uint32_t ALTD_STATUS_CRESP_NUM_BITS = (ALTD_STATUS_CRESP_END_BIT - ALTD_ST const uint32_t ALTD_STATUS_CRESP_ACK_DONE = 0x04; -// ADU PMisc Register field/bit definitions -const uint32_t ALTD_SND_MODE_FBC_STOP_BIT = 22; - -// FBC Mode Register field/bit definitions -const uint32_t PU_FBC_MODE_PB_INITIALIZED_BIT = 0; - //------------------------------------------------------------------------------ // Function definitions @@ -105,17 +93,19 @@ p9_sbe_fabricinit(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target) FAPI_INF("Start"); fapi2::buffer<uint64_t> l_cmd_data; - fapi2::buffer<uint64_t> l_pmisc_mode_data; fapi2::buffer<uint64_t> l_status_data_act; fapi2::buffer<uint64_t> l_status_data_exp; - fapi2::buffer<uint64_t> l_fbc_mode_data; + bool l_fbc_is_initialized, l_fbc_is_running; // check state of fabric pervasive stop control signal // if set, this would prohibit all fabric commands from being broadcast - FAPI_TRY(fapi2::getScom(i_target, PU_SND_MODE_REG, l_pmisc_mode_data), - "Error reading ADU PMisc Mode register"); - FAPI_ASSERT(!l_pmisc_mode_data.getBit<ALTD_SND_MODE_FBC_STOP_BIT>(), - fapi2::P9_SBE_FABRICINIT_FBC_STOPPED_ERR().set_TARGET(i_target), + FAPI_DBG("Checking status of FBC stop ..."); + FAPI_TRY(p9_fbc_utils_get_fbc_state(i_target, l_fbc_is_initialized, l_fbc_is_running), + "Error from p9_fbc_utils_get_fbc_state"); + FAPI_ASSERT(l_fbc_is_running, + fapi2::P9_SBE_FABRICINIT_FBC_STOPPED_ERR(). + set_TARGET(i_target). + set_FBC_RUNNING(l_fbc_is_running), "Pervasive stop control is asserted, so fabricinit will not run!"); // write ADU Command Register to attempt lock acquisition @@ -132,7 +122,7 @@ p9_sbe_fabricinit(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target) "Error writing ADU Command Register to clear status and reset state machine"); // launch init command - FAPI_DBG("Launching fabric init command via ADU ..."); + FAPI_INF("Launching fabric init command via ADU ..."); l_cmd_data.setBit<ALTD_CMD_START_OP_BIT>() .clearBit<ALTD_CMD_CLEAR_STATUS_BIT>() .clearBit<ALTD_CMD_RESET_FSM_BIT>() @@ -157,7 +147,9 @@ p9_sbe_fabricinit(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target) l_status_data_exp.insertFromRight<ALTD_STATUS_CRESP_START_BIT, ALTD_STATUS_CRESP_NUM_BITS>(ALTD_STATUS_CRESP_ACK_DONE); FAPI_ASSERT(l_status_data_exp == l_status_data_act, - fapi2::P9_SBE_FABRICINIT_FAILED_ERR().set_TARGET(i_target), + fapi2::P9_SBE_FABRICINIT_FAILED_ERR().set_TARGET(i_target). + set_ADU_STATUS_EXP(l_status_data_act). + set_ADU_STATUS_ACT(l_status_data_act), "Fabric init failed, or mismatch in expected ADU status!"); // clear ADU Command Register to release lock @@ -167,12 +159,15 @@ p9_sbe_fabricinit(const fapi2::Target<fapi2::TARGET_TYPE_PROC_CHIP>& i_target) "Error writing ADU Command Register to release lock"); // confirm that fabric was successfully initialized - FAPI_DBG("Checking status of FBC init ..."); - FAPI_TRY(fapi2::getScom(i_target, PU_FBC_MODE_REG, l_fbc_mode_data), - "Error reading FBC Mode Register"); - FAPI_ASSERT(l_fbc_mode_data.getBit<PU_FBC_MODE_PB_INITIALIZED_BIT>(), - fapi2::P9_SBE_FABRICINIT_NO_INIT_ERR().set_TARGET(i_target), - "ADU command succeded, but fabric was not initialized!"); + FAPI_DBG("Verifying status of FBC init/stop ..."); + FAPI_TRY(p9_fbc_utils_get_fbc_state(i_target, l_fbc_is_initialized, l_fbc_is_running), + "Error from p9_fbc_utils_get_fbc_state"); + FAPI_ASSERT(l_fbc_is_initialized && l_fbc_is_running, + fapi2::P9_SBE_FABRICINIT_NO_INIT_ERR(). + set_TARGET(i_target). + set_FBC_INITIALIZED(l_fbc_is_initialized). + set_FBC_RUNNING(l_fbc_is_running), + "ADU command succeded, but fabric was not cleanly initialized!"); fapi_try_exit: FAPI_INF("End"); diff --git a/import/chips/p9/procedures/hwp/nest/p9_sbe_fabricinit.H b/import/chips/p9/procedures/hwp/nest/p9_sbe_fabricinit.H index bb7e0046..5c65025c 100755 --- a/import/chips/p9/procedures/hwp/nest/p9_sbe_fabricinit.H +++ b/import/chips/p9/procedures/hwp/nest/p9_sbe_fabricinit.H @@ -1,7 +1,7 @@ /* IBM_PROLOG_BEGIN_TAG */ /* This is an automatically generated prolog. */ /* */ -/* $Source: chips/p9/procedures/hwp/nest/p9_sbe_fabricinit.H $ */ +/* $Source: chips/p9/procedures/ipl/sbe/p9_sbe_fabricinit.H $ */ /* */ /* IBM CONFIDENTIAL */ /* */ @@ -16,7 +16,6 @@ /* deposited with the U.S. Copyright Office. */ /* */ /* IBM_PROLOG_END_TAG */ - /// /// @file p9_sbe_fabricinit.H /// @brief Initialize island-mode fabric configuration (FAPI2) @@ -62,7 +61,7 @@ // *HWP HWP Owner: Joe McGill <jmcgill@us.ibm.com> // *HWP FW Owner: Thi Tran <thi@us.ibm.com> // *HWP Team: Nest -// *HWP Level: 3 +// *HWP Level: 2 // *HWP Consumed by: SBE // |