blob: ae7aaa0ba78442276a296868827db20e20a55a16 [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>
austinfcuibfa831a2022-01-26 15:37:07 -06007#include <util/trace.hpp>
Ben Tynerbcf65a82020-12-01 08:46:36 -06008
9namespace 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 */
19int handleVital(Attention* i_attention)
20{
21 int rc = RC_SUCCESS; // assume vital handled
22
austinfcuibfa831a2022-01-26 15:37:07 -060023 trace::inf("vital handler started");
Ben Tynerbcf65a82020-12-01 08:46:36 -060024
25 // if vital handling enabled, handle vital attention
26 if (false == (i_attention->getConfig()->getFlag(enVital)))
27 {
austinfcuibfa831a2022-01-26 15:37:07 -060028 trace::inf("vital handling disabled");
Ben Tynerbcf65a82020-12-01 08:46:36 -060029 rc = RC_NOT_HANDLED;
30 }
31 else
32 {
Ben Tynerbcf65a82020-12-01 08:46:36 -060033 // generate pel
Ben Tyner7f6ce6a2021-08-17 19:40:00 -050034 auto pelId = eventVital();
35
36 // conditionally request dump
37 if ((0 != pelId) && (util::dbus::HostRunningState::NotStarted ==
38 util::dbus::hostRunningState()))
39 {
Zane Shelley611b3442021-11-19 16:02:01 -060040 requestDump(pelId, DumpParameters{0, DumpType::SBE});
Ben Tyner7f6ce6a2021-08-17 19:40:00 -050041 }
42
43 // transition host
44 util::dbus::transitionHost(util::dbus::HostState::Quiesce);
Ben Tynerbcf65a82020-12-01 08:46:36 -060045 }
46
47 return rc;
48}
49
50} // namespace attn