Matt Spinler | 711d51d | 2019-11-06 09:36:51 -0600 | [diff] [blame] | 1 | /** |
| 2 | * Copyright © 2019 IBM Corporation |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
Matt Spinler | 8c686cc | 2019-09-20 13:46:02 -0500 | [diff] [blame] | 16 | #include "severity.hpp" |
| 17 | |
Matt Spinler | a7525aa | 2019-11-01 11:11:07 -0500 | [diff] [blame] | 18 | #include "pel_types.hpp" |
| 19 | |
Matt Spinler | 8c686cc | 2019-09-20 13:46:02 -0500 | [diff] [blame] | 20 | namespace openpower |
| 21 | { |
| 22 | namespace pels |
| 23 | { |
| 24 | |
| 25 | using LogSeverity = phosphor::logging::Entry::Level; |
| 26 | |
Matt Spinler | 8c686cc | 2019-09-20 13:46:02 -0500 | [diff] [blame] | 27 | uint8_t convertOBMCSeverityToPEL(LogSeverity severity) |
| 28 | { |
Matt Spinler | a7525aa | 2019-11-01 11:11:07 -0500 | [diff] [blame] | 29 | uint8_t pelSeverity = static_cast<uint8_t>(SeverityType::unrecoverable); |
Matt Spinler | 8c686cc | 2019-09-20 13:46:02 -0500 | [diff] [blame] | 30 | switch (severity) |
| 31 | { |
| 32 | case (LogSeverity::Notice): |
| 33 | case (LogSeverity::Informational): |
| 34 | case (LogSeverity::Debug): |
Matt Spinler | a7525aa | 2019-11-01 11:11:07 -0500 | [diff] [blame] | 35 | pelSeverity = static_cast<uint8_t>(SeverityType::nonError); |
Matt Spinler | 8c686cc | 2019-09-20 13:46:02 -0500 | [diff] [blame] | 36 | break; |
| 37 | |
| 38 | case (LogSeverity::Warning): |
Matt Spinler | a7525aa | 2019-11-01 11:11:07 -0500 | [diff] [blame] | 39 | pelSeverity = static_cast<uint8_t>(SeverityType::predictive); |
Matt Spinler | 8c686cc | 2019-09-20 13:46:02 -0500 | [diff] [blame] | 40 | break; |
| 41 | |
| 42 | case (LogSeverity::Critical): |
Matt Spinler | a7525aa | 2019-11-01 11:11:07 -0500 | [diff] [blame] | 43 | pelSeverity = static_cast<uint8_t>(SeverityType::critical); |
Matt Spinler | 8c686cc | 2019-09-20 13:46:02 -0500 | [diff] [blame] | 44 | break; |
| 45 | |
| 46 | case (LogSeverity::Emergency): |
| 47 | case (LogSeverity::Alert): |
| 48 | case (LogSeverity::Error): |
Matt Spinler | a7525aa | 2019-11-01 11:11:07 -0500 | [diff] [blame] | 49 | pelSeverity = static_cast<uint8_t>(SeverityType::unrecoverable); |
Matt Spinler | 8c686cc | 2019-09-20 13:46:02 -0500 | [diff] [blame] | 50 | break; |
| 51 | } |
| 52 | |
| 53 | return pelSeverity; |
| 54 | } |
| 55 | } // namespace pels |
| 56 | } // namespace openpower |