blob: 259ca231659d30d187d0e8d0aec4c6952880929b [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) :
22 blob(blob),
23 pci(pci), progress(progress), skipBridgeDisable(skipBridgeDisable),
24 sys(sys)
25 {}
26
Benjamin Faire5aafa52020-06-05 21:04:24 -070027 P2aDataHandler(ipmiblob::BlobInterface* blob, const PciAccess* pci,
28 ProgressInterface* progress,
Patrick Venture18bbe3c2019-05-14 11:40:57 -070029 const internal::Sys* sys = &internal::sys_impl) :
Willy Tu8a9de242020-10-30 11:00:21 -070030 P2aDataHandler(blob, pci, progress, false, sys)
Patrick Venture9b37b092020-05-28 20:58:57 -070031 {}
Patrick Ventureb5bf0fc2019-05-03 14:33:49 -070032
33 bool sendContents(const std::string& input, std::uint16_t session) override;
Patrick Venture84778b82019-06-26 20:11:09 -070034 ipmi_flash::FirmwareFlags::UpdateFlags supportedType() const override
Patrick Ventureb5bf0fc2019-05-03 14:33:49 -070035 {
Patrick Venture84778b82019-06-26 20:11:09 -070036 return ipmi_flash::FirmwareFlags::UpdateFlags::p2a;
Patrick Ventureb5bf0fc2019-05-03 14:33:49 -070037 }
38
39 private:
40 ipmiblob::BlobInterface* blob;
Benjamin Faire5aafa52020-06-05 21:04:24 -070041 const PciAccess* pci;
Patrick Venturecf9b2192019-06-27 12:09:52 -070042 ProgressInterface* progress;
Willy Tu8a9de242020-10-30 11:00:21 -070043 bool skipBridgeDisable;
Patrick Venture18bbe3c2019-05-14 11:40:57 -070044 const internal::Sys* sys;
Medad CChienc8445aa2020-04-23 09:47:46 +080045};
Benjamin Faire5aafa52020-06-05 21:04:24 -070046
Patrick Ventureb5bf0fc2019-05-03 14:33:49 -070047} // namespace host_tool