Update host dump ids

Host dump ids need to be started from certain numbers
this commit adds the starting if for each type of dumps

Hardare dump: Starting ID - 0
Hostboot dump: Starting ID - 20000001
SBE dump: Starting ID - 30000001

Signed-off-by: Dhruvaraj Subhashchandran <dhruvaraj@in.ibm.com>
Change-Id: I26945184c727e70fb9f543eaa7c2266a650b2793
diff --git a/dump-extensions/openpower-dumps/dump-extensions.cpp b/dump-extensions/openpower-dumps/dump-extensions.cpp
index 8812c35..94362cb 100644
--- a/dump-extensions/openpower-dumps/dump-extensions.cpp
+++ b/dump-extensions/openpower-dumps/dump-extensions.cpp
@@ -47,9 +47,9 @@
     dumpList.push_back(std::make_unique<openpower::dump::hostdump::Manager<
                            sdbusplus::com::ibm::Dump::Entry::server::Hostboot>>(
         bus, event, HOSTBOOT_DUMP_OBJPATH, HOSTBOOT_DUMP_OBJ_ENTRY,
-        HOSTBOOT_DUMP_PATH, "hbdump", HOSTBOOT_DUMP_TMP_FILE_DIR,
-        HOSTBOOT_DUMP_MAX_SIZE, HOSTBOOT_DUMP_MIN_SPACE_REQD,
-        HOSTBOOT_DUMP_TOTAL_SIZE));
+        HOSTBOOT_DUMP_START_ID, HOSTBOOT_DUMP_PATH, "hbdump",
+        HOSTBOOT_DUMP_TMP_FILE_DIR, HOSTBOOT_DUMP_MAX_SIZE,
+        HOSTBOOT_DUMP_MIN_SPACE_REQD, HOSTBOOT_DUMP_TOTAL_SIZE));
 
     try
     {
@@ -67,9 +67,9 @@
     dumpList.push_back(std::make_unique<openpower::dump::hostdump::Manager<
                            sdbusplus::com::ibm::Dump::Entry::server::Hardware>>(
         bus, event, HARDWARE_DUMP_OBJPATH, HARDWARE_DUMP_OBJ_ENTRY,
-        HARDWARE_DUMP_PATH, "hwdump", HARDWARE_DUMP_TMP_FILE_DIR,
-        HARDWARE_DUMP_MAX_SIZE, HARDWARE_DUMP_MIN_SPACE_REQD,
-        HARDWARE_DUMP_TOTAL_SIZE));
+        HARDWARE_DUMP_START_ID, HARDWARE_DUMP_PATH, "hwdump",
+        HARDWARE_DUMP_TMP_FILE_DIR, HARDWARE_DUMP_MAX_SIZE,
+        HARDWARE_DUMP_MIN_SPACE_REQD, HARDWARE_DUMP_TOTAL_SIZE));
 
     try
     {
@@ -85,8 +85,8 @@
 
     dumpList.push_back(std::make_unique<openpower::dump::hostdump::Manager<
                            sdbusplus::com::ibm::Dump::Entry::server::SBE>>(
-        bus, event, SBE_DUMP_OBJPATH, SBE_DUMP_OBJ_ENTRY, SBE_DUMP_PATH,
-        "sbedump", SBE_DUMP_TMP_FILE_DIR, SBE_DUMP_MAX_SIZE,
+        bus, event, SBE_DUMP_OBJPATH, SBE_DUMP_OBJ_ENTRY, SBE_DUMP_START_ID,
+        SBE_DUMP_PATH, "sbedump", SBE_DUMP_TMP_FILE_DIR, SBE_DUMP_MAX_SIZE,
         SBE_DUMP_MIN_SPACE_REQD, SBE_DUMP_TOTAL_SIZE));
 }
 } // namespace dump
diff --git a/dump-extensions/openpower-dumps/dump_manager_hostdump.hpp b/dump-extensions/openpower-dumps/dump_manager_hostdump.hpp
index 95fe8ed..74e40f0 100644
--- a/dump-extensions/openpower-dumps/dump_manager_hostdump.hpp
+++ b/dump-extensions/openpower-dumps/dump_manager_hostdump.hpp
@@ -79,6 +79,7 @@
      *  @param[in] event - Dump manager sd_event loop.
      *  @param[in] path - Path to attach at.
      *  @param[in] baseEntryPath - Base path for dump entry.
+     *  @param[in] startingId - Starting dump id
      *  @param[in] filePath - Path where the dumps are stored.
      *  @param[in] dumpNamePrefix - Prefix to the dump filename
      *  @param[in] dumpTempFileDir - Temporary location of dump files
@@ -88,12 +89,13 @@
      */
     Manager(sdbusplus::bus::bus& bus, const phosphor::dump::EventPtr& event,
             const char* path, const std::string& baseEntryPath,
-            const char* filePath, const std::string dumpNamePrefix,
-            const std::string dumpTempFileDir, const uint64_t maxDumpSize,
-            const uint64_t minDumpSize, const uint64_t allocatedSize) :
+            uint32_t startingId, const char* filePath,
+            const std::string dumpNamePrefix, const std::string dumpTempFileDir,
+            const uint64_t maxDumpSize, const uint64_t minDumpSize,
+            const uint64_t allocatedSize) :
         CreateIface(bus, path),
         phosphor::dump::bmc_stored::Manager(
-            bus, event, path, baseEntryPath, filePath,
+            bus, event, path, baseEntryPath, startingId, filePath,
             dumpNamePrefix + HOST_DUMP_COMMON_FILENAME_PART, maxDumpSize,
             minDumpSize, allocatedSize),
         dumpNamePrefix(dumpNamePrefix), dumpTempFileDir(dumpTempFileDir)
diff --git a/dump-extensions/openpower-dumps/meson.build b/dump-extensions/openpower-dumps/meson.build
index b1b51d1..490c0b1 100644
--- a/dump-extensions/openpower-dumps/meson.build
+++ b/dump-extensions/openpower-dumps/meson.build
@@ -40,6 +40,10 @@
 opconf_data.set('HOSTBOOT_DUMP_TOTAL_SIZE', get_option('HOSTBOOT_DUMP_TOTAL_SIZE'),
                description : 'Total size of the dump in kilo bytes'
              )
+opconf_data.set('HOSTBOOT_DUMP_START_ID', get_option('HOSTBOOT_DUMP_START_ID'),
+               description : 'Starting id of Hostboot dump'
+            )
+
 opconf_data.set_quoted('HARDWARE_DUMP_OBJPATH', get_option('HARDWARE_DUMP_OBJPATH'),
                       description : 'The hardware dump manager D-Bus path'
                     )
@@ -61,6 +65,9 @@
 opconf_data.set('HARDWARE_DUMP_TOTAL_SIZE', get_option('HARDWARE_DUMP_TOTAL_SIZE'),
                description : 'Total size of the dump in kilo bytes'
             )
+opconf_data.set('HARDWARE_DUMP_START_ID', get_option('HARDWARE_DUMP_START_ID'),
+               description : 'Starting id of Hardware dump'
+            )
 
 opconf_data.set_quoted('SBE_DUMP_OBJPATH', get_option('SBE_DUMP_OBJPATH'),
                       description : 'The SBE dump manager D-Bus path'
@@ -83,6 +90,9 @@
 opconf_data.set('SBE_DUMP_TOTAL_SIZE', get_option('SBE_DUMP_TOTAL_SIZE'),
                description : 'Total size of the dump in kilo bytes'
             )
+opconf_data.set('SBE_DUMP_START_ID', get_option('SBE_DUMP_START_ID'),
+               description : 'Starting id of SBE dump'
+            )
 
 configure_file(configuration : opconf_data,
                output : 'openpower_dumps_config.h'
diff --git a/dump_manager.hpp b/dump_manager.hpp
index c605cdc..8c070ac 100644
--- a/dump_manager.hpp
+++ b/dump_manager.hpp
@@ -47,6 +47,18 @@
         bus(bus), lastEntryId(0), baseEntryPath(baseEntryPath)
     {}
 
+    /** @brief Constructor to put object onto bus at a dbus path.
+     *  @param[in] bus - Bus to attach to.
+     *  @param[in] path - Path to attach at.
+     *  @param[in] baseEntryPath - Base path of the dump entry.
+     *  @param[in] startingId - Starting id of the dump.
+     */
+    Manager(sdbusplus::bus::bus& bus, const char* path,
+            const std::string& baseEntryPath, uint32_t startingId) :
+        Iface(bus, path),
+        bus(bus), lastEntryId(startingId), baseEntryPath(baseEntryPath)
+    {}
+
     /** @brief Construct dump d-bus objects from their persisted
      *        representations.
      */
diff --git a/dump_manager_bmcstored.hpp b/dump_manager_bmcstored.hpp
index 9c3cf28..8be5bd7 100644
--- a/dump_manager_bmcstored.hpp
+++ b/dump_manager_bmcstored.hpp
@@ -60,6 +60,35 @@
         minDumpSize(minDumpSize), allocatedSize(allocatedSize)
     {}
 
+    /** @brief Constructor to put object onto bus at a dbus path.
+     *  @param[in] bus - Bus to attach to.
+     *  @param[in] event - Dump manager sd_event loop.
+     *  @param[in] path - Path to attach at.
+     *  @param[in] baseEntryPath - Base path for dump entry.
+     *  @param[in] startingId - Starting id of the dump
+     *  @param[in] filePath - Path where the dumps are stored.
+     *  @param[in] dumpFilenameFormat - Format of dump filename in regex
+     *  @param[in] maxDumpSize - Maximum size of the dump
+     *  @param[in] minDumpSize - Minimum possible size of a usable dump.
+     *  @param[in] allocatedSize - Total size allocated for the dumps
+     */
+    Manager(sdbusplus::bus::bus& bus, const EventPtr& event, const char* path,
+            const std::string& baseEntryPath, uint32_t startingId,
+            const char* filePath, const std::string dumpFilenameFormat,
+            const uint64_t maxDumpSize, const uint64_t minDumpSize,
+            const uint64_t allocatedSize) :
+        phosphor::dump::Manager(bus, path, baseEntryPath, startingId),
+        eventLoop(event.get()), dumpDir(filePath),
+        dumpWatch(
+            eventLoop, IN_NONBLOCK, IN_CLOSE_WRITE | IN_CREATE, EPOLLIN,
+            filePath,
+            std::bind(std::mem_fn(
+                          &phosphor::dump::bmc_stored::Manager::watchCallback),
+                      this, std::placeholders::_1)),
+        dumpFilenameFormat(dumpFilenameFormat), maxDumpSize(maxDumpSize),
+        minDumpSize(minDumpSize), allocatedSize(allocatedSize)
+    {}
+
     /** @brief Implementation of dump watch call back
      *  @param [in] fileInfo - map of file info  path:event
      */
diff --git a/meson_options.txt b/meson_options.txt
index c39b964..b0b5412 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -171,6 +171,10 @@
         value : 409600,
         description : 'Total size of the dump in kilo bytes'
       )
+option('HOSTBOOT_DUMP_START_ID', type : 'integer',
+        value : 20000000,
+        description : 'Starting id of Hostboot Dump'
+      )
 
 # Hardware dump options
 
@@ -208,6 +212,10 @@
         value : 409600,
         description : 'Total size of the hardware dump in kilo bytes'
       )
+option('HARDWARE_DUMP_START_ID', type : 'integer',
+        value : 0,
+        description : 'Starting id of Hardware Dump'
+      )
 
 # SBE dump options
 
@@ -245,3 +253,7 @@
         value : 409600,
         description : 'Total size of the SBE dump in kilo bytes'
       )
+option('SBE_DUMP_START_ID', type : 'integer',
+        value : 30000000,
+        description : 'Starting id of SBE Dump'
+      )