From 93982c3a6ede0bdb8dd0e94597e4de7b09406947 Mon Sep 17 00:00:00 2001 From: Tim Wawrzynczak Date: Thu, 29 Apr 2021 09:45:59 -0600 Subject: device: Switch pci_dev_is_wake_source to take pci_devfn_t With the recent switch to SMM module loader v2, the size of the SMM for module google/volteer increased to above 64K in size, and thus failed to install the permanent SMM handler. Turns out, the devicetree is all pulled into the SMM build because of elog, which calls `pci_dev_is_wake_source`, and is the only user of `struct device` in SMM. Changing this function to take a pci_devfn_t instead allows the linker to remove almost the entire devicetree from SMM (only usage left is when disabling HECI via SMM). BUG=b:186661594 TEST=Verify loaded program size of `smm.elf` for google/volteer is almost ~50% smaller. Signed-off-by: Tim Wawrzynczak Change-Id: I4c39e5188321c8711d6479b15065e5aaedad8f38 Reviewed-on: https://review.coreboot.org/c/coreboot/+/52765 Tested-by: build bot (Jenkins) Reviewed-by: Furquan Shaikh --- src/device/pci_ops.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/device/pci_ops.c') diff --git a/src/device/pci_ops.c b/src/device/pci_ops.c index aaa9f95fb1f4..76d5e96aec54 100644 --- a/src/device/pci_ops.c +++ b/src/device/pci_ops.c @@ -79,19 +79,16 @@ void __noreturn pcidev_die(void) die("PCI: dev is NULL!\n"); } -bool pci_dev_is_wake_source(const struct device *dev) +bool pci_dev_is_wake_source(pci_devfn_t 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); + pm_cap = pci_s_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); + pmcs = pci_s_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); -- cgit v1.2.3