Patrick Venture | af69625 | 2018-12-11 10:22:14 -0800 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include "interface.hpp" |
Patrick Venture | 69a9e19 | 2019-01-17 16:02:33 -0800 | [diff] [blame] | 4 | #include "internal/sys.hpp" |
Patrick Venture | 46bdadc | 2019-01-18 09:04:16 -0800 | [diff] [blame] | 5 | #include "io.hpp" |
Patrick Venture | af69625 | 2018-12-11 10:22:14 -0800 | [diff] [blame] | 6 | |
Patrick Venture | 8e1b233 | 2019-01-17 15:22:45 -0800 | [diff] [blame] | 7 | #include <cstdint> |
Patrick Venture | 664c5bc | 2019-03-07 08:09:45 -0800 | [diff] [blame^] | 8 | #include <ipmiblob/blob_interface.hpp> |
Patrick Venture | 8e1b233 | 2019-01-17 15:22:45 -0800 | [diff] [blame] | 9 | |
Patrick Venture | 9b534f0 | 2018-12-13 16:10:02 -0800 | [diff] [blame] | 10 | namespace host_tool |
| 11 | { |
| 12 | |
Patrick Venture | 8e1b233 | 2019-01-17 15:22:45 -0800 | [diff] [blame] | 13 | struct 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 Venture | 578dfc5 | 2019-01-18 09:46:52 -0800 | [diff] [blame] | 19 | } __attribute__((packed)); |
Patrick Venture | 8e1b233 | 2019-01-17 15:22:45 -0800 | [diff] [blame] | 20 | |
Patrick Venture | af69625 | 2018-12-11 10:22:14 -0800 | [diff] [blame] | 21 | class LpcDataHandler : public DataInterface |
| 22 | { |
| 23 | public: |
Patrick Venture | 664c5bc | 2019-03-07 08:09:45 -0800 | [diff] [blame^] | 24 | LpcDataHandler(ipmiblob::BlobInterface* blob, HostIoInterface* io, |
Patrick Venture | 69a9e19 | 2019-01-17 16:02:33 -0800 | [diff] [blame] | 25 | const internal::Sys* sys = &internal::sys_impl) : |
| 26 | blob(blob), |
Patrick Venture | 46bdadc | 2019-01-18 09:04:16 -0800 | [diff] [blame] | 27 | io(io), sys(sys){}; |
Patrick Venture | af69625 | 2018-12-11 10:22:14 -0800 | [diff] [blame] | 28 | |
| 29 | bool sendContents(const std::string& input, std::uint16_t session) override; |
Patrick Venture | 8a55dcb | 2018-12-12 21:12:58 -0800 | [diff] [blame] | 30 | blobs::FirmwareBlobHandler::UpdateFlags supportedType() const override |
| 31 | { |
Patrick Venture | 55c5374 | 2019-01-17 15:54:09 -0800 | [diff] [blame] | 32 | return blobs::FirmwareBlobHandler::UpdateFlags::lpc; |
Patrick Venture | 8a55dcb | 2018-12-12 21:12:58 -0800 | [diff] [blame] | 33 | } |
Patrick Venture | 0088759 | 2018-12-11 10:57:06 -0800 | [diff] [blame] | 34 | |
| 35 | private: |
Patrick Venture | 664c5bc | 2019-03-07 08:09:45 -0800 | [diff] [blame^] | 36 | ipmiblob::BlobInterface* blob; |
Patrick Venture | 46bdadc | 2019-01-18 09:04:16 -0800 | [diff] [blame] | 37 | HostIoInterface* io; |
Patrick Venture | 69a9e19 | 2019-01-17 16:02:33 -0800 | [diff] [blame] | 38 | const internal::Sys* sys; |
Patrick Venture | af69625 | 2018-12-11 10:22:14 -0800 | [diff] [blame] | 39 | }; |
Patrick Venture | 9b534f0 | 2018-12-13 16:10:02 -0800 | [diff] [blame] | 40 | |
| 41 | } // namespace host_tool |