#pragma once #include "data_handler.hpp" #include "window_hw_interface.hpp" #include #include #include namespace ipmi_flash { struct LpcRegion { /* Host LPC address where the chunk is to be mapped. */ std::uint32_t address; /* Size of the chunk to be mapped. */ std::uint32_t length; } __attribute__((packed)); /** * Data Handler for configuration the ASPEED LPC memory region, reading and * writing data. */ class LpcDataHandler : public DataInterface { public: /** * Create an LpcDataHandler. * * @param[in] mapper - pointer to a mapper implementation to use. */ explicit LpcDataHandler(std::unique_ptr mapper) : mapper(std::move(mapper)), initialized(false) {} bool open() override; bool close() override; std::vector copyFrom(std::uint32_t length) override; bool writeMeta(const std::vector& configuration) override; std::vector readMeta() override; private: bool setInitializedAndReturn(bool value); std::unique_ptr mapper; bool initialized; /* The LPC Handler does not take ownership of this, in case there's cleanup * required for close() */ MemorySet memory = {}; /* Offset in reserved memory at which host data arrives. */ /* Size of the chunk of the memory region in use by the host (e.g. * mapped over external block mechanism). */ WindowMapResult mappingResult = {}; }; } // namespace ipmi_flash