Pull request for efi-2023-01-rc5-3

Documentation:
 
 * Describe building documentation
 
 UEFI:
 
 * Add .data section to aarch64 EFI binaries and correct section flags
 * Correct sorting of capsules when updating
 * Populate console handles in system table
 
 Other:
 
 * Fix description of eth_env_[gs]et_enetaddr() return value
 * Avoid endless loop in sound play command
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEbcT5xx8ppvoGt20zxIHbvCwFGsQFAmO1d9EACgkQxIHbvCwF
 GsQh/g/+L8SidakgdgkrKRm1eup+MmUrq1rZr1zdH35fx29nQCu5xUbqTfwLtST4
 NDRKc/WnVqUbfMm9WEgSAp+0cUm2qrv9y5JpSEoLUHmt6ZZUh/KrbOdA32Cm07WD
 FjB+Ki49jGEewBP2wlLuIgXDgiROjiLvQ8fl4DJ0piQGdeFPsSqXJZj4V2gM6/SQ
 eyAwRxwp0dsGoPHxWpvclLJCjgU/9cebiauyN3/pPLYL1MsxP1/HruXgi5TyAxxo
 qBQAv/pjJKIVfjo8l6cPlon4niXembqcybg+jqv+UfFj0ZDZ39XZ/zAoycW4wEhF
 RQRQo5cwQnPEWCUDzFn6qBF7rLBmbfDbuByZfNIEHmneLYysB46+95Qy7lM0sCUi
 wfc2MuWavKZ1H99lR8UTqwf24FY9Q88OVaDw0LCo+GSuiSFv5XnUoMVVe/yu8CmY
 DSUtSoX1VV0JAozDrH+J7O8MkWISBCd/m4S/wDNnrb6b6gig/BSVN9wrpxtvSgrO
 LJ/4zkRbjiNuxDXv3lD1c7Xpq+pcdyBzreTnrvSgadq5sMcLXhuTLcyNXt0L7EbD
 FgMVAkt02HRSA/xovvGLCcqZ7P+DmBitoleWislFvBYS/cY/N16L2LxfEwSZLLpD
 iYcjNddKsECDEk1rVW3+cq1wPstxBSilQhom+dn/nx3rkZuK57Q=
 =ItVV
 -----END PGP SIGNATURE-----

Merge tag 'efi-2023-01-rc5-3' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2023-01-rc5-3

Documentation:

* Describe building documentation

UEFI:

* Add .data section to aarch64 EFI binaries and correct section flags
* Correct sorting of capsules when updating
* Populate console handles in system table

Other:

* Fix description of eth_env_[gs]et_enetaddr() return value
* Avoid endless loop in sound play command
This commit is contained in:
Tom Rini 2023-01-04 08:50:24 -05:00
commit 8d6cbf5e6b
12 changed files with 219 additions and 22 deletions

View File

@ -25,7 +25,7 @@ pe_header:
.long IMAGE_NT_SIGNATURE /* 'PE' */
coff_header:
.short IMAGE_FILE_MACHINE_ARM64 /* AArch64 */
.short 2 /* nr_sections */
.short 3 /* nr_sections */
.long 0 /* TimeDateStamp */
.long 0 /* PointerToSymbolTable */
.long 0 /* NumberOfSymbols */
@ -40,7 +40,7 @@ optional_header:
.short IMAGE_NT_OPTIONAL_HDR64_MAGIC /* PE32+ format */
.byte 0x02 /* MajorLinkerVersion */
.byte 0x14 /* MinorLinkerVersion */
.long _edata - _start /* SizeOfCode */
.long _etext - _start /* SizeOfCode */
.long 0 /* SizeOfInitializedData */
.long 0 /* SizeOfUninitializedData */
.long _start - ImageBase /* AddressOfEntryPoint */
@ -48,7 +48,7 @@ optional_header:
extra_header_fields:
.quad 0 /* ImageBase */
.long 0x200 /* SectionAlignment */
.long 0x1000 /* SectionAlignment */
.long 0x200 /* FileAlignment */
.short 0 /* MajorOperatingSystemVersion */
.short 0 /* MinorOperatingSystemVersion */
@ -100,25 +100,46 @@ section_table:
.long 0 /* PointerToLineNumbers */
.short 0 /* NumberOfRelocations */
.short 0 /* NumberOfLineNumbers */
.long 0x42100040 /* Characteristics (section flags) */
/* Characteristics (section flags) */
.long (IMAGE_SCN_MEM_READ | \
IMAGE_SCN_MEM_DISCARDABLE | \
IMAGE_SCN_CNT_INITIALIZED_DATA)
.ascii ".text"
.byte 0
.byte 0
.byte 0 /* end of 0 padding of section name */
.long _edata - _start /* VirtualSize */
.long _etext - _start /* VirtualSize */
.long _start - ImageBase /* VirtualAddress */
.long _edata - _start /* SizeOfRawData */
.long _etext - _start /* SizeOfRawData */
.long _start - ImageBase /* PointerToRawData */
.long 0 /* PointerToRelocations */
.long 0 /* PointerToLineNumbers */
.short 0 /* NumberOfRelocations */
.short 0 /* NumberOfLineNumbers */
/* Characteristics (section flags) */
.long (IMAGE_SCN_MEM_READ | \
IMAGE_SCN_MEM_EXECUTE | \
IMAGE_SCN_CNT_CODE)
.long 0 /* PointerToRelocations (0 for executables) */
.long 0 /* PointerToLineNumbers (0 for executables) */
.short 0 /* NumberOfRelocations (0 for executables) */
.short 0 /* NumberOfLineNumbers (0 for executables) */
.long 0xe0500020 /* Characteristics (section flags) */
.ascii ".data"
.byte 0
.byte 0
.byte 0 /* end of 0 padding of section name */
.long _data_size /* VirtualSize */
.long _data - ImageBase /* VirtualAddress */
.long _data_size /* SizeOfRawData */
.long _data - ImageBase /* PointerToRawData */
.long 0 /* PointerToRelocations */
.long 0 /* PointerToLineNumbers */
.short 0 /* NumberOfRelocations */
.short 0 /* NumberOfLineNumbers */
/* Characteristics (section flags) */
.long (IMAGE_SCN_MEM_WRITE | \
IMAGE_SCN_MEM_READ | \
IMAGE_SCN_CNT_INITIALIZED_DATA)
.align 9
.align 12
_start:
stp x29, x30, [sp, #-32]!
mov x29, sp

View File

@ -18,11 +18,13 @@ SECTIONS
*(.gnu.linkonce.t.*)
*(.srodata)
*(.rodata*)
. = ALIGN(16);
*(.dynamic);
. = ALIGN(512);
}
_etext = .;
_text_size = . - _text;
.dynamic : { *(.dynamic) }
. = ALIGN(4096);
.data : {
_data = .;
*(.sdata)
@ -48,11 +50,11 @@ SECTIONS
_bss_end = .;
_edata = .;
}
_data_size = _edata - _data;
.rela.dyn : { *(.rela.dyn) }
.rela.plt : { *(.rela.plt) }
.rela.got : { *(.rela.got) }
.rela.data : { *(.rela.data) *(.rela.data*) }
_data_size = . - _etext;
. = ALIGN(4096);
.dynsym : { *(.dynsym) }

View File

@ -48,12 +48,12 @@ static int do_play(struct cmd_tbl *cmdtp, int flag, int argc,
++argv;
while (argc || first) {
first = false;
if (argc && *argv[0] != '-') {
if (argc) {
msec = dectoul(argv[0], NULL);
--argc;
++argv;
}
if (argc && *argv[0] != '-') {
if (argc) {
freq = dectoul(argv[0], NULL);
--argc;
++argv;

90
doc/build/documentation.rst vendored Normal file
View File

@ -0,0 +1,90 @@
.. SPDX-License-Identifier: GPL-2.0+:
Building documentation
======================
The U-Boot documentation is based on the Sphinx documentation generator.
HTML documentation
------------------
The *htmldocs* target is used to build the HTML documentation. It uses the
`Read the Docs Sphinx theme <https://sphinx-rtd-theme.readthedocs.io/en/stable/>`_.
.. code-block:: bash
# Create Python environment 'myenv'
python3 -m venv myenv
# Activate the Python environment
. myenv/bin/activate
# Install build requirements
python3 -m pip install -r doc/sphinx/requirements.txt
# Build the documentation
make htmldocs
# Deactivate the Python environment
deactivate
# Display the documentation in a graphical web browser
x-www-browser doc/output/index.html
Infodoc documentation
---------------------
The *infodocs* target builds both a texinfo and an info file:
.. code-block:: bash
# Create Python environment 'myenv'
python3 -m venv myenv
# Activate the Python environment
. myenv/bin/activate
# Install build requirements
python3 -m pip install -r doc/sphinx/requirements.txt
# Build the documentation
make infodocs
# Deactivate the Python environment
deactivate
# Display the documentation
info doc/output/texinfo/u-boot.info
PDF documentation
-----------------
The *pdfdocs* target is meant to be used to build PDF documenation.
As v2023.01 it fails with 'LaTeX Error: Too deeply nested'.
We can use texi2pdf instead:
.. code-block:: bash
# Create Python environment 'myenv'
python3 -m venv myenv
# Activate the Python environment
. myenv/bin/activate
# Install build requirements
python3 -m pip install -r doc/sphinx/requirements.txt
# Build the documentation
make texinfodocs
# Deactivate the Python environment
deactivate
# Convert to PDF
texi2pdf doc/output/texinfo/u-boot.texi
Texinfo documentation
---------------------
To build only the texinfo documentation the *texinfodocs* target is used:
.. code-block:: bash
# Create Python environment 'myenv'
python3 -m venv myenv
# Activate the Python environment
. myenv/bin/activate
# Install build requirements
python3 -m pip install -r doc/sphinx/requirements.txt
# Build the documentation
make texinfodocs
# Deactivate the Python environment
deactivate
The output is in file *doc/output/texinfo/u-boot.texi*.

1
doc/build/index.rst vendored
View File

@ -12,3 +12,4 @@ Build U-Boot
docker
tools
buildman
documentation

View File

@ -51,6 +51,19 @@
#define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
#define IMAGE_SUBSYSTEM_EFI_ROM 13
/* Section flags */
#define IMAGE_SCN_CNT_CODE 0x00000020
#define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040
#define IMAGE_SCN_CNT_UNINITIALIZED_ DATA 0x00000080
#define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000
#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
#define IMAGE_SCN_MEM_NOT_CACHED 0x04000000
#define IMAGE_SCN_MEM_NOT_PAGED 0x08000000
#define IMAGE_SCN_MEM_SHARED 0x10000000
#define IMAGE_SCN_MEM_EXECUTE 0x20000000
#define IMAGE_SCN_MEM_READ 0x40000000
#define IMAGE_SCN_MEM_WRITE 0x80000000
#define LINUX_ARM64_MAGIC 0x644d5241
#endif /* _ASM_PE_H */

View File

@ -173,6 +173,19 @@ s32 utf_to_lower(const s32 code);
*/
s32 utf_to_upper(const s32 code);
/**
* u16_strcasecmp() - compare two u16 strings case insensitively
*
* @s1: first string to compare
* @s2: second string to compare
* @n: maximum number of u16 to compare
* Return: 0 if the first n u16 are the same in s1 and s2
* < 0 if the first different u16 in s1 is less than the
* corresponding u16 in s2
* > 0 if the first different u16 in s1 is greater than the
*/
int u16_strcasecmp(const u16 *s1, const u16 *s2);
/**
* u16_strncmp() - compare two u16 string
*

View File

@ -226,7 +226,7 @@ int env_complete(char *var, int maxv, char *cmdv[], int maxsz, char *buf,
*
* @name: Environment variable to get (e.g. "ethaddr")
* @enetaddr: Place to put MAC address (6 bytes)
* Return: 0 if OK, 1 on error
* Return: 1 if OK, 0 on error
*/
int eth_env_get_enetaddr(const char *name, uint8_t *enetaddr);
@ -235,7 +235,7 @@ int eth_env_get_enetaddr(const char *name, uint8_t *enetaddr);
*
* @name: Environment variable to set (e.g. "ethaddr")
* @enetaddr: Pointer to MAC address to put into the variable (6 bytes)
* Return: 0 if OK, 1 on error
* Return: 0 if OK, non-zero otherwise
*/
int eth_env_set_enetaddr(const char *name, const uint8_t *enetaddr);

View File

@ -350,6 +350,32 @@ s32 utf_to_upper(const s32 code)
return ret;
}
/*
* u16_strcasecmp() - compare two u16 strings case insensitively
*
* @s1: first string to compare
* @s2: second string to compare
* @n: maximum number of u16 to compare
* Return: 0 if the first n u16 are the same in s1 and s2
* < 0 if the first different u16 in s1 is less than the
* corresponding u16 in s2
* > 0 if the first different u16 in s1 is greater than the
*/
int u16_strcasecmp(const u16 *s1, const u16 *s2)
{
int ret = 0;
s32 c1, c2;
for (;;) {
c1 = utf_to_upper(utf16_get(&s1));
c2 = utf_to_upper(utf16_get(&s2));
ret = c1 - c2;
if (ret || !c1 || c1 == -1 || c2 == -1)
break;
}
return ret;
}
/*
* u16_strncmp() - compare two u16 string
*

View File

@ -3956,8 +3956,11 @@ efi_status_t efi_initialize_system_table(void)
* These entries will be set to NULL in ExitBootServices(). To avoid
* relocation in SetVirtualAddressMap(), set them dynamically.
*/
systab.con_in_handle = efi_root;
systab.con_in = &efi_con_in;
systab.con_out_handle = efi_root;
systab.con_out = &efi_con_out;
systab.stderr_handle = efi_root;
systab.std_err = &efi_con_out;
systab.boottime = &efi_boot_services;

View File

@ -1108,10 +1108,13 @@ static efi_status_t efi_capsule_scan_dir(u16 ***files, unsigned int *num)
/* ignore an error */
EFI_CALL((*dirh->close)(dirh));
/* in ascii order */
/* FIXME: u16 version of strcasecmp */
/*
* Capsule files are applied in case insensitive alphabetic order
*
* TODO: special handling of rightmost period
*/
qsort(tmp_files, count, sizeof(*tmp_files),
(int (*)(const void *, const void *))strcasecmp);
(int (*)(const void *, const void *))u16_strcasecmp);
*files = tmp_files;
*num = count;
ret = EFI_SUCCESS;

View File

@ -624,6 +624,31 @@ static int unicode_test_utf_to_upper(struct unit_test_state *uts)
}
UNICODE_TEST(unicode_test_utf_to_upper);
static int unicode_test_u16_strcasecmp(struct unit_test_state *uts)
{
ut_assert(u16_strcasecmp(u"abcd", u"abcd") == 0);
ut_assert(u16_strcasecmp(u"aBcd", u"abcd") == 0);
ut_assert(u16_strcasecmp(u"abcd", u"abCd") == 0);
ut_assert(u16_strcasecmp(u"abcdE", u"abcd") > 0);
ut_assert(u16_strcasecmp(u"abcd", u"abcdE") < 0);
ut_assert(u16_strcasecmp(u"abcE", u"abcd") > 0);
ut_assert(u16_strcasecmp(u"abcd", u"abcE") < 0);
ut_assert(u16_strcasecmp(u"abcd", u"abcd") == 0);
ut_assert(u16_strcasecmp(u"abcd", u"abcd") == 0);
if (CONFIG_IS_ENABLED(EFI_UNICODE_CAPITALIZATION)) {
/* Cyrillic letters */
ut_assert(u16_strcasecmp(u"\x043a\x043d\x0438\x0433\x0430",
u"\x041a\x041d\x0418\x0413\x0410") == 0);
ut_assert(u16_strcasecmp(u"\x043a\x043d\x0438\x0433\x0430",
u"\x041a\x041d\x0418\x0413\x0411") < 0);
ut_assert(u16_strcasecmp(u"\x043a\x043d\x0438\x0433\x0431",
u"\x041a\x041d\x0418\x0413\x0410") > 0);
}
return 0;
}
UNICODE_TEST(unicode_test_u16_strcasecmp);
static int unicode_test_u16_strncmp(struct unit_test_state *uts)
{
ut_assert(u16_strncmp(u"abc", u"abc", 3) == 0);