PEL: Move severity type enums to a header
Move them to a header file so other files can use them in the future.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: Icb604489e9629724a79d2fc8b110e461b6aa6e01
diff --git a/extensions/openpower-pels/pel_types.hpp b/extensions/openpower-pels/pel_types.hpp
index 9f801a3..d19c875 100644
--- a/extensions/openpower-pels/pel_types.hpp
+++ b/extensions/openpower-pels/pel_types.hpp
@@ -82,5 +82,20 @@
notApplicable = 0x00
};
+/**
+ * @brief The major types of severity values, based on the
+ * the left nibble of the severity value.
+ */
+enum class SeverityType
+{
+ nonError = 0x00,
+ recovered = 0x10,
+ predictive = 0x20,
+ unrecoverable = 0x40,
+ critical = 0x50,
+ diagnostic = 0x60,
+ symptom = 0x70
+};
+
} // namespace pels
} // namespace openpower
diff --git a/extensions/openpower-pels/severity.cpp b/extensions/openpower-pels/severity.cpp
index 1911c12..de02735 100644
--- a/extensions/openpower-pels/severity.cpp
+++ b/extensions/openpower-pels/severity.cpp
@@ -1,5 +1,7 @@
#include "severity.hpp"
+#include "pel_types.hpp"
+
namespace openpower
{
namespace pels
@@ -7,44 +9,29 @@
using LogSeverity = phosphor::logging::Entry::Level;
-/**
- * @brief The major types of severity values, based on the
- * the left nibble of the severity value.
- */
-enum class PELSeverityType : uint8_t
-{
- nonError = 0x00,
- recovered = 0x10,
- predictive = 0x20,
- unrecoverable = 0x40,
- critical = 0x50,
- diagnostic = 0x60,
- symptom = 0x70
-};
-
uint8_t convertOBMCSeverityToPEL(LogSeverity severity)
{
- uint8_t pelSeverity = static_cast<uint8_t>(PELSeverityType::unrecoverable);
+ uint8_t pelSeverity = static_cast<uint8_t>(SeverityType::unrecoverable);
switch (severity)
{
case (LogSeverity::Notice):
case (LogSeverity::Informational):
case (LogSeverity::Debug):
- pelSeverity = static_cast<uint8_t>(PELSeverityType::nonError);
+ pelSeverity = static_cast<uint8_t>(SeverityType::nonError);
break;
case (LogSeverity::Warning):
- pelSeverity = static_cast<uint8_t>(PELSeverityType::predictive);
+ pelSeverity = static_cast<uint8_t>(SeverityType::predictive);
break;
case (LogSeverity::Critical):
- pelSeverity = static_cast<uint8_t>(PELSeverityType::critical);
+ pelSeverity = static_cast<uint8_t>(SeverityType::critical);
break;
case (LogSeverity::Emergency):
case (LogSeverity::Alert):
case (LogSeverity::Error):
- pelSeverity = static_cast<uint8_t>(PELSeverityType::unrecoverable);
+ pelSeverity = static_cast<uint8_t>(SeverityType::unrecoverable);
break;
}