[U-Boot] [BUG] x86: incorrect dram definition in dram_init_banksize().

Heinrich Schuchardt xypron.glpk at gmx.de
Sat Jan 6 22:51:56 UTC 2018


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 at 0 {
                        reg = <0x0 0x0 0x0 0x1000000>;
                        no-map;
                };

But U-Boot does not yet support the concept of reserved memory.

Best regards

Heinrich


More information about the U-Boot mailing list