Patrick Venture | b5bf0fc | 2019-05-03 14:33:49 -0700 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include "interface.hpp" |
Patrick Venture | 18bbe3c | 2019-05-14 11:40:57 -0700 | [diff] [blame] | 4 | #include "internal/sys.hpp" |
Patrick Venture | b5bf0fc | 2019-05-03 14:33:49 -0700 | [diff] [blame] | 5 | #include "pci.hpp" |
Patrick Venture | cf9b219 | 2019-06-27 12:09:52 -0700 | [diff] [blame] | 6 | #include "progress.hpp" |
Patrick Venture | b5bf0fc | 2019-05-03 14:33:49 -0700 | [diff] [blame] | 7 | |
Patrick Venture | b5bf0fc | 2019-05-03 14:33:49 -0700 | [diff] [blame] | 8 | #include <ipmiblob/blob_interface.hpp> |
Patrick Venture | 9b37b09 | 2020-05-28 20:58:57 -0700 | [diff] [blame] | 9 | |
| 10 | #include <cstdint> |
Medad CChien | c8445aa | 2020-04-23 09:47:46 +0800 | [diff] [blame] | 11 | #include <vector> |
Patrick Venture | b5bf0fc | 2019-05-03 14:33:49 -0700 | [diff] [blame] | 12 | |
Patrick Venture | b5bf0fc | 2019-05-03 14:33:49 -0700 | [diff] [blame] | 13 | namespace host_tool |
| 14 | { |
| 15 | |
| 16 | class P2aDataHandler : public DataInterface |
| 17 | { |
| 18 | public: |
Willy Tu | 8a9de24 | 2020-10-30 11:00:21 -0700 | [diff] [blame] | 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), |
| 23 | pci(pci), progress(progress), skipBridgeDisable(skipBridgeDisable), |
| 24 | sys(sys) |
| 25 | {} |
| 26 | |
Benjamin Fair | e5aafa5 | 2020-06-05 21:04:24 -0700 | [diff] [blame] | 27 | P2aDataHandler(ipmiblob::BlobInterface* blob, const PciAccess* pci, |
| 28 | ProgressInterface* progress, |
Patrick Venture | 18bbe3c | 2019-05-14 11:40:57 -0700 | [diff] [blame] | 29 | const internal::Sys* sys = &internal::sys_impl) : |
Willy Tu | 8a9de24 | 2020-10-30 11:00:21 -0700 | [diff] [blame] | 30 | P2aDataHandler(blob, pci, progress, false, sys) |
Patrick Venture | 9b37b09 | 2020-05-28 20:58:57 -0700 | [diff] [blame] | 31 | {} |
Patrick Venture | b5bf0fc | 2019-05-03 14:33:49 -0700 | [diff] [blame] | 32 | |
| 33 | bool sendContents(const std::string& input, std::uint16_t session) override; |
Patrick Venture | 84778b8 | 2019-06-26 20:11:09 -0700 | [diff] [blame] | 34 | ipmi_flash::FirmwareFlags::UpdateFlags supportedType() const override |
Patrick Venture | b5bf0fc | 2019-05-03 14:33:49 -0700 | [diff] [blame] | 35 | { |
Patrick Venture | 84778b8 | 2019-06-26 20:11:09 -0700 | [diff] [blame] | 36 | return ipmi_flash::FirmwareFlags::UpdateFlags::p2a; |
Patrick Venture | b5bf0fc | 2019-05-03 14:33:49 -0700 | [diff] [blame] | 37 | } |
| 38 | |
| 39 | private: |
| 40 | ipmiblob::BlobInterface* blob; |
Benjamin Fair | e5aafa5 | 2020-06-05 21:04:24 -0700 | [diff] [blame] | 41 | const PciAccess* pci; |
Patrick Venture | cf9b219 | 2019-06-27 12:09:52 -0700 | [diff] [blame] | 42 | ProgressInterface* progress; |
Willy Tu | 8a9de24 | 2020-10-30 11:00:21 -0700 | [diff] [blame] | 43 | bool skipBridgeDisable; |
Patrick Venture | 18bbe3c | 2019-05-14 11:40:57 -0700 | [diff] [blame] | 44 | const internal::Sys* sys; |
Medad CChien | c8445aa | 2020-04-23 09:47:46 +0800 | [diff] [blame] | 45 | }; |
Benjamin Fair | e5aafa5 | 2020-06-05 21:04:24 -0700 | [diff] [blame] | 46 | |
Patrick Venture | b5bf0fc | 2019-05-03 14:33:49 -0700 | [diff] [blame] | 47 | } // namespace host_tool |