summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/include/runtime/interface.h14
-rw-r--r--src/include/usr/util/util_reasoncodes.H1
-rw-r--r--src/usr/pnor/pnor_common.C12
-rw-r--r--src/usr/pnor/runtime/rt_pnor.C22
-rw-r--r--src/usr/testcore/rtloader/loader.H12
-rw-r--r--src/usr/util/runtime/utillidmgr_rt.C32
6 files changed, 72 insertions, 21 deletions
diff --git a/src/include/runtime/interface.h b/src/include/runtime/interface.h
index 26d5f6b6a..ca62f2ea1 100644
--- a/src/include/runtime/interface.h
+++ b/src/include/runtime/interface.h
@@ -201,11 +201,12 @@ typedef struct hostInterfaces
* @param[in] i_partitionName: name of the partition to read
* @param[in] i_offset: offset within the partition
* @param[out] o_data: pointer to the data read
- * @param[in] i_sizeBytes: size of data to read
- * @retval rc - non-zero on error
+ * @param[in] i_sizeBytes: size of o_data buffer, maximum number
+ * of bytes to read
+ * @retval rc - negative on error, else number of bytes actually read
*/
int (*pnor_read) (uint32_t i_proc, const char* i_partitionName,
- uint64_t i_offset, void* o_data, size_t i_sizeBytes);
+ uint64_t i_offset, void* o_data, size_t i_sizeBytes);
/**
* @brief Write to Pnor
@@ -213,11 +214,12 @@ typedef struct hostInterfaces
* @param[in] i_partitionName: name of the partition to write
* @param[in] i_offset: offset withing the partition
* @param[in] i_data: pointer to the data to write
- * @param[in] i_sizeBytes: size of data to write
- * @retval rc - non-zero on error
+ * @param[in] i_sizeBytes: size of i_data buffer, maximum number
+ * of bytes to read
+ * @retval rc - negative on error, else number of bytes actually written
*/
int (*pnor_write) (uint32_t i_proc, const char* i_partitionName,
- uint64_t i_offset, void* i_data, size_t i_sizeBytes);
+ uint64_t i_offset, void* i_data, size_t i_sizeBytes);
/**
diff --git a/src/include/usr/util/util_reasoncodes.H b/src/include/usr/util/util_reasoncodes.H
index 857d2c351..2b7ed35cb 100644
--- a/src/include/usr/util/util_reasoncodes.H
+++ b/src/include/usr/util/util_reasoncodes.H
@@ -51,6 +51,7 @@ namespace Util
UTIL_LIDMGR_UNSUP_MSG = UTIL_COMP_ID | 0x07,
UTIL_LIDMGR_INVAL_SIZE_PNOR = UTIL_COMP_ID | 0x08,
UTIL_LIDMGR_UNLOAD_RC_FAIL = UTIL_COMP_ID | 0x09,
+ UTIL_LIDMGR_NOT_FOUND = UTIL_COMP_ID | 0x0A,
};
};
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
{
diff --git a/src/usr/testcore/rtloader/loader.H b/src/usr/testcore/rtloader/loader.H
index 9ac9c5ebc..50c3b84d3 100644
--- a/src/usr/testcore/rtloader/loader.H
+++ b/src/usr/testcore/rtloader/loader.H
@@ -345,7 +345,6 @@ class RuntimeLoaderTest : public CxxTest::TestSuite
PNOR::SectionId l_id = PNOR::INVALID_SECTION;
PNOR::SectionInfo_t l_info;
errlHndl_t l_err = NULL;
- uint32_t l_plid = 0;
do
{
@@ -395,13 +394,14 @@ class RuntimeLoaderTest : public CxxTest::TestSuite
} while (0);
//commit the error
+ int rc = i_sizeBytes;
if (l_err)
{
- l_plid = l_err -> plid();
errlCommit(l_err,CXXTEST_COMP_ID);
+ rc = -1;
}
TRACFCOMP(g_trac_hbrt, EXIT_MRK"rt_pnor_read");
- return l_plid;
+ return rc;
}
@@ -415,7 +415,6 @@ class RuntimeLoaderTest : public CxxTest::TestSuite
PNOR::SectionId l_id = PNOR::INVALID_SECTION;
PNOR::SectionInfo_t l_info;
errlHndl_t l_err = NULL;
- uint32_t l_plid = 0;
do {
TARGETING::Target* pnor_target =
@@ -458,13 +457,14 @@ class RuntimeLoaderTest : public CxxTest::TestSuite
} while (0);
//commit the error
+ int rc = i_sizeBytes;
if (l_err)
{
- l_plid = l_err -> plid();
errlCommit (l_err, CXXTEST_COMP_ID);
+ rc = -1;
}
TRACFCOMP(g_trac_hbrt, EXIT_MRK"rt_pnor_write");
- return l_plid;
+ return rc;
}
//--------------------------------------------------------------------
diff --git a/src/usr/util/runtime/utillidmgr_rt.C b/src/usr/util/runtime/utillidmgr_rt.C
index 44f1ce81f..2c5c80a30 100644
--- a/src/usr/util/runtime/utillidmgr_rt.C
+++ b/src/usr/util/runtime/utillidmgr_rt.C
@@ -31,6 +31,7 @@
#include <vfs/vfs.H>
#include <runtime/interface.h>
#include <hwpf/hwp/occ/occ_common.H>
+#include <initservice/initserviceif.H>
UtilLidMgr::UtilLidMgr(uint32_t i_lidId) :
iv_isLidInPnor(false), iv_lidBuffer(NULL), iv_lidSize(0),
@@ -109,7 +110,8 @@ errlHndl_t UtilLidMgr::loadLid()
iv_lidSize = iv_lidPnorInfo.size;
iv_lidBuffer = reinterpret_cast<char *>(iv_lidPnorInfo.vaddr);
}
- else
+ else if( g_hostInterfaces->lid_load
+ && INITSERVICE::spBaseServicesEnabled() )
{
int rc = g_hostInterfaces->lid_load(iv_lidId, &iv_lidBuffer,
&iv_lidSize);
@@ -120,15 +122,39 @@ errlHndl_t UtilLidMgr::loadLid()
* @moduleid Util::UTIL_LIDMGR_RT
* @reasoncode Util::UTIL_LIDMGR_RC_FAIL
* @userdata1 Return code from lid_load call.
+ * @userdata2 Lid number
* @devdesc Unable to load LID via host interface.
*/
l_errl = new ERRORLOG::ErrlEntry(
ERRORLOG::ERRL_SEV_INFORMATIONAL,
Util::UTIL_LIDMGR_RT,
Util::UTIL_LIDMGR_RC_FAIL,
- rc);
+ rc,
+ iv_lidId,
+ true/*SW Error*/);
+ break;
}
- }
+ }
+
+ // Could not find the lid anywhere
+ if( iv_lidSize == 0 )
+ {
+ /*@
+ * @errortype ERRL_SEV_INFORMATIONAL
+ * @moduleid Util::UTIL_LIDMGR_RT
+ * @reasoncode Util::UTIL_LIDMGR_NOT_FOUND
+ * @userdata1 Lid number
+ * @devdesc Unable to find Lid.
+ */
+ l_errl = new ERRORLOG::ErrlEntry(
+ ERRORLOG::ERRL_SEV_INFORMATIONAL,
+ Util::UTIL_LIDMGR_RT,
+ Util::UTIL_LIDMGR_NOT_FOUND,
+ iv_lidId,
+ 0,
+ true/*SW Error*/);
+ break;
+ }
} while (0);
return l_errl;
}
OpenPOWER on IntegriCloud