blob: 1786c9465ba8fda3fb60cd559f1f81aedde3b0ec [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) :
30 blob(blob),
Patrick Venturecf9b2192019-06-27 12:09:52 -070031 io(io), address(address), length(length), progress(progress),
32 sys(sys){};
Patrick Ventureaf696252018-12-11 10:22:14 -080033
34 bool sendContents(const std::string& input, std::uint16_t session) override;
Patrick Venture84778b82019-06-26 20:11:09 -070035 ipmi_flash::FirmwareFlags::UpdateFlags supportedType() const override
Patrick Venture8a55dcb2018-12-12 21:12:58 -080036 {
Patrick Venture84778b82019-06-26 20:11:09 -070037 return ipmi_flash::FirmwareFlags::UpdateFlags::lpc;
Patrick Venture8a55dcb2018-12-12 21:12:58 -080038 }
Patrick Venture00887592018-12-11 10:57:06 -080039
40 private:
Patrick Venture664c5bc2019-03-07 08:09:45 -080041 ipmiblob::BlobInterface* blob;
Patrick Venture46bdadc2019-01-18 09:04:16 -080042 HostIoInterface* io;
Patrick Venture03db87e2019-06-20 07:56:06 -070043 std::uint32_t address;
44 std::uint32_t length;
Patrick Venturecf9b2192019-06-27 12:09:52 -070045 ProgressInterface* progress;
Patrick Venture69a9e192019-01-17 16:02:33 -080046 const internal::Sys* sys;
Patrick Ventureaf696252018-12-11 10:22:14 -080047};
Patrick Venture9b534f02018-12-13 16:10:02 -080048
49} // namespace host_tool