[U-Boot] [PATCH 4/7] efi_loader: provide firmware revision

Heinrich Schuchardt xypron.glpk at gmx.de
Thu Jun 28 08:57:57 UTC 2018



On 06/28/2018 08:32 AM, Bin Meng wrote:
> Hi Heinrich,
> 
> On Thu, Jun 28, 2018 at 10:20 AM, Heinrich Schuchardt
> <xypron.glpk at gmx.de> wrote:
>> Provide a firmware revision in the system table using the Makefile
>> variables VERSION and PATCHLEVEL, e.g. 0x20180700 for v2018.07.
>>
>> Correct the type of the firmware vendor. It is a u16* pointer.
>>
>> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
>> ---
>>   include/efi_api.h             | 2 +-
>>   lib/efi_loader/Makefile       | 3 +++
>>   lib/efi_loader/efi_boottime.c | 5 +++--
>>   3 files changed, 7 insertions(+), 3 deletions(-)
>>
>> diff --git a/include/efi_api.h b/include/efi_api.h
>> index c409fc0bd0..cd502c2eb2 100644
>> --- a/include/efi_api.h
>> +++ b/include/efi_api.h
>> @@ -299,7 +299,7 @@ struct efi_configuration_table
>>
>>   struct efi_system_table {
>>          struct efi_table_hdr hdr;
>> -       unsigned long fw_vendor;   /* physical addr of wchar_t vendor string */
>> +       u16 *fw_vendor;   /* physical addr of wchar_t vendor string */
>>          u32 fw_revision;
>>          efi_handle_t con_in_handle;
>>          struct efi_simple_input_interface *con_in;
>> diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile
>> index c6046e36d2..049b923553 100644
>> --- a/lib/efi_loader/Makefile
>> +++ b/lib/efi_loader/Makefile
>> @@ -6,6 +6,9 @@
>>   # This file only gets included with CONFIG_EFI_LOADER set, so all
>>   # object inclusion implicitly depends on it
>>
>> +CFLAGS_efi_boottime.o += \
>> +  -DFW_VERSION="0x0$(VERSION)" \
>> +  -DFW_PATCHLEVEL="0x0$(PATCHLEVEL)"
> 
> Why additional 0 here? 0x$(VERSION) is enough.

For SUBLEVEL I have seen in u-boot/Makefile that it is currently set to 
to "".

If the same were be done for PATHCHLEVEL or VERSION the 0 would make a 
difference otherwise it is is superfluos.

Based on the definition of the version numbering scheme in
https://www.denx.de/wiki/U-Boot/ReleaseCycle
we can drop that safeguard.

Best regards

> 
>>   CFLAGS_helloworld.o := $(CFLAGS_EFI) -Os -ffreestanding
>>   CFLAGS_REMOVE_helloworld.o := $(CFLAGS_NON_EFI) -Os
>>
>> diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
>> index fe9a86b44b..7c619c652c 100644
>> --- a/lib/efi_loader/efi_boottime.c
>> +++ b/lib/efi_loader/efi_boottime.c
>> @@ -3042,7 +3042,7 @@ static const struct efi_boot_services efi_boot_services = {
>>          .create_event_ex = efi_create_event_ex,
>>   };
>>
>> -static uint16_t __efi_runtime_data firmware_vendor[] = L"Das U-Boot";
>> +static u16 __efi_runtime_data firmware_vendor[] = L"Das U-Boot";
>>
>>   struct efi_system_table __efi_runtime_data systab = {
>>          .hdr = {
>> @@ -3050,7 +3050,8 @@ struct efi_system_table __efi_runtime_data systab = {
>>                  .revision = EFI_SPECIFICATION_VERSION,
>>                  .headersize = sizeof(struct efi_system_table),
>>          },
>> -       .fw_vendor = (long)firmware_vendor,
>> +       .fw_vendor = firmware_vendor,
>> +       .fw_revision = FW_VERSION << 16 | FW_PATCHLEVEL << 8,
>>          .con_in = (void *)&efi_con_in,
>>          .con_out = (void *)&efi_con_out,
>>          .std_err = (void *)&efi_con_out,
>> --
> 
> Other than that,
> Reviewed-by: Bin Meng <bmeng.cn at gmail.com>
> 


More information about the U-Boot mailing list