aboutsummaryrefslogtreecommitdiff
path: root/src/device
diff options
context:
space:
mode:
Diffstat (limited to 'src/device')
-rw-r--r--src/device/Kconfig5
-rw-r--r--src/device/resource_allocator_v4.c5
2 files changed, 9 insertions, 1 deletions
diff --git a/src/device/Kconfig b/src/device/Kconfig
index 6f4a24ef1a..af9beb32f5 100644
--- a/src/device/Kconfig
+++ b/src/device/Kconfig
@@ -933,6 +933,11 @@ config RESOURCE_ALLOCATOR_V4
ranges for allocating resources. This allows allocation of resources
above 4G boundary as well.
+config RESOURCE_ALLOCATION_TOP_DOWN
+ bool "Allocate resources from top down"
+ default y
+ depends on RESOURCE_ALLOCATOR_V4
+
config XHCI_UTILS
def_bool n
help
diff --git a/src/device/resource_allocator_v4.c b/src/device/resource_allocator_v4.c
index 2b62fc8e2f..222f1e9a47 100644
--- a/src/device/resource_allocator_v4.c
+++ b/src/device/resource_allocator_v4.c
@@ -372,6 +372,9 @@ static void print_resource_ranges(const struct device *dev, const struct memrang
static void allocate_child_resources(struct bus *bus, struct memranges *ranges,
unsigned long type_mask, unsigned long type_match)
{
+ const bool allocate_top_down =
+ bus->dev->path.type == DEVICE_PATH_DOMAIN &&
+ CONFIG(RESOURCE_ALLOCATION_TOP_DOWN);
struct resource *resource = NULL;
const struct device *dev;
@@ -381,7 +384,7 @@ static void allocate_child_resources(struct bus *bus, struct memranges *ranges,
continue;
if (memranges_steal(ranges, resource->limit, resource->size, resource->align,
- type_match, &resource->base) == false) {
+ type_match, &resource->base, allocate_top_down) == false) {
printk(BIOS_ERR, " ERROR: Resource didn't fit!!! ");
printk(BIOS_DEBUG, " %s %02lx * size: 0x%llx limit: %llx %s\n",
dev_path(dev), resource->index,