blob: d1a303ecd021c1aa1ed3ef00b65794e1b2dd69df [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"
Patrick Venturecf9b2192019-06-27 12:09:52 -07007#include "progress.hpp"
Patrick Ventureb5bf0fc2019-05-03 14:33:49 -07008
9#include <cstdint>
10#include <ipmiblob/blob_interface.hpp>
11
12constexpr std::uint16_t aspeedVendorId = 0x1a03;
13constexpr std::uint16_t aspeedDeviceId = 0x2000;
Patrick Venture18bbe3c2019-05-14 11:40:57 -070014constexpr std::size_t aspeedP2aOffset = 0x10000;
Patrick Venture24141612019-05-03 17:59:18 -070015constexpr std::size_t aspeedP2aConfig = 0x0f000;
16constexpr std::size_t aspeedP2aBridge = 0x0f004;
17constexpr std::uint32_t p2ABridgeEnabled = 0x1;
Patrick Ventureb5bf0fc2019-05-03 14:33:49 -070018
19namespace host_tool
20{
21
22class P2aDataHandler : public DataInterface
23{
24 public:
25 P2aDataHandler(ipmiblob::BlobInterface* blob, HostIoInterface* io,
Patrick Venturecf9b2192019-06-27 12:09:52 -070026 PciUtilInterface* pci, ProgressInterface* progress,
Patrick Venture18bbe3c2019-05-14 11:40:57 -070027 const internal::Sys* sys = &internal::sys_impl) :
Patrick Ventureb5bf0fc2019-05-03 14:33:49 -070028 blob(blob),
Patrick Venturecf9b2192019-06-27 12:09:52 -070029 io(io), pci(pci), progress(progress), sys(sys)
Patrick Ventureb5bf0fc2019-05-03 14:33:49 -070030 {
31 }
32
33 bool sendContents(const std::string& input, std::uint16_t session) override;
Patrick Venture84778b82019-06-26 20:11:09 -070034 ipmi_flash::FirmwareFlags::UpdateFlags supportedType() const override
Patrick Ventureb5bf0fc2019-05-03 14:33:49 -070035 {
Patrick Venture84778b82019-06-26 20:11:09 -070036 return ipmi_flash::FirmwareFlags::UpdateFlags::p2a;
Patrick Ventureb5bf0fc2019-05-03 14:33:49 -070037 }
38
39 private:
40 ipmiblob::BlobInterface* blob;
41 HostIoInterface* io;
42 PciUtilInterface* pci;
Patrick Venturecf9b2192019-06-27 12:09:52 -070043 ProgressInterface* progress;
Patrick Venture18bbe3c2019-05-14 11:40:57 -070044 const internal::Sys* sys;
Patrick Ventureb5bf0fc2019-05-03 14:33:49 -070045};
46
47} // namespace host_tool