Merge branch 'next'

Signed-off-by: Tom Rini <trini@konsulko.com>
This commit is contained in:
Tom Rini 2023-04-03 16:45:41 -04:00
commit 288fe30a23
1254 changed files with 34309 additions and 23377 deletions

View file

@ -63,20 +63,6 @@ static bool is_sd(struct blk_desc *desc)
}
#endif
static void *dp_alloc(size_t sz)
{
void *buf;
if (efi_allocate_pool(EFI_BOOT_SERVICES_DATA, sz, &buf) !=
EFI_SUCCESS) {
debug("EFI: ERROR: out of memory in %s\n", __func__);
return NULL;
}
memset(buf, 0, sz);
return buf;
}
/*
* Iterate to next block in device-path, terminating (returning NULL)
* at /End* node.
@ -293,7 +279,7 @@ struct efi_device_path *efi_dp_dup(const struct efi_device_path *dp)
if (!dp)
return NULL;
ndp = dp_alloc(sz);
ndp = efi_alloc(sz);
if (!ndp)
return NULL;
memcpy(ndp, dp, sz);
@ -337,7 +323,7 @@ efi_device_path *efi_dp_append_or_concatenate(const struct efi_device_path *dp1,
/* both dp1 and dp2 are non-null */
unsigned sz1 = efi_dp_size(dp1);
unsigned sz2 = efi_dp_size(dp2);
void *p = dp_alloc(sz1 + sz2 + end_size);
void *p = efi_alloc(sz1 + sz2 + end_size);
if (!p)
return NULL;
ret = p;
@ -400,7 +386,7 @@ struct efi_device_path *efi_dp_append_node(const struct efi_device_path *dp,
ret = efi_dp_dup(dp);
} else if (!dp) {
size_t sz = node->length;
void *p = dp_alloc(sz + sizeof(END));
void *p = efi_alloc(sz + sizeof(END));
if (!p)
return NULL;
memcpy(p, node, sz);
@ -409,7 +395,7 @@ struct efi_device_path *efi_dp_append_node(const struct efi_device_path *dp,
} else {
/* both dp and node are non-null */
size_t sz = efi_dp_size(dp);
void *p = dp_alloc(sz + node->length + sizeof(END));
void *p = efi_alloc(sz + node->length + sizeof(END));
if (!p)
return NULL;
memcpy(p, dp, sz);
@ -430,7 +416,7 @@ struct efi_device_path *efi_dp_create_device_node(const u8 type,
if (length < sizeof(struct efi_device_path))
return NULL;
ret = dp_alloc(length);
ret = efi_alloc(length);
if (!ret)
return ret;
ret->type = type;
@ -452,7 +438,7 @@ struct efi_device_path *efi_dp_append_instance(
return efi_dp_dup(dpi);
sz = efi_dp_size(dp);
szi = efi_dp_instance_size(dpi);
p = dp_alloc(sz + szi + 2 * sizeof(END));
p = efi_alloc(sz + szi + 2 * sizeof(END));
if (!p)
return NULL;
ret = p;
@ -477,7 +463,7 @@ struct efi_device_path *efi_dp_get_next_instance(struct efi_device_path **dp,
if (!dp || !*dp)
return NULL;
sz = efi_dp_instance_size(*dp);
p = dp_alloc(sz + sizeof(END));
p = efi_alloc(sz + sizeof(END));
if (!p)
return NULL;
memcpy(p, *dp, sz + sizeof(END));
@ -918,7 +904,7 @@ struct efi_device_path *efi_dp_from_part(struct blk_desc *desc, int part)
{
void *buf, *start;
start = buf = dp_alloc(dp_part_size(desc, part) + sizeof(END));
start = buf = efi_alloc(dp_part_size(desc, part) + sizeof(END));
if (!buf)
return NULL;
@ -945,7 +931,7 @@ struct efi_device_path *efi_dp_part_node(struct blk_desc *desc, int part)
dpsize = sizeof(struct efi_device_path_cdrom_path);
else
dpsize = sizeof(struct efi_device_path_hard_drive_path);
buf = dp_alloc(dpsize);
buf = efi_alloc(dpsize);
if (buf)
dp_part_node(buf, desc, part);
@ -1019,7 +1005,7 @@ struct efi_device_path *efi_dp_from_file(struct blk_desc *desc, int part,
dpsize += fpsize;
start = buf = dp_alloc(dpsize + sizeof(END));
start = buf = efi_alloc(dpsize + sizeof(END));
if (!buf)
return NULL;
@ -1047,7 +1033,7 @@ struct efi_device_path *efi_dp_from_uart(void)
struct efi_device_path_uart *uart;
size_t dpsize = sizeof(ROOT) + sizeof(*uart) + sizeof(END);
buf = dp_alloc(dpsize);
buf = efi_alloc(dpsize);
if (!buf)
return NULL;
pos = buf;
@ -1073,7 +1059,7 @@ struct efi_device_path *efi_dp_from_eth(void)
dpsize += dp_size(eth_get_dev());
start = buf = dp_alloc(dpsize + sizeof(END));
start = buf = efi_alloc(dpsize + sizeof(END));
if (!buf)
return NULL;
@ -1093,7 +1079,7 @@ struct efi_device_path *efi_dp_from_mem(uint32_t memory_type,
struct efi_device_path_memory *mdp;
void *buf, *start;
start = buf = dp_alloc(sizeof(*mdp) + sizeof(END));
start = buf = efi_alloc(sizeof(*mdp) + sizeof(END));
if (!buf)
return NULL;