18c686ccaSMatt Spinler #pragma once
28c686ccaSMatt Spinler 
38c686ccaSMatt Spinler #include "elog_entry.hpp"
48b81ec0eSMatt Spinler #include "pel_types.hpp"
58b81ec0eSMatt Spinler 
68b81ec0eSMatt Spinler #include <optional>
78c686ccaSMatt Spinler 
88c686ccaSMatt Spinler namespace openpower
98c686ccaSMatt Spinler {
108c686ccaSMatt Spinler namespace pels
118c686ccaSMatt Spinler {
128c686ccaSMatt Spinler 
138c686ccaSMatt Spinler /**
148c686ccaSMatt Spinler  * @brief Convert an OpenBMC event log severity to a PEL severity
158c686ccaSMatt Spinler  *
168c686ccaSMatt Spinler  * @param[in] severity - The OpenBMC event log severity
178c686ccaSMatt Spinler  *
188c686ccaSMatt Spinler  * @return uint8_t - The PEL severity value
198c686ccaSMatt Spinler  */
208c686ccaSMatt Spinler uint8_t convertOBMCSeverityToPEL(phosphor::logging::Entry::Level severity);
218c686ccaSMatt Spinler 
228b81ec0eSMatt Spinler /**
238b81ec0eSMatt Spinler  * @brief Possibly calculate a new LogSeverity value based on the
248b81ec0eSMatt Spinler  *        current LogSeverity and PEL severity.
258b81ec0eSMatt Spinler  *
268b81ec0eSMatt Spinler  * Just handles cases where the LogSeverity value is clearly out of
278b81ec0eSMatt Spinler  * sync with the PEL severity:
288b81ec0eSMatt Spinler  * - critical PEL but non critical LogSeverity
298b81ec0eSMatt Spinler  * - info PEL but non info LogSeverity
308b81ec0eSMatt Spinler  * - non info PEL but info LogSeverity
318b81ec0eSMatt Spinler  *
328b81ec0eSMatt Spinler  * @param[in] obmcSeverity - The current LogSeverity
338b81ec0eSMatt Spinler  * @param[in] pelSeverity - The PEL severity
348b81ec0eSMatt Spinler  *
358b81ec0eSMatt Spinler  * @return optional<LogSeverity> The new LogSeverity to use if one was
368b81ec0eSMatt Spinler  *         found, otherwise std::nullopt which means the original one
378b81ec0eSMatt Spinler  *         is good enough.
388b81ec0eSMatt Spinler  */
39*075c7923SPatrick Williams std::optional<phosphor::logging::Entry::Level> fixupLogSeverity(
40*075c7923SPatrick Williams     phosphor::logging::Entry::Level obmcSeverity, SeverityType pelSeverity);
418c686ccaSMatt Spinler } // namespace pels
428c686ccaSMatt Spinler } // namespace openpower
43