Pull request efi-2025-01-rc2

Documentation:

* include semihosting and K3 boards only once in table of contents
* include file-system API into HTML docs
* describe struct ext2_inode
* update Python requirements

UEFI:

* mark local functions static
* simplify efi_free_pages()
* pass correct end address value to  efi_dp_from_mem()
* fix typos in HII test and eficonfig command
This commit is contained in:
Tom Rini
2024-10-31 08:33:24 -06:00
20 changed files with 138 additions and 102 deletions

View File

@@ -963,7 +963,7 @@ static efi_status_t eficonfig_boot_add_enter_description(void *data)
return handle_user_input(bo->description, EFICONFIG_DESCRIPTION_MAX, 22,
"\n ** Edit Description **\n"
"\n"
" enter description: ");
" Enter description: ");
}
/**

7
doc/api/fs.rst Normal file
View File

@@ -0,0 +1,7 @@
.. SPDX-License-Identifier: GPL-2.0-or-later
File system API
===============
.. kernel-doc:: include/fs.h
:internal:

View File

@@ -12,6 +12,7 @@ U-Boot API documentation
dm
efi
event
fs
getopt
interrupt
led

View File

@@ -8,7 +8,6 @@ Emulation
acpi
blkdev
../../usage/semihosting
qemu-arm
qemu-mips
qemu-ppce500
@@ -16,3 +15,7 @@ Emulation
qemu-sbsa
qemu-x86
qemu-xtensa
Also see
* :doc:`../../usage/semihosting`

View File

@@ -32,19 +32,22 @@ K3 Based SoCs
am62ax_sk
am62x_sk
../beagle/am62x_beagleplay
../phytec/phycore-am62x
../toradex/verdin-am62
am62px_sk
am64x_evm
am65x_evm
j7200_evm
../beagle/j721e_beagleboneai64
j721e_evm
j721s2_evm
j722s_evm
j784s4_evm
K3 SoC based boards in other sections
* :doc:`../beagle/am62x_beagleplay`
* :doc:`../beagle/j721e_beagleboneai64`
* :doc:`../phytec/phycore-am62x`
* :doc:`../toradex/verdin-am62`
Boot Flow Overview
------------------

View File

@@ -1,25 +1,26 @@
alabaster==0.7.16
Babel==2.15.0
certifi==2024.7.4
charset-normalizer==3.3.2
docutils==0.20.1
idna==3.7
alabaster==1.0.0
babel==2.16.0
certifi==2024.8.30
charset-normalizer==3.4.0
docutils==0.21.2
idna==3.10
imagesize==1.4.1
Jinja2==3.1.4
MarkupSafe==2.1.5
MarkupSafe==3.0.2
packaging==24.1
pip==24.2
Pygments==2.18.0
requests==2.32.3
six==1.16.0
snowballstemmer==2.2.0
Sphinx==7.3.7
sphinx-prompt==1.8.0
sphinx-rtd-theme==2.0.0
sphinxcontrib-applehelp==1.0.8
sphinxcontrib-devhelp==1.0.6
sphinxcontrib-htmlhelp==2.0.5
Sphinx==8.1.3
sphinx-prompt==1.9.0
sphinx-rtd-theme==3.0.1
sphinxcontrib-applehelp==2.0.0
sphinxcontrib-devhelp==2.0.0
sphinxcontrib-htmlhelp==2.1.0
sphinxcontrib-jquery==4.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.7
sphinxcontrib-serializinghtml==1.1.10
urllib3==2.2.2
sphinxcontrib-qthelp==2.0.0
sphinxcontrib-serializinghtml==2.0.0
urllib3==2.2.3

View File

@@ -173,20 +173,38 @@ struct ext2_block_group {
__le32 bg_reserved;
};
/* The ext2 inode. */
/**
* struct ext2_inode - ext2 inode
*
* For details see Linux file
* Documentation/filesystems/ext4/inodes.rst.
*/
struct ext2_inode {
/** @mode: file mode */
__le16 mode;
/** @uid: lower 16 bits of owner UID */
__le16 uid;
/** @size: lower 32 bits of file size */
__le32 size;
/** @atime: last access time */
__le32 atime;
/** @ctime: last change time */
__le32 ctime;
/** @mtime: last modification time */
__le32 mtime;
/** @dtime: deletion time */
__le32 dtime;
/** @gid: lower 16 bits of group ID */
__le16 gid;
/** @nlinks: number of hard links */
__le16 nlinks;
__le32 blockcnt; /* Blocks of either 512 or block_size bytes */
/** @blockcnt: lower 32 bit of block count */
__le32 blockcnt;
/** @flags: inode flags */
__le32 flags;
/** @osd1: operating system specific data */
__le32 osd1;
/** @b: block map or extent tree */
union {
struct datablocks {
__le32 dir_blocks[INDIRECT_BLOCKS];
@@ -197,10 +215,19 @@ struct ext2_inode {
char symlink[60];
char inline_data[60];
} b;
/** @version: file version (for NFS) */
__le32 version;
/** @acl: lower 32 bit of extended attribute block */
__le32 acl;
__le32 size_high; /* previously dir_acl, but never used */
/** @size_high - dir_acl on ext2/3, upper 32 size bits on ext4
*
* In ext2/3 this field was named i_dir_acl, though it was usually set
* to zero and never used.
*/
__le32 size_high;
/** @fragment_addr - (obsolete) fragment address */
__le32 fragment_addr;
/** @osd2: operating system specific data */
__le32 osd2[3];
};

View File

@@ -25,7 +25,7 @@ struct blk_desc;
* do_fat_fsload - Run the fatload command
*
* @cmdtp: Command information for fatload
* @flag: Command flags (CMD_FLAG_...)
* @flag: Command flags (CMD_FLAG\_...)
* @argc: Number of arguments
* @argv: List of arguments
* Return: result (see enum command_ret_t)
@@ -37,7 +37,7 @@ int do_fat_fsload(struct cmd_tbl *cmdtp, int flag, int argc,
* do_ext2load - Run the ext2load command
*
* @cmdtp: Command information for ext2load
* @flag: Command flags (CMD_FLAG_...)
* @flag: Command flags (CMD_FLAG\_...)
* @argc: Number of arguments
* @argv: List of arguments
* Return: result (see enum command_ret_t)
@@ -145,7 +145,7 @@ int fs_size(const char *filename, loff_t *size);
* @offset: offset in the file from where to start reading
* @len: the number of bytes to read. Use 0 to read entire file.
* @actread: returns the actual number of bytes read
* Return: 0 if OK with valid *actread, -1 on error conditions
* Return: 0 if OK with valid @actread, -1 on error conditions
*/
int fs_read(const char *filename, ulong addr, loff_t offset, loff_t len,
loff_t *actread);
@@ -160,7 +160,7 @@ int fs_read(const char *filename, ulong addr, loff_t offset, loff_t len,
* @offset: offset in the file from where to start writing
* @len: the number of bytes to write
* @actwrite: returns the actual number of bytes written
* Return: 0 if OK with valid *actwrite, -1 on error conditions
* Return: 0 if OK with valid @actwrite, -1 on error conditions
*/
int fs_write(const char *filename, ulong addr, loff_t offset, loff_t len,
loff_t *actwrite);
@@ -186,57 +186,73 @@ struct fs_dirent {
unsigned int type;
/** @size: file size */
loff_t size;
/** @flags: attribute flags (FS_ATTR_*) */
/** @attr: attribute flags (FS_ATTR_*) */
u32 attr;
/** create_time: time of creation */
/** @create_time: time of creation */
struct rtc_time create_time;
/** access_time: time of last access */
/** @access_time: time of last access */
struct rtc_time access_time;
/** change_time: time of last modification */
/** @change_time: time of last modification */
struct rtc_time change_time;
/** name: file name */
/** @name: file name */
char name[FS_DIRENT_NAME_LEN];
};
/* Note: fs_dir_stream should be treated as opaque to the user of fs layer */
/**
* struct fs_dir_stream - Structure representing an opened directory
*
* Struct fs_dir_stream should be treated opaque to the user of fs layer.
* The fields @desc and @part are used by the fs layer.
* File system drivers pass additional private fields with the pointers
* to this structure.
*
* @desc: block device descriptor
* @part: partition number
*/
struct fs_dir_stream {
/* private to fs. layer: */
struct blk_desc *desc;
int part;
};
/*
/**
* fs_opendir - Open a directory
*
* @filename: the path to directory to open
* Return: a pointer to the directory stream or NULL on error and errno
* set appropriately
* .. note::
* The returned struct fs_dir_stream should be treated opaque to the
* user of the fs layer.
*
* @filename: path to the directory to open
* Return:
* A pointer to the directory stream or NULL on error and errno set
* appropriately
*/
struct fs_dir_stream *fs_opendir(const char *filename);
/*
/**
* fs_readdir - Read the next directory entry in the directory stream.
*
* Works in an analogous way to posix readdir(). The previously returned
* directory entry is no longer valid after calling fs_readdir() again.
* fs_readir works in an analogous way to posix readdir().
* The previously returned directory entry is no longer valid after calling
* fs_readdir() again.
* After fs_closedir() is called, the returned directory entry is no
* longer valid.
*
* @dirs: the directory stream
* Return: the next directory entry (only valid until next fs_readdir() or
* fs_closedir() call, do not attempt to free()) or NULL if the end of
* the directory is reached.
* Return:
* the next directory entry (only valid until next fs_readdir() or
* fs_closedir() call, do not attempt to free()) or NULL if the end of
* the directory is reached.
*/
struct fs_dirent *fs_readdir(struct fs_dir_stream *dirs);
/*
/**
* fs_closedir - close a directory stream
*
* @dirs: the directory stream
*/
void fs_closedir(struct fs_dir_stream *dirs);
/*
/**
* fs_unlink - delete a file or directory
*
* If a given name is a directory, it will be deleted only if it's empty
@@ -246,7 +262,7 @@ void fs_closedir(struct fs_dir_stream *dirs);
*/
int fs_unlink(const char *filename);
/*
/**
* fs_mkdir - Create a directory
*
* @filename: Name of directory to create
@@ -292,7 +308,7 @@ int do_fs_type(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
* do_fs_types - List supported filesystems.
*
* @cmdtp: Command information for fstypes
* @flag: Command flags (CMD_FLAG_...)
* @flag: Command flags (CMD_FLAG\_...)
* @argc: Number of arguments
* @argv: List of arguments
* Return: result (see enum command_ret_t)

View File

@@ -545,6 +545,8 @@ config EFI_BOOTMGR
config EFI_HTTP_BOOT
bool "EFI HTTP Boot support"
depends on NET || NET_LWIP
select CMD_NET
select CMD_DNS
select CMD_WGET
select BLKMAP

View File

@@ -225,7 +225,7 @@ static u32 f2h(fdt32_t val)
* @systable: system table
* Return: device tree or NULL
*/
void *get_dtb(struct efi_system_table *systable)
static void *get_dtb(struct efi_system_table *systable)
{
void *dtb = NULL;
efi_uintn_t i;
@@ -246,7 +246,7 @@ void *get_dtb(struct efi_system_table *systable)
* @pos: UTF-16 string
* Return: pointer to first non-whitespace
*/
u16 *skip_whitespace(u16 *pos)
static u16 *skip_whitespace(u16 *pos)
{
for (; *pos && *pos <= 0x20; ++pos)
;
@@ -260,7 +260,7 @@ u16 *skip_whitespace(u16 *pos)
* @keyword: keyword to be searched
* Return: true fi @string starts with the keyword
*/
bool starts_with(u16 *string, u16 *keyword)
static bool starts_with(u16 *string, u16 *keyword)
{
for (; *keyword; ++string, ++keyword) {
if (*string != *keyword)
@@ -272,7 +272,7 @@ bool starts_with(u16 *string, u16 *keyword)
/**
* do_help() - print help
*/
void do_help(void)
static void do_help(void)
{
error(u"dump - print device-tree\r\n");
error(u"load <dtb> - load device-tree from file\r\n");
@@ -332,7 +332,7 @@ open_file_system(struct efi_simple_file_system_protocol **file_system)
* @filename: file name
* Return: status code
*/
efi_status_t do_load(u16 *filename)
static efi_status_t do_load(u16 *filename)
{
struct efi_dt_fixup_protocol *dt_fixup_prot;
struct efi_simple_file_system_protocol *file_system;
@@ -469,7 +469,7 @@ out:
* @filename: file name
* Return: status code
*/
efi_status_t do_save(u16 *filename)
static efi_status_t do_save(u16 *filename)
{
struct efi_simple_file_system_protocol *file_system;
efi_uintn_t dtb_size;

View File

@@ -137,6 +137,7 @@ efi_status_t efi_run_image(void *source_buffer, efi_uintn_t source_size)
*/
file_path = efi_dp_from_mem(EFI_RESERVED_MEMORY_TYPE,
(uintptr_t)source_buffer,
(uintptr_t)source_buffer +
source_size);
/*
* Make sure that device for device_path exist

View File

@@ -385,7 +385,7 @@ err:
* @ctx: event context
* Return: status code
*/
efi_status_t efi_bootmgr_release_uridp(struct uridp_context *ctx)
static efi_status_t efi_bootmgr_release_uridp(struct uridp_context *ctx)
{
efi_status_t ret = EFI_SUCCESS;
efi_status_t ret2 = EFI_SUCCESS;

View File

@@ -1073,7 +1073,8 @@ efi_status_t efi_dp_from_name(const char *dev, const char *devnr,
efi_get_image_parameters(&image_addr, &image_size);
dp = efi_dp_from_mem(EFI_RESERVED_MEMORY_TYPE,
(uintptr_t)image_addr, image_size);
(uintptr_t)image_addr,
(uintptr_t)image_addr + image_size);
} else if (IS_ENABLED(CONFIG_NETDEVICES) && !strcmp(dev, "Net")) {
dp = efi_dp_from_eth();
} else if (!strcmp(dev, "Uart")) {

View File

@@ -561,11 +561,9 @@ static int efi_disk_create_raw(struct udevice *dev, efi_handle_t agent_handle)
{
struct efi_disk_obj *disk;
struct blk_desc *desc;
int diskid;
efi_status_t ret;
desc = dev_get_uclass_plat(dev);
diskid = desc->devnum;
ret = efi_disk_add_dev(NULL, NULL, desc,
NULL, 0, &disk, agent_handle);
@@ -608,7 +606,6 @@ static int efi_disk_create_part(struct udevice *dev, efi_handle_t agent_handle)
struct disk_part *part_data;
struct disk_partition *info;
unsigned int part;
int diskid;
struct efi_handler *handler;
struct efi_device_path *dp_parent;
struct efi_disk_obj *disk;
@@ -618,7 +615,6 @@ static int efi_disk_create_part(struct udevice *dev, efi_handle_t agent_handle)
return -1;
desc = dev_get_uclass_plat(dev_get_parent(dev));
diskid = desc->devnum;
part_data = dev_get_uclass_plat(dev);
part = part_data->partnum;

View File

@@ -521,7 +521,6 @@ efi_status_t efi_allocate_pages(enum efi_allocate_type type,
efi_status_t efi_free_pages(uint64_t memory, efi_uintn_t pages)
{
u64 len;
uint flags;
long status;
efi_status_t ret;
@@ -536,18 +535,17 @@ efi_status_t efi_free_pages(uint64_t memory, efi_uintn_t pages)
return EFI_INVALID_PARAMETER;
}
flags = LMB_NOOVERWRITE | LMB_NONOTIFY;
len = (u64)pages << EFI_PAGE_SHIFT;
/*
* The 'memory' variable for sandbox holds a pointer which has already
* been mapped with map_sysmem() from efi_allocate_pages(). Convert
* it back to an address LMB understands
*/
status = lmb_free_flags(map_to_sysmem((void *)(uintptr_t)memory), len,
flags);
LMB_NOOVERWRITE);
if (status)
return EFI_NOT_FOUND;
ret = efi_add_memory_map_pg(memory, pages, EFI_CONVENTIONAL_MEMORY,
false);
if (ret != EFI_SUCCESS)
return EFI_NOT_FOUND;
return ret;
}

View File

@@ -789,7 +789,7 @@ static const struct efi_tcg2_protocol efi_tcg2_protocol = {
/**
* tcg2_uninit - remove the final event table and free efi memory on failures
*/
void tcg2_uninit(void)
static void tcg2_uninit(void)
{
efi_status_t ret;

View File

@@ -289,7 +289,7 @@ static void *get_config_table(const efi_guid_t *guid)
* @len: length of buffer
* Return: checksum
*/
u8 checksum(void *buf, int len)
static u8 checksum(void *buf, int len)
{
u8 ret = 0;
@@ -304,7 +304,7 @@ u8 checksum(void *buf, int len)
*
* Return: status code
*/
efi_status_t do_check(void)
static efi_status_t do_check(void)
{
struct smbios3_entry *smbios3_anchor;
void *table, *table_end;
@@ -401,7 +401,7 @@ efi_status_t do_check(void)
* @buf: buffer to write
* @size: size of the buffer
*/
efi_status_t save_file(u16 *filename, void *buf, efi_uintn_t size)
static efi_status_t save_file(u16 *filename, void *buf, efi_uintn_t size)
{
efi_uintn_t ret;
struct efi_simple_file_system_protocol *file_system;

View File

@@ -913,7 +913,7 @@ static int test_hii_string_get_languages(void)
goto out;
}
efi_st_printf("got languages are %s\n", languages);
efi_st_printf("Available languages: %s\n", languages);
result = EFI_ST_SUCCESS;

View File

@@ -39,7 +39,7 @@
/* HII keyboard layout */
#define EFI_NULL_MODIFIER 0x0000
u8 packagelist1[] = {
static u8 packagelist1[] = {
// EFI_HII_PACKAGE_LIST_HEADER, length = 20
// SimpleFont, Font, GUID, Form, String, Image, DevicePath,
// (74) (110) 20 (8) 78 (67) (8)
@@ -262,7 +262,7 @@ u8 packagelist1[] = {
EFI_HII_PACKAGE_END
};
u8 packagelist2[] = {
static u8 packagelist2[] = {
// EFI_HII_PACKAGE_LIST_HEADER, length = 20
// SimpleFont, Font, GUID, KeyboardLayout, Form, End
// (74) (122) 20 192 (8) 4
@@ -424,30 +424,10 @@ u8 packagelist2[] = {
EFI_HII_PACKAGE_END // 1
};
efi_guid_t packagelist_guid1 =
EFI_GUID(0x03abcd89, 0x03f4, 0x7044,
0x81, 0xde, 0x99, 0xb1, 0x81, 0x20, 0xf7, 0x68);
efi_guid_t packagelist_guid2 =
EFI_GUID(0x8685ded3, 0x1bce, 0x43f3,
0xa2, 0x0c, 0xa3, 0x06, 0xec, 0x69, 0x72, 0xdd);
efi_guid_t kb_layout_guid11 =
static efi_guid_t kb_layout_guid11 =
EFI_GUID(0x8d40e495, 0xe2aa, 0x4c6f,
0x89, 0x70, 0x68, 0x85, 0x09, 0xee, 0xc7, 0xd2);
efi_guid_t kb_layout_guid12 =
EFI_GUID(0x2ae60b3e, 0xb9d6, 0x49d8,
0x9a, 0x16, 0xc2, 0x48, 0xf1, 0xeb, 0xa8, 0xdb);
efi_guid_t kb_layout_guid21 =
EFI_GUID(0xe0f56a1f, 0xdf6b, 0x4a7e,
0xa3, 0x9a, 0xe7, 0xa5, 0x19, 0x15, 0x45, 0xd6);
efi_guid_t kb_layout_guid22 =
EFI_GUID(0x47be6ac9, 0x54cc, 0x46f9,
0xa2, 0x62, 0xd5, 0x3b, 0x25, 0x6a, 0x0c, 0x34);
efi_guid_t package_guid =
static efi_guid_t package_guid =
EFI_GUID(0x0387c95a, 0xd703, 0x2346,
0xb2, 0xab, 0xd0, 0xc7, 0xdd, 0x90, 0x44, 0xf8);

View File

@@ -117,7 +117,7 @@ def test_efi_eficonfig(u_boot_console, efi_eficonfig_data):
press_up_down_enter_and_wait(0, 0, True, 'Quit')
# Press the enter key to select 'Description:' entry, then enter Description
press_up_down_enter_and_wait(0, 0, True, 'enter description:')
press_up_down_enter_and_wait(0, 0, True, 'Enter description:')
# Send Description user input, press ENTER key to complete
send_user_input_and_wait('test 1', 'Quit')
@@ -166,7 +166,7 @@ def test_efi_eficonfig(u_boot_console, efi_eficonfig_data):
press_up_down_enter_and_wait(0, 0, True, 'Quit')
# Press the enter key to select 'Description:' entry, then enter Description
press_up_down_enter_and_wait(0, 0, True, 'enter description:')
press_up_down_enter_and_wait(0, 0, True, 'Enter description:')
# Send Description user input, press ENTER key to complete
send_user_input_and_wait('test 2', 'Quit')
@@ -278,7 +278,7 @@ def test_efi_eficonfig(u_boot_console, efi_eficonfig_data):
u_boot_console.p.expect([i])
# Press the enter key to select 'Description:' entry, then enter Description
press_up_down_enter_and_wait(0, 0, True, 'enter description:')
press_up_down_enter_and_wait(0, 0, True, 'Enter description:')
# Send Description user input, press ENTER key to complete
send_user_input_and_wait('test 3', 'Quit')