[coreboot-gerrit] New patch to review for coreboot: b987628 resource: Add prefetchable memory resource for PCI domain
Kyösti Mälkki (kyosti.malkki@gmail.com)
gerrit at coreboot.org
Tue Mar 24 05:29:53 CET 2015
Kyösti Mälkki (kyosti.malkki at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/8892
-gerrit
commit b987628d31b622a85bd612abb1691eacf7fb9c97
Author: Kyösti Mälkki <kyosti.malkki at gmail.com>
Date: Sun Mar 22 20:44:55 2015 +0200
resource: Add prefetchable memory resource for PCI domain
With the change, prefetchable and non-prefetchable MMIO resources will
no longer be interleaved in memory space. For prefetchable memory,
the top limit is adjusted such that all of these allocations will be below
non-prefetchable resources.
Change-Id: Ibf44deab0aed0a05759e78855e23146fc45cdc43
Signed-off-by: Kyösti Mälkki <kyosti.malkki at gmail.com>
---
src/device/Kconfig | 5 ----
src/device/device.c | 71 +++++++++----------------------------------------
src/device/pci_device.c | 6 +++++
3 files changed, 19 insertions(+), 63 deletions(-)
diff --git a/src/device/Kconfig b/src/device/Kconfig
index 8ddb58c..beb29fb 100644
--- a/src/device/Kconfig
+++ b/src/device/Kconfig
@@ -205,11 +205,6 @@ config PCI
bool
default n
-config PCI_64BIT_PREF_MEM
- bool
- depends on PCI
- default n
-
config HYPERTRANSPORT_PLUGIN_SUPPORT
bool
depends on PCI
diff --git a/src/device/device.c b/src/device/device.c
index dc53d62..33869d0 100644
--- a/src/device/device.c
+++ b/src/device/device.c
@@ -357,13 +357,6 @@ static void compute_resources(struct bus *bus, struct resource *bridge,
|| (child_bridge->flags & type_mask) != type)
continue;
- /*
- * Split prefetchable memory if combined. Many domains
- * use the same address space for prefetchable memory
- * and non-prefetchable memory. Bridges below them need
- * it separated. Add the PREFETCH flag to the type_mask
- * and type.
- */
link = dev->link_list;
while (link && link->link_num !=
IOINDEX_LINK(child_bridge->index))
@@ -375,10 +368,7 @@ static void compute_resources(struct bus *bus, struct resource *bridge,
dev_path(dev));
}
- compute_resources(link, child_bridge,
- type_mask | IORESOURCE_PREFETCH,
- type | (child_bridge->flags &
- IORESOURCE_PREFETCH));
+ compute_resources(link, child_bridge, type_mask, type);
}
}
@@ -587,13 +577,6 @@ static void allocate_resources(struct bus *bus, struct resource *bridge,
(child_bridge->flags & type_mask) != type)
continue;
- /*
- * Split prefetchable memory if combined. Many domains
- * use the same address space for prefetchable memory
- * and non-prefetchable memory. Bridges below them need
- * it separated. Add the PREFETCH flag to the type_mask
- * and type.
- */
link = dev->link_list;
while (link && link->link_num !=
IOINDEX_LINK(child_bridge->index))
@@ -603,23 +586,17 @@ static void allocate_resources(struct bus *bus, struct resource *bridge,
IOINDEX_LINK(child_bridge->index),
dev_path(dev));
- allocate_resources(link, child_bridge,
- type_mask | IORESOURCE_PREFETCH,
- type | (child_bridge->flags &
- IORESOURCE_PREFETCH));
+ allocate_resources(link, child_bridge, type_mask, type);
}
}
}
-#if CONFIG_PCI_64BIT_PREF_MEM
#define IORESOURCE_TYPE (IORESOURCE_IO | IORESOURCE_MEM | IORESOURCE_PREFETCH)
-#else
-#define IORESOURCE_TYPE (IORESOURCE_IO | IORESOURCE_MEM)
-#endif
static int resource_is(struct resource *res, u32 type)
{
- return (res->flags & IORESOURCE_TYPE) == type;
+ u32 mask = (IORESOURCE_TYPE & ~IORESOURCE_PREFETCH);
+ return (res->flags & mask) == type;
}
struct constraints {
@@ -750,8 +727,10 @@ static void avoid_fixed_resources(struct device *dev)
res->limit = lim->limit;
/* MEM resources need to start at the highest address manageable. */
- if (res->flags & IORESOURCE_MEM)
+ if (res->flags & IORESOURCE_MEM) {
res->base = resource_max(res);
+ lim->limit = res->base - 1;
+ }
printk(BIOS_SPEW, "%s:@%s %02lx base %08llx limit %08llx\n",
__func__, dev_path(dev), res->index, res->base, res->limit);
@@ -1041,21 +1020,9 @@ void dev_configure(void)
for (res = child->resource_list; res; res = res->next) {
if (res->flags & IORESOURCE_FIXED)
continue;
- if (res->flags & IORESOURCE_PREFETCH) {
- compute_resources(child->link_list,
- res, IORESOURCE_TYPE, (IORESOURCE_PREFETCH | IORESOURCE_MEM));
- continue;
- }
- if (res->flags & IORESOURCE_MEM) {
- compute_resources(child->link_list,
- res, IORESOURCE_TYPE, IORESOURCE_MEM);
- continue;
- }
- if (res->flags & IORESOURCE_IO) {
- compute_resources(child->link_list,
- res, IORESOURCE_TYPE, IORESOURCE_IO);
- continue;
- }
+
+ compute_resources(child->link_list, res,
+ IORESOURCE_TYPE, res->flags & IORESOURCE_TYPE);
}
}
@@ -1073,21 +1040,9 @@ void dev_configure(void)
for (res = child->resource_list; res; res = res->next) {
if (res->flags & IORESOURCE_FIXED)
continue;
- if (res->flags & IORESOURCE_PREFETCH) {
- allocate_resources(child->link_list,
- res, IORESOURCE_TYPE, (IORESOURCE_PREFETCH | IORESOURCE_MEM));
- continue;
- }
- if (res->flags & IORESOURCE_MEM) {
- allocate_resources(child->link_list,
- res, IORESOURCE_TYPE, IORESOURCE_MEM);
- continue;
- }
- if (res->flags & IORESOURCE_IO) {
- allocate_resources(child->link_list,
- res, IORESOURCE_TYPE, IORESOURCE_IO);
- continue;
- }
+
+ allocate_resources(child->link_list, res,
+ IORESOURCE_TYPE, res->flags & IORESOURCE_TYPE);
}
}
assign_resources(root->link_list);
diff --git a/src/device/pci_device.c b/src/device/pci_device.c
index 4651258..c8e6692 100644
--- a/src/device/pci_device.c
+++ b/src/device/pci_device.c
@@ -447,6 +447,12 @@ void pci_domain_read_resources(struct device *dev)
res->limit = 0xffffffffULL;
res->flags = IORESOURCE_MEM | IORESOURCE_SUBTRACTIVE |
IORESOURCE_ASSIGNED;
+
+ /* Initialize the system-wide memory resources constraints. */
+ res = new_resource(dev, IOINDEX_SUBTRACTIVE(2, 0));
+ res->limit = 0xffffffffULL;
+ res->flags = IORESOURCE_MEM | IORESOURCE_PREFETCH | IORESOURCE_SUBTRACTIVE |
+ IORESOURCE_ASSIGNED;
}
static void pci_set_resource(struct device *dev, struct resource *resource)
More information about the coreboot-gerrit
mailing list