aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/boot/flatdevtree.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2007-09-14[POWERPC] bootwrapper: Add get_path()Scott Wood1-0/+59
This will be used by the PlanetCore firmware support to construct a linux,stdout-path from the serial node that it finds. Signed-off-by: Scott Wood <scottwood@freescale.com> Acked-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-09-14[POWERPC] bootwrapper: flatdevtree fixesScott Wood1-22/+19
1. ft_create_node was returning the internal pointer rather than a phandle. 2. ft_find_device_rel was treating a "top" phandle of NULL as an error, rather than as the root of the tree. The old, absolute ft_find_device is removed, and the relative version is renamed to ft_find_device(). Signed-off-by: Scott Wood <scottwood@freescale.com> Acked-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-08-15[POWERPC] Remove unused code causing a compile warningBecky Bruce1-18/+0
AFAICT, nobody is using ft_ordered(), and it causes a build warning to be generated. This patch cleans that up by removing the function and the commented-out code that calls it. Signed-off-by: Becky Bruce <becky.bruce@freescale.com> Acked-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-05-17[POWERPC] Fix bug adding properties with flatdevtree.c's ft_set_prop()David Gibson1-9/+8
ft_set_prop() from flatdevtree.c in the zImage wrapper will either replace an existing property in the flat device tree, or add a new property definiion if the given property isn't present. However, when adding properties, it adds the property definition immediately before the node's END_NODE tag, potentially after any subnode definitions for the node. This confuses the kernel flat tree parser in prom.c which assumes that all property definitions for a node come before all subnode definitions. This patch corrects ft_set_prop() so that it adds new properties before the first subnode, instead of before the END_NODE tag. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Acked-by: Scott Wood <scottwood@freescale.com> Acked-by: Mark A. Greer <mgreer@mvista.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-03-16[POWERPC] bootwrapper: Make ft_create_node() pay attention to the parent parameter.Scott Wood1-5/+12
Signed-off-by: Scott Wood <scottwood@freescale.com> Acked-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-03-16[POWERPC] bootwrapper: Add ft_find_node_by_prop_value().Scott Wood1-0/+65
ft_find_node_by_prop_value() finds nodes with the specified property/value pair. Signed-off-by: Scott Wood <scottwood@freescale.com> Acked-by: Mark A. Greer <mgreer@mvista.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-03-16[POWERPC] bootwrapper: Make ft_get_parent() return a phandle, and NULL if already top-level.Scott Wood1-8/+13
Most of ft_get_parent() is factored out into __ft_get_parent(), which deals only in internal node pointers. The ft_get_parent() wrapper handles phandle conversion in both directions (previously, ft_get_parent() did not convert its return value). It also now returns NULL as the parent of the toplevel node, rather than just returning the toplevel node again (which made it rather useless in loops). Signed-off-by: Scott Wood <scottwood@freescale.com> Acked-by: Mark A. Greer <mgreer@mvista.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-03-16[POWERPC] bootwrapper: Refactor ft_get_prop() into internal and external functions.Scott Wood1-19/+34
The property searching part of ft_get_prop is factored out into an internal __ft_get_prop() which does not deal with phandles and does not copy the property data. ft_get_prop() is then a wrapper that does the phandle translation and copying. Signed-off-by: Scott Wood <scottwood@freescale.com> Acked-by: Mark A. Greer <mgreer@mvista.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-03-16[POWERPC] bootwrapper: Add ft_find_device_rel().Scott Wood1-0/+13
Add a function to look up a relative, rather than absolute, path name. Signed-off-by: Scott Wood <scottwood@freescale.com> Acked-by: Mark A. Greer <mgreer@mvista.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-03-13[POWERPC] bootwrapper: Use map_string() instead of lookup_string() in ft_prop().Scott Wood1-1/+1
When adding a property, the property name should be added to the string table if it doesn't already exist. map_string() does that; lookup_string() will fail instead. Signed-off-by: Scott Wood <scottwood@freescale.com> Acked-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-03-13[POWERPC] bootwrapper: Modify *pp, not *p, in ft_shuffle().Scott Wood1-1/+1
Move the caller's pointer back to match the change in the region's start, rather than alter a byte of the device tree's content. Signed-off-by: Scott Wood <scottwood@freescale.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-03-13[POWERPC] bootwrapper: Preserve the pp pointer in ft_make_space() when calling ft_reorder().Scott Wood1-2/+8
The ft_reorder() function may change the start of the region of interest, so the pointer provided by the caller into that region must be fixed up to still point to the same datum. Signed-off-by: Scott Wood <scottwood@freescale.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-03-13[POWERPC] bootwrapper: Make ft_get_phandle() accept and return NULL.Scott Wood1-0/+3
Currently, if ft_get_phandle() is passed NULL it will allocate an entry for it and return a non-NULL phandle. This patch makes it simply pass the NULL through. Signed-off-by: Scott Wood <scottwood@freescale.com> Acked-by: Mark A. Greer <mgreer@mvista.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-03-13[POWERPC] bootwrapper: Rename ft_node_add() to ft_get_phandle().Scott Wood1-2/+2
This name better reflects what the function does, which is to look up the phandle for an internal node pointer, and add it to the internal pointer to phandle table if not found. Signed-off-by: Scott Wood <scottwood@freescale.com> Acked-by: Mark A. Greer <mgreer@mvista.com> Acked-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
2007-03-13[POWERPC] bootwrapper: Add ft_root_node().Scott Wood1-4/+9
Clean up some of the open-coded data structure references by providing a function to return a pointer to the tree's root node. This is only used in high-level functions trying to access the root of the tree, not in low-level code that is actually manipulating the data structure. Signed-off-by: Scott Wood <scottwood@freescale.com> Acked-by: Mark A. Greer <mgreer@mvista.com> Acked-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
2006-10-23[POWERPC] Add flatdevtree sourceMark A. Greer1-0/+880
Add the latest version of the flatdevtree code and corresponding glue. A phandle table now tracks values returned by ft_find_device(). The value returned by ft_find_device() is a phandle which is really an index into the phandle table. The phandle table contains the address of the corresponding node. When the flat dt is edited/moved, the node pointers in the phandle table are updated accordingly so no phandles kept by the caller become stale. Signed-off-by: Mark A. Greer <mgreer@mvista.com> Signed-off-by: Paul Mackerras <paulus@samba.org>