diff options
author | Matt Spinler <spinler@us.ibm.com> | 2019-08-27 13:56:05 -0500 |
---|---|---|
committer | Matt Spinler <spinler@us.ibm.com> | 2019-10-01 12:52:33 -0500 |
commit | 835a86938f3cf59fbdcd25835b48e6cdb1e6552b (patch) | |
tree | eca6865e34aa490abfe231b72c8b7f2492a88908 /extensions/openpower-pels/pel_values.hpp | |
parent | 09d6400fb70d5324c0ed026d1084fc51cb495216 (diff) | |
download | phosphor-logging-835a86938f3cf59fbdcd25835b48e6cdb1e6552b.tar.gz phosphor-logging-835a86938f3cf59fbdcd25835b48e6cdb1e6552b.zip |
PEL: Support for going between PELs & registry
Add tables that allow one to go between how a PEL field actually shows
up in the PEL (raw bytes) and how it shows up in the message registry (a
string enumeration). The tables also have a column to show a string
description of that value that can be used by the parser, though for now
those descriptions are all left at "TODO".
There only needs to be a table for a PEL field when there is a
corresponding message registry field that is a string enumeration, so
that when code looks up an error in the message registry it knows what
to fill in the PEL with.
Also provide APIs to look up a row in the table by either the PEL value
or the message registry value.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: Iac849bcd2b0449a8d03fac7eb067484e91d28259
Diffstat (limited to 'extensions/openpower-pels/pel_values.hpp')
-rw-r--r-- | extensions/openpower-pels/pel_values.hpp | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/extensions/openpower-pels/pel_values.hpp b/extensions/openpower-pels/pel_values.hpp new file mode 100644 index 0000000..6092f62 --- /dev/null +++ b/extensions/openpower-pels/pel_values.hpp @@ -0,0 +1,81 @@ +#pragma once + +#include <string> +#include <tuple> +#include <vector> + +namespace openpower +{ +namespace pels +{ +namespace pel_values +{ + +// The actual value as it shows up in the PEL +const int fieldValuePos = 0; + +// The name of the value as specified in the message registry +const int registryNamePos = 1; + +// The description of the field, used by PEL parsers +const int descriptionPos = 2; + +using PELFieldValue = std::tuple<uint32_t, const char*, const char*>; +using PELValues = std::vector<PELFieldValue>; + +/** + * @brief Find the desired entry in a PELValues table based on the + * field value. + * + * @param[in] value - the PEL value to find + * @param[in] fields - the PEL values table to use + * + * @return PELValues::const_iterator - an iterator to the table entry + */ +PELValues::const_iterator findByValue(uint32_t value, const PELValues& fields); + +/** + * @brief Find the desired entry in a PELValues table based on the + * field message registry name. + * + * @param[in] name - the PEL message registry enum name + * @param[in] fields - the PEL values table to use + * + * @return PELValues::const_iterator - an iterator to the table entry + */ +PELValues::const_iterator findByName(const std::string& name, + const PELValues& fields); + +/** + * @brief The values for the 'subsystem' field in the User Header + */ +extern const PELValues subsystemValues; + +/** + * @brief The values for the 'severity' field in the User Header + */ +extern const PELValues severityValues; + +/** + * @brief The values for the 'Event Type' field in the User Header + */ +extern const PELValues eventTypeValues; + +/** + * @brief The values for the 'Event Scope' field in the User Header + */ +extern const PELValues eventScopeValues; + +/** + * @brief The values for the 'Action Flags' field in the User Header + */ +extern const PELValues actionFlagsValues; + +/** + * @brief The values for callout priorities in the SRC section + */ +extern const PELValues calloutPriorityValues; + +} // namespace pel_values +} // namespace pels +} // namespace openpower |