blob: 7343648162b745edc120857c59352d7f7e9dfd51 [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 Venture8104a522019-06-19 19:04:36 -070025 long address, long length,
Patrick Venture69a9e192019-01-17 16:02:33 -080026 const internal::Sys* sys = &internal::sys_impl) :
27 blob(blob),
Patrick Venture8104a522019-06-19 19:04:36 -070028 io(io), address(address), length(length), sys(sys){};
Patrick Ventureaf696252018-12-11 10:22:14 -080029
30 bool sendContents(const std::string& input, std::uint16_t session) override;
Patrick Venture1d5a31c2019-05-20 11:38:22 -070031 ipmi_flash::FirmwareBlobHandler::UpdateFlags supportedType() const override
Patrick Venture8a55dcb2018-12-12 21:12:58 -080032 {
Patrick Venture1d5a31c2019-05-20 11:38:22 -070033 return ipmi_flash::FirmwareBlobHandler::UpdateFlags::lpc;
Patrick Venture8a55dcb2018-12-12 21:12:58 -080034 }
Patrick Venture00887592018-12-11 10:57:06 -080035
36 private:
Patrick Venture664c5bc2019-03-07 08:09:45 -080037 ipmiblob::BlobInterface* blob;
Patrick Venture46bdadc2019-01-18 09:04:16 -080038 HostIoInterface* io;
Patrick Venture8104a522019-06-19 19:04:36 -070039 long address;
40 long length;
Patrick Venture69a9e192019-01-17 16:02:33 -080041 const internal::Sys* sys;
Patrick Ventureaf696252018-12-11 10:22:14 -080042};
Patrick Venture9b534f02018-12-13 16:10:02 -080043
44} // namespace host_tool