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 | cf9b219 | 2019-06-27 12:09:52 -0700 | [diff] [blame] | 6 | #include "progress.hpp" |
Patrick Venture | af69625 | 2018-12-11 10:22:14 -0800 | [diff] [blame] | 7 | |
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 | 9b37b09 | 2020-05-28 20:58:57 -0700 | [diff] [blame^] | 10 | #include <cstdint> |
| 11 | |
Patrick Venture | 9b534f0 | 2018-12-13 16:10:02 -0800 | [diff] [blame] | 12 | namespace host_tool |
| 13 | { |
| 14 | |
Patrick Venture | 8e1b233 | 2019-01-17 15:22:45 -0800 | [diff] [blame] | 15 | struct LpcRegion |
| 16 | { |
| 17 | /* Host LPC address at which the chunk is to be mapped. */ |
| 18 | std::uint32_t address; |
| 19 | /* Size of the chunk to be mapped. */ |
| 20 | std::uint32_t length; |
Patrick Venture | 578dfc5 | 2019-01-18 09:46:52 -0800 | [diff] [blame] | 21 | } __attribute__((packed)); |
Patrick Venture | 8e1b233 | 2019-01-17 15:22:45 -0800 | [diff] [blame] | 22 | |
Patrick Venture | af69625 | 2018-12-11 10:22:14 -0800 | [diff] [blame] | 23 | class LpcDataHandler : public DataInterface |
| 24 | { |
| 25 | public: |
Patrick Venture | 664c5bc | 2019-03-07 08:09:45 -0800 | [diff] [blame] | 26 | LpcDataHandler(ipmiblob::BlobInterface* blob, HostIoInterface* io, |
Patrick Venture | 03db87e | 2019-06-20 07:56:06 -0700 | [diff] [blame] | 27 | std::uint32_t address, std::uint32_t length, |
Patrick Venture | cf9b219 | 2019-06-27 12:09:52 -0700 | [diff] [blame] | 28 | ProgressInterface* progress, |
Patrick Venture | 69a9e19 | 2019-01-17 16:02:33 -0800 | [diff] [blame] | 29 | const internal::Sys* sys = &internal::sys_impl) : |
| 30 | blob(blob), |
Patrick Venture | cf9b219 | 2019-06-27 12:09:52 -0700 | [diff] [blame] | 31 | io(io), address(address), length(length), progress(progress), |
| 32 | sys(sys){}; |
Patrick Venture | af69625 | 2018-12-11 10:22:14 -0800 | [diff] [blame] | 33 | |
| 34 | bool sendContents(const std::string& input, std::uint16_t session) override; |
Patrick Venture | 84778b8 | 2019-06-26 20:11:09 -0700 | [diff] [blame] | 35 | ipmi_flash::FirmwareFlags::UpdateFlags supportedType() const override |
Patrick Venture | 8a55dcb | 2018-12-12 21:12:58 -0800 | [diff] [blame] | 36 | { |
Patrick Venture | 84778b8 | 2019-06-26 20:11:09 -0700 | [diff] [blame] | 37 | return ipmi_flash::FirmwareFlags::UpdateFlags::lpc; |
Patrick Venture | 8a55dcb | 2018-12-12 21:12:58 -0800 | [diff] [blame] | 38 | } |
Patrick Venture | 0088759 | 2018-12-11 10:57:06 -0800 | [diff] [blame] | 39 | |
| 40 | private: |
Patrick Venture | 664c5bc | 2019-03-07 08:09:45 -0800 | [diff] [blame] | 41 | ipmiblob::BlobInterface* blob; |
Patrick Venture | 46bdadc | 2019-01-18 09:04:16 -0800 | [diff] [blame] | 42 | HostIoInterface* io; |
Patrick Venture | 03db87e | 2019-06-20 07:56:06 -0700 | [diff] [blame] | 43 | std::uint32_t address; |
| 44 | std::uint32_t length; |
Patrick Venture | cf9b219 | 2019-06-27 12:09:52 -0700 | [diff] [blame] | 45 | ProgressInterface* progress; |
Patrick Venture | 69a9e19 | 2019-01-17 16:02:33 -0800 | [diff] [blame] | 46 | const internal::Sys* sys; |
Patrick Venture | af69625 | 2018-12-11 10:22:14 -0800 | [diff] [blame] | 47 | }; |
Patrick Venture | 9b534f0 | 2018-12-13 16:10:02 -0800 | [diff] [blame] | 48 | |
| 49 | } // namespace host_tool |