pci_handler: add internal sys object
Add an internal sys object to mock system calls, such as
open/close/ioctl, etc.
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: Ide1e1d765cba34688628852bd836e5727323966f
diff --git a/pci_handler.hpp b/pci_handler.hpp
index 4df7bb7..bb9e429 100644
--- a/pci_handler.hpp
+++ b/pci_handler.hpp
@@ -1,6 +1,7 @@
#pragma once
#include "data_handler.hpp"
+#include "internal/sys.hpp"
#include <cstdint>
#include <vector>
@@ -16,12 +17,16 @@
/**
* Data handler for reading and writing data via the P2A bridge.
+ *
+ * @note: Currently implemented to support only aspeed-p2a-ctrl.
*/
class PciDataHandler : public DataInterface
{
public:
- explicit PciDataHandler(std::uint32_t regionAddress) :
- regionAddress(regionAddress){};
+ PciDataHandler(std::uint32_t regionAddress,
+ const internal::Sys* sys = &internal::sys_impl) :
+ regionAddress(regionAddress),
+ sys(sys){};
bool open() override;
bool close() override;
@@ -31,6 +36,7 @@
private:
std::uint32_t regionAddress;
+ const internal::Sys* sys;
};
} // namespace blobs