On 01/06/2018 11:51 PM, Heinrich Schuchardt wrote: > Function efi_add_known_memory uses the configured DRAM banks > (gd->bd->bi_dram) to define the memory that an EFI application may use. > > For qemu-x86_defconfig this will result in the first 1 MB of physical > memory being available. Here we find the BIOS, interrupt vectors and the > VGA memory (0xA0000-0xBFFFF). > > As a result grubia32.efi writes unknowingly to the video memory. > > For reference: > In function install_e820_map() we block > [ISA_START_ADDRESS, ISA_END_ADDRESS[. > > The problem seems to stem from file arch/x86/cpu/qemu/dram.c, function > dram_init_banksize(): > > gd->bd->bi_dram[0].start = 0; > gd->bd->bi_dram[0].size = gd->ram_size; > > Probably exluding [ISA_START_ADDRESS, ISA_END_ADDRESS[ is not sufficient > as this does not protect interrupt vectors. > > Could you, please, provide reasonable values. > > Maybe a better idea would be to define reserved memory like the ones > that we find in the device trees, e.g. > > reserved-memory { > #address-cells = <2>; > #size-cells = <2>; > ranges; > > /* 16 MiB reserved for Hardware ROM Firmware */ > hwrom_reserved: hwrom@0 { > reg = <0x0 0x0 0x0 0x1000000>; > no-map; > }; > > But U-Boot does not yet support the concept of reserved memory.
This is how memory is reserved in arch/arm/mach-meson/board.c: static void meson_board_add_reserved_memory(void *fdt, u64 start, u64 size) { int ret; ret = fdt_add_mem_rsv(fdt, start, size); if (ret) printf("Could not reserve zone @ 0x%llx\n", start); if (IS_ENABLED(CONFIG_EFI_LOADER)) { efi_add_memory_map(start, ALIGN(size, EFI_PAGE_SIZE) >> EFI_PAGE_SHIFT, EFI_RESERVED_MEMORY_TYPE, false); } } Similar code can be found in: arch/arm/cpu/armv8/fsl-layerscape/fdt.c board/raspberrypi/rpi/rpi.c Maybe we can generalize this. > > Best regards > > Heinrich > _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot