blob: 8882ac450d22c007183193737f21e27c0ac8cbdd [file] [log] [blame]
Patrick Ventureb5bf0fc2019-05-03 14:33:49 -07001#pragma once
2
3#include "interface.hpp"
Patrick Venture18bbe3c2019-05-14 11:40:57 -07004#include "internal/sys.hpp"
Patrick Ventureb5bf0fc2019-05-03 14:33:49 -07005#include "pci.hpp"
Patrick Venturecf9b2192019-06-27 12:09:52 -07006#include "progress.hpp"
Patrick Ventureb5bf0fc2019-05-03 14:33:49 -07007
Patrick Ventureb5bf0fc2019-05-03 14:33:49 -07008#include <ipmiblob/blob_interface.hpp>
Patrick Venture9b37b092020-05-28 20:58:57 -07009
10#include <cstdint>
Medad CChienc8445aa2020-04-23 09:47:46 +080011#include <vector>
Patrick Ventureb5bf0fc2019-05-03 14:33:49 -070012
Patrick Ventureb5bf0fc2019-05-03 14:33:49 -070013namespace host_tool
14{
15
16class P2aDataHandler : public DataInterface
17{
18 public:
Willy Tu8a9de242020-10-30 11:00:21 -070019 explicit P2aDataHandler(ipmiblob::BlobInterface* blob, const PciAccess* pci,
20 ProgressInterface* progress, bool skipBridgeDisable,
21 const internal::Sys* sys = &internal::sys_impl) :
Patrick Williams42a44c22024-08-16 15:21:32 -040022 blob(blob), pci(pci), progress(progress),
23 skipBridgeDisable(skipBridgeDisable), sys(sys)
Willy Tu8a9de242020-10-30 11:00:21 -070024 {}
25
Benjamin Faire5aafa52020-06-05 21:04:24 -070026 P2aDataHandler(ipmiblob::BlobInterface* blob, const PciAccess* pci,
27 ProgressInterface* progress,
Patrick Venture18bbe3c2019-05-14 11:40:57 -070028 const internal::Sys* sys = &internal::sys_impl) :
Willy Tu8a9de242020-10-30 11:00:21 -070029 P2aDataHandler(blob, pci, progress, false, sys)
Patrick Venture9b37b092020-05-28 20:58:57 -070030 {}
Patrick Ventureb5bf0fc2019-05-03 14:33:49 -070031
32 bool sendContents(const std::string& input, std::uint16_t session) override;
Patrick Venture84778b82019-06-26 20:11:09 -070033 ipmi_flash::FirmwareFlags::UpdateFlags supportedType() const override
Patrick Ventureb5bf0fc2019-05-03 14:33:49 -070034 {
Patrick Venture84778b82019-06-26 20:11:09 -070035 return ipmi_flash::FirmwareFlags::UpdateFlags::p2a;
Patrick Ventureb5bf0fc2019-05-03 14:33:49 -070036 }
37
38 private:
39 ipmiblob::BlobInterface* blob;
Benjamin Faire5aafa52020-06-05 21:04:24 -070040 const PciAccess* pci;
Patrick Venturecf9b2192019-06-27 12:09:52 -070041 ProgressInterface* progress;
Willy Tu8a9de242020-10-30 11:00:21 -070042 bool skipBridgeDisable;
Patrick Venture18bbe3c2019-05-14 11:40:57 -070043 const internal::Sys* sys;
Medad CChienc8445aa2020-04-23 09:47:46 +080044};
Benjamin Faire5aafa52020-06-05 21:04:24 -070045
Patrick Ventureb5bf0fc2019-05-03 14:33:49 -070046} // namespace host_tool