Adjust static --board output to be inline with Host
Change-Id: Ia6dcca5be077ef9e04533b632628a62633b63556 Signed-off-by: Maisam Arif <maisarif@amd.com>
This commit is contained in:
zatwierdzone przez
Maisam Arif
rodzic
f7d631b9cd
commit
b58665e77b
@@ -269,18 +269,19 @@ class AMDSMICommands():
|
||||
|
||||
if self.helpers.is_linux() and self.helpers.is_baremetal():
|
||||
if args.board:
|
||||
static_dict['board'] = {"model_number": "N/A",
|
||||
"product_serial": "N/A",
|
||||
"fru_id": "N/A",
|
||||
"manufacturer_name": "N/A",
|
||||
"product_name": "N/A"}
|
||||
try:
|
||||
board_info = amdsmi_interface.amdsmi_get_gpu_board_info(args.gpu)
|
||||
board_info['serial_number'] = hex(board_info['serial_number'])
|
||||
board_info['model_number'] = board_info['model_number'].strip()
|
||||
board_info['product_name'] = board_info['product_name'].strip()
|
||||
board_info['manufacturer_name'] = board_info['manufacturer_name'].strip()
|
||||
board_info.pop('product_serial')
|
||||
board_info.pop('manufacturer_name')
|
||||
|
||||
for key, value in board_info.items():
|
||||
if isinstance(value, str):
|
||||
if value.strip() == '':
|
||||
board_info[key] = "N/A"
|
||||
static_dict['board'] = board_info
|
||||
except amdsmi_exception.AmdSmiLibraryException as e:
|
||||
static_dict['board'] = "N/A"
|
||||
logging.debug("Failed to get board info for gpu %s | %s", gpu_id, e.get_error_info())
|
||||
if args.limit:
|
||||
# Power limits
|
||||
|
||||
@@ -823,11 +823,11 @@ def amdsmi_get_gpu_board_info(
|
||||
)
|
||||
|
||||
return {
|
||||
"serial_number": board_info.serial_number,
|
||||
"model_number": board_info.model_number.decode("utf-8"),
|
||||
"product_serial": board_info.product_serial.decode("utf-8"),
|
||||
"product_name": board_info.product_name.decode("utf-8"),
|
||||
"manufacturer_name" : board_info.product_name.decode("utf-8")
|
||||
"model_number": board_info.model_number.decode("utf-8").strip(),
|
||||
"product_serial": board_info.serial_number,
|
||||
"fru_id": board_info.fru_id.decode("utf-8").strip(),
|
||||
"manufacturer_name" : board_info.manufacturer_name.decode("utf-8").strip(),
|
||||
"product_name": board_info.product_name.decode("utf-8").strip()
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -457,7 +457,7 @@ amdsmi_status_t amdsmi_get_gpu_board_info(amdsmi_processor_handle processor_hand
|
||||
return r;
|
||||
|
||||
if (gpu_device->check_if_drm_is_supported()) {
|
||||
// Get from sys file
|
||||
// Populate product_serial, product_name, & product_number from sysfs
|
||||
status = smi_amdgpu_get_board_info(gpu_device, board_info);
|
||||
}
|
||||
else {
|
||||
@@ -472,6 +472,9 @@ amdsmi_status_t amdsmi_get_gpu_board_info(amdsmi_processor_handle processor_hand
|
||||
}
|
||||
}
|
||||
|
||||
// Get FRU ID
|
||||
// Get manufacturer name
|
||||
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -138,7 +138,7 @@ amdsmi_status_t smi_amdgpu_get_board_info(amd::smi::AMDSmiGPUDevice* device, amd
|
||||
|
||||
fp = fopen(serial_number_path.c_str(), "rb");
|
||||
if (fp) {
|
||||
fscanf(fp, "%lx", &info->serial_number);
|
||||
fscanf(fp, "%lx", &info->product_serial);
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user