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