1 /*
2  * Copyright (C) 2018 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef UFDT_OVERLAY_INTERNAL_H
18 #define UFDT_OVERLAY_INTERNAL_H
19 
20 #include <ufdt_types.h>
21 
22 void *ufdt_get_fixup_location(struct ufdt *tree, const char *fixup);
23 int ufdt_do_one_fixup(struct ufdt *tree, const char *fixups, int fixups_len,
24                       int phandle);
25 int ufdt_overlay_do_fixups(struct ufdt *main_tree, struct ufdt *overlay_tree);
26 
27 enum overlay_result {
28   OVERLAY_RESULT_OK,
29   OVERLAY_RESULT_MISSING_TARGET,
30   OVERLAY_RESULT_MISSING_OVERLAY,
31   OVERLAY_RESULT_TARGET_PATH_INVALID,
32   OVERLAY_RESULT_TARGET_INVALID,
33   OVERLAY_RESULT_MERGE_FAIL,
34   OVERLAY_RESULT_VERIFY_FAIL,
35 };
36 
37 enum overlay_result ufdt_overlay_get_target(struct ufdt *tree,
38                                             struct ufdt_node *frag_node,
39                                             struct ufdt_node **target_node);
40 void ufdt_try_increase_phandle(struct ufdt *tree, uint32_t offset);
41 uint32_t ufdt_get_max_phandle(struct ufdt *tree);
42 struct ufdt_static_phandle_table build_phandle_table(struct ufdt *tree);
43 int ufdt_overlay_do_local_fixups(struct ufdt *tree, uint32_t phandle_offset);
44 #endif /* UFDT_OVERLAY_INTERNAL_H */
45