diff options
author | Mark Pizzutillo <Mark.Pizzutillo@ibm.com> | 2019-02-21 11:08:00 -0500 |
---|---|---|
committer | Christian R. Geddes <crgeddes@us.ibm.com> | 2019-04-15 09:32:55 -0500 |
commit | 7c4068b510e172eb973b8e460ee432e7e8bc8275 (patch) | |
tree | d5200d9aace4e02d593b145333d34676e9b2b171 | |
parent | ecfbca46ab3fba9f66ce242e3c226c6c6e18ce26 (diff) | |
download | talos-hostboot-7c4068b510e172eb973b8e460ee432e7e8bc8275.tar.gz talos-hostboot-7c4068b510e172eb973b8e460ee432e7e8bc8275.zip |
Added code for exp_getecid and unit tests
Change-Id: Id0a8fcf7c28d67c1bcb4ba98ff7af6d94dfa6364
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/74784
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: HWSV CI <hwsv-ci+hostboot@us.ibm.com>
Reviewed-by: STEPHEN GLANCY <sglancy@us.ibm.com>
Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com>
Reviewed-by: Louis Stermole <stermole@us.ibm.com>
Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com>
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/75353
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
13 files changed, 449 insertions, 48 deletions
diff --git a/src/import/chips/ocmb/explorer/common/include/explorer_scom_addresses.H b/src/import/chips/ocmb/explorer/common/include/explorer_scom_addresses.H index 24f03a25f..010b81049 100644 --- a/src/import/chips/ocmb/explorer/common/include/explorer_scom_addresses.H +++ b/src/import/chips/ocmb/explorer/common/include/explorer_scom_addresses.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2018 */ +/* Contributors Listed Below - COPYRIGHT 2018,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -1504,4 +1504,59 @@ static const uint64_t EXPLR_WDF_WMSK static const uint64_t EXPLR_WDF_WSPAR = 0x08012008ull; + +static const uint32_t EXPLR_EFUSE_IMAGE_OUT_0 = 0x20B080ull; + + +static const uint32_t EXPLR_EFUSE_IMAGE_OUT_1 = 0x20B084ull; + + +static const uint32_t EXPLR_EFUSE_IMAGE_OUT_2 = 0x20B088ull; + + +static const uint32_t EXPLR_EFUSE_IMAGE_OUT_3 = 0x20B08Cull; + + +static const uint32_t EXPLR_EFUSE_PE_DATA_0 = 0x20B090ull; + + +static const uint32_t EXPLR_EFUSE_PE_DATA_1 = 0x20B094ull; + + +static const uint32_t EXPLR_EFUSE_PE_DATA_2 = 0x20B098ull; + + +static const uint32_t EXPLR_EFUSE_PE_DATA_3 = 0x20B09Cull; + + +static const uint32_t EXPLR_EFUSE_PE_DATA_4 = 0x20B0A0ull; + + +static const uint32_t EXPLR_EFUSE_PE_DATA_5 = 0x20B0A4ull; + + +static const uint32_t EXPLR_EFUSE_PE_DATA_6 = 0x20B0A8ull; + + +static const uint32_t EXPLR_EFUSE_PE_DATA_8 = 0x20B0ACull; + + +static const uint32_t EXPLR_EFUSE_PE_DATA_9 = 0x20B0B0ull; + + +static const uint32_t EXPLR_EFUSE_PE_DATA_10 = 0x20B0B4ull; + + +static const uint32_t EXPLR_EFUSE_PE_DATA_11 = 0x20B0B8ull; + + +static const uint32_t EXPLR_EFUSE_PE_DATA_12 = 0x20B0BCull; + + +static const uint32_t EXPLR_EFUSE_PE_DATA_13 = 0x20B0C0ull; + + +static const uint32_t EXPLR_EFUSE_PE_DATA_14 = 0x20B0C4ull; + + #endif diff --git a/src/import/chips/ocmb/explorer/common/include/explorer_scom_addresses_fld.H b/src/import/chips/ocmb/explorer/common/include/explorer_scom_addresses_fld.H index 4a55c4d71..5b93db5fb 100644 --- a/src/import/chips/ocmb/explorer/common/include/explorer_scom_addresses_fld.H +++ b/src/import/chips/ocmb/explorer/common/include/explorer_scom_addresses_fld.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2018 */ +/* Contributors Listed Below - COPYRIGHT 2018,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -6950,4 +6950,6 @@ static const uint8_t EXPLR_WDF_WSPAR_CFG_STEERING_R3_LEFT_LEN = static const uint8_t EXPLR_WDF_WSPAR_CFG_STEERING_R3_RIGHT = 35 ; static const uint8_t EXPLR_WDF_WSPAR_CFG_STEERING_R3_RIGHT_LEN = 5 ; +static const uint8_t EXPLR_EFUSE_IMAGE_OUT_0_ENTERPRISE_MODE_DIS = 10 ; + #endif diff --git a/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_getecid.C b/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_getecid.C index 7ab4e58ba..ad20d2e0c 100644 --- a/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_getecid.C +++ b/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_getecid.C @@ -22,3 +22,81 @@ /* permissions and limitations under the License. */ /* */ /* IBM_PROLOG_END_TAG */ + +/// @file exp_getecid.C +/// @brief Gets ECID from explorer fuse registers +/// +/// *HWP HWP Owner: Mark Pizzutillo <Mark.Pizzutillo@ibm.com> +/// *HWP HWP Backup: Andre Marin <aamarin@us.ibm.com> +/// *HWP Team: Memory +/// *HWP Level: 2 +/// *HWP Consumed by: HB + +#include <fapi2.H> +#include <exp_getecid.H> +#include <exp_getecid_utils.H> +#include <lib/shared/exp_consts.H> +#include <explorer_scom_addresses.H> +#include <explorer_scom_addresses_fld.H> +#include <mss_explorer_attribute_setters.H> + +extern "C" +{ + /// + /// @brief getecid procedure for explorer chip + /// @param[in] i_target Explorer OCMB chip + /// @return fapi2:ReturnCode FAPI2_RC_SUCCESS if success, else error code. + /// @note Sets ocmb_ecid, enterprise, half-dimm mode attributes. exp_omi_setup configures the chip with these attributes + /// + fapi2::ReturnCode exp_getecid(const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& i_target) + { + // Using FUSE enterprise_dis bit, determine whether enterprise is disabled, otherwise + // we will enable it. Override to disable it is done in omi_setup. Half_dimm_mode we + // will also disable by default, as it is not a feature of P systems + { + uint8_t l_enterprise_mode = fapi2::ENUM_ATTR_MSS_OCMB_ENTERPRISE_MODE_NON_ENTERPRISE; // 0 + uint8_t l_half_dimm_mode = fapi2::ENUM_ATTR_MSS_OCMB_HALF_DIMM_MODE_FULL_DIMM; // 0 + + FAPI_TRY(mss::exp::ecid::get_enterprise_and_half_dimm_from_fuse( + i_target, l_enterprise_mode, l_half_dimm_mode), + "exp_getecid: getting enterprise and half_dimm from fuse failed on %s", + mss::c_str(i_target)); + + // Set attributes + FAPI_TRY(mss::attr::set_ocmb_enterprise_mode(i_target, l_enterprise_mode), + "exp_getecid: Could not set ATTR_MSS_OCMB_ENTERPRISE_MODE"); + + FAPI_TRY(mss::attr::set_ocmb_half_dimm_mode(i_target, l_half_dimm_mode), + "exp_getecid: Could not set ATTR_MSS_OCMB_HALF_DIMM_MODE"); + } + + // + // Populate OCMB_ECID attribute with: + // EFUSE_IMAGE_OUT[261:64] – Serial number (Wafer ID, number and XY coordinates) + // EFUSE_IMAGE_OUT[263:262] – PSRO + // Each register in the FUSE is 32 bits in size, but only the lower 16 bits are used, Here, we piece together + // each set of lower 16 bits and insert these into the ECID register + // + // TK - Once ATTR_ECID is made large enough, we probably will not need ATTR_OCMB_ECID + // We can remove the call to it below and remove the attribute itself. + // + { + // ECID obtained from register contents + uint16_t l_ecid[mss::exp::ecid_consts::FUSE_ARRAY_SIZE] = {0}; + + FAPI_TRY(mss::exp::ecid::read_from_fuse(i_target, l_ecid), + "exp_getecid: Could not read ecid from FUSE on %s", mss::c_str(i_target)); + + // TK - Remove once ATTR_ECID is made large enough + FAPI_TRY(mss::attr::set_ocmb_ecid(i_target, l_ecid), + "exp_getecid: Could not set ATTR_MSS_OCMB_ECID on %s", mss::c_str(i_target)); + + FAPI_TRY(mss::exp::ecid::set_attr(i_target, l_ecid), + "exp_getecid: Could not set ATTR_ECID on %s", mss::c_str(i_target)); + } + + fapi_try_exit: + return fapi2::current_err; + } + +} // extern "C" diff --git a/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_getecid.H b/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_getecid.H index d749971b0..2ab79973f 100644 --- a/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_getecid.H +++ b/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_getecid.H @@ -22,3 +22,35 @@ /* permissions and limitations under the License. */ /* */ /* IBM_PROLOG_END_TAG */ + +/// +/// @file exp_getecid.H +/// @brief Contains the explorer ECID setup +/// +// *HWP HWP Owner: Mark Pizzutillo <Mark.Pizzutillo@ibm.com> +// *HWP HWP Backup: Stephen Glancy <sglancy@us.ibm.com> +// *HWP Team: Memory +// *HWP Level: 2 +// *HWP Consumed by: Memory + +#ifndef __EXP_GETECID_H_ +#define __EXP_GETECID_H_ + +#include <fapi2.H> + +typedef fapi2::ReturnCode (*exp_getecid_FP_t) (const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>&); + +extern "C" +{ + +/// +/// @brief getecid procedure for explorer chip +/// @param[in] i_target Explorer OCMB chip +/// @return fapi2:ReturnCode FAPI2_RC_SUCCESS if success, else error code. +/// @note Sets ocmb_ecid, enterprise, half-dimm mode attributes. exp_omi_setup configures the chip with these attributes +/// + fapi2::ReturnCode exp_getecid(const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& i_target); + +} // extern "C" + +#endif diff --git a/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_omi_setup.C b/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_omi_setup.C index 2b0413606..e17271c93 100644 --- a/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_omi_setup.C +++ b/src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_omi_setup.C @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2018 */ +/* Contributors Listed Below - COPYRIGHT 2018,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -53,7 +53,7 @@ extern "C" bool l_is_enterprise = false; bool l_is_half_dimm = false; - // Gets the configuration information + // Gets the configuration information from attributes FAPI_TRY(mss::enterprise_mode(i_target, l_is_enterprise)); FAPI_TRY(mss::half_dimm_mode(i_target, l_is_half_dimm)); diff --git a/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/exp_attribute_accessors_manual.H b/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/exp_attribute_accessors_manual.H index ea713830b..04434c84c 100644 --- a/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/exp_attribute_accessors_manual.H +++ b/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/exp_attribute_accessors_manual.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2018 */ +/* Contributors Listed Below - COPYRIGHT 2018,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -39,6 +39,8 @@ #define EXP_ATTR_ACCESS_MANUAL_H_ #include <fapi2.H> +#include <mss_explorer_attribute_getters.H> + #include <generic/memory/lib/utils/c_str.H> #include <generic/memory/lib/utils/find.H> @@ -51,7 +53,8 @@ namespace mss /// @param[out] o_is_enterprise_mode true if the part is in enterprise mode /// @return fapi2::ReturnCode - FAPI2_RC_SUCCESS iff get is OK /// -inline fapi2::ReturnCode enterprise_mode( const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& i_target, +inline fapi2::ReturnCode enterprise_mode( const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& + i_target, bool& o_is_enterprise_mode ) { // Constexprs for beautification @@ -63,8 +66,8 @@ inline fapi2::ReturnCode enterprise_mode( const fapi2::Target<fapi2::TARGET_TYPE uint8_t l_enterprise = 0; uint8_t l_override = 0; - FAPI_TRY( FAPI_ATTR_GET(fapi2::ATTR_MSS_OCMB_ENTERPRISE_MODE, i_target, l_enterprise) ); - FAPI_TRY( FAPI_ATTR_GET(fapi2::ATTR_MSS_OCMB_NONENTERPRISE_MODE_OVERRIDE, i_target, l_override) ); + FAPI_TRY( mss::attr::get_ocmb_enterprise_mode(i_target, l_enterprise) ); + FAPI_TRY( mss::attr::get_ocmb_nonenterprise_mode_override(i_target, l_override) ); { const bool l_enterprise_mode = l_enterprise == ENTERPRISE; @@ -89,7 +92,8 @@ fapi_try_exit: /// @param[out] o_is_half_dimm_mode true if the part is in half-DIMM mode /// @return fapi2::ReturnCode - FAPI2_RC_SUCCESS iff get is OK /// -inline fapi2::ReturnCode half_dimm_mode( const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& i_target, +inline fapi2::ReturnCode half_dimm_mode( const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& + i_target, bool& o_is_half_dimm_mode ) { // Variables @@ -109,7 +113,7 @@ inline fapi2::ReturnCode half_dimm_mode( const fapi2::Target<fapi2::TARGET_TYPE_ } // Now that we're not in enterprise mode, check for overrides - FAPI_TRY( FAPI_ATTR_GET(fapi2::ATTR_MSS_OCMB_HALF_DIMM_MODE_OVERRIDE, i_target, l_override) ); + FAPI_TRY( mss::attr::get_ocmb_half_dimm_mode_override(i_target, l_override) ); // If we have an override, set based upon the override if(l_override != fapi2::ENUM_ATTR_MSS_OCMB_HALF_DIMM_MODE_OVERRIDE_NO_OVERRIDE) @@ -121,7 +125,7 @@ inline fapi2::ReturnCode half_dimm_mode( const fapi2::Target<fapi2::TARGET_TYPE_ } // No override, so go with the attribute derived from the ECID - FAPI_TRY( FAPI_ATTR_GET(fapi2::ATTR_MSS_OCMB_HALF_DIMM_MODE, i_target, l_half_dimm) ); + FAPI_TRY( mss::attr::get_ocmb_half_dimm_mode(i_target, l_half_dimm) ); // Set half DIMM mode based upon the the normal attribute o_is_half_dimm_mode = l_half_dimm == fapi2::ENUM_ATTR_MSS_OCMB_HALF_DIMM_MODE_HALF_DIMM; diff --git a/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/exp_getecid_utils.C b/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/exp_getecid_utils.C index 0dddd27a6..dcef63ec8 100644 --- a/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/exp_getecid_utils.C +++ b/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/exp_getecid_utils.C @@ -22,3 +22,161 @@ /* permissions and limitations under the License. */ /* */ /* IBM_PROLOG_END_TAG */ + +/// @file exp_getecid_utils.C +/// @brief Gets ECID from explorer fuse registers +/// +/// *HWP HWP Owner: Mark Pizzutillo <Mark.Pizzutillo@ibm.com> +/// *HWP HWP Backup: Andre Marin <aamarin@us.ibm.com> +/// *HWP Team: Memory +/// *HWP Level: 2 +/// *HWP Consumed by: HB + +#include <fapi2.H> +#include <lib/i2c/exp_i2c.H> +#include <lib/shared/exp_consts.H> +#include <explorer_scom_addresses.H> +#include <explorer_scom_addresses_fld.H> +#include <mss_explorer_attribute_setters.H> +#include <generic/memory/lib/utils/mss_buffer_utils.H> + + +namespace mss +{ +namespace exp +{ +namespace ecid +{ + +/// +/// @brief Determines enterprise and half dimm states from explorer FUSE +/// @param[in] i_target the controller +/// @param[out] o_enterprise_mode state +/// @param[out] o_half_dimm_mode state +/// @return FAPI2_RC_SUCCESS iff ok +/// +fapi2::ReturnCode get_enterprise_and_half_dimm_from_fuse( + const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& i_target, + uint8_t& o_enterprise_mode, + uint8_t& o_half_dimm_mode) +{ + fapi2::buffer<uint64_t> l_reg_resp_buffer; + FAPI_TRY(fapi2::getScom( i_target, static_cast<uint64_t>(EXPLR_EFUSE_IMAGE_OUT_0), l_reg_resp_buffer ), + "exp_getecid: could not read explorer fuse register 0x%08x", EXPLR_EFUSE_IMAGE_OUT_0); + + // Default to disabled + o_enterprise_mode = fapi2::ENUM_ATTR_MSS_OCMB_ENTERPRISE_MODE_NON_ENTERPRISE; // 0 + + // If we support enterprise mode, enable it until otherwise overridden in OMI_SETUP + if(!l_reg_resp_buffer.getBit < EXPLR_EFUSE_IMAGE_OUT_0_ENTERPRISE_MODE_DIS + + mss::exp::ecid_consts::REG_BIT_OFFSET > ()) + { + o_enterprise_mode = fapi2::ENUM_ATTR_MSS_OCMB_ENTERPRISE_MODE_ENTERPRISE; // 1, enabled + } + + // half_dimm_mode will remain disabled for P systems + o_half_dimm_mode = fapi2::ENUM_ATTR_MSS_OCMB_HALF_DIMM_MODE_FULL_DIMM; // 0, disabled + +fapi_try_exit: + return fapi2::current_err; +} + +/// +/// @brief Reads ECID into output array from fuse +/// @param[in] i_target the controller +/// @param[out] o_array ECID contents +/// @return FAPI2_RC_SUCCESS iff ok +/// +fapi2::ReturnCode read_from_fuse( + const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& i_target, + uint16_t (&o_ecid_array)[mss::exp::ecid_consts::FUSE_ARRAY_SIZE]) +{ + + // FUSE registers mapping to the above bit-structure + static constexpr uint64_t l_ecid_regs[mss::exp::ecid_consts::FUSE_ARRAY_SIZE] = + { + EXPLR_EFUSE_PE_DATA_0, + EXPLR_EFUSE_PE_DATA_1, + EXPLR_EFUSE_PE_DATA_2, + EXPLR_EFUSE_PE_DATA_3, + EXPLR_EFUSE_PE_DATA_4, + EXPLR_EFUSE_PE_DATA_5, + EXPLR_EFUSE_PE_DATA_6, // PE_DATA_7 does not exist + EXPLR_EFUSE_PE_DATA_8, + EXPLR_EFUSE_PE_DATA_9, + EXPLR_EFUSE_PE_DATA_10, + EXPLR_EFUSE_PE_DATA_11, + EXPLR_EFUSE_PE_DATA_12, + EXPLR_EFUSE_PE_DATA_13, + EXPLR_EFUSE_PE_DATA_14 + }; + + fapi2::buffer<uint64_t> l_efuse_contents; + static constexpr uint32_t START_BIT = 48; // Last 16 bits + + for (uint16_t l_pe_reg = 0; l_pe_reg < mss::exp::ecid_consts::FUSE_ARRAY_SIZE; ++l_pe_reg) + { + l_efuse_contents.flush<0>(); + + // Assuming this will fall back to I2C. + FAPI_TRY(fapi2::getScom( i_target, l_ecid_regs[l_pe_reg], l_efuse_contents ), + "exp_getecid: could not read explorer fuse register 0x%08x", l_ecid_regs[l_pe_reg]); + + // Each EFUSE register in question looks like this according to the spec: + // + // BIT FUNCTION + // 31:16 Unused + // 15:0 EFUSE_IMAGE_OUT [HIGH:LOW] + // + // So, we are expecting the data in question to be in the right-most 16 bits. + l_efuse_contents.extract<START_BIT, mss::exp::ecid_consts::DATA_IN_SIZE>(o_ecid_array[l_pe_reg]); + } + +fapi_try_exit: + return fapi2::current_err; +} + +/// +/// @brief Stores ECID in ATTR_ECID +/// @param[in] i_target the controller +/// @param[in] i_ecid 16-bit array of ECID contents +/// @return FAPI2_RC_SUCCESS iff ok +/// +fapi2::ReturnCode set_attr( + const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& i_target, + const uint16_t i_ecid[mss::exp::ecid_consts::FUSE_ARRAY_SIZE]) +{ + + // + // TK - ATTR_ECID is only two 64-bit integers, but our OCMB ECID is larger. + // Per Dan Crowell, there are plans in the future to make ATTR_ECID larger + // This will need to be updated once that is changed. Currently, this is + // only storing the first 128 bits of the ECID. + // + // TK - Once the above is implemented, we no longer need ATTR_OCMB_ECID (see exp_getecid.C) + // + + // ATTR_ECID is an array of 2 64-bit integers + uint64_t l_attr_ecid[mss::exp::ecid_consts::ATTR_ECID_SIZE] = {0}; + + fapi2::buffer<uint64_t> l_constructed_ecid; + + // Build 64 bit ECID from right to left (from lowest to highest) + // Places l_ecid[0] in 48:64, l_ecid[1] in 32:48, etc. + mss::right_aligned_insert(l_constructed_ecid, i_ecid[3], i_ecid[2], i_ecid[1], i_ecid[0]); + l_attr_ecid[0] = l_constructed_ecid; + l_constructed_ecid.flush<0>(); + + // Places l_ecid[4] in 48:64, l_ecid[5] in 32:48, etc. + mss::right_aligned_insert(l_constructed_ecid, i_ecid[7], i_ecid[6], i_ecid[5], i_ecid[4]); + l_attr_ecid[1] = l_constructed_ecid; + + FAPI_TRY(FAPI_ATTR_SET(fapi2::ATTR_ECID, i_target, l_attr_ecid), + "exp_getecid: Could not set ATTR_ECID on %s", mss::c_str(i_target) ); + +fapi_try_exit: + return fapi2::current_err; +} +} // ecid +} // exp +} // mss diff --git a/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/exp_getecid_utils.H b/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/exp_getecid_utils.H index 0b4e34293..cb8600c04 100644 --- a/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/exp_getecid_utils.H +++ b/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/exp_getecid_utils.H @@ -22,3 +22,64 @@ /* permissions and limitations under the License. */ /* */ /* IBM_PROLOG_END_TAG */ + +/// +/// @file exp_getecid_utils.H +/// @brief Utils to set ECID attributes according to FUSE registers +/// +// *HWP HWP Owner: Mark Pizzutillo <aamarin@us.ibm.com> +// *HWP HWP Backup: Andre Marin <aamarin@us.ibm.com> +// *HWP Team: Memory +// *HWP Level: 2 +// *HWP Consumed by: FSP:HB + +#ifndef __MSS_EXP_GETECID_UTILS__ +#define __MSS_EXP_GETECID_UTILS__ + +#include <fapi2.H> +#include <lib/shared/exp_consts.H> + +namespace mss +{ +namespace exp +{ +namespace ecid +{ + +/// +/// @brief Determines enterprise and half dimm states from explorer FUSE +/// @param[in] i_target the controller +/// @param[out] o_enterprise_mode state +/// @param[out] o_half_dimm_mode state +/// @return FAPI2_RC_SUCCESS iff ok +/// +fapi2::ReturnCode get_enterprise_and_half_dimm_from_fuse( + const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& i_target, + uint8_t& o_enterprise_mode, + uint8_t& o_half_dimm_mode); + +/// +/// @brief Reads ECID into output array from fuse +/// @param[in] i_target the controller +/// @param[out] o_array ECID contents +/// @return FAPI2_RC_SUCCESS iff ok +/// +fapi2::ReturnCode read_from_fuse( + const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& i_target, + uint16_t (&o_ecid_array)[mss::exp::ecid_consts::FUSE_ARRAY_SIZE]); + +/// +/// @brief Stores ECID in ATTR_ECID +/// @param[in] i_target the controller +/// @param[in] i_ecid 16-bit array of ECID contents +/// @return FAPI2_RC_SUCCESS iff ok +/// +fapi2::ReturnCode set_attr( + const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& i_target, + const uint16_t i_ecid[mss::exp::ecid_consts::FUSE_ARRAY_SIZE]); + +} +}// exp +}// mss + +#endif diff --git a/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/omi/exp_omi_utils.H b/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/omi/exp_omi_utils.H index 318de6bf2..1faf02014 100644 --- a/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/omi/exp_omi_utils.H +++ b/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/omi/exp_omi_utils.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2018 */ +/* Contributors Listed Below - COPYRIGHT 2018,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -36,6 +36,8 @@ #define EXP_OMI_UTILS_H_ #include <fapi2.H> +#include <explorer_scom_addresses.H> +#include <explorer_scom_addresses_fld.H> #include <generic/memory/lib/utils/c_str.H> namespace mss @@ -45,29 +47,6 @@ namespace exp namespace omi { -/// -/// @brief Constants used for the OMI register fields -/// -// TODO:RTC196850 Update Explorer code to use actual register addresses/names -enum fields -{ - // Bit we set to put ourselves into enterprise mode - ENTERPRISE_SET_BIT = 0, - HALF_DIMM_MODE = 1, - // How the HW is actually configured in enterprise mode - ENTERPRISE_BIT_CONFIG = 2, -}; - -/// -/// @brief Constants used for the OMI registers -/// -// TODO:RTC196850 Update Explorer code to use actual register addresses/names -enum registers -{ - // Bit we set to put ourselves into enterprise mode - MENTERP = 0x080108e4, -}; - /////////////////////////////////////////////////////////////////////////////////// /// Bit Field Operations /////////////////////////////////////////////////////////////////////////////////// @@ -79,7 +58,7 @@ enum registers /// inline bool get_enterprise_set_bit( const fapi2::buffer<uint64_t>& i_data ) { - return i_data.getBit<fields::ENTERPRISE_SET_BIT>(); + return i_data.getBit<EXPLR_MMIO_MENTERP_MMIO_ENTERPRISE_MODE>(); } /// @@ -89,7 +68,7 @@ inline bool get_enterprise_set_bit( const fapi2::buffer<uint64_t>& i_data ) /// inline void set_enterprise_set_bit( fapi2::buffer<uint64_t>& io_data, const bool i_is_enterprise ) { - io_data.writeBit<fields::ENTERPRISE_SET_BIT>(i_is_enterprise); + io_data.writeBit<EXPLR_MMIO_MENTERP_MMIO_ENTERPRISE_MODE>(i_is_enterprise); } /// @@ -99,7 +78,7 @@ inline void set_enterprise_set_bit( fapi2::buffer<uint64_t>& io_data, const bool /// inline bool get_half_dimm_mode( const fapi2::buffer<uint64_t>& i_data ) { - return i_data.getBit<fields::HALF_DIMM_MODE>(); + return i_data.getBit<EXPLR_MMIO_MENTERP_HALF_DIMM_MODE>(); } /// @@ -109,7 +88,7 @@ inline bool get_half_dimm_mode( const fapi2::buffer<uint64_t>& i_data ) /// inline void set_half_dimm_mode( fapi2::buffer<uint64_t>& io_data, const bool i_is_half_dimm_mode ) { - io_data.writeBit<fields::HALF_DIMM_MODE>(i_is_half_dimm_mode); + io_data.writeBit<EXPLR_MMIO_MENTERP_HALF_DIMM_MODE>(i_is_half_dimm_mode); } // Note: ENTERPRISE_BIT_CONFIG is a Read only bit, so no setting it @@ -121,7 +100,7 @@ inline void set_half_dimm_mode( fapi2::buffer<uint64_t>& io_data, const bool i_i /// inline bool get_enterprise_config( const fapi2::buffer<uint64_t>& i_data ) { - return i_data.getBit<fields::ENTERPRISE_BIT_CONFIG>(); + return i_data.getBit<EXPLR_MMIO_MENTERP_CFG_ENTERPRISE_MODE>(); } /// @@ -163,7 +142,7 @@ fapi_try_exit: inline fapi2::ReturnCode read_enterprise_config( const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& i_target, fapi2::buffer<uint64_t>& o_data ) { - return fapi2::getScom(i_target, registers::MENTERP, o_data); + return fapi2::getScom(i_target, EXPLR_MMIO_MENTERP, o_data); } /// @@ -175,7 +154,7 @@ inline fapi2::ReturnCode read_enterprise_config( const fapi2::Target<fapi2::TARG inline fapi2::ReturnCode write_enterprise_config( const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& i_target, const fapi2::buffer<uint64_t>& i_data ) { - return fapi2::putScom(i_target, registers::MENTERP, i_data); + return fapi2::putScom(i_target, EXPLR_MMIO_MENTERP, i_data); } namespace train diff --git a/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/shared/exp_consts.H b/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/shared/exp_consts.H index 0855fc102..3e514ff99 100644 --- a/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/shared/exp_consts.H +++ b/src/import/chips/ocmb/explorer/procedures/hwp/memory/lib/shared/exp_consts.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2018 */ +/* Contributors Listed Below - COPYRIGHT 2018,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -104,6 +104,19 @@ enum ffdc_codes SET_SPD_CL_SUPPORTED = 0x1051, }; +/// +/// @brief constants for getecid procedure +/// +enum ecid_consts +{ + FUSE_ARRAY_SIZE = 14, + DATA_IN_SIZE = 16, + // TK - Will need to be changed once ATTR_ECID is made larger + ATTR_ECID_SIZE = 2, + // 32 bit registers with getScom/putScom use the right-most 32 bits + REG_BIT_OFFSET = 32, +}; + namespace i2c { diff --git a/src/import/chips/ocmb/explorer/procedures/xml/attribute_info/exp_attributes.xml b/src/import/chips/ocmb/explorer/procedures/xml/attribute_info/exp_attributes.xml index bbadf19b1..e19cfe5be 100644 --- a/src/import/chips/ocmb/explorer/procedures/xml/attribute_info/exp_attributes.xml +++ b/src/import/chips/ocmb/explorer/procedures/xml/attribute_info/exp_attributes.xml @@ -5,7 +5,7 @@ <!-- --> <!-- OpenPOWER HostBoot Project --> <!-- --> -<!-- Contributors Listed Below - COPYRIGHT 2018 --> +<!-- Contributors Listed Below - COPYRIGHT 2018,2019 --> <!-- [+] International Business Machines Corp. --> <!-- --> <!-- --> @@ -294,4 +294,17 @@ <writeable/> </attribute> + <attribute> + <id>ATTR_MSS_OCMB_ECID</id> + <targetType>TARGET_TYPE_OCMB_CHIP</targetType> + <description> + ECID of the chip as determined by the IPL getecid procedure. + </description> + <initToZero></initToZero> + <valueType>uint16</valueType> + <array>14</array> + <writeable/> + <mssAccessorName>ocmb_ecid</mssAccessorName> + </attribute> + </attributes> diff --git a/src/import/chips/p9/procedures/xml/attribute_info/pervasive_attributes.xml b/src/import/chips/p9/procedures/xml/attribute_info/pervasive_attributes.xml index 969e9bee0..92286ce9a 100755 --- a/src/import/chips/p9/procedures/xml/attribute_info/pervasive_attributes.xml +++ b/src/import/chips/p9/procedures/xml/attribute_info/pervasive_attributes.xml @@ -5,7 +5,7 @@ <!-- --> <!-- OpenPOWER HostBoot Project --> <!-- --> -<!-- Contributors Listed Below - COPYRIGHT 2015,2018 --> +<!-- Contributors Listed Below - COPYRIGHT 2015,2019 --> <!-- [+] International Business Machines Corp. --> <!-- --> <!-- --> @@ -311,9 +311,13 @@ <attribute> <id>ATTR_ECID</id> - <targetType>TARGET_TYPE_PROC_CHIP,TARGET_TYPE_MEMBUF_CHIP</targetType> - <description>Bits 0 to 63 of the ECID in array entry 0 and bits 64 to 127 in ECID array entry 1 - Populated by HWP called during IPL.</description> + <targetType>TARGET_TYPE_PROC_CHIP, TARGET_TYPE_MEMBUF_CHIP, TARGET_TYPE_OCMB_CHIP</targetType> + <description>Populated by HWP called during IPL. + PROC, MEMBUF: Bits 0 to 63 of the ECID in array entry 0 and bits 64 to 127 in ECID array entry 1 + OCMB: Explorer: Data Inserted HIGH:LOW, ex. ATTR_ECID[0] = [PE_DATA_3:PE_DATA_2:PE_DATA_1:PE_DATA_0] + OCMB: Gemini: 64-bit ECID inserted in ATTR_ECID[0] + TK/FIXME/TODO: This needs to be made larger to support the entire Explorer ECID. + </description> <valueType>uint64</valueType> <writeable/> <odmVisable/> diff --git a/src/usr/isteps/istep12/makefile b/src/usr/isteps/istep12/makefile index 9cfbde1fa..3047e041c 100644 --- a/src/usr/isteps/istep12/makefile +++ b/src/usr/isteps/istep12/makefile @@ -32,6 +32,7 @@ P9_INITFILE_PATH = $(P9_PROCEDURES_PATH)/hwp/initfiles P9A_MSS_HWP_PATH = ${ROOTPATH}/src/import/chips/p9a/procedures/hwp/memory/ EXPLORER_HWP_PATH = ${ROOTPATH}/src/import/chips/ocmb/explorer/procedures/hwp/memory/ +EXPLORER_INC_PATH = ${ROOTPATH}/src/import/chips/ocmb/explorer/common/include/ EXPLORER_OMI_HWP_PATH = ${EXPLORER_HWP_PATH}/lib/omi CENT_PROC_PATH = ${ROOTPATH}/src/import/chips/centaur/procedures @@ -60,6 +61,7 @@ EXTRAINCDIR += $(CENT_INITFILE_PATH) EXTRAINCDIR += $(CENT_IO_HWP_PATH) EXTRAINCDIR += ${P9A_MSS_HWP_PATH} EXTRAINCDIR += ${EXPLORER_HWP_PATH} +EXTRAINCDIR += ${EXPLORER_INC_PATH} VPATH += $(P9_NEST_HWP_PATH) VPATH += $(P9_PERV_HWP_PATH) |