summaryrefslogtreecommitdiff
path: root/src/device
diff options
context:
space:
mode:
authorNico Huber <nico.h@gmx.de>2022-08-15 00:08:58 +0200
committerMartin L Roth <gaumless@gmail.com>2022-09-04 16:39:14 +0000
commit577c6b9225515aeb32918881bfb5503c3fd71068 (patch)
tree1bac9101bb9406e3d88d52e633b89a8ee8f1a567 /src/device
parent526c64249a0a0c7b83d1914b88d4f938ede7dc1c (diff)
pciexp_device: Propagate above-4G flag to all hotplug devices
The `IORESOURCE_ABOVE_4G` flag was only explicitly set for our dummy device that reserves resources behind a hotplug port. The current re- source allocator implicitly extends this to all devices below the port, including real ones. Let's make that explicit, so future changes to the allocator can't break this rule. Change-Id: Id4c90b60682cf5c8949cde25362d286625b3e953 Signed-off-by: Nico Huber <nico.h@gmx.de> Reviewed-on: https://review.coreboot.org/c/coreboot/+/66719 Reviewed-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com>
Diffstat (limited to 'src/device')
-rw-r--r--src/device/device_util.c10
-rw-r--r--src/device/pci_device.c6
-rw-r--r--src/device/pciexp_device.c1
3 files changed, 16 insertions, 1 deletions
diff --git a/src/device/device_util.c b/src/device/device_util.c
index 809748465f..45dbccc28d 100644
--- a/src/device/device_util.c
+++ b/src/device/device_util.c
@@ -5,6 +5,7 @@
#include <device/path.h>
#include <device/pci_def.h>
#include <device/resource.h>
+#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
@@ -939,6 +940,15 @@ const char *dev_path_name(enum device_path_type type)
return type_name;
}
+bool dev_path_hotplug(const struct device *dev)
+{
+ for (dev = dev->bus->dev; dev != dev->bus->dev; dev = dev->bus->dev) {
+ if (dev->hotplug_port)
+ return true;
+ }
+ return false;
+}
+
void log_resource(const char *type, const struct device *dev, const struct resource *res,
const char *srcfile, const int line)
{
diff --git a/src/device/pci_device.c b/src/device/pci_device.c
index 232328dca8..52107f2fd3 100644
--- a/src/device/pci_device.c
+++ b/src/device/pci_device.c
@@ -164,8 +164,12 @@ struct resource *pci_get_resource(struct device *dev, unsigned long index)
/* A Memory mapped base address. */
attr &= PCI_BASE_ADDRESS_MEM_ATTR_MASK;
resource->flags |= IORESOURCE_MEM;
- if (attr & PCI_BASE_ADDRESS_MEM_PREFETCH)
+ if (attr & PCI_BASE_ADDRESS_MEM_PREFETCH) {
resource->flags |= IORESOURCE_PREFETCH;
+ if (CONFIG(PCIEXP_HOTPLUG_PREFETCH_MEM_ABOVE_4G)
+ && dev_path_hotplug(dev))
+ resource->flags |= IORESOURCE_ABOVE_4G;
+ }
attr &= PCI_BASE_ADDRESS_MEM_LIMIT_MASK;
if (attr == PCI_BASE_ADDRESS_MEM_LIMIT_32) {
/* 32bit limit. */
diff --git a/src/device/pciexp_device.c b/src/device/pciexp_device.c
index c8ac391c06..6023497241 100644
--- a/src/device/pciexp_device.c
+++ b/src/device/pciexp_device.c
@@ -646,6 +646,7 @@ static struct device_operations pciexp_hotplug_dummy_ops = {
void pciexp_hotplug_scan_bridge(struct device *dev)
{
+ dev->hotplug_port = 1;
dev->hotplug_buses = CONFIG_PCIEXP_HOTPLUG_BUSES;
/* Normal PCIe Scan */