mirror of
https://github.com/u-boot/u-boot.git
synced 2025-05-09 03:21:51 +00:00
Merge patch series "bloblist: refactor xferlist and bloblist"
Tom Rini <trini@konsulko.com> says: This small series separates "bloblist" and "standard passage" to allow for these similar concepts to explore solutions to problems without introduces breaking changes to the other. Link: https://lore.kernel.org/r/20250220000223.1044376-1-raymond.mao@linaro.org
This commit is contained in:
commit
c33ccc8725
7 changed files with 87 additions and 65 deletions
|
@ -505,8 +505,7 @@ int bloblist_reloc(void *to, uint to_size)
|
|||
/*
|
||||
* Weak default function for getting bloblist from boot args.
|
||||
*/
|
||||
int __weak xferlist_from_boot_arg(ulong __always_unused addr,
|
||||
ulong __always_unused size)
|
||||
int __weak xferlist_from_boot_arg(ulong __always_unused *addr)
|
||||
{
|
||||
return -ENOENT;
|
||||
}
|
||||
|
@ -514,37 +513,46 @@ int __weak xferlist_from_boot_arg(ulong __always_unused addr,
|
|||
int bloblist_init(void)
|
||||
{
|
||||
bool fixed = IS_ENABLED(CONFIG_BLOBLIST_FIXED);
|
||||
int ret = -ENOENT;
|
||||
int ret = 0;
|
||||
ulong addr = 0, size;
|
||||
/*
|
||||
* If U-Boot is not in the first phase, an existing bloblist must be
|
||||
* at a fixed address.
|
||||
*/
|
||||
bool from_addr = fixed && !xpl_is_first_phase();
|
||||
if (xpl_prev_phase() == PHASE_TPL && !IS_ENABLED(CONFIG_TPL_BLOBLIST))
|
||||
from_addr = false;
|
||||
if (fixed)
|
||||
addr = IF_ENABLED_INT(CONFIG_BLOBLIST_FIXED,
|
||||
CONFIG_BLOBLIST_ADDR);
|
||||
size = CONFIG_BLOBLIST_SIZE;
|
||||
|
||||
/* Check if a valid transfer list passed in */
|
||||
if (!xferlist_from_boot_arg(&addr)) {
|
||||
size = bloblist_get_total_size();
|
||||
} else {
|
||||
/*
|
||||
* If U-Boot is not in the first phase, an existing bloblist must
|
||||
* be at a fixed address.
|
||||
*/
|
||||
bool from_addr = fixed && !xpl_is_first_phase();
|
||||
|
||||
/*
|
||||
* If the current boot stage is the first phase of U-Boot, then an
|
||||
* architecture-specific routine should be used to handle the bloblist
|
||||
* passed from the previous boot loader
|
||||
*/
|
||||
if (xpl_is_first_phase() && !IS_ENABLED(CONFIG_BLOBLIST_ALLOC))
|
||||
ret = xferlist_from_boot_arg(addr, size);
|
||||
else if (from_addr)
|
||||
ret = bloblist_check(addr, size);
|
||||
/*
|
||||
* If Firmware Handoff is mandatory but no transfer list is
|
||||
* observed, report it as an error.
|
||||
*/
|
||||
if (IS_ENABLED(CONFIG_BLOBLIST_PASSAGE_MANDATORY))
|
||||
return -ENOENT;
|
||||
|
||||
if (ret)
|
||||
log_warning("Bloblist at %lx not found (err=%d)\n",
|
||||
addr, ret);
|
||||
else
|
||||
/* Get the real size */
|
||||
size = gd->bloblist->total_size;
|
||||
ret = -ENOENT;
|
||||
|
||||
if (xpl_prev_phase() == PHASE_TPL &&
|
||||
!IS_ENABLED(CONFIG_TPL_BLOBLIST))
|
||||
from_addr = false;
|
||||
if (fixed)
|
||||
addr = IF_ENABLED_INT(CONFIG_BLOBLIST_FIXED,
|
||||
CONFIG_BLOBLIST_ADDR);
|
||||
size = CONFIG_BLOBLIST_SIZE;
|
||||
|
||||
if (from_addr)
|
||||
ret = bloblist_check(addr, size);
|
||||
|
||||
if (ret)
|
||||
log_warning("Bloblist at %lx not found (err=%d)\n",
|
||||
addr, ret);
|
||||
else
|
||||
/* Get the real size */
|
||||
size = gd->bloblist->total_size;
|
||||
}
|
||||
|
||||
if (ret) {
|
||||
/*
|
||||
|
@ -569,6 +577,7 @@ int bloblist_init(void)
|
|||
log_debug("Found existing bloblist size %lx at %lx\n", size,
|
||||
addr);
|
||||
}
|
||||
|
||||
if (ret)
|
||||
return log_msg_ret("ini", ret);
|
||||
gd->flags |= GD_FLG_BLOBLIST_READY;
|
||||
|
@ -589,10 +598,11 @@ int bloblist_maybe_init(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int bloblist_check_reg_conv(ulong rfdt, ulong rzero, ulong rsig)
|
||||
int bloblist_check_reg_conv(ulong rfdt, ulong rzero, ulong rsig, ulong xlist)
|
||||
{
|
||||
u64 version = BLOBLIST_REGCONV_VER;
|
||||
ulong sigval;
|
||||
int ret;
|
||||
|
||||
if ((IS_ENABLED(CONFIG_64BIT) && !IS_ENABLED(CONFIG_SPL_BUILD)) ||
|
||||
(IS_ENABLED(CONFIG_SPL_64BIT) && IS_ENABLED(CONFIG_SPL_BUILD))) {
|
||||
|
@ -603,8 +613,14 @@ int bloblist_check_reg_conv(ulong rfdt, ulong rzero, ulong rsig)
|
|||
((version & BLOBLIST_REGCONV_MASK) << BLOBLIST_REGCONV_SHIFT_32));
|
||||
}
|
||||
|
||||
if (rzero || rsig != sigval ||
|
||||
rfdt != (ulong)bloblist_find(BLOBLISTT_CONTROL_FDT, 0)) {
|
||||
if (rzero || rsig != sigval)
|
||||
return -EIO;
|
||||
|
||||
ret = bloblist_check(xlist, 0);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (rfdt != (ulong)bloblist_find(BLOBLISTT_CONTROL_FDT, 0)) {
|
||||
gd->bloblist = NULL; /* Reset the gd bloblist pointer */
|
||||
return -EIO;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue