Pull request efi-2023-01-rc5-4
UEFI: * correct the vexpress loaddr which collides with memory used by EFI * consider the EFI memory map for LMB memory reservation * avoid RWX section warnings for .data section of *_efi.so files -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEbcT5xx8ppvoGt20zxIHbvCwFGsQFAmO4lKsACgkQxIHbvCwF GsRwdg/+NsC7KXm3NHVSbdLwgJrifKIMsz05O++ANyqYfFUpxtcOPundGegeZP6y 95dWhi/NAfckvbPifONNY/Do1Ue3j6Me+X9cbZPos8bA+8UeBkiy9NMwUUyE+/Ea cG7CTShC5uIiCmY3VR1CStJemVgGFEFk2zqnopOsi/UWjet4+gvXd1R7RIliuGoq 1VVb2mfjg8BtC6yHzjMncE3HFwZkLXOY81tpG5301JS1n00xUd5KQJVy30rVheH0 sygp3Bmme4VAF5gmH7sbxvWgqNibBzPxlrw2OlxgXmsfiGGT+McuoRt++iG+js90 5UojYgZA8P0juQW+vFDGT/rIUIxsTVrEsGQI4WN1+snFrSEkRt0xfjbegAEiTe8/ x2K8c7EXBGJ12mBN/vbyWXSY87DkvX+I5JRBrOqNT2iGZ0/b5XFszWKwWrq4VJNU hFoKjqARYBwieDM9lpPLQgWYRdiFwWd+WNNET4MqSbUUygh5Fm43swu/i1pgOnCY jOKn4+RJuhzfPS9SRiGI7IVzOkM8v58oBnnOMf+ipgJyCPOmFGvFvpxkSV+TJOUT MXinOYlr3GW+Ovqnh3AYqMS/4mPzlKAraQd3bQ2ECNFdNBYG/UJGQWaAG2HTR5uY HHkhYo17Egvq/dOGR5IV/XE9qBGxYDIa2kmbQD+xGcz9dYBYpk8= =t3Y+ -----END PGP SIGNATURE----- Merge tag 'efi-2023-01-rc5-4' of https://source.denx.de/u-boot/custodians/u-boot-efi Pull request efi-2023-01-rc5-4 UEFI: * correct the vexpress loaddr which collides with memory used by EFI * consider the EFI memory map for LMB memory reservation * avoid RWX section warnings for .data section of *_efi.so files
This commit is contained in:
commit
be914b00df
@ -7,6 +7,12 @@
|
||||
|
||||
OUTPUT_FORMAT("elf64-littleaarch64", "elf64-littleaarch64", "elf64-littleaarch64")
|
||||
OUTPUT_ARCH(aarch64)
|
||||
|
||||
PHDRS
|
||||
{
|
||||
data PT_LOAD FLAGS(3); /* SHF_WRITE | SHF_ALLOC */
|
||||
}
|
||||
|
||||
ENTRY(_start)
|
||||
SECTIONS
|
||||
{
|
||||
@ -49,7 +55,7 @@ SECTIONS
|
||||
. = ALIGN(512);
|
||||
_bss_end = .;
|
||||
_edata = .;
|
||||
}
|
||||
} :data
|
||||
_data_size = _edata - _data;
|
||||
.rela.dyn : { *(.rela.dyn) }
|
||||
.rela.plt : { *(.rela.plt) }
|
||||
|
@ -591,25 +591,15 @@ static void print_memory_attributes(u64 attributes)
|
||||
static int do_efi_show_memmap(struct cmd_tbl *cmdtp, int flag,
|
||||
int argc, char *const argv[])
|
||||
{
|
||||
struct efi_mem_desc *memmap = NULL, *map;
|
||||
efi_uintn_t map_size = 0;
|
||||
struct efi_mem_desc *memmap, *map;
|
||||
efi_uintn_t map_size;
|
||||
const char *type;
|
||||
int i;
|
||||
efi_status_t ret;
|
||||
|
||||
ret = efi_get_memory_map(&map_size, memmap, NULL, NULL, NULL);
|
||||
if (ret == EFI_BUFFER_TOO_SMALL) {
|
||||
map_size += sizeof(struct efi_mem_desc); /* for my own */
|
||||
ret = efi_allocate_pool(EFI_BOOT_SERVICES_DATA, map_size,
|
||||
(void *)&memmap);
|
||||
if (ret != EFI_SUCCESS)
|
||||
return CMD_RET_FAILURE;
|
||||
ret = efi_get_memory_map(&map_size, memmap, NULL, NULL, NULL);
|
||||
}
|
||||
if (ret != EFI_SUCCESS) {
|
||||
efi_free_pool(memmap);
|
||||
ret = efi_get_memory_map_alloc(&map_size, &memmap);
|
||||
if (ret != EFI_SUCCESS)
|
||||
return CMD_RET_FAILURE;
|
||||
}
|
||||
|
||||
printf("Type Start%.*s End%.*s Attributes\n",
|
||||
EFI_PHYS_ADDR_WIDTH - 5, spc, EFI_PHYS_ADDR_WIDTH - 3, spc);
|
||||
|
@ -147,6 +147,7 @@
|
||||
#include <config_distro_bootcmd.h>
|
||||
|
||||
#define CONFIG_EXTRA_ENV_SETTINGS \
|
||||
"loadaddr=0x60100000\0" \
|
||||
"kernel_addr_r=0x60100000\0" \
|
||||
"fdt_addr_r=0x60000000\0" \
|
||||
"bootargs=console=tty0 console=ttyAMA0,38400n8\0" \
|
||||
|
@ -736,6 +736,9 @@ efi_status_t efi_allocate_pool(enum efi_memory_type pool_type,
|
||||
efi_uintn_t size, void **buffer);
|
||||
/* EFI pool memory free function. */
|
||||
efi_status_t efi_free_pool(void *buffer);
|
||||
/* Allocate and retrieve EFI memory map */
|
||||
efi_status_t efi_get_memory_map_alloc(efi_uintn_t *map_size,
|
||||
struct efi_mem_desc **memory_map);
|
||||
/* Returns the EFI memory map */
|
||||
efi_status_t efi_get_memory_map(efi_uintn_t *memory_map_size,
|
||||
struct efi_mem_desc *memory_map,
|
||||
|
@ -736,6 +736,40 @@ efi_status_t efi_get_memory_map(efi_uintn_t *memory_map_size,
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
* efi_get_memory_map_alloc() - allocate map describing memory usage
|
||||
*
|
||||
* 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
|
||||
* Return: status code
|
||||
*/
|
||||
efi_status_t efi_get_memory_map_alloc(efi_uintn_t *map_size,
|
||||
struct efi_mem_desc **memory_map)
|
||||
{
|
||||
efi_status_t ret;
|
||||
|
||||
*memory_map = NULL;
|
||||
*map_size = 0;
|
||||
ret = efi_get_memory_map(map_size, *memory_map, NULL, NULL, NULL);
|
||||
if (ret == EFI_BUFFER_TOO_SMALL) {
|
||||
*map_size += sizeof(struct efi_mem_desc); /* for the map */
|
||||
ret = efi_allocate_pool(EFI_BOOT_SERVICES_DATA, *map_size,
|
||||
(void **)memory_map);
|
||||
if (ret != EFI_SUCCESS)
|
||||
return ret;
|
||||
ret = efi_get_memory_map(map_size, *memory_map,
|
||||
NULL, NULL, NULL);
|
||||
if (ret != EFI_SUCCESS) {
|
||||
efi_free_pool(*memory_map);
|
||||
*memory_map = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* efi_add_conventional_memory_map() - add a RAM memory area to the map
|
||||
*
|
||||
|
36
lib/lmb.c
36
lib/lmb.c
@ -7,7 +7,9 @@
|
||||
*/
|
||||
|
||||
#include <common.h>
|
||||
#include <efi_loader.h>
|
||||
#include <image.h>
|
||||
#include <mapmem.h>
|
||||
#include <lmb.h>
|
||||
#include <log.h>
|
||||
#include <malloc.h>
|
||||
@ -153,6 +155,37 @@ void arch_lmb_reserve_generic(struct lmb *lmb, ulong sp, ulong end, ulong align)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* efi_lmb_reserve() - add reservations for EFI memory
|
||||
*
|
||||
* Add reservations for all EFI memory areas that are not
|
||||
* EFI_CONVENTIONAL_MEMORY.
|
||||
*
|
||||
* @lmb: lmb environment
|
||||
* Return: 0 on success, 1 on failure
|
||||
*/
|
||||
static __maybe_unused int efi_lmb_reserve(struct lmb *lmb)
|
||||
{
|
||||
struct efi_mem_desc *memmap = NULL, *map;
|
||||
efi_uintn_t i, map_size = 0;
|
||||
efi_status_t ret;
|
||||
|
||||
ret = efi_get_memory_map_alloc(&map_size, &memmap);
|
||||
if (ret != EFI_SUCCESS)
|
||||
return 1;
|
||||
|
||||
for (i = 0, map = memmap; i < map_size / sizeof(*map); ++map, ++i) {
|
||||
if (map->type != EFI_CONVENTIONAL_MEMORY)
|
||||
lmb_reserve(lmb,
|
||||
map_to_sysmem((void *)(uintptr_t)
|
||||
map->physical_start),
|
||||
map->num_pages * EFI_PAGE_SIZE);
|
||||
}
|
||||
efi_free_pool(memmap);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void lmb_reserve_common(struct lmb *lmb, void *fdt_blob)
|
||||
{
|
||||
arch_lmb_reserve(lmb);
|
||||
@ -160,6 +193,9 @@ static void lmb_reserve_common(struct lmb *lmb, void *fdt_blob)
|
||||
|
||||
if (CONFIG_IS_ENABLED(OF_LIBFDT) && fdt_blob)
|
||||
boot_fdt_add_mem_rsv_regions(lmb, fdt_blob);
|
||||
|
||||
if (CONFIG_IS_ENABLED(EFI_LOADER))
|
||||
efi_lmb_reserve(lmb);
|
||||
}
|
||||
|
||||
/* Initialize the struct, add memory and call arch/board reserve functions */
|
||||
|
Loading…
Reference in New Issue
Block a user