blob: c0eae7d3f122d9695de852264b99b499148cf06e [file]
#ifndef THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_HAL_SYSFS_I3C_H_
#define THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_HAL_SYSFS_I3C_H_
#include <cstdint>
#include <string>
#include <string_view>
#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 I3cSysfsConfig {
std::string i3c_sysfs_path = "/sys/bus/i3c/devices/";
};
// The class is thread-safe.
class I3cSysfs : public HwmonSysfs {
public:
explicit I3cSysfs(const I3cSysfsConfig& config) : config_(config) {}
virtual ~I3cSysfs() = default;
boost::filesystem::path GetBusPath(uint64_t bus) const override;
std::string GetDeviceDirectoryName(
const HalCommonConfig& config) const override;
bool IsDevicePresent(const HalCommonConfig& config) const override;
absl::Status NewDevice(const HalCommonConfig& config,
std::string_view driver_name) const override;
absl::Status DeleteDevice(const HalCommonConfig& config) const override;
private:
const I3cSysfsConfig config_;
};
} // namespace milotic_tlbmc
#endif // THIRD_PARTY_MILOTIC_EXTERNAL_CC_TLBMC_HAL_SYSFS_I3C_H_