Adding current voltage feature & gtest.

Signed-off-by: Divya Shikre <DivyaUday.Shikre@amd.com>
Change-Id: Ic555a3af265e603419e2875d1989a366abc82596
このコミットが含まれているのは:
Divya Shikre
2020-06-08 11:54:01 -04:00
コミット 2805ed16a4
11個のファイルの変更、486行の追加、7行の削除
+67
ファイルの表示
@@ -363,6 +363,39 @@ typedef enum {
RSMI_TEMP_TYPE_INVALID = 0xFFFFFFFF //!< Invalid type
} rsmi_temperature_type_t;
/**
* @brief Voltage Metrics. This enum is used to identify various
* Volatge metrics. Corresponding values will be in millivolt.
*
*/
typedef enum {
RSMI_VOLT_CURRENT = 0x0, //!< Voltage current value.
RSMI_VOLT_FIRST = RSMI_VOLT_CURRENT,
RSMI_VOLT_MAX, //!< Voltage max value.
RSMI_VOLT_MIN_CRIT, //!< Voltage critical min value.
RSMI_VOLT_MIN, //!< Voltage min value.
RSMI_VOLT_MAX_CRIT, //!< Voltage critical max value.
RSMI_VOLT_AVERAGE, //!< Average voltage.
RSMI_VOLT_LOWEST, //!< Historical minimum voltage.
RSMI_VOLT_HIGHEST, //!< Historical maximum voltage.
RSMI_VOLT_LAST = RSMI_VOLT_HIGHEST
} rsmi_voltage_metric_t;
/**
* @brief This ennumeration is used to indicate which type of
* voltage reading should be obtained.
*/
typedef enum {
RSMI_VOLT_TYPE_FIRST = 0,
RSMI_VOLT_TYPE_VDDGFX = RSMI_VOLT_TYPE_FIRST, //!< Vddgfx GPU
//!< voltage
RSMI_VOLT_TYPE_LAST = RSMI_VOLT_TYPE_VDDGFX,
RSMI_VOLT_TYPE_INVALID = 0xFFFFFFFF //!< Invalid type
} rsmi_voltage_type_t;
/**
* @brief Pre-set Profile Selections. These bitmasks can be AND'd with the
* ::rsmi_power_profile_status_t.available_profiles returned from
@@ -1736,6 +1769,40 @@ rsmi_status_t rsmi_dev_temp_metric_get(uint32_t dv_ind, uint32_t sensor_type,
rsmi_temperature_metric_t metric, int64_t *temperature);
/** @} */ // end of PhysQuer
/**
* @brief Get the voltage metric value for the specified metric, from the
* specified voltage sensor on the specified device.
*
* @details Given a device index @p dv_ind, a sensor type @p sensor_type, a
* ::rsmi_voltage_metric_t @p metric and a pointer to an int64_t @p
* voltage, this function will write the value of the metric indicated by
* @p metric and @p sensor_type to the memory location @p voltage.
*
* @param[in] dv_ind a device index
*
* @param[in] sensor_type part of device from which voltage should be
* obtained. This should come from the enum ::rsmi_voltage_type_t
*
* @param[in] metric enum indicated which voltage value should be
* retrieved
*
* @param[inout] voltage a pointer to int64_t to which the voltage
* will be written, in millivolts.
* If this parameter is nullptr, this function will return
* ::RSMI_STATUS_INVALID_ARGS if the function is supported with the provided,
* arguments and ::RSMI_STATUS_NOT_SUPPORTED if it is not supported with the
* provided arguments.
*
* @retval ::RSMI_STATUS_SUCCESS call was successful
* @retval ::RSMI_STATUS_NOT_SUPPORTED installed software or hardware does not
* support this function with the given arguments
* @retval ::RSMI_STATUS_INVALID_ARGS the provided arguments are not valid
*
*/
rsmi_status_t rsmi_dev_volt_metric_get(uint32_t dv_ind, rsmi_voltage_type_t sensor_type,
rsmi_voltage_metric_t metric, int64_t *voltage);
/** @} */ // end of PhysQuer
/*****************************************************************************/
/** @defgroup PhysCont Physical State Control
* These functions provide control over the physical state of a device.
+15 -1
ファイルの表示
@@ -80,6 +80,15 @@ enum MonitorTypes {
kMonTempLowest,
kMonTempHighest,
kMonTempLabel,
kMonVolt,
kMonVoltMax,
kMonVoltMinCrit,
kMonVoltMin,
kMonVoltMaxCrit,
kMonVoltAverage,
kMonVoltLowest,
kMonVoltHighest,
kMonVoltLabel,
kMonInvalid = 0xFFFFFFFF,
};
@@ -92,9 +101,12 @@ class Monitor {
const std::string path(void) const {return path_;}
int readMonitor(MonitorTypes type, uint32_t sensor_ind, std::string *val);
int writeMonitor(MonitorTypes type, uint32_t sensor_ind, std::string val);
uint32_t setSensorLabelMap(void);
uint32_t setTempSensorLabelMap(void);
uint32_t getTempSensorIndex(rsmi_temperature_type_t type);
rsmi_temperature_type_t getTempSensorEnum(uint64_t ind);
uint32_t setVoltSensorLabelMap(void);
uint32_t getVoltSensorIndex(rsmi_voltage_type_t type);
rsmi_voltage_type_t getVoltSensorEnum(uint64_t ind);
void fillSupportedFuncs(SupportedFuncMap *supported_funcs);
private:
@@ -111,6 +123,8 @@ class Monitor {
// a 64b value. Also, if we need to encode anything else, 64b will give
// us more room to do so, without excessive changes.
std::map<uint64_t, rsmi_temperature_type_t> index_temp_type_map_;
std::map<rsmi_voltage_type_t, uint32_t> volt_type_index_map_;
std::map<uint64_t, rsmi_voltage_type_t> index_volt_type_map_;
};
} // namespace smi