summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/include/usr/hwpf/hwp/dimmBadDqBitmapAccessHwp.H3
-rw-r--r--src/include/usr/hwpf/hwp/mvpd_accessors/getMBvpdSpareDramData.H17
-rw-r--r--src/include/usr/hwpf/hwpf_reasoncodes.H2
-rw-r--r--src/include/usr/hwpf/plat/fapiPlatAttributeService.H16
-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
-rw-r--r--src/usr/hwpf/plat/fapiPlatAttributeService.C146
8 files changed, 213 insertions, 188 deletions
diff --git a/src/include/usr/hwpf/hwp/dimmBadDqBitmapAccessHwp.H b/src/include/usr/hwpf/hwp/dimmBadDqBitmapAccessHwp.H
index d57ab1490..3529c5d16 100644
--- a/src/include/usr/hwpf/hwp/dimmBadDqBitmapAccessHwp.H
+++ b/src/include/usr/hwpf/hwp/dimmBadDqBitmapAccessHwp.H
@@ -42,6 +42,7 @@
typedef fapi::ReturnCode (*dimmBadDqBitmapAccessHwp_FP_t)(
const fapi::Target &,
+ const fapi::Target &,
const uint8_t (&)[DIMM_DQ_MAX_DIMM_RANKS][DIMM_DQ_RANK_BITMAP_SIZE],
const bool);
@@ -62,6 +63,7 @@ extern "C"
* if (data[1][0] == 0x40) then rank 1, Centaur DQ1 is bad
* if (data[1][1] == 0x20) then rank 1, Centaur DQ10 is bad
*
+ * @param[in] i_mba Reference to MBA Target
* @param[in] i_dimm Reference to DIMM Target
* @param[io] io_data Reference to bad DQ bitmap data for the DIMM.
* @param[in] i_get True if getting DQ Bitmap data. False if setting data.
@@ -69,6 +71,7 @@ extern "C"
* @return ReturnCode
*/
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);
diff --git a/src/include/usr/hwpf/hwp/mvpd_accessors/getMBvpdSpareDramData.H b/src/include/usr/hwpf/hwp/mvpd_accessors/getMBvpdSpareDramData.H
index 0692b30af..39f37e089 100644
--- a/src/include/usr/hwpf/hwp/mvpd_accessors/getMBvpdSpareDramData.H
+++ b/src/include/usr/hwpf/hwp/mvpd_accessors/getMBvpdSpareDramData.H
@@ -29,29 +29,26 @@
typedef fapi::ReturnCode (*getMBvpdSpareDramData_FP_t)(
const fapi::Target &,
- const fapi::Target &,
- uint8_t &);
-
+ uint8_t (&)[DIMM_DQ_MAX_MBA_PORTS][DIMM_DQ_MAX_MBAPORT_DIMMS]
+ [DIMM_DQ_MAX_DIMM_RANKS]);
extern "C"
{
/**
- * @brief FW Team HWP that, for C-DIMMs, queries MBvpd to determine spare DRAM
- * availability and, for IS-DIMMS, returns NO_SPARE.
+ * @brief FW Team HWP that handles the ATTR_VPD_DIMM_SPARE attribute
+ * by querying MBvpd to determine spare DRAM availability for C-DIMMs.
*
* This HWP should be called through the VPD_DIMM_SPARE attribute.
*
- * @param[in] i_mba Reference to MBA Target associated with the DIMM.
- * @param[in] i_dimm Reference to DIMM Target.
+ * @param[in] i_mba Reference to MBA Target.
* @param[out] o_data Reference to spare DRAM data.
*
* @return ReturnCode
*/
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]);
}
#endif
diff --git a/src/include/usr/hwpf/hwpf_reasoncodes.H b/src/include/usr/hwpf/hwpf_reasoncodes.H
index 871297e4c..6b151a998 100644
--- a/src/include/usr/hwpf/hwpf_reasoncodes.H
+++ b/src/include/usr/hwpf/hwpf_reasoncodes.H
@@ -62,6 +62,8 @@ namespace fapi
MOD_VDDR_SEND_MSG = 0x17,
MOD_PLAT_ATTR_SVC_GET_MIRR_DATA = 0x18,
MOD_PLAT_ATTR_SVC_GET_SPARE_DATA = 0x19,
+ MOD_PLAT_ATTR_SVC_GET_BADDQ_DATA = 0x1A,
+ MOD_PLAT_ATTR_SVC_SET_BADDQ_DATA = 0x1B,
};
/**
diff --git a/src/include/usr/hwpf/plat/fapiPlatAttributeService.H b/src/include/usr/hwpf/plat/fapiPlatAttributeService.H
index 6e5d3b0e6..5e49540dc 100644
--- a/src/include/usr/hwpf/plat/fapiPlatAttributeService.H
+++ b/src/include/usr/hwpf/plat/fapiPlatAttributeService.H
@@ -514,13 +514,13 @@ fapi::ReturnCode fapiPlatGetSlopeInterceptData (
* the Bad DQ Bitmap attribute
* It should not be called directly.
*
- * @param[in] i_pTarget Target pointer
+ * @param[in] i_pTarget DIMM target pointer
* @param[out] o_data Bad DIMM DQ Bitmap
* @return ReturnCode. Zero on success, else platform specified error
*/
fapi::ReturnCode fapiPlatDimmGetBadDqBitmap (
const fapi::Target * i_pTarget,
- uint8_t (&o_data)[DIMM_DQ_MAX_DIMM_RANKS]\
+ uint8_t (&o_data)[DIMM_DQ_MAX_DIMM_RANKS]
[DIMM_DQ_RANK_BITMAP_SIZE]);
/**
@@ -528,13 +528,13 @@ fapi::ReturnCode fapiPlatDimmGetBadDqBitmap (
* the Bad DQ Bitmap attribute
* It should not be called directly.
*
- * @param[in] i_pTarget Target pointer
+ * @param[in] i_pTarget DIMM target pointer
* @param[in] i_data Bad DIMM DQ Bitmap
* @return ReturnCode. Zero on success, else platform specified error
*/
fapi::ReturnCode fapiPlatDimmSetBadDqBitmap (
const fapi::Target * i_pTarget,
- uint8_t (&i_data)[DIMM_DQ_MAX_DIMM_RANKS]\
+ uint8_t (&i_data)[DIMM_DQ_MAX_DIMM_RANKS]
[DIMM_DQ_RANK_BITMAP_SIZE]);
//------------------------------------------------------------------------------
@@ -547,13 +547,15 @@ fapi::ReturnCode fapiPlatDimmSetBadDqBitmap (
* the VPD DIMM Spare attribute
* It should not be called directly.
*
- * @param[in] i_pTarget Target pointer
- * @param[out] o_data Spare DRAM availability for DIMM
+ * @param[in] i_pTarget MBA target pointer
+ * @param[out] o_data Spare DRAM availability for all DIMMs on MBA
* @return ReturnCode. Zero on success, else platform specified error
*/
fapi::ReturnCode fapiPlatDimmGetSpareDram (
const fapi::Target * i_pTarget,
- uint8_t &o_data);
+ uint8_t (&o_data)[DIMM_DQ_MAX_MBA_PORTS]
+ [DIMM_DQ_MAX_MBAPORT_DIMMS]
+ [DIMM_DQ_MAX_DIMM_RANKS]);
/**
* @brief This function is called by the FAPI_ATTR_GET macro when getting
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;
diff --git a/src/usr/hwpf/plat/fapiPlatAttributeService.C b/src/usr/hwpf/plat/fapiPlatAttributeService.C
index 92a2dfd65..37e0ce639 100644
--- a/src/usr/hwpf/plat/fapiPlatAttributeService.C
+++ b/src/usr/hwpf/plat/fapiPlatAttributeService.C
@@ -1349,7 +1349,7 @@ fapi::ReturnCode fapiPlatGetEnableAttr ( fapi::AttributeId i_id,
* the Bad DQ Bitmap attribute
* It should not be called directly.
*
- * @param[in] i_pTarget Target pointer
+ * @param[in] i_pTarget DIMM target pointer
* @param[out] o_data Bad DIMM DQ Bitmap
* @return ReturnCode. Zero on success, else platform specified error
*/
@@ -1359,13 +1359,63 @@ fapi::ReturnCode fapiPlatDimmGetBadDqBitmap (
[DIMM_DQ_RANK_BITMAP_SIZE])
{
fapi::ReturnCode l_rc;
- FAPI_EXEC_HWP(l_rc, dimmBadDqBitmapAccessHwp, *i_pTarget, o_data, true);
-
- if (l_rc)
+ TARGETING::Target * l_pTarget = NULL;
+ TARGETING::TargetHandleList l_mbaList;
+ do
{
- FAPI_ERR("dimmGetBadDqBitmap: "
- "Error from dimmBadDqBitmapAccessHwp (get)");
- }
+ // Get the Targeting Target
+ l_rc = getTargetingTarget(i_pTarget, l_pTarget);
+ if (l_rc)
+ {
+ FAPI_ERR("fapiPlatDimmGetBadDqBitmap:Error from getTargetingTarget");
+ break;
+ }
+
+ // Find MBA target from DIMM target
+ getParentAffinityTargets(l_mbaList, l_pTarget, TARGETING::CLASS_UNIT,
+ TARGETING::TYPE_MBA, false);
+
+
+ if (l_mbaList.size() != 1 )
+ {
+ FAPI_ERR("fapiPlatDimmGetBadDqBitmap: expect 1 mba %d ",
+ l_mbaList.size());
+
+ /*@
+ * @errortype
+ * @moduleid fapi::MOD_PLAT_ATTR_SVC_GET_BADDQ_DATA
+ * @reasoncode fapi::RC_NO_SINGLE_MBA
+ * @userdata1 Number of MBAs
+ * @devdesc fapiPlatDimmGetBadDqBitmap could not find the
+ * expected 1 mba from the passed dimm target
+ */
+ errlHndl_t l_pError = new ERRORLOG::ErrlEntry(
+ ERRORLOG::ERRL_SEV_UNRECOVERABLE,
+ fapi::MOD_PLAT_ATTR_SVC_GET_BADDQ_DATA,
+ fapi::RC_NO_SINGLE_MBA,
+ l_mbaList.size());
+
+ // Attach the error log to the fapi::ReturnCode
+ l_rc.setPlatError(reinterpret_cast<void *> (l_pError));
+ break;
+ }
+
+
+ // Create the Fapi Target
+ fapi::Target l_mbaTarget(TARGET_TYPE_MBA_CHIPLET,
+ static_cast<void *>(l_mbaList[0]));
+
+
+ FAPI_EXEC_HWP(l_rc, dimmBadDqBitmapAccessHwp,
+ l_mbaTarget, *i_pTarget, o_data, true);
+
+ if (l_rc)
+ {
+ FAPI_ERR("fapiPlatDimmGetBadDqBitmap: "
+ "Error from dimmBadDqBitmapAccessHwp (get)");
+ }
+
+ }while(0);
return l_rc;
}
@@ -1375,7 +1425,7 @@ fapi::ReturnCode fapiPlatDimmGetBadDqBitmap (
* the Bad DQ Bitmap attribute
* It should not be called directly.
*
- * @param[in] i_pTarget Target pointer
+ * @param[in] i_pTarget DIMM target pointer
* @param[in] i_data Bad DIMM DQ Bitmap
* @return ReturnCode. Zero on success, else platform specified error
*/
@@ -1385,36 +1435,6 @@ fapi::ReturnCode fapiPlatDimmSetBadDqBitmap (
[DIMM_DQ_RANK_BITMAP_SIZE])
{
fapi::ReturnCode l_rc;
- FAPI_EXEC_HWP(l_rc, dimmBadDqBitmapAccessHwp, *i_pTarget, i_data, false);
-
- if (l_rc)
- {
- FAPI_ERR("dimmSetBadDqBitmap: "
- "Error from dimmBadDqBitmapAccessHwp (set)");
- }
- return l_rc;
-}
-
-//------------------------------------------------------------------------------
-// Function to support VPD_DIMM_SPARE attribute
-// See dimm_spd_attributes.xml for detailed description
-//------------------------------------------------------------------------------
-
-/**
- * @brief This function is called by the FAPI_ATTR_GET macro when getting
- * the VPD DIMM Spare attribute
- * It should not be called directly.
- *
- * @param[in] i_pTarget Target pointer
- * @param[out] o_data Spare DRAM availability for DIMM
- * @return ReturnCode. Zero on success, else platform specified error
- */
-fapi::ReturnCode fapiPlatDimmGetSpareDram (
- const fapi::Target * i_pTarget,
- uint8_t &o_data)
-{
-
- fapi::ReturnCode l_rc;
TARGETING::Target * l_pTarget = NULL;
TARGETING::TargetHandleList l_mbaList;
do
@@ -1423,7 +1443,7 @@ fapi::ReturnCode fapiPlatDimmGetSpareDram (
l_rc = getTargetingTarget(i_pTarget, l_pTarget);
if (l_rc)
{
- FAPI_ERR("fapiPlatDimmGetSpareDram:Error from getTargetingTarget");
+ FAPI_ERR("fapiPlatDimmSetBadDqBitmap:Error from getTargetingTarget");
break;
}
@@ -1434,20 +1454,20 @@ fapi::ReturnCode fapiPlatDimmGetSpareDram (
if (l_mbaList.size() != 1 )
{
- FAPI_ERR("fapiPlatDimmGetSpareDram: expect 1 mba %d ",
+ FAPI_ERR("fapiPlatDimmSetBadDqBitmap: expect 1 mba %d ",
l_mbaList.size());
/*@
* @errortype
- * @moduleid fapi::MOD_PLAT_ATTR_SVC_GET_SPARE_DATA
+ * @moduleid fapi::MOD_PLAT_ATTR_SVC_SET_BADDQ_DATA
* @reasoncode fapi::RC_NO_SINGLE_MBA
* @userdata1 Number of MBAs
- * @devdesc fapiPlatDimmGetSpareDram could not find the
+ * @devdesc fapiPlatDimmSetBadDqBitmap could not find the
* expected 1 mba from the passed dimm target
*/
errlHndl_t l_pError = new ERRORLOG::ErrlEntry(
ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- fapi::MOD_PLAT_ATTR_SVC_GET_SPARE_DATA,
+ fapi::MOD_PLAT_ATTR_SVC_SET_BADDQ_DATA,
fapi::RC_NO_SINGLE_MBA,
l_mbaList.size());
@@ -1462,8 +1482,44 @@ fapi::ReturnCode fapiPlatDimmGetSpareDram (
static_cast<void *>(l_mbaList[0]));
- FAPI_EXEC_HWP(l_rc, getMBvpdSpareDramData, l_mbaTarget, *i_pTarget,
- o_data);
+ FAPI_EXEC_HWP(l_rc, dimmBadDqBitmapAccessHwp,
+ l_mbaTarget, *i_pTarget, i_data, false);
+
+ if (l_rc)
+ {
+ FAPI_ERR("fapiPlatdimmSetBadDqBitmap: "
+ "Error from dimmBadDqBitmapAccessHwp (set)");
+ }
+
+ }while(0);
+ return l_rc;
+}
+
+//------------------------------------------------------------------------------
+// Function to support VPD_DIMM_SPARE attribute
+// See dimm_spd_attributes.xml for detailed description
+//------------------------------------------------------------------------------
+
+/**
+ * @brief This function is called by the FAPI_ATTR_GET macro when getting
+ * the VPD DIMM Spare attribute
+ * It should not be called directly.
+ *
+ * @param[in] i_pTarget MBA target pointer
+ * @param[out] o_data Spare DRAM availability for MBA
+ * @return ReturnCode. Zero on success, else platform specified error
+ */
+fapi::ReturnCode fapiPlatDimmGetSpareDram (
+ const fapi::Target * i_pTarget,
+ uint8_t (&o_data)[DIMM_DQ_MAX_MBA_PORTS]
+ [DIMM_DQ_MAX_MBAPORT_DIMMS]
+ [DIMM_DQ_MAX_DIMM_RANKS])
+{
+
+ fapi::ReturnCode l_rc;
+ do
+ {
+ FAPI_EXEC_HWP(l_rc, getMBvpdSpareDramData, *i_pTarget, o_data);
if (l_rc)
{
OpenPOWER on IntegriCloud