1 #include "pel_entry.hpp"
2 
3 #include <iostream>
4 #include <xyz/openbmc_project/Common/error.hpp>
5 
6 namespace openpower
7 {
8 namespace pels
9 {
10 
11 namespace common_error = sdbusplus::xyz::openbmc_project::Common::Error;
12 
13 bool PELEntry::managementSystemAck(bool value)
14 {
15     auto current = sdbusplus::org::open_power::Logging::PEL::server::Entry::
16         managementSystemAck();
17     if (value != current)
18     {
19         current = sdbusplus::org::open_power::Logging::PEL::server::Entry::
20             managementSystemAck(value);
21 
22         Repository::LogID id{Repository::LogID::Obmc(getMyId())};
23         if (auto logId = _repo->getLogID(id); logId.has_value())
24         {
25             // Update HMC acknowledge bit in PEL
26             _repo->setPELHMCTransState(
27                 logId->pelID.id,
28                 (value ? TransmissionState::acked : TransmissionState::newPEL));
29         }
30         else
31         {
32             throw common_error::InvalidArgument();
33         }
34     }
35     return current;
36 }
37 
38 } // namespace pels
39 } // namespace openpower
40