Age | Commit message (Collapse) | Author | Files | Lines |
|
When there is a new device tree that needs to be added to
the main dt of the opal (ex, IMC catalog dtb loaded from
pnor partition), we need to check for the phandle values
in the new incoming device tree before attaching it.
Reason is that, incoming device tree could already have
phandle values initialized for its nodes. Now, if we attach
this new device tree to the main opal DT, we could
potentially hit phandle duplicate error (since the
phandles value usually start with 1).
To avoid this, a new helper function dt_adjust_subtree_phandle()
is added to scan the incoming device tree and update
node "phandle" accordingly based on the opal
"last_phandle" value.
Add to this, helper function also supports updates of
"properties" with in a node which may refer the
"phandle" value in the incoming device tree. Helper
function will also fix the "properties" field accordingly.
Acked-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Add helper functions for "last_phandle" access/update and
modify functions to use helper functions.
Acked-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
90% of what we print isn't useful to a normal user. This
dramatically reduces the amount of messages printed by
OPAL in normal circumstances.
We still need to add a way to bump the log level at boot
based on a BMC scratch register or some HDAT property.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Adds two helper functions that allow device nodes to be found via
their name and unit address. One will take an integer address and
format it to a hex string while the other looks up the unit based
a user supplied string. This is handy in a few places inside the
HDAT parser.
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Currently this is implemented by calling dt_get_address() which only
works when a device is a child of the root node. This patch implements
the functionality to work with nested nodes when all parent nodes have
an appropriate "ranges" property.
This implementation only works for up to 64 bit addresses. Properly
supporting larger addressing schemes is a fair amount of (probably
pointless) work, so I'm leaving supporting that until we have an
actual a need for it.
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Tested-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
This is similar to dt_new(), but if the node already exists it will
return the existing node. This is useful because some init code depends
on the presence of certain nodes, but where the node is actually created
is unimportant.
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Reference bug: https://github.com/open-power/op-build/issues/751
Signed-off-by: Pridhiviraj Paidipeddi <ppaidipe@linux.vnet.ibm.com>
[stewart@linux.vnet.ibm.com: tweak message slightly]
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
This will be useful for fast reboot which needs to clean a few
things up.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
This is created seperately when parsing the hdat and when expanding the
DT. There is no real reason for this and it makes more sense to create
it in the main init path.
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
This accessor tests the "status" property allowing us to represent
disabled devices in the device-tree. It will be used by PHB4 initially
but its usage could be made more widespread.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Merge device tree sorting
|
|
Moved the dt_dump() into test/dt_common.c so that it can be shared
between hdata/test/hdata_to_dt.c and core/test/run-device.c
run-device.c contains two tests, one basic sorting test and a
generate-and-sort test.
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
[stewart@linux.vnet.ibm.com: remove trailing whitespace]
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
When unflattening (or building from hdat) a device tree child nodes are added in
the order in which they are encountered. For nodes that have a <basename>@<unit>
style name with a common basename it is useful to have them in the tree sorted
by the unit in ascending order. Currently this requires the source data to
present them in sorted order, but this isn't always the case.
This patch modifies the node insertion process to insert new nodes in the
correct location so the list of child nodes is sorted.
Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
[stewart@linux.vnet.ibm.com: remove trailing whitespace]
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
The error paths here are a bit suspicious anyway as we're allocating
memory in a failure path for having failed to allocate memory.
One can hope that the memory allocated to display the error is less
than the memory we attempted to allocate in the first place.
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Even though we're heading to abort(), it seems like some static
analysis checkers still think we're leaking. So.... well, let's
just make them happy and free the memory. It's harmless to do
that.
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
This change adds a new function to copy a device tree node to a new
parent.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Else, we are dereferencing NULL
Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Reviewed-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Add a function dt_find_by_name() that returns the child node if
matches the given name, otherwise NULL.
Signed-off-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
When destroying a dt_node, it needs to release both the name and itself. And
there are several places to do the release.
This patch wrap a function dt_destroy() to make sure both of the elements of a
dt_node are released when it is not used any more.
Signed-off-by: Wei Yang <weiyang@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
I debugged a checkstop with a BML boot which turned out to be device
tree issues. A corrupt device tree is very likely to result in a
later checkstop, so abort in dt_expand to make debugging much easier.
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
|
|
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
|