Date: Thu, 15 Aug 2019 14:11:11 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r351072 - head/sys/dev/ntb/ntb_hw Message-ID: <201908151411.x7FEBBkd006468@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Thu Aug 15 14:11:11 2019 New Revision: 351072 URL: https://svnweb.freebsd.org/changeset/base/351072 Log: Implement new methods for Intel and PLX NTB. This restores parity with AMD NTB driver. Though without any drivers supporting more then one peer and respective KPI modification to pass peer index to most of the calls this addition is pretty useless now. MFC after: 2 weeks Modified: head/sys/dev/ntb/ntb_hw/ntb_hw_intel.c head/sys/dev/ntb/ntb_hw/ntb_hw_plx.c Modified: head/sys/dev/ntb/ntb_hw/ntb_hw_intel.c ============================================================================== --- head/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Thu Aug 15 13:44:33 2019 (r351071) +++ head/sys/dev/ntb/ntb_hw/ntb_hw_intel.c Thu Aug 15 14:11:11 2019 (r351072) @@ -1978,6 +1978,44 @@ atom_perform_link_restart(struct ntb_softc *ntb) } static int +intel_ntb_port_number(device_t dev) +{ + struct ntb_softc *ntb = device_get_softc(dev); + + return (ntb->dev_type == NTB_DEV_USD ? 0 : 1); +} + +static int +intel_ntb_peer_port_count(device_t dev) +{ + + return (1); +} + +static int +intel_ntb_peer_port_number(device_t dev, int pidx) +{ + struct ntb_softc *ntb = device_get_softc(dev); + + if (pidx != 0) + return (-EINVAL); + + return (ntb->dev_type == NTB_DEV_USD ? 1 : 0); +} + +static int +intel_ntb_peer_port_idx(device_t dev, int port) +{ + int peer_port; + + peer_port = intel_ntb_peer_port_number(dev, 0); + if (peer_port == -EINVAL || port != peer_port) + return (-EINVAL); + + return (0); +} + +static int intel_ntb_link_enable(device_t dev, enum ntb_speed speed __unused, enum ntb_width width __unused) { @@ -3087,6 +3125,10 @@ static device_method_t ntb_intel_methods[] = { DEVMETHOD(bus_child_location_str, ntb_child_location_str), DEVMETHOD(bus_print_child, ntb_print_child), /* NTB interface */ + DEVMETHOD(ntb_port_number, intel_ntb_port_number), + DEVMETHOD(ntb_peer_port_count, intel_ntb_peer_port_count), + DEVMETHOD(ntb_peer_port_number, intel_ntb_peer_port_number), + DEVMETHOD(ntb_peer_port_idx, intel_ntb_peer_port_idx), DEVMETHOD(ntb_link_is_up, intel_ntb_link_is_up), DEVMETHOD(ntb_link_enable, intel_ntb_link_enable), DEVMETHOD(ntb_link_disable, intel_ntb_link_disable), Modified: head/sys/dev/ntb/ntb_hw/ntb_hw_plx.c ============================================================================== --- head/sys/dev/ntb/ntb_hw/ntb_hw_plx.c Thu Aug 15 13:44:33 2019 (r351071) +++ head/sys/dev/ntb/ntb_hw/ntb_hw_plx.c Thu Aug 15 14:11:11 2019 (r351072) @@ -470,7 +470,44 @@ ntb_plx_detach(device_t dev) return (0); } +static int +ntb_plx_port_number(device_t dev) +{ + struct ntb_plx_softc *sc = device_get_softc(dev); + return (sc->link ? 1 : 0); +} + +static int +ntb_plx_peer_port_count(device_t dev) +{ + + return (1); +} + +static int +ntb_plx_peer_port_number(device_t dev, int pidx) +{ + struct ntb_plx_softc *sc = device_get_softc(dev); + + if (pidx != 0) + return (-EINVAL); + + return (sc->link ? 0 : 1); +} + +static int +ntb_plx_peer_port_idx(device_t dev, int port) +{ + int peer_port; + + peer_port = ntb_plx_peer_port_number(dev, 0); + if (peer_port == -EINVAL || port != peer_port) + return (-EINVAL); + + return (0); +} + static bool ntb_plx_link_is_up(device_t dev, enum ntb_speed *speed, enum ntb_width *width) { @@ -974,6 +1011,10 @@ static device_method_t ntb_plx_methods[] = { DEVMETHOD(bus_child_location_str, ntb_child_location_str), DEVMETHOD(bus_print_child, ntb_print_child), /* NTB interface */ + DEVMETHOD(ntb_port_number, ntb_plx_port_number), + DEVMETHOD(ntb_peer_port_count, ntb_plx_peer_port_count), + DEVMETHOD(ntb_peer_port_number, ntb_plx_peer_port_number), + DEVMETHOD(ntb_peer_port_idx, ntb_plx_peer_port_idx), DEVMETHOD(ntb_link_is_up, ntb_plx_link_is_up), DEVMETHOD(ntb_link_enable, ntb_plx_link_enable), DEVMETHOD(ntb_link_disable, ntb_plx_link_disable),
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201908151411.x7FEBBkd006468>