1 /*
2  * Copyright (C) 2016 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_H
18 #define UFDT_OVERLAY_H
19 
20 #include <libfdt.h>
21 
22 /* Given a buffer in RAM containing the contents of a .dtb file,
23  * it initializes an FDT in-place and returns a pointer to the
24  * given buffer, or NULL in case of error.
25  * In case of error, it may printf() diagnostic messages.
26  */
27 struct fdt_header *ufdt_install_blob(void *blob, size_t blob_size);
28 
29 /* Given a main_fdt_header buffer and an overlay_fdtp buffer containing the
30  * contents of a .dtbo file, it creates a new FDT containing the applied
31  * overlay_fdtp in a dto_malloc'd buffer and returns it, or NULL in case of
32  * error.
33  * It is allowed to modify the buffers (both main_fdt_header and overlay_fdtp
34  * buffer) passed in.
35  * It does not dto_free main_fdt_header and overlay_fdtp buffer passed in.
36  */
37 struct fdt_header *ufdt_apply_overlay(struct fdt_header *main_fdt_header,
38                                       size_t main_fdt_size,
39                                       void *overlay_fdtp,
40                                       size_t overlay_size);
41 
42 #endif /* UFDT_OVERLAY_H */
43