summaryrefslogtreecommitdiffstats
path: root/src/import/generic
diff options
context:
space:
mode:
authorLouis Stermole <stermole@us.ibm.com>2019-03-04 17:05:49 -0500
committerChristian R. Geddes <crgeddes@us.ibm.com>2019-03-20 09:42:14 -0500
commit8fc0e7abffb04554f63196f5aaab035f1a72d245 (patch)
treecfb8c2d9a20292bed239ff4257db011c7f9e5c51 /src/import/generic
parent71d98844bb93c20cdc7c0eb438ee8be7b3806908 (diff)
downloadtalos-hostboot-8fc0e7abffb04554f63196f5aaab035f1a72d245.tar.gz
talos-hostboot-8fc0e7abffb04554f63196f5aaab035f1a72d245.zip
Add p9a version of eff_memory_size API
Adds mc_type template on eff_memory_size functions to avoid symbol duplication on future systems. Change-Id: I11552c94ac1dfc7ea367e0a6bb5d63e13d18c183 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/72790 Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Reviewed-by: Mark Pizzutillo <mark.pizzutillo@ibm.com> Reviewed-by: STEPHEN GLANCY <sglancy@us.ibm.com> Tested-by: HWSV CI <hwsv-ci+hostboot@us.ibm.com> Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com> Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com> Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/72896 Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
Diffstat (limited to 'src/import/generic')
-rw-r--r--src/import/generic/memory/lib/utils/memory_size.H55
-rw-r--r--src/import/generic/memory/lib/utils/shared/mss_generic_consts.H1
2 files changed, 54 insertions, 2 deletions
diff --git a/src/import/generic/memory/lib/utils/memory_size.H b/src/import/generic/memory/lib/utils/memory_size.H
index 0c18f90d0..dc2e73cc7 100644
--- a/src/import/generic/memory/lib/utils/memory_size.H
+++ b/src/import/generic/memory/lib/utils/memory_size.H
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2016,2017 */
+/* Contributors Listed Below - COPYRIGHT 2016,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -37,6 +37,7 @@
#define _MSS_EFF_MEMORY_SIZE_H_
#include <fapi2.H>
+#include <generic/memory/lib/utils/find.H>
namespace mss
{
@@ -53,13 +54,63 @@ bool is_dimm_functional(const uint8_t i_valid_dimm_bitmap,
///
/// @brief Return the total memory size behind the target
+/// @tparam MC the type of memory controller (defaults to DEFAULT_MC_TYPE)
/// @tparam T fapi2 target template parameter
/// @param[in] i_target the fapi2::Target, typically a port
/// @param[out] o_size the size of memory in GB behind the target
/// @return FAPI2_RC_SUCCESS if ok
///
-template< fapi2::TargetType T >
+template< mss::mc_type MC, fapi2::TargetType T >
fapi2::ReturnCode eff_memory_size( const fapi2::Target<T>& i_target, uint64_t& o_size );
+
+///
+/// @brief Return the total memory size behind a MEM_PORT target
+/// @param[in] i_target the port target
+/// @param[out] o_size the size of memory in GB behind the target
+/// @return FAPI2_RC_SUCCESS if ok
+///
+template< mss::mc_type MC >
+inline fapi2::ReturnCode eff_memory_size( const fapi2::Target<fapi2::TARGET_TYPE_MEM_PORT>& i_target, uint64_t& o_size )
+{
+ // Don't try to get cute and read the attributes once and loop over the array.
+ // Cronus honors initToZero which would work, but HB might not and so we might get
+ // crap in some of the attributes (which we shouldn't access as there's no DIMM there)
+ uint64_t l_sizes = 0;
+ o_size = 0;
+
+ for (const auto& d : mss::find_targets<fapi2::TARGET_TYPE_DIMM>(i_target))
+ {
+ FAPI_TRY( eff_memory_size<MC>(d, l_sizes) );
+ o_size += l_sizes;
+ }
+
+fapi_try_exit:
+ return fapi2::current_err;
+}
+
+///
+/// @brief Return the total memory size behind an OCMB_CHIP target
+/// @param[in] i_target the OCMB target
+/// @param[out] o_size the size of memory in GB behind the target
+/// @return FAPI2_RC_SUCCESS if ok
+///
+template< mss::mc_type MC >
+inline fapi2::ReturnCode eff_memory_size( const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& i_target,
+ uint64_t& o_size )
+{
+ o_size = 0;
+
+ for (const auto& p : mss::find_targets<fapi2::TARGET_TYPE_MEM_PORT>(i_target))
+ {
+ uint64_t l_size = 0;
+ FAPI_TRY( eff_memory_size<MC>(p, l_size) );
+ o_size += l_size;
+ }
+
+fapi_try_exit:
+ return fapi2::current_err;
+}
+
}
#endif
diff --git a/src/import/generic/memory/lib/utils/shared/mss_generic_consts.H b/src/import/generic/memory/lib/utils/shared/mss_generic_consts.H
index 194e36526..17fe87ac4 100644
--- a/src/import/generic/memory/lib/utils/shared/mss_generic_consts.H
+++ b/src/import/generic/memory/lib/utils/shared/mss_generic_consts.H
@@ -377,6 +377,7 @@ struct procTraits<proc_type::AXONE>
enum
{
EXP_PORTS_PER_OCMB = 1,
+ DIMMS_PER_PORT = 2,
};
};
OpenPOWER on IntegriCloud