From 54ecaf1172d1e85ef021a63783b23e77401f3a0a Mon Sep 17 00:00:00 2001 From: Pengfei Xu Date: Fri, 13 Sep 2024 15:54:30 +0800 Subject: [PATCH] pcie_check.c: remove MMIO base address detection by dmesg way Remove MMIO base address detection by dmesg way, because in CXL QEMU environment, dmesg shows incorrect MMIO base address "0xffc00000": " [ 0.000000] efi: Remove mem128: MMIO range=[0xffc00000-0xffffffff] (4MB) from e820 map " And use MCFG way directly and it could detect correct MMIO base address "0xe0000000" for CXL QEMU environment. Signed-off-by: Pengfei Xu --- BM/tools/pcie/pcie_check.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/BM/tools/pcie/pcie_check.c b/BM/tools/pcie/pcie_check.c index bf754aa4..a56eae93 100644 --- a/BM/tools/pcie/pcie_check.c +++ b/BM/tools/pcie/pcie_check.c @@ -178,15 +178,19 @@ int find_bar(void) } fclose(maps); + /* + * In CXL QEMU environment, MMIO base address is incorrect, + * so will not use dmesg check way to detect the MMIO base + * address, will use mcfg way instead. + * if (BASE_ADDR == 0) { + * BASE_ADDR = find_base_from_dmesg(); + * } + */ if (BASE_ADDR == 0) { - //printf("Check kconfig CONFIG_IO_STRICT_DEVMEM or v6.9 or newer kernel!\n"); - BASE_ADDR = find_base_from_dmesg(); + BASE_ADDR = find_base_from_mcfg(); if (BASE_ADDR == 0) { - BASE_ADDR = find_base_from_mcfg(); - if (BASE_ADDR == 0) { - printf("No MMIO in dmesg, /proc/iomem and mcfg, check acpidump.\n"); - exit(2); - } + printf("No MMIO in dmesg, /proc/iomem and mcfg, check acpidump.\n"); + exit(2); } } #endif