Author: zbb
Date: Thu Jan 28 16:58:49 2016
New Revision: 294998
URL: https://svnweb.freebsd.org/changeset/base/294998

Log:
  Fix VNIC enumeration after r294993 and r294990
  
  ofw_bus_get_node() must be tested against negative values since
  missing parent bus method will result in calling the default method
  which simply returns (-1): sys/dev/ofw/ofw_bus_if.m
  This was lost in the review process.
  
  Obtained from: Semihalf
  Sponsored by:  Cavium

Modified:
  head/sys/arm64/cavium/thunder_pcie_fdt.c
  head/sys/dev/vnic/thunder_bgx_fdt.c

Modified: head/sys/arm64/cavium/thunder_pcie_fdt.c
==============================================================================
--- head/sys/arm64/cavium/thunder_pcie_fdt.c    Thu Jan 28 16:52:02 2016        
(r294997)
+++ head/sys/arm64/cavium/thunder_pcie_fdt.c    Thu Jan 28 16:58:49 2016        
(r294998)
@@ -276,7 +276,7 @@ thunder_pcie_ofw_bus_alloc_res(device_t 
        int i;
 
        /* For PCIe devices that do not have FDT nodes, use PCIB method */
-       if (ofw_bus_get_node(child) == 0) {
+       if ((int)ofw_bus_get_node(child) <= 0) {
                return (thunder_pcie_alloc_resource(bus, child, type, rid,
                    start, end, count, flags));
        }
@@ -329,7 +329,7 @@ thunder_pcie_ofw_bus_rel_res(device_t bu
 {
 
        /* For PCIe devices that do not have FDT nodes, use PCIB method */
-       if (ofw_bus_get_node(child) == 0) {
+       if ((int)ofw_bus_get_node(child) <= 0) {
                return (thunder_pcie_release_resource(bus,
                    child, type, rid, res));
        }

Modified: head/sys/dev/vnic/thunder_bgx_fdt.c
==============================================================================
--- head/sys/dev/vnic/thunder_bgx_fdt.c Thu Jan 28 16:52:02 2016        
(r294997)
+++ head/sys/dev/vnic/thunder_bgx_fdt.c Thu Jan 28 16:58:49 2016        
(r294998)
@@ -244,7 +244,7 @@ bgx_fdt_find_node(struct bgx *bgx)
        }
 
        node = ofw_bus_get_node(root_pcib);
-       if (node == 0) {
+       if ((int)node <= 0) {
                device_printf(bgx->dev, "No parent FDT node for BGX\n");
                goto out;
        }
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to