PEL: devcallouts: Determine access type
Add a function to determine if the device path represents an I2C, FSI,
FSI-I2C, or FSI-SPI attached device.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: Ie58452e7988938e9b701357bbb96252be971902f
diff --git a/extensions/openpower-pels/device_callouts.hpp b/extensions/openpower-pels/device_callouts.hpp
index 2945f25..1f559c2 100644
--- a/extensions/openpower-pels/device_callouts.hpp
+++ b/extensions/openpower-pels/device_callouts.hpp
@@ -1,7 +1,5 @@
#pragma once
-#include "pel_types.hpp"
-
#include <filesystem>
#include <nlohmann/json.hpp>
#include <string>
@@ -123,6 +121,18 @@
{
/**
+ * @brief The different callout path types
+ */
+enum class CalloutType
+{
+ i2c,
+ fsi,
+ fsii2c,
+ fsispi,
+ unknown
+};
+
+/**
* @brief Returns the path to the JSON file to look up callouts in.
*
* @param[in] compatibleList - The list of compatible names for this
@@ -145,5 +155,16 @@
std::vector<device_callouts::Callout>
calloutI2C(size_t i2CBus, uint8_t i2cAddress,
const nlohmann::json& calloutJSON);
+
+/**
+ * @brief Determines the type of the path (FSI, I2C, etc) based
+ * on tokens in the device path.
+ *
+ * @param[in] devPath - The device path
+ *
+ * @return CalloutType - The callout type
+ */
+CalloutType getCalloutType(const std::string& devPath);
+
} // namespace util
} // namespace openpower::pels::device_callouts