summaryrefslogtreecommitdiffstats
path: root/extensions/openpower-pels/callouts.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/openpower-pels/callouts.hpp')
-rw-r--r--extensions/openpower-pels/callouts.hpp96
1 files changed, 96 insertions, 0 deletions
diff --git a/extensions/openpower-pels/callouts.hpp b/extensions/openpower-pels/callouts.hpp
new file mode 100644
index 0000000..9226a1b
--- /dev/null
+++ b/extensions/openpower-pels/callouts.hpp
@@ -0,0 +1,96 @@
+#pragma once
+
+#include "callout.hpp"
+#include "stream.hpp"
+
+namespace openpower
+{
+namespace pels
+{
+namespace src
+{
+
+/**
+ * @class Callouts
+ *
+ * This is an optional subsection of the SRC section in a PEL
+ * that holds callouts (represented as Callout objects).
+ * It is at the end of the SRC section, and there can only be one
+ * of these present in the SRC.
+ *
+ * If an SRC doesn't have any callouts, this object won't be created.
+ */
+class Callouts
+{
+ public:
+ Callouts() = default;
+ ~Callouts() = default;
+ Callouts(const Callouts&) = delete;
+ Callouts& operator=(const Callouts&) = delete;
+ Callouts(Callouts&&) = delete;
+ Callouts& operator=(Callouts&&) = delete;
+
+ /**
+ * @brief Constructor
+ *
+ * Fills in this class's data fields from the stream.
+ *
+ * @param[in] pel - the PEL data stream
+ */
+ explicit Callouts(Stream& pel);
+
+ /**
+ * @brief Flatten the object into the stream
+ *
+ * @param[in] stream - The stream to write to
+ */
+ void flatten(Stream& pel) const;
+
+ /**
+ * @brief Returns the size of this object when flattened into a PEL
+ *
+ * @return size_t - The size of the section
+ */
+ size_t flattenedSize()
+ {
+ return _subsectionWordLength * 4;
+ }
+
+ /**
+ * @brief Returns the contained callouts
+ *
+ * @return const std::vector<std::unique_ptr<Callout>>&
+ */
+ const std::vector<std::unique_ptr<Callout>>& callouts() const
+ {
+ return _callouts;
+ }
+
+ private:
+ /**
+ * @brief The ID of this subsection, which is 0xC0.
+ */
+ uint8_t _subsectionID;
+
+ /**
+ * @brief Subsection flags. Always 0.
+ */
+ uint8_t _subsectionFlags;
+
+ /**
+ * @brief Subsection length in 4B words.
+ *
+ * (Subsection is always a multiple of 4B)
+ */
+ uint16_t _subsectionWordLength;
+
+ /**
+ * @brief The contained callouts
+ */
+ std::vector<std::unique_ptr<Callout>> _callouts;
+};
+
+} // namespace src
+
+} // namespace pels
+} // namespace openpower
OpenPOWER on IntegriCloud