blob: 05e86ac06b1a2df4f6e963ac7190765ec549b00e [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Simon Glass8b50d522017-05-18 20:08:55 -06002/*
3 * Copyright (c) 2017 Google, Inc
4 * Written by Simon Glass <sjg@chromium.org>
5 *
Simon Glass8b50d522017-05-18 20:08:55 -06006 * Support for a 'live' (as opposed to flat) device tree
7 */
8
9#ifndef _OF_LIVE_H
10#define _OF_LIVE_H
11
12struct device_node;
13
14/**
15 * of_live_build() - build a live (hierarchical) tree from a flat DT
16 *
17 * @fdt_blob: Input tree to convert
18 * @rootp: Returns live tree that was created
Heinrich Schuchardt185f8122022-01-19 18:05:50 +010019 * Return: 0 if OK, -ve on error
Simon Glass8b50d522017-05-18 20:08:55 -060020 */
21int of_live_build(const void *fdt_blob, struct device_node **rootp);
22
Simon Glass33104842022-07-30 15:52:08 -060023/**
24 * unflatten_device_tree() - create tree of device_nodes from flat blob
25 *
26 * Note that this allocates a single block of memory, pointed to by *mynodes.
27 * To free the tree, use free(*mynodes)
28 *
29 * unflattens a device-tree, creating the
30 * tree of struct device_node. It also fills the "name" and "type"
31 * pointers of the nodes so the normal device-tree walking functions
32 * can be used.
33 * @blob: The blob to expand
34 * @mynodes: The device_node tree created by the call
35 * Return: 0 if OK, -ve on error
36 */
37int unflatten_device_tree(const void *blob, struct device_node **mynodes);
38
Simon Glassa8f2ac22023-06-01 10:22:42 -060039/**
40 * of_live_free() - Dispose of a livetree
41 *
42 * This frees memory used by the tree, after which @root becomes invalid and
43 * cannot be used
44 *
45 * @root: Tree to dispose
46 */
47void of_live_free(struct device_node *root);
48
Simon Glass8b50d522017-05-18 20:08:55 -060049#endif