blob: 17367bbd5aa8b07c1adb1feb37a58cd2ab8af345 [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 Venture8e1b2332019-01-17 15:22:45 -08008#include <cstdint>
Patrick Venture664c5bc2019-03-07 08:09:45 -08009#include <ipmiblob/blob_interface.hpp>
Patrick Venture8e1b2332019-01-17 15:22:45 -080010
Patrick Venture9b534f02018-12-13 16:10:02 -080011namespace host_tool
12{
13
Patrick Venture8e1b2332019-01-17 15:22:45 -080014struct 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;
Patrick Venture578dfc52019-01-18 09:46:52 -080020} __attribute__((packed));
Patrick Venture8e1b2332019-01-17 15:22:45 -080021
Patrick Ventureaf696252018-12-11 10:22:14 -080022class LpcDataHandler : public DataInterface
23{
24 public:
Patrick Venture664c5bc2019-03-07 08:09:45 -080025 LpcDataHandler(ipmiblob::BlobInterface* blob, HostIoInterface* io,
Patrick Venture03db87e2019-06-20 07:56:06 -070026 std::uint32_t address, std::uint32_t length,
Patrick Venturecf9b2192019-06-27 12:09:52 -070027 ProgressInterface* progress,
Patrick Venture69a9e192019-01-17 16:02:33 -080028 const internal::Sys* sys = &internal::sys_impl) :
29 blob(blob),
Patrick Venturecf9b2192019-06-27 12:09:52 -070030 io(io), address(address), length(length), progress(progress),
31 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