summaryrefslogtreecommitdiffstats
path: root/src/usr/hwpf/hwp
diff options
context:
space:
mode:
Diffstat (limited to 'src/usr/hwpf/hwp')
-rw-r--r--src/usr/hwpf/hwp/dimmBadDqBitmapAccessHwp.C55
-rw-r--r--src/usr/hwpf/hwp/dimm_attributes.xml21
-rw-r--r--src/usr/hwpf/hwp/mvpd_accessors/getMBvpdSpareDramData.C141
3 files changed, 91 insertions, 126 deletions
diff --git a/src/usr/hwpf/hwp/dimmBadDqBitmapAccessHwp.C b/src/usr/hwpf/hwp/dimmBadDqBitmapAccessHwp.C
index fd66af567..3d4dbb370 100644
--- a/src/usr/hwpf/hwp/dimmBadDqBitmapAccessHwp.C
+++ b/src/usr/hwpf/hwp/dimmBadDqBitmapAccessHwp.C
@@ -35,6 +35,8 @@
* mjjones 01/30/2013 Cope with platform endian
* differences
* dedahle 06/22/2013 Show unconnected DQ lines
+ * dedahle 09/20/2013 Temporarily use
+ * ATTR_EFF_DIMM_SPARE
*/
#include <dimmBadDqBitmapAccessHwp.H>
@@ -60,10 +62,11 @@ extern "C"
{
/**
- * @brief Called by dimmBadDqBitmapAccessHwp() to query ATR_VPD_DIMM_SPARE
+ * @brief Called by dimmBadDqBitmapAccessHwp() to query ATTR_EFF_DIMM_SPARE
* and set bits for unconnected spare DRAM in caller's data.
*
*
+ * @param[in] i_mba Reference to MBA Target.
* @param[in] i_dimm Reference to DIMM Target.
* @param[o] o_data Reference to Bad DQ Bitmap set by
* the caller. Only the SPARE_DRAM_DQ_BYTE_NUMBER_INDEX
@@ -73,6 +76,7 @@ extern "C"
*/
fapi::ReturnCode dimmUpdateDqBitmapSpareByte(
+ const fapi::Target & i_mba,
const fapi::Target & i_dimm,
uint8_t (&o_data)[DIMM_DQ_MAX_DIMM_RANKS][DIMM_DQ_RANK_BITMAP_SIZE])
{
@@ -80,27 +84,42 @@ fapi::ReturnCode dimmUpdateDqBitmapSpareByte(
do
{
- // Spare DRAM Attribute
- uint8_t l_dimmSpare = 0;
- l_rc = FAPI_ATTR_GET(ATTR_VPD_DIMM_SPARE, &i_dimm, l_dimmSpare);
+ // Spare DRAM Attribute: Returns spare DRAM availability for
+ // all DIMMs associated with the target MBA.
+ uint8_t l_mbaSpare[DIMM_DQ_MAX_MBA_PORTS][DIMM_DQ_MAX_MBAPORT_DIMMS]
+ [DIMM_DQ_MAX_DIMM_RANKS] = {};
+ // TODO RTC 84506 Change to use ATTR_VPD_DIMM_SPARE once Cronus
+ // makes transition to reading VPD.
+ l_rc = FAPI_ATTR_GET(ATTR_EFF_DIMM_SPARE, &i_mba, l_mbaSpare);
if (l_rc)
{
- FAPI_ERR("dimmCheckSpareDram: "
+ FAPI_ERR("dimmUpdateDqBitmapSpareByte: "
"Error getting DRAM Spare data");
break;
}
-
- // Bitmask and beginning bit shift values for decoding
- // ATTR_VPD_DIMM_SPARE attribute as described in
- // dimm_spd_attributes.xml.
- uint8_t l_dimmMask = 0xC0;
- uint8_t l_rankBitShift = 6;
-
+ // Find the mba port this dimm is connected to
+ uint8_t l_mbaPort = 0;
+ l_rc = FAPI_ATTR_GET(ATTR_MBA_PORT, &i_dimm, l_mbaPort);
+ if (l_rc)
+ {
+ FAPI_ERR("dimmUpdateDqBitmapSpareByte: "
+ "Error getting MBA port number");
+ break;
+ }
+ // Find the dimm number associated with this dimm
+ uint8_t l_dimm = 0;
+ l_rc = FAPI_ATTR_GET(ATTR_MBA_DIMM, &i_dimm, l_dimm);
+ if (l_rc)
+ {
+ FAPI_ERR("dimmUpdateDqBitmapSpareByte: "
+ "Error getting dimm number");
+ break;
+ }
// Iterate through each rank of this DIMM
for (uint8_t i = 0; i < DIMM_DQ_MAX_DIMM_RANKS; i++)
{
// Handle spare DRAM configuration cases
- switch ((l_dimmSpare & l_dimmMask) >> l_rankBitShift)
+ switch (l_mbaSpare[l_mbaPort][l_dimm][i])
{
case fapi::ENUM_ATTR_VPD_DIMM_SPARE_NO_SPARE:
// Set DQ bits reflecting unconnected
@@ -122,9 +141,6 @@ fapi::ReturnCode dimmUpdateDqBitmapSpareByte(
o_data[i][SPARE_DRAM_DQ_BYTE_NUMBER_INDEX] = 0x00;
break;
}
-
- l_dimmMask >>= 2;
- l_rankBitShift -= 2;
}
}while(0);
return l_rc;
@@ -136,6 +152,7 @@ extern "C"
{
fapi::ReturnCode dimmBadDqBitmapAccessHwp(
+ const fapi::Target & i_mba,
const fapi::Target & i_dimm,
uint8_t (&io_data)[DIMM_DQ_MAX_DIMM_RANKS][DIMM_DQ_RANK_BITMAP_SIZE],
const bool i_get)
@@ -156,12 +173,12 @@ fapi::ReturnCode dimmBadDqBitmapAccessHwp(
// Centaur DQ to DIMM Connector DQ Wiring attribute.
uint8_t (&l_wiringData)[DIMM_DQ_NUM_DQS] =
*(reinterpret_cast<uint8_t(*)[DIMM_DQ_NUM_DQS]>
- (new uint8_t[DIMM_DQ_NUM_DQS]));
+ (new uint8_t[DIMM_DQ_NUM_DQS]()));
// DQ SPD Attribute
uint8_t (&l_spdData)[DIMM_DQ_SPD_DATA_SIZE] =
*(reinterpret_cast<uint8_t(*)[DIMM_DQ_SPD_DATA_SIZE]>
- (new uint8_t[DIMM_DQ_SPD_DATA_SIZE]));
+ (new uint8_t[DIMM_DQ_SPD_DATA_SIZE]()));
// Memory Bus Width Attribute
uint8_t l_eccBits = 0;
@@ -274,7 +291,7 @@ fapi::ReturnCode dimmBadDqBitmapAccessHwp(
}
}
// Check spare DRAM
- l_rc = dimmUpdateDqBitmapSpareByte(i_dimm, io_data);
+ l_rc = dimmUpdateDqBitmapSpareByte(i_mba, i_dimm, io_data);
if (l_rc)
{
FAPI_ERR("dimmBadDqBitmapAccessHwp: "
diff --git a/src/usr/hwpf/hwp/dimm_attributes.xml b/src/usr/hwpf/hwp/dimm_attributes.xml
index e066c0e20..5dcd070f9 100644
--- a/src/usr/hwpf/hwp/dimm_attributes.xml
+++ b/src/usr/hwpf/hwp/dimm_attributes.xml
@@ -75,10 +75,10 @@
<attribute>
<id>ATTR_VPD_DIMM_SPARE</id>
- <targetType>TARGET_TYPE_DIMM</targetType>
+ <targetType>TARGET_TYPE_MBA_CHIPLET</targetType>
<description>
- Spare DRAM availability for each rank on the DIMM.
- There are 8 DQ lines to spare DRAMs.
+ Spare DRAM availability for all DIMMs connected to the target MBA.
+ For each rank on a DIMM, there are 8 DQ lines to spare DRAMs.
- NO_SPARE: No spare DRAMs
- LOW_NIBBLE: x4 DRAMs in use, one spare DRAM connected to SP_DQ0-3
- HIGH_NIBBLE: x4 DRAMs in use, one spare DRAM connected to SP_DQ4-7
@@ -86,20 +86,6 @@
1/ x4 DRAMs in use, two spare DRAMs connected to SP_DQ0-7
2/ x8 DRAMs in use, one spare DRAM connected to SP_DQ0-7
For C-DIMMs, this is in a VPD field : Record:VSPD, Keyword:AM
- For IS-DIMMs, the platform should return 0 indicating
- no spares for any rank.
- The top 2 bits are for rank 0 e.g:
- if (((val AND 0xc0) >> 6) ==
- ENUM_ATTR_VPD_DIMM_SPARE_LOW_NIBBLE) {...}
- The next 2 bits are for rank 1 e.g:
- if (((val AND 0x30) >> 4) ==
- ENUM_ATTR_VPD_DIMM_SPARE_NO_SPARE) {...}
- The next 2 bits are for rank 2 e.g:
- if (((val AND 0x0c) >> 2) ==
- ENUM_ATTR_VPD_DIMM_SPARE_HIGH_NIBBLE) {...}
- The bottom 2 bits are for rank 3 e.g:
- if ((val AND 0x03) ==
- ENUM_ATTR_VPD_DIMM_SPARE_FULL_BYTE) {...}
</description>
<valueType>uint8</valueType>
<enum>
@@ -108,6 +94,7 @@
HIGH_NIBBLE = 0x02,
FULL_BYTE = 0x03
</enum>
+ <array>2 2 4</array>
<platInit/>
</attribute>
diff --git a/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdSpareDramData.C b/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdSpareDramData.C
index 3bfae7b32..8605ea5f8 100644
--- a/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdSpareDramData.C
+++ b/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdSpareDramData.C
@@ -33,18 +33,16 @@ extern "C"
using namespace fapi;
fapi::ReturnCode getMBvpdSpareDramData(const fapi::Target &i_mba,
- const fapi::Target &i_dimm,
- uint8_t &o_data)
-
+ uint8_t (&o_data)[DIMM_DQ_MAX_MBA_PORTS]
+ [DIMM_DQ_MAX_MBAPORT_DIMMS]
+ [DIMM_DQ_MAX_DIMM_RANKS])
{
// AM keyword layout
const uint8_t NUM_MBAS = 2; // Two MBAs per Centaur
- const uint8_t NUM_PORTS = 2; // Two ports per MBA
- const uint8_t NUM_DIMMS = 2; // Two DIMMS per port
const uint8_t NUM_MIRR_BYTES = 4; // Size of address mirror data
// Struct for AM Keyword buffer
- // Contains a simple array for the address mirror data and
+ // Contains a 1D array for the address mirror data and
// a 2D array for the spare DRAM data.
struct MirrorData
{
@@ -57,11 +55,11 @@ fapi::ReturnCode getMBvpdSpareDramData(const fapi::Target &i_mba,
};
struct PortSpareData
{
- DimmSpareData iv_dimmSpareData[NUM_DIMMS];
+ DimmSpareData iv_dimmSpareData[DIMM_DQ_MAX_MBAPORT_DIMMS];
};
struct MbaSpareData
{
- PortSpareData iv_portSpareData[NUM_PORTS];
+ PortSpareData iv_portSpareData[DIMM_DQ_MAX_MBA_PORTS];
};
struct AmKeyword
{
@@ -69,40 +67,19 @@ fapi::ReturnCode getMBvpdSpareDramData(const fapi::Target &i_mba,
MbaSpareData iv_mbaSpareData[NUM_MBAS];
};
- // Current VPD AM keyword size
+ // AM keyword size
const uint32_t AM_KEYWORD_SIZE = sizeof(AmKeyword);
fapi::ReturnCode l_rc;
- // Centaur target
+ // Centaur memory buffer target
fapi::Target l_mbTarget;
// MBvpd AM keyword buffer
AmKeyword * l_pAmBuffer = NULL;
uint32_t l_AmBufSize = sizeof(AmKeyword);
- // For old VPD without spare DRAM data
- // Store data for all 4 ranks of this DIMM
- const uint8_t VPD_WITHOUT_SPARE_LOW_NIBBLE = 0x55;
- const uint8_t VPD_WITHOUT_SPARE_FULL_BYTE = 0xFF;
-
do
{
- // Check to see if IS-DIMM
- uint8_t l_dimmType = 0;
- l_rc = FAPI_ATTR_GET(ATTR_SPD_CUSTOM, &i_dimm, l_dimmType);
- if (l_rc)
- {
- FAPI_ERR("getMBvpdSpareDramData: "
- "Error getting ATTR_SPD_CUSTOM");
- break;
- }
- if (fapi::ENUM_ATTR_SPD_CUSTOM_NO == l_dimmType)
- {
- //IS-DIMM, return NO_SPARE
- o_data = fapi::ENUM_ATTR_VPD_DIMM_SPARE_NO_SPARE;
- break;
- }
-
// find the Centaur memory buffer from the passed MBA
- l_rc = fapiGetParentChip (i_mba,l_mbTarget);
+ l_rc = fapiGetParentChip (i_mba, l_mbTarget);
if (l_rc)
{
FAPI_ERR("getMBvpdSpareDramData: Finding the parent mb failed ");
@@ -110,84 +87,68 @@ fapi::ReturnCode getMBvpdSpareDramData(const fapi::Target &i_mba,
}
// Read AM keyword field
- l_pAmBuffer = new AmKeyword;
+ l_pAmBuffer = new AmKeyword();
l_rc = fapiGetMBvpdField(fapi::MBVPD_RECORD_VSPD,
fapi::MBVPD_KEYWORD_AM,
l_mbTarget,
reinterpret_cast<uint8_t *>(l_pAmBuffer),
l_AmBufSize);
+ if (l_rc)
+ {
+ FAPI_ERR("getMBvpdSpareDramData: "
+ "Read of AM Keyword failed");
+ break;
+ }
// Check for error or incorrect amount of data returned
- if (l_rc || (l_AmBufSize < AM_KEYWORD_SIZE))
+ if (l_AmBufSize < AM_KEYWORD_SIZE)
{
- // This handles two scenarios:
- // 1. fapiGetMBvpdField has returned an error because
- // the AM keyword is not present in this DIMM's
- // VPD.
- // 2. This DIMM does have the AM Keyword, however it
- // is in an old version of VPD and does not contain
- // any spare DRAM information.
- // In both cases, the ATTR_SPD_DRAM_WIDTH
- // attribute is used to determine spare DRAM availability.
- // If x4 configuration, assume LOW_NIBBLE.
- // Otherwise, FULL_BYTE.
- // TODO RTC 84278: Undo the workaround for scenario 1 once the
- // C-DIMM VPD is updated on all DIMMs to the current version.
- uint8_t l_dramWidth = 0;
- l_rc = FAPI_ATTR_GET(ATTR_SPD_DRAM_WIDTH, &i_dimm, l_dramWidth);
- if (l_rc)
- {
- FAPI_ERR("getMBvpdSpareDramData: "
- "Error getting DRAM spare data");
- break;
- }
- // If x4 configuration, low nibble.
- if (fapi::ENUM_ATTR_SPD_DRAM_WIDTH_W4 == l_dramWidth)
- {
- o_data = VPD_WITHOUT_SPARE_LOW_NIBBLE;
- break;
- }
- // Else, full spare.
- else
- {
- o_data = VPD_WITHOUT_SPARE_FULL_BYTE;
- break;
- }
+ FAPI_ERR("getMBvpdSpareDramData:"
+ " less AM keyword returned than expected %d < %d",
+ l_AmBufSize, AM_KEYWORD_SIZE);
+ const uint32_t & KEYWORD = fapi::MBVPD_KEYWORD_AM;
+ const uint32_t & RETURNED_SIZE = l_AmBufSize;
+ FAPI_SET_HWP_ERROR(l_rc, RC_MBVPD_INSUFFICIENT_VPD_RETURNED );
+ break;
}
-
- // Return the spare DRAM availability for particular dimm
// Find the position of the passed mba on the centuar
uint8_t l_mba = 0;
l_rc = FAPI_ATTR_GET(ATTR_CHIP_UNIT_POS, &i_mba, l_mba);
+
if (l_rc)
{
FAPI_ERR("getMBvpdSpareDramData: Get MBA position failed ");
break;
}
- // Find the mba port this dimm is connected to
- uint8_t l_mbaPort = 0;
- l_rc = FAPI_ATTR_GET(ATTR_MBA_PORT, &i_dimm, l_mbaPort);
- if (l_rc)
- {
- FAPI_ERR("getMBvpdSpareDramData: "
- "Error getting MBA port number");
- break;
- }
- // Find the dimm number associated with this dimm
- uint8_t l_dimm = 0;
- l_rc = FAPI_ATTR_GET(ATTR_MBA_DIMM, &i_dimm, l_dimm);
- if (l_rc)
+ // Data in the AM Keyword contains information for both MBAs and
+ // is stored in [mba][port][dimm] ([2][2][2]) format, where the
+ // third (dimm) dimension contains a byte where each two bits of that
+ // byte are the spare status for a particular rank.
+ // The caller expects data returned for a particular MBA,
+ // and where the ranks for each dimm are separately indexed,
+ // so conversion to a [port][dimm][rank] ([2][2][4]) format
+ // is necessary.
+ for (uint8_t i = 0; i < DIMM_DQ_MAX_MBA_PORTS; i++)
{
- FAPI_ERR("getMBvpdSpareDramData: "
- "Error getting dimm number");
- break;
+ for (uint8_t j = 0; j < DIMM_DQ_MAX_MBAPORT_DIMMS; j++)
+ {
+ // Mask to pull of two bits at a time from iv_dimmSpareData
+ uint8_t l_dimmMask = 0xC0;
+ // Shift amount decrements each time as l_dimmMask is shifted
+ // to the right
+ uint8_t l_rankBitShift = 6;
+ for (uint8_t k = 0; k < DIMM_DQ_MAX_DIMM_RANKS; k++)
+ {
+ o_data[i][j][k] = ((l_pAmBuffer->iv_mbaSpareData[l_mba].
+ iv_portSpareData[i].iv_dimmSpareData[j].
+ iv_dimmSpareData & l_dimmMask) >>
+ l_rankBitShift);
+ l_dimmMask >>= 2;
+ l_rankBitShift -= 2;
+ }
+ }
}
-
- o_data = l_pAmBuffer->iv_mbaSpareData[l_mba].\
- iv_portSpareData[l_mbaPort].\
- iv_dimmSpareData[l_dimm].iv_dimmSpareData;
-
}while(0);
delete l_pAmBuffer;
OpenPOWER on IntegriCloud