Date: Wed, 23 Oct 2013 14:04:09 +0000 (UTC) From: Nathan Whitehorn <nwhitehorn@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r256967 - in head/sys: arm/mv dev/fdt dev/ofw Message-ID: <201310231404.r9NE49C0099156@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: nwhitehorn Date: Wed Oct 23 14:04:09 2013 New Revision: 256967 URL: http://svnweb.freebsd.org/changeset/base/256967 Log: Remove OF_instance_to_package() hack for FDT and replace with use of the generic OF_xref_phandle() API universally. Also replace some related explicit uses of fdt32_to_cpu() with OF_getencprop() calls. Modified: head/sys/arm/mv/gpio.c head/sys/dev/fdt/fdt_common.c head/sys/dev/fdt/fdt_pci.c head/sys/dev/fdt/simplebus.c head/sys/dev/ofw/ofw_fdt.c Modified: head/sys/arm/mv/gpio.c ============================================================================== --- head/sys/arm/mv/gpio.c Wed Oct 23 13:55:41 2013 (r256966) +++ head/sys/arm/mv/gpio.c Wed Oct 23 14:04:09 2013 (r256967) @@ -605,7 +605,6 @@ int platform_gpio_init(void) { phandle_t child, parent, root, ctrl; - ihandle_t ctrl_ihandle; pcell_t gpios[MAX_PINS_PER_NODE * GPIOS_PROP_CELLS]; struct gpio_ctrl_entry *e; int len, rv; @@ -639,9 +638,7 @@ platform_gpio_init(void) * contain a ref. to a node defining GPIO * controller. */ - ctrl_ihandle = (ihandle_t)gpios[0]; - ctrl_ihandle = fdt32_to_cpu(ctrl_ihandle); - ctrl = OF_instance_to_package(ctrl_ihandle); + ctrl = OF_xref_handle(fdt32_to_cpu(gpios[0])); if (fdt_is_compatible(ctrl, e->compat)) /* Call a handler. */ Modified: head/sys/dev/fdt/fdt_common.c ============================================================================== --- head/sys/dev/fdt/fdt_common.c Wed Oct 23 13:55:41 2013 (r256966) +++ head/sys/dev/fdt/fdt_common.c Wed Oct 23 14:04:09 2013 (r256967) @@ -523,7 +523,7 @@ fdt_intr_to_rl(phandle_t node, struct re /* * Find #interrupt-cells of the interrupt domain. */ - if (OF_getprop(node, "interrupt-parent", &iph, sizeof(iph)) <= 0) { + if (OF_getencprop(node, "interrupt-parent", &iph, sizeof(iph)) <= 0) { debugf("no intr-parent phandle\n"); intr_par = OF_parent(node); } else { @@ -583,7 +583,7 @@ fdt_get_phyaddr(phandle_t node, device_t uint32_t i; device_t parent, child; - if (OF_getprop(node, "phy-handle", (void *)&phy_handle, + if (OF_getencprop(node, "phy-handle", (void *)&phy_handle, sizeof(phy_handle)) <= 0) return (ENXIO); Modified: head/sys/dev/fdt/fdt_pci.c ============================================================================== --- head/sys/dev/fdt/fdt_pci.c Wed Oct 23 13:55:41 2013 (r256966) +++ head/sys/dev/fdt/fdt_pci.c Wed Oct 23 14:04:09 2013 (r256967) @@ -255,7 +255,7 @@ fdt_pci_route_intr(int bus, int slot, in struct fdt_pci_intr *intr_info, int *interrupt) { pcell_t child_spec[4], masked[4]; - ihandle_t iph; + phandle_t iph; pcell_t intr_par; pcell_t *map_ptr; uint32_t addr; @@ -280,7 +280,7 @@ fdt_pci_route_intr(int bus, int slot, in i = 0; while (i < map_len) { iph = fdt32_to_cpu(map_ptr[par_idx]); - intr_par = OF_instance_to_package(iph); + intr_par = OF_xref_phandle(iph); err = fdt_addr_cells(intr_par, &par_addr_cells); if (err != 0) { Modified: head/sys/dev/fdt/simplebus.c ============================================================================== --- head/sys/dev/fdt/simplebus.c Wed Oct 23 13:55:41 2013 (r256966) +++ head/sys/dev/fdt/simplebus.c Wed Oct 23 14:04:09 2013 (r256967) @@ -339,8 +339,7 @@ simplebus_get_interrupt_parent(device_t struct simplebus_devinfo *di; struct fdt_ic *ic; device_t ip; - ihandle_t iph; - phandle_t ph; + phandle_t ph, iph; ip = NULL; @@ -348,10 +347,9 @@ simplebus_get_interrupt_parent(device_t if (di == NULL) return (NULL); - if (OF_getprop(di->di_ofw.obd_node, "interrupt-parent", &iph, + if (OF_getencprop(di->di_ofw.obd_node, "interrupt-parent", &iph, sizeof(iph)) > 0) { - iph = fdt32_to_cpu(iph); - ph = OF_instance_to_package(iph); + ph = OF_xref_phandle(iph); SLIST_FOREACH(ic, &fdt_ic_list_head, fdt_ics) { if (ic->iph == ph) { ip = ic->dev; Modified: head/sys/dev/ofw/ofw_fdt.c ============================================================================== --- head/sys/dev/ofw/ofw_fdt.c Wed Oct 23 13:55:41 2013 (r256966) +++ head/sys/dev/ofw/ofw_fdt.c Wed Oct 23 14:04:09 2013 (r256967) @@ -226,20 +226,8 @@ ofw_fdt_parent(ofw_t ofw, phandle_t node static phandle_t ofw_fdt_instance_to_package(ofw_t ofw, ihandle_t instance) { - int offset; - - /* - * 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 (-1); - return (fdt_offset_phandle(offset)); + return (-1); } /* Get the length of a property of a package. */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201310231404.r9NE49C0099156>