From f1e85e20a1a6e97e27737b5883a8aa6a63c79b22 Mon Sep 17 00:00:00 2001 From: Matt Spinler Date: Fri, 1 Nov 2019 11:31:31 -0500 Subject: PEL: Validate the Action Flags field According to the PEL spec, the Action Flags and Event Type fields in the User Header section must be in agreement with the Severity field. So, when a PEL is being created from an OpenBMC event log, check those values for correctness and fix them up if required. In addition, as those fields are optional in the message registry, this code will also just set these two fields to valid values if they were left out. The rules being followed are documented in the PEL readme. Signed-off-by: Matt Spinler Change-Id: Iad88de5080ba79a9ff31f962ef99bfc11994b9ed --- extensions/openpower-pels/pel_rules.hpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 extensions/openpower-pels/pel_rules.hpp (limited to 'extensions/openpower-pels/pel_rules.hpp') diff --git a/extensions/openpower-pels/pel_rules.hpp b/extensions/openpower-pels/pel_rules.hpp new file mode 100644 index 0000000..ca05875 --- /dev/null +++ b/extensions/openpower-pels/pel_rules.hpp @@ -0,0 +1,32 @@ +#pragma once + +#include +#include + +namespace openpower +{ +namespace pels +{ +namespace pel_rules +{ + +/** + * @brief Ensure certain PEL fields are in agreement, and fix them if they + * aren't. These rules are documented in the README.md in this + * directory. + * + * Note: The message registry schema enforces that there are no undefined + * bits set in these fields. + * + * @param[in] actionFlags - The current Action Flags value + * @param[in] eventType - The current Event Type value + * @param[in] severity - The current Severity value + * + * @return std::tuple - The corrected values. + */ +std::tuple check(uint16_t actionFlags, uint8_t eventType, + uint8_t severity); + +} // namespace pel_rules +} // namespace pels +} // namespace openpower -- cgit v1.2.1