Jayanth Othayoth | 25e39c8 | 2021-07-12 01:00:17 -0500 | [diff] [blame] | 1 | #include "extensions/phal/common_utils.hpp" |
Jayanth Othayoth | 6552de0 | 2021-07-12 00:55:57 -0500 | [diff] [blame] | 2 | #include "extensions/phal/phal_error.hpp" |
Chirag Sharma | a257693 | 2020-12-05 23:17:41 -0600 | [diff] [blame] | 3 | #include "registration.hpp" |
| 4 | |
| 5 | #include <libekb.H> |
| 6 | |
| 7 | #include <phosphor-logging/log.hpp> |
| 8 | |
| 9 | namespace openpower |
| 10 | { |
| 11 | namespace phal |
| 12 | { |
| 13 | |
| 14 | using namespace phosphor::logging; |
| 15 | |
| 16 | void prePoweroff(void) |
| 17 | { |
| 18 | try |
| 19 | { |
| 20 | phal_init(); |
| 21 | } |
| 22 | catch (const std::exception& ex) |
| 23 | { |
| 24 | log<level::ERR>("Exception raised during init PHAL", |
| 25 | entry("EXCEPTION=%s", ex.what())); |
Jayanth Othayoth | 2b21170 | 2021-09-06 05:14:23 -0500 | [diff] [blame] | 26 | openpower::pel::detail::processBootError(false); |
Chirag Sharma | a257693 | 2020-12-05 23:17:41 -0600 | [diff] [blame] | 27 | // Dont throw exception on failure because, we need to proceed |
| 28 | // further eventhough there is failure for proc-pre-poweroff |
| 29 | return; |
| 30 | } |
| 31 | |
| 32 | // To clear trace if success |
Jayanth Othayoth | 2b21170 | 2021-09-06 05:14:23 -0500 | [diff] [blame] | 33 | openpower::pel::detail::processBootError(true); |
Chirag Sharma | a257693 | 2020-12-05 23:17:41 -0600 | [diff] [blame] | 34 | |
| 35 | // callback method will be called upon failure which will create the PEL |
| 36 | int rc = ipl_pre_poweroff(); |
| 37 | if (rc) |
| 38 | { |
| 39 | log<level::ERR>("pre_poweroff failed"); |
| 40 | // Dont throw exception on failure because, we need to proceed |
| 41 | // further eventhough there is failure for proc-pre-poweroff |
| 42 | return; |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | REGISTER_PROCEDURE("prePoweroff", prePoweroff) |
| 47 | |
| 48 | } // namespace phal |
| 49 | } // namespace openpower |