blob: 8292143a8585e026cbf69549b16b1622b82625a6 [file] [log] [blame]
Brandon Kim1d0c3562022-06-06 20:50:57 -07001#pragma once
2
3#include <cstdint>
4#include <span>
5#include <vector>
6
7namespace bios_bmc_smm_error_logger
8{
9
10/**
11 * Each data transport mechanism must implement the DataInterface.
12 */
13class DataInterface
14{
15 public:
16 virtual ~DataInterface() = default;
17
18 /**
19 * Read bytes from shared buffer (blocking call).
20 *
Brandon Kim35d43352022-06-16 11:13:36 -070021 * @param[in] offset - offset to read from relative to MMIO space
Brandon Kim1d0c3562022-06-06 20:50:57 -070022 * @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 *
Brandon Kim35d43352022-06-16 11:13:36 -070031 * @param[in] offset - offset to write to relative to MMIO space
Brandon Kim1d0c3562022-06-06 20:50:57 -070032 * @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