summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatt Ploetz <maploetz@us.ibm.com>2017-03-23 12:30:26 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2017-05-02 11:23:32 -0400
commit3d0fd427668ae9418f50d1432cceee3c95e794d6 (patch)
tree2a74367a05299ea1c8f7095c3820fdad9d09312b /src
parent56a7aab1b97625940c62f06ba83a6359f25653b7 (diff)
downloadtalos-hostboot-3d0fd427668ae9418f50d1432cceee3c95e794d6.tar.gz
talos-hostboot-3d0fd427668ae9418f50d1432cceee3c95e794d6.zip
Support manufacturing date VPD in IPMI fru inventory
Change-Id: Iab5d8d5fdc0a9c361de9f28348719c36fcddb827 RTC: 158892 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/38365 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Reviewed-by: Prachi Gupta <pragupta@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src')
-rw-r--r--src/include/usr/ipmi/ipmi_reasoncodes.H2
-rw-r--r--src/include/usr/vpd/cvpdenums.H1
-rw-r--r--src/include/usr/vpd/pvpdenums.H3
-rw-r--r--src/usr/ipmi/ipmifruinv.C152
-rw-r--r--src/usr/ipmi/ipmifruinvprvt.H20
-rw-r--r--src/usr/vpd/cvpd.H1
-rw-r--r--src/usr/vpd/pvpd.H3
7 files changed, 169 insertions, 13 deletions
diff --git a/src/include/usr/ipmi/ipmi_reasoncodes.H b/src/include/usr/ipmi/ipmi_reasoncodes.H
index 3fe746170..f4f08cf65 100644
--- a/src/include/usr/ipmi/ipmi_reasoncodes.H
+++ b/src/include/usr/ipmi/ipmi_reasoncodes.H
@@ -38,6 +38,7 @@ namespace IPMI
MOD_IPMIDCMI = 0x04, // IPMI::sensor
MOD_IPMIRT = 0x05, // rt IPMI::send/IPMI::sendrecv
MOD_IPMISRV_POSTEVENT = 0x06, // IpmiRP::postEvent
+ MOD_IPMIFRU_INV = 0x07, // IPMI:fruInventory
};
enum IPMIReasonCode
@@ -55,6 +56,7 @@ namespace IPMI
RC_SENSOR_READING_NOT_AVAIL = IPMI_COMP_ID | 0x0b,
RC_GET_SENSOR_TYPE_CMD_FAILED = IPMI_COMP_ID | 0x0c,
RC_SENSOR_NOT_FOUND = IPMI_COMP_ID | 0x0d,
+ RC_INVALID_VPD_DATA = IPMI_COMP_ID | 0x0e,
};
};
diff --git a/src/include/usr/vpd/cvpdenums.H b/src/include/usr/vpd/cvpdenums.H
index 5af38dd2a..04d89b1bb 100644
--- a/src/include/usr/vpd/cvpdenums.H
+++ b/src/include/usr/vpd/cvpdenums.H
@@ -131,6 +131,7 @@ namespace CVPD
pd6 = 0x44, //#6
pd8 = 0x45, //#8
pdY = 0x46, //#Y
+ MB = 0x47,
// Last Keyword
CVPD_LAST_KEYWORD,
diff --git a/src/include/usr/vpd/pvpdenums.H b/src/include/usr/vpd/pvpdenums.H
index 6bf004107..28fddb376 100644
--- a/src/include/usr/vpd/pvpdenums.H
+++ b/src/include/usr/vpd/pvpdenums.H
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2013,2016 */
+/* Contributors Listed Below - COPYRIGHT 2013,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -82,6 +82,7 @@ namespace PVPD
VS = 0x16,
VZ = 0x17,
LX = 0x18,
+ MB = 0x19,
// Last Keyword
PVPD_LAST_KEYWORD,
diff --git a/src/usr/ipmi/ipmifruinv.C b/src/usr/ipmi/ipmifruinv.C
index ab25c8c50..a2e3a5eba 100644
--- a/src/usr/ipmi/ipmifruinv.C
+++ b/src/usr/ipmi/ipmifruinv.C
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2014,2016 */
+/* Contributors Listed Below - COPYRIGHT 2014,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -39,7 +39,7 @@
#include <stdio.h>
#include <assert.h>
#include <pnor/pnorif.H>
-
+#include <ipmi/ipmi_reasoncodes.H>
extern trace_desc_t * g_trac_ipmi;
/**
@@ -378,6 +378,131 @@ void IpmiFruInv::setAreaSize(std::vector<uint8_t> &io_data, uint8_t i_offset)
return;
}
+// Function to compute the correct data for the Mfg date/time section.
+// IPMI expects the time to be in seconds from 01/01/1996.
+errlHndl_t IpmiFruInv::formatMfgData(std::vector<uint8_t> i_mfgDateData,
+ uint32_t& o_mfgDate)
+{
+ 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)
+ {
+ /*@
+ * @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 );
+
+ }
+ else
+ {
+ // Convert Centuries / Years / months / day / hour / minute / second
+ // into a uint64 representing number of minute since 1/1/96
+
+ // The vpd data is expected to be in this format VVCCYYmmDDHHMMSS
+ uint8_t century = i_mfgDateData.at(1);
+ uint8_t year = i_mfgDateData.at(2);
+ uint8_t month = i_mfgDateData.at(3);
+ uint8_t day = i_mfgDateData.at(4);
+ uint8_t hour = i_mfgDateData.at(5);
+ uint8_t minute = i_mfgDateData.at(6);
+
+ // Subtract year
+ uint8_t numOfYears = (century*100 + year) - 1996;
+ // Subtract month
+ uint8_t numOfMonths = month - 1;
+ // Subtract day
+ uint8_t numOfDays = day - 1;
+
+ // Convert into minutes
+
+ // TODO: RTC 172125
+ // At some point we should take into account leap year and specific
+ // days in a month.
+ o_mfgDate = ((((numOfYears*365)*24)*60) +
+ (((numOfMonths*30.42)*24)*60) + ((numOfDays*24)*60) +
+ (hour*60) + minute);
+
+ }
+
+ return l_errl;
+}
+
+// Function to set the data for the Mfg date/time section.
+void IpmiFruInv::setMfgData(std::vector<uint8_t> &io_data,
+ std::vector<uint8_t> &mfgDateData)
+{
+ errlHndl_t l_errl = NULL;
+ uint32_t mfgDate = 0;
+
+ // Pass mfgDateData vector to format function to get the minute integer
+ l_errl = formatMfgData(mfgDateData, mfgDate);
+ if (l_errl)
+ {
+ // MFG date isn't entierly necessary. Let's just delete and
+ // continue.
+ TRACFCOMP(g_trac_ipmi,"backplaneIpmiFruInv::buildBoardInfoArea - "
+ "Error from formatMfgData. Using default MFG Date/Time.");
+ io_data.push_back(0);
+ io_data.push_back(0);
+ io_data.push_back(0);
+ delete l_errl;
+ }
+ else
+ {
+ if(((mfgDate & 0xFF000000) >> 24) != 0)
+ {
+ // If there is data in these bits, we have exceeded the
+ // maximum time we can display (IPMI only takes in 3 bytes
+ // of hex, FFFFFF)
+ TRACFCOMP(g_trac_ipmi,"backplaneIpmiFruInv::buildBoardInfoArea "
+ "- Exeeded maximum allowed build date to display. Using "
+ "default MFG Date/Time.");
+ io_data.push_back(0);
+ io_data.push_back(0);
+ io_data.push_back(0);
+ }
+ else
+ {
+ // Convert mfgDate to hex
+ uint8_t l_leastSig = (mfgDate & 0x000000FF);
+ uint8_t l_middleSig = (mfgDate & 0x0000FF00) >> 8;
+ uint8_t l_mostSig = (mfgDate & 0x00FF0000) >> 16;
+
+ // Push data into io_data - least significant byte first
+ io_data.push_back(l_leastSig);
+ io_data.push_back(l_middleSig);
+ io_data.push_back(l_mostSig);
+ }
+ }
+}
+
+
//##############################################################################
isdimmIpmiFruInv::isdimmIpmiFruInv( TARGETING::TargetHandle_t i_target )
:IpmiFruInv(i_target)
@@ -752,11 +877,14 @@ errlHndl_t backplaneIpmiFruInv::buildBoardInfoArea(
//Set formatting data that goes at the beginning of the record
preFormatProcessing(io_data, true);
- //Set MFG Date/Time - Blank
- io_data.push_back(0);
- io_data.push_back(0);
- io_data.push_back(0);
+ // Set Mfg Build date
+ // Grab VPD data into seperate data vector
+ std::vector<uint8_t> mfgDateData;
+ l_errl = addVpdData(mfgDateData, PVPD::OPFR, PVPD::MB, false, false);
+ if (l_errl) { break; }
+ // Pass that to the function that sets the Build date
+ setMfgData(io_data, mfgDateData);
//Set Vendor Name - ascii formatted data
l_errl = addVpdData(io_data, PVPD::OPFR, PVPD::VN, true);
@@ -1075,10 +1203,14 @@ errlHndl_t membufIpmiFruInv::buildBoardInfoArea(
//Set formatting data that goes at the beginning of the record
preFormatProcessing(io_data, true);
- //Set MFG Date/Time - Blank
- io_data.push_back(0);
- io_data.push_back(0);
- io_data.push_back(0);
+ // Set Mfg Build date
+ // Grab VPD data into seperate data vector
+ std::vector<uint8_t> mfgDateData;
+ l_errl = addVpdData(mfgDateData, PVPD::OPFR, PVPD::MB, false, false);
+ if (l_errl) { break; }
+
+ // Pass that to the function that sets the Build date
+ setMfgData(io_data, mfgDateData);
uint8_t l_fru_id = 0xFF;
// if the centaur_ecid_fru_id is not valid then the centaur is on a
diff --git a/src/usr/ipmi/ipmifruinvprvt.H b/src/usr/ipmi/ipmifruinvprvt.H
index 0075d9094..a2a15585a 100644
--- a/src/usr/ipmi/ipmifruinvprvt.H
+++ b/src/usr/ipmi/ipmifruinvprvt.H
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2014,2016 */
+/* Contributors Listed Below - COPYRIGHT 2014,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -134,6 +134,24 @@ class IpmiFruInv
void addDataToRecord(const std::vector<uint8_t>& i_data);
/**
+ * @brief Format inpuuted data to hex data that contains build date info
+ *
+ * @param[in] mfgDateData, MFG date data container from VPD
+ * @param[out] mfgDate, MFG date data value in minutes
+ */
+ errlHndl_t formatMfgData(std::vector<uint8_t> i_mfgDateData,
+ uint32_t& o_mfgDate);
+
+ /**
+ * @brief Add product build date to IPMI fru record
+ *
+ * @param[in/out] data, The container to put build date in
+ * @param[in] mfgDateData, MFG date data container from VPD
+ */
+ void setMfgData(std::vector<uint8_t> &io_data,
+ std::vector<uint8_t> &i_mfgDateData);
+
+ /**
* @brief Builds the Internal Use Area Data Section
* @param[in/out] data, The container to put intenral use area data in
*/
diff --git a/src/usr/vpd/cvpd.H b/src/usr/vpd/cvpd.H
index a2fd58011..e5eec6f6e 100644
--- a/src/usr/vpd/cvpd.H
+++ b/src/usr/vpd/cvpd.H
@@ -168,6 +168,7 @@ namespace CVPD
{ pd6, "#6" },
{ pd8, "#8" },
{ pdY, "#Y" },
+ { MB, "MB" },
// -------------------------------------------------------------------
// DO NOT USE!! This is for test purposes ONLY!
diff --git a/src/usr/vpd/pvpd.H b/src/usr/vpd/pvpd.H
index 32679507a..71d90d084 100644
--- a/src/usr/vpd/pvpd.H
+++ b/src/usr/vpd/pvpd.H
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2013,2016 */
+/* Contributors Listed Below - COPYRIGHT 2013,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -104,6 +104,7 @@ namespace PVPD
{ VS, "VS" },
{ VZ, "VZ" },
{ LX, "LX" },
+ { MB, "MB" },
// -------------------------------------------------------------------
// DO NOT USE!! This is for test purposes ONLY!
OpenPOWER on IntegriCloud