summaryrefslogtreecommitdiffstats
path: root/src/usr/hwpf
diff options
context:
space:
mode:
authorBill Schwartz <whs@us.ibm.com>2013-11-20 07:50:29 -0600
committerA. Patrick Williams III <iawillia@us.ibm.com>2013-12-06 09:52:28 -0600
commitfd95cabecf413f579457779a32b903cf9f789b77 (patch)
treeb8e4ae21101bd6d4c47870ade5495e7be28fb8a4 /src/usr/hwpf
parenta96e2080968c59e11745fc1d1ee55ab910821bc9 (diff)
downloadtalos-hostboot-fd95cabecf413f579457779a32b903cf9f789b77.tar.gz
talos-hostboot-fd95cabecf413f579457779a32b903cf9f789b77.zip
SENSOR_MAP FAPI attributes should come from Centaur VPD (MW)
Add hwp accessor for primary and secondary sensor map from VSPD keyword MW Change-Id: I7f64632c32236ecb29f5fd177bd5d8e9e356d7ae RTC: 91776 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/7344 Tested-by: Jenkins Server Reviewed-by: Brian H. Horton <brianh@linux.ibm.com> Reviewed-by: MIKE J. JONES <mjjones@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/hwpf')
-rw-r--r--src/usr/hwpf/hwp/dimm_spd_attributes.xml38
-rw-r--r--src/usr/hwpf/hwp/mvpd_accessors/getMBvpdSensorMap.C128
-rw-r--r--src/usr/hwpf/hwp/mvpd_accessors/mvpd.mk3
-rw-r--r--src/usr/hwpf/plat/fapiPlatAttributeService.C12
-rw-r--r--src/usr/hwpf/test/fapiwinkletest.H105
5 files changed, 276 insertions, 10 deletions
diff --git a/src/usr/hwpf/hwp/dimm_spd_attributes.xml b/src/usr/hwpf/hwp/dimm_spd_attributes.xml
index 77af0e71d..704d9c959 100644
--- a/src/usr/hwpf/hwp/dimm_spd_attributes.xml
+++ b/src/usr/hwpf/hwp/dimm_spd_attributes.xml
@@ -2307,6 +2307,44 @@ This Attribute is to be interpreted as an Integer</description>
</attribute>
<attribute>
+ <id>ATTR_VPD_CDIMM_SENSOR_MAP_PRIMARY</id>
+ <targetType>TARGET_TYPE_MEMBUF_CHIP</targetType>
+ <description>Custom DIMM Sensor Map for Primary I2C Port (1 byte of data):
+0x00 No sensors attached
+0x01 DIMM sensor 0 attached
+0x02 DIMM sensor 1 attached
+0x04 DIMM sensor 2 attached
+0x08 DIMM sensor 3 attached
+0x10 DIMM sensor 4 attached
+0x20 DIMM sensor 5 attached
+0x40 DIMM sensor 6 attached
+0x80 DIMM sensor 7 attached
+Comes from the VPD MW Keyword</description>
+ <valueType>uint8</valueType>
+ <platInit/>
+ <odmVisable/>
+</attribute>
+
+<attribute>
+ <id>ATTR_VPD_CDIMM_SENSOR_MAP_SECONDARY</id>
+ <targetType>TARGET_TYPE_MEMBUF_CHIP</targetType>
+ <description>Custom DIMM Sensor Map for Secondary I2C Port (1 byte of data):
+0x00 No sensors attached
+0x01 DIMM sensor 0 attached
+0x02 DIMM sensor 1 attached
+0x04 DIMM sensor 2 attached
+0x08 DIMM sensor 3 attached
+0x10 DIMM sensor 4 attached
+0x20 DIMM sensor 5 attached
+0x40 DIMM sensor 6 attached
+0x80 DIMM sensor 7 attached
+Comes from the VPD MW Keyword</description>
+ <valueType>uint8</valueType>
+ <platInit/>
+ <odmVisable/>
+</attribute>
+
+<attribute>
<id>ATTR_VPD_DRAM_2N_MODE_ENABLED</id>
<targetType>TARGET_TYPE_MBA_CHIPLET</targetType>
<description>Describes if this MBA is in 2N address mode. The DIMM attributes associated with this MBA describes if this mode is needed for SI. Come from the VPD and consumed in the mba_def.initfile.</description>
diff --git a/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdSensorMap.C b/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdSensorMap.C
new file mode 100644
index 000000000..37d20d311
--- /dev/null
+++ b/src/usr/hwpf/hwp/mvpd_accessors/getMBvpdSensorMap.C
@@ -0,0 +1,128 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/hwpf/hwp/mvpd_accessors/getMBvpdSensorMap.C $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2012,2013 */
+/* */
+/* p1 */
+/* */
+/* Object Code Only (OCO) source materials */
+/* Licensed Internal Code Source Materials */
+/* IBM HostBoot Licensed Internal Code */
+/* */
+/* The source code for this program is not published or otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
+// $Id: getMBvpdSensorMap.C,v 1.1 2013/11/20 22:37:38 whs Exp $
+
+/**
+ * @file getMBvpdSensorMap.C
+ *
+ * @brief Return primary and secondary sensor map from cvpd record VSPD
+ * keyword MW for attributes:
+ *
+ * ATTR_VPD_CDIMM_SENSOR_MAP_PRIMARY
+ * ATTR_VPD_CDIMM_SENSOR_MAP_SECONDARY
+ */
+
+#include <stdint.h>
+
+// fapi support
+#include <fapi.H>
+#include <getMBvpdSensorMap.H>
+
+extern "C"
+{
+using namespace fapi;
+
+fapi::ReturnCode getMBvpdSensorMap(
+ const fapi::Target &i_mbTarget,
+ const fapi::MBvpdSensorMap i_attr,
+ uint8_t &o_val)
+
+{
+ fapi::ReturnCode l_fapirc;
+
+ //MW keyword layout
+ struct mw_keyword
+ {
+ uint8_t MWKeywordVersion;
+ uint8_t masterPowerSlope_MSB; //big endian order
+ uint8_t masterPowerSlope_LSB;
+ uint8_t masterPowerIntercept_MSB; //big endian order
+ uint8_t masterPowerIntercept_LSB;
+ uint8_t reserved[4];
+ uint8_t tempSensorPrimaryLayout;
+ uint8_t tempSensorSecondaryLayout;
+ };
+ const uint32_t MW_KEYWORD_SIZE = sizeof(mw_keyword); // keyword size
+
+ mw_keyword * l_pMwBuffer = NULL; // MBvpd MW keyword buffer
+ uint32_t l_MwBufsize = sizeof(mw_keyword);
+
+ FAPI_DBG("getMBvpdSensorMap: entry ");
+
+ do {
+
+ l_pMwBuffer = new mw_keyword;
+
+ // Read the MW keyword field
+ l_fapirc = fapiGetMBvpdField(fapi::MBVPD_RECORD_VSPD,
+ fapi::MBVPD_KEYWORD_MW,
+ i_mbTarget,
+ reinterpret_cast<uint8_t *>(l_pMwBuffer),
+ l_MwBufsize);
+ if (l_fapirc)
+ {
+ FAPI_ERR("getMBvpdSensorMap: Read of MV keyword failed");
+ break; // break out with fapirc
+ }
+ // Check that sufficient MW keyword was returned.
+ if (l_MwBufsize < MW_KEYWORD_SIZE )
+ {
+ FAPI_ERR("getMBvpdSensorMap:"
+ " less MW keyword returned than expected %d < %d",
+ l_MwBufsize, MW_KEYWORD_SIZE);
+ const uint32_t & KEYWORD = fapi::MBVPD_KEYWORD_MW;
+ const uint32_t & RETURNED_SIZE = l_MwBufsize;
+ FAPI_SET_HWP_ERROR(l_fapirc, RC_MBVPD_INSUFFICIENT_VPD_RETURNED );
+ break; // break out with fapirc
+ }
+
+ // Return requested value
+ switch (i_attr)
+ {
+ case SENSOR_MAP_PRIMARY:
+ o_val = l_pMwBuffer->tempSensorPrimaryLayout;
+ break;
+ case SENSOR_MAP_SECONDARY:
+ o_val = l_pMwBuffer->tempSensorSecondaryLayout;
+ break;
+ default: // Hard to do, but needs to be caught
+ FAPI_ERR("getMBvpdSensorMap: invalid attribute ID 0x%02x",
+ i_attr);
+ const fapi::MBvpdSensorMap & ATTR_ID = i_attr;
+ FAPI_SET_HWP_ERROR(l_fapirc, RC_MBVPD_INVALID_ATTRIBUTE_ID);
+ break;
+ }
+
+ } while (0);
+
+ delete l_pMwBuffer;
+ l_pMwBuffer = NULL;
+
+ FAPI_DBG("getMBvpdSensorMap: exit rc=0x%08x",
+ static_cast<uint32_t>(l_fapirc));
+
+ return l_fapirc;
+
+}
+
+} // extern "C"
diff --git a/src/usr/hwpf/hwp/mvpd_accessors/mvpd.mk b/src/usr/hwpf/hwp/mvpd_accessors/mvpd.mk
index d90544f73..767090c12 100644
--- a/src/usr/hwpf/hwp/mvpd_accessors/mvpd.mk
+++ b/src/usr/hwpf/hwp/mvpd_accessors/mvpd.mk
@@ -36,5 +36,6 @@ OBJS += getMvpdRing.o \
getMBvpdSlopeInterceptData.o \
getMBvpdSpareDramData.o \
getMBvpdVersion.o \
- getMBvpdDram2NModeEnabled.o
+ getMBvpdDram2NModeEnabled.o \
+ getMBvpdSensorMap.o
diff --git a/src/usr/hwpf/plat/fapiPlatAttributeService.C b/src/usr/hwpf/plat/fapiPlatAttributeService.C
index 00ca0ed69..146e91b1d 100644
--- a/src/usr/hwpf/plat/fapiPlatAttributeService.C
+++ b/src/usr/hwpf/plat/fapiPlatAttributeService.C
@@ -49,6 +49,7 @@
#include <hwpf/hwp/mvpd_accessors/getMBvpdSpareDramData.H>
#include <hwpf/hwp/mvpd_accessors/getMBvpdVersion.H>
#include <hwpf/hwp/mvpd_accessors/getMBvpdDram2NModeEnabled.H>
+#include <hwpf/hwp/mvpd_accessors/getMBvpdSensorMap.H>
#include <fapiPllRingAttr.H>
#include <hwpf/hwp/pll_accessors/getPllRingAttr.H>
#include <hwpf/hwp/pll_accessors/getPllRingInfoAttr.H>
@@ -1302,6 +1303,17 @@ fapi::ReturnCode fapiPlatGetDram2NModeEnabled (
return l_rc;
}
+fapi::ReturnCode fapiPlatGetSensorMap (
+ const fapi::Target * i_pFapiTarget,
+ const fapi::MBvpdSensorMap i_attr,
+ uint8_t & o_val)
+{
+ // Get the data using the HWP accessor
+ fapi::ReturnCode l_rc;
+ FAPI_EXEC_HWP(l_rc, getMBvpdSensorMap, * i_pFapiTarget, i_attr, o_val);
+ return l_rc;
+}
+
fapi::ReturnCode fapiPlatGetEnableAttr ( fapi::AttributeId i_id,
const fapi::Target * i_pFapiTarget, uint8_t & o_enable )
{
diff --git a/src/usr/hwpf/test/fapiwinkletest.H b/src/usr/hwpf/test/fapiwinkletest.H
index 118dccef6..faae88919 100644
--- a/src/usr/hwpf/test/fapiwinkletest.H
+++ b/src/usr/hwpf/test/fapiwinkletest.H
@@ -27,6 +27,8 @@
// set to 1 for doing unit tests, set to 0 for production
#define UNITTESTfwt 0
#define UNITTEST2fwt 0
+#define HWPMBVPDACCESSORTEST_UT0 0 // 0 = just one chip, 1 = all
+#define HWPMBVPDACCESSORTEST_UT7 0 // 0 = min sensor map tests
/**
* @file fapiwinkletest.H
@@ -50,6 +52,7 @@
#include <mvpd_accessors/getMBvpdSlopeInterceptData.H>
#include <mvpd_accessors/getMBvpdVersion.H>
#include <mvpd_accessors/getMBvpdDram2NModeEnabled.H>
+#include <mvpd_accessors/getMBvpdSensorMap.H>
#include <errl/errlmanager.H>
#include <errl/errlentry.H>
@@ -72,7 +75,7 @@ public:
*/
void testGetMvpd()
{
- fapi::ReturnCode l_fapirc( fapi::FAPI_RC_SUCCESS );
+ fapi::ReturnCode l_fapirc;
uint8_t *l_pdRRecord = NULL;
uint32_t l_pdRLen = 0;
@@ -173,7 +176,7 @@ public:
*/
void testGetMBvpd()
{
- fapi::ReturnCode l_fapirc( fapi::FAPI_RC_SUCCESS );
+ fapi::ReturnCode l_fapirc;
uint8_t *l_pRecord = NULL;
uint32_t l_len = 0;
@@ -305,7 +308,7 @@ public:
*/
void testGetSlopeInterceptData()
{
- fapi::ReturnCode l_fapirc( fapi::FAPI_RC_SUCCESS );
+ fapi::ReturnCode l_fapirc;
getMBvpdSlopeInterceptData_FP_t (l_getMBvpdSlopeInterceptData)
= &getMBvpdSlopeInterceptData;
uint32_t l_val = 0xFFFFFFFF;
@@ -409,12 +412,96 @@ public:
}
/**
+ * @brief call getMBvpdSensorMap to fetch sensor map
+ * attributes from the MW keyword
+ *
+ */
+ void testGetSensorMap()
+ {
+ fapi::ReturnCode l_fapirc;
+ uint8_t l_val = 0xFF;
+
+ TS_TRACE( "testGetSensorMap entry" );
+
+ TARGETING::TargetHandleList l_memBufList;
+ getAllChips(l_memBufList, TYPE_MEMBUF);
+
+ TS_TRACE( "testGetSensorMap l_memBufList.size()=%d",
+ l_memBufList.size() );
+ // loop thru memory buffers
+#if HWPMBVPDACCESSORTEST_UT0
+ uint8_t l_mbNum = 0; // check them all in unit test
+#else
+ uint8_t l_mbNum = (l_memBufList.size() > 0) ? l_memBufList.size()-1 : 0;
+#endif
+ for (; l_mbNum < l_memBufList.size(); l_mbNum++ )
+ {
+ // make a local copy of the memory buffer target
+ TARGETING::Target* l_mb_target = l_memBufList[l_mbNum];
+
+ // dump physical path to target
+ EntityPath l_path;
+ l_path = l_mb_target->getAttr<ATTR_PHYS_PATH>();
+ l_path.dump();
+
+ // cast OUR type of target to a FAPI type of target.
+ fapi::Target l_fapi_mb_target(
+ TARGET_TYPE_MEMBUF_CHIP,
+ (const_cast<TARGETING::Target*>(l_mb_target)) );
+
+#if HWPMBVPDACCESSORTEST_UT7
+ // test accessor directly
+ getMBvpdSensorMap_FP_t (l_getMBvpdSensorMap) = &getMBvpdSensorMap;
+
+ // Primary Sensor Map
+ l_fapirc = (*l_getMBvpdSensorMap)(l_fapi_mb_target,
+ fapi::SENSOR_MAP_PRIMARY, l_val);
+ if (l_fapirc) break;
+ TS_TRACE( "testSensorMap accessor "
+ "SENSOR_MAP_PRIMARY=0x%02x", l_val);
+
+ // Secondary Sensor Map
+ l_fapirc = (*l_getMBvpdSensorMap)(l_fapi_mb_target,
+ fapi::SENSOR_MAP_SECONDARY, l_val);
+ if (l_fapirc) break;
+ TS_TRACE( "testSensorMap accessor "
+ "SENSOR_MAP_SECONDARY=0x%02x", l_val);
+
+ // test attribute
+ // Primary Sensor Map
+ l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CDIMM_SENSOR_MAP_PRIMARY,
+ &l_fapi_mb_target, l_val);
+ if (l_fapirc) break;
+ TS_TRACE( "testSensorMap attr "
+ "SENSOR_MAP_PRIMARY=0x%02x", l_val);
+#endif
+
+ // Secondary Sensor Map
+ l_fapirc = FAPI_ATTR_GET(ATTR_VPD_CDIMM_SENSOR_MAP_SECONDARY,
+ &l_fapi_mb_target, l_val);
+ if (l_fapirc) break;
+ TS_TRACE( "testSensorMap attr "
+ "SENSOR_MAP_SECONDARY=0x%02x", l_val);
+ }
+
+ if (l_fapirc)
+ {
+ TS_FAIL( "fapiGetSensorMap: FAPI_ATTR_GET fail rc=0x%x",
+ static_cast<uint32_t>(l_fapirc) );
+ fapiLogError(l_fapirc);
+ }
+
+ TS_TRACE( "testGetSensorMap exit" );
+
+ }
+
+ /**
* @brief call getMBvpdVersion to fetch vpd version
*
*/
void testGetVersion()
{
- fapi::ReturnCode l_fapirc( fapi::FAPI_RC_SUCCESS );
+ fapi::ReturnCode l_fapirc;
getMBvpdVersion_FP_t (l_getMBvpdVersion)
= &getMBvpdVersion;
@@ -521,7 +608,7 @@ public:
*/
void testGetDram2NModeEnabled()
{
- fapi::ReturnCode l_fapirc( fapi::FAPI_RC_SUCCESS );
+ fapi::ReturnCode l_fapirc;
getMBvpdDram2NModeEnabled_FP_t (l_getMBvpdDram2NModeEnabled)
= &getMBvpdDram2NModeEnabled;
@@ -605,7 +692,7 @@ public:
*/
void testGetAddrMirrorData()
{
- fapi::ReturnCode l_fapirc( fapi::FAPI_RC_SUCCESS );
+ fapi::ReturnCode l_fapirc;
getMBvpdAddrMirrorData_FP_t (l_getMBvpdAddrMirrorData)
= &getMBvpdAddrMirrorData;
@@ -689,7 +776,7 @@ public:
*/
void testGetTermData()
{
- fapi::ReturnCode l_fapirc( fapi::FAPI_RC_SUCCESS );
+ fapi::ReturnCode l_fapirc;
uint8_t val1[2][2] = {{0xFF,0xFF},{0xFF,0xFF}};
#if UNITTESTfwt
uint8_t val2[2][2][4]={
@@ -1054,7 +1141,7 @@ public:
*/
void testGetPhaseRotatorData()
{
- fapi::ReturnCode l_fapirc( fapi::FAPI_RC_SUCCESS );
+ fapi::ReturnCode l_fapirc;
const uint8_t PORT_SIZE = 2;
uint8_t l_attr_eff_cen_phase_rot[PORT_SIZE];
@@ -1584,7 +1671,7 @@ public:
*/
void testRepairRings()
{
- fapi::ReturnCode l_fapirc = fapi::FAPI_RC_SUCCESS;
+ fapi::ReturnCode l_fapirc;
uint8_t *l_pRingBuf = NULL;
uint32_t l_ringBufsize = 0;
uint32_t l_ringId = 0;
OpenPOWER on IntegriCloud