summaryrefslogtreecommitdiffstats
path: root/src/usr
diff options
context:
space:
mode:
authorAndres Lugo-Reyes <aalugore@us.ibm.com>2014-09-10 14:09:29 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2014-10-03 11:11:10 -0500
commit6066a4b18b29baea4cdfa8cf68c7a207978c327c (patch)
tree11855fb9636ed4a438939ae7b9bbdd6e259aa511 /src/usr
parenta5f37a7efcfc85f4c58d526ecc8f9028bc9f26bb (diff)
downloadtalos-hostboot-6066a4b18b29baea4cdfa8cf68c7a207978c327c.tar.gz
talos-hostboot-6066a4b18b29baea4cdfa8cf68c7a207978c327c.zip
fsipres.C now checks of mvpd/cvpd without creating error logs.
Change-Id: Ie2542e97f2bb7bf9ea9680b57e337cd10beda81b RTC:113960 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/13286 Tested-by: Jenkins Server Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Reviewed-by: Corey V. Swenson <cswenson@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr')
-rw-r--r--src/usr/fsi/fsipres.C129
-rw-r--r--src/usr/vpd/cvpd.C14
-rw-r--r--src/usr/vpd/ipvpd.C149
-rw-r--r--src/usr/vpd/ipvpd.H33
-rw-r--r--src/usr/vpd/mvpd.C10
5 files changed, 174 insertions, 161 deletions
diff --git a/src/usr/fsi/fsipres.C b/src/usr/fsi/fsipres.C
index c4ac77ce0..dfc74c6a6 100644
--- a/src/usr/fsi/fsipres.C
+++ b/src/usr/fsi/fsipres.C
@@ -29,6 +29,7 @@
#include <fsi/fsi_reasoncodes.H>
#include <vpd/mvpdenums.H>
#include <vpd/cvpdenums.H>
+#include <vpd/vpd_if.H>
#include <errl/errlmanager.H>
#include <hwas/common/hwasCallout.H>
#include <targeting/common/predicates/predicatectm.H>
@@ -68,7 +69,6 @@ errlHndl_t procPresenceDetect(DeviceFW::OperationType i_opType,
va_list i_args)
{
errlHndl_t l_errl = NULL;
- uint32_t l_saved_plid = 0;
if (unlikely(io_buflen < sizeof(bool)))
{
@@ -115,64 +115,10 @@ errlHndl_t procPresenceDetect(DeviceFW::OperationType i_opType,
#endif // CONFIG_MVPD_READ_FROM_HW
bool mvpd_present = false;
- size_t theSize = 0;
if ( check_for_mvpd )
{
- l_errl = deviceRead( i_target,
- NULL,
- theSize,
- DEVICE_MVPD_ADDRESS( MVPD::CP00,
- MVPD::VD ) );
- if( l_errl )
- {
- if( fsi_present )
- {
- // Save this plid to use later
- l_saved_plid = l_errl->plid();
-
- // commit this log because we expected to have VPD
- errlCommit( l_errl,
- FSI_COMP_ID );
- }
- else
- {
- // just delete this
- delete l_errl;
- }
- }
-
- if( theSize > 0 )
- {
- uint8_t theData[theSize];
- l_errl = deviceRead( i_target,
- theData,
- theSize,
- DEVICE_MVPD_ADDRESS( MVPD::CP00,
- MVPD::VD ) );
- if( l_errl )
- {
- if( fsi_present )
- {
-
- // Save this plid to use later
- l_saved_plid = l_errl->plid();
-
- // commit this log because we expected to have VPD
- errlCommit( l_errl,
- FSI_COMP_ID );
- }
- else
- {
- // just delete this
- delete l_errl;
- }
- }
- else
- {
- mvpd_present = true;
- }
- }
+ mvpd_present = VPD::mvpdPresent( i_target );
}
@@ -206,11 +152,6 @@ errlHndl_t procPresenceDetect(DeviceFW::OperationType i_opType,
HWAS::NO_DECONFIG,
HWAS::GARD_NULL );
- // if there is a saved PLID, apply it to this error log
- if (l_saved_plid)
- {
- l_errl->plid(l_saved_plid);
- }
// Add FFDC for the target to an error log
getFsiFFDC( FFDC_PRESENCE_FAIL, l_errl, i_target);
@@ -259,7 +200,6 @@ errlHndl_t membPresenceDetect(DeviceFW::OperationType i_opType,
va_list i_args)
{
errlHndl_t l_errl = NULL;
- uint32_t l_saved_plid = 0;
if (unlikely(io_buflen < sizeof(bool)))
{
@@ -293,66 +233,10 @@ errlHndl_t membPresenceDetect(DeviceFW::OperationType i_opType,
#endif // CONFIG_CVPD_READ_FROM_HW
bool cvpd_present = false;
- size_t theSize = 0;
-
+
if ( check_for_cvpd )
{
- l_errl = deviceRead( i_target,
- NULL,
- theSize,
- DEVICE_CVPD_ADDRESS( CVPD::VEIR,
- CVPD::PF ) );
-
- if( l_errl )
- {
-
- if( fsi_present )
- {
- // Save this plid to use later
- l_saved_plid = l_errl->plid();
-
- // commit this log because we expected to have VPD
- errlCommit( l_errl,
- FSI_COMP_ID );
- }
- else
- {
- // just delete this
- delete l_errl;
- }
- }
-
- if( theSize > 0 )
- {
- uint8_t theData[theSize];
- l_errl = deviceRead( i_target,
- theData,
- theSize,
- DEVICE_CVPD_ADDRESS( CVPD::VEIR,
- CVPD::PF ) );
- if( l_errl )
- {
-
- if( fsi_present )
- {
- // Save this plid to use later
- l_saved_plid = l_errl->plid();
-
- // commit this log because we expected to have VPD
- errlCommit( l_errl,
- FSI_COMP_ID );
- }
- else
- {
- // just delete this
- delete l_errl;
- }
- }
- else
- {
- cvpd_present = true;
- }
- }
+ cvpd_present = VPD::cvpdPresent( i_target );
}
// Finally compare the 2 methods
@@ -386,11 +270,6 @@ errlHndl_t membPresenceDetect(DeviceFW::OperationType i_opType,
HWAS::NO_DECONFIG,
HWAS::GARD_NULL );
- // if there is a saved PLID, apply it to this error log
- if (l_saved_plid)
- {
- l_errl->plid(l_saved_plid);
- }
// Add FFDC for the target to an error log
getFsiFFDC( FFDC_PRESENCE_FAIL, l_errl, i_target);
diff --git a/src/usr/vpd/cvpd.C b/src/usr/vpd/cvpd.C
index a21eaaa62..4abc9bdf8 100644
--- a/src/usr/vpd/cvpd.C
+++ b/src/usr/vpd/cvpd.C
@@ -36,6 +36,7 @@
#include <vfs/vfs.H>
#include <vpd/vpdreasoncodes.H>
#include <vpd/cvpdenums.H>
+#include <vpd/vpd_if.H>
#include <config.h>
#include "cvpd.H"
#include "vpd.H"
@@ -183,6 +184,19 @@ namespace CVPD
}; // end namespace CVPD
+// --------------------------------------------------------
+// Presence Detection
+//---------------------------------------------------------
+bool VPD::cvpdPresent( TARGETING::Target * i_target )
+{
+ return Singleton<CvpdFacade>::instance().hasVpdPresent( i_target,
+ CVPD::VEIR,
+ CVPD::PF );
+}
+
+
+
+
//CVPD Class Functions
/**
* @brief Constructor
diff --git a/src/usr/vpd/ipvpd.C b/src/usr/vpd/ipvpd.C
index 22504f672..ed61de47a 100644
--- a/src/usr/vpd/ipvpd.C
+++ b/src/usr/vpd/ipvpd.C
@@ -38,6 +38,7 @@
#include <i2c/eepromif.H>
#include <vfs/vfs.H>
#include <vpd/vpdreasoncodes.H>
+#include <vpd/vpd_if.H>
#include <config.h>
#include "vpd.H"
@@ -429,23 +430,76 @@ errlHndl_t IpVpdFacade::findRecordOffset ( const char * i_record,
return NULL;
}
+
+
// ------------------------------------------------------------------
-// IpVpdFacade::findRecordOffsetPnor
+// IpVpdFacade::hasVpdPresent
// ------------------------------------------------------------------
-errlHndl_t IpVpdFacade::findRecordOffsetPnor ( const char * i_record,
- uint16_t & o_offset,
- TARGETING::Target * i_target,
- input_args_t i_args )
+bool IpVpdFacade::hasVpdPresent( TARGETING::Target * i_target,
+ uint64_t i_record,
+ uint64_t i_keyword )
+{
+ errlHndl_t err = NULL;
+ uint16_t recordOffset = 0x0;
+ input_args_t i_args;
+ bool vpdPresent = false;
+ const char * recordName = NULL;
+ const char * keywordName = NULL;
+
+ i_args.record = i_record;
+ i_args.keyword = i_keyword;
+
+ do
+ {
+ //get the Recod/Keyword names
+ err = translateRecord( i_args.record,
+ recordName );
+
+ if( err )
+ {
+ TRACFCOMP( g_trac_vpd, ERR_MRK"Error occured during translateRecord\
+ - IpVpdFacade::hasVpdPresent");
+ break;
+ }
+
+ err = translateKeyword( i_args.keyword,
+ keywordName );
+
+ if( err )
+ {
+ TRACFCOMP( g_trac_vpd, ERR_MRK"Error occured during \
+ translateKeyword - IpVpdFacade::hasVpdPresent" );
+ break;
+ }
+
+ vpdPresent = recordPresent( recordName,
+ recordOffset,
+ i_target );
+
+ }while( 0 );
+
+ if( err )
+ {
+ errlCommit( err, VPD_COMP_ID );
+ return false;
+ }
+
+
+ return vpdPresent;
+}
+
+// ------------------------------------------------------------------
+// IpVpdFacade::recordPresent
+// ------------------------------------------------------------------
+bool IpVpdFacade::recordPresent( const char * i_record,
+ uint16_t & o_offset,
+ TARGETING::Target * i_target )
{
errlHndl_t err = NULL;
uint64_t tmpOffset = 0x0;
char record[RECORD_BYTE_SIZE] = { '\0' };
- uint16_t offset = 0x0;
bool matchFound = false;
- TRACSSCOMP( g_trac_vpd,
- ENTER_MRK"IpVpdFacade::findRecordOffset()" );
-
do
{
// --------------------------------------
@@ -462,50 +516,73 @@ errlHndl_t IpVpdFacade::findRecordOffsetPnor ( const char * i_record,
while( ( tmpOffset < IPVPD_TOC_SIZE ) &&
!matchFound )
{
- TRACDCOMP( g_trac_vpd,
- INFO_MRK"IpVpdFacade::findRecordOffset: read offset: 0x%08x",
- tmpOffset );
-
- // Read Record Name
- err = fetchData( tmpOffset,
- RECORD_BYTE_SIZE,
- record,
- i_target );
- tmpOffset += RECORD_BYTE_SIZE;
-
- if( err )
- {
- break;
- }
-
- if( !(memcmp( record, i_record, RECORD_BYTE_SIZE )) )
- {
- matchFound = true;
-
- // Read the matching records offset
+ //Read Record Name
err = fetchData( tmpOffset,
- RECORD_ADDR_BYTE_SIZE,
- &offset,
+ RECORD_BYTE_SIZE,
+ record,
i_target );
+ tmpOffset += RECORD_BYTE_SIZE;
if( err )
{
break;
}
- }
- tmpOffset += (RECORD_ADDR_BYTE_SIZE + RECORD_TOC_UNUSED);
+
+ if( !(memcmp(record, i_record, RECORD_BYTE_SIZE )) )
+ {
+ matchFound = true;
+
+ // Read the matching record's offset
+ err = fetchData( tmpOffset,
+ RECORD_ADDR_BYTE_SIZE,
+ &o_offset,
+ i_target );
+ if( err )
+ {
+ break;
+ }
+ }
+ tmpOffset += (RECORD_ADDR_BYTE_SIZE + RECORD_TOC_UNUSED);
}
if( err )
{
break;
}
- } while( 0 );
+ }while( 0 );
+
+ if( err )
+ {
+ errlCommit( err, VPD_COMP_ID );
+ return false;
+ }
+ return matchFound;
+}
+
+// ------------------------------------------------------------------
+// IpVpdFacade::findRecordOffsetPnor
+// ------------------------------------------------------------------
+errlHndl_t IpVpdFacade::findRecordOffsetPnor ( const char * i_record,
+ uint16_t & o_offset,
+ TARGETING::Target * i_target,
+ input_args_t i_args )
+{
+ errlHndl_t err = NULL;
+ uint16_t offset = 0x0;
+ bool matchFound = false;
+
+ TRACSSCOMP( g_trac_vpd,
+ ENTER_MRK"IpVpdFacade::findRecordOffset()" );
+
+ matchFound = recordPresent( i_record,
+ offset,
+ i_target );
if( !matchFound )
{
TRACFCOMP( g_trac_vpd,
- ERR_MRK"IpVpdFacade::findRecordOffset: No matching Record (%s) found in TOC!",
+ ERR_MRK"IpVpdFacade::findRecordOffset: No matching\
+ Record (%s) found in TOC!",
i_record );
/*@
diff --git a/src/usr/vpd/ipvpd.H b/src/usr/vpd/ipvpd.H
index 95f110ef0..d59e84608 100644
--- a/src/usr/vpd/ipvpd.H
+++ b/src/usr/vpd/ipvpd.H
@@ -28,6 +28,7 @@
#include <pnor/pnorif.H>
+#include <devicefw/driverif.H>
#include "vpd.H"
/** @file ipvpd.H
@@ -209,6 +210,19 @@ class IpVpdFacade
size_t & io_buflen,
input_args_t i_args );
+ /**
+ * @brief this function checks to see if the given target
+ * is present.
+ *
+ * @param[in] i_target - target VPD to search for.
+ *
+ * @return - bool - true if vpd is present, false if it is not.
+ */
+ bool hasVpdPresent ( TARGETING::Target * i_target,
+ uint64_t record,
+ uint64_t keyword );
+
+
protected:
/**
@@ -262,6 +276,25 @@ class IpVpdFacade
input_args_t i_args );
/**
+ * @brief This function searches for the VPD record and returns
+ * True if it is there, False otherwise. This function works similarly
+ * to findRecordOffsetPnor except it does not create error logs if
+ * the record was not found. This will replace some of the code in
+ * findRecordOffsetPnor
+ *
+ * @param[in] i_record - String value for the record to look for.
+ *
+ * @param[out] offset - The offset where the record is located.
+ *
+ * @param[in] i_target - The target to retrieve the data for.
+ *
+ * @return bool - True if the record is found, False otherwise.
+ */
+ bool recordPresent( const char * i_record,
+ uint16_t & offset,
+ TARGETING::Target * i_target );
+
+ /**
* @brief This function will read the VPD TOC to find the offset where the
* given record is located within the chunk of data.
*
diff --git a/src/usr/vpd/mvpd.C b/src/usr/vpd/mvpd.C
index b9d411298..0e9801984 100644
--- a/src/usr/vpd/mvpd.C
+++ b/src/usr/vpd/mvpd.C
@@ -36,6 +36,7 @@
#include <vfs/vfs.H>
#include <vpd/vpdreasoncodes.H>
#include <vpd/mvpdenums.H>
+#include <vpd/vpd_if.H>
#include <config.h>
#include "mvpd.H"
@@ -179,6 +180,15 @@ namespace MVPD
}; // end MVPD namespace
+// ---------------------------------------------------------
+// Presence Detection
+// ---------------------------------------------------------
+bool VPD::mvpdPresent( TARGETING::Target * i_target )
+{
+ return Singleton<MvpdFacade>::instance().hasVpdPresent( i_target,
+ MVPD::CP00,
+ MVPD::VD );
+}
//MVPD Class Functions
OpenPOWER on IntegriCloud