Eddie James | b5508d7 | 2018-05-02 15:57:23 -0500 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <string> |
| 4 | #include <experimental/filesystem> |
| 5 | |
| 6 | namespace open_power |
| 7 | { |
| 8 | namespace occ |
| 9 | { |
| 10 | |
| 11 | namespace fs = std::experimental::filesystem; |
| 12 | |
| 13 | /** @class Bus |
| 14 | * @brief Manages the bus on which the OCC device exists |
| 15 | */ |
| 16 | class Bus |
| 17 | { |
| 18 | public: |
| 19 | Bus() = delete; |
| 20 | ~Bus() = default; |
| 21 | Bus(const Bus&) = delete; |
| 22 | Bus& operator=(const Bus&) = delete; |
| 23 | Bus(Bus&&) = default; |
| 24 | Bus& operator=(Bus&&) = default; |
| 25 | |
| 26 | /** @brief Constructs the Bus object |
| 27 | * |
| 28 | * @param[in] instance - OCC device index |
| 29 | */ |
| 30 | explicit Bus(int instance) : |
| 31 | config("0" + std::to_string(instance) + ":0" + |
| 32 | std::to_string(instance) + ":00:06") |
| 33 | { |
| 34 | // Nothing to do here |
| 35 | } |
| 36 | |
| 37 | void reset() const; |
| 38 | |
| 39 | private: |
| 40 | /** @brief Config value to be used to do bind and unbind */ |
| 41 | const std::string config; |
| 42 | |
| 43 | /** @brief To bind the device to the OCC's bus driver, do: |
| 44 | * |
| 45 | * Write 0x:0x:00:06 to: /sys/bus/fsi/drivers/sbefifo/bind |
| 46 | */ |
| 47 | static fs::path bindPath; |
| 48 | |
| 49 | /** @brief To un-bind the dvice from the OCC's bus driver, do: |
| 50 | * Write 0x:0x:00:06 to: /sys/bus/fsi/drivers/sbefifo/unbind |
| 51 | */ |
| 52 | static fs::path unBindPath; |
| 53 | }; |
| 54 | |
| 55 | } // namespace occ |
| 56 | } // namespace open_power |