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