summaryrefslogtreecommitdiffstats
path: root/src/usr/ipmiext/ipmifruinv.C
diff options
context:
space:
mode:
Diffstat (limited to 'src/usr/ipmiext/ipmifruinv.C')
-rw-r--r--src/usr/ipmiext/ipmifruinv.C101
1 files changed, 64 insertions, 37 deletions
diff --git a/src/usr/ipmiext/ipmifruinv.C b/src/usr/ipmiext/ipmifruinv.C
index e70d5afa0..14ad957d1 100644
--- a/src/usr/ipmiext/ipmifruinv.C
+++ b/src/usr/ipmiext/ipmifruinv.C
@@ -7,8 +7,9 @@
/* */
/* Contributors Listed Below - COPYRIGHT 2014,2019 */
/* [+] International Business Machines Corp. */
-/* [+] Jim Yuan */
-/* [+] Maxim Polyakov */
+/* [+] Super Micro Computer, Inc. */
+/* [+] YADRO */
+/* [+] lixg */
/* */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); */
@@ -546,42 +547,43 @@ errlHndl_t IpmiFruInv::formatMfgData(std::vector<uint8_t> i_mfgDateData,
{
errlHndl_t l_errl = NULL;
- // MB keyword size is 8 hex bytes, throw an error if it is smaller so we
- // don't do an invalid access.
- if (i_mfgDateData.size() != 8)
+ do
{
- /*@
- * @errortype
- * @moduleid IPMI::MOD_IPMIFRU_INV
- * @reasoncode IPMI::RC_INVALID_VPD_DATA
- * @userdata1 Size of vpd data
- *
- * @devdesc VPD data is invalid size
- */
- l_errl = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_INFORMATIONAL,
- IPMI::MOD_IPMIFRU_INV,
- IPMI::RC_INVALID_VPD_DATA,
- i_mfgDateData.size());
-
- TARGETING::Target* nodeTarget = NULL;
- TARGETING::PredicateCTM nodeFilter(TARGETING::CLASS_ENC,
- TARGETING::TYPE_NODE);
- TARGETING::TargetRangeFilter nodeItr(
- TARGETING::targetService().begin(),
- TARGETING::targetService().end(),
- &nodeFilter);
-
- nodeTarget = *nodeItr;
-
- // Callout out node since that is where the VPD lives
- l_errl->addHwCallout(nodeTarget,
- HWAS::SRCI_PRIORITY_HIGH,
- HWAS::NO_DECONFIG,
- HWAS::GARD_NULL );
+ // MB keyword size is 8 hex bytes, throw an error if it is smaller so we
+ // don't do an invalid access.
+ if (i_mfgDateData.size() != 8)
+ {
+ /*@
+ * @errortype
+ * @moduleid IPMI::MOD_IPMIFRU_INV
+ * @reasoncode IPMI::RC_INVALID_VPD_DATA
+ * @userdata1 Size of vpd data
+ *
+ * @devdesc VPD data is invalid size
+ */
+ l_errl = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_INFORMATIONAL,
+ IPMI::MOD_IPMIFRU_INV,
+ IPMI::RC_INVALID_VPD_DATA,
+ i_mfgDateData.size());
+
+ TARGETING::Target* nodeTarget = NULL;
+ TARGETING::PredicateCTM nodeFilter(TARGETING::CLASS_ENC,
+ TARGETING::TYPE_NODE);
+ TARGETING::TargetRangeFilter nodeItr(
+ TARGETING::targetService().begin(),
+ TARGETING::targetService().end(),
+ &nodeFilter);
+
+ nodeTarget = *nodeItr;
+
+ // Callout out node since that is where the VPD lives
+ l_errl->addHwCallout(nodeTarget,
+ HWAS::SRCI_PRIORITY_HIGH,
+ HWAS::NO_DECONFIG,
+ HWAS::GARD_NULL );
+ break;
+ }
- }
- else
- {
// Convert Centuries / Years / months / day / hour / minute / second
// into a uint64 representing number of minute since 1/1/96
@@ -594,6 +596,25 @@ errlHndl_t IpmiFruInv::formatMfgData(std::vector<uint8_t> i_mfgDateData,
uint8_t hour = bcd2_to_int(i_mfgDateData.at(5));
uint8_t minute = bcd2_to_int(i_mfgDateData.at(6));
+ // Do some sanity checking on the data so the math below doesn't
+ // go crazy and cause a crash
+ if ( (century < 20)
+ || (month < 1) || (month > 12)
+ || (day < 1) || (day > 31)
+ || (hour > 23) || (minute > 59) )
+ {
+ o_mfgDate = 0xFFFFFFFF;
+ TRACFCOMP(g_trac_ipmi,"MfgDate error: %02X %02X %02X %02X %02X %02X %02X ",
+ i_mfgDateData.at(0),
+ i_mfgDateData.at(1),
+ i_mfgDateData.at(2),
+ i_mfgDateData.at(3),
+ i_mfgDateData.at(4),
+ i_mfgDateData.at(5),
+ i_mfgDateData.at(6));
+ break;
+ }
+
// Subtract year
uint8_t numOfYears = (century*100 + year) - 1996;
// Subtract month
@@ -612,6 +633,7 @@ errlHndl_t IpmiFruInv::formatMfgData(std::vector<uint8_t> i_mfgDateData,
// Add a day for every leap year
// Check if we need to consider the current year
+ // Year is related to century, anybody familiar with this may fix it
if (month <= 2)
{
// We don't need to consider this year for a leap year, as it
@@ -638,7 +660,7 @@ errlHndl_t IpmiFruInv::formatMfgData(std::vector<uint8_t> i_mfgDateData,
// Convert into minutes
o_mfgDate = (((numOfDays*24)*60) + (hour*60) + minute);
- }
+ } while(0);
return l_errl;
}
@@ -2406,6 +2428,8 @@ void IPMIFRUINV::gatherSetData(const TARGETING::Target* i_pSys,
TARGETING::PredicateCTM predChip(TARGETING::CLASS_CHIP);
TARGETING::PredicateCTM predDimm(TARGETING::CLASS_LOGICAL_CARD,
TARGETING::TYPE_DIMM);
+ TARGETING::PredicateCTM predOcmb(TARGETING::CLASS_CHIP,
+ TARGETING::TYPE_OCMB_CHIP);
TARGETING::PredicatePostfixExpr checkExpr;
TARGETING::PredicateHwas l_present;
// @todo-RTC:124553 - Additional logic for deconfigured Frus
@@ -2427,6 +2451,9 @@ void IPMIFRUINV::gatherSetData(const TARGETING::Target* i_pSys,
checkExpr.push(&predDimm).Or().push(&l_present).And();
}
+ // We do NOT want to process fruInv for OCMB_CHIP targets
+ checkExpr.push(&predOcmb).Not().And();
+
TARGETING::TargetHandleList pCheckPres;
TARGETING::targetService().getAssociated( pCheckPres, i_pSys,
TARGETING::TargetService::CHILD, TARGETING::TargetService::ALL,
OpenPOWER on IntegriCloud