Specify PEL callout priority and sort callouts.

Allow the priority to be passed in at creation time by calling the
CALLOUT_PRIORITY keyword. When creating a PEL, callouts will always
be sorted by priority instead of creation time, the order is as follows:
H,M,A,B,C,L.

Signed-off-by: Miguel Gomez <mgomez@mx1.ibm.com>
Change-Id: I84345aaf3fad7b2e4958b698ab761966f499986b
diff --git a/extensions/openpower-pels/callouts.cpp b/extensions/openpower-pels/callouts.cpp
index 2440621..885dda5 100644
--- a/extensions/openpower-pels/callouts.cpp
+++ b/extensions/openpower-pels/callouts.cpp
@@ -61,7 +61,19 @@
         using namespace phosphor::logging;
         log<level::INFO>("Dropping PEL callout because at max");
     }
+
+    // Mapping including the  3 Medium levels as A,B and C
+    const std::map<std::uint8_t, int> priorities = {
+        {'H', 10}, {'M', 9}, {'A', 8}, {'B', 7}, {'C', 6}, {'L', 5}};
+
+    auto sortPriority = [&priorities](const std::unique_ptr<Callout>& p1,
+                                      const std::unique_ptr<Callout>& p2) {
+        return priorities.at(p1->priority()) > priorities.at(p2->priority());
+    };
+
+    std::sort(_callouts.begin(), _callouts.end(), sortPriority);
 }
+
 } // namespace src
 } // namespace pels
-} // namespace openpower
+} // namespace openpower
\ No newline at end of file