summaryrefslogtreecommitdiffstats
path: root/extensions/openpower-pels/pce_identity.hpp
diff options
context:
space:
mode:
authorMatt Spinler <spinler@us.ibm.com>2019-10-08 14:13:31 -0500
committerMatt Spinler <spinler@us.ibm.com>2019-10-22 14:09:56 +0000
commit5b3a11db9c1f9715cc6371ecdcaa6bc54343ecc0 (patch)
tree5bcf71cb6f215c3c1568f475dbad6ed9b21500a9 /extensions/openpower-pels/pce_identity.hpp
parentced1a2185f3d38ab153cb4050dd074dcdc6a478d (diff)
downloadphosphor-logging-5b3a11db9c1f9715cc6371ecdcaa6bc54343ecc0.tar.gz
phosphor-logging-5b3a11db9c1f9715cc6371ecdcaa6bc54343ecc0.zip
PEL: Power controlling enc SRC substructure
This substructure is part of the callout subsection in the SRC section of a PEL, and contains enclosure information for when another enclosure controls the power of the failing entity. This would be an unusual case, when the piece of hardware that is being called out has its power controlled by another enclosure, for example when an I/O expansion drawer is connected to 2 servers, and only one of them controls its power. This includes: * The enclosure's name * The enclosure's machine type, model, and serial number The BMC will never create this section for BMC errors, but it may need to unflatten them for PELs sent down from a host that has to deal with I/O drawers. Signed-off-by: Matt Spinler <spinler@us.ibm.com> Change-Id: Ie04c1ee3fdfa67ee8666c10fa3bc837f4d33a9ef
Diffstat (limited to 'extensions/openpower-pels/pce_identity.hpp')
-rw-r--r--extensions/openpower-pels/pce_identity.hpp125
1 files changed, 125 insertions, 0 deletions
diff --git a/extensions/openpower-pels/pce_identity.hpp b/extensions/openpower-pels/pce_identity.hpp
new file mode 100644
index 0000000..4503764
--- /dev/null
+++ b/extensions/openpower-pels/pce_identity.hpp
@@ -0,0 +1,125 @@
+#pragma once
+
+#include "mtms.hpp"
+#include "stream.hpp"
+
+namespace openpower
+{
+namespace pels
+{
+namespace src
+{
+
+/**
+ * @class PCEIdentity
+ *
+ * This represents the PCE (Power Controlling Enclosure) Identity
+ * substructure in the callout subsection of the SRC PEL section.
+ *
+ * It contains the name and machine type/model/SN of that enclosure.
+ *
+ * It is only used for errors in an I/O drawer where another enclosure
+ * may control its power. It is not used in BMC errors and so will
+ * never be created by the BMC, but only unflattened in errors it
+ * receives from the host.
+ */
+class PCEIdentity
+{
+ public:
+ PCEIdentity() = delete;
+ ~PCEIdentity() = default;
+ PCEIdentity(const PCEIdentity&) = default;
+ PCEIdentity& operator=(const PCEIdentity&) = default;
+ PCEIdentity(PCEIdentity&&) = default;
+ PCEIdentity& operator=(PCEIdentity&&) = default;
+
+ /**
+ * @brief Constructor
+ *
+ * Fills in this class's data fields from the stream.
+ *
+ * @param[in] pel - the PEL data stream
+ */
+ explicit PCEIdentity(Stream& pel);
+
+ /**
+ * @brief Flatten the object into the stream
+ *
+ * @param[in] stream - The stream to write to
+ */
+ void flatten(Stream& pel);
+
+ /**
+ * @brief Returns the size of this structure when flattened into a PEL
+ *
+ * @return size_t - The size of the structure
+ */
+ size_t flattenedSize()
+ {
+ return _size;
+ }
+
+ /**
+ * @brief The type identifier value of this structure.
+ */
+ static const uint16_t substructureType = 0x5045; // "PE"
+
+ /**
+ * @brief Returns the enclosure name
+ *
+ * @return std::string - The enclosure name
+ */
+ std::string enclosureName() const
+ {
+ // _pceName is NULL terminated
+ std::string name{static_cast<const char*>(_pceName.data())};
+ return name;
+ }
+
+ /**
+ * @brief Returns the MTMS sub structure
+ *
+ * @return const MTMS& - The machine type/model/SN structure.
+ */
+ const MTMS& mtms() const
+ {
+ return _mtms;
+ }
+
+ private:
+ /**
+ * @brief The callout substructure type field. Will be 'PE'.
+ */
+ uint16_t _type;
+
+ /**
+ * @brief The size of this callout structure.
+ *
+ * Always a multiple of 4.
+ */
+ uint8_t _size;
+
+ /**
+ * @brief The flags byte of this substructure.
+ *
+ * Always 0 for this structure.
+ */
+ uint8_t _flags;
+
+ /**
+ * @brief The structure that holds the power controlling enclosure's
+ * machine type, model, and serial number.
+ */
+ MTMS _mtms;
+
+ /**
+ * @brief The name of the power controlling enclosure.
+ *
+ * Null terminated and padded with NULLs to a 4 byte boundary.
+ */
+ std::vector<char> _pceName;
+};
+
+} // namespace src
+} // namespace pels
+} // namespace openpower
OpenPOWER on IntegriCloud