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
diff --git a/extensions/openpower-pels/pce_identity.cpp b/extensions/openpower-pels/pce_identity.cpp
new file mode 100644
index 0000000..12b21ae
--- /dev/null
+++ b/extensions/openpower-pels/pce_identity.cpp
@@ -0,0 +1,33 @@
+#include "pce_identity.hpp"
+
+namespace openpower
+{
+namespace pels
+{
+namespace src
+{
+
+PCEIdentity::PCEIdentity(Stream& pel)
+{
+    pel >> _type >> _size >> _flags >> _mtms;
+
+    // Whatever is left is the enclosure name.
+    if (_size < (4 + _mtms.flattenedSize()))
+    {
+        throw std::runtime_error("PCE identity structure size field too small");
+    }
+
+    size_t pceNameSize = _size - (4 + _mtms.flattenedSize());
+
+    _pceName.resize(pceNameSize);
+    pel >> _pceName;
+}
+
+void PCEIdentity::flatten(Stream& pel)
+{
+    pel << _type << _size << _flags << _mtms << _pceName;
+}
+
+} // namespace src
+} // namespace pels
+} // namespace openpower