diff options
author | Dan Crowell <dcrowell@us.ibm.com> | 2015-03-03 09:03:43 -0600 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2015-03-26 07:58:56 -0500 |
commit | 0d7ec79752556d06069b37de26cd5aa8ea38e1de (patch) | |
tree | 8d5cece0f3d216e897481a7b51ad614434c94818 /src/usr/pnor | |
parent | 4c31ecf3b63f4f21e677d7359f64de22cd8fc1eb (diff) | |
download | talos-hostboot-0d7ec79752556d06069b37de26cd5aa8ea38e1de.tar.gz talos-hostboot-0d7ec79752556d06069b37de26cd5aa8ea38e1de.zip |
Modify hbrt pnor interfaces to handle different partition sizes
Change-Id: I8ea0d9fa603328bdafed97bd33d70ad3634b43a3
RTC: 125021
Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/16139
Tested-by: Jenkins Server
Reviewed-by: Corey V. Swenson <cswenson@us.ibm.com>
Reviewed-by: PRACHI GUPTA <pragupta@us.ibm.com>
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/pnor')
-rw-r--r-- | src/usr/pnor/pnor_common.C | 12 | ||||
-rw-r--r-- | src/usr/pnor/runtime/rt_pnor.C | 22 |
2 files changed, 28 insertions, 6 deletions
diff --git a/src/usr/pnor/pnor_common.C b/src/usr/pnor/pnor_common.C index c14e41b6c..eeb2ed3fa 100644 --- a/src/usr/pnor/pnor_common.C +++ b/src/usr/pnor/pnor_common.C @@ -188,10 +188,22 @@ errlHndl_t PNOR::parseTOC(uint8_t* i_toc0Buffer, uint8_t* i_toc1Buffer, ffs_hdr* l_ffs_hdr; if (cur_TOC == 0) { + if( !i_toc0Buffer ) + { + TRACFCOMP(g_trac_pnor, "TOC0 buffer is NULL"); + TOC_0_failed = true; + o_TOC_used = TOC_1; + continue; + } l_ffs_hdr = (ffs_hdr*) i_toc0Buffer; } else if (cur_TOC == 1) { + if( !i_toc1Buffer ) + { + TRACFCOMP(g_trac_pnor, "TOC1 buffer is NULL"); + continue; + } l_ffs_hdr = (ffs_hdr*) i_toc1Buffer; } diff --git a/src/usr/pnor/runtime/rt_pnor.C b/src/usr/pnor/runtime/rt_pnor.C index 0afb7fea9..d434f2656 100644 --- a/src/usr/pnor/runtime/rt_pnor.C +++ b/src/usr/pnor/runtime/rt_pnor.C @@ -343,12 +343,13 @@ errlHndl_t RtPnor::readFromDevice (uint64_t i_procId, l_offset = (i_offset * 9)/8; } + int l_rc = 0; if (g_hostInterfaces && g_hostInterfaces->pnor_read) { // get the data from OPAL - int l_rc = g_hostInterfaces->pnor_read(i_procId, l_partitionName, + l_rc = g_hostInterfaces->pnor_read(i_procId, l_partitionName, l_offset, l_dataToRead, l_readSize); - if (l_rc) + if (l_rc < 0) { TRACFCOMP(g_trac_pnor, "RtPnor::readFromDevice: pnor_read" " failed proc:%d, part:%s, offset:0x%X, size:0x%X," @@ -375,6 +376,10 @@ errlHndl_t RtPnor::readFromDevice (uint64_t i_procId, true); break; } + else if( l_rc != static_cast<int>(l_readSize) ) + { + TRACFCOMP( g_trac_pnor, "RtPnor::readFromDevice: only read 0x%X bytes, expecting 0x%X", l_rc, l_readSize ); + } } else { @@ -403,7 +408,7 @@ errlHndl_t RtPnor::readFromDevice (uint64_t i_procId, PNOR::ECC::eccStatus ecc_stat = PNOR::ECC::removeECC(reinterpret_cast<uint8_t*>(l_dataToRead), reinterpret_cast<uint8_t*>(o_data), - i_size); + l_rc); //actual size of read data // create an error if we couldn't correct things if( ecc_stat == PNOR::ECC::UNCORRECTABLE ) @@ -438,7 +443,7 @@ errlHndl_t RtPnor::readFromDevice (uint64_t i_procId, //need to write good data back to PNOR int l_rc = g_hostInterfaces->pnor_write(i_procId, l_partitionName,l_offset, l_dataToRead,l_readSize); - if (l_rc) + if (l_rc != static_cast<int>(l_readSize)) { TRACFCOMP(g_trac_pnor, "RtPnor::readFromDevice> Error" " writing corrected data back to device"); @@ -448,6 +453,7 @@ errlHndl_t RtPnor::readFromDevice (uint64_t i_procId, * @moduleid PNOR::MOD_RTPNOR_READFROMDEVICE * @reasoncode PNOR::RC_PNOR_WRITE_FAILED * @userdata1 rc returned from pnor_write + * @userdata2 Expected size of write * @devdesc error writing corrected data back to PNOR * @custdesc Error accessing system firmware flash */ @@ -455,7 +461,7 @@ errlHndl_t RtPnor::readFromDevice (uint64_t i_procId, ERRORLOG::ERRL_SEV_UNRECOVERABLE, PNOR::MOD_RTPNOR_READFROMDEVICE, PNOR::RC_PNOR_WRITE_FAILED, - l_rc, 0, true); + l_rc, l_readSize, true); errlCommit(l_err, PNOR_COMP_ID); } } @@ -511,7 +517,7 @@ errlHndl_t RtPnor::writeToDevice( uint64_t i_procId, //make call into opal to write the data int l_rc = g_hostInterfaces->pnor_write(i_procId, l_partitionName,l_offset,l_dataToWrite,l_writeSize); - if (l_rc) + if (l_rc != static_cast<int>(l_writeSize)) { TRACFCOMP(g_trac_pnor, "RtPnor::writeToDevice: pnor_write failed " "proc:%d, part:%s, offset:0x%X, size:0x%X, dataPt:0x%X," @@ -537,6 +543,10 @@ errlHndl_t RtPnor::writeToDevice( uint64_t i_procId, true); break; } + else if( l_rc != static_cast<int>(l_writeSize) ) + { + TRACFCOMP( g_trac_pnor, "RtPnor::writeToDevice: only read 0x%X bytes, expecting 0x%X", l_rc, l_writeSize ); + } } else { |