Ben Tyner | bcf65a8 | 2020-12-01 08:46:36 -0600 | [diff] [blame] | 1 | #include <attn/attention.hpp> |
| 2 | #include <attn/attn_common.hpp> |
Ben Tyner | 7f6ce6a | 2021-08-17 19:40:00 -0500 | [diff] [blame] | 3 | #include <attn/attn_dump.hpp> |
Ben Tyner | bcf65a8 | 2020-12-01 08:46:36 -0600 | [diff] [blame] | 4 | #include <attn/attn_logging.hpp> |
| 5 | #include <sdbusplus/bus.hpp> |
Ben Tyner | 9306716 | 2021-07-23 10:39:30 -0500 | [diff] [blame] | 6 | #include <util/dbus.hpp> |
austinfcui | bfa831a | 2022-01-26 15:37:07 -0600 | [diff] [blame] | 7 | #include <util/trace.hpp> |
Ben Tyner | bcf65a8 | 2020-12-01 08:46:36 -0600 | [diff] [blame] | 8 | |
| 9 | namespace attn |
| 10 | { |
| 11 | |
| 12 | /** |
| 13 | * @brief Handle SBE vital attention |
| 14 | * |
| 15 | * @param i_attention Attention object |
| 16 | * @return 0 indicates that the vital attention was successfully handled |
| 17 | * 1 indicates that the vital attention was NOT successfully handled |
| 18 | */ |
| 19 | int handleVital(Attention* i_attention) |
| 20 | { |
| 21 | int rc = RC_SUCCESS; // assume vital handled |
| 22 | |
austinfcui | bfa831a | 2022-01-26 15:37:07 -0600 | [diff] [blame] | 23 | trace::inf("vital handler started"); |
Ben Tyner | bcf65a8 | 2020-12-01 08:46:36 -0600 | [diff] [blame] | 24 | |
| 25 | // if vital handling enabled, handle vital attention |
| 26 | if (false == (i_attention->getConfig()->getFlag(enVital))) |
| 27 | { |
austinfcui | bfa831a | 2022-01-26 15:37:07 -0600 | [diff] [blame] | 28 | trace::inf("vital handling disabled"); |
Ben Tyner | bcf65a8 | 2020-12-01 08:46:36 -0600 | [diff] [blame] | 29 | rc = RC_NOT_HANDLED; |
| 30 | } |
| 31 | else |
| 32 | { |
Ben Tyner | 3a80c98 | 2022-10-21 12:49:41 -0500 | [diff] [blame] | 33 | // wait for power fault handling before starting analyses |
| 34 | sleepSeconds(POWER_FAULT_WAIT); |
| 35 | |
Ben Tyner | bcf65a8 | 2020-12-01 08:46:36 -0600 | [diff] [blame] | 36 | // generate pel |
Ben Tyner | 7f6ce6a | 2021-08-17 19:40:00 -0500 | [diff] [blame] | 37 | auto pelId = eventVital(); |
| 38 | |
| 39 | // conditionally request dump |
| 40 | if ((0 != pelId) && (util::dbus::HostRunningState::NotStarted == |
| 41 | util::dbus::hostRunningState())) |
| 42 | { |
Zane Shelley | 611b344 | 2021-11-19 16:02:01 -0600 | [diff] [blame] | 43 | requestDump(pelId, DumpParameters{0, DumpType::SBE}); |
Ben Tyner | 7f6ce6a | 2021-08-17 19:40:00 -0500 | [diff] [blame] | 44 | } |
| 45 | |
| 46 | // transition host |
| 47 | util::dbus::transitionHost(util::dbus::HostState::Quiesce); |
Ben Tyner | bcf65a8 | 2020-12-01 08:46:36 -0600 | [diff] [blame] | 48 | } |
| 49 | |
| 50 | return rc; |
| 51 | } |
| 52 | |
| 53 | } // namespace attn |