blob: 3c93bfd6a3c98200b840b689e19a048068068441 [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>
austinfcuibfa831a2022-01-26 15:37:07 -06004#include <util/trace.hpp>
Ben Tyner9ae5ca42020-02-28 13:13:50 -06005
Ben Tyner9ae5ca42020-02-28 13:13:50 -06006namespace attn
7{
8
9/**
10 * @brief Notify Cronus over dbus interface
11 *
12 * When the special attention is due to a breakpoint condition we will notify
13 * Cronus over the dbus interface.
14 */
Ben Tynerfe156492021-04-08 07:28:13 -050015int bpHandler()
Ben Tyner9ae5ca42020-02-28 13:13:50 -060016{
Ben Tynerfe156492021-04-08 07:28:13 -050017 int rc = RC_SUCCESS; // assume success
18
Ben Tyner9ae5ca42020-02-28 13:13:50 -060019 // trace message
austinfcuibfa831a2022-01-26 15:37:07 -060020 trace::inf("Notify Cronus");
Ben Tyner9ae5ca42020-02-28 13:13:50 -060021
22 // notify Cronus over dbus
Ben Tynerfe156492021-04-08 07:28:13 -050023 try
24 {
25 auto bus = sdbusplus::bus::new_system();
26 auto msg = bus.new_signal("/", "org.openbmc.cronus", "Brkpt");
Ben Tyner9ae5ca42020-02-28 13:13:50 -060027
Ben Tynerfe156492021-04-08 07:28:13 -050028 // Cronus will figure out proc, core, thread so just send 0,0,0
29 std::array<uint32_t, 3> params{0, 0, 0};
30 msg.append(params);
Ben Tyner9ae5ca42020-02-28 13:13:50 -060031
Ben Tynerfe156492021-04-08 07:28:13 -050032 msg.signal_send();
33 }
34 catch (const sdbusplus::exception::SdBusError& e)
35 {
austinfcuibfa831a2022-01-26 15:37:07 -060036 trace::inf("bpHandler() exception");
37 trace::err(e.what());
Ben Tynerfe156492021-04-08 07:28:13 -050038 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