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> |
Ben Tyner | bcf65a8 | 2020-12-01 08:46:36 -0600 | [diff] [blame] | 7 | |
| 8 | namespace attn |
| 9 | { |
| 10 | |
| 11 | /** |
| 12 | * @brief Handle SBE vital attention |
| 13 | * |
| 14 | * @param i_attention Attention object |
| 15 | * @return 0 indicates that the vital attention was successfully handled |
| 16 | * 1 indicates that the vital attention was NOT successfully handled |
| 17 | */ |
| 18 | int handleVital(Attention* i_attention) |
| 19 | { |
| 20 | int rc = RC_SUCCESS; // assume vital handled |
| 21 | |
| 22 | trace<level::INFO>("vital handler started"); |
| 23 | |
| 24 | // if vital handling enabled, handle vital attention |
| 25 | if (false == (i_attention->getConfig()->getFlag(enVital))) |
| 26 | { |
| 27 | trace<level::INFO>("vital handling disabled"); |
| 28 | rc = RC_NOT_HANDLED; |
| 29 | } |
| 30 | else |
| 31 | { |
Ben Tyner | bcf65a8 | 2020-12-01 08:46:36 -0600 | [diff] [blame] | 32 | // generate pel |
Ben Tyner | 7f6ce6a | 2021-08-17 19:40:00 -0500 | [diff] [blame] | 33 | auto pelId = eventVital(); |
| 34 | |
| 35 | // conditionally request dump |
| 36 | if ((0 != pelId) && (util::dbus::HostRunningState::NotStarted == |
| 37 | util::dbus::hostRunningState())) |
| 38 | { |
| 39 | requestDump(DumpParameters{pelId, 0, DumpType::SBE}); |
| 40 | } |
| 41 | |
| 42 | // transition host |
| 43 | util::dbus::transitionHost(util::dbus::HostState::Quiesce); |
Ben Tyner | bcf65a8 | 2020-12-01 08:46:36 -0600 | [diff] [blame] | 44 | } |
| 45 | |
| 46 | return rc; |
| 47 | } |
| 48 | |
| 49 | } // namespace attn |