soc/intel/common/acpi: Fix ACPI Namespace lookup failure, AE_ALREADY_EXISTS issue
[coreboot.git] / src / include / fit.h
blob6e0667f6cf6c7b9eefe7cc735db6b4bc95acce3c
1 /*
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.
18 #ifndef __LIB_FIT_H__
19 #define __LIB_FIT_H__
21 #include <stddef.h>
22 #include <stdint.h>
23 #include <device_tree.h>
24 #include <list.h>
25 #include <program_loading.h>
27 struct fit_image_node
29 const char *name;
30 const void *data;
31 uint32_t size;
32 int compression;
34 struct list_node list_node;
37 struct fit_config_node
39 const char *name;
40 const char *kernel;
41 struct fit_image_node *kernel_node;
42 const char *fdt;
43 struct fit_image_node *fdt_node;
44 const char *ramdisk;
45 struct fit_image_node *ramdisk_node;
46 struct fdt_property compat;
47 int compat_rank;
48 int compat_pos;
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, const 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.
82 * False on error.
84 bool fit_payload_arch(struct prog *payload, struct fit_config_node *config,
85 struct region *kernel,
86 struct region *fdt,
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
92 * node.
94 struct fit_config_node *fit_load(void *fit);
96 void fit_add_ramdisk(struct device_tree *tree, void *ramdisk_addr,
97 size_t ramdisk_size);
99 #endif /* __LIB_FIT_H__ */