ntb_hw_idt.h 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226
  1. /*
  2. * This file is provided under a GPLv2 license. When using or
  3. * redistributing this file, you may do so under that license.
  4. *
  5. * GPL LICENSE SUMMARY
  6. *
  7. * Copyright (C) 2016-2018 T-Platforms JSC All Rights Reserved.
  8. *
  9. * This program is free software; you can redistribute it and/or modify it
  10. * under the terms and conditions of the GNU General Public License,
  11. * version 2, as published by the Free Software Foundation.
  12. *
  13. * This program is distributed in the hope that it will be useful, but
  14. * WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
  16. * Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License along
  19. * with this program; if not, one can be found http://www.gnu.org/licenses/.
  20. *
  21. * The full GNU General Public License is included in this distribution in
  22. * the file called "COPYING".
  23. *
  24. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  25. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  26. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  27. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  28. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  29. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  30. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  31. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  32. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  33. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  34. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  35. *
  36. * IDT PCIe-switch NTB Linux driver
  37. *
  38. * Contact Information:
  39. * Serge Semin <fancer.lancer@gmail.com>, <Sergey.Semin@t-platforms.ru>
  40. */
  41. #ifndef NTB_HW_IDT_H
  42. #define NTB_HW_IDT_H
  43. #include <linux/types.h>
  44. #include <linux/pci.h>
  45. #include <linux/pci_ids.h>
  46. #include <linux/interrupt.h>
  47. #include <linux/spinlock.h>
  48. #include <linux/mutex.h>
  49. #include <linux/ntb.h>
  50. /*
  51. * Macro is used to create the struct pci_device_id that matches
  52. * the supported IDT PCIe-switches
  53. * @devname: Capitalized name of the particular device
  54. * @data: Variable passed to the driver of the particular device
  55. */
  56. #define IDT_PCI_DEVICE_IDS(devname, data) \
  57. .vendor = PCI_VENDOR_ID_IDT, .device = PCI_DEVICE_ID_IDT_##devname, \
  58. .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, \
  59. .class = (PCI_CLASS_BRIDGE_OTHER << 8), .class_mask = (0xFFFF00), \
  60. .driver_data = (kernel_ulong_t)&data
  61. /*
  62. * IDT PCIe-switches device IDs
  63. */
  64. #define PCI_DEVICE_ID_IDT_89HPES24NT6AG2 0x8091
  65. #define PCI_DEVICE_ID_IDT_89HPES32NT8AG2 0x808F
  66. #define PCI_DEVICE_ID_IDT_89HPES32NT8BG2 0x8088
  67. #define PCI_DEVICE_ID_IDT_89HPES12NT12G2 0x8092
  68. #define PCI_DEVICE_ID_IDT_89HPES16NT16G2 0x8090
  69. #define PCI_DEVICE_ID_IDT_89HPES24NT24G2 0x808E
  70. #define PCI_DEVICE_ID_IDT_89HPES32NT24AG2 0x808C
  71. #define PCI_DEVICE_ID_IDT_89HPES32NT24BG2 0x808A
  72. /*
  73. * NT-function Configuration Space registers
  74. * NOTE 1) The IDT PCIe-switch internal data is little-endian
  75. * so it must be taken into account in the driver
  76. * internals.
  77. * 2) Additionally the registers should be accessed either
  78. * with byte-enables corresponding to their native size or
  79. * the size of one DWORD
  80. *
  81. * So to simplify the driver code, there is only DWORD-sized read/write
  82. * operations utilized.
  83. */
  84. /* PCI Express Configuration Space */
  85. /* PCI Express command/status register (DWORD) */
  86. #define IDT_NT_PCICMDSTS 0x00004U
  87. /* PCI Express Device Capabilities (DWORD) */
  88. #define IDT_NT_PCIEDCAP 0x00044U
  89. /* PCI Express Device Control/Status (WORD+WORD) */
  90. #define IDT_NT_PCIEDCTLSTS 0x00048U
  91. /* PCI Express Link Capabilities (DWORD) */
  92. #define IDT_NT_PCIELCAP 0x0004CU
  93. /* PCI Express Link Control/Status (WORD+WORD) */
  94. #define IDT_NT_PCIELCTLSTS 0x00050U
  95. /* PCI Express Device Capabilities 2 (DWORD) */
  96. #define IDT_NT_PCIEDCAP2 0x00064U
  97. /* PCI Express Device Control 2 (WORD+WORD) */
  98. #define IDT_NT_PCIEDCTL2 0x00068U
  99. /* PCI Power Management Control and Status (DWORD) */
  100. #define IDT_NT_PMCSR 0x000C4U
  101. /*==========================================*/
  102. /* IDT Proprietary NT-port-specific registers */
  103. /* NT-function main control registers */
  104. /* NT Endpoint Control (DWORD) */
  105. #define IDT_NT_NTCTL 0x00400U
  106. /* NT Endpoint Interrupt Status/Mask (DWORD) */
  107. #define IDT_NT_NTINTSTS 0x00404U
  108. #define IDT_NT_NTINTMSK 0x00408U
  109. /* NT Endpoint Signal Data (DWORD) */
  110. #define IDT_NT_NTSDATA 0x0040CU
  111. /* NT Endpoint Global Signal (DWORD) */
  112. #define IDT_NT_NTGSIGNAL 0x00410U
  113. /* Internal Error Reporting Mask 0/1 (DWORD) */
  114. #define IDT_NT_NTIERRORMSK0 0x00414U
  115. #define IDT_NT_NTIERRORMSK1 0x00418U
  116. /* Doorbel registers */
  117. /* NT Outbound Doorbell Set (DWORD) */
  118. #define IDT_NT_OUTDBELLSET 0x00420U
  119. /* NT Inbound Doorbell Status/Mask (DWORD) */
  120. #define IDT_NT_INDBELLSTS 0x00428U
  121. #define IDT_NT_INDBELLMSK 0x0042CU
  122. /* Message registers */
  123. /* Outbound Message N (DWORD) */
  124. #define IDT_NT_OUTMSG0 0x00430U
  125. #define IDT_NT_OUTMSG1 0x00434U
  126. #define IDT_NT_OUTMSG2 0x00438U
  127. #define IDT_NT_OUTMSG3 0x0043CU
  128. /* Inbound Message N (DWORD) */
  129. #define IDT_NT_INMSG0 0x00440U
  130. #define IDT_NT_INMSG1 0x00444U
  131. #define IDT_NT_INMSG2 0x00448U
  132. #define IDT_NT_INMSG3 0x0044CU
  133. /* Inbound Message Source N (DWORD) */
  134. #define IDT_NT_INMSGSRC0 0x00450U
  135. #define IDT_NT_INMSGSRC1 0x00454U
  136. #define IDT_NT_INMSGSRC2 0x00458U
  137. #define IDT_NT_INMSGSRC3 0x0045CU
  138. /* Message Status (DWORD) */
  139. #define IDT_NT_MSGSTS 0x00460U
  140. /* Message Status Mask (DWORD) */
  141. #define IDT_NT_MSGSTSMSK 0x00464U
  142. /* BAR-setup registers */
  143. /* BAR N Setup/Limit Address/Lower and Upper Translated Base Address (DWORD) */
  144. #define IDT_NT_BARSETUP0 0x00470U
  145. #define IDT_NT_BARLIMIT0 0x00474U
  146. #define IDT_NT_BARLTBASE0 0x00478U
  147. #define IDT_NT_BARUTBASE0 0x0047CU
  148. #define IDT_NT_BARSETUP1 0x00480U
  149. #define IDT_NT_BARLIMIT1 0x00484U
  150. #define IDT_NT_BARLTBASE1 0x00488U
  151. #define IDT_NT_BARUTBASE1 0x0048CU
  152. #define IDT_NT_BARSETUP2 0x00490U
  153. #define IDT_NT_BARLIMIT2 0x00494U
  154. #define IDT_NT_BARLTBASE2 0x00498U
  155. #define IDT_NT_BARUTBASE2 0x0049CU
  156. #define IDT_NT_BARSETUP3 0x004A0U
  157. #define IDT_NT_BARLIMIT3 0x004A4U
  158. #define IDT_NT_BARLTBASE3 0x004A8U
  159. #define IDT_NT_BARUTBASE3 0x004ACU
  160. #define IDT_NT_BARSETUP4 0x004B0U
  161. #define IDT_NT_BARLIMIT4 0x004B4U
  162. #define IDT_NT_BARLTBASE4 0x004B8U
  163. #define IDT_NT_BARUTBASE4 0x004BCU
  164. #define IDT_NT_BARSETUP5 0x004C0U
  165. #define IDT_NT_BARLIMIT5 0x004C4U
  166. #define IDT_NT_BARLTBASE5 0x004C8U
  167. #define IDT_NT_BARUTBASE5 0x004CCU
  168. /* NT mapping table registers */
  169. /* NT Mapping Table Address/Status/Data (DWORD) */
  170. #define IDT_NT_NTMTBLADDR 0x004D0U
  171. #define IDT_NT_NTMTBLSTS 0x004D4U
  172. #define IDT_NT_NTMTBLDATA 0x004D8U
  173. /* Requester ID (Bus:Device:Function) Capture (DWORD) */
  174. #define IDT_NT_REQIDCAP 0x004DCU
  175. /* Memory Windows Lookup table registers */
  176. /* Lookup Table Offset/Lower, Middle and Upper data (DWORD) */
  177. #define IDT_NT_LUTOFFSET 0x004E0U
  178. #define IDT_NT_LUTLDATA 0x004E4U
  179. #define IDT_NT_LUTMDATA 0x004E8U
  180. #define IDT_NT_LUTUDATA 0x004ECU
  181. /* NT Endpoint Uncorrectable/Correctable Errors Emulation registers (DWORD) */
  182. #define IDT_NT_NTUEEM 0x004F0U
  183. #define IDT_NT_NTCEEM 0x004F4U
  184. /* Global Address Space Access/Data registers (DWARD) */
  185. #define IDT_NT_GASAADDR 0x00FF8U
  186. #define IDT_NT_GASADATA 0x00FFCU
  187. /*
  188. * IDT PCIe-switch Global Configuration and Status registers
  189. */
  190. /* Port N Configuration register in global space */
  191. /* PCI Express command/status and link control/status registers (WORD+WORD) */
  192. #define IDT_SW_NTP0_PCIECMDSTS 0x01004U
  193. #define IDT_SW_NTP0_PCIELCTLSTS 0x01050U
  194. /* NT-function control register (DWORD) */
  195. #define IDT_SW_NTP0_NTCTL 0x01400U
  196. /* BAR setup/limit/base address registers (DWORD) */
  197. #define IDT_SW_NTP0_BARSETUP0 0x01470U
  198. #define IDT_SW_NTP0_BARLIMIT0 0x01474U
  199. #define IDT_SW_NTP0_BARLTBASE0 0x01478U
  200. #define IDT_SW_NTP0_BARUTBASE0 0x0147CU
  201. #define IDT_SW_NTP0_BARSETUP1 0x01480U
  202. #define IDT_SW_NTP0_BARLIMIT1 0x01484U
  203. #define IDT_SW_NTP0_BARLTBASE1 0x01488U
  204. #define IDT_SW_NTP0_BARUTBASE1 0x0148CU
  205. #define IDT_SW_NTP0_BARSETUP2 0x01490U
  206. #define IDT_SW_NTP0_BARLIMIT2 0x01494U
  207. #define IDT_SW_NTP0_BARLTBASE2 0x01498U
  208. #define IDT_SW_NTP0_BARUTBASE2 0x0149CU
  209. #define IDT_SW_NTP0_BARSETUP3 0x014A0U
  210. #define IDT_SW_NTP0_BARLIMIT3 0x014A4U
  211. #define IDT_SW_NTP0_BARLTBASE3 0x014A8U
  212. #define IDT_SW_NTP0_BARUTBASE3 0x014ACU
  213. #define IDT_SW_NTP0_BARSETUP4 0x014B0U
  214. #define IDT_SW_NTP0_BARLIMIT4 0x014B4U
  215. #define IDT_SW_NTP0_BARLTBASE4 0x014B8U
  216. #define IDT_SW_NTP0_BARUTBASE4 0x014BCU
  217. #define IDT_SW_NTP0_BARSETUP5 0x014C0U
  218. #define IDT_SW_NTP0_BARLIMIT5 0x014C4U
  219. #define IDT_SW_NTP0_BARLTBASE5 0x014C8U
  220. #define IDT_SW_NTP0_BARUTBASE5 0x014CCU
  221. /* PCI Express command/status and link control/status registers (WORD+WORD) */
  222. #define IDT_SW_NTP2_PCIECMDSTS 0x05004U
  223. #define IDT_SW_NTP2_PCIELCTLSTS 0x05050U
  224. /* NT-function control register (DWORD) */
  225. #define IDT_SW_NTP2_NTCTL 0x05400U
  226. /* BAR setup/limit/base address registers (DWORD) */
  227. #define IDT_SW_NTP2_BARSETUP0 0x05470U
  228. #define IDT_SW_NTP2_BARLIMIT0 0x05474U
  229. #define IDT_SW_NTP2_BARLTBASE0 0x05478U
  230. #define IDT_SW_NTP2_BARUTBASE0 0x0547CU
  231. #define IDT_SW_NTP2_BARSETUP1 0x05480U
  232. #define IDT_SW_NTP2_BARLIMIT1 0x05484U
  233. #define IDT_SW_NTP2_BARLTBASE1 0x05488U
  234. #define IDT_SW_NTP2_BARUTBASE1 0x0548CU
  235. #define IDT_SW_NTP2_BARSETUP2 0x05490U
  236. #define IDT_SW_NTP2_BARLIMIT2 0x05494U
  237. #define IDT_SW_NTP2_BARLTBASE2 0x05498U
  238. #define IDT_SW_NTP2_BARUTBASE2 0x0549CU
  239. #define IDT_SW_NTP2_BARSETUP3 0x054A0U
  240. #define IDT_SW_NTP2_BARLIMIT3 0x054A4U
  241. #define IDT_SW_NTP2_BARLTBASE3 0x054A8U
  242. #define IDT_SW_NTP2_BARUTBASE3 0x054ACU
  243. #define IDT_SW_NTP2_BARSETUP4 0x054B0U
  244. #define IDT_SW_NTP2_BARLIMIT4 0x054B4U
  245. #define IDT_SW_NTP2_BARLTBASE4 0x054B8U
  246. #define IDT_SW_NTP2_BARUTBASE4 0x054BCU
  247. #define IDT_SW_NTP2_BARSETUP5 0x054C0U
  248. #define IDT_SW_NTP2_BARLIMIT5 0x054C4U
  249. #define IDT_SW_NTP2_BARLTBASE5 0x054C8U
  250. #define IDT_SW_NTP2_BARUTBASE5 0x054CCU
  251. /* PCI Express command/status and link control/status registers (WORD+WORD) */
  252. #define IDT_SW_NTP4_PCIECMDSTS 0x09004U
  253. #define IDT_SW_NTP4_PCIELCTLSTS 0x09050U
  254. /* NT-function control register (DWORD) */
  255. #define IDT_SW_NTP4_NTCTL 0x09400U
  256. /* BAR setup/limit/base address registers (DWORD) */
  257. #define IDT_SW_NTP4_BARSETUP0 0x09470U
  258. #define IDT_SW_NTP4_BARLIMIT0 0x09474U
  259. #define IDT_SW_NTP4_BARLTBASE0 0x09478U
  260. #define IDT_SW_NTP4_BARUTBASE0 0x0947CU
  261. #define IDT_SW_NTP4_BARSETUP1 0x09480U
  262. #define IDT_SW_NTP4_BARLIMIT1 0x09484U
  263. #define IDT_SW_NTP4_BARLTBASE1 0x09488U
  264. #define IDT_SW_NTP4_BARUTBASE1 0x0948CU
  265. #define IDT_SW_NTP4_BARSETUP2 0x09490U
  266. #define IDT_SW_NTP4_BARLIMIT2 0x09494U
  267. #define IDT_SW_NTP4_BARLTBASE2 0x09498U
  268. #define IDT_SW_NTP4_BARUTBASE2 0x0949CU
  269. #define IDT_SW_NTP4_BARSETUP3 0x094A0U
  270. #define IDT_SW_NTP4_BARLIMIT3 0x094A4U
  271. #define IDT_SW_NTP4_BARLTBASE3 0x094A8U
  272. #define IDT_SW_NTP4_BARUTBASE3 0x094ACU
  273. #define IDT_SW_NTP4_BARSETUP4 0x094B0U
  274. #define IDT_SW_NTP4_BARLIMIT4 0x094B4U
  275. #define IDT_SW_NTP4_BARLTBASE4 0x094B8U
  276. #define IDT_SW_NTP4_BARUTBASE4 0x094BCU
  277. #define IDT_SW_NTP4_BARSETUP5 0x094C0U
  278. #define IDT_SW_NTP4_BARLIMIT5 0x094C4U
  279. #define IDT_SW_NTP4_BARLTBASE5 0x094C8U
  280. #define IDT_SW_NTP4_BARUTBASE5 0x094CCU
  281. /* PCI Express command/status and link control/status registers (WORD+WORD) */
  282. #define IDT_SW_NTP6_PCIECMDSTS 0x0D004U
  283. #define IDT_SW_NTP6_PCIELCTLSTS 0x0D050U
  284. /* NT-function control register (DWORD) */
  285. #define IDT_SW_NTP6_NTCTL 0x0D400U
  286. /* BAR setup/limit/base address registers (DWORD) */
  287. #define IDT_SW_NTP6_BARSETUP0 0x0D470U
  288. #define IDT_SW_NTP6_BARLIMIT0 0x0D474U
  289. #define IDT_SW_NTP6_BARLTBASE0 0x0D478U
  290. #define IDT_SW_NTP6_BARUTBASE0 0x0D47CU
  291. #define IDT_SW_NTP6_BARSETUP1 0x0D480U
  292. #define IDT_SW_NTP6_BARLIMIT1 0x0D484U
  293. #define IDT_SW_NTP6_BARLTBASE1 0x0D488U
  294. #define IDT_SW_NTP6_BARUTBASE1 0x0D48CU
  295. #define IDT_SW_NTP6_BARSETUP2 0x0D490U
  296. #define IDT_SW_NTP6_BARLIMIT2 0x0D494U
  297. #define IDT_SW_NTP6_BARLTBASE2 0x0D498U
  298. #define IDT_SW_NTP6_BARUTBASE2 0x0D49CU
  299. #define IDT_SW_NTP6_BARSETUP3 0x0D4A0U
  300. #define IDT_SW_NTP6_BARLIMIT3 0x0D4A4U
  301. #define IDT_SW_NTP6_BARLTBASE3 0x0D4A8U
  302. #define IDT_SW_NTP6_BARUTBASE3 0x0D4ACU
  303. #define IDT_SW_NTP6_BARSETUP4 0x0D4B0U
  304. #define IDT_SW_NTP6_BARLIMIT4 0x0D4B4U
  305. #define IDT_SW_NTP6_BARLTBASE4 0x0D4B8U
  306. #define IDT_SW_NTP6_BARUTBASE4 0x0D4BCU
  307. #define IDT_SW_NTP6_BARSETUP5 0x0D4C0U
  308. #define IDT_SW_NTP6_BARLIMIT5 0x0D4C4U
  309. #define IDT_SW_NTP6_BARLTBASE5 0x0D4C8U
  310. #define IDT_SW_NTP6_BARUTBASE5 0x0D4CCU
  311. /* PCI Express command/status and link control/status registers (WORD+WORD) */
  312. #define IDT_SW_NTP8_PCIECMDSTS 0x11004U
  313. #define IDT_SW_NTP8_PCIELCTLSTS 0x11050U
  314. /* NT-function control register (DWORD) */
  315. #define IDT_SW_NTP8_NTCTL 0x11400U
  316. /* BAR setup/limit/base address registers (DWORD) */
  317. #define IDT_SW_NTP8_BARSETUP0 0x11470U
  318. #define IDT_SW_NTP8_BARLIMIT0 0x11474U
  319. #define IDT_SW_NTP8_BARLTBASE0 0x11478U
  320. #define IDT_SW_NTP8_BARUTBASE0 0x1147CU
  321. #define IDT_SW_NTP8_BARSETUP1 0x11480U
  322. #define IDT_SW_NTP8_BARLIMIT1 0x11484U
  323. #define IDT_SW_NTP8_BARLTBASE1 0x11488U
  324. #define IDT_SW_NTP8_BARUTBASE1 0x1148CU
  325. #define IDT_SW_NTP8_BARSETUP2 0x11490U
  326. #define IDT_SW_NTP8_BARLIMIT2 0x11494U
  327. #define IDT_SW_NTP8_BARLTBASE2 0x11498U
  328. #define IDT_SW_NTP8_BARUTBASE2 0x1149CU
  329. #define IDT_SW_NTP8_BARSETUP3 0x114A0U
  330. #define IDT_SW_NTP8_BARLIMIT3 0x114A4U
  331. #define IDT_SW_NTP8_BARLTBASE3 0x114A8U
  332. #define IDT_SW_NTP8_BARUTBASE3 0x114ACU
  333. #define IDT_SW_NTP8_BARSETUP4 0x114B0U
  334. #define IDT_SW_NTP8_BARLIMIT4 0x114B4U
  335. #define IDT_SW_NTP8_BARLTBASE4 0x114B8U
  336. #define IDT_SW_NTP8_BARUTBASE4 0x114BCU
  337. #define IDT_SW_NTP8_BARSETUP5 0x114C0U
  338. #define IDT_SW_NTP8_BARLIMIT5 0x114C4U
  339. #define IDT_SW_NTP8_BARLTBASE5 0x114C8U
  340. #define IDT_SW_NTP8_BARUTBASE5 0x114CCU
  341. /* PCI Express command/status and link control/status registers (WORD+WORD) */
  342. #define IDT_SW_NTP12_PCIECMDSTS 0x19004U
  343. #define IDT_SW_NTP12_PCIELCTLSTS 0x19050U
  344. /* NT-function control register (DWORD) */
  345. #define IDT_SW_NTP12_NTCTL 0x19400U
  346. /* BAR setup/limit/base address registers (DWORD) */
  347. #define IDT_SW_NTP12_BARSETUP0 0x19470U
  348. #define IDT_SW_NTP12_BARLIMIT0 0x19474U
  349. #define IDT_SW_NTP12_BARLTBASE0 0x19478U
  350. #define IDT_SW_NTP12_BARUTBASE0 0x1947CU
  351. #define IDT_SW_NTP12_BARSETUP1 0x19480U
  352. #define IDT_SW_NTP12_BARLIMIT1 0x19484U
  353. #define IDT_SW_NTP12_BARLTBASE1 0x19488U
  354. #define IDT_SW_NTP12_BARUTBASE1 0x1948CU
  355. #define IDT_SW_NTP12_BARSETUP2 0x19490U
  356. #define IDT_SW_NTP12_BARLIMIT2 0x19494U
  357. #define IDT_SW_NTP12_BARLTBASE2 0x19498U
  358. #define IDT_SW_NTP12_BARUTBASE2 0x1949CU
  359. #define IDT_SW_NTP12_BARSETUP3 0x194A0U
  360. #define IDT_SW_NTP12_BARLIMIT3 0x194A4U
  361. #define IDT_SW_NTP12_BARLTBASE3 0x194A8U
  362. #define IDT_SW_NTP12_BARUTBASE3 0x194ACU
  363. #define IDT_SW_NTP12_BARSETUP4 0x194B0U
  364. #define IDT_SW_NTP12_BARLIMIT4 0x194B4U
  365. #define IDT_SW_NTP12_BARLTBASE4 0x194B8U
  366. #define IDT_SW_NTP12_BARUTBASE4 0x194BCU
  367. #define IDT_SW_NTP12_BARSETUP5 0x194C0U
  368. #define IDT_SW_NTP12_BARLIMIT5 0x194C4U
  369. #define IDT_SW_NTP12_BARLTBASE5 0x194C8U
  370. #define IDT_SW_NTP12_BARUTBASE5 0x194CCU
  371. /* PCI Express command/status and link control/status registers (WORD+WORD) */
  372. #define IDT_SW_NTP16_PCIECMDSTS 0x21004U
  373. #define IDT_SW_NTP16_PCIELCTLSTS 0x21050U
  374. /* NT-function control register (DWORD) */
  375. #define IDT_SW_NTP16_NTCTL 0x21400U
  376. /* BAR setup/limit/base address registers (DWORD) */
  377. #define IDT_SW_NTP16_BARSETUP0 0x21470U
  378. #define IDT_SW_NTP16_BARLIMIT0 0x21474U
  379. #define IDT_SW_NTP16_BARLTBASE0 0x21478U
  380. #define IDT_SW_NTP16_BARUTBASE0 0x2147CU
  381. #define IDT_SW_NTP16_BARSETUP1 0x21480U
  382. #define IDT_SW_NTP16_BARLIMIT1 0x21484U
  383. #define IDT_SW_NTP16_BARLTBASE1 0x21488U
  384. #define IDT_SW_NTP16_BARUTBASE1 0x2148CU
  385. #define IDT_SW_NTP16_BARSETUP2 0x21490U
  386. #define IDT_SW_NTP16_BARLIMIT2 0x21494U
  387. #define IDT_SW_NTP16_BARLTBASE2 0x21498U
  388. #define IDT_SW_NTP16_BARUTBASE2 0x2149CU
  389. #define IDT_SW_NTP16_BARSETUP3 0x214A0U
  390. #define IDT_SW_NTP16_BARLIMIT3 0x214A4U
  391. #define IDT_SW_NTP16_BARLTBASE3 0x214A8U
  392. #define IDT_SW_NTP16_BARUTBASE3 0x214ACU
  393. #define IDT_SW_NTP16_BARSETUP4 0x214B0U
  394. #define IDT_SW_NTP16_BARLIMIT4 0x214B4U
  395. #define IDT_SW_NTP16_BARLTBASE4 0x214B8U
  396. #define IDT_SW_NTP16_BARUTBASE4 0x214BCU
  397. #define IDT_SW_NTP16_BARSETUP5 0x214C0U
  398. #define IDT_SW_NTP16_BARLIMIT5 0x214C4U
  399. #define IDT_SW_NTP16_BARLTBASE5 0x214C8U
  400. #define IDT_SW_NTP16_BARUTBASE5 0x214CCU
  401. /* PCI Express command/status and link control/status registers (WORD+WORD) */
  402. #define IDT_SW_NTP20_PCIECMDSTS 0x29004U
  403. #define IDT_SW_NTP20_PCIELCTLSTS 0x29050U
  404. /* NT-function control register (DWORD) */
  405. #define IDT_SW_NTP20_NTCTL 0x29400U
  406. /* BAR setup/limit/base address registers (DWORD) */
  407. #define IDT_SW_NTP20_BARSETUP0 0x29470U
  408. #define IDT_SW_NTP20_BARLIMIT0 0x29474U
  409. #define IDT_SW_NTP20_BARLTBASE0 0x29478U
  410. #define IDT_SW_NTP20_BARUTBASE0 0x2947CU
  411. #define IDT_SW_NTP20_BARSETUP1 0x29480U
  412. #define IDT_SW_NTP20_BARLIMIT1 0x29484U
  413. #define IDT_SW_NTP20_BARLTBASE1 0x29488U
  414. #define IDT_SW_NTP20_BARUTBASE1 0x2948CU
  415. #define IDT_SW_NTP20_BARSETUP2 0x29490U
  416. #define IDT_SW_NTP20_BARLIMIT2 0x29494U
  417. #define IDT_SW_NTP20_BARLTBASE2 0x29498U
  418. #define IDT_SW_NTP20_BARUTBASE2 0x2949CU
  419. #define IDT_SW_NTP20_BARSETUP3 0x294A0U
  420. #define IDT_SW_NTP20_BARLIMIT3 0x294A4U
  421. #define IDT_SW_NTP20_BARLTBASE3 0x294A8U
  422. #define IDT_SW_NTP20_BARUTBASE3 0x294ACU
  423. #define IDT_SW_NTP20_BARSETUP4 0x294B0U
  424. #define IDT_SW_NTP20_BARLIMIT4 0x294B4U
  425. #define IDT_SW_NTP20_BARLTBASE4 0x294B8U
  426. #define IDT_SW_NTP20_BARUTBASE4 0x294BCU
  427. #define IDT_SW_NTP20_BARSETUP5 0x294C0U
  428. #define IDT_SW_NTP20_BARLIMIT5 0x294C4U
  429. #define IDT_SW_NTP20_BARLTBASE5 0x294C8U
  430. #define IDT_SW_NTP20_BARUTBASE5 0x294CCU
  431. /* IDT PCIe-switch control register (DWORD) */
  432. #define IDT_SW_CTL 0x3E000U
  433. /* Boot Configuration Vector Status (DWORD) */
  434. #define IDT_SW_BCVSTS 0x3E004U
  435. /* Port Clocking Mode (DWORD) */
  436. #define IDT_SW_PCLKMODE 0x3E008U
  437. /* Reset Drain Delay (DWORD) */
  438. #define IDT_SW_RDRAINDELAY 0x3E080U
  439. /* Port Operating Mode Change Drain Delay (DWORD) */
  440. #define IDT_SW_POMCDELAY 0x3E084U
  441. /* Side Effect Delay (DWORD) */
  442. #define IDT_SW_SEDELAY 0x3E088U
  443. /* Upstream Secondary Bus Reset Delay (DWORD) */
  444. #define IDT_SW_SSBRDELAY 0x3E08CU
  445. /* Switch partition N Control/Status/Failover registers */
  446. #define IDT_SW_SWPART0CTL 0x3E100U
  447. #define IDT_SW_SWPART0STS 0x3E104U
  448. #define IDT_SW_SWPART0FCTL 0x3E108U
  449. #define IDT_SW_SWPART1CTL 0x3E120U
  450. #define IDT_SW_SWPART1STS 0x3E124U
  451. #define IDT_SW_SWPART1FCTL 0x3E128U
  452. #define IDT_SW_SWPART2CTL 0x3E140U
  453. #define IDT_SW_SWPART2STS 0x3E144U
  454. #define IDT_SW_SWPART2FCTL 0x3E148U
  455. #define IDT_SW_SWPART3CTL 0x3E160U
  456. #define IDT_SW_SWPART3STS 0x3E164U
  457. #define IDT_SW_SWPART3FCTL 0x3E168U
  458. #define IDT_SW_SWPART4CTL 0x3E180U
  459. #define IDT_SW_SWPART4STS 0x3E184U
  460. #define IDT_SW_SWPART4FCTL 0x3E188U
  461. #define IDT_SW_SWPART5CTL 0x3E1A0U
  462. #define IDT_SW_SWPART5STS 0x3E1A4U
  463. #define IDT_SW_SWPART5FCTL 0x3E1A8U
  464. #define IDT_SW_SWPART6CTL 0x3E1C0U
  465. #define IDT_SW_SWPART6STS 0x3E1C4U
  466. #define IDT_SW_SWPART6FCTL 0x3E1C8U
  467. #define IDT_SW_SWPART7CTL 0x3E1E0U
  468. #define IDT_SW_SWPART7STS 0x3E1E4U
  469. #define IDT_SW_SWPART7FCTL 0x3E1E8U
  470. /* Switch port N control and status registers */
  471. #define IDT_SW_SWPORT0CTL 0x3E200U
  472. #define IDT_SW_SWPORT0STS 0x3E204U
  473. #define IDT_SW_SWPORT0FCTL 0x3E208U
  474. #define IDT_SW_SWPORT2CTL 0x3E240U
  475. #define IDT_SW_SWPORT2STS 0x3E244U
  476. #define IDT_SW_SWPORT2FCTL 0x3E248U
  477. #define IDT_SW_SWPORT4CTL 0x3E280U
  478. #define IDT_SW_SWPORT4STS 0x3E284U
  479. #define IDT_SW_SWPORT4FCTL 0x3E288U
  480. #define IDT_SW_SWPORT6CTL 0x3E2C0U
  481. #define IDT_SW_SWPORT6STS 0x3E2C4U
  482. #define IDT_SW_SWPORT6FCTL 0x3E2C8U
  483. #define IDT_SW_SWPORT8CTL 0x3E300U
  484. #define IDT_SW_SWPORT8STS 0x3E304U
  485. #define IDT_SW_SWPORT8FCTL 0x3E308U
  486. #define IDT_SW_SWPORT12CTL 0x3E380U
  487. #define IDT_SW_SWPORT12STS 0x3E384U
  488. #define IDT_SW_SWPORT12FCTL 0x3E388U
  489. #define IDT_SW_SWPORT16CTL 0x3E400U
  490. #define IDT_SW_SWPORT16STS 0x3E404U
  491. #define IDT_SW_SWPORT16FCTL 0x3E408U
  492. #define IDT_SW_SWPORT20CTL 0x3E480U
  493. #define IDT_SW_SWPORT20STS 0x3E484U
  494. #define IDT_SW_SWPORT20FCTL 0x3E488U
  495. /* Switch Event registers */
  496. /* Switch Event Status/Mask/Partition mask (DWORD) */
  497. #define IDT_SW_SESTS 0x3EC00U
  498. #define IDT_SW_SEMSK 0x3EC04U
  499. #define IDT_SW_SEPMSK 0x3EC08U
  500. /* Switch Event Link Up/Down Status/Mask (DWORD) */
  501. #define IDT_SW_SELINKUPSTS 0x3EC0CU
  502. #define IDT_SW_SELINKUPMSK 0x3EC10U
  503. #define IDT_SW_SELINKDNSTS 0x3EC14U
  504. #define IDT_SW_SELINKDNMSK 0x3EC18U
  505. /* Switch Event Fundamental Reset Status/Mask (DWORD) */
  506. #define IDT_SW_SEFRSTSTS 0x3EC1CU
  507. #define IDT_SW_SEFRSTMSK 0x3EC20U
  508. /* Switch Event Hot Reset Status/Mask (DWORD) */
  509. #define IDT_SW_SEHRSTSTS 0x3EC24U
  510. #define IDT_SW_SEHRSTMSK 0x3EC28U
  511. /* Switch Event Failover Mask (DWORD) */
  512. #define IDT_SW_SEFOVRMSK 0x3EC2CU
  513. /* Switch Event Global Signal Status/Mask (DWORD) */
  514. #define IDT_SW_SEGSIGSTS 0x3EC30U
  515. #define IDT_SW_SEGSIGMSK 0x3EC34U
  516. /* NT Global Doorbell Status (DWORD) */
  517. #define IDT_SW_GDBELLSTS 0x3EC3CU
  518. /* Switch partition N message M control (msgs routing table) (DWORD) */
  519. #define IDT_SW_SWP0MSGCTL0 0x3EE00U
  520. #define IDT_SW_SWP1MSGCTL0 0x3EE04U
  521. #define IDT_SW_SWP2MSGCTL0 0x3EE08U
  522. #define IDT_SW_SWP3MSGCTL0 0x3EE0CU
  523. #define IDT_SW_SWP4MSGCTL0 0x3EE10U
  524. #define IDT_SW_SWP5MSGCTL0 0x3EE14U
  525. #define IDT_SW_SWP6MSGCTL0 0x3EE18U
  526. #define IDT_SW_SWP7MSGCTL0 0x3EE1CU
  527. #define IDT_SW_SWP0MSGCTL1 0x3EE20U
  528. #define IDT_SW_SWP1MSGCTL1 0x3EE24U
  529. #define IDT_SW_SWP2MSGCTL1 0x3EE28U
  530. #define IDT_SW_SWP3MSGCTL1 0x3EE2CU
  531. #define IDT_SW_SWP4MSGCTL1 0x3EE30U
  532. #define IDT_SW_SWP5MSGCTL1 0x3EE34U
  533. #define IDT_SW_SWP6MSGCTL1 0x3EE38U
  534. #define IDT_SW_SWP7MSGCTL1 0x3EE3CU
  535. #define IDT_SW_SWP0MSGCTL2 0x3EE40U
  536. #define IDT_SW_SWP1MSGCTL2 0x3EE44U
  537. #define IDT_SW_SWP2MSGCTL2 0x3EE48U
  538. #define IDT_SW_SWP3MSGCTL2 0x3EE4CU
  539. #define IDT_SW_SWP4MSGCTL2 0x3EE50U
  540. #define IDT_SW_SWP5MSGCTL2 0x3EE54U
  541. #define IDT_SW_SWP6MSGCTL2 0x3EE58U
  542. #define IDT_SW_SWP7MSGCTL2 0x3EE5CU
  543. #define IDT_SW_SWP0MSGCTL3 0x3EE60U
  544. #define IDT_SW_SWP1MSGCTL3 0x3EE64U
  545. #define IDT_SW_SWP2MSGCTL3 0x3EE68U
  546. #define IDT_SW_SWP3MSGCTL3 0x3EE6CU
  547. #define IDT_SW_SWP4MSGCTL3 0x3EE70U
  548. #define IDT_SW_SWP5MSGCTL3 0x3EE74U
  549. #define IDT_SW_SWP6MSGCTL3 0x3EE78U
  550. #define IDT_SW_SWP7MSGCTL3 0x3EE7CU
  551. /* SMBus Status and Control registers (DWORD) */
  552. #define IDT_SW_SMBUSSTS 0x3F188U
  553. #define IDT_SW_SMBUSCTL 0x3F18CU
  554. /* Serial EEPROM Interface (DWORD) */
  555. #define IDT_SW_EEPROMINTF 0x3F190U
  556. /* MBus I/O Expander Address N (DWORD) */
  557. #define IDT_SW_IOEXPADDR0 0x3F198U
  558. #define IDT_SW_IOEXPADDR1 0x3F19CU
  559. #define IDT_SW_IOEXPADDR2 0x3F1A0U
  560. #define IDT_SW_IOEXPADDR3 0x3F1A4U
  561. #define IDT_SW_IOEXPADDR4 0x3F1A8U
  562. #define IDT_SW_IOEXPADDR5 0x3F1ACU
  563. /* General Purpose Events Control and Status registers (DWORD) */
  564. #define IDT_SW_GPECTL 0x3F1B0U
  565. #define IDT_SW_GPESTS 0x3F1B4U
  566. /* Temperature sensor Control/Status/Alarm/Adjustment/Slope registers */
  567. #define IDT_SW_TMPCTL 0x3F1D4U
  568. #define IDT_SW_TMPSTS 0x3F1D8U
  569. #define IDT_SW_TMPALARM 0x3F1DCU
  570. #define IDT_SW_TMPADJ 0x3F1E0U
  571. #define IDT_SW_TSSLOPE 0x3F1E4U
  572. /* SMBus Configuration Block header log (DWORD) */
  573. #define IDT_SW_SMBUSCBHL 0x3F1E8U
  574. /*
  575. * Common registers related constants
  576. * @IDT_REG_ALIGN: Registers alignment used in the driver
  577. * @IDT_REG_PCI_MAX: Maximum PCI configuration space register value
  578. * @IDT_REG_SW_MAX: Maximum global register value
  579. */
  580. #define IDT_REG_ALIGN 4
  581. #define IDT_REG_PCI_MAX 0x00FFFU
  582. #define IDT_REG_SW_MAX 0x3FFFFU
  583. /*
  584. * PCICMDSTS register fields related constants
  585. * @IDT_PCICMDSTS_IOAE: I/O access enable
  586. * @IDT_PCICMDSTS_MAE: Memory access enable
  587. * @IDT_PCICMDSTS_BME: Bus master enable
  588. */
  589. #define IDT_PCICMDSTS_IOAE 0x00000001U
  590. #define IDT_PCICMDSTS_MAE 0x00000002U
  591. #define IDT_PCICMDSTS_BME 0x00000004U
  592. /*
  593. * PCIEDCAP register fields related constants
  594. * @IDT_PCIEDCAP_MPAYLOAD_MASK: Maximum payload size mask
  595. * @IDT_PCIEDCAP_MPAYLOAD_FLD: Maximum payload size field offset
  596. * @IDT_PCIEDCAP_MPAYLOAD_S128: Max supported payload size of 128 bytes
  597. * @IDT_PCIEDCAP_MPAYLOAD_S256: Max supported payload size of 256 bytes
  598. * @IDT_PCIEDCAP_MPAYLOAD_S512: Max supported payload size of 512 bytes
  599. * @IDT_PCIEDCAP_MPAYLOAD_S1024: Max supported payload size of 1024 bytes
  600. * @IDT_PCIEDCAP_MPAYLOAD_S2048: Max supported payload size of 2048 bytes
  601. */
  602. #define IDT_PCIEDCAP_MPAYLOAD_MASK 0x00000007U
  603. #define IDT_PCIEDCAP_MPAYLOAD_FLD 0
  604. #define IDT_PCIEDCAP_MPAYLOAD_S128 0x00000000U
  605. #define IDT_PCIEDCAP_MPAYLOAD_S256 0x00000001U
  606. #define IDT_PCIEDCAP_MPAYLOAD_S512 0x00000002U
  607. #define IDT_PCIEDCAP_MPAYLOAD_S1024 0x00000003U
  608. #define IDT_PCIEDCAP_MPAYLOAD_S2048 0x00000004U
  609. /*
  610. * PCIEDCTLSTS registers fields related constants
  611. * @IDT_PCIEDCTL_MPS_MASK: Maximum payload size mask
  612. * @IDT_PCIEDCTL_MPS_FLD: MPS field offset
  613. * @IDT_PCIEDCTL_MPS_S128: Max payload size of 128 bytes
  614. * @IDT_PCIEDCTL_MPS_S256: Max payload size of 256 bytes
  615. * @IDT_PCIEDCTL_MPS_S512: Max payload size of 512 bytes
  616. * @IDT_PCIEDCTL_MPS_S1024: Max payload size of 1024 bytes
  617. * @IDT_PCIEDCTL_MPS_S2048: Max payload size of 2048 bytes
  618. * @IDT_PCIEDCTL_MPS_S4096: Max payload size of 4096 bytes
  619. */
  620. #define IDT_PCIEDCTLSTS_MPS_MASK 0x000000E0U
  621. #define IDT_PCIEDCTLSTS_MPS_FLD 5
  622. #define IDT_PCIEDCTLSTS_MPS_S128 0x00000000U
  623. #define IDT_PCIEDCTLSTS_MPS_S256 0x00000020U
  624. #define IDT_PCIEDCTLSTS_MPS_S512 0x00000040U
  625. #define IDT_PCIEDCTLSTS_MPS_S1024 0x00000060U
  626. #define IDT_PCIEDCTLSTS_MPS_S2048 0x00000080U
  627. #define IDT_PCIEDCTLSTS_MPS_S4096 0x000000A0U
  628. /*
  629. * PCIELCAP register fields related constants
  630. * @IDT_PCIELCAP_PORTNUM_MASK: Port number field mask
  631. * @IDT_PCIELCAP_PORTNUM_FLD: Port number field offset
  632. */
  633. #define IDT_PCIELCAP_PORTNUM_MASK 0xFF000000U
  634. #define IDT_PCIELCAP_PORTNUM_FLD 24
  635. /*
  636. * PCIELCTLSTS registers fields related constants
  637. * @IDT_PCIELSTS_CLS_MASK: Current link speed mask
  638. * @IDT_PCIELSTS_CLS_FLD: Current link speed field offset
  639. * @IDT_PCIELSTS_NLW_MASK: Negotiated link width mask
  640. * @IDT_PCIELSTS_NLW_FLD: Negotiated link width field offset
  641. * @IDT_PCIELSTS_SCLK_COM: Common slot clock configuration
  642. */
  643. #define IDT_PCIELCTLSTS_CLS_MASK 0x000F0000U
  644. #define IDT_PCIELCTLSTS_CLS_FLD 16
  645. #define IDT_PCIELCTLSTS_NLW_MASK 0x03F00000U
  646. #define IDT_PCIELCTLSTS_NLW_FLD 20
  647. #define IDT_PCIELCTLSTS_SCLK_COM 0x10000000U
  648. /*
  649. * NTCTL register fields related constants
  650. * @IDT_NTCTL_IDPROTDIS: ID Protection check disable (disable MTBL)
  651. * @IDT_NTCTL_CPEN: Completion enable
  652. * @IDT_NTCTL_RNS: Request no snoop processing (if MTBL disabled)
  653. * @IDT_NTCTL_ATP: Address type processing (if MTBL disabled)
  654. */
  655. #define IDT_NTCTL_IDPROTDIS 0x00000001U
  656. #define IDT_NTCTL_CPEN 0x00000002U
  657. #define IDT_NTCTL_RNS 0x00000004U
  658. #define IDT_NTCTL_ATP 0x00000008U
  659. /*
  660. * NTINTSTS register fields related constants
  661. * @IDT_NTINTSTS_MSG: Message interrupt bit
  662. * @IDT_NTINTSTS_DBELL: Doorbell interrupt bit
  663. * @IDT_NTINTSTS_SEVENT: Switch Event interrupt bit
  664. * @IDT_NTINTSTS_TMPSENSOR: Temperature sensor interrupt bit
  665. */
  666. #define IDT_NTINTSTS_MSG 0x00000001U
  667. #define IDT_NTINTSTS_DBELL 0x00000002U
  668. #define IDT_NTINTSTS_SEVENT 0x00000008U
  669. #define IDT_NTINTSTS_TMPSENSOR 0x00000080U
  670. /*
  671. * NTINTMSK register fields related constants
  672. * @IDT_NTINTMSK_MSG: Message interrupt mask bit
  673. * @IDT_NTINTMSK_DBELL: Doorbell interrupt mask bit
  674. * @IDT_NTINTMSK_SEVENT: Switch Event interrupt mask bit
  675. * @IDT_NTINTMSK_TMPSENSOR: Temperature sensor interrupt mask bit
  676. * @IDT_NTINTMSK_ALL: NTB-related interrupts mask
  677. */
  678. #define IDT_NTINTMSK_MSG 0x00000001U
  679. #define IDT_NTINTMSK_DBELL 0x00000002U
  680. #define IDT_NTINTMSK_SEVENT 0x00000008U
  681. #define IDT_NTINTMSK_TMPSENSOR 0x00000080U
  682. #define IDT_NTINTMSK_ALL \
  683. (IDT_NTINTMSK_MSG | IDT_NTINTMSK_DBELL | IDT_NTINTMSK_SEVENT)
  684. /*
  685. * NTGSIGNAL register fields related constants
  686. * @IDT_NTGSIGNAL_SET: Set global signal of the local partition
  687. */
  688. #define IDT_NTGSIGNAL_SET 0x00000001U
  689. /*
  690. * BARSETUP register fields related constants
  691. * @IDT_BARSETUP_TYPE_MASK: Mask of the TYPE field
  692. * @IDT_BARSETUP_TYPE_32: 32-bit addressing BAR
  693. * @IDT_BARSETUP_TYPE_64: 64-bit addressing BAR
  694. * @IDT_BARSETUP_PREF: Value of the BAR prefetchable field
  695. * @IDT_BARSETUP_SIZE_MASK: Mask of the SIZE field
  696. * @IDT_BARSETUP_SIZE_FLD: SIZE field offset
  697. * @IDT_BARSETUP_SIZE_CFG: SIZE field value in case of config space MODE
  698. * @IDT_BARSETUP_MODE_CFG: Configuration space BAR mode
  699. * @IDT_BARSETUP_ATRAN_MASK: ATRAN field mask
  700. * @IDT_BARSETUP_ATRAN_FLD: ATRAN field offset
  701. * @IDT_BARSETUP_ATRAN_DIR: Direct address translation memory window
  702. * @IDT_BARSETUP_ATRAN_LUT12: 12-entry lookup table
  703. * @IDT_BARSETUP_ATRAN_LUT24: 24-entry lookup table
  704. * @IDT_BARSETUP_TPART_MASK: TPART field mask
  705. * @IDT_BARSETUP_TPART_FLD: TPART field offset
  706. * @IDT_BARSETUP_EN: BAR enable bit
  707. */
  708. #define IDT_BARSETUP_TYPE_MASK 0x00000006U
  709. #define IDT_BARSETUP_TYPE_FLD 0
  710. #define IDT_BARSETUP_TYPE_32 0x00000000U
  711. #define IDT_BARSETUP_TYPE_64 0x00000004U
  712. #define IDT_BARSETUP_PREF 0x00000008U
  713. #define IDT_BARSETUP_SIZE_MASK 0x000003F0U
  714. #define IDT_BARSETUP_SIZE_FLD 4
  715. #define IDT_BARSETUP_SIZE_CFG 0x000000C0U
  716. #define IDT_BARSETUP_MODE_CFG 0x00000400U
  717. #define IDT_BARSETUP_ATRAN_MASK 0x00001800U
  718. #define IDT_BARSETUP_ATRAN_FLD 11
  719. #define IDT_BARSETUP_ATRAN_DIR 0x00000000U
  720. #define IDT_BARSETUP_ATRAN_LUT12 0x00000800U
  721. #define IDT_BARSETUP_ATRAN_LUT24 0x00001000U
  722. #define IDT_BARSETUP_TPART_MASK 0x0000E000U
  723. #define IDT_BARSETUP_TPART_FLD 13
  724. #define IDT_BARSETUP_EN 0x80000000U
  725. /*
  726. * NTMTBLDATA register fields related constants
  727. * @IDT_NTMTBLDATA_VALID: Set the MTBL entry being valid
  728. * @IDT_NTMTBLDATA_REQID_MASK: Bus:Device:Function field mask
  729. * @IDT_NTMTBLDATA_REQID_FLD: Bus:Device:Function field offset
  730. * @IDT_NTMTBLDATA_PART_MASK: Partition field mask
  731. * @IDT_NTMTBLDATA_PART_FLD: Partition field offset
  732. * @IDT_NTMTBLDATA_ATP_TRANS: Enable AT field translation on request TLPs
  733. * @IDT_NTMTBLDATA_CNS_INV: Enable No Snoop attribute inversion of
  734. * Completion TLPs
  735. * @IDT_NTMTBLDATA_RNS_INV: Enable No Snoop attribute inversion of
  736. * Request TLPs
  737. */
  738. #define IDT_NTMTBLDATA_VALID 0x00000001U
  739. #define IDT_NTMTBLDATA_REQID_MASK 0x0001FFFEU
  740. #define IDT_NTMTBLDATA_REQID_FLD 1
  741. #define IDT_NTMTBLDATA_PART_MASK 0x000E0000U
  742. #define IDT_NTMTBLDATA_PART_FLD 17
  743. #define IDT_NTMTBLDATA_ATP_TRANS 0x20000000U
  744. #define IDT_NTMTBLDATA_CNS_INV 0x40000000U
  745. #define IDT_NTMTBLDATA_RNS_INV 0x80000000U
  746. /*
  747. * REQIDCAP register fields related constants
  748. * @IDT_REQIDCAP_REQID_MASK: Request ID field mask
  749. * @IDT_REQIDCAP_REQID_FLD: Request ID field offset
  750. */
  751. #define IDT_REQIDCAP_REQID_MASK 0x0000FFFFU
  752. #define IDT_REQIDCAP_REQID_FLD 0
  753. /*
  754. * LUTOFFSET register fields related constants
  755. * @IDT_LUTOFFSET_INDEX_MASK: Lookup table index field mask
  756. * @IDT_LUTOFFSET_INDEX_FLD: Lookup table index field offset
  757. * @IDT_LUTOFFSET_BAR_MASK: Lookup table BAR select field mask
  758. * @IDT_LUTOFFSET_BAR_FLD: Lookup table BAR select field offset
  759. */
  760. #define IDT_LUTOFFSET_INDEX_MASK 0x0000001FU
  761. #define IDT_LUTOFFSET_INDEX_FLD 0
  762. #define IDT_LUTOFFSET_BAR_MASK 0x00000700U
  763. #define IDT_LUTOFFSET_BAR_FLD 8
  764. /*
  765. * LUTUDATA register fields related constants
  766. * @IDT_LUTUDATA_PART_MASK: Partition field mask
  767. * @IDT_LUTUDATA_PART_FLD: Partition field offset
  768. * @IDT_LUTUDATA_VALID: Lookup table entry valid bit
  769. */
  770. #define IDT_LUTUDATA_PART_MASK 0x0000000FU
  771. #define IDT_LUTUDATA_PART_FLD 0
  772. #define IDT_LUTUDATA_VALID 0x80000000U
  773. /*
  774. * SWPARTxSTS register fields related constants
  775. * @IDT_SWPARTxSTS_SCI: Switch partition state change initiated
  776. * @IDT_SWPARTxSTS_SCC: Switch partition state change completed
  777. * @IDT_SWPARTxSTS_STATE_MASK: Switch partition state mask
  778. * @IDT_SWPARTxSTS_STATE_FLD: Switch partition state field offset
  779. * @IDT_SWPARTxSTS_STATE_DIS: Switch partition disabled
  780. * @IDT_SWPARTxSTS_STATE_ACT: Switch partition enabled
  781. * @IDT_SWPARTxSTS_STATE_RES: Switch partition in reset
  782. * @IDT_SWPARTxSTS_US: Switch partition has upstream port
  783. * @IDT_SWPARTxSTS_USID_MASK: Switch partition upstream port ID mask
  784. * @IDT_SWPARTxSTS_USID_FLD: Switch partition upstream port ID field offset
  785. * @IDT_SWPARTxSTS_NT: Upstream port has NT function
  786. * @IDT_SWPARTxSTS_DMA: Upstream port has DMA function
  787. */
  788. #define IDT_SWPARTxSTS_SCI 0x00000001U
  789. #define IDT_SWPARTxSTS_SCC 0x00000002U
  790. #define IDT_SWPARTxSTS_STATE_MASK 0x00000060U
  791. #define IDT_SWPARTxSTS_STATE_FLD 5
  792. #define IDT_SWPARTxSTS_STATE_DIS 0x00000000U
  793. #define IDT_SWPARTxSTS_STATE_ACT 0x00000020U
  794. #define IDT_SWPARTxSTS_STATE_RES 0x00000060U
  795. #define IDT_SWPARTxSTS_US 0x00000100U
  796. #define IDT_SWPARTxSTS_USID_MASK 0x00003E00U
  797. #define IDT_SWPARTxSTS_USID_FLD 9
  798. #define IDT_SWPARTxSTS_NT 0x00004000U
  799. #define IDT_SWPARTxSTS_DMA 0x00008000U
  800. /*
  801. * SWPORTxSTS register fields related constants
  802. * @IDT_SWPORTxSTS_OMCI: Operation mode change initiated
  803. * @IDT_SWPORTxSTS_OMCC: Operation mode change completed
  804. * @IDT_SWPORTxSTS_LINKUP: Link up status
  805. * @IDT_SWPORTxSTS_DS: Port lanes behave as downstream lanes
  806. * @IDT_SWPORTxSTS_MODE_MASK: Port mode field mask
  807. * @IDT_SWPORTxSTS_MODE_FLD: Port mode field offset
  808. * @IDT_SWPORTxSTS_MODE_DIS: Port mode - disabled
  809. * @IDT_SWPORTxSTS_MODE_DS: Port mode - downstream switch port
  810. * @IDT_SWPORTxSTS_MODE_US: Port mode - upstream switch port
  811. * @IDT_SWPORTxSTS_MODE_NT: Port mode - NT function
  812. * @IDT_SWPORTxSTS_MODE_USNT: Port mode - upstream switch port with NTB
  813. * @IDT_SWPORTxSTS_MODE_UNAT: Port mode - unattached
  814. * @IDT_SWPORTxSTS_MODE_USDMA: Port mode - upstream switch port with DMA
  815. * @IDT_SWPORTxSTS_MODE_USNTDMA:Port mode - upstream port with NTB and DMA
  816. * @IDT_SWPORTxSTS_MODE_NTDMA: Port mode - NT function with DMA
  817. * @IDT_SWPORTxSTS_SWPART_MASK: Port partition field mask
  818. * @IDT_SWPORTxSTS_SWPART_FLD: Port partition field offset
  819. * @IDT_SWPORTxSTS_DEVNUM_MASK: Port device number field mask
  820. * @IDT_SWPORTxSTS_DEVNUM_FLD: Port device number field offset
  821. */
  822. #define IDT_SWPORTxSTS_OMCI 0x00000001U
  823. #define IDT_SWPORTxSTS_OMCC 0x00000002U
  824. #define IDT_SWPORTxSTS_LINKUP 0x00000010U
  825. #define IDT_SWPORTxSTS_DS 0x00000020U
  826. #define IDT_SWPORTxSTS_MODE_MASK 0x000003C0U
  827. #define IDT_SWPORTxSTS_MODE_FLD 6
  828. #define IDT_SWPORTxSTS_MODE_DIS 0x00000000U
  829. #define IDT_SWPORTxSTS_MODE_DS 0x00000040U
  830. #define IDT_SWPORTxSTS_MODE_US 0x00000080U
  831. #define IDT_SWPORTxSTS_MODE_NT 0x000000C0U
  832. #define IDT_SWPORTxSTS_MODE_USNT 0x00000100U
  833. #define IDT_SWPORTxSTS_MODE_UNAT 0x00000140U
  834. #define IDT_SWPORTxSTS_MODE_USDMA 0x00000180U
  835. #define IDT_SWPORTxSTS_MODE_USNTDMA 0x000001C0U
  836. #define IDT_SWPORTxSTS_MODE_NTDMA 0x00000200U
  837. #define IDT_SWPORTxSTS_SWPART_MASK 0x00001C00U
  838. #define IDT_SWPORTxSTS_SWPART_FLD 10
  839. #define IDT_SWPORTxSTS_DEVNUM_MASK 0x001F0000U
  840. #define IDT_SWPORTxSTS_DEVNUM_FLD 16
  841. /*
  842. * SEMSK register fields related constants
  843. * @IDT_SEMSK_LINKUP: Link Up event mask bit
  844. * @IDT_SEMSK_LINKDN: Link Down event mask bit
  845. * @IDT_SEMSK_GSIGNAL: Global Signal event mask bit
  846. */
  847. #define IDT_SEMSK_LINKUP 0x00000001U
  848. #define IDT_SEMSK_LINKDN 0x00000002U
  849. #define IDT_SEMSK_GSIGNAL 0x00000020U
  850. /*
  851. * SWPxMSGCTL register fields related constants
  852. * @IDT_SWPxMSGCTL_REG_MASK: Register select field mask
  853. * @IDT_SWPxMSGCTL_REG_FLD: Register select field offset
  854. * @IDT_SWPxMSGCTL_PART_MASK: Partition select field mask
  855. * @IDT_SWPxMSGCTL_PART_FLD: Partition select field offset
  856. */
  857. #define IDT_SWPxMSGCTL_REG_MASK 0x00000003U
  858. #define IDT_SWPxMSGCTL_REG_FLD 0
  859. #define IDT_SWPxMSGCTL_PART_MASK 0x00000070U
  860. #define IDT_SWPxMSGCTL_PART_FLD 4
  861. /*
  862. * TMPCTL register fields related constants
  863. * @IDT_TMPCTL_LTH_MASK: Low temperature threshold field mask
  864. * @IDT_TMPCTL_LTH_FLD: Low temperature threshold field offset
  865. * @IDT_TMPCTL_MTH_MASK: Middle temperature threshold field mask
  866. * @IDT_TMPCTL_MTH_FLD: Middle temperature threshold field offset
  867. * @IDT_TMPCTL_HTH_MASK: High temperature threshold field mask
  868. * @IDT_TMPCTL_HTH_FLD: High temperature threshold field offset
  869. * @IDT_TMPCTL_PDOWN: Temperature sensor power down
  870. */
  871. #define IDT_TMPCTL_LTH_MASK 0x000000FFU
  872. #define IDT_TMPCTL_LTH_FLD 0
  873. #define IDT_TMPCTL_MTH_MASK 0x0000FF00U
  874. #define IDT_TMPCTL_MTH_FLD 8
  875. #define IDT_TMPCTL_HTH_MASK 0x00FF0000U
  876. #define IDT_TMPCTL_HTH_FLD 16
  877. #define IDT_TMPCTL_PDOWN 0x80000000U
  878. /*
  879. * TMPSTS register fields related constants
  880. * @IDT_TMPSTS_TEMP_MASK: Current temperature field mask
  881. * @IDT_TMPSTS_TEMP_FLD: Current temperature field offset
  882. * @IDT_TMPSTS_LTEMP_MASK: Lowest temperature field mask
  883. * @IDT_TMPSTS_LTEMP_FLD: Lowest temperature field offset
  884. * @IDT_TMPSTS_HTEMP_MASK: Highest temperature field mask
  885. * @IDT_TMPSTS_HTEMP_FLD: Highest temperature field offset
  886. */
  887. #define IDT_TMPSTS_TEMP_MASK 0x000000FFU
  888. #define IDT_TMPSTS_TEMP_FLD 0
  889. #define IDT_TMPSTS_LTEMP_MASK 0x0000FF00U
  890. #define IDT_TMPSTS_LTEMP_FLD 8
  891. #define IDT_TMPSTS_HTEMP_MASK 0x00FF0000U
  892. #define IDT_TMPSTS_HTEMP_FLD 16
  893. /*
  894. * TMPALARM register fields related constants
  895. * @IDT_TMPALARM_LTEMP_MASK: Lowest temperature field mask
  896. * @IDT_TMPALARM_LTEMP_FLD: Lowest temperature field offset
  897. * @IDT_TMPALARM_HTEMP_MASK: Highest temperature field mask
  898. * @IDT_TMPALARM_HTEMP_FLD: Highest temperature field offset
  899. * @IDT_TMPALARM_IRQ_MASK: Alarm IRQ status mask
  900. */
  901. #define IDT_TMPALARM_LTEMP_MASK 0x0000FF00U
  902. #define IDT_TMPALARM_LTEMP_FLD 8
  903. #define IDT_TMPALARM_HTEMP_MASK 0x00FF0000U
  904. #define IDT_TMPALARM_HTEMP_FLD 16
  905. #define IDT_TMPALARM_IRQ_MASK 0x3F000000U
  906. /*
  907. * TMPADJ register fields related constants
  908. * @IDT_TMPADJ_OFFSET_MASK: Temperature value offset field mask
  909. * @IDT_TMPADJ_OFFSET_FLD: Temperature value offset field offset
  910. */
  911. #define IDT_TMPADJ_OFFSET_MASK 0x000000FFU
  912. #define IDT_TMPADJ_OFFSET_FLD 0
  913. /*
  914. * Helper macro to get/set the corresponding field value
  915. * @GET_FIELD: Retrieve the value of the corresponding field
  916. * @SET_FIELD: Set the specified field up
  917. * @IS_FLD_SET: Check whether a field is set with value
  918. */
  919. #define GET_FIELD(field, data) \
  920. (((u32)(data) & IDT_ ##field## _MASK) >> IDT_ ##field## _FLD)
  921. #define SET_FIELD(field, data, value) \
  922. (((u32)(data) & ~IDT_ ##field## _MASK) | \
  923. ((u32)(value) << IDT_ ##field## _FLD))
  924. #define IS_FLD_SET(field, data, value) \
  925. (((u32)(data) & IDT_ ##field## _MASK) == IDT_ ##field## _ ##value)
  926. /*
  927. * Useful registers masks:
  928. * @IDT_DBELL_MASK: Doorbell bits mask
  929. * @IDT_OUTMSG_MASK: Out messages status bits mask
  930. * @IDT_INMSG_MASK: In messages status bits mask
  931. * @IDT_MSG_MASK: Any message status bits mask
  932. */
  933. #define IDT_DBELL_MASK ((u32)0xFFFFFFFFU)
  934. #define IDT_OUTMSG_MASK ((u32)0x0000000FU)
  935. #define IDT_INMSG_MASK ((u32)0x000F0000U)
  936. #define IDT_MSG_MASK (IDT_INMSG_MASK | IDT_OUTMSG_MASK)
  937. /*
  938. * Number of IDT NTB resources:
  939. * @IDT_MSG_CNT: Number of Message registers
  940. * @IDT_BAR_CNT: Number of BARs of each port
  941. * @IDT_MTBL_ENTRY_CNT: Number mapping table entries
  942. */
  943. #define IDT_MSG_CNT 4
  944. #define IDT_BAR_CNT 6
  945. #define IDT_MTBL_ENTRY_CNT 64
  946. /*
  947. * General IDT PCIe-switch constant
  948. * @IDT_MAX_NR_PORTS: Maximum number of ports per IDT PCIe-switch
  949. * @IDT_MAX_NR_PARTS: Maximum number of partitions per IDT PCIe-switch
  950. * @IDT_MAX_NR_PEERS: Maximum number of NT-peers per IDT PCIe-switch
  951. * @IDT_MAX_NR_MWS: Maximum number of Memory Widows
  952. * @IDT_PCIE_REGSIZE: Size of the registers in bytes
  953. * @IDT_TRANS_ALIGN: Alignment of translated base address
  954. * @IDT_DIR_SIZE_ALIGN: Alignment of size setting for direct translated MWs.
  955. * Even though the lower 10 bits are reserved, they are
  956. * treated by IDT as one's so basically there is no any
  957. * alignment of size limit for DIR address translation.
  958. */
  959. #define IDT_MAX_NR_PORTS 24
  960. #define IDT_MAX_NR_PARTS 8
  961. #define IDT_MAX_NR_PEERS 8
  962. #define IDT_MAX_NR_MWS 29
  963. #define IDT_PCIE_REGSIZE 4
  964. #define IDT_TRANS_ALIGN 4
  965. #define IDT_DIR_SIZE_ALIGN 1
  966. /*
  967. * IDT PCIe-switch temperature sensor value limits
  968. * @IDT_TEMP_MIN_MDEG: Minimal integer value of temperature
  969. * @IDT_TEMP_MAX_MDEG: Maximal integer value of temperature
  970. * @IDT_TEMP_MIN_OFFSET:Minimal integer value of temperature offset
  971. * @IDT_TEMP_MAX_OFFSET:Maximal integer value of temperature offset
  972. */
  973. #define IDT_TEMP_MIN_MDEG 0
  974. #define IDT_TEMP_MAX_MDEG 127500
  975. #define IDT_TEMP_MIN_OFFSET -64000
  976. #define IDT_TEMP_MAX_OFFSET 63500
  977. /*
  978. * Temperature sensor values enumeration
  979. * @IDT_TEMP_CUR: Current temperature
  980. * @IDT_TEMP_LOW: Lowest historical temperature
  981. * @IDT_TEMP_HIGH: Highest historical temperature
  982. * @IDT_TEMP_OFFSET: Current temperature offset
  983. */
  984. enum idt_temp_val {
  985. IDT_TEMP_CUR,
  986. IDT_TEMP_LOW,
  987. IDT_TEMP_HIGH,
  988. IDT_TEMP_OFFSET
  989. };
  990. /*
  991. * IDT Memory Windows type. Depending on the device settings, IDT supports
  992. * Direct Address Translation MW registers and Lookup Table registers
  993. * @IDT_MW_DIR: Direct address translation
  994. * @IDT_MW_LUT12: 12-entry lookup table entry
  995. * @IDT_MW_LUT24: 24-entry lookup table entry
  996. *
  997. * NOTE These values are exactly the same as one of the BARSETUP ATRAN field
  998. */
  999. enum idt_mw_type {
  1000. IDT_MW_DIR = 0x0,
  1001. IDT_MW_LUT12 = 0x1,
  1002. IDT_MW_LUT24 = 0x2
  1003. };
  1004. /*
  1005. * IDT PCIe-switch model private data
  1006. * @name: Device name
  1007. * @port_cnt: Total number of NT endpoint ports
  1008. * @ports: Port ids
  1009. */
  1010. struct idt_89hpes_cfg {
  1011. char *name;
  1012. unsigned char port_cnt;
  1013. unsigned char ports[];
  1014. };
  1015. /*
  1016. * Memory window configuration structure
  1017. * @type: Type of the memory window (direct address translation or lookup
  1018. * table)
  1019. *
  1020. * @bar: PCIe BAR the memory window referenced to
  1021. * @idx: Index of the memory window within the BAR
  1022. *
  1023. * @addr_align: Alignment of translated address
  1024. * @size_align: Alignment of memory window size
  1025. * @size_max: Maximum size of memory window
  1026. */
  1027. struct idt_mw_cfg {
  1028. enum idt_mw_type type;
  1029. unsigned char bar;
  1030. unsigned char idx;
  1031. u64 addr_align;
  1032. u64 size_align;
  1033. u64 size_max;
  1034. };
  1035. /*
  1036. * Description structure of peer IDT NT-functions:
  1037. * @port: NT-function port
  1038. * @part: NT-function partition
  1039. *
  1040. * @mw_cnt: Number of memory windows supported by NT-function
  1041. * @mws: Array of memory windows descriptors
  1042. */
  1043. struct idt_ntb_peer {
  1044. unsigned char port;
  1045. unsigned char part;
  1046. unsigned char mw_cnt;
  1047. struct idt_mw_cfg *mws;
  1048. };
  1049. /*
  1050. * Description structure of local IDT NT-function:
  1051. * @ntb: Linux NTB-device description structure
  1052. * @swcfg: Pointer to the structure of local IDT PCIe-switch
  1053. * specific cofnfigurations
  1054. *
  1055. * @port: Local NT-function port
  1056. * @part: Local NT-function partition
  1057. *
  1058. * @peer_cnt: Number of peers with activated NTB-function
  1059. * @peers: Array of peers descripting structures
  1060. * @port_idx_map: Map of port number -> peer index
  1061. * @part_idx_map: Map of partition number -> peer index
  1062. *
  1063. * @mtbl_lock: Mapping table access lock
  1064. *
  1065. * @mw_cnt: Number of memory windows supported by NT-function
  1066. * @mws: Array of memory windows descriptors
  1067. * @lut_lock: Lookup table access lock
  1068. *
  1069. * @msg_locks: Message registers mapping table lockers
  1070. *
  1071. * @cfgspc: Virtual address of the memory mapped configuration
  1072. * space of the NT-function
  1073. * @db_mask_lock: Doorbell mask register lock
  1074. * @msg_mask_lock: Message mask register lock
  1075. * @gasa_lock: GASA registers access lock
  1076. *
  1077. * @hwmon_mtx: Temperature sensor interface update mutex
  1078. *
  1079. * @dbgfs_info: DebugFS info node
  1080. */
  1081. struct idt_ntb_dev {
  1082. struct ntb_dev ntb;
  1083. struct idt_89hpes_cfg *swcfg;
  1084. unsigned char port;
  1085. unsigned char part;
  1086. unsigned char peer_cnt;
  1087. struct idt_ntb_peer peers[IDT_MAX_NR_PEERS];
  1088. char port_idx_map[IDT_MAX_NR_PORTS];
  1089. char part_idx_map[IDT_MAX_NR_PARTS];
  1090. spinlock_t mtbl_lock;
  1091. unsigned char mw_cnt;
  1092. struct idt_mw_cfg *mws;
  1093. spinlock_t lut_lock;
  1094. spinlock_t msg_locks[IDT_MSG_CNT];
  1095. void __iomem *cfgspc;
  1096. spinlock_t db_mask_lock;
  1097. spinlock_t msg_mask_lock;
  1098. spinlock_t gasa_lock;
  1099. struct mutex hwmon_mtx;
  1100. struct dentry *dbgfs_info;
  1101. };
  1102. #define to_ndev_ntb(__ntb) container_of(__ntb, struct idt_ntb_dev, ntb)
  1103. /*
  1104. * Descriptor of the IDT PCIe-switch BAR resources
  1105. * @setup: BAR setup register
  1106. * @limit: BAR limit register
  1107. * @ltbase: Lower translated base address
  1108. * @utbase: Upper translated base address
  1109. */
  1110. struct idt_ntb_bar {
  1111. unsigned int setup;
  1112. unsigned int limit;
  1113. unsigned int ltbase;
  1114. unsigned int utbase;
  1115. };
  1116. /*
  1117. * Descriptor of the IDT PCIe-switch message resources
  1118. * @in: Inbound message register
  1119. * @out: Outbound message register
  1120. * @src: Source of inbound message register
  1121. */
  1122. struct idt_ntb_msg {
  1123. unsigned int in;
  1124. unsigned int out;
  1125. unsigned int src;
  1126. };
  1127. /*
  1128. * Descriptor of the IDT PCIe-switch NT-function specific parameters in the
  1129. * PCI Configuration Space
  1130. * @bars: BARs related registers
  1131. * @msgs: Messaging related registers
  1132. */
  1133. struct idt_ntb_regs {
  1134. struct idt_ntb_bar bars[IDT_BAR_CNT];
  1135. struct idt_ntb_msg msgs[IDT_MSG_CNT];
  1136. };
  1137. /*
  1138. * Descriptor of the IDT PCIe-switch port specific parameters in the
  1139. * Global Configuration Space
  1140. * @pcicmdsts: PCI command/status register
  1141. * @pcielctlsts: PCIe link control/status
  1142. *
  1143. * @ctl: Port control register
  1144. * @sts: Port status register
  1145. *
  1146. * @bars: BARs related registers
  1147. */
  1148. struct idt_ntb_port {
  1149. unsigned int pcicmdsts;
  1150. unsigned int pcielctlsts;
  1151. unsigned int ntctl;
  1152. unsigned int ctl;
  1153. unsigned int sts;
  1154. struct idt_ntb_bar bars[IDT_BAR_CNT];
  1155. };
  1156. /*
  1157. * Descriptor of the IDT PCIe-switch partition specific parameters.
  1158. * @ctl: Partition control register in the Global Address Space
  1159. * @sts: Partition status register in the Global Address Space
  1160. * @msgctl: Messages control registers
  1161. */
  1162. struct idt_ntb_part {
  1163. unsigned int ctl;
  1164. unsigned int sts;
  1165. unsigned int msgctl[IDT_MSG_CNT];
  1166. };
  1167. #endif /* NTB_HW_IDT_H */