summaryrefslogtreecommitdiffstats
path: root/extensions/openpower-pels/failing_mtms.hpp
diff options
context:
space:
mode:
authorMatt Spinler <spinler@us.ibm.com>2019-09-11 14:29:46 -0500
committerMatt Spinler <spinler@us.ibm.com>2019-09-27 14:26:15 -0500
commit09d6400fb70d5324c0ed026d1084fc51cb495216 (patch)
treed34884de1ee2a7474007ab06eb8e4bae898bae30 /extensions/openpower-pels/failing_mtms.hpp
parent1a94cc38fc2885eac2b7674cc75837debea26eb8 (diff)
downloadphosphor-logging-09d6400fb70d5324c0ed026d1084fc51cb495216.tar.gz
phosphor-logging-09d6400fb70d5324c0ed026d1084fc51cb495216.zip
PEL: Add FailingMTMS PEL section class
This PEL section contains the Machine Type-Model and Serial number of the enclosure and is required for BMC PELs. In the constructor that creates the section from scratch, it gets those values from the DataInterface class. This commit doesn't hook this section into the PEL class as there are some prerequisites that still need to be done first. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: I24d679b57751afb00539691defef180191ea8fc7
Diffstat (limited to 'extensions/openpower-pels/failing_mtms.hpp')
-rw-r--r--extensions/openpower-pels/failing_mtms.hpp102
1 files changed, 102 insertions, 0 deletions
diff --git a/extensions/openpower-pels/failing_mtms.hpp b/extensions/openpower-pels/failing_mtms.hpp
new file mode 100644
index 0000000..209eaa9
--- /dev/null
+++ b/extensions/openpower-pels/failing_mtms.hpp
@@ -0,0 +1,102 @@
+#pragma once
+
+#include "data_interface.hpp"
+#include "mtms.hpp"
+#include "section.hpp"
+#include "stream.hpp"
+
+namespace openpower
+{
+namespace pels
+{
+
+/**
+ * @class FailingMTMS
+ *
+ * This represents the Failing Enclosure MTMS section in a PEL.
+ * It is a required section. In the BMC case, the enclosure is
+ * the system enclosure.
+ */
+class FailingMTMS : public Section
+{
+ public:
+ FailingMTMS() = delete;
+ ~FailingMTMS() = default;
+ FailingMTMS(const FailingMTMS&) = default;
+ FailingMTMS& operator=(const FailingMTMS&) = default;
+ FailingMTMS(FailingMTMS&&) = default;
+ FailingMTMS& operator=(FailingMTMS&&) = default;
+
+ /**
+ * @brief Constructor
+ *
+ * @param[in] dataIface - The object to use to obtain
+ * the MTM and SN.
+ */
+ explicit FailingMTMS(const DataInterfaceBase& dataIface);
+
+ /**
+ * @brief Constructor
+ *
+ * Fills in this class's data fields from the stream.
+ *
+ * @param[in] pel - the PEL data stream
+ */
+ explicit FailingMTMS(Stream& pel);
+
+ /**
+ * @brief Flatten the section into the stream
+ *
+ * @param[in] stream - The stream to write to
+ */
+ void flatten(Stream& stream) override;
+
+ /**
+ * @brief Returns the size of this section when flattened into a PEL
+ *
+ * @return size_t - the size of the section
+ */
+ static constexpr size_t flattenedSize()
+ {
+ return Section::flattenedSize() + MTMS::flattenedSize();
+ }
+
+ /**
+ * @brief Returns the machine type+model as a string
+ *
+ * @return std::string the MTM
+ */
+ std::string getMachineTypeModel();
+
+ /**
+ * @brief Returns the machine serial number as a string
+ *
+ * @return std::string the serial number
+ */
+ std::string getMachineSerialNumber();
+
+ private:
+ /**
+ * @brief Validates the section contents
+ *
+ * Updates _valid (in Section) with the results.
+ */
+ void validate() override;
+
+ /**
+ * @brief Fills in the object from the stream data
+ *
+ * @param[in] stream - The stream to read from
+ */
+ void unflatten(Stream& stream);
+
+ /**
+ * @brief The structure that holds the TM and SN fields.
+ * This is also used in other places in the PEL.
+ */
+ MTMS _mtms;
+};
+
+} // namespace pels
+
+} // namespace openpower
OpenPOWER on IntegriCloud