blob: bdcf7be21674c3b39811fc6eecbb81f8547df5ed [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 Ventureaf696252018-12-11 10:22:14 -08006
Patrick Venture8e1b2332019-01-17 15:22:45 -08007#include <cstdint>
Patrick Venture664c5bc2019-03-07 08:09:45 -08008#include <ipmiblob/blob_interface.hpp>
Patrick Venture8e1b2332019-01-17 15:22:45 -08009
Patrick Venture9b534f02018-12-13 16:10:02 -080010namespace host_tool
11{
12
Patrick Venture8e1b2332019-01-17 15:22:45 -080013struct LpcRegion
14{
15 /* Host LPC address at which the chunk is to be mapped. */
16 std::uint32_t address;
17 /* Size of the chunk to be mapped. */
18 std::uint32_t length;
Patrick Venture578dfc52019-01-18 09:46:52 -080019} __attribute__((packed));
Patrick Venture8e1b2332019-01-17 15:22:45 -080020
Patrick Ventureaf696252018-12-11 10:22:14 -080021class LpcDataHandler : public DataInterface
22{
23 public:
Patrick Venture664c5bc2019-03-07 08:09:45 -080024 LpcDataHandler(ipmiblob::BlobInterface* blob, HostIoInterface* io,
Patrick Venture69a9e192019-01-17 16:02:33 -080025 const internal::Sys* sys = &internal::sys_impl) :
26 blob(blob),
Patrick Venture46bdadc2019-01-18 09:04:16 -080027 io(io), sys(sys){};
Patrick Ventureaf696252018-12-11 10:22:14 -080028
29 bool sendContents(const std::string& input, std::uint16_t session) override;
Patrick Venture1d5a31c2019-05-20 11:38:22 -070030 ipmi_flash::FirmwareBlobHandler::UpdateFlags supportedType() const override
Patrick Venture8a55dcb2018-12-12 21:12:58 -080031 {
Patrick Venture1d5a31c2019-05-20 11:38:22 -070032 return ipmi_flash::FirmwareBlobHandler::UpdateFlags::lpc;
Patrick Venture8a55dcb2018-12-12 21:12:58 -080033 }
Patrick Venture00887592018-12-11 10:57:06 -080034
35 private:
Patrick Venture664c5bc2019-03-07 08:09:45 -080036 ipmiblob::BlobInterface* blob;
Patrick Venture46bdadc2019-01-18 09:04:16 -080037 HostIoInterface* io;
Patrick Venture69a9e192019-01-17 16:02:33 -080038 const internal::Sys* sys;
Patrick Ventureaf696252018-12-11 10:22:14 -080039};
Patrick Venture9b534f02018-12-13 16:10:02 -080040
41} // namespace host_tool