xref: /openbmc/phosphor-ipmi-flash/tools/p2a.hpp (revision 42a44c281cce08be0ca6251955f4fb73d30c8ced)
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)198a9de245SWilly Tu     explicit P2aDataHandler(ipmiblob::BlobInterface* blob, const PciAccess* pci,
208a9de245SWilly Tu                             ProgressInterface* progress, bool skipBridgeDisable,
218a9de245SWilly Tu                             const internal::Sys* sys = &internal::sys_impl) :
22*42a44c28SPatrick Williams         blob(blob), pci(pci), progress(progress),
23*42a44c28SPatrick Williams         skipBridgeDisable(skipBridgeDisable), sys(sys)
248a9de245SWilly Tu     {}
258a9de245SWilly Tu 
P2aDataHandler(ipmiblob::BlobInterface * blob,const PciAccess * pci,ProgressInterface * progress,const internal::Sys * sys=& internal::sys_impl)26e5aafa5bSBenjamin Fair     P2aDataHandler(ipmiblob::BlobInterface* blob, const PciAccess* pci,
27e5aafa5bSBenjamin Fair                    ProgressInterface* progress,
2818bbe3c6SPatrick Venture                    const internal::Sys* sys = &internal::sys_impl) :
298a9de245SWilly Tu         P2aDataHandler(blob, pci, progress, false, sys)
309b37b095SPatrick Venture     {}
31b5bf0fc2SPatrick Venture 
32b5bf0fc2SPatrick Venture     bool sendContents(const std::string& input, std::uint16_t session) override;
supportedType() const3384778b8dSPatrick Venture     ipmi_flash::FirmwareFlags::UpdateFlags supportedType() const override
34b5bf0fc2SPatrick Venture     {
3584778b8dSPatrick Venture         return ipmi_flash::FirmwareFlags::UpdateFlags::p2a;
36b5bf0fc2SPatrick Venture     }
37b5bf0fc2SPatrick Venture 
38b5bf0fc2SPatrick Venture   private:
39b5bf0fc2SPatrick Venture     ipmiblob::BlobInterface* blob;
40e5aafa5bSBenjamin Fair     const PciAccess* pci;
41cf9b2195SPatrick Venture     ProgressInterface* progress;
428a9de245SWilly Tu     bool skipBridgeDisable;
4318bbe3c6SPatrick Venture     const internal::Sys* sys;
44c8445aaaSMedad CChien };
45e5aafa5bSBenjamin Fair 
46b5bf0fc2SPatrick Venture } // namespace host_tool
47