summaryrefslogtreecommitdiffstats
path: root/targeting.hpp
diff options
context:
space:
mode:
authorEdward A. James <eajames@us.ibm.com>2017-04-24 14:20:48 -0500
committerEdward A. James <eajames@us.ibm.com>2017-04-27 15:42:38 -0500
commit8316b77b67aac9dea3e7281e2455ad80f509a5b3 (patch)
treeb79e7507b3e8d21ab1c80c3945e8f453ade27abb /targeting.hpp
parentbe407166d0cb22f6967055b426c805e82ac48af8 (diff)
downloadopenpower-proc-control-8316b77b67aac9dea3e7281e2455ad80f509a5b3.tar.gz
openpower-proc-control-8316b77b67aac9dea3e7281e2455ad80f509a5b3.zip
Change FSI behavior for 4.10
Latest FSI code changes paths and endianness, so we need to update Targeting and flip the CFAM data endian when necessary. Also update the test case to use the new 4.10 path style. Change-Id: I35cdedf4b9723ee0f8291d0abf4467dbfd99b334 Signed-off-by: Edward A. James <eajames@us.ibm.com>
Diffstat (limited to 'targeting.hpp')
-rw-r--r--targeting.hpp34
1 files changed, 29 insertions, 5 deletions
diff --git a/targeting.hpp b/targeting.hpp
index 8ab8eda..d5b99fd 100644
--- a/targeting.hpp
+++ b/targeting.hpp
@@ -10,9 +10,16 @@ namespace targeting
{
constexpr auto fsiMasterDevPath =
+ "/sys/devices/platform/gpio-fsi/fsi0/slave@00:00/raw";
+constexpr auto fsiMasterDevPathOld =
"/sys/devices/platform/fsi-master/slave@00:00/raw";
-constexpr auto fsiSlaveBaseDir = "/sys/devices/platform/fsi-master/slave@00:00/hub@00/";
+constexpr auto fsiSlaveBaseDir =
+ "/sys/devices/platform/gpio-fsi/fsi0/slave@00:00/00:00:00:0a/";
+constexpr auto fsiSlaveBaseDirOld =
+ "/sys/devices/platform/fsi-master/slave@00:00/hub@00/";
+
+typedef uint32_t (*swap_endian_t)(uint32_t);
/**
* Represents a specific P9 processor in the system. Used by
@@ -27,9 +34,11 @@ class Target
*
* @param[in] - The logical position of the target
* @param[in] - The sysfs device path
+ * @param[in] - The function pointer for swapping endianness
*/
- Target(size_t position, const std::string& devPath) :
- pos(position), cfamPath(devPath)
+ Target(size_t position, const std::string& devPath,
+ const swap_endian_t swapper) :
+ pos(position), cfamPath(devPath), doSwapEndian(swapper)
{
}
@@ -61,6 +70,16 @@ class Target
*/
int getCFAMFD();
+ /**
+ * Returns correct byte-order data. (May or may not swap it depending
+ * on the function received during construction from Targeting and the
+ * host endianness).
+ */
+ inline uint32_t swapEndian(uint32_t data) const
+ {
+ return doSwapEndian(data);
+ }
+
private:
/**
@@ -77,6 +96,11 @@ class Target
* The file descriptor to use for read/writeCFAMReg
*/
std::unique_ptr<openpower::util::FileDescriptor> cfamFD;
+
+ /**
+ * The function pointer for swapping endianness
+ */
+ const swap_endian_t doSwapEndian;
};
@@ -137,12 +161,12 @@ class Targeting
/**
* The path to the fsi-master sysfs device to access
*/
- const std::string fsiMasterPath;
+ std::string fsiMasterPath;
/**
* The path to the fsi slave sysfs base directory
*/
- const std::string fsiSlaveBasePath;
+ std::string fsiSlaveBasePath;
/**
* A container of Targets in the system
OpenPOWER on IntegriCloud