Matt DeVillier has submitted this change. ( https://review.coreboot.org/c/coreboot/+/85809?usp=email )
Change subject: soc/intel/xeon_sp/ebg/soc_xhci: Check if BAR is reachable ......................................................................
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 --- M src/soc/intel/xeon_sp/ebg/soc_xhci.c 1 file changed, 7 insertions(+), 0 deletions(-)
Approvals: build bot (Jenkins): Verified Shuo Liu: Looks good to me, approved
diff --git a/src/soc/intel/xeon_sp/ebg/soc_xhci.c b/src/soc/intel/xeon_sp/ebg/soc_xhci.c index f8aa37b..f7b1320 100644 --- a/src/soc/intel/xeon_sp/ebg/soc_xhci.c +++ b/src/soc/intel/xeon_sp/ebg/soc_xhci.c @@ -17,6 +17,13 @@ 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; }