Read PCIe slot type from sysfs
Read the PCIe slot type from sysfs instead of libdrm. Change-Id: I9392b9e18a209ac7332f6902bcafb3b6062c86c1
此提交包含在:
1 父節點
3d3759061a
當前提交
656f12e0f3
7 file changed
+107
-24
No files matched your search
+12
-24
@@ -1830,22 +1830,14 @@ amdsmi_get_pcie_link_status(amdsmi_processor_handle processor_handle, amdsmi_pci
|
||||
|
||||
// default to PCIe
|
||||
info->pcie_slot_type = AMDSMI_SLOT_TYPE__PCIE;
|
||||
amd::smi::AMDSmiGPUDevice* gpu_device = nullptr;
|
||||
status = get_gpu_device_from_handle(
|
||||
processor_handle, &gpu_device);
|
||||
if (status == AMDSMI_STATUS_SUCCESS
|
||||
&& gpu_device->check_if_drm_is_supported()) {
|
||||
struct drm_amdgpu_info_device dev_info = {};
|
||||
status = gpu_device->amdgpu_query_info(AMDGPU_INFO_DEV_INFO,
|
||||
sizeof(struct drm_amdgpu_memory_info), &dev_info);
|
||||
// bits [16:17] in ids_flags field as slot type
|
||||
if (status == AMDSMI_STATUS_SUCCESS) {
|
||||
// two bits starts with index 16
|
||||
info->pcie_slot_type = static_cast<amdsmi_pcie_slot_type_t>((dev_info.ids_flags >> 16) & 0x03);
|
||||
}
|
||||
rsmi_pcie_slot_type_t slot_type;
|
||||
status = rsmi_wrapper(rsmi_dev_pcie_slot_type_get,
|
||||
processor_handle, &slot_type);
|
||||
if (status == AMDSMI_STATUS_SUCCESS) {
|
||||
info->pcie_slot_type = static_cast<amdsmi_pcie_slot_type_t>(slot_type);
|
||||
}
|
||||
|
||||
return status;
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_get_pcie_link_caps(amdsmi_processor_handle processor_handle, amdsmi_pcie_info_t *info) {
|
||||
@@ -1921,18 +1913,14 @@ amdsmi_status_t amdsmi_get_pcie_link_caps(amdsmi_processor_handle processor_hand
|
||||
|
||||
// default to PCIe
|
||||
info->pcie_slot_type = AMDSMI_SLOT_TYPE__PCIE;
|
||||
if (gpu_device->check_if_drm_is_supported()) {
|
||||
struct drm_amdgpu_info_device dev_info = {};
|
||||
status = gpu_device->amdgpu_query_info(AMDGPU_INFO_DEV_INFO,
|
||||
sizeof(struct drm_amdgpu_memory_info), &dev_info);
|
||||
// bits [16:17] in ids_flags field as slot type
|
||||
if (status == AMDSMI_STATUS_SUCCESS) {
|
||||
// two bits starts with index 16
|
||||
info->pcie_slot_type = static_cast<amdsmi_pcie_slot_type_t>((dev_info.ids_flags >> 16) & 0x03);
|
||||
}
|
||||
rsmi_pcie_slot_type_t slot_type;
|
||||
status = rsmi_wrapper(rsmi_dev_pcie_slot_type_get,
|
||||
processor_handle, &slot_type);
|
||||
if (status == AMDSMI_STATUS_SUCCESS) {
|
||||
info->pcie_slot_type = static_cast<amdsmi_pcie_slot_type_t>(slot_type);
|
||||
}
|
||||
|
||||
return status;
|
||||
return AMDSMI_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
amdsmi_status_t amdsmi_get_processor_handle_from_bdf(amdsmi_bdf_t bdf,
|
||||
|
||||
Reference in new issue
封鎖使用者