diff options
| author | Alexander Motin <mav@FreeBSD.org> | 2019-08-15 14:11:11 +0000 |
|---|---|---|
| committer | Alexander Motin <mav@FreeBSD.org> | 2019-08-15 14:11:11 +0000 |
| commit | 6ddecf2b7592b1de4b556d1d8e2c6af8234ecdb7 (patch) | |
| tree | 3edac97300f17a6a1c8167491e35eb273036b22b /sys/dev/ntb | |
| parent | 773a7e222433de9406a82231b7333b2f08526a26 (diff) | |
Notes
Diffstat (limited to 'sys/dev/ntb')
| -rw-r--r-- | sys/dev/ntb/ntb_hw/ntb_hw_intel.c | 42 | ||||
| -rw-r--r-- | sys/dev/ntb/ntb_hw/ntb_hw_plx.c | 41 |
2 files changed, 83 insertions, 0 deletions
diff --git a/sys/dev/ntb/ntb_hw/ntb_hw_intel.c b/sys/dev/ntb/ntb_hw/ntb_hw_intel.c index 05348fe59d2b..26207938fda1 100644 --- a/sys/dev/ntb/ntb_hw/ntb_hw_intel.c +++ b/sys/dev/ntb/ntb_hw/ntb_hw_intel.c @@ -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), diff --git a/sys/dev/ntb/ntb_hw/ntb_hw_plx.c b/sys/dev/ntb/ntb_hw/ntb_hw_plx.c index 040bb8f80e29..15e8da4cd38c 100644 --- a/sys/dev/ntb/ntb_hw/ntb_hw_plx.c +++ b/sys/dev/ntb/ntb_hw/ntb_hw_plx.c @@ -470,6 +470,43 @@ 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), |
