svn commit: r273652 - in stable/10/sys: arm/arm arm/at91 arm/freescale/vybrid arm/mv arm/rockchip dev/fdt dev/gpio dev/ofw dev/tsec mips/beri powerpc/ofw powerpc/powermac
Ian Lepore
ian at FreeBSD.org
Sun Oct 26 01:30:51 UTC 2014
Author: ian
Date: Sun Oct 26 01:30:46 2014
New Revision: 273652
URL: https://svnweb.freebsd.org/changeset/base/273652
Log:
MFC r270945:
Rename OF_xref_phandle() to OF_node_from_xref() and add a new function
that provides the inverse translation, OF_xref_from_node().
Modified:
stable/10/sys/arm/arm/nexus.c
stable/10/sys/arm/at91/at91_pinctrl.c
stable/10/sys/arm/freescale/vybrid/vf_sai.c
stable/10/sys/arm/mv/gpio.c
stable/10/sys/arm/rockchip/rk30xx_gpio.c
stable/10/sys/dev/fdt/fdt_common.c
stable/10/sys/dev/fdt/simplebus.c
stable/10/sys/dev/gpio/ofw_gpiobus.c
stable/10/sys/dev/ofw/ofw_bus_subr.c
stable/10/sys/dev/ofw/ofw_fdt.c
stable/10/sys/dev/ofw/ofwbus.c
stable/10/sys/dev/ofw/openfirm.c
stable/10/sys/dev/ofw/openfirm.h
stable/10/sys/dev/tsec/if_tsec_fdt.c
stable/10/sys/mips/beri/beri_simplebus.c
stable/10/sys/powerpc/ofw/ofw_pcibus.c
stable/10/sys/powerpc/powermac/macio.c
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/sys/arm/arm/nexus.c
==============================================================================
--- stable/10/sys/arm/arm/nexus.c Sun Oct 26 01:26:53 2014 (r273651)
+++ stable/10/sys/arm/arm/nexus.c Sun Oct 26 01:30:46 2014 (r273652)
@@ -341,7 +341,7 @@ nexus_ofw_map_intr(device_t dev, device_
phandle_t intr_offset;
int i, rv, interrupt, trig, pol;
- intr_offset = OF_xref_phandle(iparent);
+ intr_offset = OF_node_from_xref(iparent);
for (i = 0; i < icells; i++)
intr[i] = cpu_to_fdt32(intr[i]);
Modified: stable/10/sys/arm/at91/at91_pinctrl.c
==============================================================================
--- stable/10/sys/arm/at91/at91_pinctrl.c Sun Oct 26 01:26:53 2014 (r273651)
+++ stable/10/sys/arm/at91/at91_pinctrl.c Sun Oct 26 01:30:46 2014 (r273652)
@@ -136,7 +136,7 @@ at91_pinctrl_setup_dinfo(device_t dev, p
"assuming direct parent\n");
iparent = OF_parent(node);
}
- if (OF_searchencprop(OF_xref_phandle(iparent),
+ if (OF_searchencprop(OF_node_from_xref(iparent),
"#interrupt-cells", &icells, sizeof(icells)) == -1) {
device_printf(dev, "Missing #interrupt-cells property, "
"assuming <1>\n");
@@ -399,7 +399,7 @@ pinctrl_walk_tree(device_t bus, phandle_
len /= sizeof(phandle_t);
printf("pinctrl: Found active node %s\n", name);
for (i = 0; i < len; i++) {
- scratch = OF_xref_phandle(pinctrl[i]);
+ scratch = OF_node_from_xref(pinctrl[i]);
npins = OF_getencprop(scratch, "atmel,pins", pins, sizeof(pins));
if (npins <= 0) {
printf("We're doing it wrong %s\n", name);
Modified: stable/10/sys/arm/freescale/vybrid/vf_sai.c
==============================================================================
--- stable/10/sys/arm/freescale/vybrid/vf_sai.c Sun Oct 26 01:26:53 2014 (r273651)
+++ stable/10/sys/arm/freescale/vybrid/vf_sai.c Sun Oct 26 01:30:46 2014 (r273652)
@@ -430,7 +430,7 @@ find_edma_controller(struct sc_info *sc)
OF_getprop(node, "edma-mux-group", &dts_value, len);
edma_mux_group = fdt32_to_cpu(dts_value);
OF_getprop(node, "edma-controller", &dts_value, len);
- edma_node = OF_xref_phandle(fdt32_to_cpu(dts_value));
+ edma_node = OF_node_from_xref(fdt32_to_cpu(dts_value));
if ((len = OF_getproplen(edma_node, "device-id")) <= 0) {
return (ENXIO);
Modified: stable/10/sys/arm/mv/gpio.c
==============================================================================
--- stable/10/sys/arm/mv/gpio.c Sun Oct 26 01:26:53 2014 (r273651)
+++ stable/10/sys/arm/mv/gpio.c Sun Oct 26 01:30:46 2014 (r273652)
@@ -641,7 +641,7 @@ platform_gpio_init(void)
* contain a ref. to a node defining GPIO
* controller.
*/
- ctrl = OF_xref_phandle(fdt32_to_cpu(gpios[0]));
+ ctrl = OF_node_from_xref(fdt32_to_cpu(gpios[0]));
if (fdt_is_compatible(ctrl, e->compat))
/* Call a handler. */
Modified: stable/10/sys/arm/rockchip/rk30xx_gpio.c
==============================================================================
--- stable/10/sys/arm/rockchip/rk30xx_gpio.c Sun Oct 26 01:26:53 2014 (r273651)
+++ stable/10/sys/arm/rockchip/rk30xx_gpio.c Sun Oct 26 01:30:46 2014 (r273652)
@@ -656,7 +656,7 @@ rk30_gpio_init(void)
* contain a ref. to a node defining GPIO
* controller.
*/
- ctrl = OF_xref_phandle(fdt32_to_cpu(gpios[0]));
+ ctrl = OF_node_from_xref(fdt32_to_cpu(gpios[0]));
if (fdt_is_compatible(ctrl, e->compat))
/* Call a handler. */
Modified: stable/10/sys/dev/fdt/fdt_common.c
==============================================================================
--- stable/10/sys/dev/fdt/fdt_common.c Sun Oct 26 01:26:53 2014 (r273651)
+++ stable/10/sys/dev/fdt/fdt_common.c Sun Oct 26 01:30:46 2014 (r273652)
@@ -510,7 +510,7 @@ fdt_intr_to_rl(device_t dev, phandle_t n
"assuming direct parent\n");
iparent = OF_parent(node);
}
- if (OF_searchencprop(OF_xref_phandle(iparent),
+ if (OF_searchencprop(OF_node_from_xref(iparent),
"#interrupt-cells", &icells, sizeof(icells)) == -1) {
device_printf(dev, "Missing #interrupt-cells property, "
"assuming <1>\n");
@@ -545,7 +545,7 @@ fdt_get_phyaddr(phandle_t node, device_t
sizeof(phy_handle)) <= 0)
return (ENXIO);
- phy_node = OF_xref_phandle(phy_handle);
+ phy_node = OF_node_from_xref(phy_handle);
if (OF_getprop(phy_node, "reg", (void *)&phy_reg,
sizeof(phy_reg)) <= 0)
Modified: stable/10/sys/dev/fdt/simplebus.c
==============================================================================
--- stable/10/sys/dev/fdt/simplebus.c Sun Oct 26 01:26:53 2014 (r273651)
+++ stable/10/sys/dev/fdt/simplebus.c Sun Oct 26 01:30:46 2014 (r273652)
@@ -298,7 +298,7 @@ simplebus_setup_dinfo(device_t dev, phan
"assuming direct parent\n");
iparent = OF_parent(node);
}
- if (OF_searchencprop(OF_xref_phandle(iparent),
+ if (OF_searchencprop(OF_node_from_xref(iparent),
"#interrupt-cells", &icells, sizeof(icells)) == -1) {
device_printf(dev, "Missing #interrupt-cells property, "
"assuming <1>\n");
Modified: stable/10/sys/dev/gpio/ofw_gpiobus.c
==============================================================================
--- stable/10/sys/dev/gpio/ofw_gpiobus.c Sun Oct 26 01:26:53 2014 (r273651)
+++ stable/10/sys/dev/gpio/ofw_gpiobus.c Sun Oct 26 01:30:46 2014 (r273652)
@@ -129,7 +129,7 @@ ofw_gpiobus_parse_gpios(struct gpiobus_s
i++;
continue;
}
- gpio = OF_xref_phandle(gpios[i]);
+ gpio = OF_node_from_xref(gpios[i]);
/* Verify if we're attaching to the correct GPIO controller. */
if (!OF_hasprop(gpio, "gpio-controller") ||
gpio != ofw_bus_get_node(sc->sc_dev)) {
@@ -168,7 +168,7 @@ ofw_gpiobus_parse_gpios(struct gpiobus_s
continue;
}
- gpio = OF_xref_phandle(gpios[i]);
+ gpio = OF_node_from_xref(gpios[i]);
/* Read gpio-cells property for this GPIO controller. */
if (OF_getencprop(gpio, "#gpio-cells", &cells,
sizeof(cells)) < 0) {
Modified: stable/10/sys/dev/ofw/ofw_bus_subr.c
==============================================================================
--- stable/10/sys/dev/ofw/ofw_bus_subr.c Sun Oct 26 01:26:53 2014 (r273651)
+++ stable/10/sys/dev/ofw/ofw_bus_subr.c Sun Oct 26 01:30:46 2014 (r273652)
@@ -344,7 +344,7 @@ ofw_bus_search_intrmap(void *intr, int i
i = imapsz;
while (i > 0) {
bcopy(mptr + physsz + intrsz, &parent, sizeof(parent));
- if (OF_searchencprop(OF_xref_phandle(parent),
+ if (OF_searchencprop(OF_node_from_xref(parent),
"#interrupt-cells", &pintrsz, sizeof(pintrsz)) == -1)
pintrsz = 1; /* default */
pintrsz *= sizeof(pcell_t);
Modified: stable/10/sys/dev/ofw/ofw_fdt.c
==============================================================================
--- stable/10/sys/dev/ofw/ofw_fdt.c Sun Oct 26 01:26:53 2014 (r273651)
+++ stable/10/sys/dev/ofw/ofw_fdt.c Sun Oct 26 01:30:46 2014 (r273652)
@@ -208,7 +208,7 @@ ofw_fdt_instance_to_package(ofw_t ofw, i
{
/* Where real OF uses ihandles in the tree, FDT uses xref phandles */
- return (OF_xref_phandle(instance));
+ return (OF_node_from_xref(instance));
}
/* Get the length of a property of a package. */
Modified: stable/10/sys/dev/ofw/ofwbus.c
==============================================================================
--- stable/10/sys/dev/ofw/ofwbus.c Sun Oct 26 01:26:53 2014 (r273651)
+++ stable/10/sys/dev/ofw/ofwbus.c Sun Oct 26 01:30:46 2014 (r273652)
@@ -494,7 +494,7 @@ ofwbus_setup_dinfo(device_t dev, phandle
"assuming nexus on <%s>\n", nodename);
iparent = 0xffffffff;
}
- if (OF_searchencprop(OF_xref_phandle(iparent),
+ if (OF_searchencprop(OF_node_from_xref(iparent),
"#interrupt-cells", &icells, sizeof(icells)) == -1) {
device_printf(dev, "Missing #interrupt-cells property, "
"assuming <1> on <%s>\n", nodename);
Modified: stable/10/sys/dev/ofw/openfirm.c
==============================================================================
--- stable/10/sys/dev/ofw/openfirm.c Sun Oct 26 01:26:53 2014 (r273651)
+++ stable/10/sys/dev/ofw/openfirm.c Sun Oct 26 01:30:46 2014 (r273652)
@@ -463,7 +463,7 @@ OF_child_xref_phandle(phandle_t parent,
}
phandle_t
-OF_xref_phandle(phandle_t xref)
+OF_node_from_xref(phandle_t xref)
{
phandle_t node;
@@ -474,6 +474,20 @@ OF_xref_phandle(phandle_t xref)
return (node);
}
+phandle_t
+OF_xref_from_node(phandle_t node)
+{
+ phandle_t xref;
+
+ if (OF_getencprop(node, "phandle", &xref, sizeof(xref)) ==
+ -1 && OF_getencprop(node, "ibm,phandle", &xref,
+ sizeof(xref)) == -1 && OF_getencprop(node,
+ "linux,phandle", &xref, sizeof(xref)) == -1)
+ return (node);
+
+ return (xref);
+}
+
/* Call the method in the scope of a given instance. */
int
OF_call_method(const char *method, ihandle_t instance, int nargs, int nreturns,
Modified: stable/10/sys/dev/ofw/openfirm.h
==============================================================================
--- stable/10/sys/dev/ofw/openfirm.h Sun Oct 26 01:26:53 2014 (r273651)
+++ stable/10/sys/dev/ofw/openfirm.h Sun Oct 26 01:30:46 2014 (r273652)
@@ -130,7 +130,8 @@ ssize_t OF_package_to_path(phandle_t no
* real phandle. If one can't be found (or running on OF implementations
* without this property), returns its input.
*/
-phandle_t OF_xref_phandle(phandle_t xref);
+phandle_t OF_node_from_xref(phandle_t xref);
+phandle_t OF_xref_from_node(phandle_t node);
/* Device I/O functions */
ihandle_t OF_open(const char *path);
Modified: stable/10/sys/dev/tsec/if_tsec_fdt.c
==============================================================================
--- stable/10/sys/dev/tsec/if_tsec_fdt.c Sun Oct 26 01:26:53 2014 (r273651)
+++ stable/10/sys/dev/tsec/if_tsec_fdt.c Sun Oct 26 01:30:46 2014 (r273652)
@@ -168,7 +168,7 @@ tsec_fdt_attach(device_t dev)
return (ENXIO);
}
- phy = OF_xref_phandle(phy);
+ phy = OF_node_from_xref(phy);
OF_decode_addr(OF_parent(phy), 0, &sc->phy_bst, &sc->phy_bsh);
OF_getencprop(phy, "reg", &sc->phyaddr, sizeof(sc->phyaddr));
Modified: stable/10/sys/mips/beri/beri_simplebus.c
==============================================================================
--- stable/10/sys/mips/beri/beri_simplebus.c Sun Oct 26 01:26:53 2014 (r273651)
+++ stable/10/sys/mips/beri/beri_simplebus.c Sun Oct 26 01:30:46 2014 (r273652)
@@ -350,7 +350,7 @@ simplebus_get_interrupt_parent(device_t
if (OF_getencprop(di->di_ofw.obd_node, "interrupt-parent", &iph,
sizeof(iph)) > 0) {
- ph = OF_xref_phandle(iph);
+ ph = OF_node_from_xref(iph);
SLIST_FOREACH(ic, &fdt_ic_list_head, fdt_ics) {
if (ic->iph == ph) {
ip = ic->dev;
Modified: stable/10/sys/powerpc/ofw/ofw_pcibus.c
==============================================================================
--- stable/10/sys/powerpc/ofw/ofw_pcibus.c Sun Oct 26 01:26:53 2014 (r273651)
+++ stable/10/sys/powerpc/ofw/ofw_pcibus.c Sun Oct 26 01:30:46 2014 (r273652)
@@ -212,7 +212,7 @@ ofw_pcibus_enum_devtree(device_t dev, u_
OF_getprop(child, "interrupt-parent", &iparent,
sizeof(iparent));
if (iparent != 0) {
- OF_getprop(OF_xref_phandle(iparent),
+ OF_getprop(OF_node_from_xref(iparent),
"#interrupt-cells", &icells,
sizeof(icells));
intr[0] = ofw_bus_map_intr(dev, iparent,
@@ -329,7 +329,7 @@ ofw_pcibus_assign_interrupt(device_t dev
iparent = -1;
icells = 1;
if (iparent != -1)
- OF_getprop(OF_xref_phandle(iparent), "#interrupt-cells",
+ OF_getprop(OF_node_from_xref(iparent), "#interrupt-cells",
&icells, sizeof(icells));
/*
Modified: stable/10/sys/powerpc/powermac/macio.c
==============================================================================
--- stable/10/sys/powerpc/powermac/macio.c Sun Oct 26 01:26:53 2014 (r273651)
+++ stable/10/sys/powerpc/powermac/macio.c Sun Oct 26 01:30:46 2014 (r273652)
@@ -217,7 +217,7 @@ macio_add_intr(phandle_t devnode, struct
<= 0)
panic("Interrupt but no interrupt parent!\n");
- if (OF_getprop(OF_xref_phandle(iparent), "#interrupt-cells", &icells,
+ if (OF_getprop(OF_node_from_xref(iparent), "#interrupt-cells", &icells,
sizeof(icells)) <= 0)
icells = 1;
More information about the svn-src-all
mailing list