blob: 1e365269a819bb66d353771d6acf3259f7b40f17 [file] [log] [blame]
Ben Tynerb8335562021-07-16 12:43:52 -05001#include <attn/attn_common.hpp>
Ben Tynerb797b3e2020-06-29 10:12:05 -05002#include <attn/attn_logging.hpp>
Ben Tyner9ae5ca42020-02-28 13:13:50 -06003#include <sdbusplus/bus.hpp>
4
Ben Tyner9ae5ca42020-02-28 13:13:50 -06005namespace attn
6{
7
8/**
9 * @brief Notify Cronus over dbus interface
10 *
11 * When the special attention is due to a breakpoint condition we will notify
12 * Cronus over the dbus interface.
13 */
Ben Tynerfe156492021-04-08 07:28:13 -050014int bpHandler()
Ben Tyner9ae5ca42020-02-28 13:13:50 -060015{
Ben Tynerfe156492021-04-08 07:28:13 -050016 int rc = RC_SUCCESS; // assume success
17
Ben Tyner9ae5ca42020-02-28 13:13:50 -060018 // trace message
Ben Tynerb1ebfcb2020-05-08 18:52:48 -050019 trace<level::INFO>("Notify Cronus");
Ben Tyner9ae5ca42020-02-28 13:13:50 -060020
21 // notify Cronus over dbus
Ben Tynerfe156492021-04-08 07:28:13 -050022 try
23 {
24 auto bus = sdbusplus::bus::new_system();
25 auto msg = bus.new_signal("/", "org.openbmc.cronus", "Brkpt");
Ben Tyner9ae5ca42020-02-28 13:13:50 -060026
Ben Tynerfe156492021-04-08 07:28:13 -050027 // Cronus will figure out proc, core, thread so just send 0,0,0
28 std::array<uint32_t, 3> params{0, 0, 0};
29 msg.append(params);
Ben Tyner9ae5ca42020-02-28 13:13:50 -060030
Ben Tynerfe156492021-04-08 07:28:13 -050031 msg.signal_send();
32 }
33 catch (const sdbusplus::exception::SdBusError& e)
34 {
35 trace<level::INFO>("bpHandler() exception");
36 std::string traceMsg = std::string(e.what(), maxTraceLen);
37 trace<level::ERROR>(traceMsg.c_str());
38 rc = RC_NOT_HANDLED;
39 }
Ben Tyner9ae5ca42020-02-28 13:13:50 -060040
Ben Tynerfe156492021-04-08 07:28:13 -050041 return rc;
Ben Tyner9ae5ca42020-02-28 13:13:50 -060042}
43
44} // namespace attn