From f7d9e76dc7094214ab11bb4cb21ff6bd853ce750 Mon Sep 17 00:00:00 2001 From: Eddie James Date: Thu, 28 Jun 2018 09:06:16 -0500 Subject: Revert "Add Bus class to reset OCC bus driver" This reverts commit b5508d7a0fd9202c37cc02aea045f189e991dd09. The new SBEFIFO driver handles recovery on it's own, making this code unnecessary. Change-Id: I65dfb0ff4a67c6f7e225c6dcf68366768236f47a Signed-off-by: Eddie James --- Makefile.am | 2 -- configure.ac | 3 --- occ_bus.cpp | 21 --------------------- occ_bus.hpp | 56 -------------------------------------------------------- occ_device.hpp | 41 +++++++++++++++-------------------------- occ_status.hpp | 1 - 6 files changed, 15 insertions(+), 109 deletions(-) delete mode 100644 occ_bus.cpp delete mode 100644 occ_bus.hpp diff --git a/Makefile.am b/Makefile.am index fddf9e7..b883f94 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,7 +4,6 @@ noinst_HEADERS = \ occ_pass_through.hpp \ occ_status.hpp \ powercap.hpp \ - occ_bus.hpp \ occ_errors.hpp \ occ_events.hpp \ occ_finder.hpp \ @@ -22,7 +21,6 @@ libocc_control_la_SOURCES = \ occ_pass_through.cpp \ occ_manager.cpp \ occ_status.cpp \ - occ_bus.cpp \ occ_device.cpp \ occ_errors.cpp \ occ_presence.cpp \ diff --git a/configure.ac b/configure.ac index 7ac868c..149e0d0 100644 --- a/configure.ac +++ b/configure.ac @@ -105,7 +105,6 @@ AC_ARG_VAR(OCC_MASTER_NAME, [The OCC master object name]) AS_IF([test "x$OCC_MASTER_NAME" == "x"], [OCC_MASTER_NAME="occ-hwmon.1"]) AC_DEFINE_UNQUOTED([OCC_MASTER_NAME], ["$OCC_MASTER_NAME"], [The OCC master object name]) -AC_ARG_VAR(OCC_BUS_PATH, [The OCC bus device path]) AC_ARG_VAR(OCC_HWMON_PATH, [The OCC hwmon path]) AC_ARG_VAR(DEV_PATH, [The device path]) AC_ARG_VAR(I2C_OCC_DEVICE_NAME, [The device name of i2c occ hwmon]) @@ -116,11 +115,9 @@ AS_IF([test "x$enable_i2c_occ" == "xyes"], AS_IF([test "x$I2C_OCC_DEVICE_NAME" == "x"], [I2C_OCC_DEVICE_NAME="p8-occ-hwmon"]), # Else, define occ hwmon path for FSI - AS_IF([test "x$OCC_BUS_PATH" == "x"], [OCC_BUS_PATH="/sys/bus/fsi/drivers/sbefifo/"]) AS_IF([test "x$OCC_HWMON_PATH" == "x"], [OCC_HWMON_PATH="/sys/bus/platform/drivers/occ-hwmon/"]) AS_IF([test "x$DEV_PATH" == "x"], [DEV_PATH="/sys/bus/platform/devices/"]), ) -AC_DEFINE_UNQUOTED([OCC_BUS_PATH], ["$OCC_BUS_PATH"], [The OCC bus device path]) AC_DEFINE_UNQUOTED([OCC_HWMON_PATH], ["$OCC_HWMON_PATH"], [The OCC hwmon path]) AC_DEFINE_UNQUOTED([DEV_PATH], ["$DEV_PATH"], [The device path]) AC_DEFINE_UNQUOTED([I2C_OCC_DEVICE_NAME], ["$I2C_OCC_DEVICE_NAME"], [The device name of i2c occ hwmon]) diff --git a/occ_bus.cpp b/occ_bus.cpp deleted file mode 100644 index 27be21b..0000000 --- a/occ_bus.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "occ_device.hpp" -#include "occ_bus.hpp" - -namespace open_power -{ -namespace occ -{ - -fs::path Bus::bindPath = fs::path(OCC_BUS_PATH) / "bind"; -fs::path Bus::unBindPath = fs::path(OCC_BUS_PATH) / "unbind"; - -void Bus::reset() const -{ -#ifndef I2C_OCC - Device::write(unBindPath, config); - Device::write(bindPath, config); -#endif -} - -} // namespace occ -} // namespace open_power diff --git a/occ_bus.hpp b/occ_bus.hpp deleted file mode 100644 index bdb4fa4..0000000 --- a/occ_bus.hpp +++ /dev/null @@ -1,56 +0,0 @@ -#pragma once - -#include -#include - -namespace open_power -{ -namespace occ -{ - -namespace fs = std::experimental::filesystem; - -/** @class Bus - * @brief Manages the bus on which the OCC device exists - */ -class Bus -{ - public: - Bus() = delete; - ~Bus() = default; - Bus(const Bus&) = delete; - Bus& operator=(const Bus&) = delete; - Bus(Bus&&) = default; - Bus& operator=(Bus&&) = default; - - /** @brief Constructs the Bus object - * - * @param[in] instance - OCC device index - */ - explicit Bus(int instance) : - config("0" + std::to_string(instance) + ":0" + - std::to_string(instance) + ":00:06") - { - // Nothing to do here - } - - void reset() const; - - private: - /** @brief Config value to be used to do bind and unbind */ - const std::string config; - - /** @brief To bind the device to the OCC's bus driver, do: - * - * Write 0x:0x:00:06 to: /sys/bus/fsi/drivers/sbefifo/bind - */ - static fs::path bindPath; - - /** @brief To un-bind the dvice from the OCC's bus driver, do: - * Write 0x:0x:00:06 to: /sys/bus/fsi/drivers/sbefifo/unbind - */ - static fs::path unBindPath; -}; - -} // namespace occ -} // namespace open_power diff --git a/occ_device.hpp b/occ_device.hpp index 85abde6..efa46dc 100644 --- a/occ_device.hpp +++ b/occ_device.hpp @@ -2,7 +2,6 @@ #include #include -#include "occ_bus.hpp" #include "occ_events.hpp" #include "occ_errors.hpp" #include "occ_presence.hpp" @@ -35,20 +34,16 @@ class Device * @param[in] event - Unique ptr reference to sd_event * @param[in] name - OCC instance name * @param[in] manager - OCC manager instance - * @param[in] status - OCC status instance - * @param[in] instance - OCC device index * @param[in] callback - Optional callback on errors */ Device(EventPtr& event, const std::string& name, const Manager& manager, Status& status, - int instance, std::function callBack = nullptr) : config(name), errorFile(fs::path(config) / "occ_error"), statusObject(status), - busObject(instance), error(event, errorFile, callBack), presence(event, fs::path(config) / "occs_present", @@ -79,9 +74,6 @@ class Device /** @brief Binds device to the OCC driver */ inline void bind() { - // Reset this OCC's bus driver - busObject.reset(); - // Bind the device return write(bindPath, config); } @@ -136,21 +128,6 @@ class Device } } - /** @brief file writer to achieve bind and unbind - * - * @param[in] filename - Name of file to be written - * @param[in] data - Data to be written to - * @return - None - */ - static void write(const fs::path& fileName, const std::string& data) - { - // If there is an error, move the exception all the way up - std::ofstream file(fileName, std::ios::out); - file << data; - file.close(); - return; - } - private: /** @brief Config value to be used to do bind and unbind */ const std::string config; @@ -172,9 +149,6 @@ class Device /** Store the associated Status instance */ Status& statusObject; - /** Store the associated Bus instance */ - const Bus busObject; - /** Abstraction of error monitoring */ Error error; @@ -186,6 +160,21 @@ class Device Error throttleProcPower; Error throttleMemTemp; + /** @brief file writer to achieve bind and unbind + * + * @param[in] filename - Name of file to be written + * @param[in] data - Data to be written to + * @return - None + */ + void write(const fs::path& fileName, const std::string& data) + { + // If there is an error, move the exception all the way up + std::ofstream file(fileName, std::ios::out); + file << data; + file.close(); + return; + } + /** @brief Returns if device represents the master OCC */ bool master() const; diff --git a/occ_status.hpp b/occ_status.hpp index 579f29d..f14bd7d 100644 --- a/occ_status.hpp +++ b/occ_status.hpp @@ -74,7 +74,6 @@ class Status : public Interface #endif manager, *this, - instance, std::bind(std::mem_fn(&Status::deviceErrorHandler), this, std::placeholders::_1)), hostControlSignal( -- cgit v1.2.1