| #ifndef THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_HAL_SYSFS_PECI_H_ |
| #define THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_HAL_SYSFS_PECI_H_ |
| |
| #include <cstdint> |
| #include <filesystem> // NOLINT: filesystem is available on BMC |
| #include <string> |
| |
| #include "absl/status/status.h" |
| #include "boost/filesystem.hpp" // NOLINT: boost::filesystem is commonly used in BMC |
| #include "hal_common_config.pb.h" |
| #include "tlbmc/hal/sysfs/hwmon.h" |
| |
| namespace milotic_tlbmc { |
| |
| struct PeciSysfsConfig { |
| // From: https://patchwork.ozlabs.org/project/linux-aspeed/patch/20220208153639.255278-8-iwona.winiarska@intel.com/ |
| std::string peci_sysfs_path = "/sys/bus/peci"; |
| std::string peci_dev_path = "/dev/peci-"; |
| }; |
| |
| // The class is thread-safe. |
| class PeciSysfs : public HwmonSysfs { |
| public: |
| explicit PeciSysfs(const PeciSysfsConfig& config) : config_(config) {} |
| |
| virtual ~PeciSysfs() = default; |
| |
| boost::filesystem::path GetBusPath(uint64_t bus) const override; |
| |
| boost::filesystem::path GetPeciDevicePath(uint64_t bus) const; |
| |
| virtual boost::filesystem::path GetPeciRescanPath() const; |
| |
| absl::Status DeleteDevice(const HalCommonConfig& config) const override; |
| |
| std::string GetDeviceDirectoryName( |
| const HalCommonConfig& config) const override; |
| |
| bool IsDevicePresent(const HalCommonConfig& config) const override; |
| |
| private: |
| const PeciSysfsConfig config_; |
| }; |
| |
| } // namespace milotic_tlbmc |
| |
| #endif // THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_HAL_SYSFS_PECI_H_ |