blob: 5ea4deb8b220f0e7f128137b42ef266790a0df97 [file] [log] [blame]
Dhruvaraj Subhashchandranfef66a92020-09-06 13:10:59 -05001#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 Subhashchandran7040bce2020-09-16 00:50:19 -05009#include <xyz/openbmc_project/Dump/Create/server.hpp>
Dhruvaraj Subhashchandranfef66a92020-09-06 13:10:59 -050010
Dhruvaraj Subhashchandran341d6832021-01-15 06:28:04 -060011namespace openpower
Dhruvaraj Subhashchandranfef66a92020-09-06 13:10:59 -050012{
13namespace dump
14{
15namespace system
16{
17
Dhruvaraj Subhashchandran6ccb50e2020-10-29 09:33:18 -050018constexpr uint32_t INVALID_SOURCE_ID = 0xFFFFFFFF;
Patrick Williams9b18bf22022-07-22 19:26:55 -050019using NotifyIface = sdbusplus::server::object_t<
Dhruvaraj Subhashchandran7040bce2020-09-16 00:50:19 -050020 sdbusplus::xyz::openbmc_project::Dump::server::Create,
Dhruvaraj Subhashchandranfef66a92020-09-06 13:10:59 -050021 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 */
Jayanth Othayoth0af74a52021-04-08 03:55:21 -050028class Manager :
29 virtual public NotifyIface,
30 virtual public phosphor::dump::Manager
Dhruvaraj Subhashchandranfef66a92020-09-06 13:10:59 -050031{
32 public:
33 Manager() = delete;
34 Manager(const Manager&) = default;
35 Manager& operator=(const Manager&) = delete;
36 Manager(Manager&&) = delete;
37 Manager& operator=(Manager&&) = delete;
38 virtual ~Manager() = default;
39
40 /** @brief Constructor to put object onto bus at a dbus path.
41 * @param[in] bus - Bus to attach to.
42 * @param[in] event - Dump manager sd_event loop.
43 * @param[in] path - Path to attach at.
44 * @param[in] baseEntryPath - Base path of the dump entry.
45 */
Patrick Williams9b18bf22022-07-22 19:26:55 -050046 Manager(sdbusplus::bus_t& bus, const char* path,
Dhruvaraj Subhashchandranfef66a92020-09-06 13:10:59 -050047 const std::string& baseEntryPath) :
48 NotifyIface(bus, path),
49 phosphor::dump::Manager(bus, path, baseEntryPath)
Jayanth Othayoth0af74a52021-04-08 03:55:21 -050050 {}
Dhruvaraj Subhashchandranfef66a92020-09-06 13:10:59 -050051
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 Subhashchandranfef66a92020-09-06 13:10:59 -050059 * @param[in] dumpId - Id from the source of the dump.
60 * @param[in] size - Size of the dump.
61 */
Dhruvaraj Subhashchandranf37c5c32020-12-17 22:08:19 -060062 void notify(uint32_t dumpId, uint64_t size) override;
Dhruvaraj Subhashchandran7040bce2020-09-16 00:50:19 -050063
64 /** @brief Implementation for CreateDump
Dhruvaraj Subhashchandran6ccb50e2020-10-29 09:33:18 -050065 * Method to create a new system dump entry when user
66 * requests for a new system dump.
Dhruvaraj Subhashchandran7040bce2020-09-16 00:50:19 -050067 *
Dhruvaraj Subhashchandran6ccb50e2020-10-29 09:33:18 -050068 * @return object_path - The path to the new dump entry.
Dhruvaraj Subhashchandran7040bce2020-09-16 00:50:19 -050069 */
Dhruvaraj Subhashchandran969f9a52020-10-30 01:42:39 -050070 sdbusplus::message::object_path
Dhruvaraj Subhashchandranddc33662021-07-19 09:28:42 -050071 createDump(phosphor::dump::DumpCreateParams params) override;
Dhruvaraj Subhashchandranfef66a92020-09-06 13:10:59 -050072};
73
74} // namespace system
75} // namespace dump
Dhruvaraj Subhashchandran341d6832021-01-15 06:28:04 -060076} // namespace openpower