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 | bcf65a8 | 2020-12-01 08:46:36 -0600 | [diff] [blame] | 33 | // generate pel |
Ben Tyner | 7f6ce6a | 2021-08-17 19:40:00 -0500 | [diff] [blame] | 34 | auto pelId = eventVital(); |
| 35 | |
| 36 | // conditionally request dump |
| 37 | if ((0 != pelId) && (util::dbus::HostRunningState::NotStarted == |
| 38 | util::dbus::hostRunningState())) |
| 39 | { |
Zane Shelley | 611b344 | 2021-11-19 16:02:01 -0600 | [diff] [blame] | 40 | requestDump(pelId, DumpParameters{0, DumpType::SBE}); |
Ben Tyner | 7f6ce6a | 2021-08-17 19:40:00 -0500 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | // transition host |
| 44 | util::dbus::transitionHost(util::dbus::HostState::Quiesce); |
Ben Tyner | bcf65a8 | 2020-12-01 08:46:36 -0600 | [diff] [blame] | 45 | } |
| 46 | |
| 47 | return rc; |
| 48 | } |
| 49 | |
| 50 | } // namespace attn |