18c686ccaSMatt Spinler #pragma once
28c686ccaSMatt Spinler 
38c686ccaSMatt Spinler #include "elog_entry.hpp"
4*8b81ec0eSMatt Spinler #include "pel_types.hpp"
5*8b81ec0eSMatt Spinler 
6*8b81ec0eSMatt 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 
22*8b81ec0eSMatt Spinler /**
23*8b81ec0eSMatt Spinler  * @brief Possibly calculate a new LogSeverity value based on the
24*8b81ec0eSMatt Spinler  *        current LogSeverity and PEL severity.
25*8b81ec0eSMatt Spinler  *
26*8b81ec0eSMatt Spinler  * Just handles cases where the LogSeverity value is clearly out of
27*8b81ec0eSMatt Spinler  * sync with the PEL severity:
28*8b81ec0eSMatt Spinler  * - critical PEL but non critical LogSeverity
29*8b81ec0eSMatt Spinler  * - info PEL but non info LogSeverity
30*8b81ec0eSMatt Spinler  * - non info PEL but info LogSeverity
31*8b81ec0eSMatt Spinler  *
32*8b81ec0eSMatt Spinler  * @param[in] obmcSeverity - The current LogSeverity
33*8b81ec0eSMatt Spinler  * @param[in] pelSeverity - The PEL severity
34*8b81ec0eSMatt Spinler  *
35*8b81ec0eSMatt Spinler  * @return optional<LogSeverity> The new LogSeverity to use if one was
36*8b81ec0eSMatt Spinler  *         found, otherwise std::nullopt which means the original one
37*8b81ec0eSMatt Spinler  *         is good enough.
38*8b81ec0eSMatt Spinler  */
39*8b81ec0eSMatt Spinler std::optional<phosphor::logging::Entry::Level>
40*8b81ec0eSMatt Spinler     fixupLogSeverity(phosphor::logging::Entry::Level obmcSeverity,
41*8b81ec0eSMatt Spinler                      SeverityType pelSeverity);
428c686ccaSMatt Spinler } // namespace pels
438c686ccaSMatt Spinler } // namespace openpower
44