blob: 910c005acc0b5923c72ee82444e8897b9c6ee662 [file] [log] [blame]
Ben Tynerbcf65a82020-12-01 08:46:36 -06001#include <attn/attention.hpp>
2#include <attn/attn_common.hpp>
Ben Tynerbcf65a82020-12-01 08:46:36 -06003#include <attn/attn_logging.hpp>
4#include <sdbusplus/bus.hpp>
Ben Tyner93067162021-07-23 10:39:30 -05005#include <util/dbus.hpp>
Ben Tynerbcf65a82020-12-01 08:46:36 -06006
7namespace attn
8{
9
10/**
11 * @brief Handle SBE vital attention
12 *
13 * @param i_attention Attention object
14 * @return 0 indicates that the vital attention was successfully handled
15 * 1 indicates that the vital attention was NOT successfully handled
16 */
17int handleVital(Attention* i_attention)
18{
19 int rc = RC_SUCCESS; // assume vital handled
20
21 trace<level::INFO>("vital handler started");
22
23 // if vital handling enabled, handle vital attention
24 if (false == (i_attention->getConfig()->getFlag(enVital)))
25 {
26 trace<level::INFO>("vital handling disabled");
27 rc = RC_NOT_HANDLED;
28 }
29 else
30 {
31 // transition host state after analyses
Ben Tyner93067162021-07-23 10:39:30 -050032 util::dbus::transitionHost(util::dbus::HostState::Quiesce);
Ben Tynerbcf65a82020-12-01 08:46:36 -060033
34 // generate pel
35 eventVital();
36 }
37
38 return rc;
39}
40
41} // namespace attn