From d1da7769c378da649a72b5b9027f9bdba94a6733 Mon Sep 17 00:00:00 2001 From: Patrick Rudolph Date: Mon, 30 Dec 2024 08:19:12 +0100 Subject: [PATCH] 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 Reviewed-on: https://review.coreboot.org/c/coreboot/+/85809 Tested-by: build bot (Jenkins) Reviewed-by: Shuo Liu --- src/soc/intel/xeon_sp/ebg/soc_xhci.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/soc/intel/xeon_sp/ebg/soc_xhci.c b/src/soc/intel/xeon_sp/ebg/soc_xhci.c index f8aa37b88d..f7b1320e86 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 @@ 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; }