PERFORCE change 171818 for review
Rafal Jaworowski
raj at FreeBSD.org
Tue Dec 15 14:35:44 PST 2009
http://p4web.freebsd.org/chv.cgi?CH=171818
Change 171818 by raj at raj_fdt on 2009/12/15 22:35:36
Allow for translation of internal FDT phandles via
OF_instance_to_package().
This slighly abuses the OF_* i/f as FDT does not really have the
notion of instances, but lets us get away with a uniform way of
handling internal FDT offsets at the consumer level; this is needed in
some specific cases like interrupt domain graph traversal.
Affected files ...
.. //depot/projects/fdt/sys/dev/ofw/ofw_fdt.c#2 edit
Differences ...
==== //depot/projects/fdt/sys/dev/ofw/ofw_fdt.c#2 (text+ko) ====
@@ -201,8 +201,7 @@
ofw_fdt_parent(ofw_t ofw, phandle_t node)
{
phandle_t p;
- int offset;
- int paroffset;
+ int offset, paroffset;
offset = fdt_phandle_offset(node);
if (offset < 0)
@@ -217,8 +216,22 @@
static phandle_t
ofw_fdt_instance_to_package(ofw_t ofw, ihandle_t instance)
{
+ phandle_t p;
+ int offset;
- return (0);
+ /*
+ * Note: FDT does not have the notion of instances, but we somewhat
+ * abuse the semantics and let treat as 'instance' the internal
+ * 'phandle' prop, so that ofw I/F consumers have a uniform way of
+ * translation between internal representation (which appear in some
+ * contexts as property values) and effective phandles.
+ */
+ offset = fdt_node_offset_by_phandle(fdtp, instance);
+ if (offset < 0)
+ return (0);
+
+ p = (phandle_t)fdt_offset_ptr(fdtp, offset, sizeof(phandle_t));
+ return (p);
}
/* Get the length of a property of a package. */
More information about the p4-projects
mailing list