[PATCH v7 4/7] misc: fw_loader: implement request_firmware_size() OP

Simon Glass sjg at chromium.org
Fri Jun 19 14:46:07 CEST 2026


On 2026-06-16T19:18:35, Christian Marangi <ansuelsmth at gmail.com> wrote:
> misc: fw_loader: implement request_firmware_size() OP
>
> It might be useful to get the firmware size before reading it to allocate
> the correct size. This is needed for case where the firmware size change
> across different firmware version and is not always the same. In such case
> the only way to handle this scenario is to allocate a big-enough buffer to
> read the firmware.
>
> To better handle this, introduce the request_firmware_size() OP to get the
> firmware size before reading it. This way proper buffer can be allocated
> and dynamic firmware size can be better supported.
>
> FS loader is updated to handle the new .get_size() handler.
>
> Signed-off-by: Christian Marangi <ansuelsmth at gmail.com>
>
> drivers/misc/fw_loader/fs_loader.c        | 68 +++++++++++++++++++++++++------
>  drivers/misc/fw_loader/fw_loader-uclass.c | 19 +++++++++
>  drivers/misc/fw_loader/internal.h         |  7 ++++
>  include/fw_loader.h                       |  9 ++++
>  4 files changed, 91 insertions(+), 12 deletions(-)

Reviewed-by: Simon Glass <sjg at chromium.org>


More information about the U-Boot mailing list