1 #pragma once 2 3 #include "interface.hpp" 4 #include "internal/sys.hpp" 5 #include "io.hpp" 6 #include "progress.hpp" 7 8 #include <ipmiblob/blob_interface.hpp> 9 10 #include <cstdint> 11 12 namespace host_tool 13 { 14 15 struct LpcRegion 16 { 17 /* Host LPC address at which the chunk is to be mapped. */ 18 std::uint32_t address; 19 /* Size of the chunk to be mapped. */ 20 std::uint32_t length; 21 } __attribute__((packed)); 22 23 class LpcDataHandler : public DataInterface 24 { 25 public: 26 LpcDataHandler(ipmiblob::BlobInterface* blob, HostIoInterface* io, 27 std::uint32_t address, std::uint32_t length, 28 ProgressInterface* progress, 29 const internal::Sys* sys = &internal::sys_impl) : 30 blob(blob), 31 io(io), address(address), length(length), progress(progress), 32 sys(sys){}; 33 34 bool sendContents(const std::string& input, std::uint16_t session) override; 35 ipmi_flash::FirmwareFlags::UpdateFlags supportedType() const override 36 { 37 return ipmi_flash::FirmwareFlags::UpdateFlags::lpc; 38 } 39 40 private: 41 ipmiblob::BlobInterface* blob; 42 HostIoInterface* io; 43 std::uint32_t address; 44 std::uint32_t length; 45 ProgressInterface* progress; 46 const internal::Sys* sys; 47 }; 48 49 } // namespace host_tool 50