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