summaryrefslogtreecommitdiffstats
path: root/src/usr/hdat
diff options
context:
space:
mode:
authornagurram-in <nagendra.g@in.ibm.com>2017-03-27 14:07:35 -0500
committerWilliam G. Hoffa <wghoffa@us.ibm.com>2017-04-03 10:41:44 -0400
commitb1f3ddfd201451bdb3305faffe6ab1d22a080747 (patch)
tree3cbb3ebb387d3642002f408d50396d6ae3f78122 /src/usr/hdat
parente452a1b543b9f7879203ae9cfc939e695f5a198d (diff)
downloadblackbird-hostboot-b1f3ddfd201451bdb3305faffe6ab1d22a080747.tar.gz
blackbird-hostboot-b1f3ddfd201451bdb3305faffe6ab1d22a080747.zip
HDAT alignment fix for variable length PCRD structs
Change-Id: I966ded06a5d62c4ae17fb5003d0bd2e7bbccd1e2 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/38485 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: Dean Sanner <dsanner@us.ibm.com> Reviewed-by: VENKATESH SAINATH <venkatesh.sainath@in.ibm.com> Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com>
Diffstat (limited to 'src/usr/hdat')
-rw-r--r--src/usr/hdat/hdatpcrd.C32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/usr/hdat/hdatpcrd.C b/src/usr/hdat/hdatpcrd.C
index b9e72d983..8b46f156c 100644
--- a/src/usr/hdat/hdatpcrd.C
+++ b/src/usr/hdat/hdatpcrd.C
@@ -76,6 +76,9 @@ const HdatKeywordInfo l_mvpdKeywords[] =
};
+//Max number of I2c devices for any given proc
+#define HDAT_PCRD_MAX_I2C_DEV 64
+
/*******************************************************************************
* hdatSetPcrdHdrs
*
@@ -142,7 +145,8 @@ HdatPcrd::HdatPcrd(errlHndl_t &o_errlHndl, const hdatMsAddr_t &i_msAddr)
{
// Allocate the CHIP INFO section also
iv_numPcrdEntries = HDAT_NUM_P7_PCRD_ENTRIES;
- iv_spPcrdEntrySize = sizeof(hdatSpPcrd_t) + HDAT_FULL_MVPD_SIZE;
+ iv_spPcrdEntrySize = sizeof(hdatSpPcrd_t) + HDAT_FULL_MVPD_SIZE +
+ sizeof(hdatHDIFDataArray_t) + (sizeof(hdatI2cData_t) * HDAT_PCRD_MAX_I2C_DEV);
// Allocate space for each CHIP -- will use max amount to start
uint64_t l_base_addr = ((uint64_t) i_msAddr.hi << 32) | i_msAddr.lo;
@@ -493,9 +497,10 @@ errlHndl_t HdatPcrd::hdatLoadPcrd(uint32_t &o_size, uint32_t &o_count)
hdatSize;
this->iv_spPcrd->hdatPcrdIntData
[HDAT_PCRD_DA_HOST_I2C].hdatSize = l_pcrdHI2cTotalSize;
- this->iv_spPcrd->hdatHdr.hdatSize += l_pcrdHI2cTotalSize;
+ this->iv_spPcrd->hdatHdr.hdatSize +=
+ sizeof(hdatHDIFDataArray_t) + (sizeof(hdatI2cData_t) * HDAT_PCRD_MAX_I2C_DEV);
-
+
uint8_t* l_temp = reinterpret_cast<uint8_t *>
(l_hostI2cFullPcrdHdrPtr);
@@ -503,13 +508,14 @@ errlHndl_t HdatPcrd::hdatLoadPcrd(uint32_t &o_size, uint32_t &o_count)
l_pnor = reinterpret_cast<hdatPcrdPnor_t *>(l_temp);
}
- if ( l_pProcTarget == l_pMasterProc )
- {
- this->iv_spPcrd->hdatPcrdIntData[HDAT_PCRD_DA_PNOR].hdatOffset =
- this->iv_spPcrd->hdatPcrdIntData[HDAT_PCRD_DA_HOST_I2C].hdatOffset
- +
- this->iv_spPcrd->hdatPcrdIntData[HDAT_PCRD_DA_HOST_I2C].hdatSize;
+ this->iv_spPcrd->hdatPcrdIntData[HDAT_PCRD_DA_PNOR].hdatOffset =
+ this->iv_spPcrd->hdatPcrdIntData[HDAT_PCRD_DA_HOST_I2C].hdatOffset
+ +
+ sizeof(hdatHDIFDataArray_t) + (sizeof(hdatI2cData_t) * HDAT_PCRD_MAX_I2C_DEV);
+
+ if(l_pProcTarget == l_pMasterProc)
+ {
hdatMsAddr_t l_hardCodedAddr = {0x00000000, 0x00000000};
HDAT_DBG("adding pnor data to the master processor");
@@ -544,15 +550,15 @@ errlHndl_t HdatPcrd::hdatLoadPcrd(uint32_t &o_size, uint32_t &o_count)
}
else
{
- this->iv_spPcrd->hdatPcrdIntData[HDAT_PCRD_DA_PNOR].hdatOffset =
- this->iv_spPcrd->hdatPcrdIntData[HDAT_PCRD_DA_HOST_I2C].hdatOffset
- +
- this->iv_spPcrd->hdatPcrdIntData[HDAT_PCRD_DA_HOST_I2C].hdatSize;
this->iv_spPcrd->hdatPcrdIntData[HDAT_PCRD_DA_PNOR].hdatSize
= 0;
HDAT_DBG("not a master proc, pnor data is not added");
}
+
+ // Add pnor struct size to whole pcrd size, since all pcrd
+ // structs should be of same size
+ this->iv_spPcrd->hdatHdr.hdatSize += sizeof(hdatPcrdPnor_t);
if( NULL != l_errl)
{
OpenPOWER on IntegriCloud