summaryrefslogtreecommitdiff
path: root/src/soc
diff options
context:
space:
mode:
authorTim Wawrzynczak <twawrzynczak@chromium.org>2021-04-29 09:45:59 -0600
committerTim Wawrzynczak <twawrzynczak@chromium.org>2021-05-03 16:28:42 +0000
commit93982c3a6ede0bdb8dd0e94597e4de7b09406947 (patch)
tree8c058b87b2adcd220d41a3530742c67b2426161e /src/soc
parentd87bbde169f84b8c723b0d5289f39df164251b52 (diff)
downloadcoreboot-93982c3a6ede0bdb8dd0e94597e4de7b09406947.tar.xz
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 <twawrzynczak@chromium.org> Change-Id: I4c39e5188321c8711d6479b15065e5aaedad8f38 Reviewed-on: https://review.coreboot.org/c/coreboot/+/52765 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Furquan Shaikh <furquan@google.com>
Diffstat (limited to 'src/soc')
-rw-r--r--src/soc/intel/alderlake/elog.c28
-rw-r--r--src/soc/intel/jasperlake/elog.c14
-rw-r--r--src/soc/intel/tigerlake/elog.c29
3 files changed, 20 insertions, 51 deletions
diff --git a/src/soc/intel/alderlake/elog.c b/src/soc/intel/alderlake/elog.c
index 1efba25eed..84765d9b58 100644
--- a/src/soc/intel/alderlake/elog.c
+++ b/src/soc/intel/alderlake/elog.c
@@ -48,11 +48,8 @@ static void pch_log_rp_wake_source(void)
};
for (i = 0; i < MIN(CONFIG_MAX_ROOT_PORTS, ARRAY_SIZE(pme_map)); ++i) {
- const struct device *dev = pcidev_path_on_root(pme_map[i].devfn);
- if (!dev)
- continue;
-
- if (pci_dev_is_wake_source(dev))
+ if (pci_dev_is_wake_source(PCI_DEV(0, PCI_SLOT(pme_map[i].devfn),
+ PCI_FUNC(pme_map[i].devfn))))
elog_add_event_wake(pme_map[i].wake_source, 0);
}
}
@@ -77,11 +74,8 @@ static void pch_log_pme_internal_wake_source(void)
size_t i;
for (i = 0; i < ARRAY_SIZE(ipme_map); i++) {
- const struct device *dev = pcidev_path_on_root(ipme_map[i].devfn);
- if (!dev)
- continue;
-
- if (pci_dev_is_wake_source(dev)) {
+ unsigned int devfn = ipme_map[i].devfn;
+ if (pci_dev_is_wake_source(PCI_DEV(0, PCI_SLOT(devfn), PCI_FUNC(devfn)))) {
elog_add_event_wake(ipme_map[i].wake_source, 0);
dev_found = true;
}
@@ -89,11 +83,8 @@ static void pch_log_pme_internal_wake_source(void)
/* Check Thunderbolt ports */
for (i = 0; i < NUM_TBT_FUNCTIONS; i++) {
- const struct device *dev = pcidev_path_on_root(SA_DEVFN_TBT(i));
- if (!dev)
- continue;
-
- if (pci_dev_is_wake_source(dev)) {
+ unsigned int devfn = SA_DEVFN_TBT(i);
+ if (pci_dev_is_wake_source(PCI_DEV(0, PCI_SLOT(devfn), PCI_FUNC(devfn)))) {
elog_add_event_wake(ELOG_WAKE_SOURCE_PME_TBT, i);
dev_found = true;
}
@@ -101,11 +92,8 @@ static void pch_log_pme_internal_wake_source(void)
/* Check DMA devices */
for (i = 0; i < NUM_TCSS_DMA_FUNCTIONS; i++) {
- const struct device *dev = pcidev_path_on_root(SA_DEVFN_TCSS_DMA(i));
- if (!dev)
- continue;
-
- if (pci_dev_is_wake_source(dev)) {
+ unsigned int devfn = SA_DEVFN_TCSS_DMA(i);
+ if (pci_dev_is_wake_source(PCI_DEV(0, PCI_SLOT(devfn), PCI_FUNC(devfn)))) {
elog_add_event_wake(ELOG_WAKE_SOURCE_PME_TCSS_DMA, i);
dev_found = true;
}
diff --git a/src/soc/intel/jasperlake/elog.c b/src/soc/intel/jasperlake/elog.c
index ccf6fd048b..858b3714d4 100644
--- a/src/soc/intel/jasperlake/elog.c
+++ b/src/soc/intel/jasperlake/elog.c
@@ -48,11 +48,8 @@ static void pch_log_rp_wake_source(void)
};
for (i = 0; i < MIN(CONFIG_MAX_ROOT_PORTS, ARRAY_SIZE(pme_map)); ++i) {
- const struct device *dev = pcidev_path_on_root(pme_map[i].devfn);
- if (!dev)
- continue;
-
- if (pci_dev_is_wake_source(dev))
+ if (pci_dev_is_wake_source(PCI_DEV(0, PCI_SLOT(pme_map[i].devfn),
+ PCI_FUNC(pme_map[i].devfn))))
elog_add_event_wake(pme_map[i].wake_source, 0);
}
}
@@ -75,11 +72,8 @@ static void pch_log_pme_internal_wake_source(void)
};
for (i = 0; i < ARRAY_SIZE(ipme_map); i++) {
- const struct device *dev = pcidev_path_on_root(ipme_map[i].devfn);
- if (!dev)
- continue;
-
- if (pci_dev_is_wake_source(dev)) {
+ if (pci_dev_is_wake_source(PCI_DEV(0, PCI_SLOT(ipme_map[i].devfn),
+ PCI_FUNC(ipme_map[i].devfn)))) {
elog_add_event_wake(ipme_map[i].wake_source, 0);
dev_found = true;
}
diff --git a/src/soc/intel/tigerlake/elog.c b/src/soc/intel/tigerlake/elog.c
index 878959a9b5..0fccf84d5c 100644
--- a/src/soc/intel/tigerlake/elog.c
+++ b/src/soc/intel/tigerlake/elog.c
@@ -48,11 +48,8 @@ static void pch_log_rp_wake_source(void)
};
for (i = 0; i < MIN(CONFIG_MAX_ROOT_PORTS, ARRAY_SIZE(pme_map)); ++i) {
- const struct device *dev = pcidev_path_on_root(pme_map[i].devfn);
- if (!dev)
- continue;
-
- if (pci_dev_is_wake_source(dev))
+ if (pci_dev_is_wake_source(PCI_DEV(0, PCI_SLOT(pme_map[i].devfn),
+ PCI_FUNC(pme_map[i].devfn))))
elog_add_event_wake(pme_map[i].wake_source, 0);
}
}
@@ -76,12 +73,8 @@ static void pch_log_pme_internal_wake_source(void)
size_t i;
for (i = 0; i < ARRAY_SIZE(ipme_map); i++) {
- const struct device *dev =
- pcidev_path_on_root(ipme_map[i].devfn);
- if (!dev)
- continue;
-
- if (pci_dev_is_wake_source(dev)) {
+ if (pci_dev_is_wake_source(PCI_DEV(0, PCI_SLOT(ipme_map[i].devfn),
+ PCI_FUNC(ipme_map[i].devfn)))) {
elog_add_event_wake(ipme_map[i].wake_source, 0);
dev_found = true;
}
@@ -89,11 +82,8 @@ static void pch_log_pme_internal_wake_source(void)
/* Check Thunderbolt ports */
for (i = 0; i < NUM_TBT_FUNCTIONS; i++) {
- const struct device *dev = pcidev_path_on_root(SA_DEVFN_TBT(i));
- if (!dev)
- continue;
-
- if (pci_dev_is_wake_source(dev)) {
+ const unsigned int devfn = SA_DEVFN_TBT(i);
+ if (pci_dev_is_wake_source(PCI_DEV(0, PCI_SLOT(devfn), PCI_FUNC(devfn)))) {
elog_add_event_wake(ELOG_WAKE_SOURCE_PME_TBT, i);
dev_found = true;
}
@@ -101,11 +91,8 @@ static void pch_log_pme_internal_wake_source(void)
/* Check DMA devices */
for (i = 0; i < NUM_TCSS_DMA_FUNCTIONS; i++) {
- const struct device *dev = pcidev_path_on_root(SA_DEVFN_TCSS_DMA(i));
- if (!dev)
- continue;
-
- if (pci_dev_is_wake_source(dev)) {
+ const unsigned int devfn = SA_DEVFN_TCSS_DMA(i);
+ if (pci_dev_is_wake_source(PCI_DEV(0, PCI_SLOT(devfn), PCI_FUNC(devfn)))) {
elog_add_event_wake(ELOG_WAKE_SOURCE_PME_TCSS_DMA, i);
dev_found = true;
}