1 #pragma once 2 3 #include "interface.hpp" 4 #include "internal/sys.hpp" 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; 13 constexpr std::size_t aspeedP2aOffset = 0x10000; 14 constexpr std::size_t aspeedP2aConfig = 0x0f000; 15 constexpr std::size_t aspeedP2aBridge = 0x0f004; 16 constexpr std::uint32_t p2ABridgeEnabled = 0x1; 17 18 namespace host_tool 19 { 20 21 class P2aDataHandler : public DataInterface 22 { 23 public: 24 P2aDataHandler(ipmiblob::BlobInterface* blob, HostIoInterface* io, 25 PciUtilInterface* pci, 26 const internal::Sys* sys = &internal::sys_impl) : 27 blob(blob), 28 io(io), pci(pci), sys(sys) 29 { 30 } 31 32 bool sendContents(const std::string& input, std::uint16_t session) override; 33 ipmi_flash::FirmwareFlags::UpdateFlags supportedType() const override 34 { 35 return ipmi_flash::FirmwareFlags::UpdateFlags::p2a; 36 } 37 38 private: 39 ipmiblob::BlobInterface* blob; 40 HostIoInterface* io; 41 PciUtilInterface* pci; 42 const internal::Sys* sys; 43 }; 44 45 } // namespace host_tool 46