coreboot-kgpe-d16/src/device
Nico Huber 117e436115 allocator_v4: Treat above 4G resources more natively
We currently have two competing mechanisms to limit the placement of
resources:

 1. the explicit `.limit` field of a resource, and
 2. the IORESOURCE_ABOVE_4G flag.

This makes the resource allocator unnecessarily complex. Ideally, we
would always reduce the `.limit` field if we want to "pin" a specific
resource below 4G. However, as that's not done across the tree yet,
we will use the _absence_ of the IORESOURCE_ABOVE_4G flag as a hint
to implicitly lower the `limit` of a resource. In this patch, this
is done inside the effective_limit() function that hides the flag
from the rest of the allocator.

To automatically place resources above 4G if their limit allows it,
we have to allocate from top down. Hence, we disable the prompt for
RESOURCE_ALLOCATION_TOP_DOWN if resources above 4G are requested.

One implication of the changes is that we act differently when a
cold-plugged device reports a prefetchable resource with 32-bit
limit. Before this change, we would fail to allocate the resource.
After this change, it forces everything on the same root port below
the 4G line.

A possible solution to get completely rid of the IORESOURCE_ABOVE_4G
flag would be rules to place resources of certain devices below 4G.
For instance, the primary VGA device and storage and HID devices
could be made available to a payload that can only address 32 bits.

For now, effective_limit() provides us enough abstraction as if the
`limit` would be the only variable to consider. With this, we get
rid of all the special handling of above 4G resources during phase 2
of the allocator. Which saves us about 20% of the code :D

Change-Id: I4c7fcd1f5146f6cc287bd3aa5582da55bc5d6955
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/65413
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2022-09-04 16:41:58 +00:00
..
dram device/dram/ddr4.c: note that dimm size calculation won't work for 3DS 2022-08-31 16:45:47 +00:00
oprom treewide: Remove "ERROR: "/"WARN: " prefixes from log messages 2022-02-07 23:29:09 +00:00
azalia_device.c treewide: Get rid of CONFIG_AZALIA_MAX_CODECS 2022-02-22 17:40:30 +00:00
cardbus_device.c
cpu_device.c
device.c arch/x86/ebda.c: Move setting up ebda to a BS hook 2022-05-17 11:24:12 +00:00
device_const.c device: Drop unused function dev_find_matching_device_on_bus 2021-09-24 21:20:07 +00:00
device_util.c pciexp_device: Propagate above-4G flag to all hotplug devices 2022-09-04 16:39:14 +00:00
gpio.c device + util/sconfig: introduce new device gpio 2020-12-28 17:47:04 +00:00
i2c.c
i2c_bus.c device/i2c_bus: Add routines to read and write multiple bytes 2022-09-04 14:55:59 +00:00
Kconfig allocator_v4: Treat above 4G resources more natively 2022-09-04 16:41:58 +00:00
Makefile.inc device/mipi: Move to drivers/mipi 2021-08-26 15:18:45 +00:00
mmio.c device/mmio: Make buffer_to_fifo32() take a const buffer 2021-09-20 12:07:51 +00:00
pci_class.c
pci_device.c pciexp_device: Propagate above-4G flag to all hotplug devices 2022-09-04 16:39:14 +00:00
pci_early.c src/acpi to src/lib: Fix spelling errors 2021-10-05 18:06:39 +00:00
pci_ops.c Rename ECAM-specific MMCONF Kconfigs 2021-11-10 17:24:16 +00:00
pci_rom.c src: Make PCI ID define names shorter 2022-03-07 08:32:09 +00:00
pciexp_device.c pciexp_device: Propagate above-4G flag to all hotplug devices 2022-09-04 16:39:14 +00:00
pcix_device.c
pnp_device.c treewide: Remove "ERROR: "/"WARN: " prefixes from log messages 2022-02-07 23:29:09 +00:00
resource_allocator_common.c src/device: Remove unused <console/console.h> 2021-02-15 10:48:28 +00:00
resource_allocator_v3.c
resource_allocator_v4.c allocator_v4: Treat above 4G resources more natively 2022-09-04 16:41:58 +00:00
root_device.c device: Export enable_static_device() function 2020-10-21 15:35:24 +00:00
smbus_ops.c
software_i2c.c
xhci.c device/xhci.c: Remove repeated word 2021-01-18 07:33:25 +00:00