Add option to skip p2a bridge disable
Add a new constructor for P2aDataHandler with skipBridgeDisable bool to
enable an option to skip disableBridge() in AspeedPciBridge and
NuvotonPciBridge.
Signed-off-by: Willy Tu <wltu@google.com>
Change-Id: I439bbaa2b7295adc54a8aa98157db60a7e820837
diff --git a/tools/pci.hpp b/tools/pci.hpp
index 3aeae7b..6c901ca 100644
--- a/tools/pci.hpp
+++ b/tools/pci.hpp
@@ -82,15 +82,18 @@
class NuvotonPciBridge : public PciAccessBridge
{
public:
- explicit NuvotonPciBridge(const PciAccess* pci) :
- PciAccessBridge(&match, bar, dataOffset, dataLength, pci)
+ explicit NuvotonPciBridge(const PciAccess* pci,
+ bool skipBridgeDisable = false) :
+ PciAccessBridge(&match, bar, dataOffset, dataLength, pci),
+ skipBridgeDisable(skipBridgeDisable)
{
enableBridge();
}
~NuvotonPciBridge()
{
- disableBridge();
+ if (!skipBridgeDisable)
+ disableBridge();
}
private:
@@ -110,20 +113,25 @@
void enableBridge();
void disableBridge();
+
+ bool skipBridgeDisable;
};
class AspeedPciBridge : public PciAccessBridge
{
public:
- explicit AspeedPciBridge(const PciAccess* pci) :
- PciAccessBridge(&match, bar, dataOffset, dataLength, pci)
+ explicit AspeedPciBridge(const PciAccess* pci,
+ bool skipBridgeDisable = false) :
+ PciAccessBridge(&match, bar, dataOffset, dataLength, pci),
+ skipBridgeDisable(skipBridgeDisable)
{
enableBridge();
}
~AspeedPciBridge()
{
- disableBridge();
+ if (!skipBridgeDisable)
+ disableBridge();
}
void configure(const ipmi_flash::PciConfigResponse& configResp) override;
@@ -146,6 +154,8 @@
void enableBridge();
void disableBridge();
+
+ bool skipBridgeDisable;
};
} // namespace host_tool