coreboot-kgpe-d16/src/device
Nico Huber 5226301765 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 and turn it on by default. Platforms
that are incompatible should be fixed, but can also override the
default as a temporary measure.

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

An earlier version of this change (commit 117e436115) had to be
reverted because of missing resource reservations in platform code.
This is worked around now with commit ae81497cb6 (device/pci:
Limit default domain memory window).

Change-Id: Ia822f0ce648c7f7afc801d9cb00b6459fe7cebea
Signed-off-by: Nico Huber <nico.h@gmx.de>
Original-reviewed-on: https://review.coreboot.org/c/coreboot/+/65413
Original-reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Original-reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/75012
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
Reviewed-by: Lean Sheng Tan <sheng.tan@9elements.com>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
2023-06-22 19:07:18 +00:00
..
dram device/dram: Update RDIMM classification from RIMM to DIMM 2023-05-31 18:52:39 +00:00
oprom treewide: Remove repeated words 2023-02-09 10:04:04 +00:00
azalia_device.c treewide: Get rid of CONFIG_AZALIA_MAX_CODECS 2022-02-22 17:40:30 +00:00
cardbus_device.c src/device: Clean up includes 2022-10-26 16:38:11 +00:00
cpu_device.c cpu/x86/topology: Add code to fill in topology on struct path 2023-04-06 15:27:23 +00:00
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 src/device + util/sconfig: Introduce new device 'mdio' 2022-11-24 05:53:55 +00:00
device_util.c console: Add format-checking __printf() to die() 2023-05-17 11:23:59 +00:00
gpio.c src/device: Clean up includes 2022-10-26 16:38:11 +00:00
i2c.c
i2c_bus.c src/device: Clean up includes 2022-10-26 16:38:11 +00:00
Kconfig allocator_v4: Treat above 4G resources more natively 2023-06-22 19:07:18 +00:00
Makefile.inc device/xhci: Add functions to work with resource pointers 2023-03-05 15:32:34 +00:00
mdio.c device/mdio: Provide helper functions for read and write 2022-11-24 05:58:28 +00:00
mmio.c src/device: Clean up includes 2022-10-26 16:38:11 +00:00
pci_class.c src/device: Clean up includes 2022-10-26 16:38:11 +00:00
pci_device.c device/pci: Limit default domain memory window 2023-06-01 13:11:33 +00:00
pci_early.c treewide: Remove duplicated include <device/pci.h> 2023-02-01 03:03:34 +00:00
pci_ops.c treewide: Remove duplicated include <device/pci.h> 2023-02-01 03:03:34 +00:00
pci_rom.c device/pci_rom: rework PCI ID remapping in pci_rom_probe 2023-03-09 20:57:40 +00:00
pciexp_device.c device/pciexp_device.c: Do not enable common clock if already active 2023-03-02 13:04:15 +00:00
pcix_device.c src/device: Clean up includes 2022-10-26 16:38:11 +00:00
pnp_device.c src/device: Clean up includes 2022-10-26 16:38:11 +00:00
resource_allocator_common.c src/device: Clean up includes 2022-10-26 16:38:11 +00:00
resource_allocator_v4.c allocator_v4: Treat above 4G resources more natively 2023-06-22 19:07:18 +00:00
root_device.c lib/version: Move board identification strings 2023-04-22 16:20:49 +00:00
smbus_ops.c console: Add format-checking __printf() to die() 2023-05-17 11:23:59 +00:00
software_i2c.c
xhci.c device/xhci: Add functions to work with resource pointers 2023-03-05 15:32:34 +00:00
xhci_resource.c device/xhci: Add functions to work with resource pointers 2023-03-05 15:32:34 +00:00