Patrick Venture | e772842 | 2018-11-14 20:16:33 -0800 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <cstdint> |
| 4 | #include <utility> |
| 5 | |
| 6 | namespace blobs |
| 7 | { |
| 8 | |
| 9 | /** |
Patrick Venture | 5251da9 | 2019-01-17 11:25:26 -0800 | [diff] [blame^] | 10 | * 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 Venture | e772842 | 2018-11-14 20:16:33 -0800 | [diff] [blame] | 13 | */ |
Patrick Venture | 5251da9 | 2019-01-17 11:25:26 -0800 | [diff] [blame^] | 14 | class HardwareMapperInterface |
Patrick Venture | e772842 | 2018-11-14 20:16:33 -0800 | [diff] [blame] | 15 | { |
| 16 | public: |
Patrick Venture | 5251da9 | 2019-01-17 11:25:26 -0800 | [diff] [blame^] | 17 | virtual ~HardwareMapperInterface() = default; |
Patrick Venture | e772842 | 2018-11-14 20:16:33 -0800 | [diff] [blame] | 18 | |
| 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 |