From 8a1ad138225e5a31d75cd77b9d7f183f3ab6d39c Mon Sep 17 00:00:00 2001 From: Tim Wawrzynczak Date: Thu, 5 Nov 2020 14:38:51 -0700 Subject: device: Move pci_dev_is_wake_source function Move this function to pci_ops.c, which is already included in the smm build. This is required to use this function in elog functionality, which is called from SMM. Signed-off-by: Tim Wawrzynczak Change-Id: Ie5583c04366c9a16bc1b00a6892d39eeafe5da49 Reviewed-on: https://review.coreboot.org/c/coreboot/+/47260 Tested-by: build bot (Jenkins) Reviewed-by: Furquan Shaikh Reviewed-by: Karthik Ramasubramanian --- src/device/pci_device.c | 18 ------------------ src/device/pci_ops.c | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 18 deletions(-) (limited to 'src/device') diff --git a/src/device/pci_device.c b/src/device/pci_device.c index 691ad6b316..6075ebeac7 100644 --- a/src/device/pci_device.c +++ b/src/device/pci_device.c @@ -1648,21 +1648,3 @@ void pci_dev_disable_bus_master(const struct device *dev) pci_update_config16(dev, PCI_COMMAND, ~PCI_COMMAND_MASTER, 0x0); } #endif - -bool pci_dev_is_wake_source(const struct device *dev) -{ - unsigned int pm_cap; - uint16_t pmcs; - - if (dev->path.type != DEVICE_PATH_PCI) - return false; - - pm_cap = pci_find_capability(dev, PCI_CAP_ID_PM); - if (!pm_cap) - return false; - - pmcs = pci_read_config16(dev, pm_cap + PCI_PM_CTRL); - - /* PCI Device is a wake source if PME_ENABLE and PME_STATUS are set in PMCS register. */ - return (pmcs & PCI_PM_CTRL_PME_ENABLE) && (pmcs & PCI_PM_CTRL_PME_STATUS); -} diff --git a/src/device/pci_ops.c b/src/device/pci_ops.c index 90f45bf21a..aaa9f95fb1 100644 --- a/src/device/pci_ops.c +++ b/src/device/pci_ops.c @@ -78,3 +78,21 @@ void __noreturn pcidev_die(void) { die("PCI: dev is NULL!\n"); } + +bool pci_dev_is_wake_source(const struct device *dev) +{ + unsigned int pm_cap; + uint16_t pmcs; + + if (dev->path.type != DEVICE_PATH_PCI) + return false; + + pm_cap = pci_find_capability(dev, PCI_CAP_ID_PM); + if (!pm_cap) + return false; + + pmcs = pci_s_read_config16(PCI_BDF(dev), pm_cap + PCI_PM_CTRL); + + /* PCI Device is a wake source if PME_ENABLE and PME_STATUS are set in PMCS register. */ + return (pmcs & PCI_PM_CTRL_PME_ENABLE) && (pmcs & PCI_PM_CTRL_PME_STATUS); +} -- cgit v1.2.3