xref: /openbmc/phosphor-ipmi-flash/tools/p2a.hpp (revision bcae9002)
1 #pragma once
2 
3 #include "interface.hpp"
4 #include "internal/sys.hpp"
5 #include "pci.hpp"
6 #include "progress.hpp"
7 
8 #include <ipmiblob/blob_interface.hpp>
9 
10 #include <cstdint>
11 #include <vector>
12 
13 namespace host_tool
14 {
15 
16 class P2aDataHandler : public DataInterface
17 {
18   public:
19     explicit P2aDataHandler(ipmiblob::BlobInterface* blob, const PciAccess* pci,
20                             ProgressInterface* progress, bool skipBridgeDisable,
21                             const internal::Sys* sys = &internal::sys_impl) :
22         blob(blob),
23         pci(pci), progress(progress), skipBridgeDisable(skipBridgeDisable),
24         sys(sys)
25     {}
26 
27     P2aDataHandler(ipmiblob::BlobInterface* blob, const PciAccess* pci,
28                    ProgressInterface* progress,
29                    const internal::Sys* sys = &internal::sys_impl) :
30         P2aDataHandler(blob, pci, progress, false, sys)
31     {}
32 
33     bool sendContents(const std::string& input, std::uint16_t session) override;
34     ipmi_flash::FirmwareFlags::UpdateFlags supportedType() const override
35     {
36         return ipmi_flash::FirmwareFlags::UpdateFlags::p2a;
37     }
38 
39   private:
40     ipmiblob::BlobInterface* blob;
41     const PciAccess* pci;
42     ProgressInterface* progress;
43     bool skipBridgeDisable;
44     const internal::Sys* sys;
45 };
46 
47 } // namespace host_tool
48