blob: a9de4ddbde4a9b8a9be3c62c898462113466ce45 [file] [log] [blame]
Patrick Venturee7728422018-11-14 20:16:33 -08001#pragma once
2
3#include <cstdint>
4#include <utility>
5
6namespace blobs
7{
8
9/**
Patrick Venture5251da92019-01-17 11:25:26 -080010 * Different LPC (or P2a) memory map implementations may require different
11 * mechanisms for specific tasks such as mapping the memory window or copying
12 * out data.
Patrick Venturee7728422018-11-14 20:16:33 -080013 */
Patrick Venture5251da92019-01-17 11:25:26 -080014class HardwareMapperInterface
Patrick Venturee7728422018-11-14 20:16:33 -080015{
16 public:
Patrick Venture5251da92019-01-17 11:25:26 -080017 virtual ~HardwareMapperInterface() = default;
Patrick Venturee7728422018-11-14 20:16:33 -080018
19 /**
20 * Returns a windowOffset and windowSize if the requested window was mapped.
21 *
22 * TODO: If the length requested is too large, windowSize will be written
23 * with the max size that the BMC can map and returns false.
24 *
25 * @param[in] address - The address for mapping (passed to LPC window)
26 * @param[in] length - The length of the region
27 * @return windowOffset, windowSize - The offset into the window and
28 * length of the region. On failure, length is set to 0.
29 */
30 virtual std::pair<std::uint32_t, std::uint32_t>
31 mapWindow(std::uint32_t address, std::uint32_t length) = 0;
32};
33
34} // namespace blobs