diff options
author | Sampa Misra <sampmisr@in.ibm.com> | 2016-11-29 23:57:22 -0600 |
---|---|---|
committer | William G. Hoffa <wghoffa@us.ibm.com> | 2017-01-12 16:19:16 -0500 |
commit | 803a38f125d5b4696b7f5fd3432dc296ea838e3d (patch) | |
tree | bfbc90936c4ac1f8e294b05e2cca922bb8fcf035 /src/usr/hdat | |
parent | 8dca78dfaeddb87852e7c560e3e5ad2c6bf95989 (diff) | |
download | talos-hostboot-803a38f125d5b4696b7f5fd3432dc296ea838e3d.tar.gz talos-hostboot-803a38f125d5b4696b7f5fd3432dc296ea838e3d.zip |
pnor changes
Change-Id: I0ade5a5d49bc18d963087e4b45845c8991b24cfc
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/33168
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')
-rw-r--r-- | src/usr/hdat/hdatpcrd.C | 102 | ||||
-rw-r--r-- | src/usr/hdat/hdatpcrd.H | 49 |
2 files changed, 148 insertions, 3 deletions
diff --git a/src/usr/hdat/hdatpcrd.C b/src/usr/hdat/hdatpcrd.C index 8e6a63c54..84c715399 100644 --- a/src/usr/hdat/hdatpcrd.C +++ b/src/usr/hdat/hdatpcrd.C @@ -169,6 +169,10 @@ static errlHndl_t hdatSetPcrdHdrs(hdatSpPcrd_t *i_pcrd) i_pcrd->hdatPcrdIntData[HDAT_PCRD_DA_HOST_I2C].hdatOffset = 0; i_pcrd->hdatPcrdIntData[HDAT_PCRD_DA_HOST_I2C].hdatSize = 0; + i_pcrd->hdatPcrdIntData[HDAT_PCRD_DA_PNOR].hdatOffset = 0; + i_pcrd->hdatPcrdIntData[HDAT_PCRD_DA_PNOR].hdatSize = + sizeof(hdatPcrdPnor_t); + return l_errlHndl; } @@ -206,7 +210,7 @@ HdatPcrd::HdatPcrd(errlHndl_t &o_errlHndl, const hdatMsAddr_t &i_msAddr) *******************************************************************************/ errlHndl_t HdatPcrd::hdatLoadPcrd(uint32_t &o_size, uint32_t &o_count) { - errlHndl_t l_errl = NULL; + errlHndl_t l_errl = NULL, l_errl1 = NULL; do { // PCRD index @@ -216,6 +220,8 @@ errlHndl_t HdatPcrd::hdatLoadPcrd(uint32_t &o_size, uint32_t &o_count) uint8_t *l_offset = reinterpret_cast<uint8_t *> (this->iv_spPcrd); uint8_t *l_addr =l_offset; + hdatPcrdPnor_t * l_pnor = NULL; + // Get Max threads ATTR_THREAD_COUNT_type l_coreThreadCount = 0; Target* l_pTopLevel = NULL; @@ -258,6 +264,32 @@ errlHndl_t HdatPcrd::hdatLoadPcrd(uint32_t &o_size, uint32_t &o_count) HDAT_PROC_NOT_INSTALLED | HDAT_PRIM_THREAD | HDAT_TWO_THREAD; } + //query the master proc + TARGETING::Target* l_pMasterProc = NULL; + l_errl1 =targetService().queryMasterProcChipTargetHandle(l_pMasterProc); + + if ( l_errl1 ) + { + HDAT_ERR("could not find the master processor," + " the PNOR data will not be added"); + + /*@ + * @errortype + * @moduleid HDAT::MOD_PCRD_LOAD + * @reasoncode RC_TGT_ATTR_NOTFOUND + * @devdesc could not find target + * @custdesc Firmware encountered an internal error + */ + hdatBldErrLog(l_errl1, + MOD_PCRD_LOAD, + RC_TGT_ATTR_NOTFOUND, + 0,0,0,0, + ERRORLOG::ERRL_SEV_INFORMATIONAL, + HDAT_VERSION1, + true); + + } + //for each procs in the system TARGETING::PredicateCTM l_procFilter(CLASS_CHIP, TYPE_PROC); TARGETING::PredicateHwas l_pred; @@ -504,7 +536,66 @@ errlHndl_t HdatPcrd::hdatLoadPcrd(uint32_t &o_size, uint32_t &o_count) this->iv_spPcrd->hdatPcrdIntData [HDAT_PCRD_DA_HOST_I2C].hdatSize = l_pcrdHI2cTotalSize; this->iv_spPcrd->hdatHdr.hdatSize += l_pcrdHI2cTotalSize; + + + uint8_t* l_temp = reinterpret_cast<uint8_t *> + (l_hostI2cFullPcrdHdrPtr); + + l_temp += l_pcrdHI2cTotalSize; + 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; + + hdatMsAddr_t l_hardCodedAddr = {0x00000000, 0x00000000}; + + HDAT_DBG("adding pnor data to the master processor"); + l_pnor->hdatPcrdPnorBusType= 0x00; + + memset(l_pnor->hdatPcrdPnorReserved1,0x0,sizeof(uint8_t) *7); + + memcpy(&l_pnor->hdatPcrdPnorBaseAddr,&l_hardCodedAddr, + sizeof(hdatMsAddr_t)); + + l_pnor->hdatPcrdPnorSize = 0x0; + l_pnor->hdatPcrdPnorReserved2 = 0x0; + + memcpy(&l_pnor->hdatPcrdPnorGoldenTOC,&l_hardCodedAddr, + sizeof(hdatMsAddr_t)); + l_pnor->hdatPcrdPnorGoldenTOCsize = 0x0; + l_pnor->hdatPcrdPnorReserved3 = 0x0; + + memcpy(&l_pnor->hdatPcrdPnorWorkingTOC,&l_hardCodedAddr, + sizeof(hdatMsAddr_t)); + l_pnor->hdatPcrdPnorWorkTOCsize = 0x0; + l_pnor->hdatPcrdPnorReserved4 = 0x0; + + memcpy(&l_pnor->hdatPcrdPnorPsideTOC,&l_hardCodedAddr, + sizeof(hdatMsAddr_t)); + l_pnor->hdatPcrdPnorPsideTOCsize = 0x0; + l_pnor->hdatPcrdPnorReserved5 = 0x0; + + memcpy(&l_pnor->hdatPcrdPnorTsideTOC,&l_hardCodedAddr, + sizeof(hdatMsAddr_t)); + l_pnor->hdatPcrdPnorTsideTOCsize = 0x0; + } + 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"); + } + if( NULL != l_errl) { break; @@ -747,4 +838,13 @@ HdatPcrd :: ~HdatPcrd() } +errlHndl_t HdatPcrd::fetch_pnor_data( hdatPcrdPnor_t& o_pnorData) +{ + errlHndl_t l_err = NULL; + + return l_err; + + //will be implemented once api is available + +} } // namespace HDATPcrd diff --git a/src/usr/hdat/hdatpcrd.H b/src/usr/hdat/hdatpcrd.H index d3c9157f3..8aac19105 100644 --- a/src/usr/hdat/hdatpcrd.H +++ b/src/usr/hdat/hdatpcrd.H @@ -68,8 +68,9 @@ enum hdatPcrdDataPtrs HDAT_PCRD_DA_ASCII_KWD = 3, HDAT_PCRD_DA_CHIP_VPD = 4, HDAT_PCRD_DA_HOST_I2C = 5, - HDAT_PCRD_DA_CNT = 6, - HDAT_PCRD_DA_LAST = 7, + HDAT_PCRD_DA_PNOR = 6, + HDAT_PCRD_DA_CNT = 7, + HDAT_PCRD_DA_LAST = 8, }; /*----------------------------------------------------------------------------*/ @@ -120,6 +121,34 @@ struct hdatPcrdHI2cData_t uint32_t hdatPcrdI2cPurpose; // 0x0008 Host I2C purpose }__attribute__ ((packed)); + +/* @brief defines PNOR structure in PCRD */ +struct hdatPcrdPnor_t +{ + uint8_t hdatPcrdPnorBusType; //0x0000 bus on which pnor placed + uint8_t hdatPcrdPnorReserved1[7]; //0x0001 Reserved + + hdatMsAddr_t hdatPcrdPnorBaseAddr; //0x0008 base addr of pnor device + uint32_t hdatPcrdPnorSize; //0x0010 size of pnor addr space + uint32_t hdatPcrdPnorReserved2; //0x0014 Reserved + + hdatMsAddr_t hdatPcrdPnorGoldenTOC; //0x0018 start addr of golden image TOC + uint32_t hdatPcrdPnorGoldenTOCsize; //0x0020 KB size of golden image TOC + uint32_t hdatPcrdPnorReserved3; //0x0024 Reserved + + hdatMsAddr_t hdatPcrdPnorWorkingTOC; //0x0028 working TOC start addr + uint32_t hdatPcrdPnorWorkTOCsize; //0x0030 KB size of working TOC + uint32_t hdatPcrdPnorReserved4; //0x0034 Reserved + + hdatMsAddr_t hdatPcrdPnorPsideTOC; //0x0038 P-side image TOC start addr + uint32_t hdatPcrdPnorPsideTOCsize; //0x0040 KB size of P-side TOC + uint32_t hdatPcrdPnorReserved5; //0x0044 Reserved + + hdatMsAddr_t hdatPcrdPnorTsideTOC; //0x0048 T-side TOC start addr + uint32_t hdatPcrdPnorTsideTOCsize; //0x0050 T-side TOC size +}; + + /** @brief Defines the PCRD. * FipS updates this portion and DMAs the entire PCRD back to main memory. */ @@ -132,6 +161,7 @@ struct hdatSpPcrd_t hdatFruId_t hdatFruId; char *hdatKwd; uint8_t *vpd_data; + hdatPcrdPnor_t hdatPnorData; //add in padding here. uint32_t whatever it is. } __attribute__ ((packed)); @@ -271,6 +301,21 @@ class HdatPcrd errlHndl_t hdatSetProcessorInfo(const TARGETING::Target* i_pProcTarget, uint32_t i_procstatus); + + /** + * @brief fetches the pnor data according to the hdat spec + * + * @pre HdatPcrd Object should be constructed with the main memory address + * Target pointer to the present procs in the system + * + * @post the pnor data is populated + * + * @param[out] o_pnorData the pnor data structure + * + * @return A null error log handle if successful, else the return code + * pointed to by o_errlHndl + */ + errlHndl_t fetch_pnor_data( hdatPcrdPnor_t& o_pnorData); }; |