summaryrefslogtreecommitdiffstats
path: root/occ_finder.hpp
diff options
context:
space:
mode:
authorVishwanatha Subbanna <vishwa@linux.vnet.ibm.com>2017-08-22 16:06:11 +0530
committerVishwanatha Subbanna <vishwa@linux.vnet.ibm.com>2017-08-23 18:56:41 +0530
commit3ace7576176afed9196fb308c766de6b1252d3ea (patch)
tree67682cab04671d496086c9043e1c69e98ba4c3b8 /occ_finder.hpp
parent1ec291fbaddf4f2b44cdfff3891d8782f28fb2c9 (diff)
downloadopenpower-occ-control-3ace7576176afed9196fb308c766de6b1252d3ea.tar.gz
openpower-occ-control-3ace7576176afed9196fb308c766de6b1252d3ea.zip
Only consider CPUs that are Present and Functional
OCC control application looks at CPU inventory and creates D-Bus objects. In some of the cases, hostboot marks the CPU as Not Present but also marks Functional and this results in creating an OCC object for the CPU which is not present. Need to filter CPUs based on Present and Functional properties to address the issue and this commit adds that support. Fixes openbmc/openbmc#2024 Change-Id: I58a06bfd09131bc3deba8f132547095c53bde5e1 Signed-off-by: Vishwanatha Subbanna <vishwa@linux.vnet.ibm.com>
Diffstat (limited to 'occ_finder.hpp')
-rw-r--r--occ_finder.hpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/occ_finder.hpp b/occ_finder.hpp
index c096c4b..557d468 100644
--- a/occ_finder.hpp
+++ b/occ_finder.hpp
@@ -11,6 +11,15 @@ namespace occ
namespace finder
{
+// Map of property and interface
+// This is used to filter the OCCs based on the property value
+using Interface = std::string;
+using Property = std::string;
+
+using Value = bool;
+using Match = std::tuple<Interface, Property, Value>;
+using Criteria = std::vector<Match>;
+
/** @brief Get OCC objects on the system by mapping them to CPU inventory
* @returns vector of occ objects, such as occ0, occ1, and so on.
*
@@ -18,6 +27,39 @@ namespace finder
*/
std::vector<std::string> get(sdbusplus::bus::bus& bus);
+/** @brief Returns true if the inventory item matches the criteria
+ *
+ * @param[in] bus - sdbusplus handler
+ * @param[in] path - D-Bus path
+ * @param[in] service - D-Bus service name
+ * @param[in] match - Criteria match vector
+ *
+ * @return true on match, false otherwise
+ */
+bool matchCriteria(sdbusplus::bus::bus& bus,
+ const std::string& path,
+ const std::string& service,
+ const Criteria& match);
+
+/** @brief Gets the value associated with the given object
+ * and the interface.
+ *
+ * @param[in] bus - sdbusplus handler
+ * @param[in] service - D-Bus service name.
+ * @param[in] objPath - D-Bus object path.
+ * @param[in] interface - D-Bus interface.
+ * @param[in] property - Name of the property.
+ *
+ * @return Value of the property
+ */
+
+template <typename T>
+T getDbusProperty(sdbusplus::bus::bus& bus,
+ const std::string& service,
+ const std::string& objPath,
+ const std::string& interface,
+ const std::string& property);
+
} // namespace finder
} // namespace occ
} // namespace open_power
OpenPOWER on IntegriCloud