xref: /openbmc/phosphor-ipmi-flash/tools/p2a.hpp (revision 42a44c281cce08be0ca6251955f4fb73d30c8ced)
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:
P2aDataHandler(ipmiblob::BlobInterface * blob,const PciAccess * pci,ProgressInterface * progress,bool skipBridgeDisable,const internal::Sys * sys=& internal::sys_impl)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), pci(pci), progress(progress),
23         skipBridgeDisable(skipBridgeDisable), sys(sys)
24     {}
25 
P2aDataHandler(ipmiblob::BlobInterface * blob,const PciAccess * pci,ProgressInterface * progress,const internal::Sys * sys=& internal::sys_impl)26     P2aDataHandler(ipmiblob::BlobInterface* blob, const PciAccess* pci,
27                    ProgressInterface* progress,
28                    const internal::Sys* sys = &internal::sys_impl) :
29         P2aDataHandler(blob, pci, progress, false, sys)
30     {}
31 
32     bool sendContents(const std::string& input, std::uint16_t session) override;
supportedType() const33     ipmi_flash::FirmwareFlags::UpdateFlags supportedType() const override
34     {
35         return ipmi_flash::FirmwareFlags::UpdateFlags::p2a;
36     }
37 
38   private:
39     ipmiblob::BlobInterface* blob;
40     const PciAccess* pci;
41     ProgressInterface* progress;
42     bool skipBridgeDisable;
43     const internal::Sys* sys;
44 };
45 
46 } // namespace host_tool
47