summaryrefslogtreecommitdiffstats
path: root/src/usr/hdat
diff options
context:
space:
mode:
authornagurram-in <nagendra.g@in.ibm.com>2017-02-27 08:28:01 -0600
committerWilliam G. Hoffa <wghoffa@us.ibm.com>2017-03-22 17:38:12 -0400
commitf92bf74315ee13b44d60d6085b86d4153ba85f92 (patch)
tree9700cc7c4cbd39b023e905051aa4e1d8b9c6d68c /src/usr/hdat
parent0f5d9ad1ca5f27d3aaeecceea0f326e65a70478b (diff)
downloadtalos-hostboot-f92bf74315ee13b44d60d6085b86d4153ba85f92.tar.gz
talos-hostboot-f92bf74315ee13b44d60d6085b86d4153ba85f92.zip
I2c data fillup in msvpd and pcrd structs
Change-Id: Id2d9754b9a044223372d67a7c61e7784584a45c3 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/37093 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Jayashankar Padath <jayashankar.padath@in.ibm.com> Reviewed-by: Elizabeth K. Liner <eliner@us.ibm.com> Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com>
Diffstat (limited to 'src/usr/hdat')
-rwxr-xr-xsrc/usr/hdat/hdatmsarea.C12
-rwxr-xr-xsrc/usr/hdat/hdatmsarea.H13
-rwxr-xr-xsrc/usr/hdat/hdatmsvpd.C48
-rwxr-xr-xsrc/usr/hdat/hdatmsvpd.H2
-rw-r--r--src/usr/hdat/hdatpcrd.C62
-rw-r--r--src/usr/hdat/hdatpcrd.H11
-rw-r--r--src/usr/hdat/hdatutil.C54
-rwxr-xr-xsrc/usr/hdat/hdatutil.H40
8 files changed, 117 insertions, 125 deletions
diff --git a/src/usr/hdat/hdatmsarea.C b/src/usr/hdat/hdatmsarea.C
index e8ff98d3b..593f37fb2 100755
--- a/src/usr/hdat/hdatmsarea.C
+++ b/src/usr/hdat/hdatmsarea.C
@@ -382,23 +382,23 @@ errlHndl_t HdatMsArea::addEcEntry(uint32_t i_manfId,
/** @brief See the prologue in hdatmsarea.H
*/
void HdatMsArea::setMsaI2cInfo(
- std::vector<hdatMsAreaHI2cData_t> &i_I2cDevEntries )
+ std::vector<hdatI2cData_t> &i_I2cDevEntries )
{
HDAT_ENTER();
iv_msaI2cHdr.hdatOffset = 0x0010; // this is just header of 4 words. arrays start at 0x0010
iv_msaI2cHdr.hdatArrayCnt = i_I2cDevEntries.size();
- iv_msaI2cHdr.hdatAllocSize = sizeof(hdatMsAreaHI2cData_t);
- iv_msaI2cHdr.hdatActSize = sizeof(hdatMsAreaHI2cData_t);
+ iv_msaI2cHdr.hdatAllocSize = sizeof(hdatI2cData_t);
+ iv_msaI2cHdr.hdatActSize = sizeof(hdatI2cData_t);
iv_msaHostI2cCnt = i_I2cDevEntries.size();
iv_msaHostI2cSize = sizeof(hdatHDIFDataArray_t) +
- (sizeof(hdatMsAreaHI2cData_t) * iv_msaHostI2cCnt);
+ (sizeof(hdatI2cData_t) * iv_msaHostI2cCnt);
HDAT_INF("iv_msaHostI2cCnt=%d, iv_msaHostI2cSize=%d",
iv_msaHostI2cCnt, iv_msaHostI2cSize);
if ( i_I2cDevEntries.size() != 0 )
{
- iv_msaI2cDataPtr = new uint8_t[sizeof(hdatMsAreaHI2cData_t) * iv_msaHostI2cCnt];
+ iv_msaI2cDataPtr = new uint8_t[sizeof(hdatI2cData_t) * iv_msaHostI2cCnt];
memcpy(iv_msaI2cDataPtr , i_I2cDevEntries.begin() ,
- (sizeof(hdatMsAreaHI2cData_t) * iv_msaHostI2cCnt));
+ (sizeof(hdatI2cData_t) * iv_msaHostI2cCnt));
}
else
diff --git a/src/usr/hdat/hdatmsarea.H b/src/usr/hdat/hdatmsarea.H
index 6f4b4cf49..ccd238fa3 100755
--- a/src/usr/hdat/hdatmsarea.H
+++ b/src/usr/hdat/hdatmsarea.H
@@ -42,6 +42,7 @@
#include "hdathdif.H" // HdatHdif base class definition
#include "hdatram.H" // HdatRam class definition
#include <errl/errlentry.H> // ErrlEntry class
+#include "hdatutil.H"
namespace HDAT
{
@@ -158,16 +159,6 @@ struct hdatMsAreaEcLvl_t
uint32_t hdatChipEcLvl; // 0x0004 Memory interface chip EC level
} __attribute__ ((packed));
-/** @brief Structure definition for the host I2C devices header
- */
-struct hdatMsAreaHI2cData_t
-{
- uint32_t hdatMsaI2cMasterInfo; // 0x0000 Host I2C device info
- uint32_t hdatMsaI2cSlaveDevType; // 0x0004 Host I2C slave device type
- uint32_t hdatMsaI2cPurpose; // 0x0008 Host I2C purpose
-} __attribute__ ((packed));
-
-
/*----------------------------------------------------------------------------*/
/* Constants */
/*----------------------------------------------------------------------------*/
@@ -480,7 +471,7 @@ public:
* @retval void
*/
void setMsaI2cInfo (
- std::vector<hdatMsAreaHI2cData_t>& i_I2cDevEntries );
+ std::vector<hdatI2cData_t>& i_I2cDevEntries );
/**
* @brief This routine returns the length of all RAM objects associated
diff --git a/src/usr/hdat/hdatmsvpd.C b/src/usr/hdat/hdatmsvpd.C
index f835da10e..32ab77fd1 100755
--- a/src/usr/hdat/hdatmsvpd.C
+++ b/src/usr/hdat/hdatmsvpd.C
@@ -55,45 +55,6 @@ namespace HDAT
#define HDAT_MS_AREA(_i_idx_) *((HdatMsArea **)((char *)iv_msAreaPtrs + \
_i_idx_ * sizeof(HdatMsArea *)))
-/*******************************************************************************
- * hdatGetMsaDeviceInfo
- *
- * @brief Routine returns the Host I2C device entries
- *
- * @pre None
- *
- * @post None
- *
- * @param[in] i_pMembufTarget
- * The membuf target handle
- * @param[out] o_i2cDevEntries
- * The host i2c dev entries
- *
- * @return void
- *
-*******************************************************************************/
-void hdatGetMsaDeviceInfo(TARGETING::Target* i_pMembufTarget,
- std::vector<hdatMsAreaHI2cData_t>&o_i2cDevEntries)
-{
- HDAT_ENTER();
- //TODO : RTC Story 165230
- //Need to populate the data once ready
- //std::vector<hdatDeviceInfo_t> o_deviceInfo;
- //getDeviceInfo( TARGETING::Target* i_membufTarget,
- // std::vector<hdatDeviceInfo_t>& o_deviceInfo );
-
- hdatMsAreaHI2cData_t l_hostI2cObj;
- memset(&l_hostI2cObj, 0x00, sizeof(l_hostI2cObj));
-
- //Hard coded values
- l_hostI2cObj.hdatMsaI2cMasterInfo = 1;
- l_hostI2cObj.hdatMsaI2cSlaveDevType = 1;
- l_hostI2cObj.hdatMsaI2cPurpose = 1;
- o_i2cDevEntries.push_back(l_hostI2cObj);
-
- HDAT_EXIT();
-}
-
/** @brief See the prologue in hdatmsvpd.H
*/
HdatMsVpd::HdatMsVpd(errlHndl_t &o_errlHndl,
@@ -691,7 +652,7 @@ errlHndl_t HdatMsVpd::addEcEntry(uint16_t i_msAreaId,
/** @brief See the prologue in hdatmsvpd.H
*/
void HdatMsVpd::setMsaI2cInfo(uint16_t i_msAreaId,
- std::vector<hdatMsAreaHI2cData_t>& i_I2cDevEntries)
+ std::vector<hdatI2cData_t>& i_I2cDevEntries)
{
HdatMsArea *l_obj;
@@ -1405,10 +1366,9 @@ errlHndl_t HdatMsVpd::hdatLoadMsData(uint32_t &o_size, uint32_t &o_count)
l_pMcsTarget->getAttr<TARGETING::ATTR_HUID>());
break;
}
-
- // TODO RTC Story 165230
+
// Need to get i2c Master data correctly
- std::vector<hdatMsAreaHI2cData_t> l_i2cDevEntries;
+ std::vector<hdatI2cData_t> l_i2cDevEntries;
TARGETING::PredicateCTM l_membufPredicate(
TARGETING::CLASS_CHIP, TARGETING::TYPE_MEMBUF);
@@ -1432,7 +1392,7 @@ errlHndl_t HdatMsVpd::hdatLoadMsData(uint32_t &o_size, uint32_t &o_count)
l_membufList[0];
if (l_pMembufTarget != NULL)
{
- hdatGetMsaDeviceInfo(l_pMembufTarget,
+ hdatGetI2cDeviceInfo(l_pMembufTarget,
l_i2cDevEntries);
}
}
diff --git a/src/usr/hdat/hdatmsvpd.H b/src/usr/hdat/hdatmsvpd.H
index fc54ce966..c530db9e3 100755
--- a/src/usr/hdat/hdatmsvpd.H
+++ b/src/usr/hdat/hdatmsvpd.H
@@ -683,7 +683,7 @@ class HdatMsVpd : public HdatHdif
* @param i_I2cDevEntries- input parameter - host I2c device info
*/
void setMsaI2cInfo(uint16_t i_msAreaId,
- std::vector<hdatMsAreaHI2cData_t>& i_I2cDevEntries);
+ std::vector<hdatI2cData_t>& i_I2cDevEntries);
/**
* @brief Add a RAM area FRU.
diff --git a/src/usr/hdat/hdatpcrd.C b/src/usr/hdat/hdatpcrd.C
index 85e81981b..b9e72d983 100644
--- a/src/usr/hdat/hdatpcrd.C
+++ b/src/usr/hdat/hdatpcrd.C
@@ -76,48 +76,6 @@ const HdatKeywordInfo l_mvpdKeywords[] =
};
-/******************************************************************************
- * hdatGetPcrdDeviceInfo
- *
- * @brief Routine returns the Host I2C device entries
- *
- * @pre None
- *
- * @post None
- *
- * @param[in] i_pProcTarget
- * The proc target handle
- * @param[out] o_i2cDevEntries
- * The host i2c dev entries
- *
- * @return void
- *
-******************************************************************************/
-void hdatGetPcrdDeviceInfo(TARGETING::Target* i_pProcTarget,
- std::vector<hdatPcrdHI2cData_t>&o_i2cDevEntries)
-{
- HDAT_ENTER();
- //TODO : RTC Story 165230
- //Need to populate the data once ready
- //std::vector<hdatDeviceInfo_t> o_deviceInfo;
- //getDeviceInfo( TARGETING::Target* i_procTarget,
- // std::vector<hdatDeviceInfo_t>& o_deviceInfo );
- hdatPcrdHI2cData_t l_hostI2cObj;
- memset(&l_hostI2cObj, 0x00, sizeof(l_hostI2cObj));
-
- uint32_t l_idx = 0;
-
- //Hard coded values
- for (l_idx = 1; l_idx < 3; l_idx++)
- {
- l_hostI2cObj.hdatPcrdI2cMasterInfo = l_idx;
- l_hostI2cObj.hdatPcrdI2cSlaveDevType = l_idx;
- l_hostI2cObj.hdatPcrdI2cPurpose = l_idx;
- o_i2cDevEntries.push_back(l_hostI2cObj);
- }
- HDAT_EXIT();
-}
-
/*******************************************************************************
* hdatSetPcrdHdrs
*
@@ -492,14 +450,13 @@ errlHndl_t HdatPcrd::hdatLoadPcrd(uint32_t &o_size, uint32_t &o_count)
reinterpret_cast<hdatHDIFDataArray_t *>
(l_FullMvpdAddr+l_FullMvpdSize);
- // TODO RTC Story 165230
// Need to get i2c Master data correctly
- std::vector<hdatPcrdHI2cData_t> l_i2cDevEntries;
+ std::vector<hdatI2cData_t> l_i2cDevEntries;
- hdatGetPcrdDeviceInfo(l_pProcTarget, l_i2cDevEntries);
+ hdatGetI2cDeviceInfo(l_pProcTarget, l_i2cDevEntries);
l_pcrdHI2cTotalSize = sizeof(hdatHDIFDataArray_t) +
- (sizeof(hdatPcrdHI2cData_t) * l_i2cDevEntries.size());
+ (sizeof(hdatI2cData_t) * l_i2cDevEntries.size());
HDAT_INF("pcrdHI2cNumEntries=0x%x, l_pcrdHI2cTotalSize=0x%x",
l_i2cDevEntries.size(), l_pcrdHI2cTotalSize);
@@ -508,14 +465,15 @@ errlHndl_t HdatPcrd::hdatLoadPcrd(uint32_t &o_size, uint32_t &o_count)
l_hostI2cFullPcrdHdrPtr->hdatArrayCnt =
l_i2cDevEntries.size();
l_hostI2cFullPcrdHdrPtr->hdatAllocSize =
- sizeof(hdatPcrdHI2cData_t);
+ sizeof(hdatI2cData_t);
l_hostI2cFullPcrdHdrPtr->hdatActSize =
- sizeof(hdatPcrdHI2cData_t);
+ sizeof(hdatI2cData_t);
- hdatPcrdHI2cData_t *l_hostI2cFullPcrdDataPtr = NULL;
- l_hostI2cFullPcrdDataPtr =
- reinterpret_cast<hdatPcrdHI2cData_t *>
- (l_hostI2cFullPcrdHdrPtr+sizeof(hdatHDIFDataArray_t));
+ hdatI2cData_t *l_hostI2cFullPcrdDataPtr = NULL;
+ l_hostI2cFullPcrdDataPtr =
+ reinterpret_cast<hdatI2cData_t *>
+ (reinterpret_cast<uint8_t *>(l_hostI2cFullPcrdHdrPtr)
+ +sizeof(hdatHDIFDataArray_t));
if ( l_i2cDevEntries.size() != 0 )
{
diff --git a/src/usr/hdat/hdatpcrd.H b/src/usr/hdat/hdatpcrd.H
index 62d9bff29..647c8779a 100644
--- a/src/usr/hdat/hdatpcrd.H
+++ b/src/usr/hdat/hdatpcrd.H
@@ -112,17 +112,6 @@ struct hdatPcrdChipTod_t
// control register
} __attribute__ ((packed));
-
-/** @brief Defines the Host I2C device info in the PCRD
- */
-struct hdatPcrdHI2cData_t
-{
- uint32_t hdatPcrdI2cMasterInfo; // 0x0000 Host I2C device info
- uint32_t hdatPcrdI2cSlaveDevType; // 0x0004 Host I2C slave device type
- uint32_t hdatPcrdI2cPurpose; // 0x0008 Host I2C purpose
-}__attribute__ ((packed));
-
-
/* @brief defines PNOR structure in PCRD */
struct hdatPcrdPnor_t
{
diff --git a/src/usr/hdat/hdatutil.C b/src/usr/hdat/hdatutil.C
index d17116f04..747205b6c 100644
--- a/src/usr/hdat/hdatutil.C
+++ b/src/usr/hdat/hdatutil.C
@@ -1665,5 +1665,59 @@ errlHndl_t hdatGetFullEepromVpd(TARGETING::Target * i_target,
return(err);
}
+/*******************************************************************************
+ * hdatGetI2cDeviceInfo
+ *
+ * @brief Routine returns the Host I2C device entries
+ *
+ * @pre None
+ *
+ * @post None
+ *
+ * @param[in] i_pTarget
+ * The i2c master target handle
+ * @param[out] o_i2cDevEntries
+ * The host i2c dev entries
+ *
+ * @return void
+ *
+*******************************************************************************/
+void hdatGetI2cDeviceInfo(TARGETING::Target* i_pTarget,
+ std::vector<hdatI2cData_t>&o_i2cDevEntries)
+{
+ HDAT_ENTER();
+ std::vector<DeviceInfo_t> o_deviceInfo;
+ getDeviceInfo( i_pTarget, o_deviceInfo);
+ uint32_t l_I2cLinkId = 0;
+
+ if(!o_deviceInfo.size())
+ {
+ HDAT_INF(" No i2c connections found for i2c master : 0x08X",
+ i_pTarget->getAttr<ATTR_HUID>());
+ }
+ else
+ {
+ for ( auto &l_i2cDevEle : o_deviceInfo )
+ {
+ hdatI2cData_t l_hostI2cObj;
+ memset(&l_hostI2cObj, 0x00, sizeof(hdatI2cData_t));
+
+ l_hostI2cObj.hdatI2cEngine = l_i2cDevEle.engine;
+ l_hostI2cObj.hdatI2cMasterPort = l_i2cDevEle.masterPort;
+ l_hostI2cObj.hdatI2cBusSpeed = l_i2cDevEle.busFreqKhz;
+ l_hostI2cObj.hdatI2cSlaveDevType = l_i2cDevEle.deviceType;
+ l_hostI2cObj.hdatI2cSlaveDevAddr = l_i2cDevEle.addr;
+ l_hostI2cObj.hdatI2cSlavePort = l_i2cDevEle.slavePort;
+ l_hostI2cObj.hdatI2cSlaveDevPurp = l_i2cDevEle.devicePurpose;
+ l_hostI2cObj.hdatI2cLinkId = l_I2cLinkId++;
+
+ o_i2cDevEntries.push_back(l_hostI2cObj);
+ }
+ }
+
+ HDAT_EXIT();
+}
+
+
} //namespace HDAT
diff --git a/src/usr/hdat/hdatutil.H b/src/usr/hdat/hdatutil.H
index f1ec66f4f..9dfa0b95b 100755
--- a/src/usr/hdat/hdatutil.H
+++ b/src/usr/hdat/hdatutil.H
@@ -55,9 +55,11 @@
#include <../vpd/mvpd.H>
#include <../vpd/ipvpd.H>
#include <../vpd/pvpd.H>
+#include <i2c/i2cif.H>
using namespace MVPD;
using namespace PVPD;
using namespace IPVPD;
+using namespace I2C;
/*----------------------------------------------------------------------------*/
@@ -95,6 +97,23 @@ namespace HDAT
extern trace_desc_t* g_trac_hdat;
+/** @brief Defines the Host I2C device info
+ */
+struct hdatI2cData_t
+{
+ uint8_t hdatI2cEngine;
+ uint8_t hdatI2cMasterPort;
+ uint16_t hdatI2cBusSpeed;
+ uint8_t hdatI2cSlaveDevType;
+ uint8_t hdatI2cSlaveDevAddr;
+ uint8_t hdatI2cSlavePort;
+ uint8_t hdatReserved1;
+ uint32_t hdatI2cSlaveDevPurp;
+ uint32_t hdatI2cLinkId;
+
+}__attribute__ ((packed));
+
+
/**
* @brief Create/Build an Error log and add HADT component trace
* if the log exists then FFDC will be added to the existing log and
@@ -456,6 +475,27 @@ errlHndl_t hdatGetFullEepromVpd ( TARGETING::Target * i_target,
size_t &io_dataSize,
char* &o_data);
+/*******************************************************************************
+ * hdatGetI2cDeviceInfo
+ *
+ * @brief Routine returns the Host I2C device entries
+ *
+ * @pre None
+ *
+ * @post None
+ *
+ * @param[in] i_pTarget
+ * The i2c master target handle
+ * @param[out] o_i2cDevEntries
+ * The host i2c dev entries
+ *
+ * @return void
+ *
+*******************************************************************************/
+void hdatGetI2cDeviceInfo(TARGETING::Target* i_pTarget,
+ std::vector<hdatI2cData_t>&o_i2cDevEntries);
+
+
};// end namespace
#endif // HDATUTILITY_H
OpenPOWER on IntegriCloud