summaryrefslogtreecommitdiffstats
path: root/occ_status.cpp
diff options
context:
space:
mode:
authorVishwanatha Subbanna <vishwa@linux.vnet.ibm.com>2017-08-09 21:42:10 +0530
committerVishwanatha Subbanna <vishwa@linux.vnet.ibm.com>2017-08-11 21:15:28 +0530
commitd298105de8ff706e66fe9f45b034219988dd1473 (patch)
tree1c15643a41e297965439f16a51496b50988517d3 /occ_status.cpp
parent30e329add77a72fffeb21e9d3203062a042c6f30 (diff)
downloadopenpower-occ-control-d298105de8ff706e66fe9f45b034219988dd1473.tar.gz
openpower-occ-control-d298105de8ff706e66fe9f45b034219988dd1473.zip
Call Hub FSI scan service prior to doing OCC bind
This is needed to make sure that the /dev/occ files are created that are needed to communicate with OCC device. Also, calling to this service is needed only when the first call to do OCC bind is received. Change-Id: I40466b8b74753b2f2366be385a8b066e912b32e4 Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
Diffstat (limited to 'occ_status.cpp')
-rw-r--r--occ_status.cpp32
1 files changed, 30 insertions, 2 deletions
diff --git a/occ_status.cpp b/occ_status.cpp
index f740dc7..7eafb66 100644
--- a/occ_status.cpp
+++ b/occ_status.cpp
@@ -7,6 +7,11 @@ namespace open_power
namespace occ
{
+bool Status::hubFsiScanDone = false;
+
+// To initiate a FSI rescan
+constexpr auto fsiReScan = "1";
+
// Handles updates to occActive property
bool Status::occActive(bool value)
{
@@ -14,16 +19,26 @@ bool Status::occActive(bool value)
{
if (value)
{
+ if (!hubFsiScanDone)
+ {
+ // Need to do hub scan before we bind
+ this->scanHubFSI();
+ }
+
// Bind the device
device.bind();
// And watch for errors
- device.addErrorWatch();
+ // Commenting until we solve the occ error monitoring issue
+ // TODO: openbmc/openbmc#2126
+ // device.addErrorWatch();
}
else
{
// Stop watching for errors
- device.removeErrorWatch();
+ // Commenting until we solve the occ error monitoring issue
+ // TODO: openbmc/openbmc#2126
+ // device.removeErrorWatch();
// Do the unbind.
device.unBind();
@@ -97,5 +112,18 @@ void Status::hostControlEvent(sdbusplus::message::message& msg)
return;
}
+// Scans the secondary FSI hub to make sure /dev/occ files are populated
+// Write "1" to achieve that
+void Status::scanHubFSI()
+{
+ std::ofstream file(FSI_SCAN_FILE, std::ios::out);
+ file << fsiReScan;
+ file.close();
+
+ // Hub FSI scan has been done. No need to do this for all the OCCs
+ hubFsiScanDone = true;
+ return;
+}
+
} // namespace occ
} // namespace open_power
OpenPOWER on IntegriCloud