1ed9652daSAlexander Motin.\" 27aafa7c3SAlexander Motin.\" Copyright (c) 2017-2019 Alexander Motin <mav@FreeBSD.org> 3ed9652daSAlexander Motin.\" All rights reserved. 4ed9652daSAlexander Motin.\" 5ed9652daSAlexander Motin.\" Redistribution and use in source and binary forms, with or without 6ed9652daSAlexander Motin.\" modification, are permitted provided that the following conditions 7ed9652daSAlexander Motin.\" are met: 8ed9652daSAlexander Motin.\" 1. Redistributions of source code must retain the above copyright 9ed9652daSAlexander Motin.\" notice, this list of conditions and the following disclaimer. 10ed9652daSAlexander Motin.\" 2. Redistributions in binary form must reproduce the above copyright 11ed9652daSAlexander Motin.\" notice, this list of conditions and the following disclaimer in the 12ed9652daSAlexander Motin.\" documentation and/or other materials provided with the distribution. 13ed9652daSAlexander Motin.\" 14ed9652daSAlexander Motin.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15ed9652daSAlexander Motin.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16ed9652daSAlexander Motin.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17ed9652daSAlexander Motin.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18ed9652daSAlexander Motin.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19ed9652daSAlexander Motin.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20ed9652daSAlexander Motin.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21ed9652daSAlexander Motin.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22ed9652daSAlexander Motin.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23ed9652daSAlexander Motin.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24ed9652daSAlexander Motin.\" SUCH DAMAGE. 25ed9652daSAlexander Motin.\" 26ed9652daSAlexander Motin.\" $FreeBSD$ 27ed9652daSAlexander Motin.\" 287aafa7c3SAlexander Motin.Dd November 9, 2019 29ed9652daSAlexander Motin.Dt NTB_HW_PLX 4 30ed9652daSAlexander Motin.Os 31ed9652daSAlexander Motin.Sh NAME 32ed9652daSAlexander Motin.Nm ntb_hw_plx 33ed9652daSAlexander Motin.Nd PLX/Avago/Broadcom Non-Transparent Bridge driver 34ed9652daSAlexander Motin.Sh SYNOPSIS 35ed9652daSAlexander MotinTo compile this driver into your kernel, 36ed9652daSAlexander Motinplace the following lines in your kernel configuration file: 37ed9652daSAlexander Motin.Bd -ragged -offset indent 38ed9652daSAlexander Motin.Cd "device ntb" 39ed9652daSAlexander Motin.Cd "device ntb_hw_plx" 40ed9652daSAlexander Motin.Ed 41ed9652daSAlexander Motin.Pp 42ed9652daSAlexander MotinOr, to load the driver as a module at boot, place the following line in 43ed9652daSAlexander Motin.Xr loader.conf 5 : 44ed9652daSAlexander Motin.Bd -literal -offset indent 45ed9652daSAlexander Motinntb_hw_plx_load="YES" 46ed9652daSAlexander Motin.Ed 47ed9652daSAlexander Motin.Pp 48ed9652daSAlexander MotinThe following tunables are settable from the 49ed9652daSAlexander Motin.Xr loader 8 : 50ed9652daSAlexander Motin.Bl -ohang 51ed9652daSAlexander Motin.It Va hint.ntb_hw. Ns Ar X Ns Va .b2b 52ed9652daSAlexander MotinBeing set to 1 (default) tells the driver attached to Virtual Interface of the 53ed9652daSAlexander MotinNTB that it works in NTB-to-NTB (back-to-back) mode, 0 -- NTB-to-Root Port. 54ed9652daSAlexander MotinDriver attached to Link Interface (visible from Root Port side) switches to 55ed9652daSAlexander MotinNTB-to-Root Port mode automatically, but one attached to Virtual Interface 56ed9652daSAlexander Motincan't detect what is on the other side and require external knowledge. 577aafa7c3SAlexander Motin.It Va hint.ntb_hw. Ns Ar X Ns Va .split 587aafa7c3SAlexander MotinBeing set above zero splits BAR2 into 2^x memory windows using Address 597aafa7c3SAlexander MotinLookup Table (A-LUT). 60ed9652daSAlexander Motin.El 61ed9652daSAlexander Motin.Sh DESCRIPTION 62ed9652daSAlexander MotinThe 63ed9652daSAlexander Motin.Nm 64ed9652daSAlexander Motindriver provides support for the Non-Transparent Bridge (NTB) hardware in 65ed9652daSAlexander MotinPLX PCIe bridge chips, which allow up to two of their PCIe ports to be 66ed9652daSAlexander Motinswitched from transparent to non-transparent bridge mode. 67ed9652daSAlexander MotinIn this mode bridge looks not as a PCI bridge, but as PCI endpoint device. 68ed9652daSAlexander MotinThe driver hides hardware details, exposing memory windows, scratchpads 69ed9652daSAlexander Motinand doorbells of the other side via hardware independent KPI to 70ed9652daSAlexander Motin.Xr ntb 4 71ed9652daSAlexander Motinsubsystem. 72ed9652daSAlexander Motin.Pp 73ed9652daSAlexander MotinEach PLX NTB provides up to 2 64-bit or 4 32-bit memory windows to the 74ed9652daSAlexander Motinother system's memory, 6 or 12 scratchpad registers and 16 doorbells to 75ed9652daSAlexander Motininterrupt the other system. 767aafa7c3SAlexander MotinIf Address Lookup Table (A-LUT) is enabled, BAR2 can be split into several 777aafa7c3SAlexander Motin(up to 128) memory windows. 78ed9652daSAlexander MotinIn NTB-to-NTB mode one of memory windows (or half of it, if bigger then 1MB) 79ed9652daSAlexander Motinis consumed by the driver itself to access scratchpad and doorbell registers 80ed9652daSAlexander Motinof the other side. 81ed9652daSAlexander Motin.Sh HARDWARE 82ed9652daSAlexander MotinThe following PLX/Avago/Broadcom chips are supported by the 83ed9652daSAlexander Motin.Nm 84ed9652daSAlexander Motindriver: 85ed9652daSAlexander Motin.Pp 86ed9652daSAlexander Motin.Bl -bullet -compact 87ed9652daSAlexander Motin.It 88ed9652daSAlexander MotinPEX 8713 89ed9652daSAlexander Motin.It 90ed9652daSAlexander MotinPEX 8717 91ed9652daSAlexander Motin.It 92ed9652daSAlexander MotinPEX 8725 93ed9652daSAlexander Motin.It 94ed9652daSAlexander MotinPEX 8733 95ed9652daSAlexander Motin.It 96ed9652daSAlexander MotinPEX 8749 97ed9652daSAlexander Motin.El 98ed9652daSAlexander Motin.Pp 99ed9652daSAlexander Motin, but it may also work with other compatible ones. 100ed9652daSAlexander Motin.Sh CONFIGURATION 101ed9652daSAlexander MotinThe basic chip configuration should be done by serial EEPROM or via i2c. 102ed9652daSAlexander MotinIt includes enabling NTB on one or both sides (choosing between NTB-to-NTB 103ed9652daSAlexander Motin(back-to-back) and NTB-to-Root Port modes) and configuring BARs sizes. 104ed9652daSAlexander Motin.Pp 105ed9652daSAlexander MotinThe recommended mode is NTB-to-NTB mode, since while NTB-to-Root Port is 106ed9652daSAlexander Motingenerally supported by the driver, it require PCI hotplug handling on the 107ed9652daSAlexander MotinRoot Port, that may be difficult or cause different kinds of problems. 108ed9652daSAlexander Motin.Sh SEE ALSO 109ed9652daSAlexander Motin.Xr if_ntb 4 , 110ed9652daSAlexander Motin.Xr ntb 4 , 111*16ee5cd1SChristian Brueffer.Xr ntb_transport 4 112ed9652daSAlexander Motin.Sh AUTHORS 113ed9652daSAlexander Motin.An -nosplit 114ed9652daSAlexander MotinThe 115ed9652daSAlexander Motin.Nm 116ed9652daSAlexander Motindriver was written by 117ed9652daSAlexander Motin.An Alexander Motin Aq Mt mav@FreeBSD.org . 118ed9652daSAlexander Motin.Sh BUGS 119ed9652daSAlexander MotinThere is no way to protect your system from malicious behavior on the other 120ed9652daSAlexander Motinsystem once the link is brought up. 121ed9652daSAlexander MotinAnyone with root or kernel access on the other system can read or write to 122ed9652daSAlexander Motinany location on your system. 123ed9652daSAlexander MotinIn other words, only connect two systems that completely trust each other. 124