]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
x86/coreboot: Exclude memory regions starting above 4GB master
authorJeremy Compostella <jeremy.compostella@intel.com>
Wed, 4 Feb 2026 02:42:36 +0000 (19:42 -0700)
committerTom Rini <trini@konsulko.com>
Mon, 16 Feb 2026 18:00:42 +0000 (12:00 -0600)
This commit updates the RAM region filtering logic in
board_get_usable_ram_top() to skip any memory regions whose start address
is above 4GB. Previously, only the end address was capped at 4GB, but
regions entirely above this threshold were still considered.

Typically, the following memory map entries would cause
board_get_usable_ram_top() to return 0x100000000, which is incorrect.

    start=00000000, end=00001000, type=16
    start=00001000, end=000a0000, type=1
    start=000a0000, end=000f6000, type=2
    start=000f6000, end=000f7000, type=16
    start=000f7000, end=00100000, type=2
    start=00100000, end=6f170000, type=1
    start=6f170000, end=70000000, type=16
    start=70000000, end=80800000, type=2
    start=e0000000, end=f8000000, type=2
    start=fa000000, end=fc000000, type=2
    start=fc800000, end=fc880000, type=2
    start=fd800000, end=fe800000, type=2
    start=feb00000, end=feb80000, type=2
    start=fec00000, end=fed00000, type=2
    start=fed20000, end=fed80000, type=2
    start=feda1000, end=feda2000, type=2
    start=fedc0000, end=fede0000, type=2
    start=100000000, end=102400000, type=2
    start=102400000, end=47f800000, type=1
    start=4000000000, end=4020000000, type=2

By adding a check to continue the loop if the region's start address
exceeds 0xffffffffULL, the function now properly ignores regions that are
not usable in 32-bit address space.

Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>
arch/x86/cpu/coreboot/sdram.c

index 013225f129a9c6d34211211e3a7a13f3b9a481e8..cc1edd7badd8771c9217d3567b3380f8b627954d 100644 (file)
@@ -42,6 +42,8 @@ phys_addr_t board_get_usable_ram_top(phys_size_t total_size)
                        continue;
 
                /* Filter memory over 4GB. */
                        continue;
 
                /* Filter memory over 4GB. */
+               if (start > 0xffffffffULL)
+                       continue;
                if (end > 0xffffffffULL)
                        end = 0x100000000ULL;
                /* Skip this region if it's too small. */
                if (end > 0xffffffffULL)
                        end = 0x100000000ULL;
                /* Skip this region if it's too small. */