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" |
| 7 | |
| 8 | #include <cstdint> |
| 9 | #include <ipmiblob/blob_interface.hpp> |
| 10 | |
| 11 | constexpr std::uint16_t aspeedVendorId = 0x1a03; |
| 12 | constexpr std::uint16_t aspeedDeviceId = 0x2000; |
Patrick Venture | 18bbe3c | 2019-05-14 11:40:57 -0700 | [diff] [blame] | 13 | constexpr std::size_t aspeedP2aOffset = 0x10000; |
Patrick Venture | 2414161 | 2019-05-03 17:59:18 -0700 | [diff] [blame] | 14 | constexpr std::size_t aspeedP2aConfig = 0x0f000; |
| 15 | constexpr std::size_t aspeedP2aBridge = 0x0f004; |
| 16 | constexpr std::uint32_t p2ABridgeEnabled = 0x1; |
Patrick Venture | b5bf0fc | 2019-05-03 14:33:49 -0700 | [diff] [blame] | 17 | |
| 18 | namespace host_tool |
| 19 | { |
| 20 | |
| 21 | class P2aDataHandler : public DataInterface |
| 22 | { |
| 23 | public: |
| 24 | P2aDataHandler(ipmiblob::BlobInterface* blob, HostIoInterface* io, |
Patrick Venture | 18bbe3c | 2019-05-14 11:40:57 -0700 | [diff] [blame] | 25 | PciUtilInterface* pci, |
| 26 | const internal::Sys* sys = &internal::sys_impl) : |
Patrick Venture | b5bf0fc | 2019-05-03 14:33:49 -0700 | [diff] [blame] | 27 | blob(blob), |
Patrick Venture | 18bbe3c | 2019-05-14 11:40:57 -0700 | [diff] [blame] | 28 | io(io), pci(pci), sys(sys) |
Patrick Venture | b5bf0fc | 2019-05-03 14:33:49 -0700 | [diff] [blame] | 29 | { |
| 30 | } |
| 31 | |
| 32 | bool sendContents(const std::string& input, std::uint16_t session) override; |
Patrick Venture | 1d5a31c | 2019-05-20 11:38:22 -0700 | [diff] [blame] | 33 | ipmi_flash::FirmwareBlobHandler::UpdateFlags supportedType() const override |
Patrick Venture | b5bf0fc | 2019-05-03 14:33:49 -0700 | [diff] [blame] | 34 | { |
Patrick Venture | 1d5a31c | 2019-05-20 11:38:22 -0700 | [diff] [blame] | 35 | return ipmi_flash::FirmwareBlobHandler::UpdateFlags::p2a; |
Patrick Venture | b5bf0fc | 2019-05-03 14:33:49 -0700 | [diff] [blame] | 36 | } |
| 37 | |
| 38 | private: |
| 39 | ipmiblob::BlobInterface* blob; |
| 40 | HostIoInterface* io; |
| 41 | PciUtilInterface* pci; |
Patrick Venture | 18bbe3c | 2019-05-14 11:40:57 -0700 | [diff] [blame] | 42 | const internal::Sys* sys; |
Patrick Venture | b5bf0fc | 2019-05-03 14:33:49 -0700 | [diff] [blame] | 43 | }; |
| 44 | |
| 45 | } // namespace host_tool |