PEL: Create FRUIdentity with FRUs/procedures
Add constructors to the FRUIdentity structure in the SRC section to take
either a hardware callout with PN/SN/CCIN, or a maintenance procedure
callout with a maintenance procedure enum. Both of these also take
callout priority.
These will be used when creating PELs that have callouts.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I5071d98df38b63ba53224c3f3b853e57234ed74e
diff --git a/extensions/openpower-pels/fru_identity.hpp b/extensions/openpower-pels/fru_identity.hpp
index bf7b2f7..016f3fd 100644
--- a/extensions/openpower-pels/fru_identity.hpp
+++ b/extensions/openpower-pels/fru_identity.hpp
@@ -1,5 +1,6 @@
#pragma once
+#include "pel_types.hpp"
#include "stream.hpp"
#include <optional>
@@ -71,6 +72,28 @@
explicit FRUIdentity(Stream& pel);
/**
+ * Constructor
+ *
+ * Creates the object as a hardware callout with the part number,
+ * CCIN, and serial number fields supplied.
+ *
+ * @param[in] partNumber - The part number of the FRU
+ * @param[in] ccin - The CCIN of the FRU
+ * @param[in] serialNumber - The serial number of the FRU
+ */
+ FRUIdentity(const std::string& partNumber, const std::string& ccin,
+ const std::string& serialNumber);
+
+ /**
+ * @brief Constructor
+ *
+ * Creates the object with a maintenance procedure callout.
+ *
+ * @param[in] procedure - The procedure to use
+ */
+ FRUIdentity(MaintProcedure procedure);
+
+ /**
* @brief Flatten the object into the stream
*
* @param[in] stream - The stream to write to
@@ -85,6 +108,15 @@
size_t flattenedSize() const;
/**
+ * @brief Returns the type field
+ *
+ * @return uint16_t - The type, always 0x4944 "ID".
+ */
+ uint16_t type() const
+ {
+ return _type;
+ }
+ /**
* @brief The failing component type for this FRU callout.
*
* @return FailingComponentType
@@ -173,6 +205,35 @@
}
/**
+ * @brief Sets the 8 character null terminated part
+ * number field to the string passed in.
+ *
+ * @param[in] partNumber - The part number string.
+ */
+ void setPartNumber(const std::string& partNumber);
+
+ /**
+ * @brief Sets the 4 character CCIN field.
+ *
+ * @param[in] ccin - The CCIN string
+ */
+ void setCCIN(const std::string& ccin);
+
+ /**
+ * @brief Sets the 12 character serial number field.
+ *
+ * @param[in] serialNumber - The serial number string
+ */
+ void setSerialNumber(const std::string& serialNumber);
+
+ /**
+ * @brief Sets the 8 character null terminated procedure
+ * field. This is in the same field as the part
+ * number since they are mutually exclusive.
+ */
+ void setMaintenanceProcedure(MaintProcedure procedure);
+
+ /**
* @brief The callout substructure type field. Will be "ID".
*/
uint16_t _type;