[U-Boot] 2018.09-rc1 breakage on orangepi pc2

Heinrich Schuchardt xypron.glpk at gmx.de
Sat Aug 4 12:21:17 UTC 2018


On 08/03/2018 12:07 AM, Mark Kettenis wrote:
>> Date: Thu, 2 Aug 2018 22:55:23 +0200 (CEST)
>> From: Mark Kettenis <mark.kettenis at xs4all.nl>
>>
>> I can no longer boot OpenBSD on the orangepi pc2.  The kernel faults
>> somewhere in the EFI detection code, almost certainly where it looks
>> through the configuration table entries looking for the ACPI table.
>> I've bisected this resulting in:
>>
>>
>> 4182a129ef735bfd6c54788affe1b649ab85b851 is the first bad commit
>> commit 4182a129ef735bfd6c54788affe1b649ab85b851
>> Author: Heinrich Schuchardt <xypron.glpk at gmx.de>
>> Date:   Thu Jun 28 12:45:32 2018 +0200
>>
>>     efi_loader: allocate configuration table array
>>     
>>     The system table contains a link to the list of configurations tables.
>>     These include the device tree, SMBIOS table, and the ACPI table.
>>     
>>     This array is currently statically linked. With the patch it is allocated
>>     as EFI_RUNTIME_SERVICES_DATA. Due to the structure of the system table we
>>     cannot work with a linked list here.
>>     
>>     Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
>>     Reviewed-by: Bin Meng <bmeng.cn at gmail.com>
>>     Signed-off-by: Alexander Graf <agraf at suse.de>
> 
> So after this commit, the ConfigurationTable field of the system table
> is no longer translated from a physical address into a virtual address
> when the SerVirtualAddressMap() runtime service gets called.
> 
> The way SetVirtualAddressMap() is implemented is actually quite nify.
> It "relocates" the relevant bits by processing the ELF relocations for
> everything that is marked as __efi_runtime_data.  This magically
> modifies all the pointers in the system table that reference other
> symbols, such as firmware_vendor, efi_runtime_services and
> efi_conf_table.  But since the diff replaces the reference to
> efi_conf_table with a dynamically updated pointer, there no longer is
> a relocation for the tables member.
> 
>>From the commit message it isn't abvious what is being fixed.  I think
> the commit should be reverted.
> 
Hello Mark,

thanks for pointing out the following requirement from the UEFI spec
that is not correctly implemented:

"Several fields of the EFI System Table must be converted from physical
pointers to virtual pointers using the ConvertPointer() service. These
fields include FirmwareVendor, RuntimeServices, and ConfigurationTable."

The EDK2 implementation is in
MdeModulePkg/Core/RuntimeDxe/Runtime.c:352:
RuntimeDriverConvertInternalPointer ((VOID **) &gST->ConfigurationTable);

I am currently testing a patch for this.

@Alex:

Relocation still has several todos:
- calculate crc32 after updating the system table
- provide ConvertPointer()
- do not assume U-Boot is the only runtime driver

Best regards

Heinrich


More information about the U-Boot mailing list