Documentation and volt-curve read updates

[ROCm/amdsmi commit: 68b5e2ee0d]
This commit is contained in:
Chris Freehill
2019-02-22 15:05:44 -06:00
förälder 402b3cd383
incheckning 0f66ee6958
8 ändrade filer med 151 tillägg och 78 borttagningar
+10 -16
Visa fil
@@ -680,12 +680,11 @@ static rsmi_status_t get_od_clk_volt_info(uint32_t dv_ind,
nullptr, kOD_MCLK_label_array_index + 1);
assert(val_vec[kOD_VDDC_CURVE_label_array_index] == "OD_VDDC_CURVE:");
freq_volt_string_to_point(val_vec[kOD_VDDC_CURVE_label_array_index + 1],
&(p->curve[0]));
freq_volt_string_to_point(val_vec[kOD_VDDC_CURVE_label_array_index + 2],
&(p->curve[1]));
freq_volt_string_to_point(val_vec[kOD_VDDC_CURVE_label_array_index + 3],
&(p->curve[2]));
uint32_t tmp = kOD_VDDC_CURVE_label_array_index + 1;
for (uint32_t i = 0; i < RSMI_NUM_VOLTAGE_CURVE_POINTS; ++i) {
freq_volt_string_to_point(val_vec[tmp + i], &(p->curve.vc_points[i]));
}
assert(val_vec[kOD_OD_RANGE_label_array_index] == "OD_RANGE:");
od_value_pair_str_to_range(val_vec[kOD_OD_RANGE_label_array_index + 1],
@@ -708,14 +707,8 @@ static void get_vc_region(uint32_t start_ind,
assert(val_vec->size() >= kOD_OD_RANGE_label_array_index + 2);
assert((*val_vec)[kOD_OD_RANGE_label_array_index] == "OD_RANGE:");
rsmi_range rg;
od_value_pair_str_to_range((*val_vec)[start_ind], &rg);
p->min_corner.frequency = rg.lower_bound;
p->max_corner.frequency = rg.upper_bound;
od_value_pair_str_to_range((*val_vec)[start_ind + 1], &rg);
p->min_corner.voltage = rg.lower_bound;
p->max_corner.voltage = rg.upper_bound;
od_value_pair_str_to_range((*val_vec)[start_ind], &p->freq_range);
od_value_pair_str_to_range((*val_vec)[start_ind + 1], &p->volt_range);
return;
}
@@ -734,7 +727,6 @@ static rsmi_status_t get_od_clk_volt_curve_regions(uint32_t dv_ind,
rsmi_status_t ret;
assert(num_regions != nullptr);
assert(*num_regions > 0);
assert(p != nullptr);
ret = get_dev_value_vec(amd::smi::kDevPowerODVoltage, dv_ind, &val_vec);
@@ -755,7 +747,7 @@ static rsmi_status_t get_od_clk_volt_curve_regions(uint32_t dv_ind,
*num_regions);
for (uint32_t i=0; i < *num_regions; ++i) {
get_vc_region(kOD_VDDC_CURVE_start_index + i, &val_vec, p + i);
get_vc_region(kOD_VDDC_CURVE_start_index + i*2, &val_vec, p + i);
}
return RSMI_STATUS_SUCCESS;
@@ -1143,6 +1135,7 @@ rsmi_dev_fan_speed_max_get(uint32_t dv_ind, uint32_t sensor_ind,
return ret;
CATCH
}
rsmi_status_t
rsmi_dev_od_volt_info_get(uint32_t dv_ind, rsmi_od_volt_freq_data *odv) {
TRY
@@ -1151,6 +1144,7 @@ rsmi_dev_od_volt_info_get(uint32_t dv_ind, rsmi_od_volt_freq_data *odv) {
return ret;
CATCH
}
rsmi_status_t rsmi_dev_od_volt_curve_regions_get(uint32_t dv_ind,
uint32_t *num_regions, rsmi_freq_volt_region *buffer) {
TRY
+22 -6
Visa fil
@@ -126,10 +126,14 @@ int Device::readDevInfoStr(DevInfoTypes type, std::string *retStr) {
assert(retStr != nullptr);
if (env_->path_DRM_root_override && type == env_->enum_override) {
tempPath = env_->path_DRM_root_override;
}
tempPath += "/device/";
tempPath += kDevAttribNameMap.at(type);
DBG_FILE_ERROR(tempPath);
DBG_FILE_ERROR(tempPath, (std::string *)nullptr);
if (!isRegularFile(tempPath)) {
return EISDIR;
}
@@ -137,7 +141,6 @@ int Device::readDevInfoStr(DevInfoTypes type, std::string *retStr) {
std::ifstream fs;
fs.open(tempPath);
DBG_FILE_ERROR(tempPath);
if (!fs.is_open()) {
return errno;
}
@@ -150,23 +153,35 @@ int Device::readDevInfoStr(DevInfoTypes type, std::string *retStr) {
int Device::writeDevInfoStr(DevInfoTypes type, std::string valStr) {
auto tempPath = path_;
if (env_->path_DRM_root_override && type == env_->enum_override) {
tempPath = env_->path_DRM_root_override;
}
tempPath += "/device/";
tempPath += kDevAttribNameMap.at(type);
if (env_->path_DRM_root_override && type == env_->enum_override) {
tempPath += ".write";
}
std::ofstream fs;
fs.open(tempPath);
DBG_FILE_ERROR(tempPath);
DBG_FILE_ERROR(tempPath, &valStr);
if (!isRegularFile(tempPath)) {
return EISDIR;
}
DBG_FILE_ERROR(tempPath);
if (!fs.is_open()) {
return errno;
}
fs << valStr;
try {
fs << valStr;
} catch (...) {
std::cout << "Write to file threw exception" << std::endl;
}
fs.close();
return 0;
@@ -213,6 +228,7 @@ int Device::writeDevInfo(DevInfoTypes type, std::string val) {
case kDevGPUMClk:
case kDevGPUSClk:
case kDevPCIEBW:
case kDevPowerODVoltage:
return writeDevInfoStr(type, val);
case kDevOverDriveLevel:
@@ -241,7 +257,7 @@ int Device::readDevInfoMultiLineStr(DevInfoTypes type,
std::ifstream fs(tempPath);
std::stringstream buffer;
DBG_FILE_ERROR(tempPath);
DBG_FILE_ERROR(tempPath, (std::string *)nullptr);
if (!isRegularFile(tempPath)) {
return EISDIR;
}
+2 -2
Visa fil
@@ -138,7 +138,7 @@ int Monitor::writeMonitor(MonitorTypes type, uint32_t sensor_id,
std::string val) {
std::string sysfs_path = MakeMonitorPath(type, sensor_id);
DBG_FILE_ERROR(sysfs_path)
DBG_FILE_ERROR(sysfs_path, &val)
return WriteSysfsStr(sysfs_path, val);
}
@@ -150,7 +150,7 @@ int Monitor::readMonitor(MonitorTypes type, uint32_t sensor_id,
std::string temp_str;
std::string sysfs_path = MakeMonitorPath(type, sensor_id);
DBG_FILE_ERROR(sysfs_path)
DBG_FILE_ERROR(sysfs_path, (std::string *)nullptr)
return ReadSysfsStr(sysfs_path, val);
}
+1 -1
Visa fil
@@ -136,7 +136,7 @@ int PowerMon::readPowerValue(PowerMonTypes type, uint64_t *power) {
tempPath += "/";
tempPath += kMonitorNameMap.at(type);
DBG_FILE_ERROR(tempPath)
DBG_FILE_ERROR(tempPath, (std::string *)nullptr)
int ret = ReadSysfsStr(tempPath, &fstr);
if (ret) {