2 * Copyright 2013 Google Inc.
3 * Copyright 2018-present Facebook, Inc.
5 * Taken from depthcharge: src/boot/fit.h
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of
10 * the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but without any warranty; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
23 #include <device_tree.h>
25 #include <program_loading.h>
34 struct list_node list_node
;
37 struct fit_config_node
41 struct fit_image_node
*kernel_node
;
43 struct fit_image_node
*fdt_node
;
45 struct fit_image_node
*ramdisk_node
;
46 struct fdt_property compat
;
49 const char *compat_string
;
51 struct list_node list_node
;
55 * Updates the cmdline in the devicetree.
57 void fit_update_chosen(struct device_tree
*tree
, char *cmd_line
);
60 * Add a compat string to the list of supported board ids.
61 * Has to be called before fit_load().
62 * The most common use-case would be to implement it on board level.
63 * Strings that were added first have a higher priority on finding a match.
65 void fit_add_compat_string(const char *str
);
68 * Updates the memory section in the devicetree.
70 void fit_update_memory(struct device_tree
*tree
);
73 * Do architecture specific payload placements and fixups.
74 * Set entrypoint and first argument (if any).
75 * @param payload The payload, to set the entry point
76 * @param config The extracted FIT config
77 * @param kernel out-argument where to place the kernel
78 * @param fdt out-argument where to place the devicetree
79 * @param initrd out-argument where to place the initrd (optional)
80 * @return True if all config nodes could be placed, the corresponding
81 * regions have been updated and the entry point has been set.
84 bool fit_payload_arch(struct prog
*payload
, struct fit_config_node
*config
,
85 struct region
*kernel
,
87 struct region
*initrd
);
90 * Unpack a FIT image into memory, choosing the right configuration through the
91 * compatible string set by fit_add_compat() and return the selected config
94 struct fit_config_node
*fit_load(void *fit
);
96 void fit_add_ramdisk(struct device_tree
*tree
, void *ramdisk_addr
,
99 #endif /* __LIB_FIT_H__ */