Ben Tyner | b833556 | 2021-07-16 12:43:52 -0500 | [diff] [blame] | 1 | #include <attn/attn_common.hpp> |
Ben Tyner | b797b3e | 2020-06-29 10:12:05 -0500 | [diff] [blame] | 2 | #include <attn/attn_logging.hpp> |
Ben Tyner | 9ae5ca4 | 2020-02-28 13:13:50 -0600 | [diff] [blame] | 3 | #include <sdbusplus/bus.hpp> |
| 4 | |
Ben Tyner | 9ae5ca4 | 2020-02-28 13:13:50 -0600 | [diff] [blame] | 5 | namespace 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 Tyner | fe15649 | 2021-04-08 07:28:13 -0500 | [diff] [blame] | 14 | int bpHandler() |
Ben Tyner | 9ae5ca4 | 2020-02-28 13:13:50 -0600 | [diff] [blame] | 15 | { |
Ben Tyner | fe15649 | 2021-04-08 07:28:13 -0500 | [diff] [blame] | 16 | int rc = RC_SUCCESS; // assume success |
| 17 | |
Ben Tyner | 9ae5ca4 | 2020-02-28 13:13:50 -0600 | [diff] [blame] | 18 | // trace message |
Ben Tyner | b1ebfcb | 2020-05-08 18:52:48 -0500 | [diff] [blame] | 19 | trace<level::INFO>("Notify Cronus"); |
Ben Tyner | 9ae5ca4 | 2020-02-28 13:13:50 -0600 | [diff] [blame] | 20 | |
| 21 | // notify Cronus over dbus |
Ben Tyner | fe15649 | 2021-04-08 07:28:13 -0500 | [diff] [blame] | 22 | try |
| 23 | { |
| 24 | auto bus = sdbusplus::bus::new_system(); |
| 25 | auto msg = bus.new_signal("/", "org.openbmc.cronus", "Brkpt"); |
Ben Tyner | 9ae5ca4 | 2020-02-28 13:13:50 -0600 | [diff] [blame] | 26 | |
Ben Tyner | fe15649 | 2021-04-08 07:28:13 -0500 | [diff] [blame] | 27 | // 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 Tyner | 9ae5ca4 | 2020-02-28 13:13:50 -0600 | [diff] [blame] | 30 | |
Ben Tyner | fe15649 | 2021-04-08 07:28:13 -0500 | [diff] [blame] | 31 | 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 Tyner | 9ae5ca4 | 2020-02-28 13:13:50 -0600 | [diff] [blame] | 40 | |
Ben Tyner | fe15649 | 2021-04-08 07:28:13 -0500 | [diff] [blame] | 41 | return rc; |
Ben Tyner | 9ae5ca4 | 2020-02-28 13:13:50 -0600 | [diff] [blame] | 42 | } |
| 43 | |
| 44 | } // namespace attn |