blob: dd7245fbbc0d1c7ee80bc1d6dbbd01c7be4ac6bb [file] [log] [blame]
Lei YU322f3f42019-02-21 16:10:41 +08001#pragma once
2
3#include "item_updater.hpp"
4
5namespace openpower
6{
7namespace software
8{
9namespace updater
10{
11
12/** @class ItemUpdaterStatic
13 * @brief Manages the activation of the host version items for static layout
14 */
15class ItemUpdaterStatic : public ItemUpdater
16{
17 public:
18 ItemUpdaterStatic(sdbusplus::bus::bus& bus, const std::string& path) :
19 ItemUpdater(bus, path)
20 {
21 processPNORImage();
22 gardReset = std::make_unique<GardReset>(bus, GARD_PATH);
23 volatileEnable = std::make_unique<ObjectEnable>(bus, volatilePath);
24
25 // Emit deferred signal.
26 emit_object_added();
27 }
28 virtual ~ItemUpdaterStatic() = default;
29
30 void freePriority(uint8_t value, const std::string& versionId) override;
31
32 void processPNORImage() override;
33
34 void deleteAll() override;
35
36 void freeSpace() override;
37
38 bool isVersionFunctional(const std::string& versionId) override;
39
40 private:
41 /** @brief Create Activation object */
42 std::unique_ptr<Activation> createActivationObject(
43 const std::string& path, const std::string& versionId,
44 const std::string& extVersion,
45 sdbusplus::xyz::openbmc_project::Software::server::Activation::
46 Activations activationStatus,
47 AssociationList& assocs) override;
48
49 /** @brief Create Version object */
50 std::unique_ptr<Version>
51 createVersionObject(const std::string& objPath,
52 const std::string& versionId,
53 const std::string& versionString,
54 sdbusplus::xyz::openbmc_project::Software::server::
55 Version::VersionPurpose versionPurpose,
56 const std::string& filePath) override;
57
58 /** @brief Validate if image is valid or not */
59 bool validateImage(const std::string& path);
60
61 /** @brief Host factory reset - clears PNOR partitions for each
62 * Activation D-Bus object */
63 void reset() override;
64};
65
66} // namespace updater
67} // namespace software
68} // namespace openpower