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>
This commit is contained in:
Shuo Liu 2022-08-02 01:50:36 +08:00 committed by Martin L Roth
parent 85894aa5bc
commit 0640c281c3
1 changed files with 4 additions and 0 deletions

View File

@ -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);
}
}