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 | 8104a52 | 2019-06-19 19:04:36 -0700 | [diff] [blame^] | 25 | long address, long length, |
Patrick Venture | 69a9e19 | 2019-01-17 16:02:33 -0800 | [diff] [blame] | 26 | const internal::Sys* sys = &internal::sys_impl) : |
| 27 | blob(blob), |
Patrick Venture | 8104a52 | 2019-06-19 19:04:36 -0700 | [diff] [blame^] | 28 | io(io), address(address), length(length), sys(sys){}; |
Patrick Venture | af69625 | 2018-12-11 10:22:14 -0800 | [diff] [blame] | 29 | |
| 30 | bool sendContents(const std::string& input, std::uint16_t session) override; |
Patrick Venture | 1d5a31c | 2019-05-20 11:38:22 -0700 | [diff] [blame] | 31 | ipmi_flash::FirmwareBlobHandler::UpdateFlags supportedType() const override |
Patrick Venture | 8a55dcb | 2018-12-12 21:12:58 -0800 | [diff] [blame] | 32 | { |
Patrick Venture | 1d5a31c | 2019-05-20 11:38:22 -0700 | [diff] [blame] | 33 | return ipmi_flash::FirmwareBlobHandler::UpdateFlags::lpc; |
Patrick Venture | 8a55dcb | 2018-12-12 21:12:58 -0800 | [diff] [blame] | 34 | } |
Patrick Venture | 0088759 | 2018-12-11 10:57:06 -0800 | [diff] [blame] | 35 | |
| 36 | private: |
Patrick Venture | 664c5bc | 2019-03-07 08:09:45 -0800 | [diff] [blame] | 37 | ipmiblob::BlobInterface* blob; |
Patrick Venture | 46bdadc | 2019-01-18 09:04:16 -0800 | [diff] [blame] | 38 | HostIoInterface* io; |
Patrick Venture | 8104a52 | 2019-06-19 19:04:36 -0700 | [diff] [blame^] | 39 | long address; |
| 40 | long length; |
Patrick Venture | 69a9e19 | 2019-01-17 16:02:33 -0800 | [diff] [blame] | 41 | const internal::Sys* sys; |
Patrick Venture | af69625 | 2018-12-11 10:22:14 -0800 | [diff] [blame] | 42 | }; |
Patrick Venture | 9b534f0 | 2018-12-13 16:10:02 -0800 | [diff] [blame] | 43 | |
| 44 | } // namespace host_tool |