blob: 4d4b0ce77177e8c0fda2b7d4676827639cb901e8 [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 {
Zane Shelley611b3442021-11-19 16:02:01 -060039 requestDump(pelId, DumpParameters{0, DumpType::SBE});
Ben Tyner7f6ce6a2021-08-17 19:40:00 -050040 }
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