GPU: detect current pcie link speed

This commit is contained in:
Carter Li
2026-06-14 17:36:54 +08:00
committed by 李通洲
parent 107f39eb15
commit 22f9948497
18 changed files with 190 additions and 79 deletions
+22 -8
View File
@@ -235,20 +235,34 @@ const char* ffDetectAmdGpuInfo(const FFGpuDriverCondition* cond, FFGpuDriverResu
FF_DEBUG("Setting adapter name: %s; UDID: %s, Present: %d, Exist: %d", device->strAdapterName, device->strUDID, device->iPresent, device->iExist);
}
if (result.pcieGen || result.pcieLanes) {
if (result.psMax || result.psCurr) {
ADLChipSetInfo chipSetInfo;
int status = adlData.ffADL2_Adapter_ChipSetInfo_Get(adlData.apiHandle, device->iAdapterIndex, &chipSetInfo);
FF_DEBUG("ADL2_Adapter_ChipSetInfo_Get returned %s (%d)", ffAdlStatusToString(status), status);
if (status == ADL_OK) {
FF_DEBUG("Chipset info - Bus Type: %d, PCIe Lane Width: %d", chipSetInfo.iBusType, chipSetInfo.iMaxPCIELaneWidth);
if (result.pcieGen && chipSetInfo.iBusType >= 2) {
*result.pcieGen = (uint16_t) (chipSetInfo.iBusType - 2);
FF_DEBUG("Got PCIe Gen: %u", *result.pcieGen);
FF_DEBUG("Chipset info - iBusSpeedType: %d, iMaxPCIELaneWidth: %d", chipSetInfo.iBusSpeedType, chipSetInfo.iMaxPCIELaneWidth);
if (result.psMax) {
if (chipSetInfo.iBusSpeedType >= 2) {
result.psMax->gen = (uint16_t) (chipSetInfo.iBusSpeedType - 2);
FF_DEBUG("Got PCIe Max Gen: %u", result.psMax->gen);
}
if (chipSetInfo.iMaxPCIELaneWidth > 0) {
result.psMax->lanes = (uint16_t) chipSetInfo.iMaxPCIELaneWidth;
FF_DEBUG("Got PCIe Max Lanes: %u", result.psMax->lanes);
}
}
if (result.pcieLanes && chipSetInfo.iMaxPCIELaneWidth > 0) {
*result.pcieLanes = (uint16_t) chipSetInfo.iMaxPCIELaneWidth;
FF_DEBUG("Got PCIe Lanes: %u", *result.pcieLanes);
FF_DEBUG("Chipset info - iBusType: %d, iCurrentPCIELaneWidth: %d", chipSetInfo.iBusType, chipSetInfo.iCurrentPCIELaneWidth);
if (result.psCurr) {
if (chipSetInfo.iBusType >= 2) {
result.psCurr->gen = (uint16_t) (chipSetInfo.iBusType - 2);
FF_DEBUG("Got PCIe Current Gen: %u", result.psCurr->gen);
}
if (chipSetInfo.iCurrentPCIELaneWidth > 0) {
result.psCurr->lanes = (uint16_t) chipSetInfo.iCurrentPCIELaneWidth;
FF_DEBUG("Got PCIe Current Lanes: %u", result.psCurr->lanes);
}
}
} else {
FF_DEBUG("Failed to get chipset information");