From 2e253cebdaffb92d67fe19999d818e327daca1fb Mon Sep 17 00:00:00 2001 From: Dan Crowell Date: Thu, 17 Jan 2019 08:57:31 -0600 Subject: Interface for OCMB getVPD Add new getVPD interface to support the OCMB chip with the DDIMM SPD. Change-Id: I7bb8b7958aeeaca2fda788b013e9e5e244013c27 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/70596 Tested-by: FSP CI Jenkins Tested-by: Jenkins Server Reviewed-by: STEPHEN GLANCY Tested-by: PPE CI Tested-by: Hostboot CI Reviewed-by: Louis Stermole Reviewed-by: ANDRE A. MARIN Reviewed-by: Jennifer A. Stofer Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/70600 Reviewed-by: RAJA DAS --- src/import/hwpf/fapi2/include/fapi2_vpd_access.H | 71 +++++++++++++++++++--- .../hwpf/fapi2/include/plat/plat_vpd_access.H | 45 ++++++++++++-- src/import/hwpf/fapi2/include/plat/vpd_access.H | 10 ++- src/import/hwpf/fapi2/include/vpd_access_defs.H | 4 +- 4 files changed, 117 insertions(+), 13 deletions(-) (limited to 'src/import/hwpf') diff --git a/src/import/hwpf/fapi2/include/fapi2_vpd_access.H b/src/import/hwpf/fapi2/include/fapi2_vpd_access.H index 0482e74d..d71a2195 100644 --- a/src/import/hwpf/fapi2/include/fapi2_vpd_access.H +++ b/src/import/hwpf/fapi2/include/fapi2_vpd_access.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER sbe Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2016,2018 */ +/* Contributors Listed Below - COPYRIGHT 2016,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -40,7 +40,9 @@ namespace fapi2 { /// constants for VPD Info -constexpr uint64_t VPD_INFO_INVALID = 0xffffffffffffffff; +constexpr uint64_t VPD_INFO_INVALID_64 = 0xffffffffffffffff; +constexpr uint64_t VPD_INFO_INVALID_16 = 0xffff; +constexpr uint64_t VPD_INFO_INVALID_8 = 0xff; /// @brief Specialized class representing required VPDInfo to be used /// in collecting VPD for the MCS target type. @@ -49,13 +51,14 @@ template<> class VPDInfo { public: - // @brief VPDInfo constructor + /// @brief VPDInfo constructor + /// @param[in] Type of VPD data to return VPDInfo( const fapi2::MemVpdData& i_vpd_type) : iv_vpd_type(i_vpd_type), - iv_size(VPD_INFO_INVALID), - iv_freq_mhz(VPD_INFO_INVALID), - iv_rank_count_dimm_0(VPD_INFO_INVALID), - iv_rank_count_dimm_1(VPD_INFO_INVALID), + iv_size(VPD_INFO_INVALID_64), + iv_freq_mhz(VPD_INFO_INVALID_64), + iv_rank_count_dimm_0(VPD_INFO_INVALID_64), + iv_rank_count_dimm_1(VPD_INFO_INVALID_64), iv_is_config_ffdc_enabled(true) {}; // type of vpd field to return @@ -63,12 +66,66 @@ class VPDInfo // size of the vpd data size_t iv_size; + + // frequency of memory bus uint64_t iv_freq_mhz; + + // number of ranks per dimm position uint64_t iv_rank_count_dimm_0; uint64_t iv_rank_count_dimm_1; + + // set to false to avoid collecting a real ReturnCode bool iv_is_config_ffdc_enabled; }; +/// @brief Specialized class representing required VPDInfo to be used +/// in collecting VPD for the OCMB_CHIP target type. +/// @tparam T fapi2::TARGET_TYPE_OCMB_CHIP +template<> +class VPDInfo +{ + public: + /// @brief VPDInfo constructor + /// @param[in] Type of VPD data to return + VPDInfo( const fapi2::MemVpdData& i_vpd_type) + : iv_vpd_type(i_vpd_type), + iv_size(VPD_INFO_INVALID_64), + iv_omi_freq_mhz(VPD_INFO_INVALID_64), + iv_rank_count(VPD_INFO_INVALID_64), + iv_is_config_ffdc_enabled(true), + iv_efd_type(VPD_INFO_INVALID_8), + iv_dmb_mfg_id(VPD_INFO_INVALID_16), + iv_dmb_revision(VPD_INFO_INVALID_8), + iv_ddr_mode(VPD_INFO_INVALID_8) + {}; + + // *** INPUT DATA *** + + // type of vpd field to return + fapi2::MemVpdData_t iv_vpd_type; + + // size of the vpd data in bytes + size_t iv_size; + + // frequency of attached OMI bus + uint64_t iv_omi_freq_mhz; + + // number of master ranks + uint64_t iv_rank_count; + + // set to false to avoid collecting a real ReturnCode + bool iv_is_config_ffdc_enabled; + + + // *** OUTPUT DATA *** + + // metadata describing the EFD data that was returned + uint8_t iv_efd_type; // e.g. byte 288 of DDIMM SPD + uint16_t iv_dmb_mfg_id; // buffer manufacturer + uint8_t iv_dmb_revision; // buffer revision + uint8_t iv_ddr_mode; // DDR4 or DDR5 +}; + /// @brief Return a blob of memory VPD data associated with the input target /// @param[in] i_target a valid fapi2 target diff --git a/src/import/hwpf/fapi2/include/plat/plat_vpd_access.H b/src/import/hwpf/fapi2/include/plat/plat_vpd_access.H index bc82a1d3..430aad87 100644 --- a/src/import/hwpf/fapi2/include/plat/plat_vpd_access.H +++ b/src/import/hwpf/fapi2/include/plat/plat_vpd_access.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER sbe Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2016 */ +/* Contributors Listed Below - COPYRIGHT 2016,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -50,10 +50,47 @@ inline fapi2::ReturnCode platGetVPD(const fapi2::Target& else { o_blob[0] = 111; + } + + return l_rc; +} + +// platform specific for OCMB target -- test code only +inline fapi2::ReturnCode platGetVPD(const fapi2::Target& i_target, + VPDInfo& io_vpd_info, + uint8_t* o_blob) +{ + fapi2::ReturnCode l_rc = fapi2::FAPI2_RC_SUCCESS; + + if( o_blob == nullptr ) + { + io_vpd_info.iv_size = 128; + } + else + { + //-- Implementation Example/Suggestion for 'EFD' -- + // Check byte 2 for DDR4 or DDR5 + // Check bytes 205-206 of SPD for supported speeds + // Look at EFD metadata in 277-415 + // Walk through all present EFD blocks looking for + // a match for speed, rank, channel/position + // Copy entire EFD block into o_blob + // Update output variables with the metadata that + // should be used to decode the block + + if( io_vpd_info.iv_omi_freq_mhz == 25600 ) + { + o_blob[0] = 0x40; + } + else if( io_vpd_info.iv_omi_freq_mhz == 21330 ) + { + o_blob[0] = 0x10; + } - io_vpd_info.iv_freq_mhz = 10000; - io_vpd_info.iv_rank_count_dimm_0 = 1; - io_vpd_info.iv_rank_count_dimm_1 = 8; + io_vpd_info.iv_efd_type = 0x11; + io_vpd_info.iv_dmb_mfg_id = 0x2980; + io_vpd_info.iv_dmb_revision = 0x00; + io_vpd_info.iv_ddr_mode = 0x0C; } diff --git a/src/import/hwpf/fapi2/include/plat/vpd_access.H b/src/import/hwpf/fapi2/include/plat/vpd_access.H index bf8ca7cc..18e8f9cb 100644 --- a/src/import/hwpf/fapi2/include/plat/vpd_access.H +++ b/src/import/hwpf/fapi2/include/plat/vpd_access.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER sbe Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2016 */ +/* Contributors Listed Below - COPYRIGHT 2016,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -47,6 +47,14 @@ template<> fapi2::ReturnCode getVPD(const fapi2::Target& return platGetVPD( i_target, io_vpd_info, o_blob ); } +// specialization for MCS target +template<> fapi2::ReturnCode getVPD(const fapi2::Target& i_target, + VPDInfo& io_vpd_info, + uint8_t* o_blob) +{ + return platGetVPD( i_target, io_vpd_info, o_blob ); +} + }; #endif // _FAPI2_VPDACCESS_H_ diff --git a/src/import/hwpf/fapi2/include/vpd_access_defs.H b/src/import/hwpf/fapi2/include/vpd_access_defs.H index 1f178e41..a7cc7238 100644 --- a/src/import/hwpf/fapi2/include/vpd_access_defs.H +++ b/src/import/hwpf/fapi2/include/vpd_access_defs.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER sbe Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2016 */ +/* Contributors Listed Below - COPYRIGHT 2016,2019 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -44,6 +44,8 @@ enum MemVpdData MP, //! Memory Power related info DQ, //! DQ/DQS pin assignments CK, //! CKE pin assignments + EFD, //! Extended Function Descriptor data for OCMB + BUFFER, //! Buffer data for OCMB }; typedef MemVpdData MemVpdData_t; -- cgit v1.2.1