1 #include <attn/attention.hpp>
2 #include <attn/attn_common.hpp>
3 #include <attn/attn_dump.hpp>
4 #include <attn/attn_logging.hpp>
5 #include <sdbusplus/bus.hpp>
6 #include <util/dbus.hpp>
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     {
32         // generate pel
33         auto pelId = eventVital();
34 
35         // conditionally request dump
36         if ((0 != pelId) && (util::dbus::HostRunningState::NotStarted ==
37                              util::dbus::hostRunningState()))
38         {
39             requestDump(pelId, DumpParameters{0, DumpType::SBE});
40         }
41 
42         // transition host
43         util::dbus::transitionHost(util::dbus::HostState::Quiesce);
44     }
45 
46     return rc;
47 }
48 
49 } // namespace attn
50