From b2fa1b2494d7182852010ddc33f2bbe28e11f06c Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Wed, 1 Nov 2017 07:40:31 +0100 Subject: vx900: skip remap of high memory ranges if unnecessary If the DRAM does *not* actually overlap the PCI space, the remap code notices it is the case, but for some reason proceeds with the remapping, attempting to remap a negatively sized chunk. Bummer. With a single 1024M (two ranks of 512M) module: Nothing to remap Mem remapping enabled Remapstart 5120(MB) Remapend 6144(MB) Top of RAM 1024MB New top of RAM 2560MB Wrote remap map a0101 Mem remapping enabled Remapstart 4096(MB) Remapend 2560(MB) New top of memory is at 2560MB Needless to say, subsequent ram_resource() ruins the memory map for the OS -- Linux won't boot without a mem= argument and memtest quickly. TEST=memtest and Linux boot on HP t5550 with 1024M of memory Change-Id: Ic221723a26c5d1a03bf34c7722b0abe115f456ba Signed-off-by: Lubomir Rintel Reviewed-on: https://review.coreboot.org/22271 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel Reviewed-by: Stefan Reinauer --- src/northbridge/via/vx900/northbridge.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/northbridge/via') diff --git a/src/northbridge/via/vx900/northbridge.c b/src/northbridge/via/vx900/northbridge.c index 36382934da..774f744366 100644 --- a/src/northbridge/via/vx900/northbridge.c +++ b/src/northbridge/via/vx900/northbridge.c @@ -120,6 +120,7 @@ static u64 vx900_remap_above_4g(device_t mcu, u32 tolm) */ if (tolm >= vx900_get_top_of_ram(mcu)) { printk(BIOS_DEBUG, "Nothing to remap\n"); + return 0; } /* This is how the Vendor BIOS. Keep it for comparison for now */ @@ -275,7 +276,8 @@ static void vx900_set_resources(device_t dev) uma_memory_size >> 20); /* FIXME: How do we handle remapping above 4G? */ u64 tor = vx900_remap_above_4g(mcu, pci_tolm); - ram_resource(dev, idx++, RAM_4GB >> 10, (tor - RAM_4GB) >> 10); + if (tor) + ram_resource(dev, idx++, RAM_4GB >> 10, (tor - RAM_4GB) >> 10); set_late_cbmem_top(tolmk << 10); -- cgit v1.2.3