From d13acd817dc822cae7c5bad594c68b2a21f2142c Mon Sep 17 00:00:00 2001 From: John Zhao Date: Tue, 17 Nov 2020 15:08:53 -0800 Subject: [PATCH] device: Enable ASPM for TBT PCIe root ports The virtual/generic device under TBT PCIe root ports has path type as DEVICE_PATH_GENERIC. While scanning the pcie bus, the generic device blocks its root ports configuration. This change adds device path type check and enables ASPM for TBT root ports. BUG=b:173207454 TEST=Built image and booted to kernel on Voxel board. Verified both of the TBT Root ports 00:07.0 and 00:07.1 ASPM are enabled. Signed-off-by: John Zhao Change-Id: I82ffaeb5a8821d9034d8dae9d98d3b5953a9608b --- src/device/pciexp_device.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/device/pciexp_device.c b/src/device/pciexp_device.c index 8d4bb9849d..8f721071c9 100644 --- a/src/device/pciexp_device.c +++ b/src/device/pciexp_device.c @@ -446,7 +446,7 @@ static void pciexp_tune_dev(struct device *dev) unsigned int root_cap, cap; cap = pci_find_capability(dev, PCI_CAP_ID_PCIE); - if (!cap) + if (!cap && (dev->path.type != DEVICE_PATH_GENERIC)) return; root_cap = pci_find_capability(root, PCI_CAP_ID_PCIE); @@ -480,7 +480,8 @@ void pciexp_scan_bus(struct bus *bus, unsigned int min_devfn, pci_scan_bus(bus, min_devfn, max_devfn); for (child = bus->children; child; child = child->sibling) { - if (child->path.type != DEVICE_PATH_PCI) + if ((child->path.type != DEVICE_PATH_PCI) && + (child->path.type != DEVICE_PATH_GENERIC)) continue; if ((child->path.pci.devfn < min_devfn) || (child->path.pci.devfn > max_devfn)) {