summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShuo Liu <shuo.liu@intel.com>2022-08-02 01:50:36 +0800
committerMartin L Roth <gaumless@gmail.com>2022-08-13 16:39:33 +0000
commit0640c281c3efb870ffac1631d6562df4aa115810 (patch)
tree6930be17832fd2dd99819764d6a204daab36f52a /src
parent85894aa5bcb8f53d24aedc0e6b1f4f26ec1ef3e1 (diff)
device: Skip not assigned resources during global resource search
It's possible that some BARs are not got their resource successfully mapped, e.g. when these BARs are too large to fit into the available MMIO window. Not assigned resources might be with base address as 0x0. During global resource search, these not assigned resources should not be picked up. One example is MTRR calculation. MTRR calculation is based on global memory ranges. An unmapped BAR whose base is left as 0x0 will be mistakenly picked up and recognized as an UC range starting from 0x0. Change-Id: I9c3ea302058914f38a13a7739fc28d7f94527704 Signed-off-by: Shuo Liu <shuo.liu@intel.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/66347 Reviewed-by: Nico Huber <nico.h@gmx.de> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Jonathan Zhang <jonzhang@fb.com>
Diffstat (limited to 'src')
-rw-r--r--src/device/device_util.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/device/device_util.c b/src/device/device_util.c
index 80f82fd03d..809748465f 100644
--- a/src/device/device_util.c
+++ b/src/device/device_util.c
@@ -586,6 +586,10 @@ void search_global_resources(unsigned long type_mask, unsigned long type,
if (res->flags & IORESOURCE_SUBTRACTIVE)
continue;
+ /* If the resource is not assigned ignore it. */
+ if (!(res->flags & IORESOURCE_ASSIGNED))
+ continue;
+
search(gp, curdev, res);
}
}