lpc_aspeed: implement mapRegion as part of copyFrom
For the lpc aspeed ctrl driver, it'll use mmap to map the memory region
instead of using an ioctl.
Change-Id: I884fb5713b4c853cc84c8e994969b385392bdc95
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/lpc_aspeed.hpp b/lpc_aspeed.hpp
index e89662c..56d1479 100644
--- a/lpc_aspeed.hpp
+++ b/lpc_aspeed.hpp
@@ -30,9 +30,17 @@
std::vector<std::uint8_t> copyFrom(std::uint32_t length) override;
+ /**
+ * Attempt to mmap the region.
+ *
+ * @return true on success, false otherwise.
+ */
+ bool mapRegion();
+
private:
static const std::string lpcControlPath;
int mappedFd = -1;
+ std::uint8_t* mappedRegion = nullptr;
std::uint32_t regionAddress;
std::size_t regionSize;
const internal::Sys* sys;