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