blob: 21c776dca676fa4a5c7abc79cc2a7db415933b13 [file] [log] [blame]
Patrick Ventureaf696252018-12-11 10:22:14 -08001#pragma once
2
Patrick Venture00887592018-12-11 10:57:06 -08003#include "blob_interface.hpp"
Patrick Ventureaf696252018-12-11 10:22:14 -08004#include "interface.hpp"
Patrick Venture69a9e192019-01-17 16:02:33 -08005#include "internal/sys.hpp"
Patrick Ventureaf696252018-12-11 10:22:14 -08006
Patrick Venture8e1b2332019-01-17 15:22:45 -08007#include <cstdint>
8
Patrick Venture9b534f02018-12-13 16:10:02 -08009namespace host_tool
10{
11
Patrick Venture8e1b2332019-01-17 15:22:45 -080012struct LpcRegion
13{
14 /* Host LPC address at which the chunk is to be mapped. */
15 std::uint32_t address;
16 /* Size of the chunk to be mapped. */
17 std::uint32_t length;
Patrick Venture578dfc52019-01-18 09:46:52 -080018} __attribute__((packed));
Patrick Venture8e1b2332019-01-17 15:22:45 -080019
Patrick Ventureaf696252018-12-11 10:22:14 -080020class LpcDataHandler : public DataInterface
21{
22 public:
Patrick Venture69a9e192019-01-17 16:02:33 -080023 LpcDataHandler(BlobInterface* blob,
24 const internal::Sys* sys = &internal::sys_impl) :
25 blob(blob),
26 sys(sys){};
Patrick Ventureaf696252018-12-11 10:22:14 -080027
28 bool sendContents(const std::string& input, std::uint16_t session) override;
Patrick Venture8a55dcb2018-12-12 21:12:58 -080029 blobs::FirmwareBlobHandler::UpdateFlags supportedType() const override
30 {
Patrick Venture55c53742019-01-17 15:54:09 -080031 return blobs::FirmwareBlobHandler::UpdateFlags::lpc;
Patrick Venture8a55dcb2018-12-12 21:12:58 -080032 }
Patrick Venture00887592018-12-11 10:57:06 -080033
34 private:
35 BlobInterface* blob;
Patrick Venture69a9e192019-01-17 16:02:33 -080036 const internal::Sys* sys;
Patrick Ventureaf696252018-12-11 10:22:14 -080037};
Patrick Venture9b534f02018-12-13 16:10:02 -080038
39} // namespace host_tool