summaryrefslogtreecommitdiffstats
path: root/src/usr/hdat
diff options
context:
space:
mode:
authorJay <jayashankar.padath@in.ibm.com>2016-11-29 02:59:33 -0600
committerWilliam G. Hoffa <wghoffa@us.ibm.com>2017-01-12 16:17:35 -0500
commit8dca78dfaeddb87852e7c560e3e5ad2c6bf95989 (patch)
tree3436618217e9552b1e17b2095c6ddca296975de8 /src/usr/hdat
parent04de5bff9299162049d141192cb395116a5c6437 (diff)
downloadtalos-hostboot-8dca78dfaeddb87852e7c560e3e5ad2c6bf95989.tar.gz
talos-hostboot-8dca78dfaeddb87852e7c560e3e5ad2c6bf95989.zip
HDAT: Host I2C changes for PCRD and MS Area
Change-Id: Ie138a86f19e23374f10479af43e0d1b467ceec9e Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/33096 Reviewed-by: VENKATESH SAINATH <venkatesh.sainath@in.ibm.com> Reviewed-by: NAGENDRA K. GURRAM <nagendra.g@in.ibm.com> Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com>
Diffstat (limited to 'src/usr/hdat')
-rwxr-xr-xsrc/usr/hdat/hdatmsarea.C42
-rwxr-xr-xsrc/usr/hdat/hdatmsarea.H42
-rwxr-xr-xsrc/usr/hdat/hdatmsvpd.C87
-rwxr-xr-xsrc/usr/hdat/hdatmsvpd.H17
-rw-r--r--src/usr/hdat/hdatpcrd.C98
-rw-r--r--src/usr/hdat/hdatpcrd.H17
6 files changed, 292 insertions, 11 deletions
diff --git a/src/usr/hdat/hdatmsarea.C b/src/usr/hdat/hdatmsarea.C
index 4dc614b2f..70eb16a6b 100755
--- a/src/usr/hdat/hdatmsarea.C
+++ b/src/usr/hdat/hdatmsarea.C
@@ -101,9 +101,12 @@ HdatMsArea::HdatMsArea(errlHndl_t &o_errlHndl,
iv_maxRamCnt(i_ramCnt), iv_actRamCnt(0), iv_maxRamObjSize(0), iv_kwd(NULL),
iv_ramPadReq(false),iv_addrRange(NULL), iv_ecLvl(NULL), iv_ramPtrs(NULL)
{
- HDAT_ENTER( );
+ HDAT_ENTER( );
uint32_t l_slcaIdx = 0;
+ iv_msaHostI2cCnt = 0;
+ iv_msaHostI2cSize = 0;
+ iv_msaI2cDataPtr = NULL;
o_errlHndl = NULL;
iv_fru.hdatResourceId = i_resourceId;
@@ -369,6 +372,34 @@ errlHndl_t HdatMsArea::addEcEntry(uint32_t i_manfId,
return l_errlHndl;
}
+/** @brief See the prologue in hdatmsarea.H
+ */
+void HdatMsArea::setMsaI2cInfo(
+ std::vector<hdatMsAreaHI2cData_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_msaHostI2cCnt = i_I2cDevEntries.size();
+ iv_msaHostI2cSize = sizeof(hdatHDIFDataArray_t) +
+ (sizeof(hdatMsAreaHI2cData_t) * iv_msaHostI2cCnt);
+ HDAT_INF("iv_msaHostI2cCnt=%d, iv_msaHostI2cSize=%d",
+ iv_msaHostI2cCnt, iv_msaHostI2cSize);
+ if ( i_I2cDevEntries.size() != 0 )
+ {
+ //copy from vector to array
+ std::copy(i_I2cDevEntries.begin(),i_I2cDevEntries.end(),
+ iv_msaI2cDataPtr);
+ }
+ else
+ {
+ HDAT_INF("Empty Host I2C device info vector : Ms Area Id=%d, Size=%d",
+ iv_msId.hdatMsAreaId, i_I2cDevEntries.size());
+ }
+ HDAT_EXIT();
+}
/** @brief See the prologue in hdatmsarea.H
*/
@@ -480,6 +511,7 @@ void HdatMsArea::finalizeObjSize()
this->addData(HDAT_MS_AREA_AFF, sizeof(hdatMsAreaAffinity_t));
this->addData(HDAT_MS_AREA_EC_ARRAY, sizeof(hdatHDIFDataArray_t) +
iv_maxEcCnt * sizeof(hdatMsAreaEcLvl_t));
+ this->addData(HDAT_MS_AREA_HOST_I2C, iv_msaHostI2cSize);
this->align();
@@ -606,6 +638,14 @@ void HdatMsArea::commit(UtilMem &i_data)
i_data.write(iv_ecLvl,iv_maxEcCnt * sizeof(hdatMsAreaEcLvl_t));
+ i_data.write(&iv_msaI2cHdr, sizeof(hdatHDIFDataArray_t));
+
+ if (NULL != iv_msaI2cDataPtr)
+ {
+ i_data.write(iv_msaI2cDataPtr,
+ (iv_msaHostI2cSize - sizeof(hdatHDIFDataArray_t)));
+ }
+
this->endCommit(i_data);
}
/** @brief See the prologue in hdatmsarea.H
diff --git a/src/usr/hdat/hdatmsarea.H b/src/usr/hdat/hdatmsarea.H
index 79fa04a10..6d33a2893 100755
--- a/src/usr/hdat/hdatmsarea.H
+++ b/src/usr/hdat/hdatmsarea.H
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2016 */
+/* Contributors Listed Below - COPYRIGHT 2016,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -76,10 +76,11 @@ enum hdatMsAreaDataPtrs
HDAT_MS_AREA_ADDR_RNG = 4,
HDAT_MS_AREA_AFF = 5,
HDAT_MS_AREA_EC_ARRAY = 6,
- HDAT_MS_AREA_RESERVED1 = 7,
- HDAT_MS_AREA_RESERVED2 = 8,
- HDAT_MS_AREA_RESERVED3 = 9,
- HDAT_MS_AREA_LAST = 10
+ HDAT_MS_AREA_HOST_I2C = 7,
+ HDAT_MS_AREA_RESERVED1 = 8,
+ HDAT_MS_AREA_RESERVED2 = 9,
+ HDAT_MS_AREA_RESERVED3 = 10,
+ HDAT_MS_AREA_LAST = 11
};
@@ -155,6 +156,14 @@ 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));
/*----------------------------------------------------------------------------*/
@@ -456,6 +465,20 @@ public:
errlHndl_t addEcEntry(uint32_t i_manfId,
uint32_t i_ecLvl);
+ /**
+ * @brief Update the Host I2C device info
+ *
+ * @pre None
+ *
+ * @post None
+ *
+ * @param i_I2cDevEntries - input parameter - This contains I2C master infoi,
+ * I2C slave device type and I2C device purpose
+ *
+ * @retval void
+ */
+ void setMsaI2cInfo (
+ std::vector<hdatMsAreaHI2cData_t>& i_I2cDevEntries );
/**
* @brief This routine returns the length of all RAM objects associated
@@ -558,6 +581,9 @@ private:
* @li iv_maxAddrRngCnt - maximum number of address range entries that
* can be added
* @li iv_maxEcCnt - maximum number of EC entries that can be added
+ * @li iv_msaHostI2cCnt - actual number of host I2C entries that can be
+ * added
+ * @li iv_msaHostI2cSize - total size of host i2c data
* @li iv_maxRamCnt - maximum number of RAM objects that can be added
* @li iv_actRamCnt - actual number of RAM objects that were added
* @li iv_maxRamObjSize - maximum size of any RAM object associated with
@@ -573,12 +599,16 @@ private:
* @li iv_aff - CPU affinity information
* @li iv_ecArrayHdr - data array header
* @li iv_ecLvl - EC level array
+ * @li iv_msaI2cHdr - Host I2C info header
+ * @li iv_msaI2cEntryPtr - Host I2C info entries
* @li iv_ramPtrs - ptr to storage which contains one of more ptrs
* to RAM objects
*/
uint32_t iv_kwdSize;
uint32_t iv_maxAddrRngCnt;
uint32_t iv_maxEcCnt;
+ uint32_t iv_msaHostI2cCnt;
+ uint32_t iv_msaHostI2cSize;
uint32_t iv_maxRamCnt;
uint32_t iv_actRamCnt;
uint32_t iv_maxRamObjSize;
@@ -592,6 +622,8 @@ private:
hdatMsAreaAffinity_t iv_aff;
hdatHDIFDataArray_t iv_ecArrayHdr;
hdatMsAreaEcLvl_t *iv_ecLvl;
+ hdatHDIFDataArray_t iv_msaI2cHdr;
+ hdatMsAreaHI2cData_t *iv_msaI2cDataPtr;
HdatRam **iv_ramPtrs;
diff --git a/src/usr/hdat/hdatmsvpd.C b/src/usr/hdat/hdatmsvpd.C
index a83669a71..5d7fa7b92 100755
--- a/src/usr/hdat/hdatmsvpd.C
+++ b/src/usr/hdat/hdatmsvpd.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2016 */
+/* Contributors Listed Below - COPYRIGHT 2016,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -55,8 +55,44 @@ 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
*/
@@ -651,6 +687,23 @@ errlHndl_t HdatMsVpd::addEcEntry(uint16_t i_msAreaId,
return l_errlHndl;
}
+/** @brief See the prologue in hdatmsvpd.H
+ */
+void HdatMsVpd::setMsaI2cInfo(uint16_t i_msAreaId,
+ std::vector<hdatMsAreaHI2cData_t>& i_I2cDevEntries)
+{
+ HdatMsArea *l_obj;
+
+ if (i_msAreaId < iv_actMsAreaCnt)
+ {
+ l_obj = HDAT_MS_AREA(i_msAreaId);
+ l_obj->setMsaI2cInfo(i_I2cDevEntries);
+ }
+ else
+ {
+ HDAT_ERR("hdatmsvpd:setMsaI2cInfo - invalid i_msAreadId parametera");
+ }
+}
/** @brief See the prologue in hdatmsvpd.H
*/
@@ -1302,6 +1355,38 @@ errlHndl_t HdatMsVpd::hdatLoadMsData(uint32_t &o_size, uint32_t &o_count)
break;
}
+ // TODO RTC Story 165230
+ // Need to get i2c Master data correctly
+ std::vector<hdatMsAreaHI2cData_t> l_i2cDevEntries;
+
+ TARGETING::PredicateCTM l_membufPredicate(TARGETING::CLASS_CHIP,
+ TARGETING::TYPE_MEMBUF);
+
+ TARGETING::PredicatePostfixExpr l_presentMemBuf;
+ l_presentMemBuf.push(&l_membufPredicate).
+ push(&l_predHwasPresent).And();
+
+ TARGETING::TargetHandleList l_membufList;
+
+ // Find Associated membuf
+ TARGETING::targetService().getAssociated(l_membufList,
+ l_pMcsTarget,
+ TARGETING::TargetService::CHILD_BY_AFFINITY,
+ TARGETING::TargetService::ALL,
+ &l_presentMemBuf);
+ //Skip is there is no Membuf attached to this MCS
+ if(l_membufList.size() > 0)
+ {
+ TARGETING::Target *l_pMembufTarget = l_membufList[0];
+ if (l_pMembufTarget != NULL)
+ {
+ hdatGetMsaDeviceInfo(l_pMembufTarget,
+ l_i2cDevEntries);
+ }
+ }
+
+ setMsaI2cInfo(l_index, l_i2cDevEntries);
+
std::list<hdatRamArea>::iterator l_area = l_areas.begin();
for (uint32_t l_ramId = 0;
diff --git a/src/usr/hdat/hdatmsvpd.H b/src/usr/hdat/hdatmsvpd.H
index ade185b41..27294c339 100755
--- a/src/usr/hdat/hdatmsvpd.H
+++ b/src/usr/hdat/hdatmsvpd.H
@@ -666,6 +666,23 @@ class HdatMsVpd : public HdatHdif
uint32_t i_manfId,
uint32_t i_ecLvl);
+ /**
+ * @brief Update the mainstore area to specify the host I2C device info
+ *
+ * @pre The i_msAreaId parameter must be for a valid mainstore area that
+ * was added with the addMsAreaFru() method. HDAT does not check
+ * or enforce that this is a valid main store area ID.
+ *
+ * @post None
+ *
+ * @param i_msAreaId - input parameter - A unique id for each main
+ * store area associated with a mainstore VPD
+ * object. The id identifies the mainstore area
+ * that is to be updated.
+ * @param i_I2cDevEntries- input parameter - host I2c device info
+ */
+ void setMsaI2cInfo(uint16_t i_msAreaId,
+ std::vector<hdatMsAreaHI2cData_t>& i_I2cDevEntries);
/**
* @brief Add a RAM area FRU.
diff --git a/src/usr/hdat/hdatpcrd.C b/src/usr/hdat/hdatpcrd.C
index 6796e63b3..8e6a63c54 100644
--- a/src/usr/hdat/hdatpcrd.C
+++ b/src/usr/hdat/hdatpcrd.C
@@ -76,6 +76,48 @@ 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
*
@@ -124,6 +166,8 @@ static errlHndl_t hdatSetPcrdHdrs(hdatSpPcrd_t *i_pcrd)
i_pcrd->hdatPcrdIntData[HDAT_PCRD_DA_ASCII_KWD].hdatSize = 0;
i_pcrd->hdatPcrdIntData[HDAT_PCRD_DA_CHIP_VPD].hdatOffset = 0;
i_pcrd->hdatPcrdIntData[HDAT_PCRD_DA_CHIP_VPD].hdatSize = 0;
+ i_pcrd->hdatPcrdIntData[HDAT_PCRD_DA_HOST_I2C].hdatOffset = 0;
+ i_pcrd->hdatPcrdIntData[HDAT_PCRD_DA_HOST_I2C].hdatSize = 0;
return l_errlHndl;
}
@@ -402,12 +446,64 @@ errlHndl_t HdatPcrd::hdatLoadPcrd(uint32_t &o_size, uint32_t &o_count)
delete[] l_FullMvpd;
l_FullMvpd = NULL;
}
-
+
// Set the Full mvpd dptr and full pcrd struct sizes
this->iv_spPcrd->hdatPcrdIntData
[HDAT_PCRD_DA_CHIP_VPD].hdatSize = l_FullMvpdSize;
this->iv_spPcrd->hdatHdr.hdatSize += l_FullMvpdSize;
+ // Setting Host I2C device entry data
+ uint32_t l_pcrdHI2cTotalSize = 0;
+
+ hdatHDIFDataArray_t *l_hostI2cFullPcrdHdrPtr = NULL;
+ l_hostI2cFullPcrdHdrPtr =
+ 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;
+
+ hdatGetPcrdDeviceInfo(l_pProcTarget, l_i2cDevEntries);
+
+ l_pcrdHI2cTotalSize = sizeof(hdatHDIFDataArray_t) +
+ (sizeof(hdatPcrdHI2cData_t) * l_i2cDevEntries.size());
+
+ HDAT_INF("pcrdHI2cNumEntries=0x%x, l_pcrdHI2cTotalSize=0x%x",
+ l_i2cDevEntries.size(), l_pcrdHI2cTotalSize);
+
+ l_hostI2cFullPcrdHdrPtr->hdatOffset = 0x0010; // All array entries start right after header which is of 4 word size
+ l_hostI2cFullPcrdHdrPtr->hdatArrayCnt =
+ l_i2cDevEntries.size();
+ l_hostI2cFullPcrdHdrPtr->hdatAllocSize =
+ sizeof(hdatPcrdHI2cData_t);
+ l_hostI2cFullPcrdHdrPtr->hdatActSize =
+ sizeof(hdatPcrdHI2cData_t);
+
+ hdatPcrdHI2cData_t *l_hostI2cFullPcrdDataPtr = NULL;
+ l_hostI2cFullPcrdDataPtr =
+ reinterpret_cast<hdatPcrdHI2cData_t *>
+ (l_hostI2cFullPcrdHdrPtr+sizeof(hdatHDIFDataArray_t));
+
+ if ( l_i2cDevEntries.size() != 0 )
+ {
+ //copy data from vector to data ptr
+ std::copy(l_i2cDevEntries.begin(),
+ l_i2cDevEntries.end(), l_hostI2cFullPcrdDataPtr);
+ }
+ else
+ {
+ HDAT_INF("Empty Host I2C device info vector : Size=%d",
+ l_i2cDevEntries.size());
+ }
+ this->iv_spPcrd->hdatPcrdIntData[HDAT_PCRD_DA_HOST_I2C].
+ hdatOffset = this->iv_spPcrd->hdatPcrdIntData
+ [HDAT_PCRD_DA_CHIP_VPD].hdatOffset +
+ this->iv_spPcrd->hdatPcrdIntData[HDAT_PCRD_DA_CHIP_VPD].
+ hdatSize;
+ this->iv_spPcrd->hdatPcrdIntData
+ [HDAT_PCRD_DA_HOST_I2C].hdatSize = l_pcrdHI2cTotalSize;
+ this->iv_spPcrd->hdatHdr.hdatSize += l_pcrdHI2cTotalSize;
}
if( NULL != l_errl)
{
diff --git a/src/usr/hdat/hdatpcrd.H b/src/usr/hdat/hdatpcrd.H
index b3ac168d3..d3c9157f3 100644
--- a/src/usr/hdat/hdatpcrd.H
+++ b/src/usr/hdat/hdatpcrd.H
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2016 */
+/* Contributors Listed Below - COPYRIGHT 2016,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -67,8 +67,9 @@ enum hdatPcrdDataPtrs
HDAT_PCRD_DA_FRU_ID = 2,
HDAT_PCRD_DA_ASCII_KWD = 3,
HDAT_PCRD_DA_CHIP_VPD = 4,
- HDAT_PCRD_DA_CNT = 5,
- HDAT_PCRD_DA_LAST = 8,
+ HDAT_PCRD_DA_HOST_I2C = 5,
+ HDAT_PCRD_DA_CNT = 6,
+ HDAT_PCRD_DA_LAST = 7,
};
/*----------------------------------------------------------------------------*/
@@ -109,6 +110,16 @@ 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 the PCRD.
* FipS updates this portion and DMAs the entire PCRD back to main memory.
*/
OpenPOWER on IntegriCloud