xref: /openbmc/phosphor-ipmi-flash/tools/p2a.hpp (revision 8a9de245)
1b5bf0fc2SPatrick Venture #pragma once
2b5bf0fc2SPatrick Venture 
3b5bf0fc2SPatrick Venture #include "interface.hpp"
418bbe3c6SPatrick Venture #include "internal/sys.hpp"
5b5bf0fc2SPatrick Venture #include "pci.hpp"
6cf9b2195SPatrick Venture #include "progress.hpp"
7b5bf0fc2SPatrick Venture 
8b5bf0fc2SPatrick Venture #include <ipmiblob/blob_interface.hpp>
99b37b095SPatrick Venture 
109b37b095SPatrick Venture #include <cstdint>
11c8445aaaSMedad CChien #include <vector>
12b5bf0fc2SPatrick Venture 
13b5bf0fc2SPatrick Venture namespace host_tool
14b5bf0fc2SPatrick Venture {
15b5bf0fc2SPatrick Venture 
16b5bf0fc2SPatrick Venture class P2aDataHandler : public DataInterface
17b5bf0fc2SPatrick Venture {
18b5bf0fc2SPatrick Venture   public:
P2aDataHandler(ipmiblob::BlobInterface * blob,const PciAccess * pci,ProgressInterface * progress,bool skipBridgeDisable,const internal::Sys * sys=& internal::sys_impl)19*8a9de245SWilly Tu     explicit P2aDataHandler(ipmiblob::BlobInterface* blob, const PciAccess* pci,
20*8a9de245SWilly Tu                             ProgressInterface* progress, bool skipBridgeDisable,
21*8a9de245SWilly Tu                             const internal::Sys* sys = &internal::sys_impl) :
22*8a9de245SWilly Tu         blob(blob),
23*8a9de245SWilly Tu         pci(pci), progress(progress), skipBridgeDisable(skipBridgeDisable),
24*8a9de245SWilly Tu         sys(sys)
25*8a9de245SWilly Tu     {}
26*8a9de245SWilly Tu 
P2aDataHandler(ipmiblob::BlobInterface * blob,const PciAccess * pci,ProgressInterface * progress,const internal::Sys * sys=& internal::sys_impl)27e5aafa5bSBenjamin Fair     P2aDataHandler(ipmiblob::BlobInterface* blob, const PciAccess* pci,
28e5aafa5bSBenjamin Fair                    ProgressInterface* progress,
2918bbe3c6SPatrick Venture                    const internal::Sys* sys = &internal::sys_impl) :
30*8a9de245SWilly Tu         P2aDataHandler(blob, pci, progress, false, sys)
319b37b095SPatrick Venture     {}
32b5bf0fc2SPatrick Venture 
33b5bf0fc2SPatrick Venture     bool sendContents(const std::string& input, std::uint16_t session) override;
supportedType() const3484778b8dSPatrick Venture     ipmi_flash::FirmwareFlags::UpdateFlags supportedType() const override
35b5bf0fc2SPatrick Venture     {
3684778b8dSPatrick Venture         return ipmi_flash::FirmwareFlags::UpdateFlags::p2a;
37b5bf0fc2SPatrick Venture     }
38b5bf0fc2SPatrick Venture 
39b5bf0fc2SPatrick Venture   private:
40b5bf0fc2SPatrick Venture     ipmiblob::BlobInterface* blob;
41e5aafa5bSBenjamin Fair     const PciAccess* pci;
42cf9b2195SPatrick Venture     ProgressInterface* progress;
43*8a9de245SWilly Tu     bool skipBridgeDisable;
4418bbe3c6SPatrick Venture     const internal::Sys* sys;
45c8445aaaSMedad CChien };
46e5aafa5bSBenjamin Fair 
47b5bf0fc2SPatrick Venture } // namespace host_tool
48