1 /* Taken from depthcharge: src/boot/fit.h */
2 /* SPDX-License-Identifier: GPL-2.0-or-later */
7 #include <commonlib/device_tree.h>
8 #include <commonlib/list.h>
9 #include <program_loading.h>
13 struct fit_image_node
{
19 struct list_node list_node
;
22 struct fit_config_node
{
24 struct fit_image_node
*kernel
;
25 struct fit_image_node
*fdt
;
26 struct list_node overlays
;
27 struct fit_image_node
*ramdisk
;
28 struct fdt_property compat
;
31 const char *compat_string
;
33 struct list_node list_node
;
36 struct fit_overlay_chain
{
37 struct fit_image_node
*overlay
;
38 struct list_node list_node
;
42 * Updates the cmdline in the devicetree.
44 void fit_update_chosen(struct device_tree
*tree
, const char *cmd_line
);
47 * Add a compat string to the list of supported board ids.
48 * Has to be called before fit_load().
49 * The most common use-case would be to implement it on board level.
50 * Strings that were added first have a higher priority on finding a match.
52 void fit_add_compat_string(const char *str
);
55 * Updates the memory section in the devicetree.
57 void fit_update_memory(struct device_tree
*tree
);
60 * Do architecture specific payload placements and fixups.
61 * Set entrypoint and first argument (if any).
62 * @param payload The payload, to set the entry point
63 * @param config The extracted FIT config
64 * @param kernel out-argument where to place the kernel
65 * @param fdt out-argument where to place the devicetree
66 * @param initrd out-argument where to place the initrd (optional)
67 * @return True if all config nodes could be placed, the corresponding
68 * regions have been updated and the entry point has been set.
71 bool fit_payload_arch(struct prog
*payload
, struct fit_config_node
*config
,
72 struct region
*kernel
,
74 struct region
*initrd
);
77 * Unpack a FIT image into memory, choosing the right configuration through the
78 * compatible string set by fit_add_compat() and return the selected config
81 struct fit_config_node
*fit_load(void *fit
);
83 void fit_add_ramdisk(struct device_tree
*tree
, void *ramdisk_addr
,
86 #endif /* __LIB_FIT_H__ */