blob: c07dfc719f1d0badd3fd902b26187a7fbc38e279 [file] [log] [blame]
Ben Tynerbcf65a82020-12-01 08:46:36 -06001#include <attn/attention.hpp>
2#include <attn/attn_common.hpp>
Ben Tyner7f6ce6a2021-08-17 19:40:00 -05003#include <attn/attn_dump.hpp>
Ben Tynerbcf65a82020-12-01 08:46:36 -06004#include <attn/attn_logging.hpp>
5#include <sdbusplus/bus.hpp>
Ben Tyner93067162021-07-23 10:39:30 -05006#include <util/dbus.hpp>
Ben Tynerbcf65a82020-12-01 08:46:36 -06007
8namespace 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 */
18int 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 Tynerbcf65a82020-12-01 08:46:36 -060032 // generate pel
Ben Tyner7f6ce6a2021-08-17 19:40:00 -050033 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 Tynerbcf65a82020-12-01 08:46:36 -060044 }
45
46 return rc;
47}
48
49} // namespace attn