summaryrefslogtreecommitdiffstats
path: root/src/import
diff options
context:
space:
mode:
Diffstat (limited to 'src/import')
-rw-r--r--src/import/chips/ocmb/gemini/procedures/hwp/memory/00gem_common.mk16
-rw-r--r--src/import/chips/ocmb/gemini/procedures/hwp/memory/gem_draminit.C33
-rw-r--r--src/import/chips/ocmb/gemini/procedures/hwp/memory/gem_draminit.H31
-rw-r--r--src/import/chips/ocmb/gemini/procedures/hwp/memory/gem_draminit.mk7
-rw-r--r--src/import/chips/ocmb/gemini/procedures/hwp/memory/gem_getecid.C38
-rw-r--r--src/import/chips/ocmb/gemini/procedures/hwp/memory/gem_getecid.H21
-rw-r--r--src/import/chips/ocmb/gemini/procedures/hwp/memory/gem_getecid.mk5
-rw-r--r--src/import/chips/ocmb/gemini/procedures/hwp/memory/lib/gem_draminit_utils.C99
-rw-r--r--src/import/chips/ocmb/gemini/procedures/hwp/memory/lib/gem_draminit_utils.H39
-rw-r--r--src/import/chips/ocmb/gemini/procedures/hwp/memory/lib/mss_gemini.mk30
-rw-r--r--src/import/chips/ocmb/gemini/procedures/xml/error_info/gem_draminit_errors.xml27
-rw-r--r--src/import/generic/memory/lib/utils/find.H1
12 files changed, 347 insertions, 0 deletions
diff --git a/src/import/chips/ocmb/gemini/procedures/hwp/memory/00gem_common.mk b/src/import/chips/ocmb/gemini/procedures/hwp/memory/00gem_common.mk
index 15fcba892..579195632 100644
--- a/src/import/chips/ocmb/gemini/procedures/hwp/memory/00gem_common.mk
+++ b/src/import/chips/ocmb/gemini/procedures/hwp/memory/00gem_common.mk
@@ -22,3 +22,19 @@
# permissions and limitations under the License.
#
# IBM_PROLOG_END_TAG
+
+MSS_GEM_INCLUDES := $(GENPATH)
+MSS_GEM_INCLUDES += $(ROOTPATH)
+MSS_GEM_INCLUDES += $(ROOTPATH)/chips/ocmb/gemini/procedures/hwp/memory/
+MSS_GEM_INCLUDES += $(ROOTPATH)/chips/ocmb/gemini/procedures/hwp/memory/lib/
+MSS_GEM_INCLUDES += $(ROOTPATH)/chips/ocmb/explorer/common/include
+MSS_GEM_INCLUDES += $(ROOTPATH)/chips/ocmb/explorer/procedures/hwp/memory/
+MSS_GEM_INCLUDES += $(ROOTPATH)/chips/ocmb/explorer/procedures/hwp/memory/lib/i2c
+MSS_GEM_INCLUDES += $(ROOTPATH)/chips/ocmb/explorer/procedures/hwp/memory/lib/
+MSS_GEM_INCLUDES += $(ROOTPATH)/generic/memory/lib
+
+CATCH_UNIT_TESTS_INCLUDES := $(ROOTPATH)/hwpf/fapi2/test
+
+# ADD_EXP_MEMORY_INCDIRS
+# This macro will add additional include paths for all memory modules
+ADD_GEM_MEMORY_INCDIRS = $(call __ADD_MODULE_INCDIR,$(1),$(MSS_GEM_INCLUDES))
diff --git a/src/import/chips/ocmb/gemini/procedures/hwp/memory/gem_draminit.C b/src/import/chips/ocmb/gemini/procedures/hwp/memory/gem_draminit.C
index 548ee2de6..40aeb9b6f 100644
--- a/src/import/chips/ocmb/gemini/procedures/hwp/memory/gem_draminit.C
+++ b/src/import/chips/ocmb/gemini/procedures/hwp/memory/gem_draminit.C
@@ -22,3 +22,36 @@
/* permissions and limitations under the License. */
/* */
/* IBM_PROLOG_END_TAG */
+
+///
+/// @file gem_draminit.C
+/// @brief Procedure definition to initialize DRAM
+///
+// *HWP HWP Owner: Mark Pizzutillo <Mark.Pizzutillo@us.ibm.com>
+// *HWP HWP Backup: Andre Marin <aamarin@us.ibm.com>
+// *HWP Team: Memory
+// *HWP Level: 2
+// *HWP Consumed by: FSP:HB
+
+#include <fapi2.H>
+#include <lib/gem_draminit_utils.H>
+
+extern "C"
+{
+ ///
+ /// @brief Initializes DRAM
+ /// @param[in] i_target the OCMB chip (Gemini)
+ /// @return FAPI2_RC_SUCCESS iff ok, else fapi2::current_err
+ ///
+ fapi2::ReturnCode gem_draminit(const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& i_target)
+ {
+ FAPI_TRY(mss::gem::gem_draminit_check_memory_size(i_target));
+ FAPI_TRY(mss::gem::gem_draminit_poll_check_calibration(i_target));
+
+ return fapi2::FAPI2_RC_SUCCESS;
+
+ fapi_try_exit:
+ return fapi2::current_err;
+ }
+
+} // extern "C"
diff --git a/src/import/chips/ocmb/gemini/procedures/hwp/memory/gem_draminit.H b/src/import/chips/ocmb/gemini/procedures/hwp/memory/gem_draminit.H
index 61da5bde8..bfe86b631 100644
--- a/src/import/chips/ocmb/gemini/procedures/hwp/memory/gem_draminit.H
+++ b/src/import/chips/ocmb/gemini/procedures/hwp/memory/gem_draminit.H
@@ -22,3 +22,34 @@
/* permissions and limitations under the License. */
/* */
/* IBM_PROLOG_END_TAG */
+
+///
+/// @file gem_draminit.H
+/// @brief Procedure definition to initialize DRAM
+///
+// *HWP HWP Owner: Mark Pizzutillo <Mark.Pizzutillo@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_GEM_DRAMINIT__
+#define __MSS_GEM_DRAMINIT__
+
+#include <fapi2.H>
+
+// Required for Cronus
+typedef fapi2::ReturnCode (*gem_draminit_FP_t) (const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>&);
+
+extern "C"
+{
+
+///
+/// @brief Initializes DRAM
+/// @param[in] i_target the controller
+/// @return FAPI2_RC_SUCCESS iff ok
+///
+ fapi2::ReturnCode gem_draminit(const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& i_target);
+
+}// extern C
+#endif
diff --git a/src/import/chips/ocmb/gemini/procedures/hwp/memory/gem_draminit.mk b/src/import/chips/ocmb/gemini/procedures/hwp/memory/gem_draminit.mk
index 84a97f3ab..ea64e2617 100644
--- a/src/import/chips/ocmb/gemini/procedures/hwp/memory/gem_draminit.mk
+++ b/src/import/chips/ocmb/gemini/procedures/hwp/memory/gem_draminit.mk
@@ -22,3 +22,10 @@
# permissions and limitations under the License.
#
# IBM_PROLOG_END_TAG
+
+# Include the macros and things for MSS GEMINI procedures
+-include 00gem_common.mk
+
+PROCEDURE=gem_draminit
+$(eval $(call ADD_GEM_MEMORY_INCDIRS,$(PROCEDURE)))
+$(call BUILD_PROCEDURE)
diff --git a/src/import/chips/ocmb/gemini/procedures/hwp/memory/gem_getecid.C b/src/import/chips/ocmb/gemini/procedures/hwp/memory/gem_getecid.C
index 8deac2c76..892c85904 100644
--- a/src/import/chips/ocmb/gemini/procedures/hwp/memory/gem_getecid.C
+++ b/src/import/chips/ocmb/gemini/procedures/hwp/memory/gem_getecid.C
@@ -22,3 +22,41 @@
/* permissions and limitations under the License. */
/* */
/* IBM_PROLOG_END_TAG */
+
+#include <fapi2.H>
+#include <gem_getecid.H>
+#include <mss_explorer_attribute_setters.H>
+
+extern "C"
+{
+
+ ///
+ /// @brief Gets gemini ECID
+ /// @param[in] i_target the controller
+ /// @return FAPI2_RC_SUCCESS iff ok
+ ///
+ fapi2::ReturnCode gem_getecid(const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& i_target)
+ {
+ // Address defined here as gemini SCOM address library does not exist
+ static constexpr uint64_t GEMINI_ECID_REGISTER = 0x0801240E;
+ fapi2::buffer<uint64_t> l_data_buffer;
+
+ FAPI_TRY(fapi2::getScom(i_target, GEMINI_ECID_REGISTER, l_data_buffer),
+ "Failed getScom() for %s", mss::spd::c_str(i_target));
+
+ {
+ // Set ATTR_ECID
+ // TK - Update once ATTR_ECID array size is updated to be larger than 2
+ static constexpr uint32_t ECID_ARRAY_SIZE = 2;
+ uint64_t l_attr_ecid[ECID_ARRAY_SIZE] = {l_data_buffer, 0};
+
+ 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) );
+ }
+
+ // omi_setup not used by GEMINI, so not setting ocmb enterprise mode and half-dimm mode attributes
+
+ fapi_try_exit:
+ return fapi2::current_err;
+ }
+} // extern "C"
diff --git a/src/import/chips/ocmb/gemini/procedures/hwp/memory/gem_getecid.H b/src/import/chips/ocmb/gemini/procedures/hwp/memory/gem_getecid.H
index 20b8d4bb6..3ee0d7403 100644
--- a/src/import/chips/ocmb/gemini/procedures/hwp/memory/gem_getecid.H
+++ b/src/import/chips/ocmb/gemini/procedures/hwp/memory/gem_getecid.H
@@ -22,3 +22,24 @@
/* permissions and limitations under the License. */
/* */
/* IBM_PROLOG_END_TAG */
+
+#ifndef __MSS_GEM_GETECID__
+#define __MSS_GEM_GETECID__
+
+#include <fapi2.H>
+
+// Required for Cronus
+typedef fapi2::ReturnCode (*gem_getecid_FP_t) (const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>&);
+
+extern "C"
+{
+
+///
+/// @brief Gets gemini ECID
+/// @param[in] i_target the controller
+/// @return FAPI2_RC_SUCCESS iff ok
+///
+ fapi2::ReturnCode gem_getecid(const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& i_target);
+
+}// extern C
+#endif
diff --git a/src/import/chips/ocmb/gemini/procedures/hwp/memory/gem_getecid.mk b/src/import/chips/ocmb/gemini/procedures/hwp/memory/gem_getecid.mk
index 339fd149e..efd3e49a3 100644
--- a/src/import/chips/ocmb/gemini/procedures/hwp/memory/gem_getecid.mk
+++ b/src/import/chips/ocmb/gemini/procedures/hwp/memory/gem_getecid.mk
@@ -22,3 +22,8 @@
# permissions and limitations under the License.
#
# IBM_PROLOG_END_TAG
+-include 00gemini_common.mk
+
+PROCEDURE=gem_getecid
+$(eval $(call ADD_GEM_MEMORY_INCDIRS,$(PROCEDURE)))
+$(call BUILD_PROCEDURE)
diff --git a/src/import/chips/ocmb/gemini/procedures/hwp/memory/lib/gem_draminit_utils.C b/src/import/chips/ocmb/gemini/procedures/hwp/memory/lib/gem_draminit_utils.C
index c9f1a9b63..460727073 100644
--- a/src/import/chips/ocmb/gemini/procedures/hwp/memory/lib/gem_draminit_utils.C
+++ b/src/import/chips/ocmb/gemini/procedures/hwp/memory/lib/gem_draminit_utils.C
@@ -22,3 +22,102 @@
/* permissions and limitations under the License. */
/* */
/* IBM_PROLOG_END_TAG */
+///
+/// @file gem_draminit_utils.C
+/// @brief Procedure definition to initialize DRAM
+///
+// *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: FSP:HB
+
+#include <generic/memory/lib/utils/find.H>
+#include <generic/memory/lib/utils/c_str.H>
+#include <generic/memory/lib/utils/poll.H>
+#include <mss_generic_attribute_getters.H>
+#include <generic/memory/lib/utils/count_dimm.H>
+#include <mss_generic_attribute_setters.H>
+#include <lib/gem_draminit_utils.H>
+
+namespace mss
+{
+namespace gem
+{
+
+///
+/// @brief Checks that DIMM sizes are 32GB
+/// @param[in] i_target the controller
+/// @return FAPI2_RC_SUCCESS iff ok
+///
+fapi2::ReturnCode gem_draminit_check_memory_size(const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& i_target)
+{
+ if (mss::count_dimm(i_target) == 0)
+ {
+ FAPI_INF("NO DIMM on %s", mss::spd::c_str(i_target));
+ return fapi2::FAPI2_RC_SUCCESS;
+ }
+
+ uint32_t l_dimm_size = 0;
+
+ constexpr uint32_t MEMORY_SIZE = 32; // GB
+
+ // Verify 32GB memory size for each DIMM.
+ for (const auto& l_dimm : mss::find_targets<fapi2::TARGET_TYPE_DIMM>(i_target))
+ {
+ //Function get_dimm_size returns in GB
+ FAPI_TRY(mss::attr::get_dimm_size(l_dimm, l_dimm_size), "Failed get_dimm_size() for %s", mss::spd::c_str(i_target));
+
+ FAPI_ASSERT(l_dimm_size == MEMORY_SIZE, fapi2::MSS_GEM_DRAMINIT_DIMM_SIZE_DOESNT_MATCH()
+ .set_TARGET(i_target)
+ .set_DIMM(l_dimm)
+ .set_SIZE_RETURNED(l_dimm_size), "Invalid DIMM size. Received size (%lu) for target DIMM %s", l_dimm_size,
+ mss::spd::c_str(l_dimm));
+ }
+
+fapi_try_exit:
+ return fapi2::current_err;
+}
+
+///
+/// @brief Polls DRAM calibration register to check for complete
+/// @param[in] i_target the controller
+/// @return FAPI2_RC_SUCCESS iff ok
+///
+fapi2::ReturnCode gem_draminit_poll_check_calibration(const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& i_target)
+{
+ // Address defined here as gemini SCOM address library does not exist
+ constexpr uint64_t GEMINI_CALIBRATION_STATUS_ADDR = 0x08012428;
+ const uint64_t GEMINI_CALIBRATION_STATUS_BIT_1 = 0x0;
+ const uint64_t GEMINI_CALIBRATION_STATUS_BIT_2 = 0x1;
+
+ // Using default parameters
+ mss::poll_parameters l_poll_params;
+
+ fapi2::buffer<uint64_t> l_data_buffer;
+
+ bool l_poll_success =
+ mss::poll(i_target, GEMINI_CALIBRATION_STATUS_ADDR, l_poll_params,
+ [&l_data_buffer](const size_t poll_remaining, const fapi2::buffer<uint64_t>& stat_reg) -> bool
+ {
+ FAPI_DBG("Polling: Gemini calibration status 0x%llx, remaining: %d", stat_reg, poll_remaining);
+ l_data_buffer = stat_reg;
+
+ return l_data_buffer.getBit<GEMINI_CALIBRATION_STATUS_BIT_1>()
+ && l_data_buffer.getBit<GEMINI_CALIBRATION_STATUS_BIT_2>();
+ });
+
+ FAPI_ASSERT(l_poll_success == true,
+ fapi2::MSS_GEM_DRAMINIT_CALIBRATION_DID_NOT_COMPLETE()
+ .set_OCMB_TARGET(i_target)
+ .set_TARGET(i_target)
+ .set_REGISTER(GEMINI_CALIBRATION_STATUS_ADDR), "Calibration did not complete for target %s",
+ mss::spd::c_str(i_target));
+
+fapi_try_exit:
+ return fapi2::current_err;
+
+}
+
+}// exp
+}// mss
diff --git a/src/import/chips/ocmb/gemini/procedures/hwp/memory/lib/gem_draminit_utils.H b/src/import/chips/ocmb/gemini/procedures/hwp/memory/lib/gem_draminit_utils.H
index 346eabb40..5091d06d1 100644
--- a/src/import/chips/ocmb/gemini/procedures/hwp/memory/lib/gem_draminit_utils.H
+++ b/src/import/chips/ocmb/gemini/procedures/hwp/memory/lib/gem_draminit_utils.H
@@ -22,3 +22,42 @@
/* permissions and limitations under the License. */
/* */
/* IBM_PROLOG_END_TAG */
+
+///
+/// @file gem_draminit_utils.H
+/// @brief Procedure definition to initialize DRAM
+///
+// *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_GEM_DRAMINIT_UTILS__
+#define __MSS_GEM_DRAMINIT_UTILS__
+
+#include <fapi2.H>
+
+namespace mss
+{
+namespace gem
+{
+
+///
+/// @brief Checks that DIMM sizes are 32GB
+/// @param[in] i_target the controller
+/// @return FAPI2_RC_SUCCESS iff ok
+///
+fapi2::ReturnCode gem_draminit_check_memory_size(const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& i_target);
+
+///
+/// @brief Polls DRAM calibration register to check for complete
+/// @param[in] i_target the controller
+/// @return FAPI2_RC_SUCCESS iff ok
+///
+fapi2::ReturnCode gem_draminit_poll_check_calibration(const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& i_target);
+
+}// exp
+}// mss
+
+#endif
diff --git a/src/import/chips/ocmb/gemini/procedures/hwp/memory/lib/mss_gemini.mk b/src/import/chips/ocmb/gemini/procedures/hwp/memory/lib/mss_gemini.mk
index acafbc603..a3b5fae39 100644
--- a/src/import/chips/ocmb/gemini/procedures/hwp/memory/lib/mss_gemini.mk
+++ b/src/import/chips/ocmb/gemini/procedures/hwp/memory/lib/mss_gemini.mk
@@ -22,3 +22,33 @@
# permissions and limitations under the License.
#
# IBM_PROLOG_END_TAG
+#
+# Makefile to build the MSS libraries.
+#
+
+# Add common and generated parts to object list.
+
+MSS_GEMINI_LIB_PATH := $(ROOTPATH)/chips/ocmb/gemini/procedures/hwp/memory/lib
+
+MSS_GEM_SOURCE := $(shell find $(MSS_GEMINI_LIB_PATH) -name '*.C' -exec basename {} \;)
+
+MSS_GEM_MODULE_OBJS += $(patsubst %.C,%.o,$(MSS_GEM_SOURCE))
+
+MSS_GEM_SOURCE_DIRS := $(shell find $(MSS_GEMINI_LIB_PATH) -type d)
+
+# Define common source and include paths.
+define MSS_GEM_MODULE_INCLUDES
+$(foreach dir, $(MSS_GEM_SOURCE_DIRS), $(call ADD_MODULE_SRCDIR,$(1),$(dir)))
+$(call ADD_MODULE_INCDIR,$(1),$(ROOTPATH)/chips/ocmb/gemini/procedures/hwp/memory)
+$(call ADD_MODULE_INCDIR,$(1),$(ROOTPATH)/chips/ocmb/explorer/procedures/hwp/memory)
+$(call ADD_MODULE_INCDIR,$(1),$(ROOTPATH)/generic/memory/lib)
+$(call ADD_MODULE_INCDIR,$(1),$(FAPI2_PATH)/include)
+$(call ADD_MODULE_INCDIR,$(1),$(GENPATH))
+$(call ADD_MODULE_INCDIR,$(1),$(FAPI2_PLAT_INCLUDE))
+$(call ADD_MODULE_INCDIR,$(1),$(ROOTPATH))
+endef
+MODULE = mss_gemini
+OBJS += $(MSS_GEM_MODULE_OBJS)
+
+$(eval $(call MSS_GEM_MODULE_INCLUDES,$(MODULE)))
+$(call BUILD_MODULE)
diff --git a/src/import/chips/ocmb/gemini/procedures/xml/error_info/gem_draminit_errors.xml b/src/import/chips/ocmb/gemini/procedures/xml/error_info/gem_draminit_errors.xml
index a8cdc5e7d..330e6991d 100644
--- a/src/import/chips/ocmb/gemini/procedures/xml/error_info/gem_draminit_errors.xml
+++ b/src/import/chips/ocmb/gemini/procedures/xml/error_info/gem_draminit_errors.xml
@@ -23,4 +23,31 @@
<!-- -->
<!-- IBM_PROLOG_END_TAG -->
<hwpErrors>
+ <hwpError>
+ <rc>RC_MSS_GEM_DRAMINIT_DIMM_SIZE_DOESNT_MATCH</rc>
+ <description>
+ DIMM size reported by gemini did not match the expected value of 32GB.
+ </description>
+ <callout>
+ <procedure>CODE</procedure>
+ <priority>LOW</priority>
+ </callout>
+ <ffdc>TARGET</ffdc>
+ <ffdc>DIMM</ffdc>
+ <ffdc>SIZE_RETURNED</ffdc>
+ </hwpError>
+
+ <hwpError>
+ <rc>RC_MSS_GEM_DRAMINIT_CALIBRATION_DID_NOT_COMPLETE</rc>
+ <description>
+ During gemini dram initialization, the calibration process
+ did not complete as reported by the Gemini calibration status register.
+ </description>
+ <ffdc>TARGET</ffdc>
+ <ffdc>REGISTER</ffdc>
+ <callout>
+ <target>OCMB_TARGET</target>
+ <priority>HIGH</priority>
+ </callout>
+ </hwpError>
</hwpErrors>
diff --git a/src/import/generic/memory/lib/utils/find.H b/src/import/generic/memory/lib/utils/find.H
index c22199b6d..1d5744cbe 100644
--- a/src/import/generic/memory/lib/utils/find.H
+++ b/src/import/generic/memory/lib/utils/find.H
@@ -117,6 +117,7 @@ static inline fapi2::Target<M> find_target_impl( const fapi2::Target<T>& i_targe
/// @tparam M the target type to be returned
/// @tparam T the fapi2 target type of the argument
/// @param[in] i_target the fapi2 target T
+/// @param[in] std::true_type tag dispatch if T == M
/// @return an M target.
/// @note Only works for valid parent-child relationships
///
OpenPOWER on IntegriCloud