Skip to content

Commit

Permalink
Added code for exp_getecid and unit tests
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
markypizz authored and crgeddes committed Apr 15, 2019
1 parent ecfbca4 commit 7c4068b
Show file tree
Hide file tree
Showing 13 changed files with 449 additions and 48 deletions.
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2018 */
/* Contributors Listed Below - COPYRIGHT 2018,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -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
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2018 */
/* Contributors Listed Below - COPYRIGHT 2018,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -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
78 changes: 78 additions & 0 deletions src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_getecid.C
Expand Up @@ -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"
32 changes: 32 additions & 0 deletions src/import/chips/ocmb/explorer/procedures/hwp/memory/exp_getecid.H
Expand Up @@ -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
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2018 */
/* Contributors Listed Below - COPYRIGHT 2018,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -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));

Expand Down
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2018 */
/* Contributors Listed Below - COPYRIGHT 2018,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -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>

Expand All @@ -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
Expand All @@ -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;
Expand All @@ -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
Expand All @@ -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)
Expand All @@ -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;
Expand Down

0 comments on commit 7c4068b

Please sign in to comment.