diff options
author | Prachi Gupta <pragupta@us.ibm.com> | 2015-01-23 14:18:43 -0600 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2015-02-24 15:36:10 -0600 |
commit | b908135a569ed584b12262a020664d0150e4d933 (patch) | |
tree | 695a74c1598415beefc984d27f8a7fd9713ccf2f /src/usr/pnor/runtime/rt_pnor.C | |
parent | b03dc1b8e4b20a8039775e474bd9ebf2503bf48c (diff) | |
download | talos-hostboot-b908135a569ed584b12262a020664d0150e4d933.tar.gz talos-hostboot-b908135a569ed584b12262a020664d0150e4d933.zip |
determine the toc locations in pnorrp and rt_pnor code
RTC: 120733
Change-Id: I5372a102ce9761a514a6f7245ca206a2226f1f3b
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/15456
Tested-by: Jenkins Server
Reviewed-by: STEPHEN M. CPREK <smcprek@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/pnor/runtime/rt_pnor.C')
-rw-r--r-- | src/usr/pnor/runtime/rt_pnor.C | 56 |
1 files changed, 22 insertions, 34 deletions
diff --git a/src/usr/pnor/runtime/rt_pnor.C b/src/usr/pnor/runtime/rt_pnor.C index f616e9874..0afb7fea9 100644 --- a/src/usr/pnor/runtime/rt_pnor.C +++ b/src/usr/pnor/runtime/rt_pnor.C @@ -37,6 +37,7 @@ #include "../ffs.h" #include "../common/ffs_hb.H" +#include <util/align.H> // Trace definition extern trace_desc_t* g_trac_pnor; @@ -297,7 +298,6 @@ errlHndl_t RtPnor::flush( PNOR::SectionId i_section) } /*******Protected Methods**************/ RtPnor::RtPnor() -:iv_TOC_used(PNOR::TOC_0) { errlHndl_t l_err = readTOC(); if (l_err) @@ -574,44 +574,37 @@ errlHndl_t RtPnor::readTOC () { TRACFCOMP(g_trac_pnor, ENTER_MRK"RtPnor::readTOC" ); errlHndl_t l_err = NULL; - uint8_t* toc0Buffer = new uint8_t[PAGESIZE]; - uint8_t* toc1Buffer = new uint8_t[PAGESIZE]; + uint8_t* l_toc0Buffer = new uint8_t[PNOR::TOC_SIZE]; do { - //find proc id - uint64_t l_procId; - TARGETING::Target* l_masterProc = NULL; - TARGETING::targetService().masterProcChipTargetHandle( l_masterProc ); - l_err = RT_TARG::getRtTarget (l_masterProc, l_procId); - if (l_err) - { - TRACFCOMP(g_trac_pnor, "RtPnor::readTOC: getRtTarget failed"); - break; - } - if (g_hostInterfaces && g_hostInterfaces->pnor_read) { - //@TODO RTC:120733 - //RT code needs a way to get the active side tocs vs just defaulting - //to SIDE_A - l_err = readFromDevice(l_procId,PNOR::TOC,PNOR::SIDE_A_TOC_0_OFFSET, - PAGESIZE,false,toc0Buffer); + //find proc id + uint64_t l_procId; + TARGETING::Target* l_masterProc = NULL; + TARGETING::targetService().masterProcChipTargetHandle(l_masterProc); + l_err = RT_TARG::getRtTarget (l_masterProc, l_procId); if (l_err) { - TRACFCOMP(g_trac_pnor,"RtPnor::readTOC:readFromDevice failed" - " for TOC0"); + TRACFCOMP(g_trac_pnor, "RtPnor::readTOC: getRtTarget failed"); break; } - - l_err = readFromDevice(l_procId,PNOR::TOC,PNOR::SIDE_A_TOC_1_OFFSET, - PAGESIZE, false,toc1Buffer); + // offset = 0 means read the entire PNOR::TOC partition + // This offset is offset into the partition, not offset from the + // beginning of the flash + l_err = readFromDevice (l_procId, PNOR::TOC, 0, + PNOR::TOC_SIZE, false, l_toc0Buffer); if (l_err) { - TRACFCOMP(g_trac_pnor, "RtPnor::readTOC:readFromDevice failed" - " for TOC1"); + TRACFCOMP(g_trac_pnor,"RtPnor::readTOC:readFromDevice failed" + " for TOC0"); break; } - l_err = PNOR::parseTOC(toc0Buffer,toc1Buffer,iv_TOC_used,iv_TOC,0); + // When we ask for TOC partition, Opal returns a valid TOC. + // So, we don't need to verify the second TOC in parseTOC + // Therefore, sending invalid value for second toc + PNOR::TOCS l_tocUsed; + l_err = PNOR::parseTOC(l_toc0Buffer, 0, l_tocUsed, iv_TOC, 0); if (l_err) { TRACFCOMP(g_trac_pnor, "RtPnor::readTOC: parseTOC failed"); @@ -620,14 +613,9 @@ errlHndl_t RtPnor::readTOC () } } while (0); - if(toc0Buffer != NULL) - { - delete[] toc0Buffer; - } - - if(toc1Buffer != NULL) + if(l_toc0Buffer != NULL) { - delete[] toc1Buffer; + delete[] l_toc0Buffer; } TRACFCOMP(g_trac_pnor, EXIT_MRK"RtPnor::readTOC" ); |