pci_handler: add support for opening, mapping, closing
Add support for opening, mapping, closing the aspeed-p2a-ctrl.
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I8a9361d69af0218365ab752ea69f9276bd0e767a
diff --git a/pci_handler.hpp b/pci_handler.hpp
index f99a811..f3ae798 100644
--- a/pci_handler.hpp
+++ b/pci_handler.hpp
@@ -24,10 +24,10 @@
class PciDataHandler : public DataInterface
{
public:
- PciDataHandler(std::uint32_t regionAddress,
+ PciDataHandler(std::uint32_t regionAddress, std::size_t regionSize,
const internal::Sys* sys = &internal::sys_impl) :
regionAddress(regionAddress),
- sys(sys){};
+ memoryRegionSize(regionSize), sys(sys){};
bool open() override;
bool close() override;
@@ -37,7 +37,11 @@
private:
std::uint32_t regionAddress;
+ std::uint32_t memoryRegionSize;
const internal::Sys* sys;
+
+ int mappedFd = -1;
+ std::uint8_t* mapped = nullptr;
static const std::string p2aControlPath;
};