bootm: Pass image buffer to boot_get_fdt()

Rather than having boot_get_fdt() calculate this, move the calculation
into the caller. This removes the access to argv[0] in this function,
so we can later refactor it to just accept argv[2] instead of the whole
argv[].

Move the function comment to the header file and fix the u8 argument,
while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
This commit is contained in:
Simon Glass
2023-11-18 14:05:09 -07:00
committed by Tom Rini
parent 972d524893
commit ba5e3f7f78
3 changed files with 38 additions and 36 deletions

View File

@@ -808,9 +808,34 @@ int image_locate_script(void *buf, int size, const char *fit_uname,
int fit_get_node_from_config(struct bootm_headers *images,
const char *prop_name, ulong addr);
int boot_get_fdt(int flag, int argc, char *const argv[], uint8_t arch,
struct bootm_headers *images,
char **of_flat_tree, ulong *of_size);
/**
* boot_get_fdt() - locate FDT devicetree to use for booting
*
* @buf: Pointer to image
* @argc: command argument count
* @argv: command argument list
* @arch: architecture (IH_ARCH_...)
* @images: pointer to the bootm images structure
* @of_flat_tree: pointer to a char* variable, will hold fdt start address
* @of_size: pointer to a ulong variable, will hold fdt length
*
* boot_get_fdt() is responsible for finding a valid flat device tree image.
* Currently supported are the following FDT sources:
* - multicomponent kernel/ramdisk/FDT image,
* - commandline provided address of decicated FDT image.
*
* Return:
* 0, if fdt image was found and valid, or skipped
* of_flat_tree and of_size are set to fdt start address and length if
* fdt image is found and valid
*
* 1, if fdt image is found but corrupted
* of_flat_tree and of_size are set to 0 if no fdt exists
*/
int boot_get_fdt(void *buf, int flag, int argc, char *const argv[], uint arch,
struct bootm_headers *images, char **of_flat_tree,
ulong *of_size);
void boot_fdt_add_mem_rsv_regions(struct lmb *lmb, void *fdt_blob);
int boot_relocate_fdt(struct lmb *lmb, char **of_flat_tree, ulong *of_size);