Pull request for efi-2023-04-rc1

Documentation:
 
 * build infodocs target on Gitlab CI, Azure
 
 UEFI:
 
 * fix function descriptions
 * add .rela sections to .text on arm64
 * use EFI_EXIT in efi_riscv_get_boot_hartid
 * improve specification conformance of set_keyboard_layout()
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEbcT5xx8ppvoGt20zxIHbvCwFGsQFAmPBEjYACgkQxIHbvCwF
 GsRxCA//ftrtHdcrEvUVIVkUy8hZ57v8NBhCGaHNk2nZS7SbwG4MwWn4ll+MUeID
 Eq2YiUcRKMXfrcDMAgy9pBLs9Ox6zbK2Q0XIMq7UneL7jEyPPz2JuSeoRPyRR7kE
 7KExyyy4lM9EfMFIzwjD62Pk/Q57U/AYAq3/5l/A0khml6U0Jr8ODoUls0ozbBYz
 b4xB5FMc0JEiQnYQU7ZOewPqiKlWQgiPyajCsFqnlB9gXp6XZIvk2L+Fs6v9Asml
 9rG+3zgraR4gt0x9sgyWK/i6x4m7x3Wc0NlplQ94VmnWwMoxw9MA3SMP9QWuuRzM
 lCBfLCzfuiyYPO/VlBA8kTg7fjeM1r1lShQdzn/U5z/pprr5z7Vu6U2oXCupfgTh
 bau02amy4LVXNoPvuY8cDhtVYvsJXGmgLHNo/fxgnPpdnaorFhlzy73ARIK16opq
 QorlpMEwbjsYAwRAqz7JcnliRjO5jJZUTunA+RFT7DCWzH+f6vYp0Iwt1dJyEsg8
 fKk99ar4xH6AV0NKGB0HyedgG+sdc+vmAPCdGa+ESUvx4qAkX5K3P7UNju2foE9G
 /Mp3M/d+DhV1n3JGOR8uyj9R1NDLHVT2aeHiBKoXc7vFb1Ulevp8N9QU86WdQoat
 JwqOq9ZRuZA2Wli5hEp8pbZk9NlAuDW27vxZPvFtzv4K9bgBpsA=
 =EIV/
 -----END PGP SIGNATURE-----

Merge tag 'efi-2023-04-rc1' of https://source.denx.de/u-boot/custodians/u-boot-efi

Pull request for efi-2023-04-rc1

Documentation:

* build infodocs target on Gitlab CI, Azure

UEFI:

* fix function descriptions
* add .rela sections to .text on arm64
* use EFI_EXIT in efi_riscv_get_boot_hartid
* improve specification conformance of set_keyboard_layout()
This commit is contained in:
Tom Rini 2023-01-13 08:37:32 -05:00
commit b3f6e0ff1f
9 changed files with 117 additions and 51 deletions

View File

@ -76,8 +76,8 @@ stages:
steps:
- script: cppcheck -j$(nproc) --force --quiet --inline-suppr .
- job: htmldocs
displayName: 'Build HTML documentation'
- job: docs
displayName: 'Build documentation'
pool:
vmImage: $(ubuntu_vm)
container:
@ -89,6 +89,7 @@ stages:
. /tmp/venvhtml/bin/activate
pip install -r doc/sphinx/requirements.txt
make htmldocs
make infodocs
- job: todo
displayName: 'Search for TODO within source tree'

View File

@ -149,14 +149,15 @@ grep TODO/FIXME/HACK:
# search for HACK within source tree and ignore HACKKIT board
- grep -r HACK . | grep -v HACKKIT
# build HTML documentation
htmldocs:
# build documentation
docs:
stage: testsuites
script:
- virtualenv -p /usr/bin/python3 /tmp/venvhtml
- . /tmp/venvhtml/bin/activate
- pip install -r doc/sphinx/requirements.txt
- make htmldocs
- make infodocs
# some statistics about the code base
sloccount:

View File

@ -28,6 +28,10 @@ SECTIONS
*(.dynamic);
. = ALIGN(512);
}
.rela.dyn : { *(.rela.dyn) }
.rela.plt : { *(.rela.plt) }
.rela.got : { *(.rela.got) }
.rela.data : { *(.rela.data) *(.rela.data*) }
_etext = .;
_text_size = . - _text;
. = ALIGN(4096);
@ -57,10 +61,6 @@ SECTIONS
_edata = .;
} :data
_data_size = _edata - _data;
.rela.dyn : { *(.rela.dyn) }
.rela.plt : { *(.rela.plt) }
.rela.got : { *(.rela.got) }
.rela.data : { *(.rela.data) *(.rela.data*) }
. = ALIGN(4096);
.dynsym : { *(.dynsym) }

View File

@ -178,7 +178,6 @@ s32 utf_to_upper(const s32 code);
*
* @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

View File

@ -13,6 +13,7 @@
#include <dm/device-internal.h>
#include <dm/tag.h>
#include <event.h>
#include <efi_driver.h>
#include <efi_loader.h>
#include <fs.h>
#include <log.h>
@ -386,6 +387,7 @@ static int efi_fs_exists(struct blk_desc *desc, int part)
* @part_info: partition info
* @part: partition
* @disk: pointer to receive the created handle
* @agent_handle: handle of the EFI block driver
* Return: disk object
*/
static efi_status_t efi_disk_add_dev(
@ -395,7 +397,8 @@ static efi_status_t efi_disk_add_dev(
int dev_index,
struct disk_partition *part_info,
unsigned int part,
struct efi_disk_obj **disk)
struct efi_disk_obj **disk,
efi_handle_t agent_handle)
{
struct efi_disk_obj *diskobj;
struct efi_object *handle;
@ -529,17 +532,18 @@ error:
return ret;
}
/*
* Create a handle for a whole raw disk
/**
* efi_disk_create_raw() - create a handle for a whole raw disk
*
* @dev uclass device (UCLASS_BLK)
* @dev: udevice (UCLASS_BLK)
* @agent_handle: handle of the EFI block driver
*
* Create an efi_disk object which is associated with @dev.
* The type of @dev must be UCLASS_BLK.
*
* @return 0 on success, -1 otherwise
* Return: 0 on success, -1 otherwise
*/
static int efi_disk_create_raw(struct udevice *dev)
static int efi_disk_create_raw(struct udevice *dev, efi_handle_t agent_handle)
{
struct efi_disk_obj *disk;
struct blk_desc *desc;
@ -550,7 +554,7 @@ static int efi_disk_create_raw(struct udevice *dev)
diskid = desc->devnum;
ret = efi_disk_add_dev(NULL, NULL, desc,
diskid, NULL, 0, &disk);
diskid, NULL, 0, &disk, agent_handle);
if (ret != EFI_SUCCESS) {
if (ret == EFI_NOT_READY)
log_notice("Disk %s not ready\n", dev->name);
@ -569,17 +573,18 @@ static int efi_disk_create_raw(struct udevice *dev)
return 0;
}
/*
* Create a handle for a disk partition
/**
* efi_disk_create_part() - create a handle for a disk partition
*
* @dev uclass device (UCLASS_PARTITION)
* @dev: udevice (UCLASS_PARTITION)
* @agent_handle: handle of the EFI block driver
*
* Create an efi_disk object which is associated with @dev.
* The type of @dev must be UCLASS_PARTITION.
*
* @return 0 on success, -1 otherwise
* Return: 0 on success, -1 otherwise
*/
static int efi_disk_create_part(struct udevice *dev)
static int efi_disk_create_part(struct udevice *dev, efi_handle_t agent_handle)
{
efi_handle_t parent;
struct blk_desc *desc;
@ -608,7 +613,7 @@ static int efi_disk_create_part(struct udevice *dev)
dp_parent = (struct efi_device_path *)handler->protocol_interface;
ret = efi_disk_add_dev(parent, dp_parent, desc, diskid,
info, part, &disk);
info, part, &disk, agent_handle);
if (ret != EFI_SUCCESS) {
log_err("Adding partition for %s failed\n", dev->name);
return -1;
@ -623,17 +628,18 @@ static int efi_disk_create_part(struct udevice *dev)
return 0;
}
/*
* Create efi_disk objects for a block device
/**
* efi_disk_probe() - create efi_disk objects for a block device
*
* @dev uclass device (UCLASS_BLK)
* @ctx: event context - driver binding protocol
* @event: EV_PM_POST_PROBE event
*
* Create efi_disk objects for partitions as well as a raw disk
* which is associated with @dev.
* The type of @dev must be UCLASS_BLK.
* This function is expected to be called at EV_PM_POST_PROBE.
*
* @return 0 on success, -1 otherwise
* Return: 0 on success, -1 otherwise
*/
int efi_disk_probe(void *ctx, struct event *event)
{
@ -641,28 +647,30 @@ int efi_disk_probe(void *ctx, struct event *event)
enum uclass_id id;
struct blk_desc *desc;
struct udevice *child;
struct efi_driver_binding_extended_protocol *db_prot = ctx;
efi_handle_t agent_handle = db_prot->bp.driver_binding_handle;
int ret;
dev = event->data.dm.dev;
id = device_get_uclass_id(dev);
/* TODO: We won't support partitions in a partition */
/* We won't support partitions in a partition */
if (id != UCLASS_BLK)
return 0;
/*
* avoid creating duplicated objects now that efi_driver
* Avoid creating duplicated objects now that efi_driver
* has already created an efi_disk at this moment.
*/
desc = dev_get_uclass_plat(dev);
if (desc->uclass_id != UCLASS_EFI_LOADER) {
ret = efi_disk_create_raw(dev);
ret = efi_disk_create_raw(dev, agent_handle);
if (ret)
return -1;
}
device_foreach_child(child, dev) {
ret = efi_disk_create_part(child);
ret = efi_disk_create_part(child, agent_handle);
if (ret)
return -1;
}

View File

@ -758,6 +758,9 @@ set_keyboard_layout(const struct efi_hii_database_protocol *this,
{
EFI_ENTRY("%p, %pUs", this, key_guid);
if (!key_guid)
return EFI_EXIT(EFI_INVALID_PARAMETER);
return EFI_EXIT(EFI_NOT_FOUND);
}

View File

@ -78,12 +78,19 @@ static u64 checksum(struct efi_pool_allocation *alloc)
return ret;
}
/*
/**
* efi_mem_cmp() - comparator function for sorting memory map
*
* Sorts the memory list from highest address to lowest address
*
* When allocating memory we should always start from the highest
* address chunk, so sort the memory list such that the first list
* iterator gets the highest address and goes lower from there.
*
* @priv: unused
* @a: first memory area
* @b: second memory area
* Return: 1 if @a is before @b, -1 if @b is before @a, 0 if equal
*/
static int efi_mem_cmp(void *priv, struct list_head *a, struct list_head *b)
{
@ -98,11 +105,22 @@ static int efi_mem_cmp(void *priv, struct list_head *a, struct list_head *b)
return -1;
}
/**
* desc_get_end() - get end address of memory area
*
* @desc: memory descriptor
* Return: end address + 1
*/
static uint64_t desc_get_end(struct efi_mem_desc *desc)
{
return desc->physical_start + (desc->num_pages << EFI_PAGE_SHIFT);
}
/**
* efi_mem_sort() - sort memory map
*
* Sort the memory map and then try to merge adjacent memory areas.
*/
static void efi_mem_sort(void)
{
struct list_head *lhandle;
@ -148,12 +166,13 @@ static void efi_mem_sort(void)
}
}
/** efi_mem_carve_out - unmap memory region
/**
* efi_mem_carve_out() - unmap memory region
*
* @map: memory map
* @carve_desc: memory region to unmap
* @overlap_only_ram: the carved out region may only overlap RAM
* Return Value: the number of overlapping pages which have been
* Return: the number of overlapping pages which have been
* removed from the map,
* EFI_CARVE_NO_OVERLAP, if the regions don't overlap,
* EFI_CARVE_OVERLAPS_NONRAM, if the carve and map overlap,
@ -403,6 +422,13 @@ static efi_status_t efi_check_allocated(u64 addr, bool must_be_allocated)
return EFI_NOT_FOUND;
}
/**
* efi_find_free_memory() - find free memory pages
*
* @len: size of memory area needed
* @max_addr: highest address to allocate
* Return: pointer to free memory area or 0
*/
static uint64_t efi_find_free_memory(uint64_t len, uint64_t max_addr)
{
struct list_head *lhandle;
@ -445,13 +471,13 @@ static uint64_t efi_find_free_memory(uint64_t len, uint64_t max_addr)
return 0;
}
/*
* Allocate memory pages.
/**
* efi_allocate_pages - allocate memory pages
*
* @type type of allocation to be performed
* @memory_type usage type of the allocated memory
* @pages number of pages to be allocated
* @memory allocated memory
* @type: type of allocation to be performed
* @memory_type: usage type of the allocated memory
* @pages: number of pages to be allocated
* @memory: allocated memory
* Return: status code
*/
efi_status_t efi_allocate_pages(enum efi_allocate_type type,
@ -507,6 +533,13 @@ efi_status_t efi_allocate_pages(enum efi_allocate_type type,
return EFI_SUCCESS;
}
/**
* efi_alloc() - allocate memory pages
*
* @len: size of the memory to be allocated
* @memory_type: usage type of the allocated memory
* Return: pointer to the allocated memory area or NULL
*/
void *efi_alloc(uint64_t len, int memory_type)
{
uint64_t ret = 0;
@ -552,7 +585,7 @@ efi_status_t efi_free_pages(uint64_t memory, efi_uintn_t pages)
}
/**
* efi_alloc_aligned_pages - allocate
* efi_alloc_aligned_pages() - allocate aligned memory pages
*
* @len: len in bytes
* @memory_type: usage type of the allocated memory
@ -673,15 +706,15 @@ efi_status_t efi_free_pool(void *buffer)
return ret;
}
/*
* Get map describing memory usage.
/**
* efi_get_memory_map() - get map describing memory usage.
*
* @memory_map_size on entry the size, in bytes, of the memory map buffer,
* @memory_map_size: on entry the size, in bytes, of the memory map buffer,
* on exit the size of the copied memory map
* @memory_map buffer to which the memory map is written
* @map_key key for the memory map
* @descriptor_size size of an individual memory descriptor
* @descriptor_version version number of the memory descriptor structure
* @memory_map: buffer to which the memory map is written
* @map_key: key for the memory map
* @descriptor_size: size of an individual memory descriptor
* @descriptor_version: version number of the memory descriptor structure
* Return: status code
*/
efi_status_t efi_get_memory_map(efi_uintn_t *memory_map_size,
@ -741,8 +774,8 @@ efi_status_t efi_get_memory_map(efi_uintn_t *memory_map_size,
*
* The caller is responsible for calling FreePool() if the call succeeds.
*
* @memory_map buffer to which the memory map is written
* @map_size size of the memory map
* @map_size: size of the memory map
* @memory_map: buffer to which the memory map is written
* Return: status code
*/
efi_status_t efi_get_memory_map_alloc(efi_uintn_t *map_size,
@ -818,6 +851,11 @@ efi_status_t efi_add_conventional_memory_map(u64 ram_start, u64 ram_end,
return EFI_SUCCESS;
}
/**
* efi_add_known_memory() - add memory banks to map
*
* This function may be overridden for specific architectures.
*/
__weak void efi_add_known_memory(void)
{
u64 ram_top = board_get_usable_ram_top(0) & ~EFI_PAGE_MASK;
@ -844,7 +882,11 @@ __weak void efi_add_known_memory(void)
}
}
/* Add memory regions for U-Boot's memory and for the runtime services code */
/**
* add_u_boot_and_runtime() - add U-Boot code to memory map
*
* Add memory regions for U-Boot's memory and for the runtime services code.
*/
static void add_u_boot_and_runtime(void)
{
unsigned long runtime_start, runtime_end, runtime_pages;

View File

@ -31,7 +31,7 @@ efi_riscv_get_boot_hartid(struct riscv_efi_boot_protocol *this,
EFI_ENTRY("%p, %p", this, boot_hartid);
if (this != &riscv_efi_boot_prot || !boot_hartid)
return EFI_INVALID_PARAMETER;
return EFI_EXIT(EFI_INVALID_PARAMETER);
*boot_hartid = gd->arch.boot_hart;

View File

@ -564,7 +564,19 @@ out:
*/
static int test_hii_database_set_keyboard_layout(void)
{
efi_status_t ret;
PRINT_TESTNAME;
/* Invalid key guid. */
ret = hii_database_protocol->set_keyboard_layout(
hii_database_protocol, NULL);
if (ret != EFI_INVALID_PARAMETER) {
efi_st_error("set_keyboard_layout returned %u not invalid\n",
(unsigned int)ret);
return EFI_ST_FAILURE;
}
/* set_keyboard_layout() not implemented yet */
return EFI_ST_SUCCESS;
}