[U-Boot] [RFC] efi: workaround for SCT (against unicode collation protocol)

Alexander Graf agraf at suse.de
Mon Oct 1 07:49:31 UTC 2018



On 01.10.18 09:35, AKASHI Takahiro wrote:
> UEFI SCT doesn't run on the latest u-boot (or Alex's efi-next).
> Among other issues, there are two problems around language handling:
> 1. SCT looks for efi_unicode_collation_protocol with an (old?) guid,
> 	{0x1d85cd7f, 0xf43d, 0x11d2,
> 	 0x9a, 0x0c, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d)
> 2. SCT uses a hard-coded language name, "eng," in SctInializeLib()
> 
> These assumptions conflict with Heinrich's current unicode implementation.
> 
> While this patch fixes them in a quick way, it's more of an informative
> one so that we will share and discuss them.

FWIW the collation protocol v1 is considered deprecated pretty much
since UEFI - and same goes for the "eng" name which is the v1
representation of "English".

I had a similar patch in my queue, but after consultation with Heinrich
we agreed that we should be a clean UEFI implementation without too much
legacy. What the goal instead should be is to help the UEFI people to
fix SCT to no longer require deprecated protocols.

I've thus added Vincent and Dong for input :).


Thanks,

Alex

> 
> Signed-off-by: AKASHI Takahiro <takahiro.akashi at linaro.org>
> ---
>  include/efi_api.h                      |  3 +++
>  include/efi_loader.h                   |  3 +++
>  lib/efi_loader/efi_root_node.c         |  2 ++
>  lib/efi_loader/efi_unicode_collation.c | 13 +++++++++++++
>  4 files changed, 21 insertions(+)
> 
> diff --git a/include/efi_api.h b/include/efi_api.h
> index daaaa78d72b0..841b680581c0 100644
> --- a/include/efi_api.h
> +++ b/include/efi_api.h
> @@ -1262,6 +1262,9 @@ struct efi_driver_binding_protocol {
>  	efi_handle_t driver_binding_handle;
>  };
>  
> +#define EFI_UNICODE_COLLATION_PROTOCOL_GUID \
> +	EFI_GUID(0x1d85cd7f, 0xf43d, 0x11d2, \
> +		 0x9a, 0x0c, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d)
>  #define EFI_UNICODE_COLLATION_PROTOCOL2_GUID \
>  	EFI_GUID(0xa4c751fc, 0x23ae, 0x4c3e, \
>  		 0x92, 0xe9, 0x49, 0x64, 0xcf, 0x63, 0xf3, 0x49)
> diff --git a/include/efi_loader.h b/include/efi_loader.h
> index c8760bebd6bc..2d99eba15e32 100644
> --- a/include/efi_loader.h
> +++ b/include/efi_loader.h
> @@ -104,6 +104,8 @@ extern const struct efi_device_path_to_text_protocol efi_device_path_to_text;
>  extern const struct efi_device_path_utilities_protocol
>  					efi_device_path_utilities;
>  /* Implementation of the EFI_UNICODE_COLLATION_PROTOCOL */
> +extern const struct efi_unicode_collation_protocol
> +					efi_unicode_collation_protocol_eng;
>  extern const struct efi_unicode_collation_protocol
>  					efi_unicode_collation_protocol;
>  extern const struct efi_hii_config_routing_protocol efi_hii_config_routing;
> @@ -142,6 +144,7 @@ extern const efi_guid_t efi_file_system_info_guid;
>  extern const efi_guid_t efi_guid_device_path_utilities_protocol;
>  /* GUID of the Unicode collation protocol */
>  extern const efi_guid_t efi_guid_unicode_collation_protocol;
> +extern const efi_guid_t efi_guid_unicode_collation_protocol2;
>  extern const efi_guid_t efi_guid_hii_config_routing_protocol;
>  extern const efi_guid_t efi_guid_hii_database_protocol;
>  extern const efi_guid_t efi_guid_hii_string_protocol;
> diff --git a/lib/efi_loader/efi_root_node.c b/lib/efi_loader/efi_root_node.c
> index b056ba3ee880..aadb47aba1cd 100644
> --- a/lib/efi_loader/efi_root_node.c
> +++ b/lib/efi_loader/efi_root_node.c
> @@ -70,6 +70,8 @@ efi_status_t efi_root_node_register(void)
>  
>  	/* Install Unicode collation protocol */
>  	ret = efi_add_protocol(root, &efi_guid_unicode_collation_protocol,
> +			       (void *)&efi_unicode_collation_protocol_eng);
> +	ret = efi_add_protocol(root, &efi_guid_unicode_collation_protocol2,
>  			       (void *)&efi_unicode_collation_protocol);
>  	if (ret != EFI_SUCCESS)
>  		goto failure;
> diff --git a/lib/efi_loader/efi_unicode_collation.c b/lib/efi_loader/efi_unicode_collation.c
> index 7f3ea3c77e4e..932feb3a9984 100644
> --- a/lib/efi_loader/efi_unicode_collation.c
> +++ b/lib/efi_loader/efi_unicode_collation.c
> @@ -28,6 +28,8 @@ static const u16 codepage[] = CP437;
>  
>  /* GUID of the EFI_UNICODE_COLLATION_PROTOCOL */
>  const efi_guid_t efi_guid_unicode_collation_protocol =
> +	EFI_UNICODE_COLLATION_PROTOCOL_GUID;
> +const efi_guid_t efi_guid_unicode_collation_protocol2 =
>  	EFI_UNICODE_COLLATION_PROTOCOL2_GUID;
>  
>  /**
> @@ -318,6 +320,17 @@ static bool EFIAPI efi_str_to_fat(struct efi_unicode_collation_protocol *this,
>  	return ret;
>  }
>  
> +const
> +struct efi_unicode_collation_protocol efi_unicode_collation_protocol_eng = {
> +	.stri_coll = efi_stri_coll,
> +	.metai_match = efi_metai_match,
> +	.str_lwr = efi_str_lwr,
> +	.str_upr = efi_str_upr,
> +	.fat_to_str = efi_fat_to_str,
> +	.str_to_fat = efi_str_to_fat,
> +	.supported_languages = "eng",
> +};
> +
>  const struct efi_unicode_collation_protocol efi_unicode_collation_protocol = {
>  	.stri_coll = efi_stri_coll,
>  	.metai_match = efi_metai_match,
> 


More information about the U-Boot mailing list