From fb5b9994b3f77fe3c8a64538a4b92b29da9d0582 Mon Sep 17 00:00:00 2001 From: Nathan Whitehorn Date: Sun, 1 Dec 2013 19:03:20 +0000 Subject: [PATCH] Open Firmware mandates that certain cross-references, in particular those in /chosen, be ihandles. The ePAPR spec makes those cross-reference phandles, since FDT has no concept of ihandles. Have the OF FDT CI module interpret queries about ihandles as cross-reference phandles. --- sys/dev/ofw/ofw_fdt.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sys/dev/ofw/ofw_fdt.c b/sys/dev/ofw/ofw_fdt.c index b53bdab2324..8f68a0d7d76 100644 --- a/sys/dev/ofw/ofw_fdt.c +++ b/sys/dev/ofw/ofw_fdt.c @@ -207,7 +207,8 @@ static phandle_t ofw_fdt_instance_to_package(ofw_t ofw, ihandle_t instance) { - return (-1); + /* Where real OF uses ihandles in the tree, FDT uses xref phandles */ + return (OF_xref_phandle(instance)); } /* Get the length of a property of a package. */ @@ -350,8 +351,13 @@ ofw_fdt_finddevice(ofw_t ofw, const char *device) static ssize_t ofw_fdt_instance_to_path(ofw_t ofw, ihandle_t instance, char *buf, size_t len) { + phandle_t phandle; - return (-1); + phandle = OF_instance_to_package(instance); + if (phandle == -1) + return (-1); + + return (OF_package_to_path(phandle, buf, len)); } /* Return the fully qualified pathname corresponding to a package. */