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 "io.hpp" |
| 6 | #include "pci.hpp" |
Patrick Venture | cf9b219 | 2019-06-27 12:09:52 -0700 | [diff] [blame] | 7 | #include "progress.hpp" |
Patrick Venture | b5bf0fc | 2019-05-03 14:33:49 -0700 | [diff] [blame] | 8 | |
| 9 | #include <cstdint> |
| 10 | #include <ipmiblob/blob_interface.hpp> |
| 11 | |
| 12 | constexpr std::uint16_t aspeedVendorId = 0x1a03; |
| 13 | constexpr std::uint16_t aspeedDeviceId = 0x2000; |
Patrick Venture | 18bbe3c | 2019-05-14 11:40:57 -0700 | [diff] [blame] | 14 | constexpr std::size_t aspeedP2aOffset = 0x10000; |
Patrick Venture | 2414161 | 2019-05-03 17:59:18 -0700 | [diff] [blame] | 15 | constexpr std::size_t aspeedP2aConfig = 0x0f000; |
| 16 | constexpr std::size_t aspeedP2aBridge = 0x0f004; |
| 17 | constexpr std::uint32_t p2ABridgeEnabled = 0x1; |
Patrick Venture | b5bf0fc | 2019-05-03 14:33:49 -0700 | [diff] [blame] | 18 | |
| 19 | namespace host_tool |
| 20 | { |
| 21 | |
| 22 | class P2aDataHandler : public DataInterface |
| 23 | { |
| 24 | public: |
| 25 | P2aDataHandler(ipmiblob::BlobInterface* blob, HostIoInterface* io, |
Patrick Venture | cf9b219 | 2019-06-27 12:09:52 -0700 | [diff] [blame] | 26 | PciUtilInterface* pci, ProgressInterface* progress, |
Patrick Venture | 18bbe3c | 2019-05-14 11:40:57 -0700 | [diff] [blame] | 27 | const internal::Sys* sys = &internal::sys_impl) : |
Patrick Venture | b5bf0fc | 2019-05-03 14:33:49 -0700 | [diff] [blame] | 28 | blob(blob), |
Patrick Venture | cf9b219 | 2019-06-27 12:09:52 -0700 | [diff] [blame] | 29 | io(io), pci(pci), progress(progress), sys(sys) |
Patrick Venture | b5bf0fc | 2019-05-03 14:33:49 -0700 | [diff] [blame] | 30 | { |
| 31 | } |
| 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; |
| 41 | HostIoInterface* io; |
| 42 | PciUtilInterface* pci; |
Patrick Venture | cf9b219 | 2019-06-27 12:09:52 -0700 | [diff] [blame] | 43 | ProgressInterface* progress; |
Patrick Venture | 18bbe3c | 2019-05-14 11:40:57 -0700 | [diff] [blame] | 44 | const internal::Sys* sys; |
Patrick Venture | b5bf0fc | 2019-05-03 14:33:49 -0700 | [diff] [blame] | 45 | }; |
| 46 | |
| 47 | } // namespace host_tool |