soc/intel/xeon_sp/ebg/soc_xhci: Check if BAR is reachable

On x86_32 the xHCI BAR isn't reachable as it's mapped in high MMIO.
Currently this is not a problem since the code is unused.

Add a check and return NULL instead of cutting of the higher bits
and thus do not return an invalid pointer. On x86_64 it's working
when the extended page-tables are installed.

Change-Id: I00496ad476c33e0984d7cb0019f27154302edda5
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/85809
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Shuo Liu <shuo.liu@intel.com>
This commit is contained in:
Patrick Rudolph 2024-12-30 08:19:12 +01:00 committed by Matt DeVillier
commit d1da7769c3

View file

@ -17,6 +17,13 @@ static uint8_t *get_xhci_bar(void)
printk(BIOS_ERR, "XHCI BAR is not found\n");
return NULL;
}
#if ENV_X86_32
assert(res->base < 0x100000000ULL);
if (res->base >= 0x100000000ULL)
return NULL;
#endif
return (void *)(uintptr_t)res->base;
}