Index: head/sys/dev/cxgbe/t4_if.m =================================================================== --- head/sys/dev/cxgbe/t4_if.m +++ head/sys/dev/cxgbe/t4_if.m @@ -55,11 +55,11 @@ device_t dev; }; -# Called by a driver to query the PF4 driver for the unit number to use -# for a given port. If the port is not enabled on the adapter, this -# will fail. -METHOD int read_port_unit { +# Called by a driver to query the PF4 driver for the child device +# associated with a given port. If the port is not enabled on the adapter, +# this will fail. +METHOD int read_port_device { device_t dev; int port; - int *unit; + device_t *child; }; Index: head/sys/dev/cxgbe/t4_iov.c =================================================================== --- head/sys/dev/cxgbe/t4_iov.c +++ head/sys/dev/cxgbe/t4_iov.c @@ -104,6 +104,7 @@ for (i = 0; i < nitems(t4iov_pciids); i++) { if (d == t4iov_pciids[i].device) { device_set_desc(dev, t4iov_pciids[i].desc); + device_quiet(dev); return (BUS_PROBE_DEFAULT); } } @@ -120,6 +121,7 @@ for (i = 0; i < nitems(t5iov_pciids); i++) { if (d == t5iov_pciids[i].device) { device_set_desc(dev, t5iov_pciids[i].desc); + device_quiet(dev); return (BUS_PROBE_DEFAULT); } } @@ -148,25 +150,27 @@ #ifdef PCI_IOV nvlist_t *pf_schema, *vf_schema; #endif - int error, unit; + device_t pdev; + int error; sc = device_get_softc(dev); MPASS(!sc->sc_attached); /* * PF0-3 are associated with a specific port on the NIC (PF0 - * with port 0, etc.). Ask the PF4 driver for the unit number - * for this function's associated port to determine if the port - * is present. + * with port 0, etc.). Ask the PF4 driver for the device for + * this function's associated port to determine if the port is + * present. */ - error = T4_READ_PORT_UNIT(sc->sc_main, pci_get_function(dev), &unit); + error = T4_READ_PORT_DEVICE(sc->sc_main, pci_get_function(dev), &pdev); if (error) return (0); #ifdef PCI_IOV pf_schema = pci_iov_schema_alloc_node(); vf_schema = pci_iov_schema_alloc_node(); - error = pci_iov_attach(dev, pf_schema, vf_schema); + error = pci_iov_attach_name(dev, pf_schema, vf_schema, "%s", + device_get_nameunit(pdev)); if (error) { device_printf(dev, "Failed to initialize SR-IOV: %d\n", error); return (0); Index: head/sys/dev/cxgbe/t4_main.c =================================================================== --- head/sys/dev/cxgbe/t4_main.c +++ head/sys/dev/cxgbe/t4_main.c @@ -83,14 +83,14 @@ static int t4_attach(device_t); static int t4_detach(device_t); static int t4_ready(device_t); -static int t4_read_port_unit(device_t, int, int *); +static int t4_read_port_device(device_t, int, device_t *); static device_method_t t4_methods[] = { DEVMETHOD(device_probe, t4_probe), DEVMETHOD(device_attach, t4_attach), DEVMETHOD(device_detach, t4_detach), DEVMETHOD(t4_is_main_ready, t4_ready), - DEVMETHOD(t4_read_port_unit, t4_read_port_unit), + DEVMETHOD(t4_read_port_device, t4_read_port_device), DEVMETHOD_END }; @@ -149,7 +149,7 @@ DEVMETHOD(device_detach, t4_detach), DEVMETHOD(t4_is_main_ready, t4_ready), - DEVMETHOD(t4_read_port_unit, t4_read_port_unit), + DEVMETHOD(t4_read_port_device, t4_read_port_device), DEVMETHOD_END }; @@ -1094,7 +1094,7 @@ } static int -t4_read_port_unit(device_t dev, int port, int *unit) +t4_read_port_device(device_t dev, int port, device_t *child) { struct adapter *sc; struct port_info *pi; @@ -1105,7 +1105,7 @@ pi = sc->port[port]; if (pi == NULL || pi->dev == NULL) return (ENXIO); - *unit = device_get_unit(pi->dev); + *child = pi->dev; return (0); }