Dhruvaraj Subhashchandran | fef66a9 | 2020-09-06 13:10:59 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include "dump_manager.hpp" |
| 4 | #include "dump_utils.hpp" |
| 5 | #include "xyz/openbmc_project/Dump/NewDump/server.hpp" |
| 6 | |
| 7 | #include <sdbusplus/bus.hpp> |
| 8 | #include <sdbusplus/server/object.hpp> |
Dhruvaraj Subhashchandran | 7040bce | 2020-09-16 00:50:19 -0500 | [diff] [blame] | 9 | #include <xyz/openbmc_project/Dump/Create/server.hpp> |
Dhruvaraj Subhashchandran | fef66a9 | 2020-09-06 13:10:59 -0500 | [diff] [blame] | 10 | |
Dhruvaraj Subhashchandran | 341d683 | 2021-01-15 06:28:04 -0600 | [diff] [blame] | 11 | namespace openpower |
Dhruvaraj Subhashchandran | fef66a9 | 2020-09-06 13:10:59 -0500 | [diff] [blame] | 12 | { |
| 13 | namespace dump |
| 14 | { |
| 15 | namespace system |
| 16 | { |
| 17 | |
Dhruvaraj Subhashchandran | 6ccb50e | 2020-10-29 09:33:18 -0500 | [diff] [blame] | 18 | constexpr uint32_t INVALID_SOURCE_ID = 0xFFFFFFFF; |
Dhruvaraj Subhashchandran | fef66a9 | 2020-09-06 13:10:59 -0500 | [diff] [blame] | 19 | using NotifyIface = sdbusplus::server::object::object< |
Dhruvaraj Subhashchandran | 7040bce | 2020-09-16 00:50:19 -0500 | [diff] [blame] | 20 | sdbusplus::xyz::openbmc_project::Dump::server::Create, |
Dhruvaraj Subhashchandran | fef66a9 | 2020-09-06 13:10:59 -0500 | [diff] [blame] | 21 | sdbusplus::xyz::openbmc_project::Dump::server::NewDump>; |
| 22 | |
| 23 | /** @class Manager |
| 24 | * @brief System Dump manager implementation. |
| 25 | * @details A concrete implementation for the |
| 26 | * xyz.openbmc_project.Dump.Notify DBus API |
| 27 | */ |
| 28 | class Manager : virtual public NotifyIface, |
| 29 | virtual public phosphor::dump::Manager |
| 30 | { |
| 31 | public: |
| 32 | Manager() = delete; |
| 33 | Manager(const Manager&) = default; |
| 34 | Manager& operator=(const Manager&) = delete; |
| 35 | Manager(Manager&&) = delete; |
| 36 | Manager& operator=(Manager&&) = delete; |
| 37 | virtual ~Manager() = default; |
| 38 | |
| 39 | /** @brief Constructor to put object onto bus at a dbus path. |
| 40 | * @param[in] bus - Bus to attach to. |
| 41 | * @param[in] event - Dump manager sd_event loop. |
| 42 | * @param[in] path - Path to attach at. |
| 43 | * @param[in] baseEntryPath - Base path of the dump entry. |
| 44 | */ |
| 45 | Manager(sdbusplus::bus::bus& bus, const char* path, |
| 46 | const std::string& baseEntryPath) : |
| 47 | NotifyIface(bus, path), |
| 48 | phosphor::dump::Manager(bus, path, baseEntryPath) |
| 49 | { |
| 50 | } |
| 51 | |
| 52 | void restore() override |
| 53 | { |
| 54 | // TODO #2597 Implement the restore to restore the dump entries |
| 55 | // after the service restart. |
| 56 | } |
| 57 | |
| 58 | /** @brief Notify the system dump manager about creation of a new dump. |
Dhruvaraj Subhashchandran | fef66a9 | 2020-09-06 13:10:59 -0500 | [diff] [blame] | 59 | * @param[in] dumpId - Id from the source of the dump. |
| 60 | * @param[in] size - Size of the dump. |
| 61 | */ |
Dhruvaraj Subhashchandran | f37c5c3 | 2020-12-17 22:08:19 -0600 | [diff] [blame] | 62 | void notify(uint32_t dumpId, uint64_t size) override; |
Dhruvaraj Subhashchandran | 7040bce | 2020-09-16 00:50:19 -0500 | [diff] [blame] | 63 | |
| 64 | /** @brief Implementation for CreateDump |
Dhruvaraj Subhashchandran | 6ccb50e | 2020-10-29 09:33:18 -0500 | [diff] [blame] | 65 | * Method to create a new system dump entry when user |
| 66 | * requests for a new system dump. |
Dhruvaraj Subhashchandran | 7040bce | 2020-09-16 00:50:19 -0500 | [diff] [blame] | 67 | * |
Dhruvaraj Subhashchandran | 6ccb50e | 2020-10-29 09:33:18 -0500 | [diff] [blame] | 68 | * @return object_path - The path to the new dump entry. |
Dhruvaraj Subhashchandran | 7040bce | 2020-09-16 00:50:19 -0500 | [diff] [blame] | 69 | */ |
Dhruvaraj Subhashchandran | 969f9a5 | 2020-10-30 01:42:39 -0500 | [diff] [blame] | 70 | sdbusplus::message::object_path |
| 71 | createDump(std::map<std::string, std::string> params) override; |
Dhruvaraj Subhashchandran | fef66a9 | 2020-09-06 13:10:59 -0500 | [diff] [blame] | 72 | }; |
| 73 | |
| 74 | } // namespace system |
| 75 | } // namespace dump |
Dhruvaraj Subhashchandran | 341d683 | 2021-01-15 06:28:04 -0600 | [diff] [blame] | 76 | } // namespace openpower |