device/pciexp: Add hot-plug capable helper function

Add and use a new helper function to determine if a device is
1) a PCIe device
2) it's mark hot-plug capable

Change-Id: I61cc013844024b43808cd2f054310cb6676ba69e
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/84792
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Shuo Liu <shuo.liu@intel.com>
This commit is contained in:
Patrick Rudolph 2024-10-16 12:14:06 +02:00 committed by Lean Sheng Tan
commit 5d6355efcf
4 changed files with 27 additions and 17 deletions

View file

@ -19,14 +19,9 @@ static const char *pcie_device_get_acpi_name(const struct device *dev)
static void soc_pciexp_scan_bridge(struct device *dev)
{
if (CONFIG(PCIEXP_HOTPLUG)) {
unsigned int pciexpos = pci_find_capability(dev, PCI_CAP_ID_PCIE);
u16 sltcap = pci_read_config16(dev, pciexpos + PCI_EXP_SLTCAP);
if (sltcap & PCI_EXP_SLTCAP_HPC) {
pciexp_hotplug_scan_bridge(dev);
return;
}
} else
if (CONFIG(PCIEXP_HOTPLUG) && pciexp_dev_is_slot_hot_plug_cap(dev))
pciexp_hotplug_scan_bridge(dev);
else
pciexp_scan_bridge(dev);
}