Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  *   This file is provided under a GPLv2 license.  When using or
0003  *   redistributing this file, you may do so under that license.
0004  *
0005  *   GPL LICENSE SUMMARY
0006  *
0007  *   Copyright (C) 2016-2018 T-Platforms JSC All Rights Reserved.
0008  *
0009  *   This program is free software; you can redistribute it and/or modify it
0010  *   under the terms and conditions of the GNU General Public License,
0011  *   version 2, as published by the Free Software Foundation.
0012  *
0013  *   This program is distributed in the hope that it will be useful, but
0014  *   WITHOUT ANY WARRANTY; without even the implied warranty of
0015  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
0016  *   Public License for more details.
0017  *
0018  *   You should have received a copy of the GNU General Public License along
0019  *   with this program; if not, one can be found http://www.gnu.org/licenses/.
0020  *
0021  *   The full GNU General Public License is included in this distribution in
0022  *   the file called "COPYING".
0023  *
0024  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0025  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0026  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
0027  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
0028  *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0029  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0030  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0031  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0032  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0033  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0034  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0035  *
0036  * IDT PCIe-switch NTB Linux driver
0037  *
0038  * Contact Information:
0039  * Serge Semin <fancer.lancer@gmail.com>, <Sergey.Semin@t-platforms.ru>
0040  */
0041 
0042 #ifndef NTB_HW_IDT_H
0043 #define NTB_HW_IDT_H
0044 
0045 #include <linux/types.h>
0046 #include <linux/pci.h>
0047 #include <linux/pci_ids.h>
0048 #include <linux/interrupt.h>
0049 #include <linux/spinlock.h>
0050 #include <linux/mutex.h>
0051 #include <linux/ntb.h>
0052 
0053 /*
0054  * Macro is used to create the struct pci_device_id that matches
0055  * the supported IDT PCIe-switches
0056  * @devname: Capitalized name of the particular device
0057  * @data: Variable passed to the driver of the particular device
0058  */
0059 #define IDT_PCI_DEVICE_IDS(devname, data) \
0060     .vendor = PCI_VENDOR_ID_IDT, .device = PCI_DEVICE_ID_IDT_##devname, \
0061     .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, \
0062     .class = (PCI_CLASS_BRIDGE_OTHER << 8), .class_mask = (0xFFFF00), \
0063     .driver_data = (kernel_ulong_t)&data
0064 
0065 /*
0066  * IDT PCIe-switches device IDs
0067  */
0068 #define PCI_DEVICE_ID_IDT_89HPES24NT6AG2  0x8091
0069 #define PCI_DEVICE_ID_IDT_89HPES32NT8AG2  0x808F
0070 #define PCI_DEVICE_ID_IDT_89HPES32NT8BG2  0x8088
0071 #define PCI_DEVICE_ID_IDT_89HPES12NT12G2  0x8092
0072 #define PCI_DEVICE_ID_IDT_89HPES16NT16G2  0x8090
0073 #define PCI_DEVICE_ID_IDT_89HPES24NT24G2  0x808E
0074 #define PCI_DEVICE_ID_IDT_89HPES32NT24AG2 0x808C
0075 #define PCI_DEVICE_ID_IDT_89HPES32NT24BG2 0x808A
0076 
0077 /*
0078  * NT-function Configuration Space registers
0079  * NOTE 1) The IDT PCIe-switch internal data is little-endian
0080  *      so it must be taken into account in the driver
0081  *      internals.
0082  *      2) Additionally the registers should be accessed either
0083  *      with byte-enables corresponding to their native size or
0084  *      the size of one DWORD
0085  *
0086  * So to simplify the driver code, there is only DWORD-sized read/write
0087  * operations utilized.
0088  */
0089 /* PCI Express Configuration Space */
0090 /* PCI Express command/status register  (DWORD) */
0091 #define IDT_NT_PCICMDSTS        0x00004U
0092 /* PCI Express Device Capabilities  (DWORD) */
0093 #define IDT_NT_PCIEDCAP         0x00044U
0094 /* PCI Express Device Control/Status    (WORD+WORD) */
0095 #define IDT_NT_PCIEDCTLSTS      0x00048U
0096 /* PCI Express Link Capabilities    (DWORD) */
0097 #define IDT_NT_PCIELCAP         0x0004CU
0098 /* PCI Express Link Control/Status  (WORD+WORD) */
0099 #define IDT_NT_PCIELCTLSTS      0x00050U
0100 /* PCI Express Device Capabilities 2    (DWORD) */
0101 #define IDT_NT_PCIEDCAP2        0x00064U
0102 /* PCI Express Device Control 2     (WORD+WORD) */
0103 #define IDT_NT_PCIEDCTL2        0x00068U
0104 /* PCI Power Management Control and Status (DWORD) */
0105 #define IDT_NT_PMCSR            0x000C4U
0106 /*==========================================*/
0107 /* IDT Proprietary NT-port-specific registers */
0108 /* NT-function main control registers */
0109 /* NT Endpoint Control          (DWORD) */
0110 #define IDT_NT_NTCTL            0x00400U
0111 /* NT Endpoint Interrupt Status/Mask    (DWORD) */
0112 #define IDT_NT_NTINTSTS         0x00404U
0113 #define IDT_NT_NTINTMSK         0x00408U
0114 /* NT Endpoint Signal Data      (DWORD) */
0115 #define IDT_NT_NTSDATA          0x0040CU
0116 /* NT Endpoint Global Signal        (DWORD) */
0117 #define IDT_NT_NTGSIGNAL        0x00410U
0118 /* Internal Error Reporting Mask 0/1    (DWORD) */
0119 #define IDT_NT_NTIERRORMSK0     0x00414U
0120 #define IDT_NT_NTIERRORMSK1     0x00418U
0121 /* Doorbel registers */
0122 /* NT Outbound Doorbell Set     (DWORD) */
0123 #define IDT_NT_OUTDBELLSET      0x00420U
0124 /* NT Inbound Doorbell Status/Mask  (DWORD) */
0125 #define IDT_NT_INDBELLSTS       0x00428U
0126 #define IDT_NT_INDBELLMSK       0x0042CU
0127 /* Message registers */
0128 /* Outbound Message N           (DWORD) */
0129 #define IDT_NT_OUTMSG0          0x00430U
0130 #define IDT_NT_OUTMSG1          0x00434U
0131 #define IDT_NT_OUTMSG2          0x00438U
0132 #define IDT_NT_OUTMSG3          0x0043CU
0133 /* Inbound Message N            (DWORD) */
0134 #define IDT_NT_INMSG0           0x00440U
0135 #define IDT_NT_INMSG1           0x00444U
0136 #define IDT_NT_INMSG2           0x00448U
0137 #define IDT_NT_INMSG3           0x0044CU
0138 /* Inbound Message Source N     (DWORD) */
0139 #define IDT_NT_INMSGSRC0        0x00450U
0140 #define IDT_NT_INMSGSRC1        0x00454U
0141 #define IDT_NT_INMSGSRC2        0x00458U
0142 #define IDT_NT_INMSGSRC3        0x0045CU
0143 /* Message Status           (DWORD) */
0144 #define IDT_NT_MSGSTS           0x00460U
0145 /* Message Status Mask          (DWORD) */
0146 #define IDT_NT_MSGSTSMSK        0x00464U
0147 /* BAR-setup registers */
0148 /* BAR N Setup/Limit Address/Lower and Upper Translated Base Address (DWORD) */
0149 #define IDT_NT_BARSETUP0        0x00470U
0150 #define IDT_NT_BARLIMIT0        0x00474U
0151 #define IDT_NT_BARLTBASE0       0x00478U
0152 #define IDT_NT_BARUTBASE0       0x0047CU
0153 #define IDT_NT_BARSETUP1        0x00480U
0154 #define IDT_NT_BARLIMIT1        0x00484U
0155 #define IDT_NT_BARLTBASE1       0x00488U
0156 #define IDT_NT_BARUTBASE1       0x0048CU
0157 #define IDT_NT_BARSETUP2        0x00490U
0158 #define IDT_NT_BARLIMIT2        0x00494U
0159 #define IDT_NT_BARLTBASE2       0x00498U
0160 #define IDT_NT_BARUTBASE2       0x0049CU
0161 #define IDT_NT_BARSETUP3        0x004A0U
0162 #define IDT_NT_BARLIMIT3        0x004A4U
0163 #define IDT_NT_BARLTBASE3       0x004A8U
0164 #define IDT_NT_BARUTBASE3       0x004ACU
0165 #define IDT_NT_BARSETUP4        0x004B0U
0166 #define IDT_NT_BARLIMIT4        0x004B4U
0167 #define IDT_NT_BARLTBASE4       0x004B8U
0168 #define IDT_NT_BARUTBASE4       0x004BCU
0169 #define IDT_NT_BARSETUP5        0x004C0U
0170 #define IDT_NT_BARLIMIT5        0x004C4U
0171 #define IDT_NT_BARLTBASE5       0x004C8U
0172 #define IDT_NT_BARUTBASE5       0x004CCU
0173 /* NT mapping table registers */
0174 /* NT Mapping Table Address/Status/Data (DWORD) */
0175 #define IDT_NT_NTMTBLADDR       0x004D0U
0176 #define IDT_NT_NTMTBLSTS        0x004D4U
0177 #define IDT_NT_NTMTBLDATA       0x004D8U
0178 /* Requester ID (Bus:Device:Function) Capture   (DWORD) */
0179 #define IDT_NT_REQIDCAP         0x004DCU
0180 /* Memory Windows Lookup table registers */
0181 /* Lookup Table Offset/Lower, Middle and Upper data (DWORD) */
0182 #define IDT_NT_LUTOFFSET        0x004E0U
0183 #define IDT_NT_LUTLDATA         0x004E4U
0184 #define IDT_NT_LUTMDATA         0x004E8U
0185 #define IDT_NT_LUTUDATA         0x004ECU
0186 /* NT Endpoint Uncorrectable/Correctable Errors Emulation registers (DWORD) */
0187 #define IDT_NT_NTUEEM           0x004F0U
0188 #define IDT_NT_NTCEEM           0x004F4U
0189 /* Global Address Space Access/Data registers   (DWARD) */
0190 #define IDT_NT_GASAADDR         0x00FF8U
0191 #define IDT_NT_GASADATA         0x00FFCU
0192 
0193 /*
0194  * IDT PCIe-switch Global Configuration and Status registers
0195  */
0196 /* Port N Configuration register in global space */
0197 /* PCI Express command/status and link control/status registers (WORD+WORD) */
0198 #define IDT_SW_NTP0_PCIECMDSTS      0x01004U
0199 #define IDT_SW_NTP0_PCIELCTLSTS     0x01050U
0200 /* NT-function control register     (DWORD) */
0201 #define IDT_SW_NTP0_NTCTL       0x01400U
0202 /* BAR setup/limit/base address registers (DWORD) */
0203 #define IDT_SW_NTP0_BARSETUP0       0x01470U
0204 #define IDT_SW_NTP0_BARLIMIT0       0x01474U
0205 #define IDT_SW_NTP0_BARLTBASE0      0x01478U
0206 #define IDT_SW_NTP0_BARUTBASE0      0x0147CU
0207 #define IDT_SW_NTP0_BARSETUP1       0x01480U
0208 #define IDT_SW_NTP0_BARLIMIT1       0x01484U
0209 #define IDT_SW_NTP0_BARLTBASE1      0x01488U
0210 #define IDT_SW_NTP0_BARUTBASE1      0x0148CU
0211 #define IDT_SW_NTP0_BARSETUP2       0x01490U
0212 #define IDT_SW_NTP0_BARLIMIT2       0x01494U
0213 #define IDT_SW_NTP0_BARLTBASE2      0x01498U
0214 #define IDT_SW_NTP0_BARUTBASE2      0x0149CU
0215 #define IDT_SW_NTP0_BARSETUP3       0x014A0U
0216 #define IDT_SW_NTP0_BARLIMIT3       0x014A4U
0217 #define IDT_SW_NTP0_BARLTBASE3      0x014A8U
0218 #define IDT_SW_NTP0_BARUTBASE3      0x014ACU
0219 #define IDT_SW_NTP0_BARSETUP4       0x014B0U
0220 #define IDT_SW_NTP0_BARLIMIT4       0x014B4U
0221 #define IDT_SW_NTP0_BARLTBASE4      0x014B8U
0222 #define IDT_SW_NTP0_BARUTBASE4      0x014BCU
0223 #define IDT_SW_NTP0_BARSETUP5       0x014C0U
0224 #define IDT_SW_NTP0_BARLIMIT5       0x014C4U
0225 #define IDT_SW_NTP0_BARLTBASE5      0x014C8U
0226 #define IDT_SW_NTP0_BARUTBASE5      0x014CCU
0227 /* PCI Express command/status and link control/status registers (WORD+WORD) */
0228 #define IDT_SW_NTP2_PCIECMDSTS      0x05004U
0229 #define IDT_SW_NTP2_PCIELCTLSTS     0x05050U
0230 /* NT-function control register     (DWORD) */
0231 #define IDT_SW_NTP2_NTCTL       0x05400U
0232 /* BAR setup/limit/base address registers (DWORD) */
0233 #define IDT_SW_NTP2_BARSETUP0       0x05470U
0234 #define IDT_SW_NTP2_BARLIMIT0       0x05474U
0235 #define IDT_SW_NTP2_BARLTBASE0      0x05478U
0236 #define IDT_SW_NTP2_BARUTBASE0      0x0547CU
0237 #define IDT_SW_NTP2_BARSETUP1       0x05480U
0238 #define IDT_SW_NTP2_BARLIMIT1       0x05484U
0239 #define IDT_SW_NTP2_BARLTBASE1      0x05488U
0240 #define IDT_SW_NTP2_BARUTBASE1      0x0548CU
0241 #define IDT_SW_NTP2_BARSETUP2       0x05490U
0242 #define IDT_SW_NTP2_BARLIMIT2       0x05494U
0243 #define IDT_SW_NTP2_BARLTBASE2      0x05498U
0244 #define IDT_SW_NTP2_BARUTBASE2      0x0549CU
0245 #define IDT_SW_NTP2_BARSETUP3       0x054A0U
0246 #define IDT_SW_NTP2_BARLIMIT3       0x054A4U
0247 #define IDT_SW_NTP2_BARLTBASE3      0x054A8U
0248 #define IDT_SW_NTP2_BARUTBASE3      0x054ACU
0249 #define IDT_SW_NTP2_BARSETUP4       0x054B0U
0250 #define IDT_SW_NTP2_BARLIMIT4       0x054B4U
0251 #define IDT_SW_NTP2_BARLTBASE4      0x054B8U
0252 #define IDT_SW_NTP2_BARUTBASE4      0x054BCU
0253 #define IDT_SW_NTP2_BARSETUP5       0x054C0U
0254 #define IDT_SW_NTP2_BARLIMIT5       0x054C4U
0255 #define IDT_SW_NTP2_BARLTBASE5      0x054C8U
0256 #define IDT_SW_NTP2_BARUTBASE5      0x054CCU
0257 /* PCI Express command/status and link control/status registers (WORD+WORD) */
0258 #define IDT_SW_NTP4_PCIECMDSTS      0x09004U
0259 #define IDT_SW_NTP4_PCIELCTLSTS     0x09050U
0260 /* NT-function control register     (DWORD) */
0261 #define IDT_SW_NTP4_NTCTL       0x09400U
0262 /* BAR setup/limit/base address registers (DWORD) */
0263 #define IDT_SW_NTP4_BARSETUP0       0x09470U
0264 #define IDT_SW_NTP4_BARLIMIT0       0x09474U
0265 #define IDT_SW_NTP4_BARLTBASE0      0x09478U
0266 #define IDT_SW_NTP4_BARUTBASE0      0x0947CU
0267 #define IDT_SW_NTP4_BARSETUP1       0x09480U
0268 #define IDT_SW_NTP4_BARLIMIT1       0x09484U
0269 #define IDT_SW_NTP4_BARLTBASE1      0x09488U
0270 #define IDT_SW_NTP4_BARUTBASE1      0x0948CU
0271 #define IDT_SW_NTP4_BARSETUP2       0x09490U
0272 #define IDT_SW_NTP4_BARLIMIT2       0x09494U
0273 #define IDT_SW_NTP4_BARLTBASE2      0x09498U
0274 #define IDT_SW_NTP4_BARUTBASE2      0x0949CU
0275 #define IDT_SW_NTP4_BARSETUP3       0x094A0U
0276 #define IDT_SW_NTP4_BARLIMIT3       0x094A4U
0277 #define IDT_SW_NTP4_BARLTBASE3      0x094A8U
0278 #define IDT_SW_NTP4_BARUTBASE3      0x094ACU
0279 #define IDT_SW_NTP4_BARSETUP4       0x094B0U
0280 #define IDT_SW_NTP4_BARLIMIT4       0x094B4U
0281 #define IDT_SW_NTP4_BARLTBASE4      0x094B8U
0282 #define IDT_SW_NTP4_BARUTBASE4      0x094BCU
0283 #define IDT_SW_NTP4_BARSETUP5       0x094C0U
0284 #define IDT_SW_NTP4_BARLIMIT5       0x094C4U
0285 #define IDT_SW_NTP4_BARLTBASE5      0x094C8U
0286 #define IDT_SW_NTP4_BARUTBASE5      0x094CCU
0287 /* PCI Express command/status and link control/status registers (WORD+WORD) */
0288 #define IDT_SW_NTP6_PCIECMDSTS      0x0D004U
0289 #define IDT_SW_NTP6_PCIELCTLSTS     0x0D050U
0290 /* NT-function control register     (DWORD) */
0291 #define IDT_SW_NTP6_NTCTL       0x0D400U
0292 /* BAR setup/limit/base address registers (DWORD) */
0293 #define IDT_SW_NTP6_BARSETUP0       0x0D470U
0294 #define IDT_SW_NTP6_BARLIMIT0       0x0D474U
0295 #define IDT_SW_NTP6_BARLTBASE0      0x0D478U
0296 #define IDT_SW_NTP6_BARUTBASE0      0x0D47CU
0297 #define IDT_SW_NTP6_BARSETUP1       0x0D480U
0298 #define IDT_SW_NTP6_BARLIMIT1       0x0D484U
0299 #define IDT_SW_NTP6_BARLTBASE1      0x0D488U
0300 #define IDT_SW_NTP6_BARUTBASE1      0x0D48CU
0301 #define IDT_SW_NTP6_BARSETUP2       0x0D490U
0302 #define IDT_SW_NTP6_BARLIMIT2       0x0D494U
0303 #define IDT_SW_NTP6_BARLTBASE2      0x0D498U
0304 #define IDT_SW_NTP6_BARUTBASE2      0x0D49CU
0305 #define IDT_SW_NTP6_BARSETUP3       0x0D4A0U
0306 #define IDT_SW_NTP6_BARLIMIT3       0x0D4A4U
0307 #define IDT_SW_NTP6_BARLTBASE3      0x0D4A8U
0308 #define IDT_SW_NTP6_BARUTBASE3      0x0D4ACU
0309 #define IDT_SW_NTP6_BARSETUP4       0x0D4B0U
0310 #define IDT_SW_NTP6_BARLIMIT4       0x0D4B4U
0311 #define IDT_SW_NTP6_BARLTBASE4      0x0D4B8U
0312 #define IDT_SW_NTP6_BARUTBASE4      0x0D4BCU
0313 #define IDT_SW_NTP6_BARSETUP5       0x0D4C0U
0314 #define IDT_SW_NTP6_BARLIMIT5       0x0D4C4U
0315 #define IDT_SW_NTP6_BARLTBASE5      0x0D4C8U
0316 #define IDT_SW_NTP6_BARUTBASE5      0x0D4CCU
0317 /* PCI Express command/status and link control/status registers (WORD+WORD) */
0318 #define IDT_SW_NTP8_PCIECMDSTS      0x11004U
0319 #define IDT_SW_NTP8_PCIELCTLSTS     0x11050U
0320 /* NT-function control register     (DWORD) */
0321 #define IDT_SW_NTP8_NTCTL       0x11400U
0322 /* BAR setup/limit/base address registers (DWORD) */
0323 #define IDT_SW_NTP8_BARSETUP0       0x11470U
0324 #define IDT_SW_NTP8_BARLIMIT0       0x11474U
0325 #define IDT_SW_NTP8_BARLTBASE0      0x11478U
0326 #define IDT_SW_NTP8_BARUTBASE0      0x1147CU
0327 #define IDT_SW_NTP8_BARSETUP1       0x11480U
0328 #define IDT_SW_NTP8_BARLIMIT1       0x11484U
0329 #define IDT_SW_NTP8_BARLTBASE1      0x11488U
0330 #define IDT_SW_NTP8_BARUTBASE1      0x1148CU
0331 #define IDT_SW_NTP8_BARSETUP2       0x11490U
0332 #define IDT_SW_NTP8_BARLIMIT2       0x11494U
0333 #define IDT_SW_NTP8_BARLTBASE2      0x11498U
0334 #define IDT_SW_NTP8_BARUTBASE2      0x1149CU
0335 #define IDT_SW_NTP8_BARSETUP3       0x114A0U
0336 #define IDT_SW_NTP8_BARLIMIT3       0x114A4U
0337 #define IDT_SW_NTP8_BARLTBASE3      0x114A8U
0338 #define IDT_SW_NTP8_BARUTBASE3      0x114ACU
0339 #define IDT_SW_NTP8_BARSETUP4       0x114B0U
0340 #define IDT_SW_NTP8_BARLIMIT4       0x114B4U
0341 #define IDT_SW_NTP8_BARLTBASE4      0x114B8U
0342 #define IDT_SW_NTP8_BARUTBASE4      0x114BCU
0343 #define IDT_SW_NTP8_BARSETUP5       0x114C0U
0344 #define IDT_SW_NTP8_BARLIMIT5       0x114C4U
0345 #define IDT_SW_NTP8_BARLTBASE5      0x114C8U
0346 #define IDT_SW_NTP8_BARUTBASE5      0x114CCU
0347 /* PCI Express command/status and link control/status registers (WORD+WORD) */
0348 #define IDT_SW_NTP12_PCIECMDSTS     0x19004U
0349 #define IDT_SW_NTP12_PCIELCTLSTS    0x19050U
0350 /* NT-function control register     (DWORD) */
0351 #define IDT_SW_NTP12_NTCTL      0x19400U
0352 /* BAR setup/limit/base address registers (DWORD) */
0353 #define IDT_SW_NTP12_BARSETUP0      0x19470U
0354 #define IDT_SW_NTP12_BARLIMIT0      0x19474U
0355 #define IDT_SW_NTP12_BARLTBASE0     0x19478U
0356 #define IDT_SW_NTP12_BARUTBASE0     0x1947CU
0357 #define IDT_SW_NTP12_BARSETUP1      0x19480U
0358 #define IDT_SW_NTP12_BARLIMIT1      0x19484U
0359 #define IDT_SW_NTP12_BARLTBASE1     0x19488U
0360 #define IDT_SW_NTP12_BARUTBASE1     0x1948CU
0361 #define IDT_SW_NTP12_BARSETUP2      0x19490U
0362 #define IDT_SW_NTP12_BARLIMIT2      0x19494U
0363 #define IDT_SW_NTP12_BARLTBASE2     0x19498U
0364 #define IDT_SW_NTP12_BARUTBASE2     0x1949CU
0365 #define IDT_SW_NTP12_BARSETUP3      0x194A0U
0366 #define IDT_SW_NTP12_BARLIMIT3      0x194A4U
0367 #define IDT_SW_NTP12_BARLTBASE3     0x194A8U
0368 #define IDT_SW_NTP12_BARUTBASE3     0x194ACU
0369 #define IDT_SW_NTP12_BARSETUP4      0x194B0U
0370 #define IDT_SW_NTP12_BARLIMIT4      0x194B4U
0371 #define IDT_SW_NTP12_BARLTBASE4     0x194B8U
0372 #define IDT_SW_NTP12_BARUTBASE4     0x194BCU
0373 #define IDT_SW_NTP12_BARSETUP5      0x194C0U
0374 #define IDT_SW_NTP12_BARLIMIT5      0x194C4U
0375 #define IDT_SW_NTP12_BARLTBASE5     0x194C8U
0376 #define IDT_SW_NTP12_BARUTBASE5     0x194CCU
0377 /* PCI Express command/status and link control/status registers (WORD+WORD) */
0378 #define IDT_SW_NTP16_PCIECMDSTS     0x21004U
0379 #define IDT_SW_NTP16_PCIELCTLSTS    0x21050U
0380 /* NT-function control register     (DWORD) */
0381 #define IDT_SW_NTP16_NTCTL      0x21400U
0382 /* BAR setup/limit/base address registers (DWORD) */
0383 #define IDT_SW_NTP16_BARSETUP0      0x21470U
0384 #define IDT_SW_NTP16_BARLIMIT0      0x21474U
0385 #define IDT_SW_NTP16_BARLTBASE0     0x21478U
0386 #define IDT_SW_NTP16_BARUTBASE0     0x2147CU
0387 #define IDT_SW_NTP16_BARSETUP1      0x21480U
0388 #define IDT_SW_NTP16_BARLIMIT1      0x21484U
0389 #define IDT_SW_NTP16_BARLTBASE1     0x21488U
0390 #define IDT_SW_NTP16_BARUTBASE1     0x2148CU
0391 #define IDT_SW_NTP16_BARSETUP2      0x21490U
0392 #define IDT_SW_NTP16_BARLIMIT2      0x21494U
0393 #define IDT_SW_NTP16_BARLTBASE2     0x21498U
0394 #define IDT_SW_NTP16_BARUTBASE2     0x2149CU
0395 #define IDT_SW_NTP16_BARSETUP3      0x214A0U
0396 #define IDT_SW_NTP16_BARLIMIT3      0x214A4U
0397 #define IDT_SW_NTP16_BARLTBASE3     0x214A8U
0398 #define IDT_SW_NTP16_BARUTBASE3     0x214ACU
0399 #define IDT_SW_NTP16_BARSETUP4      0x214B0U
0400 #define IDT_SW_NTP16_BARLIMIT4      0x214B4U
0401 #define IDT_SW_NTP16_BARLTBASE4     0x214B8U
0402 #define IDT_SW_NTP16_BARUTBASE4     0x214BCU
0403 #define IDT_SW_NTP16_BARSETUP5      0x214C0U
0404 #define IDT_SW_NTP16_BARLIMIT5      0x214C4U
0405 #define IDT_SW_NTP16_BARLTBASE5     0x214C8U
0406 #define IDT_SW_NTP16_BARUTBASE5     0x214CCU
0407 /* PCI Express command/status and link control/status registers (WORD+WORD) */
0408 #define IDT_SW_NTP20_PCIECMDSTS     0x29004U
0409 #define IDT_SW_NTP20_PCIELCTLSTS    0x29050U
0410 /* NT-function control register     (DWORD) */
0411 #define IDT_SW_NTP20_NTCTL      0x29400U
0412 /* BAR setup/limit/base address registers (DWORD) */
0413 #define IDT_SW_NTP20_BARSETUP0      0x29470U
0414 #define IDT_SW_NTP20_BARLIMIT0      0x29474U
0415 #define IDT_SW_NTP20_BARLTBASE0     0x29478U
0416 #define IDT_SW_NTP20_BARUTBASE0     0x2947CU
0417 #define IDT_SW_NTP20_BARSETUP1      0x29480U
0418 #define IDT_SW_NTP20_BARLIMIT1      0x29484U
0419 #define IDT_SW_NTP20_BARLTBASE1     0x29488U
0420 #define IDT_SW_NTP20_BARUTBASE1     0x2948CU
0421 #define IDT_SW_NTP20_BARSETUP2      0x29490U
0422 #define IDT_SW_NTP20_BARLIMIT2      0x29494U
0423 #define IDT_SW_NTP20_BARLTBASE2     0x29498U
0424 #define IDT_SW_NTP20_BARUTBASE2     0x2949CU
0425 #define IDT_SW_NTP20_BARSETUP3      0x294A0U
0426 #define IDT_SW_NTP20_BARLIMIT3      0x294A4U
0427 #define IDT_SW_NTP20_BARLTBASE3     0x294A8U
0428 #define IDT_SW_NTP20_BARUTBASE3     0x294ACU
0429 #define IDT_SW_NTP20_BARSETUP4      0x294B0U
0430 #define IDT_SW_NTP20_BARLIMIT4      0x294B4U
0431 #define IDT_SW_NTP20_BARLTBASE4     0x294B8U
0432 #define IDT_SW_NTP20_BARUTBASE4     0x294BCU
0433 #define IDT_SW_NTP20_BARSETUP5      0x294C0U
0434 #define IDT_SW_NTP20_BARLIMIT5      0x294C4U
0435 #define IDT_SW_NTP20_BARLTBASE5     0x294C8U
0436 #define IDT_SW_NTP20_BARUTBASE5     0x294CCU
0437 /* IDT PCIe-switch control register (DWORD) */
0438 #define IDT_SW_CTL          0x3E000U
0439 /* Boot Configuration Vector Status (DWORD) */
0440 #define IDT_SW_BCVSTS           0x3E004U
0441 /* Port Clocking Mode           (DWORD) */
0442 #define IDT_SW_PCLKMODE         0x3E008U
0443 /* Reset Drain Delay            (DWORD) */
0444 #define IDT_SW_RDRAINDELAY      0x3E080U
0445 /* Port Operating Mode Change Drain Delay (DWORD) */
0446 #define IDT_SW_POMCDELAY        0x3E084U
0447 /* Side Effect Delay            (DWORD) */
0448 #define IDT_SW_SEDELAY          0x3E088U
0449 /* Upstream Secondary Bus Reset Delay   (DWORD) */
0450 #define IDT_SW_SSBRDELAY        0x3E08CU
0451 /* Switch partition N Control/Status/Failover registers */
0452 #define IDT_SW_SWPART0CTL       0x3E100U
0453 #define IDT_SW_SWPART0STS       0x3E104U
0454 #define IDT_SW_SWPART0FCTL      0x3E108U
0455 #define IDT_SW_SWPART1CTL       0x3E120U
0456 #define IDT_SW_SWPART1STS       0x3E124U
0457 #define IDT_SW_SWPART1FCTL      0x3E128U
0458 #define IDT_SW_SWPART2CTL       0x3E140U
0459 #define IDT_SW_SWPART2STS       0x3E144U
0460 #define IDT_SW_SWPART2FCTL      0x3E148U
0461 #define IDT_SW_SWPART3CTL       0x3E160U
0462 #define IDT_SW_SWPART3STS       0x3E164U
0463 #define IDT_SW_SWPART3FCTL      0x3E168U
0464 #define IDT_SW_SWPART4CTL       0x3E180U
0465 #define IDT_SW_SWPART4STS       0x3E184U
0466 #define IDT_SW_SWPART4FCTL      0x3E188U
0467 #define IDT_SW_SWPART5CTL       0x3E1A0U
0468 #define IDT_SW_SWPART5STS       0x3E1A4U
0469 #define IDT_SW_SWPART5FCTL      0x3E1A8U
0470 #define IDT_SW_SWPART6CTL       0x3E1C0U
0471 #define IDT_SW_SWPART6STS       0x3E1C4U
0472 #define IDT_SW_SWPART6FCTL      0x3E1C8U
0473 #define IDT_SW_SWPART7CTL       0x3E1E0U
0474 #define IDT_SW_SWPART7STS       0x3E1E4U
0475 #define IDT_SW_SWPART7FCTL      0x3E1E8U
0476 /* Switch port N control and status registers */
0477 #define IDT_SW_SWPORT0CTL       0x3E200U
0478 #define IDT_SW_SWPORT0STS       0x3E204U
0479 #define IDT_SW_SWPORT0FCTL      0x3E208U
0480 #define IDT_SW_SWPORT2CTL       0x3E240U
0481 #define IDT_SW_SWPORT2STS       0x3E244U
0482 #define IDT_SW_SWPORT2FCTL      0x3E248U
0483 #define IDT_SW_SWPORT4CTL       0x3E280U
0484 #define IDT_SW_SWPORT4STS       0x3E284U
0485 #define IDT_SW_SWPORT4FCTL      0x3E288U
0486 #define IDT_SW_SWPORT6CTL       0x3E2C0U
0487 #define IDT_SW_SWPORT6STS       0x3E2C4U
0488 #define IDT_SW_SWPORT6FCTL      0x3E2C8U
0489 #define IDT_SW_SWPORT8CTL       0x3E300U
0490 #define IDT_SW_SWPORT8STS       0x3E304U
0491 #define IDT_SW_SWPORT8FCTL      0x3E308U
0492 #define IDT_SW_SWPORT12CTL      0x3E380U
0493 #define IDT_SW_SWPORT12STS      0x3E384U
0494 #define IDT_SW_SWPORT12FCTL     0x3E388U
0495 #define IDT_SW_SWPORT16CTL      0x3E400U
0496 #define IDT_SW_SWPORT16STS      0x3E404U
0497 #define IDT_SW_SWPORT16FCTL     0x3E408U
0498 #define IDT_SW_SWPORT20CTL      0x3E480U
0499 #define IDT_SW_SWPORT20STS      0x3E484U
0500 #define IDT_SW_SWPORT20FCTL     0x3E488U
0501 /* Switch Event registers */
0502 /* Switch Event Status/Mask/Partition mask (DWORD) */
0503 #define IDT_SW_SESTS            0x3EC00U
0504 #define IDT_SW_SEMSK            0x3EC04U
0505 #define IDT_SW_SEPMSK           0x3EC08U
0506 /* Switch Event Link Up/Down Status/Mask (DWORD) */
0507 #define IDT_SW_SELINKUPSTS      0x3EC0CU
0508 #define IDT_SW_SELINKUPMSK      0x3EC10U
0509 #define IDT_SW_SELINKDNSTS      0x3EC14U
0510 #define IDT_SW_SELINKDNMSK      0x3EC18U
0511 /* Switch Event Fundamental Reset Status/Mask (DWORD) */
0512 #define IDT_SW_SEFRSTSTS        0x3EC1CU
0513 #define IDT_SW_SEFRSTMSK        0x3EC20U
0514 /* Switch Event Hot Reset Status/Mask   (DWORD) */
0515 #define IDT_SW_SEHRSTSTS        0x3EC24U
0516 #define IDT_SW_SEHRSTMSK        0x3EC28U
0517 /* Switch Event Failover Mask       (DWORD) */
0518 #define IDT_SW_SEFOVRMSK        0x3EC2CU
0519 /* Switch Event Global Signal Status/Mask (DWORD) */
0520 #define IDT_SW_SEGSIGSTS        0x3EC30U
0521 #define IDT_SW_SEGSIGMSK        0x3EC34U
0522 /* NT Global Doorbell Status        (DWORD) */
0523 #define IDT_SW_GDBELLSTS        0x3EC3CU
0524 /* Switch partition N message M control (msgs routing table) (DWORD) */
0525 #define IDT_SW_SWP0MSGCTL0      0x3EE00U
0526 #define IDT_SW_SWP1MSGCTL0      0x3EE04U
0527 #define IDT_SW_SWP2MSGCTL0      0x3EE08U
0528 #define IDT_SW_SWP3MSGCTL0      0x3EE0CU
0529 #define IDT_SW_SWP4MSGCTL0      0x3EE10U
0530 #define IDT_SW_SWP5MSGCTL0      0x3EE14U
0531 #define IDT_SW_SWP6MSGCTL0      0x3EE18U
0532 #define IDT_SW_SWP7MSGCTL0      0x3EE1CU
0533 #define IDT_SW_SWP0MSGCTL1      0x3EE20U
0534 #define IDT_SW_SWP1MSGCTL1      0x3EE24U
0535 #define IDT_SW_SWP2MSGCTL1      0x3EE28U
0536 #define IDT_SW_SWP3MSGCTL1      0x3EE2CU
0537 #define IDT_SW_SWP4MSGCTL1      0x3EE30U
0538 #define IDT_SW_SWP5MSGCTL1      0x3EE34U
0539 #define IDT_SW_SWP6MSGCTL1      0x3EE38U
0540 #define IDT_SW_SWP7MSGCTL1      0x3EE3CU
0541 #define IDT_SW_SWP0MSGCTL2      0x3EE40U
0542 #define IDT_SW_SWP1MSGCTL2      0x3EE44U
0543 #define IDT_SW_SWP2MSGCTL2      0x3EE48U
0544 #define IDT_SW_SWP3MSGCTL2      0x3EE4CU
0545 #define IDT_SW_SWP4MSGCTL2      0x3EE50U
0546 #define IDT_SW_SWP5MSGCTL2      0x3EE54U
0547 #define IDT_SW_SWP6MSGCTL2      0x3EE58U
0548 #define IDT_SW_SWP7MSGCTL2      0x3EE5CU
0549 #define IDT_SW_SWP0MSGCTL3      0x3EE60U
0550 #define IDT_SW_SWP1MSGCTL3      0x3EE64U
0551 #define IDT_SW_SWP2MSGCTL3      0x3EE68U
0552 #define IDT_SW_SWP3MSGCTL3      0x3EE6CU
0553 #define IDT_SW_SWP4MSGCTL3      0x3EE70U
0554 #define IDT_SW_SWP5MSGCTL3      0x3EE74U
0555 #define IDT_SW_SWP6MSGCTL3      0x3EE78U
0556 #define IDT_SW_SWP7MSGCTL3      0x3EE7CU
0557 /* SMBus Status and Control registers   (DWORD) */
0558 #define IDT_SW_SMBUSSTS         0x3F188U
0559 #define IDT_SW_SMBUSCTL         0x3F18CU
0560 /* Serial EEPROM Interface      (DWORD) */
0561 #define IDT_SW_EEPROMINTF       0x3F190U
0562 /* MBus I/O Expander Address N      (DWORD) */
0563 #define IDT_SW_IOEXPADDR0       0x3F198U
0564 #define IDT_SW_IOEXPADDR1       0x3F19CU
0565 #define IDT_SW_IOEXPADDR2       0x3F1A0U
0566 #define IDT_SW_IOEXPADDR3       0x3F1A4U
0567 #define IDT_SW_IOEXPADDR4       0x3F1A8U
0568 #define IDT_SW_IOEXPADDR5       0x3F1ACU
0569 /* General Purpose Events Control and Status registers (DWORD) */
0570 #define IDT_SW_GPECTL           0x3F1B0U
0571 #define IDT_SW_GPESTS           0x3F1B4U
0572 /* Temperature sensor Control/Status/Alarm/Adjustment/Slope registers */
0573 #define IDT_SW_TMPCTL           0x3F1D4U
0574 #define IDT_SW_TMPSTS           0x3F1D8U
0575 #define IDT_SW_TMPALARM         0x3F1DCU
0576 #define IDT_SW_TMPADJ           0x3F1E0U
0577 #define IDT_SW_TSSLOPE          0x3F1E4U
0578 /* SMBus Configuration Block header log (DWORD) */
0579 #define IDT_SW_SMBUSCBHL        0x3F1E8U
0580 
0581 /*
0582  * Common registers related constants
0583  * @IDT_REG_ALIGN:  Registers alignment used in the driver
0584  * @IDT_REG_PCI_MAX:    Maximum PCI configuration space register value
0585  * @IDT_REG_SW_MAX: Maximum global register value
0586  */
0587 #define IDT_REG_ALIGN           4
0588 #define IDT_REG_PCI_MAX         0x00FFFU
0589 #define IDT_REG_SW_MAX          0x3FFFFU
0590 
0591 /*
0592  * PCICMDSTS register fields related constants
0593  * @IDT_PCICMDSTS_IOAE: I/O access enable
0594  * @IDT_PCICMDSTS_MAE:  Memory access enable
0595  * @IDT_PCICMDSTS_BME:  Bus master enable
0596  */
0597 #define IDT_PCICMDSTS_IOAE      0x00000001U
0598 #define IDT_PCICMDSTS_MAE       0x00000002U
0599 #define IDT_PCICMDSTS_BME       0x00000004U
0600 
0601 /*
0602  * PCIEDCAP register fields related constants
0603  * @IDT_PCIEDCAP_MPAYLOAD_MASK:  Maximum payload size mask
0604  * @IDT_PCIEDCAP_MPAYLOAD_FLD:   Maximum payload size field offset
0605  * @IDT_PCIEDCAP_MPAYLOAD_S128:  Max supported payload size of 128 bytes
0606  * @IDT_PCIEDCAP_MPAYLOAD_S256:  Max supported payload size of 256 bytes
0607  * @IDT_PCIEDCAP_MPAYLOAD_S512:  Max supported payload size of 512 bytes
0608  * @IDT_PCIEDCAP_MPAYLOAD_S1024: Max supported payload size of 1024 bytes
0609  * @IDT_PCIEDCAP_MPAYLOAD_S2048: Max supported payload size of 2048 bytes
0610  */
0611 #define IDT_PCIEDCAP_MPAYLOAD_MASK  0x00000007U
0612 #define IDT_PCIEDCAP_MPAYLOAD_FLD   0
0613 #define IDT_PCIEDCAP_MPAYLOAD_S128  0x00000000U
0614 #define IDT_PCIEDCAP_MPAYLOAD_S256  0x00000001U
0615 #define IDT_PCIEDCAP_MPAYLOAD_S512  0x00000002U
0616 #define IDT_PCIEDCAP_MPAYLOAD_S1024 0x00000003U
0617 #define IDT_PCIEDCAP_MPAYLOAD_S2048 0x00000004U
0618 
0619 /*
0620  * PCIEDCTLSTS registers fields related constants
0621  * @IDT_PCIEDCTL_MPS_MASK:  Maximum payload size mask
0622  * @IDT_PCIEDCTL_MPS_FLD:   MPS field offset
0623  * @IDT_PCIEDCTL_MPS_S128:  Max payload size of 128 bytes
0624  * @IDT_PCIEDCTL_MPS_S256:  Max payload size of 256 bytes
0625  * @IDT_PCIEDCTL_MPS_S512:  Max payload size of 512 bytes
0626  * @IDT_PCIEDCTL_MPS_S1024: Max payload size of 1024 bytes
0627  * @IDT_PCIEDCTL_MPS_S2048: Max payload size of 2048 bytes
0628  * @IDT_PCIEDCTL_MPS_S4096: Max payload size of 4096 bytes
0629  */
0630 #define IDT_PCIEDCTLSTS_MPS_MASK    0x000000E0U
0631 #define IDT_PCIEDCTLSTS_MPS_FLD     5
0632 #define IDT_PCIEDCTLSTS_MPS_S128    0x00000000U
0633 #define IDT_PCIEDCTLSTS_MPS_S256    0x00000020U
0634 #define IDT_PCIEDCTLSTS_MPS_S512    0x00000040U
0635 #define IDT_PCIEDCTLSTS_MPS_S1024   0x00000060U
0636 #define IDT_PCIEDCTLSTS_MPS_S2048   0x00000080U
0637 #define IDT_PCIEDCTLSTS_MPS_S4096   0x000000A0U
0638 
0639 /*
0640  * PCIELCAP register fields related constants
0641  * @IDT_PCIELCAP_PORTNUM_MASK:  Port number field mask
0642  * @IDT_PCIELCAP_PORTNUM_FLD:   Port number field offset
0643  */
0644 #define IDT_PCIELCAP_PORTNUM_MASK   0xFF000000U
0645 #define IDT_PCIELCAP_PORTNUM_FLD    24
0646 
0647 /*
0648  * PCIELCTLSTS registers fields related constants
0649  * @IDT_PCIELSTS_CLS_MASK:  Current link speed mask
0650  * @IDT_PCIELSTS_CLS_FLD:   Current link speed field offset
0651  * @IDT_PCIELSTS_NLW_MASK:  Negotiated link width mask
0652  * @IDT_PCIELSTS_NLW_FLD:   Negotiated link width field offset
0653  * @IDT_PCIELSTS_SCLK_COM:  Common slot clock configuration
0654  */
0655 #define IDT_PCIELCTLSTS_CLS_MASK    0x000F0000U
0656 #define IDT_PCIELCTLSTS_CLS_FLD     16
0657 #define IDT_PCIELCTLSTS_NLW_MASK    0x03F00000U
0658 #define IDT_PCIELCTLSTS_NLW_FLD     20
0659 #define IDT_PCIELCTLSTS_SCLK_COM    0x10000000U
0660 
0661 /*
0662  * NTCTL register fields related constants
0663  * @IDT_NTCTL_IDPROTDIS:    ID Protection check disable (disable MTBL)
0664  * @IDT_NTCTL_CPEN:     Completion enable
0665  * @IDT_NTCTL_RNS:      Request no snoop processing (if MTBL disabled)
0666  * @IDT_NTCTL_ATP:      Address type processing (if MTBL disabled)
0667  */
0668 #define IDT_NTCTL_IDPROTDIS     0x00000001U
0669 #define IDT_NTCTL_CPEN          0x00000002U
0670 #define IDT_NTCTL_RNS           0x00000004U
0671 #define IDT_NTCTL_ATP           0x00000008U
0672 
0673 /*
0674  * NTINTSTS register fields related constants
0675  * @IDT_NTINTSTS_MSG:       Message interrupt bit
0676  * @IDT_NTINTSTS_DBELL:     Doorbell interrupt bit
0677  * @IDT_NTINTSTS_SEVENT:    Switch Event interrupt bit
0678  * @IDT_NTINTSTS_TMPSENSOR: Temperature sensor interrupt bit
0679  */
0680 #define IDT_NTINTSTS_MSG        0x00000001U
0681 #define IDT_NTINTSTS_DBELL      0x00000002U
0682 #define IDT_NTINTSTS_SEVENT     0x00000008U
0683 #define IDT_NTINTSTS_TMPSENSOR      0x00000080U
0684 
0685 /*
0686  * NTINTMSK register fields related constants
0687  * @IDT_NTINTMSK_MSG:       Message interrupt mask bit
0688  * @IDT_NTINTMSK_DBELL:     Doorbell interrupt mask bit
0689  * @IDT_NTINTMSK_SEVENT:    Switch Event interrupt mask bit
0690  * @IDT_NTINTMSK_TMPSENSOR: Temperature sensor interrupt mask bit
0691  * @IDT_NTINTMSK_ALL:       NTB-related interrupts mask
0692  */
0693 #define IDT_NTINTMSK_MSG        0x00000001U
0694 #define IDT_NTINTMSK_DBELL      0x00000002U
0695 #define IDT_NTINTMSK_SEVENT     0x00000008U
0696 #define IDT_NTINTMSK_TMPSENSOR      0x00000080U
0697 #define IDT_NTINTMSK_ALL \
0698     (IDT_NTINTMSK_MSG | IDT_NTINTMSK_DBELL | IDT_NTINTMSK_SEVENT)
0699 
0700 /*
0701  * NTGSIGNAL register fields related constants
0702  * @IDT_NTGSIGNAL_SET:  Set global signal of the local partition
0703  */
0704 #define IDT_NTGSIGNAL_SET       0x00000001U
0705 
0706 /*
0707  * BARSETUP register fields related constants
0708  * @IDT_BARSETUP_TYPE_MASK: Mask of the TYPE field
0709  * @IDT_BARSETUP_TYPE_32:   32-bit addressing BAR
0710  * @IDT_BARSETUP_TYPE_64:   64-bit addressing BAR
0711  * @IDT_BARSETUP_PREF:      Value of the BAR prefetchable field
0712  * @IDT_BARSETUP_SIZE_MASK: Mask of the SIZE field
0713  * @IDT_BARSETUP_SIZE_FLD:  SIZE field offset
0714  * @IDT_BARSETUP_SIZE_CFG:  SIZE field value in case of config space MODE
0715  * @IDT_BARSETUP_MODE_CFG:  Configuration space BAR mode
0716  * @IDT_BARSETUP_ATRAN_MASK:    ATRAN field mask
0717  * @IDT_BARSETUP_ATRAN_FLD: ATRAN field offset
0718  * @IDT_BARSETUP_ATRAN_DIR: Direct address translation memory window
0719  * @IDT_BARSETUP_ATRAN_LUT12:   12-entry lookup table
0720  * @IDT_BARSETUP_ATRAN_LUT24:   24-entry lookup table
0721  * @IDT_BARSETUP_TPART_MASK:    TPART field mask
0722  * @IDT_BARSETUP_TPART_FLD: TPART field offset
0723  * @IDT_BARSETUP_EN:        BAR enable bit
0724  */
0725 #define IDT_BARSETUP_TYPE_MASK      0x00000006U
0726 #define IDT_BARSETUP_TYPE_FLD       0
0727 #define IDT_BARSETUP_TYPE_32        0x00000000U
0728 #define IDT_BARSETUP_TYPE_64        0x00000004U
0729 #define IDT_BARSETUP_PREF       0x00000008U
0730 #define IDT_BARSETUP_SIZE_MASK      0x000003F0U
0731 #define IDT_BARSETUP_SIZE_FLD       4
0732 #define IDT_BARSETUP_SIZE_CFG       0x000000C0U
0733 #define IDT_BARSETUP_MODE_CFG       0x00000400U
0734 #define IDT_BARSETUP_ATRAN_MASK     0x00001800U
0735 #define IDT_BARSETUP_ATRAN_FLD      11
0736 #define IDT_BARSETUP_ATRAN_DIR      0x00000000U
0737 #define IDT_BARSETUP_ATRAN_LUT12    0x00000800U
0738 #define IDT_BARSETUP_ATRAN_LUT24    0x00001000U
0739 #define IDT_BARSETUP_TPART_MASK     0x0000E000U
0740 #define IDT_BARSETUP_TPART_FLD      13
0741 #define IDT_BARSETUP_EN         0x80000000U
0742 
0743 /*
0744  * NTMTBLDATA register fields related constants
0745  * @IDT_NTMTBLDATA_VALID:   Set the MTBL entry being valid
0746  * @IDT_NTMTBLDATA_REQID_MASK:  Bus:Device:Function field mask
0747  * @IDT_NTMTBLDATA_REQID_FLD:   Bus:Device:Function field offset
0748  * @IDT_NTMTBLDATA_PART_MASK:   Partition field mask
0749  * @IDT_NTMTBLDATA_PART_FLD:    Partition field offset
0750  * @IDT_NTMTBLDATA_ATP_TRANS:   Enable AT field translation on request TLPs
0751  * @IDT_NTMTBLDATA_CNS_INV: Enable No Snoop attribute inversion of
0752  *              Completion TLPs
0753  * @IDT_NTMTBLDATA_RNS_INV: Enable No Snoop attribute inversion of
0754  *              Request TLPs
0755  */
0756 #define IDT_NTMTBLDATA_VALID        0x00000001U
0757 #define IDT_NTMTBLDATA_REQID_MASK   0x0001FFFEU
0758 #define IDT_NTMTBLDATA_REQID_FLD    1
0759 #define IDT_NTMTBLDATA_PART_MASK    0x000E0000U
0760 #define IDT_NTMTBLDATA_PART_FLD     17
0761 #define IDT_NTMTBLDATA_ATP_TRANS    0x20000000U
0762 #define IDT_NTMTBLDATA_CNS_INV      0x40000000U
0763 #define IDT_NTMTBLDATA_RNS_INV      0x80000000U
0764 
0765 /*
0766  * REQIDCAP register fields related constants
0767  * @IDT_REQIDCAP_REQID_MASK:    Request ID field mask
0768  * @IDT_REQIDCAP_REQID_FLD: Request ID field offset
0769  */
0770 #define IDT_REQIDCAP_REQID_MASK     0x0000FFFFU
0771 #define IDT_REQIDCAP_REQID_FLD      0
0772 
0773 /*
0774  * LUTOFFSET register fields related constants
0775  * @IDT_LUTOFFSET_INDEX_MASK:   Lookup table index field mask
0776  * @IDT_LUTOFFSET_INDEX_FLD:    Lookup table index field offset
0777  * @IDT_LUTOFFSET_BAR_MASK: Lookup table BAR select field mask
0778  * @IDT_LUTOFFSET_BAR_FLD:  Lookup table BAR select field offset
0779  */
0780 #define IDT_LUTOFFSET_INDEX_MASK    0x0000001FU
0781 #define IDT_LUTOFFSET_INDEX_FLD     0
0782 #define IDT_LUTOFFSET_BAR_MASK      0x00000700U
0783 #define IDT_LUTOFFSET_BAR_FLD       8
0784 
0785 /*
0786  * LUTUDATA register fields related constants
0787  * @IDT_LUTUDATA_PART_MASK: Partition field mask
0788  * @IDT_LUTUDATA_PART_FLD:  Partition field offset
0789  * @IDT_LUTUDATA_VALID:     Lookup table entry valid bit
0790  */
0791 #define IDT_LUTUDATA_PART_MASK      0x0000000FU
0792 #define IDT_LUTUDATA_PART_FLD       0
0793 #define IDT_LUTUDATA_VALID      0x80000000U
0794 
0795 /*
0796  * SWPARTxSTS register fields related constants
0797  * @IDT_SWPARTxSTS_SCI:     Switch partition state change initiated
0798  * @IDT_SWPARTxSTS_SCC:     Switch partition state change completed
0799  * @IDT_SWPARTxSTS_STATE_MASK:  Switch partition state mask
0800  * @IDT_SWPARTxSTS_STATE_FLD:   Switch partition state field offset
0801  * @IDT_SWPARTxSTS_STATE_DIS:   Switch partition disabled
0802  * @IDT_SWPARTxSTS_STATE_ACT:   Switch partition enabled
0803  * @IDT_SWPARTxSTS_STATE_RES:   Switch partition in reset
0804  * @IDT_SWPARTxSTS_US:      Switch partition has upstream port
0805  * @IDT_SWPARTxSTS_USID_MASK:   Switch partition upstream port ID mask
0806  * @IDT_SWPARTxSTS_USID_FLD:    Switch partition upstream port ID field offset
0807  * @IDT_SWPARTxSTS_NT:      Upstream port has NT function
0808  * @IDT_SWPARTxSTS_DMA:     Upstream port has DMA function
0809  */
0810 #define IDT_SWPARTxSTS_SCI      0x00000001U
0811 #define IDT_SWPARTxSTS_SCC      0x00000002U
0812 #define IDT_SWPARTxSTS_STATE_MASK   0x00000060U
0813 #define IDT_SWPARTxSTS_STATE_FLD    5
0814 #define IDT_SWPARTxSTS_STATE_DIS    0x00000000U
0815 #define IDT_SWPARTxSTS_STATE_ACT    0x00000020U
0816 #define IDT_SWPARTxSTS_STATE_RES    0x00000060U
0817 #define IDT_SWPARTxSTS_US       0x00000100U
0818 #define IDT_SWPARTxSTS_USID_MASK    0x00003E00U
0819 #define IDT_SWPARTxSTS_USID_FLD     9
0820 #define IDT_SWPARTxSTS_NT       0x00004000U
0821 #define IDT_SWPARTxSTS_DMA      0x00008000U
0822 
0823 /*
0824  * SWPORTxSTS register fields related constants
0825  * @IDT_SWPORTxSTS_OMCI:    Operation mode change initiated
0826  * @IDT_SWPORTxSTS_OMCC:    Operation mode change completed
0827  * @IDT_SWPORTxSTS_LINKUP:  Link up status
0828  * @IDT_SWPORTxSTS_DS:      Port lanes behave as downstream lanes
0829  * @IDT_SWPORTxSTS_MODE_MASK:   Port mode field mask
0830  * @IDT_SWPORTxSTS_MODE_FLD:    Port mode field offset
0831  * @IDT_SWPORTxSTS_MODE_DIS:    Port mode - disabled
0832  * @IDT_SWPORTxSTS_MODE_DS: Port mode - downstream switch port
0833  * @IDT_SWPORTxSTS_MODE_US: Port mode - upstream switch port
0834  * @IDT_SWPORTxSTS_MODE_NT: Port mode - NT function
0835  * @IDT_SWPORTxSTS_MODE_USNT:   Port mode - upstream switch port with NTB
0836  * @IDT_SWPORTxSTS_MODE_UNAT:   Port mode - unattached
0837  * @IDT_SWPORTxSTS_MODE_USDMA:  Port mode - upstream switch port with DMA
0838  * @IDT_SWPORTxSTS_MODE_USNTDMA:Port mode - upstream port with NTB and DMA
0839  * @IDT_SWPORTxSTS_MODE_NTDMA:  Port mode - NT function with DMA
0840  * @IDT_SWPORTxSTS_SWPART_MASK: Port partition field mask
0841  * @IDT_SWPORTxSTS_SWPART_FLD:  Port partition field offset
0842  * @IDT_SWPORTxSTS_DEVNUM_MASK: Port device number field mask
0843  * @IDT_SWPORTxSTS_DEVNUM_FLD:  Port device number field offset
0844  */
0845 #define IDT_SWPORTxSTS_OMCI     0x00000001U
0846 #define IDT_SWPORTxSTS_OMCC     0x00000002U
0847 #define IDT_SWPORTxSTS_LINKUP       0x00000010U
0848 #define IDT_SWPORTxSTS_DS       0x00000020U
0849 #define IDT_SWPORTxSTS_MODE_MASK    0x000003C0U
0850 #define IDT_SWPORTxSTS_MODE_FLD     6
0851 #define IDT_SWPORTxSTS_MODE_DIS     0x00000000U
0852 #define IDT_SWPORTxSTS_MODE_DS      0x00000040U
0853 #define IDT_SWPORTxSTS_MODE_US      0x00000080U
0854 #define IDT_SWPORTxSTS_MODE_NT      0x000000C0U
0855 #define IDT_SWPORTxSTS_MODE_USNT    0x00000100U
0856 #define IDT_SWPORTxSTS_MODE_UNAT    0x00000140U
0857 #define IDT_SWPORTxSTS_MODE_USDMA   0x00000180U
0858 #define IDT_SWPORTxSTS_MODE_USNTDMA 0x000001C0U
0859 #define IDT_SWPORTxSTS_MODE_NTDMA   0x00000200U
0860 #define IDT_SWPORTxSTS_SWPART_MASK  0x00001C00U
0861 #define IDT_SWPORTxSTS_SWPART_FLD   10
0862 #define IDT_SWPORTxSTS_DEVNUM_MASK  0x001F0000U
0863 #define IDT_SWPORTxSTS_DEVNUM_FLD   16
0864 
0865 /*
0866  * SEMSK register fields related constants
0867  * @IDT_SEMSK_LINKUP:   Link Up event mask bit
0868  * @IDT_SEMSK_LINKDN:   Link Down event mask bit
0869  * @IDT_SEMSK_GSIGNAL:  Global Signal event mask bit
0870  */
0871 #define IDT_SEMSK_LINKUP        0x00000001U
0872 #define IDT_SEMSK_LINKDN        0x00000002U
0873 #define IDT_SEMSK_GSIGNAL       0x00000020U
0874 
0875 /*
0876  * SWPxMSGCTL register fields related constants
0877  * @IDT_SWPxMSGCTL_REG_MASK:    Register select field mask
0878  * @IDT_SWPxMSGCTL_REG_FLD: Register select field offset
0879  * @IDT_SWPxMSGCTL_PART_MASK:   Partition select field mask
0880  * @IDT_SWPxMSGCTL_PART_FLD:    Partition select field offset
0881  */
0882 #define IDT_SWPxMSGCTL_REG_MASK     0x00000003U
0883 #define IDT_SWPxMSGCTL_REG_FLD      0
0884 #define IDT_SWPxMSGCTL_PART_MASK    0x00000070U
0885 #define IDT_SWPxMSGCTL_PART_FLD     4
0886 
0887 /*
0888  * TMPCTL register fields related constants
0889  * @IDT_TMPCTL_LTH_MASK:    Low temperature threshold field mask
0890  * @IDT_TMPCTL_LTH_FLD:     Low temperature threshold field offset
0891  * @IDT_TMPCTL_MTH_MASK:    Middle temperature threshold field mask
0892  * @IDT_TMPCTL_MTH_FLD:     Middle temperature threshold field offset
0893  * @IDT_TMPCTL_HTH_MASK:    High temperature threshold field mask
0894  * @IDT_TMPCTL_HTH_FLD:     High temperature threshold field offset
0895  * @IDT_TMPCTL_PDOWN:       Temperature sensor power down
0896  */
0897 #define IDT_TMPCTL_LTH_MASK     0x000000FFU
0898 #define IDT_TMPCTL_LTH_FLD      0
0899 #define IDT_TMPCTL_MTH_MASK     0x0000FF00U
0900 #define IDT_TMPCTL_MTH_FLD      8
0901 #define IDT_TMPCTL_HTH_MASK     0x00FF0000U
0902 #define IDT_TMPCTL_HTH_FLD      16
0903 #define IDT_TMPCTL_PDOWN        0x80000000U
0904 
0905 /*
0906  * TMPSTS register fields related constants
0907  * @IDT_TMPSTS_TEMP_MASK:   Current temperature field mask
0908  * @IDT_TMPSTS_TEMP_FLD:    Current temperature field offset
0909  * @IDT_TMPSTS_LTEMP_MASK:  Lowest temperature field mask
0910  * @IDT_TMPSTS_LTEMP_FLD:   Lowest temperature field offset
0911  * @IDT_TMPSTS_HTEMP_MASK:  Highest temperature field mask
0912  * @IDT_TMPSTS_HTEMP_FLD:   Highest temperature field offset
0913  */
0914 #define IDT_TMPSTS_TEMP_MASK        0x000000FFU
0915 #define IDT_TMPSTS_TEMP_FLD     0
0916 #define IDT_TMPSTS_LTEMP_MASK       0x0000FF00U
0917 #define IDT_TMPSTS_LTEMP_FLD        8
0918 #define IDT_TMPSTS_HTEMP_MASK       0x00FF0000U
0919 #define IDT_TMPSTS_HTEMP_FLD        16
0920 
0921 /*
0922  * TMPALARM register fields related constants
0923  * @IDT_TMPALARM_LTEMP_MASK:    Lowest temperature field mask
0924  * @IDT_TMPALARM_LTEMP_FLD: Lowest temperature field offset
0925  * @IDT_TMPALARM_HTEMP_MASK:    Highest temperature field mask
0926  * @IDT_TMPALARM_HTEMP_FLD: Highest temperature field offset
0927  * @IDT_TMPALARM_IRQ_MASK:  Alarm IRQ status mask
0928  */
0929 #define IDT_TMPALARM_LTEMP_MASK     0x0000FF00U
0930 #define IDT_TMPALARM_LTEMP_FLD      8
0931 #define IDT_TMPALARM_HTEMP_MASK     0x00FF0000U
0932 #define IDT_TMPALARM_HTEMP_FLD      16
0933 #define IDT_TMPALARM_IRQ_MASK       0x3F000000U
0934 
0935 /*
0936  * TMPADJ register fields related constants
0937  * @IDT_TMPADJ_OFFSET_MASK: Temperature value offset field mask
0938  * @IDT_TMPADJ_OFFSET_FLD:  Temperature value offset field offset
0939  */
0940 #define IDT_TMPADJ_OFFSET_MASK      0x000000FFU
0941 #define IDT_TMPADJ_OFFSET_FLD       0
0942 
0943 /*
0944  * Helper macro to get/set the corresponding field value
0945  * @GET_FIELD:      Retrieve the value of the corresponding field
0946  * @SET_FIELD:      Set the specified field up
0947  * @IS_FLD_SET:     Check whether a field is set with value
0948  */
0949 #define GET_FIELD(field, data) \
0950     (((u32)(data) & IDT_ ##field## _MASK) >> IDT_ ##field## _FLD)
0951 #define SET_FIELD(field, data, value) \
0952     (((u32)(data) & ~IDT_ ##field## _MASK) | \
0953      ((u32)(value) << IDT_ ##field## _FLD))
0954 #define IS_FLD_SET(field, data, value) \
0955     (((u32)(data) & IDT_ ##field## _MASK) == IDT_ ##field## _ ##value)
0956 
0957 /*
0958  * Useful registers masks:
0959  * @IDT_DBELL_MASK: Doorbell bits mask
0960  * @IDT_OUTMSG_MASK:    Out messages status bits mask
0961  * @IDT_INMSG_MASK: In messages status bits mask
0962  * @IDT_MSG_MASK:   Any message status bits mask
0963  */
0964 #define IDT_DBELL_MASK      ((u32)0xFFFFFFFFU)
0965 #define IDT_OUTMSG_MASK     ((u32)0x0000000FU)
0966 #define IDT_INMSG_MASK      ((u32)0x000F0000U)
0967 #define IDT_MSG_MASK        (IDT_INMSG_MASK | IDT_OUTMSG_MASK)
0968 
0969 /*
0970  * Number of IDT NTB resources:
0971  * @IDT_MSG_CNT:    Number of Message registers
0972  * @IDT_BAR_CNT:    Number of BARs of each port
0973  * @IDT_MTBL_ENTRY_CNT: Number mapping table entries
0974  */
0975 #define IDT_MSG_CNT     4
0976 #define IDT_BAR_CNT     6
0977 #define IDT_MTBL_ENTRY_CNT  64
0978 
0979 /*
0980  * General IDT PCIe-switch constant
0981  * @IDT_MAX_NR_PORTS:   Maximum number of ports per IDT PCIe-switch
0982  * @IDT_MAX_NR_PARTS:   Maximum number of partitions per IDT PCIe-switch
0983  * @IDT_MAX_NR_PEERS:   Maximum number of NT-peers per IDT PCIe-switch
0984  * @IDT_MAX_NR_MWS: Maximum number of Memory Widows
0985  * @IDT_PCIE_REGSIZE:   Size of the registers in bytes
0986  * @IDT_TRANS_ALIGN:    Alignment of translated base address
0987  * @IDT_DIR_SIZE_ALIGN: Alignment of size setting for direct translated MWs.
0988  *          Even though the lower 10 bits are reserved, they are
0989  *          treated by IDT as one's so basically there is no any
0990  *          alignment of size limit for DIR address translation.
0991  */
0992 #define IDT_MAX_NR_PORTS    24
0993 #define IDT_MAX_NR_PARTS    8
0994 #define IDT_MAX_NR_PEERS    8
0995 #define IDT_MAX_NR_MWS      29
0996 #define IDT_PCIE_REGSIZE    4
0997 #define IDT_TRANS_ALIGN     4
0998 #define IDT_DIR_SIZE_ALIGN  1
0999 
1000 /*
1001  * IDT PCIe-switch temperature sensor value limits
1002  * @IDT_TEMP_MIN_MDEG:  Minimal integer value of temperature
1003  * @IDT_TEMP_MAX_MDEG:  Maximal integer value of temperature
1004  * @IDT_TEMP_MIN_OFFSET:Minimal integer value of temperature offset
1005  * @IDT_TEMP_MAX_OFFSET:Maximal integer value of temperature offset
1006  */
1007 #define IDT_TEMP_MIN_MDEG   0
1008 #define IDT_TEMP_MAX_MDEG   127500
1009 #define IDT_TEMP_MIN_OFFSET -64000
1010 #define IDT_TEMP_MAX_OFFSET 63500
1011 
1012 /*
1013  * Temperature sensor values enumeration
1014  * @IDT_TEMP_CUR:   Current temperature
1015  * @IDT_TEMP_LOW:   Lowest historical temperature
1016  * @IDT_TEMP_HIGH:  Highest historical temperature
1017  * @IDT_TEMP_OFFSET:    Current temperature offset
1018  */
1019 enum idt_temp_val {
1020     IDT_TEMP_CUR,
1021     IDT_TEMP_LOW,
1022     IDT_TEMP_HIGH,
1023     IDT_TEMP_OFFSET
1024 };
1025 
1026 /*
1027  * IDT Memory Windows type. Depending on the device settings, IDT supports
1028  * Direct Address Translation MW registers and Lookup Table registers
1029  * @IDT_MW_DIR:     Direct address translation
1030  * @IDT_MW_LUT12:   12-entry lookup table entry
1031  * @IDT_MW_LUT24:   24-entry lookup table entry
1032  *
1033  * NOTE These values are exactly the same as one of the BARSETUP ATRAN field
1034  */
1035 enum idt_mw_type {
1036     IDT_MW_DIR = 0x0,
1037     IDT_MW_LUT12 = 0x1,
1038     IDT_MW_LUT24 = 0x2
1039 };
1040 
1041 /*
1042  * IDT PCIe-switch model private data
1043  * @name:   Device name
1044  * @port_cnt:   Total number of NT endpoint ports
1045  * @ports:  Port ids
1046  */
1047 struct idt_89hpes_cfg {
1048     char *name;
1049     unsigned char port_cnt;
1050     unsigned char ports[];
1051 };
1052 
1053 /*
1054  * Memory window configuration structure
1055  * @type:   Type of the memory window (direct address translation or lookup
1056  *      table)
1057  *
1058  * @bar:    PCIe BAR the memory window referenced to
1059  * @idx:    Index of the memory window within the BAR
1060  *
1061  * @addr_align: Alignment of translated address
1062  * @size_align: Alignment of memory window size
1063  * @size_max:   Maximum size of memory window
1064  */
1065 struct idt_mw_cfg {
1066     enum idt_mw_type type;
1067 
1068     unsigned char bar;
1069     unsigned char idx;
1070 
1071     u64 addr_align;
1072     u64 size_align;
1073     u64 size_max;
1074 };
1075 
1076 /*
1077  * Description structure of peer IDT NT-functions:
1078  * @port:       NT-function port
1079  * @part:       NT-function partition
1080  *
1081  * @mw_cnt:     Number of memory windows supported by NT-function
1082  * @mws:        Array of memory windows descriptors
1083  */
1084 struct idt_ntb_peer {
1085     unsigned char port;
1086     unsigned char part;
1087 
1088     unsigned char mw_cnt;
1089     struct idt_mw_cfg *mws;
1090 };
1091 
1092 /*
1093  * Description structure of local IDT NT-function:
1094  * @ntb:        Linux NTB-device description structure
1095  * @swcfg:      Pointer to the structure of local IDT PCIe-switch
1096  *          specific cofnfigurations
1097  *
1098  * @port:       Local NT-function port
1099  * @part:       Local NT-function partition
1100  *
1101  * @peer_cnt:       Number of peers with activated NTB-function
1102  * @peers:      Array of peers descripting structures
1103  * @port_idx_map:   Map of port number -> peer index
1104  * @part_idx_map:   Map of partition number -> peer index
1105  *
1106  * @mtbl_lock:      Mapping table access lock
1107  *
1108  * @mw_cnt:     Number of memory windows supported by NT-function
1109  * @mws:        Array of memory windows descriptors
1110  * @lut_lock:       Lookup table access lock
1111  *
1112  * @msg_locks:      Message registers mapping table lockers
1113  *
1114  * @cfgspc:     Virtual address of the memory mapped configuration
1115  *          space of the NT-function
1116  * @db_mask_lock:   Doorbell mask register lock
1117  * @msg_mask_lock:  Message mask register lock
1118  * @gasa_lock:      GASA registers access lock
1119  *
1120  * @hwmon_mtx:      Temperature sensor interface update mutex
1121  *
1122  * @dbgfs_info:     DebugFS info node
1123  */
1124 struct idt_ntb_dev {
1125     struct ntb_dev ntb;
1126     struct idt_89hpes_cfg *swcfg;
1127 
1128     unsigned char port;
1129     unsigned char part;
1130 
1131     unsigned char peer_cnt;
1132     struct idt_ntb_peer peers[IDT_MAX_NR_PEERS];
1133     char port_idx_map[IDT_MAX_NR_PORTS];
1134     char part_idx_map[IDT_MAX_NR_PARTS];
1135 
1136     spinlock_t mtbl_lock;
1137 
1138     unsigned char mw_cnt;
1139     struct idt_mw_cfg *mws;
1140     spinlock_t lut_lock;
1141 
1142     spinlock_t msg_locks[IDT_MSG_CNT];
1143 
1144     void __iomem *cfgspc;
1145     spinlock_t db_mask_lock;
1146     spinlock_t msg_mask_lock;
1147     spinlock_t gasa_lock;
1148 
1149     struct mutex hwmon_mtx;
1150 
1151     struct dentry *dbgfs_info;
1152 };
1153 #define to_ndev_ntb(__ntb) container_of(__ntb, struct idt_ntb_dev, ntb)
1154 
1155 /*
1156  * Descriptor of the IDT PCIe-switch BAR resources
1157  * @setup:  BAR setup register
1158  * @limit:  BAR limit register
1159  * @ltbase: Lower translated base address
1160  * @utbase: Upper translated base address
1161  */
1162 struct idt_ntb_bar {
1163     unsigned int setup;
1164     unsigned int limit;
1165     unsigned int ltbase;
1166     unsigned int utbase;
1167 };
1168 
1169 /*
1170  * Descriptor of the IDT PCIe-switch message resources
1171  * @in:     Inbound message register
1172  * @out:    Outbound message register
1173  * @src:    Source of inbound message register
1174  */
1175 struct idt_ntb_msg {
1176     unsigned int in;
1177     unsigned int out;
1178     unsigned int src;
1179 };
1180 
1181 /*
1182  * Descriptor of the IDT PCIe-switch NT-function specific parameters in the
1183  * PCI Configuration Space
1184  * @bars:   BARs related registers
1185  * @msgs:   Messaging related registers
1186  */
1187 struct idt_ntb_regs {
1188     struct idt_ntb_bar bars[IDT_BAR_CNT];
1189     struct idt_ntb_msg msgs[IDT_MSG_CNT];
1190 };
1191 
1192 /*
1193  * Descriptor of the IDT PCIe-switch port specific parameters in the
1194  * Global Configuration Space
1195  * @pcicmdsts:   PCI command/status register
1196  * @pcielctlsts: PCIe link control/status
1197  *
1198  * @ctl:    Port control register
1199  * @sts:    Port status register
1200  *
1201  * @bars:   BARs related registers
1202  */
1203 struct idt_ntb_port {
1204     unsigned int pcicmdsts;
1205     unsigned int pcielctlsts;
1206     unsigned int ntctl;
1207 
1208     unsigned int ctl;
1209     unsigned int sts;
1210 
1211     struct idt_ntb_bar bars[IDT_BAR_CNT];
1212 };
1213 
1214 /*
1215  * Descriptor of the IDT PCIe-switch partition specific parameters.
1216  * @ctl:    Partition control register in the Global Address Space
1217  * @sts:    Partition status register in the Global Address Space
1218  * @msgctl: Messages control registers
1219  */
1220 struct idt_ntb_part {
1221     unsigned int ctl;
1222     unsigned int sts;
1223     unsigned int msgctl[IDT_MSG_CNT];
1224 };
1225 
1226 #endif /* NTB_HW_IDT_H */