u-boot/include/of_live.h
Simon Glass 331048471d dm: core: Introduce support for multiple trees
At present ofnode only works with a single device tree, for the most part.
This is the control FDT used by U-Boot.

When booting an OS we may obtain a different device tree and want to
modify it. Add some initial support for this into the ofnode API.

Note that we don't permit aliases in this other device tree, since the
of_access implementation maintains a list of aliases collected at
start-up. Also, we don't need aliases to do fixups in the other FDT. So
make sure that flat tree and live tree processing are consistent in this
area.

Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-12 08:14:23 -04:00

39 lines
1.1 KiB
C

/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Copyright (c) 2017 Google, Inc
* Written by Simon Glass <sjg@chromium.org>
*
* Support for a 'live' (as opposed to flat) device tree
*/
#ifndef _OF_LIVE_H
#define _OF_LIVE_H
struct device_node;
/**
* of_live_build() - build a live (hierarchical) tree from a flat DT
*
* @fdt_blob: Input tree to convert
* @rootp: Returns live tree that was created
* Return: 0 if OK, -ve on error
*/
int of_live_build(const void *fdt_blob, struct device_node **rootp);
/**
* unflatten_device_tree() - create tree of device_nodes from flat blob
*
* Note that this allocates a single block of memory, pointed to by *mynodes.
* To free the tree, use free(*mynodes)
*
* unflattens a device-tree, creating the
* tree of struct device_node. It also fills the "name" and "type"
* pointers of the nodes so the normal device-tree walking functions
* can be used.
* @blob: The blob to expand
* @mynodes: The device_node tree created by the call
* Return: 0 if OK, -ve on error
*/
int unflatten_device_tree(const void *blob, struct device_node **mynodes);
#endif