]> Git Repo - J-u-boot.git/blob - include/of_live.h
Merge patch series "Universal Payload initial series"
[J-u-boot.git] / include / of_live.h
1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (c) 2017 Google, Inc
4  * Written by Simon Glass <[email protected]>
5  *
6  * Support for a 'live' (as opposed to flat) device tree
7  */
8
9 #ifndef _OF_LIVE_H
10 #define _OF_LIVE_H
11
12 struct abuf;
13 struct device_node;
14
15 /**
16  * of_live_build() - build a live (hierarchical) tree from a flat DT
17  *
18  * @fdt_blob: Input tree to convert
19  * @rootp: Returns live tree that was created
20  * Return: 0 if OK, -ve on error
21  */
22 int of_live_build(const void *fdt_blob, struct device_node **rootp);
23
24 /**
25  * unflatten_device_tree() - create tree of device_nodes from flat blob
26  *
27  * Note that this allocates a single block of memory, pointed to by *mynodes.
28  * To free the tree, use free(*mynodes)
29  *
30  * unflattens a device-tree, creating the
31  * tree of struct device_node. It also fills the "name" and "type"
32  * pointers of the nodes so the normal device-tree walking functions
33  * can be used.
34  * @blob: The blob to expand
35  * @mynodes: The device_node tree created by the call
36  * Return: 0 if OK, -ve on error
37  */
38 int unflatten_device_tree(const void *blob, struct device_node **mynodes);
39
40 /**
41  * of_live_free() - Dispose of a livetree
42  *
43  * This frees memory used by the tree, after which @root becomes invalid and
44  * cannot be used
45  *
46  * @root: Tree to dispose
47  */
48 void of_live_free(struct device_node *root);
49
50 /**
51  * of_live_create_empty() - Create a new, empty tree
52  *
53  * @rootp: Returns the root node of the created tree
54  * Return: 0 if OK, -ENOMEM if out of memory
55  */
56 int of_live_create_empty(struct device_node **rootp);
57
58 /**
59  * of_live_flatten() - Create an FDT from a hierarchical tree
60  *
61  * @root: Root node of tree to convert
62  * @buf: Buffer to return the tree (inited by this function)
63  * Return: 0 if OK, -ENOMEM if out of memory
64  */
65 int of_live_flatten(const struct device_node *root, struct abuf *buf);
66
67 #endif
This page took 0.028591 seconds and 4 git commands to generate.