blob: 2fe7e087be72831de87109ffafeffbfc2bf94c1d [file] [log] [blame]
Patrick Ventureaf696252018-12-11 10:22:14 -08001#pragma once
2
3#include "interface.hpp"
Patrick Venture69a9e192019-01-17 16:02:33 -08004#include "internal/sys.hpp"
Patrick Venture46bdadc2019-01-18 09:04:16 -08005#include "io.hpp"
Patrick Venturecf9b2192019-06-27 12:09:52 -07006#include "progress.hpp"
Patrick Ventureaf696252018-12-11 10:22:14 -08007
Patrick Venture664c5bc2019-03-07 08:09:45 -08008#include <ipmiblob/blob_interface.hpp>
Patrick Venture8e1b2332019-01-17 15:22:45 -08009
Patrick Venture9b37b092020-05-28 20:58:57 -070010#include <cstdint>
11
Patrick Venture9b534f02018-12-13 16:10:02 -080012namespace host_tool
13{
14
Patrick Venture8e1b2332019-01-17 15:22:45 -080015struct 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;
Patrick Venture578dfc52019-01-18 09:46:52 -080021} __attribute__((packed));
Patrick Venture8e1b2332019-01-17 15:22:45 -080022
Patrick Ventureaf696252018-12-11 10:22:14 -080023class LpcDataHandler : public DataInterface
24{
25 public:
Patrick Venture664c5bc2019-03-07 08:09:45 -080026 LpcDataHandler(ipmiblob::BlobInterface* blob, HostIoInterface* io,
Patrick Venture03db87e2019-06-20 07:56:06 -070027 std::uint32_t address, std::uint32_t length,
Patrick Venturecf9b2192019-06-27 12:09:52 -070028 ProgressInterface* progress,
Patrick Venture69a9e192019-01-17 16:02:33 -080029 const internal::Sys* sys = &internal::sys_impl) :
Patrick Williams42a44c22024-08-16 15:21:32 -040030 blob(blob), io(io), address(address), length(length),
31 progress(progress), sys(sys) {};
Patrick Ventureaf696252018-12-11 10:22:14 -080032
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 Venture8a55dcb2018-12-12 21:12:58 -080035 {
Patrick Venture84778b82019-06-26 20:11:09 -070036 return ipmi_flash::FirmwareFlags::UpdateFlags::lpc;
Patrick Venture8a55dcb2018-12-12 21:12:58 -080037 }
Patrick Venture00887592018-12-11 10:57:06 -080038
39 private:
Patrick Venture664c5bc2019-03-07 08:09:45 -080040 ipmiblob::BlobInterface* blob;
Patrick Venture46bdadc2019-01-18 09:04:16 -080041 HostIoInterface* io;
Patrick Venture03db87e2019-06-20 07:56:06 -070042 std::uint32_t address;
43 std::uint32_t length;
Patrick Venturecf9b2192019-06-27 12:09:52 -070044 ProgressInterface* progress;
Patrick Venture69a9e192019-01-17 16:02:33 -080045 const internal::Sys* sys;
Patrick Ventureaf696252018-12-11 10:22:14 -080046};
Patrick Venture9b534f02018-12-13 16:10:02 -080047
48} // namespace host_tool