[U-Boot] [PATCH v3 4/5] efi_loader: EFI_UNICODE_COLLATION_PROTOCOL

Alexander Graf agraf at suse.de
Tue Sep 4 22:04:04 UTC 2018



On 04.09.18 19:12, Heinrich Schuchardt wrote:
> On 09/04/2018 03:46 PM, Alexander Graf wrote:
>>
>>
>> On 03.09.18 18:35, Heinrich Schuchardt wrote:
>>> The patch implements the EFI_UNICODE_COLLATION_PROTOCOL.
>>>
>>> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
>>> ---
>>> v3:
>>> 	no change
>>> v2:
>>> 	add more comments
>>> ---
>>>  MAINTAINERS                            |   2 +
>>>  include/cp1250.h                       |  40 +++
>>>  include/cp437.h                        |  40 +++
>>>  include/efi_api.h                      |  21 ++
>>>  include/efi_loader.h                   |   5 +
>>>  lib/efi_loader/Makefile                |  18 +-
>>>  lib/efi_loader/efi_boottime.c          |   6 +
>>>  lib/efi_loader/efi_unicode_collation.c | 329 +++++++++++++++++++++++++
>>>  8 files changed, 457 insertions(+), 4 deletions(-)
>>>  create mode 100644 include/cp1250.h
>>>  create mode 100644 include/cp437.h
>>>  create mode 100644 lib/efi_loader/efi_unicode_collation.c
>>>
>>> diff --git a/MAINTAINERS b/MAINTAINERS
>>> index 8c9cd83347..67b015205c 100644
>>> --- a/MAINTAINERS
>>> +++ b/MAINTAINERS
>>> @@ -382,6 +382,8 @@ F:	doc/README.uefi
>>>  F:	doc/README.iscsi
>>>  F:	Documentation/efi.rst
>>>  F:	include/capitalization.h
>>> +F:	include/cp1250.h
>>> +F:	include/cp437.h
>>>  F:	include/efi*
>>>  F:	include/pe.h
>>>  F:	include/asm-generic/pe.h
>>> diff --git a/include/cp1250.h b/include/cp1250.h
>>> new file mode 100644
>>> index 0000000000..adacf8a958
>>> --- /dev/null
>>> +++ b/include/cp1250.h
>>> @@ -0,0 +1,40 @@
>>> +/* SPDX-License-Identifier: GPL-2.0+ */
>>> +
>>> +/*
>>> + * Constant CP1250 contains the Unicode code points for characters 0x80 - 0xff
>>> + * of the code page 1250.
>>> + */
>>> +#define CP1250 { \
>>> +	0x20ac, 0x0000, 0x201a, 0x0000, \
>>> +	0x201e, 0x2026, 0x2020, 0x2021, \
>>> +	0x0000, 0x2030, 0x0160, 0x2039, \
>>> +	0x015a, 0x0164, 0x017d, 0x0179, \
>>> +	0x0000, 0x2018, 0x2019, 0x201c, \
>>> +	0x201d, 0x2022, 0x2013, 0x2014, \
>>> +	0x0000, 0x2122, 0x0161, 0x203a, \
>>> +	0x015b, 0x0165, 0x017e, 0x017a, \
>>> +	0x00a0, 0x02c7, 0x02d8, 0x0141, \
>>> +	0x00a4, 0x0104, 0x00a6, 0x00a7, \
>>> +	0x00a8, 0x00a9, 0x015e, 0x00ab, \
>>> +	0x00ac, 0x00ad, 0x00ae, 0x017b, \
>>> +	0x00b0, 0x00b1, 0x02db, 0x0142, \
>>> +	0x00b4, 0x00b5, 0x00b6, 0x00b7, \
>>> +	0x00b8, 0x0105, 0x015f, 0x00bb, \
>>> +	0x013d, 0x02dd, 0x013e, 0x017c, \
>>> +	0x0154, 0x00c1, 0x00c2, 0x0102, \
>>> +	0x00c4, 0x0139, 0x0106, 0x00c7, \
>>> +	0x010c, 0x00c9, 0x0118, 0x00cb, \
>>> +	0x011a, 0x00cd, 0x00ce, 0x010e, \
>>> +	0x0110, 0x0143, 0x0147, 0x00d3, \
>>> +	0x00d4, 0x0150, 0x00d6, 0x00d7, \
>>> +	0x0158, 0x016e, 0x00da, 0x0170, \
>>> +	0x00dc, 0x00dd, 0x0162, 0x00df, \
>>> +	0x0155, 0x00e1, 0x00e2, 0x0103, \
>>> +	0x00e4, 0x013a, 0x0107, 0x00e7, \
>>> +	0x010d, 0x00e9, 0x0119, 0x00eb, \
>>> +	0x011b, 0x00ed, 0x00ee, 0x010f, \
>>> +	0x0111, 0x0144, 0x0148, 0x00f3, \
>>> +	0x00f4, 0x0151, 0x00f6, 0x00f7, \
>>> +	0x0159, 0x016f, 0x00fa, 0x0171, \
>>> +	0x00fc, 0x00fd, 0x0163, 0x02d9, \
>>> +}
>>> diff --git a/include/cp437.h b/include/cp437.h
>>> new file mode 100644
>>> index 0000000000..0b2b97132e
>>> --- /dev/null
>>> +++ b/include/cp437.h
>>> @@ -0,0 +1,40 @@
>>> +/* SPDX-License-Identifier: GPL-2.0+ */
>>> +
>>> +/*
>>> + * Constant CP437 contains the Unicode code points for characters 0x80 - 0xff
>>> + * of the code page 437.
>>> + */
>>> +#define CP437 { \
>>> +	0x00c7, 0x00fc, 0x00e9, 0x00e2, \
>>> +	0x00e4, 0x00e0, 0x00e5, 0x00e7, \
>>> +	0x00ea, 0x00eb, 0x00e8, 0x00ef, \
>>> +	0x00ee, 0x00ec, 0x00c4, 0x00c5, \
>>> +	0x00c9, 0x00e6, 0x00c6, 0x00f4, \
>>> +	0x00f6, 0x00f2, 0x00fb, 0x00f9, \
>>> +	0x00ff, 0x00d6, 0x00dc, 0x00a2, \
>>> +	0x00a3, 0x00a5, 0x20a7, 0x0192, \
>>> +	0x00e1, 0x00ed, 0x00f3, 0x00fa, \
>>> +	0x00f1, 0x00d1, 0x00aa, 0x00ba, \
>>> +	0x00bf, 0x2310, 0x00ac, 0x00bd, \
>>> +	0x00bc, 0x00a1, 0x00ab, 0x00bb, \
>>> +	0x2591, 0x2592, 0x2593, 0x2502, \
>>> +	0x2524, 0x2561, 0x2562, 0x2556, \
>>> +	0x2555, 0x2563, 0x2551, 0x2557, \
>>> +	0x255d, 0x255c, 0x255b, 0x2510, \
>>> +	0x2514, 0x2534, 0x252c, 0x251c, \
>>> +	0x2500, 0x253c, 0x255e, 0x255f, \
>>> +	0x255a, 0x2554, 0x2569, 0x2566, \
>>> +	0x2560, 0x2550, 0x256c, 0x2567, \
>>> +	0x2568, 0x2564, 0x2565, 0x2559, \
>>> +	0x2558, 0x2552, 0x2553, 0x256b, \
>>> +	0x256a, 0x2518, 0x250c, 0x2588, \
>>> +	0x2584, 0x258c, 0x2590, 0x2580, \
>>> +	0x03b1, 0x00df, 0x0393, 0x03c0, \
>>> +	0x03a3, 0x03c3, 0x00b5, 0x03c4, \
>>> +	0x03a6, 0x0398, 0x03a9, 0x03b4, \
>>> +	0x221e, 0x03c6, 0x03b5, 0x2229, \
>>> +	0x2261, 0x00b1, 0x2265, 0x2264, \
>>> +	0x2320, 0x2321, 0x00f7, 0x2248, \
>>> +	0x00b0, 0x2219, 0x00b7, 0x221a, \
>>> +	0x207f, 0x00b2, 0x25a0, 0x00a0, \
>>> +}
>>> diff --git a/include/efi_api.h b/include/efi_api.h
>>> index ebf2a3bc18..1efc448184 100644
>>> --- a/include/efi_api.h
>>> +++ b/include/efi_api.h
>>> @@ -31,6 +31,7 @@ enum efi_timer_delay {
>>>  	EFI_TIMER_RELATIVE = 2
>>>  };
>>>  
>>> +#define efi_intn_t ssize_t
>>>  #define efi_uintn_t size_t
>>>  typedef uint16_t *efi_string_t;
>>>  
>>> @@ -958,4 +959,24 @@ struct efi_driver_binding_protocol {
>>>  	efi_handle_t driver_binding_handle;
>>>  };
>>>  
>>> +#define EFI_UNICODE_COLLATION_PROTOCOL2_GUID \
>>> +	EFI_GUID(0xa4c751fc, 0x23ae, 0x4c3e, \
>>> +		 0x92, 0xe9, 0x49, 0x64, 0xcf, 0x63, 0xf3, 0x49)
>>
>> Looks like the UEFI Shell requires the v1 GUID of the collation
>> protocol. Please add and advertise that too.
> 
> Hello Alex,
> 
> that protocol does not exist in the UEFI 2.7 spec and it is not required
> to run EDK2 ./ShellBinPkg/UefiShell/AArch64/Shell.efi on
> qemu_arm64_defconfig.
> 
> I just removed your patch
> XXX efi_loader collation: Expose v1 GUID as well
> from https://github.com/agraf/u-boot/commits/ebbr-demo
> and I am still able to run Shell.efi.

I just double checked and Shell.efi definitely fails for me without the
v1 protocol patch:

  $ wget
'https://github.com/ARM-software/edk2/raw/master/ShellBinPkg/UefiShell/AArch64/Shell.efi'
  $ qemu-system-aarch64 -M virt -cpu cortex-a57 -kernel u-boot
-nographic -m 2G -net nic,model=e1000 -net user,tftp=.,bootfile=Shell.efi


Alex


More information about the U-Boot mailing list