diff options
Diffstat (limited to 'src/device')
-rw-r--r-- | src/device/pci_device.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/device/pci_device.c b/src/device/pci_device.c index a2ad2b3db9..d03d88df39 100644 --- a/src/device/pci_device.c +++ b/src/device/pci_device.c @@ -1346,6 +1346,24 @@ uint16_t pci_find_cap_recursive(const struct device *dev, uint16_t cap) } /** + * Returns if the device support PMEs. + * + * @param dev Pointer to the device structure. + * @return Returns true when the device support PMEs. The PME generation can be + * disabled though. + */ +bool pci_has_pme_pin(const struct device *dev) +{ + const uint16_t cap = pci_find_capability(dev, PCI_CAP_ID_PM); + if (!cap) + return false; + + const uint16_t pmecap = pci_read_config16(dev, cap + PCI_PM_PMC); + + return !!(pmecap & PCI_PM_CAP_PME); +} + +/** * PCI devices that are marked as "hidden" do not get probed. However, the same * initialization logic is still performed as if it were. This is useful when * devices would like to be described in the devicetree.cb file, and/or present |