rename lpcmapperinterface to hardwaremapperinterface
The P2A bridge and the LPC bridge both require mapping and copying data
out. In the case of the aspeed-lpc-ctrl driver, the copyFrom will be
handled via mmap. However, the similarities between all Host-BMC window
hardware supports making this interface more generic.
Change-Id: I68a325cac4cf8415b0c6f069faf78a9520ca14fd
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/window_hw_interface.hpp b/window_hw_interface.hpp
new file mode 100644
index 0000000..a9de4dd
--- /dev/null
+++ b/window_hw_interface.hpp
@@ -0,0 +1,34 @@
+#pragma once
+
+#include <cstdint>
+#include <utility>
+
+namespace blobs
+{
+
+/**
+ * Different LPC (or P2a) memory map implementations may require different
+ * mechanisms for specific tasks such as mapping the memory window or copying
+ * out data.
+ */
+class HardwareMapperInterface
+{
+ public:
+ virtual ~HardwareMapperInterface() = default;
+
+ /**
+ * Returns a windowOffset and windowSize if the requested window was mapped.
+ *
+ * TODO: If the length requested is too large, windowSize will be written
+ * with the max size that the BMC can map and returns false.
+ *
+ * @param[in] address - The address for mapping (passed to LPC window)
+ * @param[in] length - The length of the region
+ * @return windowOffset, windowSize - The offset into the window and
+ * length of the region. On failure, length is set to 0.
+ */
+ virtual std::pair<std::uint32_t, std::uint32_t>
+ mapWindow(std::uint32_t address, std::uint32_t length) = 0;
+};
+
+} // namespace blobs