summaryrefslogtreecommitdiffstats
path: root/src/import/chips/p9/procedures/hwp/nest/p9_mss_setup_bars.C
diff options
context:
space:
mode:
Diffstat (limited to 'src/import/chips/p9/procedures/hwp/nest/p9_mss_setup_bars.C')
-rw-r--r--src/import/chips/p9/procedures/hwp/nest/p9_mss_setup_bars.C464
1 files changed, 290 insertions, 174 deletions
diff --git a/src/import/chips/p9/procedures/hwp/nest/p9_mss_setup_bars.C b/src/import/chips/p9/procedures/hwp/nest/p9_mss_setup_bars.C
index 90e62859e..46a87c966 100644
--- a/src/import/chips/p9/procedures/hwp/nest/p9_mss_setup_bars.C
+++ b/src/import/chips/p9/procedures/hwp/nest/p9_mss_setup_bars.C
@@ -6,6 +6,7 @@
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2015,2019 */
+/* [+] Inspur Power Systems Corp. */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -44,17 +45,20 @@
#include <p9_mc_scom_addresses_fld.H>
#include <p9n2_mc_scom_addresses.H>
#include <p9n2_mc_scom_addresses_fld.H>
+#include <p9a_mc_scom_addresses.H>
+#include <p9a_mc_scom_addresses_fld.H>
#include <p9a_misc_scom_addresses.H>
#include <p9a_misc_scom_addresses_fld.H>
#include <p9a_addr_ext.H>
#include <map>
#include <lib/shared/mss_const.H>
#include <generic/memory/lib/utils/memory_size.H>
-#include <exp_inband.H>
+#include <lib/inband/exp_inband.H>
///----------------------------------------------------------------------------
/// Constant definitions
///----------------------------------------------------------------------------
+const uint8_t USTL_MDI_EQUAL_ONE = 1;
const uint8_t MAX_MC_PORTS_PER_MCS = 2; // 2 MC ports per MCS
const uint8_t NO_CHANNEL_PER_GROUP = 0xFF; // Init value of channel per group
@@ -300,12 +304,12 @@ fapi2::ReturnCode getMcMemSize(
uint8_t l_mcaPos = 0;
FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_CHIP_UNIT_POS, l_mca, l_mcaPos),
"Error getting ATTR_CHIP_UNIT_POS, l_rc 0x%.8X",
- (uint64_t)fapi2::current_err);
+ uint64_t(fapi2::current_err));
// Get the amount of memory behind this MCA target
FAPI_TRY(mss::eff_memory_size<mss::mc_type::NIMBUS>(l_mca, l_mcaSize),
"Error returned from eff_memory_size - MCA, l_rc 0x%.8X",
- (uint64_t)fapi2::current_err);
+ uint64_t(fapi2::current_err));
FAPI_INF("MCA %u: Total DIMM size %lu GB", l_mcaPos, l_mcaSize);
o_mcSize += l_mcaSize;
@@ -334,12 +338,12 @@ fapi2::ReturnCode getMcMemSize(
uint8_t l_dmiPos = 0;
FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_CHIP_UNIT_POS, l_dmi, l_dmiPos),
"Error getting ATTR_CHIP_UNIT_POS, l_rc 0x%.8X",
- (uint64_t)fapi2::current_err);
+ uint64_t(fapi2::current_err));
// Get the amount of memory behind this DMI target
FAPI_TRY(mss::eff_memory_size<mss::mc_type::CENTAUR>(l_dmi, l_chSize),
"Error returned from eff_memory_size - DMI, l_rc 0x%.8X",
- (uint64_t)fapi2::current_err);
+ uint64_t(fapi2::current_err));
FAPI_INF("DMI %u: Total DIMM size %lu GB", l_dmiPos, l_chSize);
o_mcSize += l_chSize;
@@ -370,19 +374,19 @@ fapi2::ReturnCode getMcMemSize(
for (auto l_omi : l_omiChiplets)
{
- const auto& l_ocmb_chiplets = l_omi.getChildren<fapi2::TARGET_TYPE_OCMB_CHIP>();
+ const auto& l_ocmb_chips = l_omi.getChildren<fapi2::TARGET_TYPE_OCMB_CHIP>();
- if (!l_ocmb_chiplets.empty())
+ if (!l_ocmb_chips.empty())
{
uint8_t l_omiPos = 0;
FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_CHIP_UNIT_POS, l_omi, l_omiPos),
"Error getting ATTR_CHIP_UNIT_POS, l_rc 0x%.8X",
- (uint64_t)fapi2::current_err);
+ uint64_t(fapi2::current_err));
// Get the amount of memory behind this OMI
- FAPI_TRY(mss::eff_memory_size<mss::mc_type::EXPLORER>(l_ocmb_chiplets[0], l_chSize),
+ FAPI_TRY(mss::eff_memory_size<mss::mc_type::EXPLORER>(l_ocmb_chips[0], l_chSize),
"Error returned from eff_memory_size - ocmb, l_rc 0x%.8X",
- (uint64_t)fapi2::current_err);
+ uint64_t(fapi2::current_err));
FAPI_INF("OMI %u: Total DIMM size %lu GB", l_omiPos, l_chSize);
@@ -506,14 +510,14 @@ fapi2::ReturnCode validateGroupData(
uint8_t l_mcPos = 0;
FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_CHIP_UNIT_POS, l_mc, l_mcPos),
"Error getting ATTR_CHIP_UNIT_POS, l_rc 0x%.8X",
- (uint64_t)fapi2::current_err);
+ uint64_t(fapi2::current_err));
FAPI_INF("validateGroupData: MC unit pos %d", l_mcPos);
// Get the memory size behind this MC
FAPI_TRY(getMcMemSize(l_mc, l_mcSize),
"Error returned from getMcMemSize, l_rc 0x%.8X",
- (uint64_t)fapi2::current_err);
+ uint64_t(fapi2::current_err));
// Get this MC memsize reported in Group data
getGroupDataMcMemSize(l_mcPos, i_omi, i_groupData, l_portFound,
@@ -536,6 +540,8 @@ fapi2::ReturnCode validateGroupData(
} // MC loop
+ FAPI_INF("Total memory size= %lu GB", l_mcSize);
+
// Assert if a PORT_ID is found more than once in any group
for (uint8_t ii = 0; ii < NUM_MC_PORTS_PER_PROC; ii++)
{
@@ -590,7 +596,7 @@ fapi2::ReturnCode getGroupSizeEncodedValue(
uint8_t l_mcPos = 0;
FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_CHIP_UNIT_POS, i_mcTarget, l_mcPos),
"Error getting ATTR_CHIP_UNIT_POS, l_rc 0x%.8X",
- (uint64_t)fapi2::current_err);
+ uint64_t(fapi2::current_err));
// Assert if can't find Group size in the table
FAPI_ASSERT( false,
fapi2::MSS_SETUP_BARS_INVALID_GROUP_SIZE()
@@ -761,7 +767,7 @@ fapi2::ReturnCode getNonMirrorBarIdSize(const fapi2::Target<T>& i_mcTarget,
FAPI_TRY(getGroupSizeEncodedValue(i_mcTarget, i_portInfo[0].groupSize,
o_mcBarData.MCFGP_group_size),
"getGroupSizeEncodedValue() returns error, l_rc 0x%.8X",
- (uint64_t)fapi2::current_err);
+ uint64_t(fapi2::current_err));
// Group base address
o_mcBarData.MCFGP_groupBaseAddr = i_portInfo[0].groupBaseAddr;
@@ -774,7 +780,7 @@ fapi2::ReturnCode getNonMirrorBarIdSize(const fapi2::Target<T>& i_mcTarget,
FAPI_TRY(getGroupSizeEncodedValue(i_mcTarget, i_portInfo[1].groupSize,
o_mcBarData.MCFGPM_group_size),
"getGroupSizeEncodedValue() returns error, l_rc 0x%.8X",
- (uint64_t)fapi2::current_err);
+ uint64_t(fapi2::current_err));
// Group base address
o_mcBarData.MCFGPM_groupBaseAddr = i_portInfo[1].groupBaseAddr;
@@ -873,7 +879,7 @@ fapi2::ReturnCode getNonMirrorBarIdSize(const fapi2::Target<fapi2::TARGET_TYPE_M
FAPI_TRY(getGroupSizeEncodedValue(i_mcTarget, i_portInfo.groupSize,
o_mcBarData.MCFGP_group_size),
"getGroupSizeEncodedValue() returns error, l_rc 0x%.8X",
- (uint64_t)fapi2::current_err);
+ uint64_t(fapi2::current_err));
// Group base address
o_mcBarData.MCFGP_groupBaseAddr = i_portInfo.groupBaseAddr;
@@ -886,7 +892,7 @@ fapi2::ReturnCode getNonMirrorBarIdSize(const fapi2::Target<fapi2::TARGET_TYPE_M
FAPI_TRY(getGroupSizeEncodedValue(i_mcTarget, i_portInfo.groupSize,
o_mcBarData.MCFGPM_group_size),
"getGroupSizeEncodedValue() returns error, l_rc 0x%.8X",
- (uint64_t)fapi2::current_err);
+ uint64_t(fapi2::current_err));
// Group base address
o_mcBarData.MCFGPM_groupBaseAddr = i_portInfo.groupBaseAddr;
@@ -1040,7 +1046,7 @@ fapi2::ReturnCode getMirrorBarData(const fapi2::Target<T>& i_mcTarget,
FAPI_TRY(getGroupSizeEncodedValue(i_mcTarget, i_portInfo[1].groupSize,
io_mcBarData.MCFGPM_group_size),
"getGroupSizeEncodedValue() returns error, l_rc 0x%.8X",
- (uint64_t)fapi2::current_err);
+ uint64_t(fapi2::current_err));
// Group base address
io_mcBarData.MCFGPM_groupBaseAddr = i_portInfo[1].groupBaseAddr;
@@ -1106,7 +1112,7 @@ fapi2::ReturnCode getMirrorBarData(const fapi2::Target<fapi2::TARGET_TYPE_MCC>&
FAPI_TRY(getGroupSizeEncodedValue(i_mcTarget, i_portInfo.groupSize,
io_mcBarData.MCFGPM_group_size),
"getGroupSizeEncodedValue() returns error, l_rc 0x%.8X",
- (uint64_t)fapi2::current_err);
+ uint64_t(fapi2::current_err));
// Group base address
io_mcBarData.MCFGPM_groupBaseAddr = i_portInfo.groupBaseAddr;
@@ -1462,7 +1468,7 @@ fapi2::ReturnCode buildMCBarData(
FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_MRW_HW_MIRRORING_ENABLE,
FAPI_SYSTEM, l_mirror_ctl),
"Error getting ATTR_MRW_HW_MIRRORING_ENABLE, "
- "l_rc 0x%.8X", (uint64_t)fapi2::current_err);
+ "l_rc 0x%.8X", uint64_t(fapi2::current_err));
for (auto l_mc : i_mcTargets)
{
@@ -1473,7 +1479,7 @@ fapi2::ReturnCode buildMCBarData(
uint8_t l_unitPos = 0;
FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_CHIP_UNIT_POS, l_mc, l_unitPos),
"Error getting ATTR_CHIP_UNIT_POS, l_rc 0x%.8X",
- (uint64_t)fapi2::current_err);
+ uint64_t(fapi2::current_err));
fapi2::toString(l_mc, l_targetStr, sizeof(l_targetStr));
FAPI_INF("Build BAR data for MC target: %s", l_targetStr);
@@ -1493,7 +1499,7 @@ fapi2::ReturnCode buildMCBarData(
// ---- Build MCFGP/MCFGM data based on port group info ----
FAPI_TRY(getNonMirrorBarData(l_mc, l_portInfo, l_mcBarData),
"getNonMirrorBarData() returns error, l_rc 0x%.8X",
- (uint64_t)fapi2::current_err);
+ uint64_t(fapi2::current_err));
// ---------------------------------------------------------------
// Set MC register values for mirror groups
@@ -1514,7 +1520,7 @@ fapi2::ReturnCode buildMCBarData(
// ---- Build MCFGM data based on port group info ----
FAPI_TRY(getMirrorBarData(l_mc, l_portInfoMirrored, l_mcBarData),
"getMirrorBarData() returns error, l_rc 0x%.8X",
- (uint64_t)fapi2::current_err);
+ uint64_t(fapi2::current_err));
}
}
@@ -1563,7 +1569,7 @@ fapi2::ReturnCode buildMCBarData(
FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_MRW_HW_MIRRORING_ENABLE,
FAPI_SYSTEM, l_mirror_ctl),
"Error getting ATTR_MRW_HW_MIRRORING_ENABLE, "
- "l_rc 0x%.8X", (uint64_t)fapi2::current_err);
+ "l_rc 0x%.8X", uint64_t(fapi2::current_err));
for (auto l_mcc : i_mccTargets)
{
@@ -1574,7 +1580,7 @@ fapi2::ReturnCode buildMCBarData(
uint8_t l_unitPos = 0;
FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_CHIP_UNIT_POS, l_mcc, l_unitPos),
"Error getting ATTR_CHIP_UNIT_POS, l_rc 0x%.8X",
- (uint64_t)fapi2::current_err);
+ uint64_t(fapi2::current_err));
fapi2::toString(l_mcc, l_targetStr, sizeof(l_targetStr));
FAPI_INF("Build BAR data for MC target: %s", l_targetStr);
@@ -1593,7 +1599,7 @@ fapi2::ReturnCode buildMCBarData(
// ---- Build MCFGP/MCFGM data based on port group info ----
FAPI_TRY(getNonMirrorBarData(l_mcc, l_portInfo, l_mcBarData),
"getNonMirrorBarData() returns error, l_rc 0x%.8X",
- (uint64_t)fapi2::current_err);
+ uint64_t(fapi2::current_err));
// ---------------------------------------------------------------
// Set MC register values for mirror groups
@@ -1610,7 +1616,7 @@ fapi2::ReturnCode buildMCBarData(
// ---- Build MCFGM data based on port group info ----
FAPI_TRY(getMirrorBarData(l_mcc, l_portInfoMirrored, l_mcBarData),
"getMirrorBarData() returns error, l_rc 0x%.8X",
- (uint64_t)fapi2::current_err);
+ uint64_t(fapi2::current_err));
}
// Add to output pair
@@ -1675,13 +1681,12 @@ fapi2::ReturnCode writeMCBarData(
FAPI_DBG("Entering");
fapi2::buffer<uint64_t> l_scomData(0);
-
fapi2::ATTR_MSS_INTERLEAVE_GRANULARITY_Type l_interleave_granule_size;
FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_MSS_INTERLEAVE_GRANULARITY,
fapi2::Target<fapi2::TARGET_TYPE_SYSTEM>(),
l_interleave_granule_size),
"Error getting ATTR_MSS_INTERLEAVE_GRANULARITY, l_rc 0x%.8X",
- (uint64_t)fapi2::current_err);
+ uint64_t(fapi2::current_err));
for (auto l_pair : i_mcBarDataPair)
{
@@ -1718,11 +1723,13 @@ fapi2::ReturnCode writeMCBarData(
MCS_MCFGP_GROUP_BASE_ADDRESS_LEN>(
(l_data.MCFGP_groupBaseAddr >> 2));
+
// configure interleave granularity if 2/4/8 MC per group only
- if ((l_data.MCFGP_chan_per_group == 0b0100) || // 2 MC/group
- (l_data.MCFGP_chan_per_group == 0b0101) ||
- (l_data.MCFGP_chan_per_group == 0b0110) || // 4 MC/group
- (l_data.MCFGP_chan_per_group == 0b1000)) // 8 MC/group
+ if ( (l_data.MCFGP_chan_per_group == 0b0100) || // 2 MC/group
+ (l_data.MCFGP_chan_per_group == 0b0101) ||
+ (l_data.MCFGP_chan_per_group == 0b0110) || // 4 MC/group
+ (l_data.MCFGP_chan_per_group == 0b1000) // 8 MC/group
+ )
{
fapi2::buffer<uint64_t> l_mcmode0_scom_data;
FAPI_TRY(fapi2::getScom(l_target, MCS_MCMODE0, l_mcmode0_scom_data),
@@ -1971,7 +1978,7 @@ fapi2::ReturnCode writeMCCInterleaveGranularity(
fapi2::Target<fapi2::TARGET_TYPE_SYSTEM>(),
l_interleave_granule_size),
"Error getting ATTR_MSS_INTERLEAVE_GRANULARITY, l_rc 0x%.8X",
- (uint64_t)fapi2::current_err);
+ uint64_t(fapi2::current_err));
for (auto l_pair : i_mcBarDataPair)
{
@@ -1982,33 +1989,6 @@ fapi2::ReturnCode writeMCCInterleaveGranularity(
if (l_data.MCFGP_valid == true)
{
fapi2::Target<fapi2::TARGET_TYPE_MI> l_mi_target = l_target.getParent<fapi2::TARGET_TYPE_MI>();
-
- // configure interleave granularity if 1/2/4/8 MC per group only
- if ((l_data.MCFGP_chan_per_group == 0) || // 8 MC/group
- (l_data.MCFGP_chan_per_group == 1) || // 1 MC/group
- (l_data.MCFGP_chan_per_group == 2) || // 2 MC/group
- (l_data.MCFGP_chan_per_group == 4)) // 4 MC/group
- {
- //Only set to true if the value for the target is not set yet
- if (l_granule_supported.find(l_mi_target) == l_granule_supported.end())
- {
- l_granule_supported[l_mi_target] = true;
- }
- }
- else
- {
- //Always set to false if we find one channel that cannot support it.
- l_granule_supported[l_mi_target] = false;
- }
- }
- }
-
- for ( auto l_it = l_granule_supported.begin(); l_it != l_granule_supported.end(); l_it++ )
- {
- if (l_it->second)
- {
- auto l_mi_target = l_it->first;
-
fapi2::buffer<uint64_t> l_mcmode0_scom_data;
FAPI_TRY(fapi2::getScom(l_mi_target, P9A_MI_MCMODE0, l_mcmode0_scom_data),
"Error reading from MCS_MCMODE0 reg");
@@ -2065,10 +2045,19 @@ fapi2::ReturnCode writeMCBarData(
uint8_t l_pos;
fapi2::buffer<uint64_t> l_scomData(0);
+ fapi2::buffer<uint64_t> l_scomData_mirror(0);
+ fapi2::buffer<uint64_t> l_scomData_mcmode(0);
fapi2::buffer<uint64_t> l_extAddr(0);
fapi2::buffer<uint64_t> l_norAddr;
uint64_t l_ext_mask;
+ const fapi2::Target<fapi2::TARGET_TYPE_SYSTEM> FAPI_SYSTEM;
+ uint8_t mirror_policy;
+
+ FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_MEM_MIRROR_PLACEMENT_POLICY, FAPI_SYSTEM, mirror_policy),
+ "Error reading ATTR_MEM_MIRROR_PLACEMENT_POLICY, l_rc 0x%.8X",
+ (uint64_t)fapi2::current_err);
+
FAPI_TRY(p9a_get_ext_mask(l_ext_mask));
FAPI_TRY(writeMCCInterleaveGranularity(i_mcBarDataPair));
@@ -2084,7 +2073,7 @@ fapi2::ReturnCode writeMCBarData(
FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_CHIP_UNIT_POS, l_target, l_pos),
"Error getting ATTR_CHIP_UNIT_POS, l_rc 0x%.8X",
- (uint64_t)fapi2::current_err);
+ uint64_t(fapi2::current_err));
// 1. ---- Set MCFGP reg -----
l_scomData = 0;
@@ -2174,55 +2163,176 @@ fapi2::ReturnCode writeMCBarData(
"Error writing to P9A_MI_MCFGPM1 reg");
}
- // 3. ---- Set MCFGPA reg -----
+ // 3. ---- Set MCFGPA/MCFGPMA regs -----
l_scomData = 0;
-
- // Assert if both HOLE1 and SMF are valid, settings will overlap
- FAPI_ASSERT((l_data.MCFGPA_HOLE_valid[1] && l_data.MCFGPA_SMF_valid) == 0,
- fapi2::MSS_SETUP_BARS_HOLE1_SMF_CONFLICT()
- .set_TARGET(l_target)
- .set_HOLE1_VALID(l_data.MCFGPA_HOLE_valid[1])
- .set_SMF_VALID(l_data.MCFGPA_SMF_valid),
- "Error: MCFGPA HOLE1 and SMF are both valid, settings will overlap");
+ l_scomData_mirror = 0;
// Hole 0
if (l_data.MCFGPA_HOLE_valid[0] == true)
{
- // MCFGPA HOLE0 valid (bit 0)
- l_scomData.setBit<P9A_MI_MCFGP0A_HOLE_VALID>();
+ if(mirror_policy ==
+ fapi2::ENUM_ATTR_MEM_MIRROR_PLACEMENT_POLICY_NORMAL) //Non-mirrored mode, but still set up mirrored equiv addressses
+ {
+ // Non-mirrored
+ // MCFGP0A HOLE valid (bit 0)
+ l_scomData.setBit<P9A_MI_MCFGP0A_HOLE_VALID>();
+
+ // Hole lower addr
+ // Hole always extends to end of range
+ FAPI_DBG("l_data.MCFGPA_HOLE_LOWER_addr[0]: %016llx", l_data.MCFGPA_HOLE_LOWER_addr[0]);
+ FAPI_TRY(extBar(l_ext_mask, l_data.MCFGPA_HOLE_LOWER_addr[0], l_extAddr));
+ l_scomData.insert<P9A_MI_MCFGP0A_HOLE_LOWER_ADDRESS,
+ P9A_MI_MCFGP0A_HOLE_LOWER_ADDRESS_LEN>(
+ (l_extAddr << 9)); //matches 17:31 extendedBarAddress shifts left 8 (17-8) = 9
+
+ // Mirrored Address = Non-mirrored >> 1 since bit 56 is not part of the dsaddr
+ // MCFGPM0A HOLE0 valid (bit 0)
+ l_scomData_mirror.setBit<P9A_MI_MCFGPM0A_HOLE_VALID>();
+
+ // Hole lower addr
+ // Hole always extends to end of range
+ FAPI_DBG("l_data.MCFGPA_HOLE_LOWER_addr[0]: %016llx", (l_data.MCFGPA_HOLE_LOWER_addr[0] >> 1));
+ FAPI_TRY(extBar(l_ext_mask, l_data.MCFGPA_HOLE_LOWER_addr[0], l_extAddr));
+ l_scomData_mirror.insert<P9A_MI_MCFGPM0A_HOLE_LOWER_ADDRESS,
+ P9A_MI_MCFGPM0A_HOLE_LOWER_ADDRESS_LEN>(
+ (l_extAddr << 8)); //matches 17:31 extendedBarAddress shifts left 8 (17- (8 + 1)) = 8
+ }
+ else
+ {
+ // Mirrored Address
+ // MCFGPM0A HOLE0 valid (bit 0)
+ l_scomData_mirror.setBit<P9A_MI_MCFGPM0A_HOLE_VALID>();
+
+ // Hole 0 lower addr
+ // Hole 0 always extends to end of range
+ FAPI_DBG("l_data.MCFGPA_HOLE_LOWER_addr[0]: %016llx", l_data.MCFGPA_HOLE_LOWER_addr[0]);
+ FAPI_TRY(extBar(l_ext_mask, l_data.MCFGPA_HOLE_LOWER_addr[0], l_extAddr));
+ l_scomData_mirror.insert<P9A_MI_MCFGPM0A_HOLE_LOWER_ADDRESS,
+ P9A_MI_MCFGPM0A_HOLE_LOWER_ADDRESS_LEN>(
+ (l_extAddr << 9)); //matches 17:31 extendedBarAddress shifts left 8 (17- 8) = 9
+
+ // Non-mirrored Address = Mirrored Address << 1 since bit 56 is part of the dsaddr
+ // MCFGPA HOLE0 valid (bit 0)
+ l_scomData.setBit<P9A_MI_MCFGP0A_HOLE_VALID>();
+
+ // Hole 0 lower addr
+ // Hole 0 always extends to end of range
+ FAPI_DBG("l_data.MCFGPA_HOLE_LOWER_addr[0]: %016llx", (l_data.MCFGPA_HOLE_LOWER_addr[0] << 1));
+ FAPI_TRY(extBar(l_ext_mask, l_data.MCFGPA_HOLE_LOWER_addr[0], l_extAddr));
+ l_scomData.insert<P9A_MI_MCFGP0A_HOLE_LOWER_ADDRESS,
+ P9A_MI_MCFGP0A_HOLE_LOWER_ADDRESS_LEN>(
+ (l_extAddr << 10)); //matches 17:31 extendedBarAddress shifts left 8 (17- (8 - 1)) = 10
- // Hole 0 lower addr
- // Hole 0 always extends to end of range
- FAPI_DBG("l_data.MCFGPA_HOLE_LOWER_addr[0]: %016llx", l_data.MCFGPA_HOLE_LOWER_addr[0]);
- FAPI_TRY(extBar(l_ext_mask, l_data.MCFGPA_HOLE_LOWER_addr[0], l_extAddr));
- l_scomData.insert<P9A_MI_MCFGP0A_HOLE_LOWER_ADDRESS,
- P9A_MI_MCFGP0A_HOLE_LOWER_ADDRESS_LEN>(
- (l_extAddr << 9)); //matches 17:31 extendedBarAddress shifts left 8 (17-8) = 9
+ }
}
// SMF
if (l_data.MCFGPA_SMF_valid == true)
{
- // MCFGPA SMF valid (bit 0)
- l_scomData.setBit<P9A_MI_MCFGP0A_SMF_VALID>();
+ FAPI_DBG("Writing SMF bit into address extension now");
+ // Set up Extension Address for SMF
+ FAPI_TRY(fapi2::getScom(l_target.getParent<fapi2::TARGET_TYPE_MI>(), P9A_MI_MCMODE2, l_scomData_mcmode),
+ "Error reading to P9A_MI_MCMODE2 reg");
+ l_scomData_mcmode.setBit<P9A_MI_MCMODE2_CHIP_ADDRESS_EXTENSION_MASK_ENABLE>();
+ FAPI_TRY(fapi2::putScom(l_target.getParent<fapi2::TARGET_TYPE_MI>(), P9A_MI_MCMODE2, l_scomData_mcmode),
+ "Error writing to P9A_MI_MCMODE2 reg");
+
+ if(mirror_policy ==
+ fapi2::ENUM_ATTR_MEM_MIRROR_PLACEMENT_POLICY_NORMAL) //Non-mirrored mode, but still set up mirrored equiv addressses
+ {
+ //Non-mirrored
+ // MCFGPA SMF valid (bit 0)
+ l_scomData.setBit<P9A_MI_MCFGP0A_SMF_VALID>();
+
+ // MCFGPA_SMF_UPPER_ADDRESS_AT_END_OF_RANGE
+ l_scomData.setBit<P9A_MI_MCFGP0A_SMF_EXTEND_TO_END_OF_RANGE>();
+
+ // SMF lower addr
+ l_norAddr = 0;
+ l_norAddr.insertFromRight<17, 19>(l_data.MCFGPA_SMF_LOWER_addr);
+ FAPI_TRY(extendBarAddress(l_ext_mask, l_norAddr, l_extAddr));
+ l_scomData.insert<P9A_MI_MCFGP0A_SMF_LOWER_ADDRESS,
+ P9A_MI_MCFGP0A_SMF_LOWER_ADDRESS_LEN>(
+ (l_extAddr << 9)); //matches 17:35 extendBarAddress shifts left 8 (17-8) = 9
+ // SMF upper addr
+ l_norAddr = 0;
+ l_norAddr.insertFromRight<17, 19>(l_data.MCFGPA_SMF_UPPER_addr);
+ FAPI_TRY(extendBarAddress(l_ext_mask, l_norAddr, l_extAddr));
+ l_scomData.insert<P9A_MI_MCFGP0A_SMF_UPPER_ADDRESS,
+ P9A_MI_MCFGP0A_SMF_UPPER_ADDRESS_LEN>(
+ (l_extAddr << 9)); //matches 17:35 extendBarAddress shifts left 8 (17-8) = 9
+
+
+ //Mirrored BAR = Non-mirrored BAR >> 1 since bit 56 is not a dsaddr bit
+ // MCFGPA SMF valid (bit 0)
+ l_scomData_mirror.setBit<P9A_MI_MCFGPM0A_SMF_VALID>();
+
+ // MCFGPA_SMF_UPPER_ADDRESS_AT_END_OF_RANGE
+ l_scomData_mirror.setBit<P9A_MI_MCFGPM0A_SMF_EXTEND_TO_END_OF_RANGE>();
+
+ // SMF lower addr
+ l_norAddr = 0;
+ l_norAddr.insertFromRight<17, 19>(l_data.MCFGPA_SMF_LOWER_addr);
+ FAPI_TRY(extendBarAddress(l_ext_mask, l_norAddr, l_extAddr));
+ l_scomData_mirror.insert<P9A_MI_MCFGPM0A_SMF_LOWER_ADDRESS,
+ P9A_MI_MCFGPM0A_SMF_LOWER_ADDRESS_LEN>(
+ (l_extAddr << 8)); //matches 17:35 extendBarAddress shifts left 8 (17- (8 + 1)) = 8
+ // SMF upper addr
+ l_norAddr = 0;
+ l_norAddr.insertFromRight<17, 19>(l_data.MCFGPA_SMF_UPPER_addr);
+ FAPI_TRY(extendBarAddress(l_ext_mask, l_norAddr, l_extAddr));
+ l_scomData_mirror.insert<P9A_MI_MCFGPM0A_SMF_UPPER_ADDRESS,
+ P9A_MI_MCFGPM0A_SMF_UPPER_ADDRESS_LEN>(
+ (l_extAddr << 8)); //matches 17:35 extendBarAddress shifts left 8 (17- (8 + 1)) = 8
+ }
+ else
+ {
+ //Mirrored
+ // MCFGPA SMF valid (bit 0)
+ l_scomData_mirror.setBit<P9A_MI_MCFGPM0A_SMF_VALID>();
+
+ // MCFGPA_SMF_UPPER_ADDRESS_AT_END_OF_RANGE
+ l_scomData_mirror.setBit<P9A_MI_MCFGPM0A_SMF_EXTEND_TO_END_OF_RANGE>();
+
+ // SMF lower addr
+ l_norAddr = 0;
+ l_norAddr.insertFromRight<17, 19>(l_data.MCFGPA_SMF_LOWER_addr);
+ FAPI_TRY(extendBarAddress(l_ext_mask, l_norAddr, l_extAddr));
+ l_scomData_mirror.insert<P9A_MI_MCFGPM0A_SMF_LOWER_ADDRESS,
+ P9A_MI_MCFGPM0A_SMF_LOWER_ADDRESS_LEN>(
+ (l_extAddr << 9)); //matches 17:35 extendBarAddress shifts left 8 (17- 8) = 9
+ // SMF upper addr
+ l_norAddr = 0;
+ l_norAddr.insertFromRight<17, 19>(l_data.MCFGPA_SMF_UPPER_addr);
+ FAPI_TRY(extendBarAddress(l_ext_mask, l_norAddr, l_extAddr));
+ l_scomData_mirror.insert<P9A_MI_MCFGPM0A_SMF_UPPER_ADDRESS,
+ P9A_MI_MCFGPM0A_SMF_UPPER_ADDRESS_LEN>(
+ (l_extAddr << 9)); //matches 17:35 extendBarAddress shifts left 8 (17- 8) = 9
+
+ //Non-Mirrored BAR = Mirrored BAR << 1 since bit 56 is now a dsaddr bit
+ // MCFGPA SMF valid (bit 0)
+ l_scomData.setBit<P9A_MI_MCFGP0A_SMF_VALID>();
+
+ // MCFGPA_SMF_UPPER_ADDRESS_AT_END_OF_RANGE
+ l_scomData.setBit<P9A_MI_MCFGP0A_SMF_EXTEND_TO_END_OF_RANGE>();
+
+ // SMF lower addr
+ l_norAddr = 0;
+ l_norAddr.insertFromRight<17, 19>(l_data.MCFGPA_SMF_LOWER_addr);
+ FAPI_TRY(extendBarAddress(l_ext_mask, l_norAddr, l_extAddr));
+ l_scomData.insert<P9A_MI_MCFGP0A_SMF_LOWER_ADDRESS,
+ P9A_MI_MCFGP0A_SMF_LOWER_ADDRESS_LEN>(
+ (l_extAddr << 10)); //matches 17:35 extendBarAddress shifts left 8 (17- (8 - 1)) = 10
+ // SMF upper addr
+ l_norAddr = 0;
+ l_norAddr.insertFromRight<17, 19>(l_data.MCFGPA_SMF_UPPER_addr);
+ FAPI_TRY(extendBarAddress(l_ext_mask, l_norAddr, l_extAddr));
+ l_scomData.insert<P9A_MI_MCFGP0A_SMF_UPPER_ADDRESS,
+ P9A_MI_MCFGP0A_SMF_UPPER_ADDRESS_LEN>(
+ (l_extAddr << 10)); //matches 17:35 extendBarAddress shifts left 8 (17- (8 - 1)) = 10
- // MCFGPA_SMF_UPPER_ADDRESS_AT_END_OF_RANGE
- l_scomData.setBit<P9A_MI_MCFGP0A_SMF_EXTEND_TO_END_OF_RANGE>();
- // SMF lower addr
- l_norAddr = 0;
- l_norAddr.insertFromRight<22, 14>(l_data.MCFGPA_SMF_LOWER_addr);
- FAPI_TRY(extendBarAddress(l_ext_mask, l_norAddr, l_extAddr));
- l_scomData.insert<P9A_MI_MCFGP0A_SMF_LOWER_ADDRESS,
- P9A_MI_MCFGP0A_SMF_LOWER_ADDRESS_LEN>(
- (l_extAddr << 14)); //matches 22:35 extendBarAddress shifts left 8 (22-8) = 14
- // SMF upper addr
- l_norAddr = 0;
- l_norAddr.insertFromRight<22, 14>(l_data.MCFGPA_SMF_UPPER_addr);
- FAPI_TRY(extendBarAddress(l_ext_mask, l_norAddr, l_extAddr));
- l_scomData.insert<P9A_MI_MCFGP0A_SMF_UPPER_ADDRESS,
- P9A_MI_MCFGP0A_SMF_UPPER_ADDRESS_LEN>(
- (l_extAddr << 14)); //matches 22:35 extendBarAddress shifts left 8 (22-8) = 14
+ }
}
// Write to reg
@@ -2232,6 +2342,11 @@ fapi2::ReturnCode writeMCBarData(
P9A_MI_MCFGP0A, l_scomData);
FAPI_TRY(fapi2::putScom(l_target.getParent<fapi2::TARGET_TYPE_MI>(), P9A_MI_MCFGP0A, l_scomData),
"Error writing to P9A_MI_MCFGP0A reg");
+
+ FAPI_INF("Write MCFGPM0A reg 0x%.16llX, Value 0x%.16llX",
+ P9A_MI_MCFGPM0A, l_scomData_mirror);
+ FAPI_TRY(fapi2::putScom(l_target.getParent<fapi2::TARGET_TYPE_MI>(), P9A_MI_MCFGPM0A, l_scomData_mirror),
+ "Error writing to P9A_MI_MCFGPM0A reg");
}
else
{
@@ -2239,83 +2354,76 @@ fapi2::ReturnCode writeMCBarData(
P9A_MI_MCFGP1A, l_scomData);
FAPI_TRY(fapi2::putScom(l_target.getParent<fapi2::TARGET_TYPE_MI>(), P9A_MI_MCFGP1A, l_scomData),
"Error writing to P9A_MI_MCFGP1A reg");
- }
-
- // 4. ---- Set MCFGPMA reg -----
- l_scomData = 0;
- // Assert if both HOLE1 and SMF are valid, settings will overlap
- FAPI_ASSERT((l_data.MCFGPMA_HOLE_valid[1] && l_data.MCFGPMA_SMF_valid) == 0,
- fapi2::MSS_SETUP_BARS_HOLE1_SMF_CONFLICT()
- .set_TARGET(l_target)
- .set_HOLE1_VALID(l_data.MCFGPMA_HOLE_valid[1])
- .set_SMF_VALID(l_data.MCFGPMA_SMF_valid),
- "Error: MCFGPMA HOLE1 and SMF are both valid, settings will overlap");
-
- // Hole 0
- if (l_data.MCFGPMA_HOLE_valid[0] == true)
- {
- // MCFGPMA HOLE0 valid (bit 0)
- l_scomData.setBit<P9A_MI_MCFGPM0A_HOLE_VALID>();
-
- // Hole 0 lower addr
- // 0b0000000001 = 4GB
- FAPI_TRY(extBar(l_ext_mask, l_data.MCFGPMA_HOLE_LOWER_addr[0], l_extAddr));
- l_scomData.insert<P9A_MI_MCFGPM0A_HOLE_LOWER_ADDRESS,
- P9A_MI_MCFGPM0A_HOLE_LOWER_ADDRESS_LEN>(
- (l_extAddr << 9)); //matches 17:31 extendedBarAddress shifts left 8 (17-8) = 9
+ FAPI_INF("Write MCFGPM1A reg 0x%.16llX, Value 0x%.16llX",
+ P9A_MI_MCFGPM1A, l_scomData_mirror);
+ FAPI_TRY(fapi2::putScom(l_target.getParent<fapi2::TARGET_TYPE_MI>(), P9A_MI_MCFGPM1A, l_scomData_mirror),
+ "Error writing to P9A_MI_MCFGP1A reg");
}
+ } // Data pair loop
- // SMF
- if (l_data.MCFGPMA_SMF_valid == true)
- {
- // MCFGPMA SMF valid (bit 0)
- l_scomData.setBit<P9A_MI_MCFGPM0A_SMF_VALID>();
+fapi_try_exit:
+ FAPI_DBG("Exit");
+ return fapi2::current_err;
+}
- // MCFGPMA_SMF_UPPER_ADDRESS_AT_END_OF_RANGE
- l_scomData.setBit<P9A_MI_MCFGPM0A_SMF_EXTEND_TO_END_OF_RANGE>();
+///
+/// @brief Apply Gemini MDI bit workaround and mask Channel Timeout
+///
+/// @param[in] i_target target to set actions/mask
+///
+/// @return FAPI2_RC_SUCCESS if success, else error code.
+///
+fapi2::ReturnCode applyGeminiFixes(const fapi2::Target<fapi2::TARGET_TYPE_MCC> i_target)
+{
+ FAPI_DBG("Entering fixGeminiMDI on %s", mss::c_str(i_target));
- // SMF lower addr
- l_norAddr = 0;
- l_norAddr.insertFromRight<22, 14>(l_data.MCFGPMA_SMF_LOWER_addr);
- FAPI_TRY(extendBarAddress(l_ext_mask, l_norAddr, l_extAddr));
- l_scomData.insert<P9A_MI_MCFGPM0A_SMF_LOWER_ADDRESS,
- P9A_MI_MCFGPM0A_SMF_LOWER_ADDRESS_LEN>(
- (l_extAddr << 14 )); //matches 22:35 extendBarAddress shifts left 8 (22-8) = 14
- // SMF upper addr
- l_norAddr = 0;
- l_norAddr.insertFromRight<22, 14>(l_data.MCFGPMA_SMF_UPPER_addr);
- FAPI_TRY(extendBarAddress(l_ext_mask, l_norAddr, l_extAddr));
- l_scomData.insert<P9A_MI_MCFGPM0A_SMF_UPPER_ADDRESS,
- P9A_MI_MCFGPM0A_SMF_UPPER_ADDRESS_LEN>(
- (l_extAddr << 14)); //matches 22:35 extendBarAddress shifts left 8 (22-8) = 14
- }
+ fapi2::buffer<uint64_t> l_scom_data;
+ uint8_t l_any_gemini = 0;
+ const auto l_omiChiplets = i_target.getChildren<fapi2::TARGET_TYPE_OMI>();
- // Write to reg
- if (l_pos % 2 == 0)
- {
- FAPI_INF("Write P9A_MI_MCFGPM0A reg 0x%.16llX, Value 0x%.16llX",
- P9A_MI_MCFGPM0A, l_scomData);
+ for (const auto& l_omi : l_omiChiplets)
+ {
+ const auto& l_ocmb_chips = l_omi.getChildren<fapi2::TARGET_TYPE_OCMB_CHIP>();
- FAPI_TRY(fapi2::putScom(l_target.getParent<fapi2::TARGET_TYPE_MI>(), P9A_MI_MCFGPM0A, l_scomData),
- "Error writing to P9A_MI_MCFGPM0A reg");
- }
- else
+ if (!l_ocmb_chips.empty())
{
- FAPI_INF("Write P9A_MI_MCFGPM1A reg 0x%.16llX, Value 0x%.16llX",
- P9A_MI_MCFGPM1A, l_scomData);
-
- FAPI_TRY(fapi2::putScom(l_target.getParent<fapi2::TARGET_TYPE_MI>(), P9A_MI_MCFGPM1A, l_scomData),
- "Error writing to P9A_MI_MCFGPM1A reg");
+ uint8_t l_workaround = 0;
+ FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_CHIP_EC_FEATURE_AXONE_GEMINI_MDI_ERROR,
+ l_ocmb_chips[0],
+ l_workaround),
+ "Error from FAPI_ATTR_GET (ATTR_CHIP_EC_FEATURE_AXONE_GEMINI_MDI_ERROR)");
+ l_any_gemini |= l_workaround;
}
+ }
- } // Data pair loop
+ if(l_any_gemini)
+ {
+ // MDI Workaround
+ FAPI_TRY(fapi2::getScom(i_target, P9A_MCC_USTLCFG, l_scom_data),
+ "Error reading from MCC_USTLCFG reg");
+ l_scom_data.setBit<P9A_MCC_USTLCFG_DEFAULT_META_DATA_ENABLE>();
+ l_scom_data.insertFromRight<P9A_MC_USTLCFG_DEFAULT_META_DATA,
+ P9A_MC_USTLCFG_DEFAULT_META_DATA_LEN>(USTL_MDI_EQUAL_ONE);
+ FAPI_TRY(fapi2::putScom(i_target, P9A_MCC_USTLCFG, l_scom_data),
+ "Error writing to MCC_USTLCFG reg");
+
+
+ fapi2::Target<fapi2::TARGET_TYPE_MI> l_mi_target = i_target.getParent<fapi2::TARGET_TYPE_MI>();
+ // Channel Timeout
+ FAPI_TRY(fapi2::getScom(l_mi_target, P9A_MI_MCTO, l_scom_data),
+ "Error reading from MCC_USTLCFG reg");
+ l_scom_data.clearBit<P9A_MI_MCTO_ENABLE_CHANNEL_HANG>();
+ FAPI_TRY(fapi2::putScom(l_mi_target, P9A_MI_MCTO, l_scom_data),
+ "Error writing to MCC_USTLCFG reg");
+ }
+
+ return fapi2::FAPI2_RC_SUCCESS;
fapi_try_exit:
- FAPI_DBG("Exit");
+ FAPI_DBG("Exiting fixGeminiMDI on %s", mss::c_str(i_target));
return fapi2::current_err;
}
-
///
/// @brief Unmask FIR before opening BARs
///
@@ -2462,7 +2570,7 @@ fapi2::ReturnCode p9_mss_setup_bars(
FAPI_TRY(FAPI_ATTR_GET(fapi2::ATTR_MSS_MCS_GROUP_32, i_target,
l_groupData),
"Error getting ATTR_MSS_MCS_GROUP_32, l_rc 0x%.8X",
- (uint64_t)fapi2::current_err);
+ uint64_t(fapi2::current_err));
// Setup BAR for Nimbus
if (l_mcsChiplets.size() > 0)
@@ -2470,22 +2578,22 @@ fapi2::ReturnCode p9_mss_setup_bars(
// Validate group data from attributes
FAPI_TRY(validateGroupData(l_mcsChiplets, false, l_groupData),
"validateGroupData() returns error, l_rc 0x%.8X",
- (uint64_t)fapi2::current_err);
+ uint64_t(fapi2::current_err));
// Build MC BAR data based on Group data info
FAPI_TRY(buildMCBarData(l_mcsChiplets, l_groupData, l_mcsBarDataPair),
"buildMCBarData() returns error, l_rc 0x%.8X",
- (uint64_t)fapi2::current_err);
+ uint64_t(fapi2::current_err));
// Unmask MC FIRs
FAPI_TRY(unmaskMCFIR(l_mcsBarDataPair),
"unmaskMCFIR() returns error, l_rc 0x%.8X",
- (uint64_t)fapi2::current_err);
+ uint64_t(fapi2::current_err));
// Write data to MCS
FAPI_TRY(writeMCBarData(l_mcsBarDataPair),
"writeMCBarData() returns error, l_rc 0x%.8X",
- (uint64_t)fapi2::current_err);
+ uint64_t(fapi2::current_err));
}
// Setup BAR for Axone
@@ -2494,25 +2602,33 @@ fapi2::ReturnCode p9_mss_setup_bars(
// Validate group data from attributes
FAPI_TRY(validateGroupData(l_mccChiplets, true, l_groupData),
"validateGroupData() returns error, l_rc 0x%.8X",
- (uint64_t)fapi2::current_err);
+ uint64_t(fapi2::current_err));
// Build MC BAR data based on Group data info
FAPI_TRY(buildMCBarData(l_mccChiplets, l_groupData, l_mccBarDataPair),
"buildMCBarData() returns error, l_rc 0x%.8X",
- (uint64_t)fapi2::current_err);
+ uint64_t(fapi2::current_err));
// Unmask MC FIRs
for (auto l_target : l_miChiplets)
{
FAPI_TRY(unmaskMCFIR(l_target),
"unmaskMCFIR() returns error, l_rc 0x%.8X",
- (uint64_t)fapi2::current_err);
+ uint64_t(fapi2::current_err));
+ }
+
+ // Apply Gemini MDI bit workaround
+ for (fapi2::Target<fapi2::TARGET_TYPE_MCC> l_target : l_mccChiplets)
+ {
+ FAPI_TRY(applyGeminiFixes(l_target),
+ "fixGeminiMDI() returns error, l_rc 0x%.8X",
+ uint64_t(fapi2::current_err));
}
// Write data to MI
FAPI_TRY(writeMCBarData(l_mccBarDataPair),
"writeMCBarData() returns error, l_rc 0x%.8X",
- (uint64_t)fapi2::current_err);
+ uint64_t(fapi2::current_err));
}
// Setup BAR for Cumulus
@@ -2521,22 +2637,22 @@ fapi2::ReturnCode p9_mss_setup_bars(
// Validate group data from attributes
FAPI_TRY(validateGroupData(l_miChiplets, false, l_groupData),
"validateGroupData() returns error, l_rc 0x%.8X",
- (uint64_t)fapi2::current_err);
+ uint64_t(fapi2::current_err));
// Build MC BAR data based on Group data info
FAPI_TRY(buildMCBarData(l_miChiplets, l_groupData, l_miBarDataPair),
"buildMCBarData() returns error, l_rc 0x%.8X",
- (uint64_t)fapi2::current_err);
+ uint64_t(fapi2::current_err));
// Unmask MC FIRs
FAPI_TRY(unmaskMCFIR(l_miBarDataPair),
"unmaskMCFIR() returns error, l_rc 0x%.8X",
- (uint64_t)fapi2::current_err);
+ uint64_t(fapi2::current_err));
// Write data to MI
FAPI_TRY(writeMCBarData(l_miBarDataPair),
"writeMCBarData() returns error, l_rc 0x%.8X",
- (uint64_t)fapi2::current_err);
+ uint64_t(fapi2::current_err));
}
OpenPOWER on IntegriCloud