162306a36Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci
362306a36Sopenharmony_ci=================================
462306a36Sopenharmony_ciDevicetree Dynamic Resolver Notes
562306a36Sopenharmony_ci=================================
662306a36Sopenharmony_ci
762306a36Sopenharmony_ciThis document describes the implementation of the in-kernel
862306a36Sopenharmony_ciDeviceTree resolver, residing in drivers/of/resolver.c
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ciHow the resolver works
1162306a36Sopenharmony_ci----------------------
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ciThe resolver is given as an input an arbitrary tree compiled with the
1462306a36Sopenharmony_ciproper dtc option and having a /plugin/ tag. This generates the
1562306a36Sopenharmony_ciappropriate __fixups__ & __local_fixups__ nodes.
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ciIn sequence the resolver works by the following steps:
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci1. Get the maximum device tree phandle value from the live tree + 1.
2062306a36Sopenharmony_ci2. Adjust all the local phandles of the tree to resolve by that amount.
2162306a36Sopenharmony_ci3. Using the __local__fixups__ node information adjust all local references
2262306a36Sopenharmony_ci   by the same amount.
2362306a36Sopenharmony_ci4. For each property in the __fixups__ node locate the node it references
2462306a36Sopenharmony_ci   in the live tree. This is the label used to tag the node.
2562306a36Sopenharmony_ci5. Retrieve the phandle of the target of the fixup.
2662306a36Sopenharmony_ci6. For each fixup in the property locate the node:property:offset location
2762306a36Sopenharmony_ci   and replace it with the phandle value.
28