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> |
austinfcui | bfa831a | 2022-01-26 15:37:07 -0600 | [diff] [blame] | 4 | #include <util/trace.hpp> |
Ben Tyner | 9ae5ca4 | 2020-02-28 13:13:50 -0600 | [diff] [blame] | 5 | |
Ben Tyner | 9ae5ca4 | 2020-02-28 13:13:50 -0600 | [diff] [blame] | 6 | namespace 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 Tyner | fe15649 | 2021-04-08 07:28:13 -0500 | [diff] [blame] | 15 | int bpHandler() |
Ben Tyner | 9ae5ca4 | 2020-02-28 13:13:50 -0600 | [diff] [blame] | 16 | { |
Ben Tyner | fe15649 | 2021-04-08 07:28:13 -0500 | [diff] [blame] | 17 | int rc = RC_SUCCESS; // assume success |
18 | |||||
Ben Tyner | 9ae5ca4 | 2020-02-28 13:13:50 -0600 | [diff] [blame] | 19 | // trace message |
austinfcui | bfa831a | 2022-01-26 15:37:07 -0600 | [diff] [blame] | 20 | trace::inf("Notify Cronus"); |
Ben Tyner | 9ae5ca4 | 2020-02-28 13:13:50 -0600 | [diff] [blame] | 21 | |
22 | // notify Cronus over dbus | ||||
Ben Tyner | fe15649 | 2021-04-08 07:28:13 -0500 | [diff] [blame] | 23 | try |
24 | { | ||||
25 | auto bus = sdbusplus::bus::new_system(); | ||||
26 | auto msg = bus.new_signal("/", "org.openbmc.cronus", "Brkpt"); | ||||
Ben Tyner | 9ae5ca4 | 2020-02-28 13:13:50 -0600 | [diff] [blame] | 27 | |
Ben Tyner | fe15649 | 2021-04-08 07:28:13 -0500 | [diff] [blame] | 28 | // 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 Tyner | 9ae5ca4 | 2020-02-28 13:13:50 -0600 | [diff] [blame] | 31 | |
Ben Tyner | fe15649 | 2021-04-08 07:28:13 -0500 | [diff] [blame] | 32 | msg.signal_send(); |
33 | } | ||||
34 | catch (const sdbusplus::exception::SdBusError& e) | ||||
35 | { | ||||
austinfcui | bfa831a | 2022-01-26 15:37:07 -0600 | [diff] [blame] | 36 | trace::inf("bpHandler() exception"); |
37 | trace::err(e.what()); | ||||
Ben Tyner | fe15649 | 2021-04-08 07:28:13 -0500 | [diff] [blame] | 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 |