xref: /openbmc/phosphor-ipmi-flash/tools/p2a.hpp (revision 241416115e13659b9cb6cef9e77e469c1f99f640)
1 #pragma once
2 
3 #include "interface.hpp"
4 #include "io.hpp"
5 #include "pci.hpp"
6 
7 #include <cstdint>
8 #include <ipmiblob/blob_interface.hpp>
9 
10 constexpr std::uint16_t aspeedVendorId = 0x1a03;
11 constexpr std::uint16_t aspeedDeviceId = 0x2000;
12 constexpr std::size_t aspeedP2aConfig = 0x0f000;
13 constexpr std::size_t aspeedP2aBridge = 0x0f004;
14 constexpr std::uint32_t p2ABridgeEnabled = 0x1;
15 
16 namespace host_tool
17 {
18 
19 class P2aDataHandler : public DataInterface
20 {
21   public:
22     P2aDataHandler(ipmiblob::BlobInterface* blob, HostIoInterface* io,
23                    PciUtilInterface* pci) :
24         blob(blob),
25         io(io), pci(pci)
26     {
27     }
28 
29     bool sendContents(const std::string& input, std::uint16_t session) override;
30     blobs::FirmwareBlobHandler::UpdateFlags supportedType() const override
31     {
32         return blobs::FirmwareBlobHandler::UpdateFlags::p2a;
33     }
34 
35   private:
36     ipmiblob::BlobInterface* blob;
37     HostIoInterface* io;
38     PciUtilInterface* pci;
39 };
40 
41 } // namespace host_tool
42