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.\" 267aafa7c3SAlexander Motin.Dd November 9, 2019 27ed9652daSAlexander Motin.Dt NTB_HW_PLX 4 28ed9652daSAlexander Motin.Os 29ed9652daSAlexander Motin.Sh NAME 30ed9652daSAlexander Motin.Nm ntb_hw_plx 31ed9652daSAlexander Motin.Nd PLX/Avago/Broadcom Non-Transparent Bridge driver 32ed9652daSAlexander Motin.Sh SYNOPSIS 33ed9652daSAlexander MotinTo compile this driver into your kernel, 34ed9652daSAlexander Motinplace the following lines in your kernel configuration file: 35ed9652daSAlexander Motin.Bd -ragged -offset indent 36ed9652daSAlexander Motin.Cd "device ntb" 37ed9652daSAlexander Motin.Cd "device ntb_hw_plx" 38ed9652daSAlexander Motin.Ed 39ed9652daSAlexander Motin.Pp 40ed9652daSAlexander MotinOr, to load the driver as a module at boot, place the following line in 41ed9652daSAlexander Motin.Xr loader.conf 5 : 42ed9652daSAlexander Motin.Bd -literal -offset indent 43ed9652daSAlexander Motinntb_hw_plx_load="YES" 44ed9652daSAlexander Motin.Ed 45ed9652daSAlexander Motin.Pp 46ed9652daSAlexander MotinThe following tunables are settable from the 47ed9652daSAlexander Motin.Xr loader 8 : 48ed9652daSAlexander Motin.Bl -ohang 49ed9652daSAlexander Motin.It Va hint.ntb_hw. Ns Ar X Ns Va .b2b 50ed9652daSAlexander MotinBeing set to 1 (default) tells the driver attached to Virtual Interface of the 51ed9652daSAlexander MotinNTB that it works in NTB-to-NTB (back-to-back) mode, 0 -- NTB-to-Root Port. 52ed9652daSAlexander MotinDriver attached to Link Interface (visible from Root Port side) switches to 53ed9652daSAlexander MotinNTB-to-Root Port mode automatically, but one attached to Virtual Interface 54ed9652daSAlexander Motincan't detect what is on the other side and require external knowledge. 557aafa7c3SAlexander Motin.It Va hint.ntb_hw. Ns Ar X Ns Va .split 567aafa7c3SAlexander MotinBeing set above zero splits BAR2 into 2^x memory windows using Address 577aafa7c3SAlexander MotinLookup Table (A-LUT). 58ed9652daSAlexander Motin.El 59ed9652daSAlexander Motin.Sh DESCRIPTION 60ed9652daSAlexander MotinThe 61ed9652daSAlexander Motin.Nm 62ed9652daSAlexander Motindriver provides support for the Non-Transparent Bridge (NTB) hardware in 63ed9652daSAlexander MotinPLX PCIe bridge chips, which allow up to two of their PCIe ports to be 64ed9652daSAlexander Motinswitched from transparent to non-transparent bridge mode. 65ed9652daSAlexander MotinIn this mode bridge looks not as a PCI bridge, but as PCI endpoint device. 66ed9652daSAlexander MotinThe driver hides hardware details, exposing memory windows, scratchpads 67ed9652daSAlexander Motinand doorbells of the other side via hardware independent KPI to 68ed9652daSAlexander Motin.Xr ntb 4 69ed9652daSAlexander Motinsubsystem. 70ed9652daSAlexander Motin.Pp 71ed9652daSAlexander MotinEach PLX NTB provides up to 2 64-bit or 4 32-bit memory windows to the 72ed9652daSAlexander Motinother system's memory, 6 or 12 scratchpad registers and 16 doorbells to 73ed9652daSAlexander Motininterrupt the other system. 747aafa7c3SAlexander MotinIf Address Lookup Table (A-LUT) is enabled, BAR2 can be split into several 757aafa7c3SAlexander Motin(up to 128) memory windows. 76ed9652daSAlexander MotinIn NTB-to-NTB mode one of memory windows (or half of it, if bigger then 1MB) 77ed9652daSAlexander Motinis consumed by the driver itself to access scratchpad and doorbell registers 78ed9652daSAlexander Motinof the other side. 79ed9652daSAlexander Motin.Sh HARDWARE 80ed9652daSAlexander MotinThe following PLX/Avago/Broadcom chips are supported by the 81ed9652daSAlexander Motin.Nm 82ed9652daSAlexander Motindriver: 83ed9652daSAlexander Motin.Pp 84ed9652daSAlexander Motin.Bl -bullet -compact 85ed9652daSAlexander Motin.It 86ed9652daSAlexander MotinPEX 8713 87ed9652daSAlexander Motin.It 88ed9652daSAlexander MotinPEX 8717 89ed9652daSAlexander Motin.It 90ed9652daSAlexander MotinPEX 8725 91ed9652daSAlexander Motin.It 92ed9652daSAlexander MotinPEX 8733 93ed9652daSAlexander Motin.It 94ed9652daSAlexander MotinPEX 8749 95ed9652daSAlexander Motin.El 96ed9652daSAlexander Motin.Pp 97ed9652daSAlexander Motin, but it may also work with other compatible ones. 98ed9652daSAlexander Motin.Sh CONFIGURATION 99ed9652daSAlexander MotinThe basic chip configuration should be done by serial EEPROM or via i2c. 100ed9652daSAlexander MotinIt includes enabling NTB on one or both sides (choosing between NTB-to-NTB 101ed9652daSAlexander Motin(back-to-back) and NTB-to-Root Port modes) and configuring BARs sizes. 102ed9652daSAlexander Motin.Pp 103ed9652daSAlexander MotinThe recommended mode is NTB-to-NTB mode, since while NTB-to-Root Port is 104ed9652daSAlexander Motingenerally supported by the driver, it require PCI hotplug handling on the 105ed9652daSAlexander MotinRoot Port, that may be difficult or cause different kinds of problems. 106ed9652daSAlexander Motin.Sh SEE ALSO 107ed9652daSAlexander Motin.Xr if_ntb 4 , 108ed9652daSAlexander Motin.Xr ntb 4 , 109*16ee5cd1SChristian Brueffer.Xr ntb_transport 4 110ed9652daSAlexander Motin.Sh AUTHORS 111ed9652daSAlexander Motin.An -nosplit 112ed9652daSAlexander MotinThe 113ed9652daSAlexander Motin.Nm 114ed9652daSAlexander Motindriver was written by 115ed9652daSAlexander Motin.An Alexander Motin Aq Mt mav@FreeBSD.org . 116ed9652daSAlexander Motin.Sh BUGS 117ed9652daSAlexander MotinThere is no way to protect your system from malicious behavior on the other 118ed9652daSAlexander Motinsystem once the link is brought up. 119ed9652daSAlexander MotinAnyone with root or kernel access on the other system can read or write to 120ed9652daSAlexander Motinany location on your system. 121ed9652daSAlexander MotinIn other words, only connect two systems that completely trust each other. 122