blob: 920422f5c18502ad6f412c62478151ce31df2604 [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 "io.hpp"
6#include "pci.hpp"
7
8#include <cstdint>
9#include <ipmiblob/blob_interface.hpp>
10
11constexpr std::uint16_t aspeedVendorId = 0x1a03;
12constexpr std::uint16_t aspeedDeviceId = 0x2000;
Patrick Venture18bbe3c2019-05-14 11:40:57 -070013constexpr std::size_t aspeedP2aOffset = 0x10000;
Patrick Venture24141612019-05-03 17:59:18 -070014constexpr std::size_t aspeedP2aConfig = 0x0f000;
15constexpr std::size_t aspeedP2aBridge = 0x0f004;
16constexpr std::uint32_t p2ABridgeEnabled = 0x1;
Patrick Ventureb5bf0fc2019-05-03 14:33:49 -070017
18namespace host_tool
19{
20
21class P2aDataHandler : public DataInterface
22{
23 public:
24 P2aDataHandler(ipmiblob::BlobInterface* blob, HostIoInterface* io,
Patrick Venture18bbe3c2019-05-14 11:40:57 -070025 PciUtilInterface* pci,
26 const internal::Sys* sys = &internal::sys_impl) :
Patrick Ventureb5bf0fc2019-05-03 14:33:49 -070027 blob(blob),
Patrick Venture18bbe3c2019-05-14 11:40:57 -070028 io(io), pci(pci), sys(sys)
Patrick Ventureb5bf0fc2019-05-03 14:33:49 -070029 {
30 }
31
32 bool sendContents(const std::string& input, std::uint16_t session) override;
Patrick Venture1d5a31c2019-05-20 11:38:22 -070033 ipmi_flash::FirmwareBlobHandler::UpdateFlags supportedType() const override
Patrick Ventureb5bf0fc2019-05-03 14:33:49 -070034 {
Patrick Venture1d5a31c2019-05-20 11:38:22 -070035 return ipmi_flash::FirmwareBlobHandler::UpdateFlags::p2a;
Patrick Ventureb5bf0fc2019-05-03 14:33:49 -070036 }
37
38 private:
39 ipmiblob::BlobInterface* blob;
40 HostIoInterface* io;
41 PciUtilInterface* pci;
Patrick Venture18bbe3c2019-05-14 11:40:57 -070042 const internal::Sys* sys;
Patrick Ventureb5bf0fc2019-05-03 14:33:49 -070043};
44
45} // namespace host_tool