1 #pragma once 2 3 #include <cstdint> 4 #include <span> 5 #include <vector> 6 7 namespace bios_bmc_smm_error_logger 8 { 9 10 /** 11 * Each data transport mechanism must implement the DataInterface. 12 */ 13 class DataInterface 14 { 15 public: 16 virtual ~DataInterface() = default; 17 18 /** 19 * Read bytes from shared buffer (blocking call). 20 * 21 * @param[in] offset - offset to read from relative to MMIO space 22 * @param[in] length - number of bytes to read 23 * @return the bytes read 24 */ 25 virtual std::vector<uint8_t> read(const uint32_t offset, 26 const uint32_t length) = 0; 27 28 /** 29 * Write bytes to shared buffer. 30 * 31 * @param[in] offset - offset to write to relative to MMIO space 32 * @param[in] bytes - byte vector of data. 33 * @return return the byte length written 34 */ 35 virtual uint32_t write(const uint32_t offset, 36 const std::span<const uint8_t> bytes) = 0; 37 38 /** 39 * Getter for Memory Region Size 40 * 41 * @return return Memory Region size allocated 42 */ 43 virtual uint32_t getMemoryRegionSize() = 0; 44 }; 45 46 } // namespace bios_bmc_smm_error_logger 47