18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci *   This file is provided under a GPLv2 license.  When using or
38c2ecf20Sopenharmony_ci *   redistributing this file, you may do so under that license.
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci *   GPL LICENSE SUMMARY
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci *   Copyright (C) 2016-2018 T-Platforms JSC All Rights Reserved.
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci *   This program is free software; you can redistribute it and/or modify it
108c2ecf20Sopenharmony_ci *   under the terms and conditions of the GNU General Public License,
118c2ecf20Sopenharmony_ci *   version 2, as published by the Free Software Foundation.
128c2ecf20Sopenharmony_ci *
138c2ecf20Sopenharmony_ci *   This program is distributed in the hope that it will be useful, but
148c2ecf20Sopenharmony_ci *   WITHOUT ANY WARRANTY; without even the implied warranty of
158c2ecf20Sopenharmony_ci *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
168c2ecf20Sopenharmony_ci *   Public License for more details.
178c2ecf20Sopenharmony_ci *
188c2ecf20Sopenharmony_ci *   You should have received a copy of the GNU General Public License along
198c2ecf20Sopenharmony_ci *   with this program; if not, one can be found http://www.gnu.org/licenses/.
208c2ecf20Sopenharmony_ci *
218c2ecf20Sopenharmony_ci *   The full GNU General Public License is included in this distribution in
228c2ecf20Sopenharmony_ci *   the file called "COPYING".
238c2ecf20Sopenharmony_ci *
248c2ecf20Sopenharmony_ci *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
258c2ecf20Sopenharmony_ci *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
268c2ecf20Sopenharmony_ci *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
278c2ecf20Sopenharmony_ci *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
288c2ecf20Sopenharmony_ci *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
298c2ecf20Sopenharmony_ci *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
308c2ecf20Sopenharmony_ci *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
318c2ecf20Sopenharmony_ci *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
328c2ecf20Sopenharmony_ci *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
338c2ecf20Sopenharmony_ci *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
348c2ecf20Sopenharmony_ci *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
358c2ecf20Sopenharmony_ci *
368c2ecf20Sopenharmony_ci * IDT PCIe-switch NTB Linux driver
378c2ecf20Sopenharmony_ci *
388c2ecf20Sopenharmony_ci * Contact Information:
398c2ecf20Sopenharmony_ci * Serge Semin <fancer.lancer@gmail.com>, <Sergey.Semin@t-platforms.ru>
408c2ecf20Sopenharmony_ci */
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci#ifndef NTB_HW_IDT_H
438c2ecf20Sopenharmony_ci#define NTB_HW_IDT_H
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci#include <linux/types.h>
468c2ecf20Sopenharmony_ci#include <linux/pci.h>
478c2ecf20Sopenharmony_ci#include <linux/pci_ids.h>
488c2ecf20Sopenharmony_ci#include <linux/interrupt.h>
498c2ecf20Sopenharmony_ci#include <linux/spinlock.h>
508c2ecf20Sopenharmony_ci#include <linux/mutex.h>
518c2ecf20Sopenharmony_ci#include <linux/ntb.h>
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci/*
548c2ecf20Sopenharmony_ci * Macro is used to create the struct pci_device_id that matches
558c2ecf20Sopenharmony_ci * the supported IDT PCIe-switches
568c2ecf20Sopenharmony_ci * @devname: Capitalized name of the particular device
578c2ecf20Sopenharmony_ci * @data: Variable passed to the driver of the particular device
588c2ecf20Sopenharmony_ci */
598c2ecf20Sopenharmony_ci#define IDT_PCI_DEVICE_IDS(devname, data) \
608c2ecf20Sopenharmony_ci	.vendor = PCI_VENDOR_ID_IDT, .device = PCI_DEVICE_ID_IDT_##devname, \
618c2ecf20Sopenharmony_ci	.subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, \
628c2ecf20Sopenharmony_ci	.class = (PCI_CLASS_BRIDGE_OTHER << 8), .class_mask = (0xFFFF00), \
638c2ecf20Sopenharmony_ci	.driver_data = (kernel_ulong_t)&data
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci/*
668c2ecf20Sopenharmony_ci * IDT PCIe-switches device IDs
678c2ecf20Sopenharmony_ci */
688c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_IDT_89HPES24NT6AG2  0x8091
698c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_IDT_89HPES32NT8AG2  0x808F
708c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_IDT_89HPES32NT8BG2  0x8088
718c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_IDT_89HPES12NT12G2  0x8092
728c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_IDT_89HPES16NT16G2  0x8090
738c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_IDT_89HPES24NT24G2  0x808E
748c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_IDT_89HPES32NT24AG2 0x808C
758c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_IDT_89HPES32NT24BG2 0x808A
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci/*
788c2ecf20Sopenharmony_ci * NT-function Configuration Space registers
798c2ecf20Sopenharmony_ci * NOTE 1) The IDT PCIe-switch internal data is little-endian
808c2ecf20Sopenharmony_ci *      so it must be taken into account in the driver
818c2ecf20Sopenharmony_ci *      internals.
828c2ecf20Sopenharmony_ci *      2) Additionally the registers should be accessed either
838c2ecf20Sopenharmony_ci *      with byte-enables corresponding to their native size or
848c2ecf20Sopenharmony_ci *      the size of one DWORD
858c2ecf20Sopenharmony_ci *
868c2ecf20Sopenharmony_ci * So to simplify the driver code, there is only DWORD-sized read/write
878c2ecf20Sopenharmony_ci * operations utilized.
888c2ecf20Sopenharmony_ci */
898c2ecf20Sopenharmony_ci/* PCI Express Configuration Space */
908c2ecf20Sopenharmony_ci/* PCI Express command/status register	(DWORD) */
918c2ecf20Sopenharmony_ci#define IDT_NT_PCICMDSTS		0x00004U
928c2ecf20Sopenharmony_ci/* PCI Express Device Capabilities	(DWORD) */
938c2ecf20Sopenharmony_ci#define IDT_NT_PCIEDCAP			0x00044U
948c2ecf20Sopenharmony_ci/* PCI Express Device Control/Status	(WORD+WORD) */
958c2ecf20Sopenharmony_ci#define IDT_NT_PCIEDCTLSTS		0x00048U
968c2ecf20Sopenharmony_ci/* PCI Express Link Capabilities	(DWORD) */
978c2ecf20Sopenharmony_ci#define IDT_NT_PCIELCAP			0x0004CU
988c2ecf20Sopenharmony_ci/* PCI Express Link Control/Status	(WORD+WORD) */
998c2ecf20Sopenharmony_ci#define IDT_NT_PCIELCTLSTS		0x00050U
1008c2ecf20Sopenharmony_ci/* PCI Express Device Capabilities 2	(DWORD) */
1018c2ecf20Sopenharmony_ci#define IDT_NT_PCIEDCAP2		0x00064U
1028c2ecf20Sopenharmony_ci/* PCI Express Device Control 2		(WORD+WORD) */
1038c2ecf20Sopenharmony_ci#define IDT_NT_PCIEDCTL2		0x00068U
1048c2ecf20Sopenharmony_ci/* PCI Power Management Control and Status (DWORD) */
1058c2ecf20Sopenharmony_ci#define IDT_NT_PMCSR			0x000C4U
1068c2ecf20Sopenharmony_ci/*==========================================*/
1078c2ecf20Sopenharmony_ci/* IDT Proprietary NT-port-specific registers */
1088c2ecf20Sopenharmony_ci/* NT-function main control registers */
1098c2ecf20Sopenharmony_ci/* NT Endpoint Control			(DWORD) */
1108c2ecf20Sopenharmony_ci#define IDT_NT_NTCTL			0x00400U
1118c2ecf20Sopenharmony_ci/* NT Endpoint Interrupt Status/Mask	(DWORD) */
1128c2ecf20Sopenharmony_ci#define IDT_NT_NTINTSTS			0x00404U
1138c2ecf20Sopenharmony_ci#define IDT_NT_NTINTMSK			0x00408U
1148c2ecf20Sopenharmony_ci/* NT Endpoint Signal Data		(DWORD) */
1158c2ecf20Sopenharmony_ci#define IDT_NT_NTSDATA			0x0040CU
1168c2ecf20Sopenharmony_ci/* NT Endpoint Global Signal		(DWORD) */
1178c2ecf20Sopenharmony_ci#define IDT_NT_NTGSIGNAL		0x00410U
1188c2ecf20Sopenharmony_ci/* Internal Error Reporting Mask 0/1	(DWORD) */
1198c2ecf20Sopenharmony_ci#define IDT_NT_NTIERRORMSK0		0x00414U
1208c2ecf20Sopenharmony_ci#define IDT_NT_NTIERRORMSK1		0x00418U
1218c2ecf20Sopenharmony_ci/* Doorbel registers */
1228c2ecf20Sopenharmony_ci/* NT Outbound Doorbell Set		(DWORD) */
1238c2ecf20Sopenharmony_ci#define IDT_NT_OUTDBELLSET		0x00420U
1248c2ecf20Sopenharmony_ci/* NT Inbound Doorbell Status/Mask	(DWORD) */
1258c2ecf20Sopenharmony_ci#define IDT_NT_INDBELLSTS		0x00428U
1268c2ecf20Sopenharmony_ci#define IDT_NT_INDBELLMSK		0x0042CU
1278c2ecf20Sopenharmony_ci/* Message registers */
1288c2ecf20Sopenharmony_ci/* Outbound Message N			(DWORD) */
1298c2ecf20Sopenharmony_ci#define IDT_NT_OUTMSG0			0x00430U
1308c2ecf20Sopenharmony_ci#define IDT_NT_OUTMSG1			0x00434U
1318c2ecf20Sopenharmony_ci#define IDT_NT_OUTMSG2			0x00438U
1328c2ecf20Sopenharmony_ci#define IDT_NT_OUTMSG3			0x0043CU
1338c2ecf20Sopenharmony_ci/* Inbound Message N			(DWORD) */
1348c2ecf20Sopenharmony_ci#define IDT_NT_INMSG0			0x00440U
1358c2ecf20Sopenharmony_ci#define IDT_NT_INMSG1			0x00444U
1368c2ecf20Sopenharmony_ci#define IDT_NT_INMSG2			0x00448U
1378c2ecf20Sopenharmony_ci#define IDT_NT_INMSG3			0x0044CU
1388c2ecf20Sopenharmony_ci/* Inbound Message Source N		(DWORD) */
1398c2ecf20Sopenharmony_ci#define IDT_NT_INMSGSRC0		0x00450U
1408c2ecf20Sopenharmony_ci#define IDT_NT_INMSGSRC1		0x00454U
1418c2ecf20Sopenharmony_ci#define IDT_NT_INMSGSRC2		0x00458U
1428c2ecf20Sopenharmony_ci#define IDT_NT_INMSGSRC3		0x0045CU
1438c2ecf20Sopenharmony_ci/* Message Status			(DWORD) */
1448c2ecf20Sopenharmony_ci#define IDT_NT_MSGSTS			0x00460U
1458c2ecf20Sopenharmony_ci/* Message Status Mask			(DWORD) */
1468c2ecf20Sopenharmony_ci#define IDT_NT_MSGSTSMSK		0x00464U
1478c2ecf20Sopenharmony_ci/* BAR-setup registers */
1488c2ecf20Sopenharmony_ci/* BAR N Setup/Limit Address/Lower and Upper Translated Base Address (DWORD) */
1498c2ecf20Sopenharmony_ci#define IDT_NT_BARSETUP0		0x00470U
1508c2ecf20Sopenharmony_ci#define IDT_NT_BARLIMIT0		0x00474U
1518c2ecf20Sopenharmony_ci#define IDT_NT_BARLTBASE0		0x00478U
1528c2ecf20Sopenharmony_ci#define IDT_NT_BARUTBASE0		0x0047CU
1538c2ecf20Sopenharmony_ci#define IDT_NT_BARSETUP1		0x00480U
1548c2ecf20Sopenharmony_ci#define IDT_NT_BARLIMIT1		0x00484U
1558c2ecf20Sopenharmony_ci#define IDT_NT_BARLTBASE1		0x00488U
1568c2ecf20Sopenharmony_ci#define IDT_NT_BARUTBASE1		0x0048CU
1578c2ecf20Sopenharmony_ci#define IDT_NT_BARSETUP2		0x00490U
1588c2ecf20Sopenharmony_ci#define IDT_NT_BARLIMIT2		0x00494U
1598c2ecf20Sopenharmony_ci#define IDT_NT_BARLTBASE2		0x00498U
1608c2ecf20Sopenharmony_ci#define IDT_NT_BARUTBASE2		0x0049CU
1618c2ecf20Sopenharmony_ci#define IDT_NT_BARSETUP3		0x004A0U
1628c2ecf20Sopenharmony_ci#define IDT_NT_BARLIMIT3		0x004A4U
1638c2ecf20Sopenharmony_ci#define IDT_NT_BARLTBASE3		0x004A8U
1648c2ecf20Sopenharmony_ci#define IDT_NT_BARUTBASE3		0x004ACU
1658c2ecf20Sopenharmony_ci#define IDT_NT_BARSETUP4		0x004B0U
1668c2ecf20Sopenharmony_ci#define IDT_NT_BARLIMIT4		0x004B4U
1678c2ecf20Sopenharmony_ci#define IDT_NT_BARLTBASE4		0x004B8U
1688c2ecf20Sopenharmony_ci#define IDT_NT_BARUTBASE4		0x004BCU
1698c2ecf20Sopenharmony_ci#define IDT_NT_BARSETUP5		0x004C0U
1708c2ecf20Sopenharmony_ci#define IDT_NT_BARLIMIT5		0x004C4U
1718c2ecf20Sopenharmony_ci#define IDT_NT_BARLTBASE5		0x004C8U
1728c2ecf20Sopenharmony_ci#define IDT_NT_BARUTBASE5		0x004CCU
1738c2ecf20Sopenharmony_ci/* NT mapping table registers */
1748c2ecf20Sopenharmony_ci/* NT Mapping Table Address/Status/Data	(DWORD) */
1758c2ecf20Sopenharmony_ci#define IDT_NT_NTMTBLADDR		0x004D0U
1768c2ecf20Sopenharmony_ci#define IDT_NT_NTMTBLSTS		0x004D4U
1778c2ecf20Sopenharmony_ci#define IDT_NT_NTMTBLDATA		0x004D8U
1788c2ecf20Sopenharmony_ci/* Requester ID (Bus:Device:Function) Capture	(DWORD) */
1798c2ecf20Sopenharmony_ci#define IDT_NT_REQIDCAP			0x004DCU
1808c2ecf20Sopenharmony_ci/* Memory Windows Lookup table registers */
1818c2ecf20Sopenharmony_ci/* Lookup Table Offset/Lower, Middle and Upper data	(DWORD) */
1828c2ecf20Sopenharmony_ci#define IDT_NT_LUTOFFSET		0x004E0U
1838c2ecf20Sopenharmony_ci#define IDT_NT_LUTLDATA			0x004E4U
1848c2ecf20Sopenharmony_ci#define IDT_NT_LUTMDATA			0x004E8U
1858c2ecf20Sopenharmony_ci#define IDT_NT_LUTUDATA			0x004ECU
1868c2ecf20Sopenharmony_ci/* NT Endpoint Uncorrectable/Correctable Errors Emulation registers (DWORD) */
1878c2ecf20Sopenharmony_ci#define IDT_NT_NTUEEM			0x004F0U
1888c2ecf20Sopenharmony_ci#define IDT_NT_NTCEEM			0x004F4U
1898c2ecf20Sopenharmony_ci/* Global Address Space Access/Data registers	(DWARD) */
1908c2ecf20Sopenharmony_ci#define IDT_NT_GASAADDR			0x00FF8U
1918c2ecf20Sopenharmony_ci#define IDT_NT_GASADATA			0x00FFCU
1928c2ecf20Sopenharmony_ci
1938c2ecf20Sopenharmony_ci/*
1948c2ecf20Sopenharmony_ci * IDT PCIe-switch Global Configuration and Status registers
1958c2ecf20Sopenharmony_ci */
1968c2ecf20Sopenharmony_ci/* Port N Configuration register in global space */
1978c2ecf20Sopenharmony_ci/* PCI Express command/status and link control/status registers (WORD+WORD) */
1988c2ecf20Sopenharmony_ci#define IDT_SW_NTP0_PCIECMDSTS		0x01004U
1998c2ecf20Sopenharmony_ci#define IDT_SW_NTP0_PCIELCTLSTS		0x01050U
2008c2ecf20Sopenharmony_ci/* NT-function control register		(DWORD) */
2018c2ecf20Sopenharmony_ci#define IDT_SW_NTP0_NTCTL		0x01400U
2028c2ecf20Sopenharmony_ci/* BAR setup/limit/base address registers (DWORD) */
2038c2ecf20Sopenharmony_ci#define IDT_SW_NTP0_BARSETUP0		0x01470U
2048c2ecf20Sopenharmony_ci#define IDT_SW_NTP0_BARLIMIT0		0x01474U
2058c2ecf20Sopenharmony_ci#define IDT_SW_NTP0_BARLTBASE0		0x01478U
2068c2ecf20Sopenharmony_ci#define IDT_SW_NTP0_BARUTBASE0		0x0147CU
2078c2ecf20Sopenharmony_ci#define IDT_SW_NTP0_BARSETUP1		0x01480U
2088c2ecf20Sopenharmony_ci#define IDT_SW_NTP0_BARLIMIT1		0x01484U
2098c2ecf20Sopenharmony_ci#define IDT_SW_NTP0_BARLTBASE1		0x01488U
2108c2ecf20Sopenharmony_ci#define IDT_SW_NTP0_BARUTBASE1		0x0148CU
2118c2ecf20Sopenharmony_ci#define IDT_SW_NTP0_BARSETUP2		0x01490U
2128c2ecf20Sopenharmony_ci#define IDT_SW_NTP0_BARLIMIT2		0x01494U
2138c2ecf20Sopenharmony_ci#define IDT_SW_NTP0_BARLTBASE2		0x01498U
2148c2ecf20Sopenharmony_ci#define IDT_SW_NTP0_BARUTBASE2		0x0149CU
2158c2ecf20Sopenharmony_ci#define IDT_SW_NTP0_BARSETUP3		0x014A0U
2168c2ecf20Sopenharmony_ci#define IDT_SW_NTP0_BARLIMIT3		0x014A4U
2178c2ecf20Sopenharmony_ci#define IDT_SW_NTP0_BARLTBASE3		0x014A8U
2188c2ecf20Sopenharmony_ci#define IDT_SW_NTP0_BARUTBASE3		0x014ACU
2198c2ecf20Sopenharmony_ci#define IDT_SW_NTP0_BARSETUP4		0x014B0U
2208c2ecf20Sopenharmony_ci#define IDT_SW_NTP0_BARLIMIT4		0x014B4U
2218c2ecf20Sopenharmony_ci#define IDT_SW_NTP0_BARLTBASE4		0x014B8U
2228c2ecf20Sopenharmony_ci#define IDT_SW_NTP0_BARUTBASE4		0x014BCU
2238c2ecf20Sopenharmony_ci#define IDT_SW_NTP0_BARSETUP5		0x014C0U
2248c2ecf20Sopenharmony_ci#define IDT_SW_NTP0_BARLIMIT5		0x014C4U
2258c2ecf20Sopenharmony_ci#define IDT_SW_NTP0_BARLTBASE5		0x014C8U
2268c2ecf20Sopenharmony_ci#define IDT_SW_NTP0_BARUTBASE5		0x014CCU
2278c2ecf20Sopenharmony_ci/* PCI Express command/status and link control/status registers (WORD+WORD) */
2288c2ecf20Sopenharmony_ci#define IDT_SW_NTP2_PCIECMDSTS		0x05004U
2298c2ecf20Sopenharmony_ci#define IDT_SW_NTP2_PCIELCTLSTS		0x05050U
2308c2ecf20Sopenharmony_ci/* NT-function control register		(DWORD) */
2318c2ecf20Sopenharmony_ci#define IDT_SW_NTP2_NTCTL		0x05400U
2328c2ecf20Sopenharmony_ci/* BAR setup/limit/base address registers (DWORD) */
2338c2ecf20Sopenharmony_ci#define IDT_SW_NTP2_BARSETUP0		0x05470U
2348c2ecf20Sopenharmony_ci#define IDT_SW_NTP2_BARLIMIT0		0x05474U
2358c2ecf20Sopenharmony_ci#define IDT_SW_NTP2_BARLTBASE0		0x05478U
2368c2ecf20Sopenharmony_ci#define IDT_SW_NTP2_BARUTBASE0		0x0547CU
2378c2ecf20Sopenharmony_ci#define IDT_SW_NTP2_BARSETUP1		0x05480U
2388c2ecf20Sopenharmony_ci#define IDT_SW_NTP2_BARLIMIT1		0x05484U
2398c2ecf20Sopenharmony_ci#define IDT_SW_NTP2_BARLTBASE1		0x05488U
2408c2ecf20Sopenharmony_ci#define IDT_SW_NTP2_BARUTBASE1		0x0548CU
2418c2ecf20Sopenharmony_ci#define IDT_SW_NTP2_BARSETUP2		0x05490U
2428c2ecf20Sopenharmony_ci#define IDT_SW_NTP2_BARLIMIT2		0x05494U
2438c2ecf20Sopenharmony_ci#define IDT_SW_NTP2_BARLTBASE2		0x05498U
2448c2ecf20Sopenharmony_ci#define IDT_SW_NTP2_BARUTBASE2		0x0549CU
2458c2ecf20Sopenharmony_ci#define IDT_SW_NTP2_BARSETUP3		0x054A0U
2468c2ecf20Sopenharmony_ci#define IDT_SW_NTP2_BARLIMIT3		0x054A4U
2478c2ecf20Sopenharmony_ci#define IDT_SW_NTP2_BARLTBASE3		0x054A8U
2488c2ecf20Sopenharmony_ci#define IDT_SW_NTP2_BARUTBASE3		0x054ACU
2498c2ecf20Sopenharmony_ci#define IDT_SW_NTP2_BARSETUP4		0x054B0U
2508c2ecf20Sopenharmony_ci#define IDT_SW_NTP2_BARLIMIT4		0x054B4U
2518c2ecf20Sopenharmony_ci#define IDT_SW_NTP2_BARLTBASE4		0x054B8U
2528c2ecf20Sopenharmony_ci#define IDT_SW_NTP2_BARUTBASE4		0x054BCU
2538c2ecf20Sopenharmony_ci#define IDT_SW_NTP2_BARSETUP5		0x054C0U
2548c2ecf20Sopenharmony_ci#define IDT_SW_NTP2_BARLIMIT5		0x054C4U
2558c2ecf20Sopenharmony_ci#define IDT_SW_NTP2_BARLTBASE5		0x054C8U
2568c2ecf20Sopenharmony_ci#define IDT_SW_NTP2_BARUTBASE5		0x054CCU
2578c2ecf20Sopenharmony_ci/* PCI Express command/status and link control/status registers (WORD+WORD) */
2588c2ecf20Sopenharmony_ci#define IDT_SW_NTP4_PCIECMDSTS		0x09004U
2598c2ecf20Sopenharmony_ci#define IDT_SW_NTP4_PCIELCTLSTS		0x09050U
2608c2ecf20Sopenharmony_ci/* NT-function control register		(DWORD) */
2618c2ecf20Sopenharmony_ci#define IDT_SW_NTP4_NTCTL		0x09400U
2628c2ecf20Sopenharmony_ci/* BAR setup/limit/base address registers (DWORD) */
2638c2ecf20Sopenharmony_ci#define IDT_SW_NTP4_BARSETUP0		0x09470U
2648c2ecf20Sopenharmony_ci#define IDT_SW_NTP4_BARLIMIT0		0x09474U
2658c2ecf20Sopenharmony_ci#define IDT_SW_NTP4_BARLTBASE0		0x09478U
2668c2ecf20Sopenharmony_ci#define IDT_SW_NTP4_BARUTBASE0		0x0947CU
2678c2ecf20Sopenharmony_ci#define IDT_SW_NTP4_BARSETUP1		0x09480U
2688c2ecf20Sopenharmony_ci#define IDT_SW_NTP4_BARLIMIT1		0x09484U
2698c2ecf20Sopenharmony_ci#define IDT_SW_NTP4_BARLTBASE1		0x09488U
2708c2ecf20Sopenharmony_ci#define IDT_SW_NTP4_BARUTBASE1		0x0948CU
2718c2ecf20Sopenharmony_ci#define IDT_SW_NTP4_BARSETUP2		0x09490U
2728c2ecf20Sopenharmony_ci#define IDT_SW_NTP4_BARLIMIT2		0x09494U
2738c2ecf20Sopenharmony_ci#define IDT_SW_NTP4_BARLTBASE2		0x09498U
2748c2ecf20Sopenharmony_ci#define IDT_SW_NTP4_BARUTBASE2		0x0949CU
2758c2ecf20Sopenharmony_ci#define IDT_SW_NTP4_BARSETUP3		0x094A0U
2768c2ecf20Sopenharmony_ci#define IDT_SW_NTP4_BARLIMIT3		0x094A4U
2778c2ecf20Sopenharmony_ci#define IDT_SW_NTP4_BARLTBASE3		0x094A8U
2788c2ecf20Sopenharmony_ci#define IDT_SW_NTP4_BARUTBASE3		0x094ACU
2798c2ecf20Sopenharmony_ci#define IDT_SW_NTP4_BARSETUP4		0x094B0U
2808c2ecf20Sopenharmony_ci#define IDT_SW_NTP4_BARLIMIT4		0x094B4U
2818c2ecf20Sopenharmony_ci#define IDT_SW_NTP4_BARLTBASE4		0x094B8U
2828c2ecf20Sopenharmony_ci#define IDT_SW_NTP4_BARUTBASE4		0x094BCU
2838c2ecf20Sopenharmony_ci#define IDT_SW_NTP4_BARSETUP5		0x094C0U
2848c2ecf20Sopenharmony_ci#define IDT_SW_NTP4_BARLIMIT5		0x094C4U
2858c2ecf20Sopenharmony_ci#define IDT_SW_NTP4_BARLTBASE5		0x094C8U
2868c2ecf20Sopenharmony_ci#define IDT_SW_NTP4_BARUTBASE5		0x094CCU
2878c2ecf20Sopenharmony_ci/* PCI Express command/status and link control/status registers (WORD+WORD) */
2888c2ecf20Sopenharmony_ci#define IDT_SW_NTP6_PCIECMDSTS		0x0D004U
2898c2ecf20Sopenharmony_ci#define IDT_SW_NTP6_PCIELCTLSTS		0x0D050U
2908c2ecf20Sopenharmony_ci/* NT-function control register		(DWORD) */
2918c2ecf20Sopenharmony_ci#define IDT_SW_NTP6_NTCTL		0x0D400U
2928c2ecf20Sopenharmony_ci/* BAR setup/limit/base address registers (DWORD) */
2938c2ecf20Sopenharmony_ci#define IDT_SW_NTP6_BARSETUP0		0x0D470U
2948c2ecf20Sopenharmony_ci#define IDT_SW_NTP6_BARLIMIT0		0x0D474U
2958c2ecf20Sopenharmony_ci#define IDT_SW_NTP6_BARLTBASE0		0x0D478U
2968c2ecf20Sopenharmony_ci#define IDT_SW_NTP6_BARUTBASE0		0x0D47CU
2978c2ecf20Sopenharmony_ci#define IDT_SW_NTP6_BARSETUP1		0x0D480U
2988c2ecf20Sopenharmony_ci#define IDT_SW_NTP6_BARLIMIT1		0x0D484U
2998c2ecf20Sopenharmony_ci#define IDT_SW_NTP6_BARLTBASE1		0x0D488U
3008c2ecf20Sopenharmony_ci#define IDT_SW_NTP6_BARUTBASE1		0x0D48CU
3018c2ecf20Sopenharmony_ci#define IDT_SW_NTP6_BARSETUP2		0x0D490U
3028c2ecf20Sopenharmony_ci#define IDT_SW_NTP6_BARLIMIT2		0x0D494U
3038c2ecf20Sopenharmony_ci#define IDT_SW_NTP6_BARLTBASE2		0x0D498U
3048c2ecf20Sopenharmony_ci#define IDT_SW_NTP6_BARUTBASE2		0x0D49CU
3058c2ecf20Sopenharmony_ci#define IDT_SW_NTP6_BARSETUP3		0x0D4A0U
3068c2ecf20Sopenharmony_ci#define IDT_SW_NTP6_BARLIMIT3		0x0D4A4U
3078c2ecf20Sopenharmony_ci#define IDT_SW_NTP6_BARLTBASE3		0x0D4A8U
3088c2ecf20Sopenharmony_ci#define IDT_SW_NTP6_BARUTBASE3		0x0D4ACU
3098c2ecf20Sopenharmony_ci#define IDT_SW_NTP6_BARSETUP4		0x0D4B0U
3108c2ecf20Sopenharmony_ci#define IDT_SW_NTP6_BARLIMIT4		0x0D4B4U
3118c2ecf20Sopenharmony_ci#define IDT_SW_NTP6_BARLTBASE4		0x0D4B8U
3128c2ecf20Sopenharmony_ci#define IDT_SW_NTP6_BARUTBASE4		0x0D4BCU
3138c2ecf20Sopenharmony_ci#define IDT_SW_NTP6_BARSETUP5		0x0D4C0U
3148c2ecf20Sopenharmony_ci#define IDT_SW_NTP6_BARLIMIT5		0x0D4C4U
3158c2ecf20Sopenharmony_ci#define IDT_SW_NTP6_BARLTBASE5		0x0D4C8U
3168c2ecf20Sopenharmony_ci#define IDT_SW_NTP6_BARUTBASE5		0x0D4CCU
3178c2ecf20Sopenharmony_ci/* PCI Express command/status and link control/status registers (WORD+WORD) */
3188c2ecf20Sopenharmony_ci#define IDT_SW_NTP8_PCIECMDSTS		0x11004U
3198c2ecf20Sopenharmony_ci#define IDT_SW_NTP8_PCIELCTLSTS		0x11050U
3208c2ecf20Sopenharmony_ci/* NT-function control register		(DWORD) */
3218c2ecf20Sopenharmony_ci#define IDT_SW_NTP8_NTCTL		0x11400U
3228c2ecf20Sopenharmony_ci/* BAR setup/limit/base address registers (DWORD) */
3238c2ecf20Sopenharmony_ci#define IDT_SW_NTP8_BARSETUP0		0x11470U
3248c2ecf20Sopenharmony_ci#define IDT_SW_NTP8_BARLIMIT0		0x11474U
3258c2ecf20Sopenharmony_ci#define IDT_SW_NTP8_BARLTBASE0		0x11478U
3268c2ecf20Sopenharmony_ci#define IDT_SW_NTP8_BARUTBASE0		0x1147CU
3278c2ecf20Sopenharmony_ci#define IDT_SW_NTP8_BARSETUP1		0x11480U
3288c2ecf20Sopenharmony_ci#define IDT_SW_NTP8_BARLIMIT1		0x11484U
3298c2ecf20Sopenharmony_ci#define IDT_SW_NTP8_BARLTBASE1		0x11488U
3308c2ecf20Sopenharmony_ci#define IDT_SW_NTP8_BARUTBASE1		0x1148CU
3318c2ecf20Sopenharmony_ci#define IDT_SW_NTP8_BARSETUP2		0x11490U
3328c2ecf20Sopenharmony_ci#define IDT_SW_NTP8_BARLIMIT2		0x11494U
3338c2ecf20Sopenharmony_ci#define IDT_SW_NTP8_BARLTBASE2		0x11498U
3348c2ecf20Sopenharmony_ci#define IDT_SW_NTP8_BARUTBASE2		0x1149CU
3358c2ecf20Sopenharmony_ci#define IDT_SW_NTP8_BARSETUP3		0x114A0U
3368c2ecf20Sopenharmony_ci#define IDT_SW_NTP8_BARLIMIT3		0x114A4U
3378c2ecf20Sopenharmony_ci#define IDT_SW_NTP8_BARLTBASE3		0x114A8U
3388c2ecf20Sopenharmony_ci#define IDT_SW_NTP8_BARUTBASE3		0x114ACU
3398c2ecf20Sopenharmony_ci#define IDT_SW_NTP8_BARSETUP4		0x114B0U
3408c2ecf20Sopenharmony_ci#define IDT_SW_NTP8_BARLIMIT4		0x114B4U
3418c2ecf20Sopenharmony_ci#define IDT_SW_NTP8_BARLTBASE4		0x114B8U
3428c2ecf20Sopenharmony_ci#define IDT_SW_NTP8_BARUTBASE4		0x114BCU
3438c2ecf20Sopenharmony_ci#define IDT_SW_NTP8_BARSETUP5		0x114C0U
3448c2ecf20Sopenharmony_ci#define IDT_SW_NTP8_BARLIMIT5		0x114C4U
3458c2ecf20Sopenharmony_ci#define IDT_SW_NTP8_BARLTBASE5		0x114C8U
3468c2ecf20Sopenharmony_ci#define IDT_SW_NTP8_BARUTBASE5		0x114CCU
3478c2ecf20Sopenharmony_ci/* PCI Express command/status and link control/status registers (WORD+WORD) */
3488c2ecf20Sopenharmony_ci#define IDT_SW_NTP12_PCIECMDSTS		0x19004U
3498c2ecf20Sopenharmony_ci#define IDT_SW_NTP12_PCIELCTLSTS	0x19050U
3508c2ecf20Sopenharmony_ci/* NT-function control register		(DWORD) */
3518c2ecf20Sopenharmony_ci#define IDT_SW_NTP12_NTCTL		0x19400U
3528c2ecf20Sopenharmony_ci/* BAR setup/limit/base address registers (DWORD) */
3538c2ecf20Sopenharmony_ci#define IDT_SW_NTP12_BARSETUP0		0x19470U
3548c2ecf20Sopenharmony_ci#define IDT_SW_NTP12_BARLIMIT0		0x19474U
3558c2ecf20Sopenharmony_ci#define IDT_SW_NTP12_BARLTBASE0		0x19478U
3568c2ecf20Sopenharmony_ci#define IDT_SW_NTP12_BARUTBASE0		0x1947CU
3578c2ecf20Sopenharmony_ci#define IDT_SW_NTP12_BARSETUP1		0x19480U
3588c2ecf20Sopenharmony_ci#define IDT_SW_NTP12_BARLIMIT1		0x19484U
3598c2ecf20Sopenharmony_ci#define IDT_SW_NTP12_BARLTBASE1		0x19488U
3608c2ecf20Sopenharmony_ci#define IDT_SW_NTP12_BARUTBASE1		0x1948CU
3618c2ecf20Sopenharmony_ci#define IDT_SW_NTP12_BARSETUP2		0x19490U
3628c2ecf20Sopenharmony_ci#define IDT_SW_NTP12_BARLIMIT2		0x19494U
3638c2ecf20Sopenharmony_ci#define IDT_SW_NTP12_BARLTBASE2		0x19498U
3648c2ecf20Sopenharmony_ci#define IDT_SW_NTP12_BARUTBASE2		0x1949CU
3658c2ecf20Sopenharmony_ci#define IDT_SW_NTP12_BARSETUP3		0x194A0U
3668c2ecf20Sopenharmony_ci#define IDT_SW_NTP12_BARLIMIT3		0x194A4U
3678c2ecf20Sopenharmony_ci#define IDT_SW_NTP12_BARLTBASE3		0x194A8U
3688c2ecf20Sopenharmony_ci#define IDT_SW_NTP12_BARUTBASE3		0x194ACU
3698c2ecf20Sopenharmony_ci#define IDT_SW_NTP12_BARSETUP4		0x194B0U
3708c2ecf20Sopenharmony_ci#define IDT_SW_NTP12_BARLIMIT4		0x194B4U
3718c2ecf20Sopenharmony_ci#define IDT_SW_NTP12_BARLTBASE4		0x194B8U
3728c2ecf20Sopenharmony_ci#define IDT_SW_NTP12_BARUTBASE4		0x194BCU
3738c2ecf20Sopenharmony_ci#define IDT_SW_NTP12_BARSETUP5		0x194C0U
3748c2ecf20Sopenharmony_ci#define IDT_SW_NTP12_BARLIMIT5		0x194C4U
3758c2ecf20Sopenharmony_ci#define IDT_SW_NTP12_BARLTBASE5		0x194C8U
3768c2ecf20Sopenharmony_ci#define IDT_SW_NTP12_BARUTBASE5		0x194CCU
3778c2ecf20Sopenharmony_ci/* PCI Express command/status and link control/status registers (WORD+WORD) */
3788c2ecf20Sopenharmony_ci#define IDT_SW_NTP16_PCIECMDSTS		0x21004U
3798c2ecf20Sopenharmony_ci#define IDT_SW_NTP16_PCIELCTLSTS	0x21050U
3808c2ecf20Sopenharmony_ci/* NT-function control register		(DWORD) */
3818c2ecf20Sopenharmony_ci#define IDT_SW_NTP16_NTCTL		0x21400U
3828c2ecf20Sopenharmony_ci/* BAR setup/limit/base address registers (DWORD) */
3838c2ecf20Sopenharmony_ci#define IDT_SW_NTP16_BARSETUP0		0x21470U
3848c2ecf20Sopenharmony_ci#define IDT_SW_NTP16_BARLIMIT0		0x21474U
3858c2ecf20Sopenharmony_ci#define IDT_SW_NTP16_BARLTBASE0		0x21478U
3868c2ecf20Sopenharmony_ci#define IDT_SW_NTP16_BARUTBASE0		0x2147CU
3878c2ecf20Sopenharmony_ci#define IDT_SW_NTP16_BARSETUP1		0x21480U
3888c2ecf20Sopenharmony_ci#define IDT_SW_NTP16_BARLIMIT1		0x21484U
3898c2ecf20Sopenharmony_ci#define IDT_SW_NTP16_BARLTBASE1		0x21488U
3908c2ecf20Sopenharmony_ci#define IDT_SW_NTP16_BARUTBASE1		0x2148CU
3918c2ecf20Sopenharmony_ci#define IDT_SW_NTP16_BARSETUP2		0x21490U
3928c2ecf20Sopenharmony_ci#define IDT_SW_NTP16_BARLIMIT2		0x21494U
3938c2ecf20Sopenharmony_ci#define IDT_SW_NTP16_BARLTBASE2		0x21498U
3948c2ecf20Sopenharmony_ci#define IDT_SW_NTP16_BARUTBASE2		0x2149CU
3958c2ecf20Sopenharmony_ci#define IDT_SW_NTP16_BARSETUP3		0x214A0U
3968c2ecf20Sopenharmony_ci#define IDT_SW_NTP16_BARLIMIT3		0x214A4U
3978c2ecf20Sopenharmony_ci#define IDT_SW_NTP16_BARLTBASE3		0x214A8U
3988c2ecf20Sopenharmony_ci#define IDT_SW_NTP16_BARUTBASE3		0x214ACU
3998c2ecf20Sopenharmony_ci#define IDT_SW_NTP16_BARSETUP4		0x214B0U
4008c2ecf20Sopenharmony_ci#define IDT_SW_NTP16_BARLIMIT4		0x214B4U
4018c2ecf20Sopenharmony_ci#define IDT_SW_NTP16_BARLTBASE4		0x214B8U
4028c2ecf20Sopenharmony_ci#define IDT_SW_NTP16_BARUTBASE4		0x214BCU
4038c2ecf20Sopenharmony_ci#define IDT_SW_NTP16_BARSETUP5		0x214C0U
4048c2ecf20Sopenharmony_ci#define IDT_SW_NTP16_BARLIMIT5		0x214C4U
4058c2ecf20Sopenharmony_ci#define IDT_SW_NTP16_BARLTBASE5		0x214C8U
4068c2ecf20Sopenharmony_ci#define IDT_SW_NTP16_BARUTBASE5		0x214CCU
4078c2ecf20Sopenharmony_ci/* PCI Express command/status and link control/status registers (WORD+WORD) */
4088c2ecf20Sopenharmony_ci#define IDT_SW_NTP20_PCIECMDSTS		0x29004U
4098c2ecf20Sopenharmony_ci#define IDT_SW_NTP20_PCIELCTLSTS	0x29050U
4108c2ecf20Sopenharmony_ci/* NT-function control register		(DWORD) */
4118c2ecf20Sopenharmony_ci#define IDT_SW_NTP20_NTCTL		0x29400U
4128c2ecf20Sopenharmony_ci/* BAR setup/limit/base address registers (DWORD) */
4138c2ecf20Sopenharmony_ci#define IDT_SW_NTP20_BARSETUP0		0x29470U
4148c2ecf20Sopenharmony_ci#define IDT_SW_NTP20_BARLIMIT0		0x29474U
4158c2ecf20Sopenharmony_ci#define IDT_SW_NTP20_BARLTBASE0		0x29478U
4168c2ecf20Sopenharmony_ci#define IDT_SW_NTP20_BARUTBASE0		0x2947CU
4178c2ecf20Sopenharmony_ci#define IDT_SW_NTP20_BARSETUP1		0x29480U
4188c2ecf20Sopenharmony_ci#define IDT_SW_NTP20_BARLIMIT1		0x29484U
4198c2ecf20Sopenharmony_ci#define IDT_SW_NTP20_BARLTBASE1		0x29488U
4208c2ecf20Sopenharmony_ci#define IDT_SW_NTP20_BARUTBASE1		0x2948CU
4218c2ecf20Sopenharmony_ci#define IDT_SW_NTP20_BARSETUP2		0x29490U
4228c2ecf20Sopenharmony_ci#define IDT_SW_NTP20_BARLIMIT2		0x29494U
4238c2ecf20Sopenharmony_ci#define IDT_SW_NTP20_BARLTBASE2		0x29498U
4248c2ecf20Sopenharmony_ci#define IDT_SW_NTP20_BARUTBASE2		0x2949CU
4258c2ecf20Sopenharmony_ci#define IDT_SW_NTP20_BARSETUP3		0x294A0U
4268c2ecf20Sopenharmony_ci#define IDT_SW_NTP20_BARLIMIT3		0x294A4U
4278c2ecf20Sopenharmony_ci#define IDT_SW_NTP20_BARLTBASE3		0x294A8U
4288c2ecf20Sopenharmony_ci#define IDT_SW_NTP20_BARUTBASE3		0x294ACU
4298c2ecf20Sopenharmony_ci#define IDT_SW_NTP20_BARSETUP4		0x294B0U
4308c2ecf20Sopenharmony_ci#define IDT_SW_NTP20_BARLIMIT4		0x294B4U
4318c2ecf20Sopenharmony_ci#define IDT_SW_NTP20_BARLTBASE4		0x294B8U
4328c2ecf20Sopenharmony_ci#define IDT_SW_NTP20_BARUTBASE4		0x294BCU
4338c2ecf20Sopenharmony_ci#define IDT_SW_NTP20_BARSETUP5		0x294C0U
4348c2ecf20Sopenharmony_ci#define IDT_SW_NTP20_BARLIMIT5		0x294C4U
4358c2ecf20Sopenharmony_ci#define IDT_SW_NTP20_BARLTBASE5		0x294C8U
4368c2ecf20Sopenharmony_ci#define IDT_SW_NTP20_BARUTBASE5		0x294CCU
4378c2ecf20Sopenharmony_ci/* IDT PCIe-switch control register	(DWORD) */
4388c2ecf20Sopenharmony_ci#define IDT_SW_CTL			0x3E000U
4398c2ecf20Sopenharmony_ci/* Boot Configuration Vector Status	(DWORD) */
4408c2ecf20Sopenharmony_ci#define IDT_SW_BCVSTS			0x3E004U
4418c2ecf20Sopenharmony_ci/* Port Clocking Mode			(DWORD) */
4428c2ecf20Sopenharmony_ci#define IDT_SW_PCLKMODE			0x3E008U
4438c2ecf20Sopenharmony_ci/* Reset Drain Delay			(DWORD) */
4448c2ecf20Sopenharmony_ci#define IDT_SW_RDRAINDELAY		0x3E080U
4458c2ecf20Sopenharmony_ci/* Port Operating Mode Change Drain Delay (DWORD) */
4468c2ecf20Sopenharmony_ci#define IDT_SW_POMCDELAY		0x3E084U
4478c2ecf20Sopenharmony_ci/* Side Effect Delay			(DWORD) */
4488c2ecf20Sopenharmony_ci#define IDT_SW_SEDELAY			0x3E088U
4498c2ecf20Sopenharmony_ci/* Upstream Secondary Bus Reset Delay	(DWORD) */
4508c2ecf20Sopenharmony_ci#define IDT_SW_SSBRDELAY		0x3E08CU
4518c2ecf20Sopenharmony_ci/* Switch partition N Control/Status/Failover registers */
4528c2ecf20Sopenharmony_ci#define IDT_SW_SWPART0CTL		0x3E100U
4538c2ecf20Sopenharmony_ci#define IDT_SW_SWPART0STS		0x3E104U
4548c2ecf20Sopenharmony_ci#define IDT_SW_SWPART0FCTL		0x3E108U
4558c2ecf20Sopenharmony_ci#define IDT_SW_SWPART1CTL		0x3E120U
4568c2ecf20Sopenharmony_ci#define IDT_SW_SWPART1STS		0x3E124U
4578c2ecf20Sopenharmony_ci#define IDT_SW_SWPART1FCTL		0x3E128U
4588c2ecf20Sopenharmony_ci#define IDT_SW_SWPART2CTL		0x3E140U
4598c2ecf20Sopenharmony_ci#define IDT_SW_SWPART2STS		0x3E144U
4608c2ecf20Sopenharmony_ci#define IDT_SW_SWPART2FCTL		0x3E148U
4618c2ecf20Sopenharmony_ci#define IDT_SW_SWPART3CTL		0x3E160U
4628c2ecf20Sopenharmony_ci#define IDT_SW_SWPART3STS		0x3E164U
4638c2ecf20Sopenharmony_ci#define IDT_SW_SWPART3FCTL		0x3E168U
4648c2ecf20Sopenharmony_ci#define IDT_SW_SWPART4CTL		0x3E180U
4658c2ecf20Sopenharmony_ci#define IDT_SW_SWPART4STS		0x3E184U
4668c2ecf20Sopenharmony_ci#define IDT_SW_SWPART4FCTL		0x3E188U
4678c2ecf20Sopenharmony_ci#define IDT_SW_SWPART5CTL		0x3E1A0U
4688c2ecf20Sopenharmony_ci#define IDT_SW_SWPART5STS		0x3E1A4U
4698c2ecf20Sopenharmony_ci#define IDT_SW_SWPART5FCTL		0x3E1A8U
4708c2ecf20Sopenharmony_ci#define IDT_SW_SWPART6CTL		0x3E1C0U
4718c2ecf20Sopenharmony_ci#define IDT_SW_SWPART6STS		0x3E1C4U
4728c2ecf20Sopenharmony_ci#define IDT_SW_SWPART6FCTL		0x3E1C8U
4738c2ecf20Sopenharmony_ci#define IDT_SW_SWPART7CTL		0x3E1E0U
4748c2ecf20Sopenharmony_ci#define IDT_SW_SWPART7STS		0x3E1E4U
4758c2ecf20Sopenharmony_ci#define IDT_SW_SWPART7FCTL		0x3E1E8U
4768c2ecf20Sopenharmony_ci/* Switch port N control and status registers */
4778c2ecf20Sopenharmony_ci#define IDT_SW_SWPORT0CTL		0x3E200U
4788c2ecf20Sopenharmony_ci#define IDT_SW_SWPORT0STS		0x3E204U
4798c2ecf20Sopenharmony_ci#define IDT_SW_SWPORT0FCTL		0x3E208U
4808c2ecf20Sopenharmony_ci#define IDT_SW_SWPORT2CTL		0x3E240U
4818c2ecf20Sopenharmony_ci#define IDT_SW_SWPORT2STS		0x3E244U
4828c2ecf20Sopenharmony_ci#define IDT_SW_SWPORT2FCTL		0x3E248U
4838c2ecf20Sopenharmony_ci#define IDT_SW_SWPORT4CTL		0x3E280U
4848c2ecf20Sopenharmony_ci#define IDT_SW_SWPORT4STS		0x3E284U
4858c2ecf20Sopenharmony_ci#define IDT_SW_SWPORT4FCTL		0x3E288U
4868c2ecf20Sopenharmony_ci#define IDT_SW_SWPORT6CTL		0x3E2C0U
4878c2ecf20Sopenharmony_ci#define IDT_SW_SWPORT6STS		0x3E2C4U
4888c2ecf20Sopenharmony_ci#define IDT_SW_SWPORT6FCTL		0x3E2C8U
4898c2ecf20Sopenharmony_ci#define IDT_SW_SWPORT8CTL		0x3E300U
4908c2ecf20Sopenharmony_ci#define IDT_SW_SWPORT8STS		0x3E304U
4918c2ecf20Sopenharmony_ci#define IDT_SW_SWPORT8FCTL		0x3E308U
4928c2ecf20Sopenharmony_ci#define IDT_SW_SWPORT12CTL		0x3E380U
4938c2ecf20Sopenharmony_ci#define IDT_SW_SWPORT12STS		0x3E384U
4948c2ecf20Sopenharmony_ci#define IDT_SW_SWPORT12FCTL		0x3E388U
4958c2ecf20Sopenharmony_ci#define IDT_SW_SWPORT16CTL		0x3E400U
4968c2ecf20Sopenharmony_ci#define IDT_SW_SWPORT16STS		0x3E404U
4978c2ecf20Sopenharmony_ci#define IDT_SW_SWPORT16FCTL		0x3E408U
4988c2ecf20Sopenharmony_ci#define IDT_SW_SWPORT20CTL		0x3E480U
4998c2ecf20Sopenharmony_ci#define IDT_SW_SWPORT20STS		0x3E484U
5008c2ecf20Sopenharmony_ci#define IDT_SW_SWPORT20FCTL		0x3E488U
5018c2ecf20Sopenharmony_ci/* Switch Event registers */
5028c2ecf20Sopenharmony_ci/* Switch Event Status/Mask/Partition mask (DWORD) */
5038c2ecf20Sopenharmony_ci#define IDT_SW_SESTS			0x3EC00U
5048c2ecf20Sopenharmony_ci#define IDT_SW_SEMSK			0x3EC04U
5058c2ecf20Sopenharmony_ci#define IDT_SW_SEPMSK			0x3EC08U
5068c2ecf20Sopenharmony_ci/* Switch Event Link Up/Down Status/Mask (DWORD) */
5078c2ecf20Sopenharmony_ci#define IDT_SW_SELINKUPSTS		0x3EC0CU
5088c2ecf20Sopenharmony_ci#define IDT_SW_SELINKUPMSK		0x3EC10U
5098c2ecf20Sopenharmony_ci#define IDT_SW_SELINKDNSTS		0x3EC14U
5108c2ecf20Sopenharmony_ci#define IDT_SW_SELINKDNMSK		0x3EC18U
5118c2ecf20Sopenharmony_ci/* Switch Event Fundamental Reset Status/Mask (DWORD) */
5128c2ecf20Sopenharmony_ci#define IDT_SW_SEFRSTSTS		0x3EC1CU
5138c2ecf20Sopenharmony_ci#define IDT_SW_SEFRSTMSK		0x3EC20U
5148c2ecf20Sopenharmony_ci/* Switch Event Hot Reset Status/Mask	(DWORD) */
5158c2ecf20Sopenharmony_ci#define IDT_SW_SEHRSTSTS		0x3EC24U
5168c2ecf20Sopenharmony_ci#define IDT_SW_SEHRSTMSK		0x3EC28U
5178c2ecf20Sopenharmony_ci/* Switch Event Failover Mask		(DWORD) */
5188c2ecf20Sopenharmony_ci#define IDT_SW_SEFOVRMSK		0x3EC2CU
5198c2ecf20Sopenharmony_ci/* Switch Event Global Signal Status/Mask (DWORD) */
5208c2ecf20Sopenharmony_ci#define IDT_SW_SEGSIGSTS		0x3EC30U
5218c2ecf20Sopenharmony_ci#define IDT_SW_SEGSIGMSK		0x3EC34U
5228c2ecf20Sopenharmony_ci/* NT Global Doorbell Status		(DWORD) */
5238c2ecf20Sopenharmony_ci#define IDT_SW_GDBELLSTS		0x3EC3CU
5248c2ecf20Sopenharmony_ci/* Switch partition N message M control (msgs routing table) (DWORD) */
5258c2ecf20Sopenharmony_ci#define IDT_SW_SWP0MSGCTL0		0x3EE00U
5268c2ecf20Sopenharmony_ci#define IDT_SW_SWP1MSGCTL0		0x3EE04U
5278c2ecf20Sopenharmony_ci#define IDT_SW_SWP2MSGCTL0		0x3EE08U
5288c2ecf20Sopenharmony_ci#define IDT_SW_SWP3MSGCTL0		0x3EE0CU
5298c2ecf20Sopenharmony_ci#define IDT_SW_SWP4MSGCTL0		0x3EE10U
5308c2ecf20Sopenharmony_ci#define IDT_SW_SWP5MSGCTL0		0x3EE14U
5318c2ecf20Sopenharmony_ci#define IDT_SW_SWP6MSGCTL0		0x3EE18U
5328c2ecf20Sopenharmony_ci#define IDT_SW_SWP7MSGCTL0		0x3EE1CU
5338c2ecf20Sopenharmony_ci#define IDT_SW_SWP0MSGCTL1		0x3EE20U
5348c2ecf20Sopenharmony_ci#define IDT_SW_SWP1MSGCTL1		0x3EE24U
5358c2ecf20Sopenharmony_ci#define IDT_SW_SWP2MSGCTL1		0x3EE28U
5368c2ecf20Sopenharmony_ci#define IDT_SW_SWP3MSGCTL1		0x3EE2CU
5378c2ecf20Sopenharmony_ci#define IDT_SW_SWP4MSGCTL1		0x3EE30U
5388c2ecf20Sopenharmony_ci#define IDT_SW_SWP5MSGCTL1		0x3EE34U
5398c2ecf20Sopenharmony_ci#define IDT_SW_SWP6MSGCTL1		0x3EE38U
5408c2ecf20Sopenharmony_ci#define IDT_SW_SWP7MSGCTL1		0x3EE3CU
5418c2ecf20Sopenharmony_ci#define IDT_SW_SWP0MSGCTL2		0x3EE40U
5428c2ecf20Sopenharmony_ci#define IDT_SW_SWP1MSGCTL2		0x3EE44U
5438c2ecf20Sopenharmony_ci#define IDT_SW_SWP2MSGCTL2		0x3EE48U
5448c2ecf20Sopenharmony_ci#define IDT_SW_SWP3MSGCTL2		0x3EE4CU
5458c2ecf20Sopenharmony_ci#define IDT_SW_SWP4MSGCTL2		0x3EE50U
5468c2ecf20Sopenharmony_ci#define IDT_SW_SWP5MSGCTL2		0x3EE54U
5478c2ecf20Sopenharmony_ci#define IDT_SW_SWP6MSGCTL2		0x3EE58U
5488c2ecf20Sopenharmony_ci#define IDT_SW_SWP7MSGCTL2		0x3EE5CU
5498c2ecf20Sopenharmony_ci#define IDT_SW_SWP0MSGCTL3		0x3EE60U
5508c2ecf20Sopenharmony_ci#define IDT_SW_SWP1MSGCTL3		0x3EE64U
5518c2ecf20Sopenharmony_ci#define IDT_SW_SWP2MSGCTL3		0x3EE68U
5528c2ecf20Sopenharmony_ci#define IDT_SW_SWP3MSGCTL3		0x3EE6CU
5538c2ecf20Sopenharmony_ci#define IDT_SW_SWP4MSGCTL3		0x3EE70U
5548c2ecf20Sopenharmony_ci#define IDT_SW_SWP5MSGCTL3		0x3EE74U
5558c2ecf20Sopenharmony_ci#define IDT_SW_SWP6MSGCTL3		0x3EE78U
5568c2ecf20Sopenharmony_ci#define IDT_SW_SWP7MSGCTL3		0x3EE7CU
5578c2ecf20Sopenharmony_ci/* SMBus Status and Control registers	(DWORD) */
5588c2ecf20Sopenharmony_ci#define IDT_SW_SMBUSSTS			0x3F188U
5598c2ecf20Sopenharmony_ci#define IDT_SW_SMBUSCTL			0x3F18CU
5608c2ecf20Sopenharmony_ci/* Serial EEPROM Interface		(DWORD) */
5618c2ecf20Sopenharmony_ci#define IDT_SW_EEPROMINTF		0x3F190U
5628c2ecf20Sopenharmony_ci/* MBus I/O Expander Address N		(DWORD) */
5638c2ecf20Sopenharmony_ci#define IDT_SW_IOEXPADDR0		0x3F198U
5648c2ecf20Sopenharmony_ci#define IDT_SW_IOEXPADDR1		0x3F19CU
5658c2ecf20Sopenharmony_ci#define IDT_SW_IOEXPADDR2		0x3F1A0U
5668c2ecf20Sopenharmony_ci#define IDT_SW_IOEXPADDR3		0x3F1A4U
5678c2ecf20Sopenharmony_ci#define IDT_SW_IOEXPADDR4		0x3F1A8U
5688c2ecf20Sopenharmony_ci#define IDT_SW_IOEXPADDR5		0x3F1ACU
5698c2ecf20Sopenharmony_ci/* General Purpose Events Control and Status registers (DWORD) */
5708c2ecf20Sopenharmony_ci#define IDT_SW_GPECTL			0x3F1B0U
5718c2ecf20Sopenharmony_ci#define IDT_SW_GPESTS			0x3F1B4U
5728c2ecf20Sopenharmony_ci/* Temperature sensor Control/Status/Alarm/Adjustment/Slope registers */
5738c2ecf20Sopenharmony_ci#define IDT_SW_TMPCTL			0x3F1D4U
5748c2ecf20Sopenharmony_ci#define IDT_SW_TMPSTS			0x3F1D8U
5758c2ecf20Sopenharmony_ci#define IDT_SW_TMPALARM			0x3F1DCU
5768c2ecf20Sopenharmony_ci#define IDT_SW_TMPADJ			0x3F1E0U
5778c2ecf20Sopenharmony_ci#define IDT_SW_TSSLOPE			0x3F1E4U
5788c2ecf20Sopenharmony_ci/* SMBus Configuration Block header log	(DWORD) */
5798c2ecf20Sopenharmony_ci#define IDT_SW_SMBUSCBHL		0x3F1E8U
5808c2ecf20Sopenharmony_ci
5818c2ecf20Sopenharmony_ci/*
5828c2ecf20Sopenharmony_ci * Common registers related constants
5838c2ecf20Sopenharmony_ci * @IDT_REG_ALIGN:	Registers alignment used in the driver
5848c2ecf20Sopenharmony_ci * @IDT_REG_PCI_MAX:	Maximum PCI configuration space register value
5858c2ecf20Sopenharmony_ci * @IDT_REG_SW_MAX:	Maximum global register value
5868c2ecf20Sopenharmony_ci */
5878c2ecf20Sopenharmony_ci#define IDT_REG_ALIGN			4
5888c2ecf20Sopenharmony_ci#define IDT_REG_PCI_MAX			0x00FFFU
5898c2ecf20Sopenharmony_ci#define IDT_REG_SW_MAX			0x3FFFFU
5908c2ecf20Sopenharmony_ci
5918c2ecf20Sopenharmony_ci/*
5928c2ecf20Sopenharmony_ci * PCICMDSTS register fields related constants
5938c2ecf20Sopenharmony_ci * @IDT_PCICMDSTS_IOAE:	I/O access enable
5948c2ecf20Sopenharmony_ci * @IDT_PCICMDSTS_MAE:	Memory access enable
5958c2ecf20Sopenharmony_ci * @IDT_PCICMDSTS_BME:	Bus master enable
5968c2ecf20Sopenharmony_ci */
5978c2ecf20Sopenharmony_ci#define IDT_PCICMDSTS_IOAE		0x00000001U
5988c2ecf20Sopenharmony_ci#define IDT_PCICMDSTS_MAE		0x00000002U
5998c2ecf20Sopenharmony_ci#define IDT_PCICMDSTS_BME		0x00000004U
6008c2ecf20Sopenharmony_ci
6018c2ecf20Sopenharmony_ci/*
6028c2ecf20Sopenharmony_ci * PCIEDCAP register fields related constants
6038c2ecf20Sopenharmony_ci * @IDT_PCIEDCAP_MPAYLOAD_MASK:	 Maximum payload size mask
6048c2ecf20Sopenharmony_ci * @IDT_PCIEDCAP_MPAYLOAD_FLD:	 Maximum payload size field offset
6058c2ecf20Sopenharmony_ci * @IDT_PCIEDCAP_MPAYLOAD_S128:	 Max supported payload size of 128 bytes
6068c2ecf20Sopenharmony_ci * @IDT_PCIEDCAP_MPAYLOAD_S256:	 Max supported payload size of 256 bytes
6078c2ecf20Sopenharmony_ci * @IDT_PCIEDCAP_MPAYLOAD_S512:	 Max supported payload size of 512 bytes
6088c2ecf20Sopenharmony_ci * @IDT_PCIEDCAP_MPAYLOAD_S1024: Max supported payload size of 1024 bytes
6098c2ecf20Sopenharmony_ci * @IDT_PCIEDCAP_MPAYLOAD_S2048: Max supported payload size of 2048 bytes
6108c2ecf20Sopenharmony_ci */
6118c2ecf20Sopenharmony_ci#define IDT_PCIEDCAP_MPAYLOAD_MASK	0x00000007U
6128c2ecf20Sopenharmony_ci#define IDT_PCIEDCAP_MPAYLOAD_FLD	0
6138c2ecf20Sopenharmony_ci#define IDT_PCIEDCAP_MPAYLOAD_S128	0x00000000U
6148c2ecf20Sopenharmony_ci#define IDT_PCIEDCAP_MPAYLOAD_S256	0x00000001U
6158c2ecf20Sopenharmony_ci#define IDT_PCIEDCAP_MPAYLOAD_S512	0x00000002U
6168c2ecf20Sopenharmony_ci#define IDT_PCIEDCAP_MPAYLOAD_S1024	0x00000003U
6178c2ecf20Sopenharmony_ci#define IDT_PCIEDCAP_MPAYLOAD_S2048	0x00000004U
6188c2ecf20Sopenharmony_ci
6198c2ecf20Sopenharmony_ci/*
6208c2ecf20Sopenharmony_ci * PCIEDCTLSTS registers fields related constants
6218c2ecf20Sopenharmony_ci * @IDT_PCIEDCTL_MPS_MASK:	Maximum payload size mask
6228c2ecf20Sopenharmony_ci * @IDT_PCIEDCTL_MPS_FLD:	MPS field offset
6238c2ecf20Sopenharmony_ci * @IDT_PCIEDCTL_MPS_S128:	Max payload size of 128 bytes
6248c2ecf20Sopenharmony_ci * @IDT_PCIEDCTL_MPS_S256:	Max payload size of 256 bytes
6258c2ecf20Sopenharmony_ci * @IDT_PCIEDCTL_MPS_S512:	Max payload size of 512 bytes
6268c2ecf20Sopenharmony_ci * @IDT_PCIEDCTL_MPS_S1024:	Max payload size of 1024 bytes
6278c2ecf20Sopenharmony_ci * @IDT_PCIEDCTL_MPS_S2048:	Max payload size of 2048 bytes
6288c2ecf20Sopenharmony_ci * @IDT_PCIEDCTL_MPS_S4096:	Max payload size of 4096 bytes
6298c2ecf20Sopenharmony_ci */
6308c2ecf20Sopenharmony_ci#define IDT_PCIEDCTLSTS_MPS_MASK	0x000000E0U
6318c2ecf20Sopenharmony_ci#define IDT_PCIEDCTLSTS_MPS_FLD		5
6328c2ecf20Sopenharmony_ci#define IDT_PCIEDCTLSTS_MPS_S128	0x00000000U
6338c2ecf20Sopenharmony_ci#define IDT_PCIEDCTLSTS_MPS_S256	0x00000020U
6348c2ecf20Sopenharmony_ci#define IDT_PCIEDCTLSTS_MPS_S512	0x00000040U
6358c2ecf20Sopenharmony_ci#define IDT_PCIEDCTLSTS_MPS_S1024	0x00000060U
6368c2ecf20Sopenharmony_ci#define IDT_PCIEDCTLSTS_MPS_S2048	0x00000080U
6378c2ecf20Sopenharmony_ci#define IDT_PCIEDCTLSTS_MPS_S4096	0x000000A0U
6388c2ecf20Sopenharmony_ci
6398c2ecf20Sopenharmony_ci/*
6408c2ecf20Sopenharmony_ci * PCIELCAP register fields related constants
6418c2ecf20Sopenharmony_ci * @IDT_PCIELCAP_PORTNUM_MASK:	Port number field mask
6428c2ecf20Sopenharmony_ci * @IDT_PCIELCAP_PORTNUM_FLD:	Port number field offset
6438c2ecf20Sopenharmony_ci */
6448c2ecf20Sopenharmony_ci#define IDT_PCIELCAP_PORTNUM_MASK	0xFF000000U
6458c2ecf20Sopenharmony_ci#define IDT_PCIELCAP_PORTNUM_FLD	24
6468c2ecf20Sopenharmony_ci
6478c2ecf20Sopenharmony_ci/*
6488c2ecf20Sopenharmony_ci * PCIELCTLSTS registers fields related constants
6498c2ecf20Sopenharmony_ci * @IDT_PCIELSTS_CLS_MASK:	Current link speed mask
6508c2ecf20Sopenharmony_ci * @IDT_PCIELSTS_CLS_FLD:	Current link speed field offset
6518c2ecf20Sopenharmony_ci * @IDT_PCIELSTS_NLW_MASK:	Negotiated link width mask
6528c2ecf20Sopenharmony_ci * @IDT_PCIELSTS_NLW_FLD:	Negotiated link width field offset
6538c2ecf20Sopenharmony_ci * @IDT_PCIELSTS_SCLK_COM:	Common slot clock configuration
6548c2ecf20Sopenharmony_ci */
6558c2ecf20Sopenharmony_ci#define IDT_PCIELCTLSTS_CLS_MASK	0x000F0000U
6568c2ecf20Sopenharmony_ci#define IDT_PCIELCTLSTS_CLS_FLD		16
6578c2ecf20Sopenharmony_ci#define IDT_PCIELCTLSTS_NLW_MASK	0x03F00000U
6588c2ecf20Sopenharmony_ci#define IDT_PCIELCTLSTS_NLW_FLD		20
6598c2ecf20Sopenharmony_ci#define IDT_PCIELCTLSTS_SCLK_COM	0x10000000U
6608c2ecf20Sopenharmony_ci
6618c2ecf20Sopenharmony_ci/*
6628c2ecf20Sopenharmony_ci * NTCTL register fields related constants
6638c2ecf20Sopenharmony_ci * @IDT_NTCTL_IDPROTDIS:	ID Protection check disable (disable MTBL)
6648c2ecf20Sopenharmony_ci * @IDT_NTCTL_CPEN:		Completion enable
6658c2ecf20Sopenharmony_ci * @IDT_NTCTL_RNS:		Request no snoop processing (if MTBL disabled)
6668c2ecf20Sopenharmony_ci * @IDT_NTCTL_ATP:		Address type processing (if MTBL disabled)
6678c2ecf20Sopenharmony_ci */
6688c2ecf20Sopenharmony_ci#define IDT_NTCTL_IDPROTDIS		0x00000001U
6698c2ecf20Sopenharmony_ci#define IDT_NTCTL_CPEN			0x00000002U
6708c2ecf20Sopenharmony_ci#define IDT_NTCTL_RNS			0x00000004U
6718c2ecf20Sopenharmony_ci#define IDT_NTCTL_ATP			0x00000008U
6728c2ecf20Sopenharmony_ci
6738c2ecf20Sopenharmony_ci/*
6748c2ecf20Sopenharmony_ci * NTINTSTS register fields related constants
6758c2ecf20Sopenharmony_ci * @IDT_NTINTSTS_MSG:		Message interrupt bit
6768c2ecf20Sopenharmony_ci * @IDT_NTINTSTS_DBELL:		Doorbell interrupt bit
6778c2ecf20Sopenharmony_ci * @IDT_NTINTSTS_SEVENT:	Switch Event interrupt bit
6788c2ecf20Sopenharmony_ci * @IDT_NTINTSTS_TMPSENSOR:	Temperature sensor interrupt bit
6798c2ecf20Sopenharmony_ci */
6808c2ecf20Sopenharmony_ci#define IDT_NTINTSTS_MSG		0x00000001U
6818c2ecf20Sopenharmony_ci#define IDT_NTINTSTS_DBELL		0x00000002U
6828c2ecf20Sopenharmony_ci#define IDT_NTINTSTS_SEVENT		0x00000008U
6838c2ecf20Sopenharmony_ci#define IDT_NTINTSTS_TMPSENSOR		0x00000080U
6848c2ecf20Sopenharmony_ci
6858c2ecf20Sopenharmony_ci/*
6868c2ecf20Sopenharmony_ci * NTINTMSK register fields related constants
6878c2ecf20Sopenharmony_ci * @IDT_NTINTMSK_MSG:		Message interrupt mask bit
6888c2ecf20Sopenharmony_ci * @IDT_NTINTMSK_DBELL:		Doorbell interrupt mask bit
6898c2ecf20Sopenharmony_ci * @IDT_NTINTMSK_SEVENT:	Switch Event interrupt mask bit
6908c2ecf20Sopenharmony_ci * @IDT_NTINTMSK_TMPSENSOR:	Temperature sensor interrupt mask bit
6918c2ecf20Sopenharmony_ci * @IDT_NTINTMSK_ALL:		NTB-related interrupts mask
6928c2ecf20Sopenharmony_ci */
6938c2ecf20Sopenharmony_ci#define IDT_NTINTMSK_MSG		0x00000001U
6948c2ecf20Sopenharmony_ci#define IDT_NTINTMSK_DBELL		0x00000002U
6958c2ecf20Sopenharmony_ci#define IDT_NTINTMSK_SEVENT		0x00000008U
6968c2ecf20Sopenharmony_ci#define IDT_NTINTMSK_TMPSENSOR		0x00000080U
6978c2ecf20Sopenharmony_ci#define IDT_NTINTMSK_ALL \
6988c2ecf20Sopenharmony_ci	(IDT_NTINTMSK_MSG | IDT_NTINTMSK_DBELL | IDT_NTINTMSK_SEVENT)
6998c2ecf20Sopenharmony_ci
7008c2ecf20Sopenharmony_ci/*
7018c2ecf20Sopenharmony_ci * NTGSIGNAL register fields related constants
7028c2ecf20Sopenharmony_ci * @IDT_NTGSIGNAL_SET:	Set global signal of the local partition
7038c2ecf20Sopenharmony_ci */
7048c2ecf20Sopenharmony_ci#define IDT_NTGSIGNAL_SET		0x00000001U
7058c2ecf20Sopenharmony_ci
7068c2ecf20Sopenharmony_ci/*
7078c2ecf20Sopenharmony_ci * BARSETUP register fields related constants
7088c2ecf20Sopenharmony_ci * @IDT_BARSETUP_TYPE_MASK:	Mask of the TYPE field
7098c2ecf20Sopenharmony_ci * @IDT_BARSETUP_TYPE_32:	32-bit addressing BAR
7108c2ecf20Sopenharmony_ci * @IDT_BARSETUP_TYPE_64:	64-bit addressing BAR
7118c2ecf20Sopenharmony_ci * @IDT_BARSETUP_PREF:		Value of the BAR prefetchable field
7128c2ecf20Sopenharmony_ci * @IDT_BARSETUP_SIZE_MASK:	Mask of the SIZE field
7138c2ecf20Sopenharmony_ci * @IDT_BARSETUP_SIZE_FLD:	SIZE field offset
7148c2ecf20Sopenharmony_ci * @IDT_BARSETUP_SIZE_CFG:	SIZE field value in case of config space MODE
7158c2ecf20Sopenharmony_ci * @IDT_BARSETUP_MODE_CFG:	Configuration space BAR mode
7168c2ecf20Sopenharmony_ci * @IDT_BARSETUP_ATRAN_MASK:	ATRAN field mask
7178c2ecf20Sopenharmony_ci * @IDT_BARSETUP_ATRAN_FLD:	ATRAN field offset
7188c2ecf20Sopenharmony_ci * @IDT_BARSETUP_ATRAN_DIR:	Direct address translation memory window
7198c2ecf20Sopenharmony_ci * @IDT_BARSETUP_ATRAN_LUT12:	12-entry lookup table
7208c2ecf20Sopenharmony_ci * @IDT_BARSETUP_ATRAN_LUT24:	24-entry lookup table
7218c2ecf20Sopenharmony_ci * @IDT_BARSETUP_TPART_MASK:	TPART field mask
7228c2ecf20Sopenharmony_ci * @IDT_BARSETUP_TPART_FLD:	TPART field offset
7238c2ecf20Sopenharmony_ci * @IDT_BARSETUP_EN:		BAR enable bit
7248c2ecf20Sopenharmony_ci */
7258c2ecf20Sopenharmony_ci#define IDT_BARSETUP_TYPE_MASK		0x00000006U
7268c2ecf20Sopenharmony_ci#define IDT_BARSETUP_TYPE_FLD		0
7278c2ecf20Sopenharmony_ci#define IDT_BARSETUP_TYPE_32		0x00000000U
7288c2ecf20Sopenharmony_ci#define IDT_BARSETUP_TYPE_64		0x00000004U
7298c2ecf20Sopenharmony_ci#define IDT_BARSETUP_PREF		0x00000008U
7308c2ecf20Sopenharmony_ci#define IDT_BARSETUP_SIZE_MASK		0x000003F0U
7318c2ecf20Sopenharmony_ci#define IDT_BARSETUP_SIZE_FLD		4
7328c2ecf20Sopenharmony_ci#define IDT_BARSETUP_SIZE_CFG		0x000000C0U
7338c2ecf20Sopenharmony_ci#define IDT_BARSETUP_MODE_CFG		0x00000400U
7348c2ecf20Sopenharmony_ci#define IDT_BARSETUP_ATRAN_MASK		0x00001800U
7358c2ecf20Sopenharmony_ci#define IDT_BARSETUP_ATRAN_FLD		11
7368c2ecf20Sopenharmony_ci#define IDT_BARSETUP_ATRAN_DIR		0x00000000U
7378c2ecf20Sopenharmony_ci#define IDT_BARSETUP_ATRAN_LUT12	0x00000800U
7388c2ecf20Sopenharmony_ci#define IDT_BARSETUP_ATRAN_LUT24	0x00001000U
7398c2ecf20Sopenharmony_ci#define IDT_BARSETUP_TPART_MASK		0x0000E000U
7408c2ecf20Sopenharmony_ci#define IDT_BARSETUP_TPART_FLD		13
7418c2ecf20Sopenharmony_ci#define IDT_BARSETUP_EN			0x80000000U
7428c2ecf20Sopenharmony_ci
7438c2ecf20Sopenharmony_ci/*
7448c2ecf20Sopenharmony_ci * NTMTBLDATA register fields related constants
7458c2ecf20Sopenharmony_ci * @IDT_NTMTBLDATA_VALID:	Set the MTBL entry being valid
7468c2ecf20Sopenharmony_ci * @IDT_NTMTBLDATA_REQID_MASK:	Bus:Device:Function field mask
7478c2ecf20Sopenharmony_ci * @IDT_NTMTBLDATA_REQID_FLD:	Bus:Device:Function field offset
7488c2ecf20Sopenharmony_ci * @IDT_NTMTBLDATA_PART_MASK:	Partition field mask
7498c2ecf20Sopenharmony_ci * @IDT_NTMTBLDATA_PART_FLD:	Partition field offset
7508c2ecf20Sopenharmony_ci * @IDT_NTMTBLDATA_ATP_TRANS:	Enable AT field translation on request TLPs
7518c2ecf20Sopenharmony_ci * @IDT_NTMTBLDATA_CNS_INV:	Enable No Snoop attribute inversion of
7528c2ecf20Sopenharmony_ci *				Completion TLPs
7538c2ecf20Sopenharmony_ci * @IDT_NTMTBLDATA_RNS_INV:	Enable No Snoop attribute inversion of
7548c2ecf20Sopenharmony_ci *				Request TLPs
7558c2ecf20Sopenharmony_ci */
7568c2ecf20Sopenharmony_ci#define IDT_NTMTBLDATA_VALID		0x00000001U
7578c2ecf20Sopenharmony_ci#define IDT_NTMTBLDATA_REQID_MASK	0x0001FFFEU
7588c2ecf20Sopenharmony_ci#define IDT_NTMTBLDATA_REQID_FLD	1
7598c2ecf20Sopenharmony_ci#define IDT_NTMTBLDATA_PART_MASK	0x000E0000U
7608c2ecf20Sopenharmony_ci#define IDT_NTMTBLDATA_PART_FLD		17
7618c2ecf20Sopenharmony_ci#define IDT_NTMTBLDATA_ATP_TRANS	0x20000000U
7628c2ecf20Sopenharmony_ci#define IDT_NTMTBLDATA_CNS_INV		0x40000000U
7638c2ecf20Sopenharmony_ci#define IDT_NTMTBLDATA_RNS_INV		0x80000000U
7648c2ecf20Sopenharmony_ci
7658c2ecf20Sopenharmony_ci/*
7668c2ecf20Sopenharmony_ci * REQIDCAP register fields related constants
7678c2ecf20Sopenharmony_ci * @IDT_REQIDCAP_REQID_MASK:	Request ID field mask
7688c2ecf20Sopenharmony_ci * @IDT_REQIDCAP_REQID_FLD:	Request ID field offset
7698c2ecf20Sopenharmony_ci */
7708c2ecf20Sopenharmony_ci#define IDT_REQIDCAP_REQID_MASK		0x0000FFFFU
7718c2ecf20Sopenharmony_ci#define IDT_REQIDCAP_REQID_FLD		0
7728c2ecf20Sopenharmony_ci
7738c2ecf20Sopenharmony_ci/*
7748c2ecf20Sopenharmony_ci * LUTOFFSET register fields related constants
7758c2ecf20Sopenharmony_ci * @IDT_LUTOFFSET_INDEX_MASK:	Lookup table index field mask
7768c2ecf20Sopenharmony_ci * @IDT_LUTOFFSET_INDEX_FLD:	Lookup table index field offset
7778c2ecf20Sopenharmony_ci * @IDT_LUTOFFSET_BAR_MASK:	Lookup table BAR select field mask
7788c2ecf20Sopenharmony_ci * @IDT_LUTOFFSET_BAR_FLD:	Lookup table BAR select field offset
7798c2ecf20Sopenharmony_ci */
7808c2ecf20Sopenharmony_ci#define IDT_LUTOFFSET_INDEX_MASK	0x0000001FU
7818c2ecf20Sopenharmony_ci#define IDT_LUTOFFSET_INDEX_FLD		0
7828c2ecf20Sopenharmony_ci#define IDT_LUTOFFSET_BAR_MASK		0x00000700U
7838c2ecf20Sopenharmony_ci#define IDT_LUTOFFSET_BAR_FLD		8
7848c2ecf20Sopenharmony_ci
7858c2ecf20Sopenharmony_ci/*
7868c2ecf20Sopenharmony_ci * LUTUDATA register fields related constants
7878c2ecf20Sopenharmony_ci * @IDT_LUTUDATA_PART_MASK:	Partition field mask
7888c2ecf20Sopenharmony_ci * @IDT_LUTUDATA_PART_FLD:	Partition field offset
7898c2ecf20Sopenharmony_ci * @IDT_LUTUDATA_VALID:		Lookup table entry valid bit
7908c2ecf20Sopenharmony_ci */
7918c2ecf20Sopenharmony_ci#define IDT_LUTUDATA_PART_MASK		0x0000000FU
7928c2ecf20Sopenharmony_ci#define IDT_LUTUDATA_PART_FLD		0
7938c2ecf20Sopenharmony_ci#define IDT_LUTUDATA_VALID		0x80000000U
7948c2ecf20Sopenharmony_ci
7958c2ecf20Sopenharmony_ci/*
7968c2ecf20Sopenharmony_ci * SWPARTxSTS register fields related constants
7978c2ecf20Sopenharmony_ci * @IDT_SWPARTxSTS_SCI:		Switch partition state change initiated
7988c2ecf20Sopenharmony_ci * @IDT_SWPARTxSTS_SCC:		Switch partition state change completed
7998c2ecf20Sopenharmony_ci * @IDT_SWPARTxSTS_STATE_MASK:	Switch partition state mask
8008c2ecf20Sopenharmony_ci * @IDT_SWPARTxSTS_STATE_FLD:	Switch partition state field offset
8018c2ecf20Sopenharmony_ci * @IDT_SWPARTxSTS_STATE_DIS:	Switch partition disabled
8028c2ecf20Sopenharmony_ci * @IDT_SWPARTxSTS_STATE_ACT:	Switch partition enabled
8038c2ecf20Sopenharmony_ci * @IDT_SWPARTxSTS_STATE_RES:	Switch partition in reset
8048c2ecf20Sopenharmony_ci * @IDT_SWPARTxSTS_US:		Switch partition has upstream port
8058c2ecf20Sopenharmony_ci * @IDT_SWPARTxSTS_USID_MASK:	Switch partition upstream port ID mask
8068c2ecf20Sopenharmony_ci * @IDT_SWPARTxSTS_USID_FLD:	Switch partition upstream port ID field offset
8078c2ecf20Sopenharmony_ci * @IDT_SWPARTxSTS_NT:		Upstream port has NT function
8088c2ecf20Sopenharmony_ci * @IDT_SWPARTxSTS_DMA:		Upstream port has DMA function
8098c2ecf20Sopenharmony_ci */
8108c2ecf20Sopenharmony_ci#define IDT_SWPARTxSTS_SCI		0x00000001U
8118c2ecf20Sopenharmony_ci#define IDT_SWPARTxSTS_SCC		0x00000002U
8128c2ecf20Sopenharmony_ci#define IDT_SWPARTxSTS_STATE_MASK	0x00000060U
8138c2ecf20Sopenharmony_ci#define IDT_SWPARTxSTS_STATE_FLD	5
8148c2ecf20Sopenharmony_ci#define IDT_SWPARTxSTS_STATE_DIS	0x00000000U
8158c2ecf20Sopenharmony_ci#define IDT_SWPARTxSTS_STATE_ACT	0x00000020U
8168c2ecf20Sopenharmony_ci#define IDT_SWPARTxSTS_STATE_RES	0x00000060U
8178c2ecf20Sopenharmony_ci#define IDT_SWPARTxSTS_US		0x00000100U
8188c2ecf20Sopenharmony_ci#define IDT_SWPARTxSTS_USID_MASK	0x00003E00U
8198c2ecf20Sopenharmony_ci#define IDT_SWPARTxSTS_USID_FLD		9
8208c2ecf20Sopenharmony_ci#define IDT_SWPARTxSTS_NT		0x00004000U
8218c2ecf20Sopenharmony_ci#define IDT_SWPARTxSTS_DMA		0x00008000U
8228c2ecf20Sopenharmony_ci
8238c2ecf20Sopenharmony_ci/*
8248c2ecf20Sopenharmony_ci * SWPORTxSTS register fields related constants
8258c2ecf20Sopenharmony_ci * @IDT_SWPORTxSTS_OMCI:	Operation mode change initiated
8268c2ecf20Sopenharmony_ci * @IDT_SWPORTxSTS_OMCC:	Operation mode change completed
8278c2ecf20Sopenharmony_ci * @IDT_SWPORTxSTS_LINKUP:	Link up status
8288c2ecf20Sopenharmony_ci * @IDT_SWPORTxSTS_DS:		Port lanes behave as downstream lanes
8298c2ecf20Sopenharmony_ci * @IDT_SWPORTxSTS_MODE_MASK:	Port mode field mask
8308c2ecf20Sopenharmony_ci * @IDT_SWPORTxSTS_MODE_FLD:	Port mode field offset
8318c2ecf20Sopenharmony_ci * @IDT_SWPORTxSTS_MODE_DIS:	Port mode - disabled
8328c2ecf20Sopenharmony_ci * @IDT_SWPORTxSTS_MODE_DS:	Port mode - downstream switch port
8338c2ecf20Sopenharmony_ci * @IDT_SWPORTxSTS_MODE_US:	Port mode - upstream switch port
8348c2ecf20Sopenharmony_ci * @IDT_SWPORTxSTS_MODE_NT:	Port mode - NT function
8358c2ecf20Sopenharmony_ci * @IDT_SWPORTxSTS_MODE_USNT:	Port mode - upstream switch port with NTB
8368c2ecf20Sopenharmony_ci * @IDT_SWPORTxSTS_MODE_UNAT:	Port mode - unattached
8378c2ecf20Sopenharmony_ci * @IDT_SWPORTxSTS_MODE_USDMA:	Port mode - upstream switch port with DMA
8388c2ecf20Sopenharmony_ci * @IDT_SWPORTxSTS_MODE_USNTDMA:Port mode - upstream port with NTB and DMA
8398c2ecf20Sopenharmony_ci * @IDT_SWPORTxSTS_MODE_NTDMA:	Port mode - NT function with DMA
8408c2ecf20Sopenharmony_ci * @IDT_SWPORTxSTS_SWPART_MASK:	Port partition field mask
8418c2ecf20Sopenharmony_ci * @IDT_SWPORTxSTS_SWPART_FLD:	Port partition field offset
8428c2ecf20Sopenharmony_ci * @IDT_SWPORTxSTS_DEVNUM_MASK:	Port device number field mask
8438c2ecf20Sopenharmony_ci * @IDT_SWPORTxSTS_DEVNUM_FLD:	Port device number field offset
8448c2ecf20Sopenharmony_ci */
8458c2ecf20Sopenharmony_ci#define IDT_SWPORTxSTS_OMCI		0x00000001U
8468c2ecf20Sopenharmony_ci#define IDT_SWPORTxSTS_OMCC		0x00000002U
8478c2ecf20Sopenharmony_ci#define IDT_SWPORTxSTS_LINKUP		0x00000010U
8488c2ecf20Sopenharmony_ci#define IDT_SWPORTxSTS_DS		0x00000020U
8498c2ecf20Sopenharmony_ci#define IDT_SWPORTxSTS_MODE_MASK	0x000003C0U
8508c2ecf20Sopenharmony_ci#define IDT_SWPORTxSTS_MODE_FLD		6
8518c2ecf20Sopenharmony_ci#define IDT_SWPORTxSTS_MODE_DIS		0x00000000U
8528c2ecf20Sopenharmony_ci#define IDT_SWPORTxSTS_MODE_DS		0x00000040U
8538c2ecf20Sopenharmony_ci#define IDT_SWPORTxSTS_MODE_US		0x00000080U
8548c2ecf20Sopenharmony_ci#define IDT_SWPORTxSTS_MODE_NT		0x000000C0U
8558c2ecf20Sopenharmony_ci#define IDT_SWPORTxSTS_MODE_USNT	0x00000100U
8568c2ecf20Sopenharmony_ci#define IDT_SWPORTxSTS_MODE_UNAT	0x00000140U
8578c2ecf20Sopenharmony_ci#define IDT_SWPORTxSTS_MODE_USDMA	0x00000180U
8588c2ecf20Sopenharmony_ci#define IDT_SWPORTxSTS_MODE_USNTDMA	0x000001C0U
8598c2ecf20Sopenharmony_ci#define IDT_SWPORTxSTS_MODE_NTDMA	0x00000200U
8608c2ecf20Sopenharmony_ci#define IDT_SWPORTxSTS_SWPART_MASK	0x00001C00U
8618c2ecf20Sopenharmony_ci#define IDT_SWPORTxSTS_SWPART_FLD	10
8628c2ecf20Sopenharmony_ci#define IDT_SWPORTxSTS_DEVNUM_MASK	0x001F0000U
8638c2ecf20Sopenharmony_ci#define IDT_SWPORTxSTS_DEVNUM_FLD	16
8648c2ecf20Sopenharmony_ci
8658c2ecf20Sopenharmony_ci/*
8668c2ecf20Sopenharmony_ci * SEMSK register fields related constants
8678c2ecf20Sopenharmony_ci * @IDT_SEMSK_LINKUP:	Link Up event mask bit
8688c2ecf20Sopenharmony_ci * @IDT_SEMSK_LINKDN:	Link Down event mask bit
8698c2ecf20Sopenharmony_ci * @IDT_SEMSK_GSIGNAL:	Global Signal event mask bit
8708c2ecf20Sopenharmony_ci */
8718c2ecf20Sopenharmony_ci#define IDT_SEMSK_LINKUP		0x00000001U
8728c2ecf20Sopenharmony_ci#define IDT_SEMSK_LINKDN		0x00000002U
8738c2ecf20Sopenharmony_ci#define IDT_SEMSK_GSIGNAL		0x00000020U
8748c2ecf20Sopenharmony_ci
8758c2ecf20Sopenharmony_ci/*
8768c2ecf20Sopenharmony_ci * SWPxMSGCTL register fields related constants
8778c2ecf20Sopenharmony_ci * @IDT_SWPxMSGCTL_REG_MASK:	Register select field mask
8788c2ecf20Sopenharmony_ci * @IDT_SWPxMSGCTL_REG_FLD:	Register select field offset
8798c2ecf20Sopenharmony_ci * @IDT_SWPxMSGCTL_PART_MASK:	Partition select field mask
8808c2ecf20Sopenharmony_ci * @IDT_SWPxMSGCTL_PART_FLD:	Partition select field offset
8818c2ecf20Sopenharmony_ci */
8828c2ecf20Sopenharmony_ci#define IDT_SWPxMSGCTL_REG_MASK		0x00000003U
8838c2ecf20Sopenharmony_ci#define IDT_SWPxMSGCTL_REG_FLD		0
8848c2ecf20Sopenharmony_ci#define IDT_SWPxMSGCTL_PART_MASK	0x00000070U
8858c2ecf20Sopenharmony_ci#define IDT_SWPxMSGCTL_PART_FLD		4
8868c2ecf20Sopenharmony_ci
8878c2ecf20Sopenharmony_ci/*
8888c2ecf20Sopenharmony_ci * TMPCTL register fields related constants
8898c2ecf20Sopenharmony_ci * @IDT_TMPCTL_LTH_MASK:	Low temperature threshold field mask
8908c2ecf20Sopenharmony_ci * @IDT_TMPCTL_LTH_FLD:		Low temperature threshold field offset
8918c2ecf20Sopenharmony_ci * @IDT_TMPCTL_MTH_MASK:	Middle temperature threshold field mask
8928c2ecf20Sopenharmony_ci * @IDT_TMPCTL_MTH_FLD:		Middle temperature threshold field offset
8938c2ecf20Sopenharmony_ci * @IDT_TMPCTL_HTH_MASK:	High temperature threshold field mask
8948c2ecf20Sopenharmony_ci * @IDT_TMPCTL_HTH_FLD:		High temperature threshold field offset
8958c2ecf20Sopenharmony_ci * @IDT_TMPCTL_PDOWN:		Temperature sensor power down
8968c2ecf20Sopenharmony_ci */
8978c2ecf20Sopenharmony_ci#define IDT_TMPCTL_LTH_MASK		0x000000FFU
8988c2ecf20Sopenharmony_ci#define IDT_TMPCTL_LTH_FLD		0
8998c2ecf20Sopenharmony_ci#define IDT_TMPCTL_MTH_MASK		0x0000FF00U
9008c2ecf20Sopenharmony_ci#define IDT_TMPCTL_MTH_FLD		8
9018c2ecf20Sopenharmony_ci#define IDT_TMPCTL_HTH_MASK		0x00FF0000U
9028c2ecf20Sopenharmony_ci#define IDT_TMPCTL_HTH_FLD		16
9038c2ecf20Sopenharmony_ci#define IDT_TMPCTL_PDOWN		0x80000000U
9048c2ecf20Sopenharmony_ci
9058c2ecf20Sopenharmony_ci/*
9068c2ecf20Sopenharmony_ci * TMPSTS register fields related constants
9078c2ecf20Sopenharmony_ci * @IDT_TMPSTS_TEMP_MASK:	Current temperature field mask
9088c2ecf20Sopenharmony_ci * @IDT_TMPSTS_TEMP_FLD:	Current temperature field offset
9098c2ecf20Sopenharmony_ci * @IDT_TMPSTS_LTEMP_MASK:	Lowest temperature field mask
9108c2ecf20Sopenharmony_ci * @IDT_TMPSTS_LTEMP_FLD:	Lowest temperature field offset
9118c2ecf20Sopenharmony_ci * @IDT_TMPSTS_HTEMP_MASK:	Highest temperature field mask
9128c2ecf20Sopenharmony_ci * @IDT_TMPSTS_HTEMP_FLD:	Highest temperature field offset
9138c2ecf20Sopenharmony_ci */
9148c2ecf20Sopenharmony_ci#define IDT_TMPSTS_TEMP_MASK		0x000000FFU
9158c2ecf20Sopenharmony_ci#define IDT_TMPSTS_TEMP_FLD		0
9168c2ecf20Sopenharmony_ci#define IDT_TMPSTS_LTEMP_MASK		0x0000FF00U
9178c2ecf20Sopenharmony_ci#define IDT_TMPSTS_LTEMP_FLD		8
9188c2ecf20Sopenharmony_ci#define IDT_TMPSTS_HTEMP_MASK		0x00FF0000U
9198c2ecf20Sopenharmony_ci#define IDT_TMPSTS_HTEMP_FLD		16
9208c2ecf20Sopenharmony_ci
9218c2ecf20Sopenharmony_ci/*
9228c2ecf20Sopenharmony_ci * TMPALARM register fields related constants
9238c2ecf20Sopenharmony_ci * @IDT_TMPALARM_LTEMP_MASK:	Lowest temperature field mask
9248c2ecf20Sopenharmony_ci * @IDT_TMPALARM_LTEMP_FLD:	Lowest temperature field offset
9258c2ecf20Sopenharmony_ci * @IDT_TMPALARM_HTEMP_MASK:	Highest temperature field mask
9268c2ecf20Sopenharmony_ci * @IDT_TMPALARM_HTEMP_FLD:	Highest temperature field offset
9278c2ecf20Sopenharmony_ci * @IDT_TMPALARM_IRQ_MASK:	Alarm IRQ status mask
9288c2ecf20Sopenharmony_ci */
9298c2ecf20Sopenharmony_ci#define IDT_TMPALARM_LTEMP_MASK		0x0000FF00U
9308c2ecf20Sopenharmony_ci#define IDT_TMPALARM_LTEMP_FLD		8
9318c2ecf20Sopenharmony_ci#define IDT_TMPALARM_HTEMP_MASK		0x00FF0000U
9328c2ecf20Sopenharmony_ci#define IDT_TMPALARM_HTEMP_FLD		16
9338c2ecf20Sopenharmony_ci#define IDT_TMPALARM_IRQ_MASK		0x3F000000U
9348c2ecf20Sopenharmony_ci
9358c2ecf20Sopenharmony_ci/*
9368c2ecf20Sopenharmony_ci * TMPADJ register fields related constants
9378c2ecf20Sopenharmony_ci * @IDT_TMPADJ_OFFSET_MASK:	Temperature value offset field mask
9388c2ecf20Sopenharmony_ci * @IDT_TMPADJ_OFFSET_FLD:	Temperature value offset field offset
9398c2ecf20Sopenharmony_ci */
9408c2ecf20Sopenharmony_ci#define IDT_TMPADJ_OFFSET_MASK		0x000000FFU
9418c2ecf20Sopenharmony_ci#define IDT_TMPADJ_OFFSET_FLD		0
9428c2ecf20Sopenharmony_ci
9438c2ecf20Sopenharmony_ci/*
9448c2ecf20Sopenharmony_ci * Helper macro to get/set the corresponding field value
9458c2ecf20Sopenharmony_ci * @GET_FIELD:		Retrieve the value of the corresponding field
9468c2ecf20Sopenharmony_ci * @SET_FIELD:		Set the specified field up
9478c2ecf20Sopenharmony_ci * @IS_FLD_SET:		Check whether a field is set with value
9488c2ecf20Sopenharmony_ci */
9498c2ecf20Sopenharmony_ci#define GET_FIELD(field, data) \
9508c2ecf20Sopenharmony_ci	(((u32)(data) & IDT_ ##field## _MASK) >> IDT_ ##field## _FLD)
9518c2ecf20Sopenharmony_ci#define SET_FIELD(field, data, value) \
9528c2ecf20Sopenharmony_ci	(((u32)(data) & ~IDT_ ##field## _MASK) | \
9538c2ecf20Sopenharmony_ci	 ((u32)(value) << IDT_ ##field## _FLD))
9548c2ecf20Sopenharmony_ci#define IS_FLD_SET(field, data, value) \
9558c2ecf20Sopenharmony_ci	(((u32)(data) & IDT_ ##field## _MASK) == IDT_ ##field## _ ##value)
9568c2ecf20Sopenharmony_ci
9578c2ecf20Sopenharmony_ci/*
9588c2ecf20Sopenharmony_ci * Useful registers masks:
9598c2ecf20Sopenharmony_ci * @IDT_DBELL_MASK:	Doorbell bits mask
9608c2ecf20Sopenharmony_ci * @IDT_OUTMSG_MASK:	Out messages status bits mask
9618c2ecf20Sopenharmony_ci * @IDT_INMSG_MASK:	In messages status bits mask
9628c2ecf20Sopenharmony_ci * @IDT_MSG_MASK:	Any message status bits mask
9638c2ecf20Sopenharmony_ci */
9648c2ecf20Sopenharmony_ci#define IDT_DBELL_MASK		((u32)0xFFFFFFFFU)
9658c2ecf20Sopenharmony_ci#define IDT_OUTMSG_MASK		((u32)0x0000000FU)
9668c2ecf20Sopenharmony_ci#define IDT_INMSG_MASK		((u32)0x000F0000U)
9678c2ecf20Sopenharmony_ci#define IDT_MSG_MASK		(IDT_INMSG_MASK | IDT_OUTMSG_MASK)
9688c2ecf20Sopenharmony_ci
9698c2ecf20Sopenharmony_ci/*
9708c2ecf20Sopenharmony_ci * Number of IDT NTB resources:
9718c2ecf20Sopenharmony_ci * @IDT_MSG_CNT:	Number of Message registers
9728c2ecf20Sopenharmony_ci * @IDT_BAR_CNT:	Number of BARs of each port
9738c2ecf20Sopenharmony_ci * @IDT_MTBL_ENTRY_CNT:	Number mapping table entries
9748c2ecf20Sopenharmony_ci */
9758c2ecf20Sopenharmony_ci#define IDT_MSG_CNT		4
9768c2ecf20Sopenharmony_ci#define IDT_BAR_CNT		6
9778c2ecf20Sopenharmony_ci#define IDT_MTBL_ENTRY_CNT	64
9788c2ecf20Sopenharmony_ci
9798c2ecf20Sopenharmony_ci/*
9808c2ecf20Sopenharmony_ci * General IDT PCIe-switch constant
9818c2ecf20Sopenharmony_ci * @IDT_MAX_NR_PORTS:	Maximum number of ports per IDT PCIe-switch
9828c2ecf20Sopenharmony_ci * @IDT_MAX_NR_PARTS:	Maximum number of partitions per IDT PCIe-switch
9838c2ecf20Sopenharmony_ci * @IDT_MAX_NR_PEERS:	Maximum number of NT-peers per IDT PCIe-switch
9848c2ecf20Sopenharmony_ci * @IDT_MAX_NR_MWS:	Maximum number of Memory Widows
9858c2ecf20Sopenharmony_ci * @IDT_PCIE_REGSIZE:	Size of the registers in bytes
9868c2ecf20Sopenharmony_ci * @IDT_TRANS_ALIGN:	Alignment of translated base address
9878c2ecf20Sopenharmony_ci * @IDT_DIR_SIZE_ALIGN:	Alignment of size setting for direct translated MWs.
9888c2ecf20Sopenharmony_ci *			Even though the lower 10 bits are reserved, they are
9898c2ecf20Sopenharmony_ci *			treated by IDT as one's so basically there is no any
9908c2ecf20Sopenharmony_ci *			alignment of size limit for DIR address translation.
9918c2ecf20Sopenharmony_ci */
9928c2ecf20Sopenharmony_ci#define IDT_MAX_NR_PORTS	24
9938c2ecf20Sopenharmony_ci#define IDT_MAX_NR_PARTS	8
9948c2ecf20Sopenharmony_ci#define IDT_MAX_NR_PEERS	8
9958c2ecf20Sopenharmony_ci#define IDT_MAX_NR_MWS		29
9968c2ecf20Sopenharmony_ci#define IDT_PCIE_REGSIZE	4
9978c2ecf20Sopenharmony_ci#define IDT_TRANS_ALIGN		4
9988c2ecf20Sopenharmony_ci#define IDT_DIR_SIZE_ALIGN	1
9998c2ecf20Sopenharmony_ci
10008c2ecf20Sopenharmony_ci/*
10018c2ecf20Sopenharmony_ci * IDT PCIe-switch temperature sensor value limits
10028c2ecf20Sopenharmony_ci * @IDT_TEMP_MIN_MDEG:	Minimal integer value of temperature
10038c2ecf20Sopenharmony_ci * @IDT_TEMP_MAX_MDEG:	Maximal integer value of temperature
10048c2ecf20Sopenharmony_ci * @IDT_TEMP_MIN_OFFSET:Minimal integer value of temperature offset
10058c2ecf20Sopenharmony_ci * @IDT_TEMP_MAX_OFFSET:Maximal integer value of temperature offset
10068c2ecf20Sopenharmony_ci */
10078c2ecf20Sopenharmony_ci#define IDT_TEMP_MIN_MDEG	0
10088c2ecf20Sopenharmony_ci#define IDT_TEMP_MAX_MDEG	127500
10098c2ecf20Sopenharmony_ci#define IDT_TEMP_MIN_OFFSET	-64000
10108c2ecf20Sopenharmony_ci#define IDT_TEMP_MAX_OFFSET	63500
10118c2ecf20Sopenharmony_ci
10128c2ecf20Sopenharmony_ci/*
10138c2ecf20Sopenharmony_ci * Temperature sensor values enumeration
10148c2ecf20Sopenharmony_ci * @IDT_TEMP_CUR:	Current temperature
10158c2ecf20Sopenharmony_ci * @IDT_TEMP_LOW:	Lowest historical temperature
10168c2ecf20Sopenharmony_ci * @IDT_TEMP_HIGH:	Highest historical temperature
10178c2ecf20Sopenharmony_ci * @IDT_TEMP_OFFSET:	Current temperature offset
10188c2ecf20Sopenharmony_ci */
10198c2ecf20Sopenharmony_cienum idt_temp_val {
10208c2ecf20Sopenharmony_ci	IDT_TEMP_CUR,
10218c2ecf20Sopenharmony_ci	IDT_TEMP_LOW,
10228c2ecf20Sopenharmony_ci	IDT_TEMP_HIGH,
10238c2ecf20Sopenharmony_ci	IDT_TEMP_OFFSET
10248c2ecf20Sopenharmony_ci};
10258c2ecf20Sopenharmony_ci
10268c2ecf20Sopenharmony_ci/*
10278c2ecf20Sopenharmony_ci * IDT Memory Windows type. Depending on the device settings, IDT supports
10288c2ecf20Sopenharmony_ci * Direct Address Translation MW registers and Lookup Table registers
10298c2ecf20Sopenharmony_ci * @IDT_MW_DIR:		Direct address translation
10308c2ecf20Sopenharmony_ci * @IDT_MW_LUT12:	12-entry lookup table entry
10318c2ecf20Sopenharmony_ci * @IDT_MW_LUT24:	24-entry lookup table entry
10328c2ecf20Sopenharmony_ci *
10338c2ecf20Sopenharmony_ci * NOTE These values are exactly the same as one of the BARSETUP ATRAN field
10348c2ecf20Sopenharmony_ci */
10358c2ecf20Sopenharmony_cienum idt_mw_type {
10368c2ecf20Sopenharmony_ci	IDT_MW_DIR = 0x0,
10378c2ecf20Sopenharmony_ci	IDT_MW_LUT12 = 0x1,
10388c2ecf20Sopenharmony_ci	IDT_MW_LUT24 = 0x2
10398c2ecf20Sopenharmony_ci};
10408c2ecf20Sopenharmony_ci
10418c2ecf20Sopenharmony_ci/*
10428c2ecf20Sopenharmony_ci * IDT PCIe-switch model private data
10438c2ecf20Sopenharmony_ci * @name:	Device name
10448c2ecf20Sopenharmony_ci * @port_cnt:	Total number of NT endpoint ports
10458c2ecf20Sopenharmony_ci * @ports:	Port ids
10468c2ecf20Sopenharmony_ci */
10478c2ecf20Sopenharmony_cistruct idt_89hpes_cfg {
10488c2ecf20Sopenharmony_ci	char *name;
10498c2ecf20Sopenharmony_ci	unsigned char port_cnt;
10508c2ecf20Sopenharmony_ci	unsigned char ports[];
10518c2ecf20Sopenharmony_ci};
10528c2ecf20Sopenharmony_ci
10538c2ecf20Sopenharmony_ci/*
10548c2ecf20Sopenharmony_ci * Memory window configuration structure
10558c2ecf20Sopenharmony_ci * @type:	Type of the memory window (direct address translation or lookup
10568c2ecf20Sopenharmony_ci *		table)
10578c2ecf20Sopenharmony_ci *
10588c2ecf20Sopenharmony_ci * @bar:	PCIe BAR the memory window referenced to
10598c2ecf20Sopenharmony_ci * @idx:	Index of the memory window within the BAR
10608c2ecf20Sopenharmony_ci *
10618c2ecf20Sopenharmony_ci * @addr_align:	Alignment of translated address
10628c2ecf20Sopenharmony_ci * @size_align:	Alignment of memory window size
10638c2ecf20Sopenharmony_ci * @size_max:	Maximum size of memory window
10648c2ecf20Sopenharmony_ci */
10658c2ecf20Sopenharmony_cistruct idt_mw_cfg {
10668c2ecf20Sopenharmony_ci	enum idt_mw_type type;
10678c2ecf20Sopenharmony_ci
10688c2ecf20Sopenharmony_ci	unsigned char bar;
10698c2ecf20Sopenharmony_ci	unsigned char idx;
10708c2ecf20Sopenharmony_ci
10718c2ecf20Sopenharmony_ci	u64 addr_align;
10728c2ecf20Sopenharmony_ci	u64 size_align;
10738c2ecf20Sopenharmony_ci	u64 size_max;
10748c2ecf20Sopenharmony_ci};
10758c2ecf20Sopenharmony_ci
10768c2ecf20Sopenharmony_ci/*
10778c2ecf20Sopenharmony_ci * Description structure of peer IDT NT-functions:
10788c2ecf20Sopenharmony_ci * @port:		NT-function port
10798c2ecf20Sopenharmony_ci * @part:		NT-function partition
10808c2ecf20Sopenharmony_ci *
10818c2ecf20Sopenharmony_ci * @mw_cnt:		Number of memory windows supported by NT-function
10828c2ecf20Sopenharmony_ci * @mws:		Array of memory windows descriptors
10838c2ecf20Sopenharmony_ci */
10848c2ecf20Sopenharmony_cistruct idt_ntb_peer {
10858c2ecf20Sopenharmony_ci	unsigned char port;
10868c2ecf20Sopenharmony_ci	unsigned char part;
10878c2ecf20Sopenharmony_ci
10888c2ecf20Sopenharmony_ci	unsigned char mw_cnt;
10898c2ecf20Sopenharmony_ci	struct idt_mw_cfg *mws;
10908c2ecf20Sopenharmony_ci};
10918c2ecf20Sopenharmony_ci
10928c2ecf20Sopenharmony_ci/*
10938c2ecf20Sopenharmony_ci * Description structure of local IDT NT-function:
10948c2ecf20Sopenharmony_ci * @ntb:		Linux NTB-device description structure
10958c2ecf20Sopenharmony_ci * @swcfg:		Pointer to the structure of local IDT PCIe-switch
10968c2ecf20Sopenharmony_ci *			specific cofnfigurations
10978c2ecf20Sopenharmony_ci *
10988c2ecf20Sopenharmony_ci * @port:		Local NT-function port
10998c2ecf20Sopenharmony_ci * @part:		Local NT-function partition
11008c2ecf20Sopenharmony_ci *
11018c2ecf20Sopenharmony_ci * @peer_cnt:		Number of peers with activated NTB-function
11028c2ecf20Sopenharmony_ci * @peers:		Array of peers descripting structures
11038c2ecf20Sopenharmony_ci * @port_idx_map:	Map of port number -> peer index
11048c2ecf20Sopenharmony_ci * @part_idx_map:	Map of partition number -> peer index
11058c2ecf20Sopenharmony_ci *
11068c2ecf20Sopenharmony_ci * @mtbl_lock:		Mapping table access lock
11078c2ecf20Sopenharmony_ci *
11088c2ecf20Sopenharmony_ci * @mw_cnt:		Number of memory windows supported by NT-function
11098c2ecf20Sopenharmony_ci * @mws:		Array of memory windows descriptors
11108c2ecf20Sopenharmony_ci * @lut_lock:		Lookup table access lock
11118c2ecf20Sopenharmony_ci *
11128c2ecf20Sopenharmony_ci * @msg_locks:		Message registers mapping table lockers
11138c2ecf20Sopenharmony_ci *
11148c2ecf20Sopenharmony_ci * @cfgspc:		Virtual address of the memory mapped configuration
11158c2ecf20Sopenharmony_ci *			space of the NT-function
11168c2ecf20Sopenharmony_ci * @db_mask_lock:	Doorbell mask register lock
11178c2ecf20Sopenharmony_ci * @msg_mask_lock:	Message mask register lock
11188c2ecf20Sopenharmony_ci * @gasa_lock:		GASA registers access lock
11198c2ecf20Sopenharmony_ci *
11208c2ecf20Sopenharmony_ci * @hwmon_mtx:		Temperature sensor interface update mutex
11218c2ecf20Sopenharmony_ci *
11228c2ecf20Sopenharmony_ci * @dbgfs_info:		DebugFS info node
11238c2ecf20Sopenharmony_ci */
11248c2ecf20Sopenharmony_cistruct idt_ntb_dev {
11258c2ecf20Sopenharmony_ci	struct ntb_dev ntb;
11268c2ecf20Sopenharmony_ci	struct idt_89hpes_cfg *swcfg;
11278c2ecf20Sopenharmony_ci
11288c2ecf20Sopenharmony_ci	unsigned char port;
11298c2ecf20Sopenharmony_ci	unsigned char part;
11308c2ecf20Sopenharmony_ci
11318c2ecf20Sopenharmony_ci	unsigned char peer_cnt;
11328c2ecf20Sopenharmony_ci	struct idt_ntb_peer peers[IDT_MAX_NR_PEERS];
11338c2ecf20Sopenharmony_ci	char port_idx_map[IDT_MAX_NR_PORTS];
11348c2ecf20Sopenharmony_ci	char part_idx_map[IDT_MAX_NR_PARTS];
11358c2ecf20Sopenharmony_ci
11368c2ecf20Sopenharmony_ci	spinlock_t mtbl_lock;
11378c2ecf20Sopenharmony_ci
11388c2ecf20Sopenharmony_ci	unsigned char mw_cnt;
11398c2ecf20Sopenharmony_ci	struct idt_mw_cfg *mws;
11408c2ecf20Sopenharmony_ci	spinlock_t lut_lock;
11418c2ecf20Sopenharmony_ci
11428c2ecf20Sopenharmony_ci	spinlock_t msg_locks[IDT_MSG_CNT];
11438c2ecf20Sopenharmony_ci
11448c2ecf20Sopenharmony_ci	void __iomem *cfgspc;
11458c2ecf20Sopenharmony_ci	spinlock_t db_mask_lock;
11468c2ecf20Sopenharmony_ci	spinlock_t msg_mask_lock;
11478c2ecf20Sopenharmony_ci	spinlock_t gasa_lock;
11488c2ecf20Sopenharmony_ci
11498c2ecf20Sopenharmony_ci	struct mutex hwmon_mtx;
11508c2ecf20Sopenharmony_ci
11518c2ecf20Sopenharmony_ci	struct dentry *dbgfs_info;
11528c2ecf20Sopenharmony_ci};
11538c2ecf20Sopenharmony_ci#define to_ndev_ntb(__ntb) container_of(__ntb, struct idt_ntb_dev, ntb)
11548c2ecf20Sopenharmony_ci
11558c2ecf20Sopenharmony_ci/*
11568c2ecf20Sopenharmony_ci * Descriptor of the IDT PCIe-switch BAR resources
11578c2ecf20Sopenharmony_ci * @setup:	BAR setup register
11588c2ecf20Sopenharmony_ci * @limit:	BAR limit register
11598c2ecf20Sopenharmony_ci * @ltbase:	Lower translated base address
11608c2ecf20Sopenharmony_ci * @utbase:	Upper translated base address
11618c2ecf20Sopenharmony_ci */
11628c2ecf20Sopenharmony_cistruct idt_ntb_bar {
11638c2ecf20Sopenharmony_ci	unsigned int setup;
11648c2ecf20Sopenharmony_ci	unsigned int limit;
11658c2ecf20Sopenharmony_ci	unsigned int ltbase;
11668c2ecf20Sopenharmony_ci	unsigned int utbase;
11678c2ecf20Sopenharmony_ci};
11688c2ecf20Sopenharmony_ci
11698c2ecf20Sopenharmony_ci/*
11708c2ecf20Sopenharmony_ci * Descriptor of the IDT PCIe-switch message resources
11718c2ecf20Sopenharmony_ci * @in:		Inbound message register
11728c2ecf20Sopenharmony_ci * @out:	Outbound message register
11738c2ecf20Sopenharmony_ci * @src:	Source of inbound message register
11748c2ecf20Sopenharmony_ci */
11758c2ecf20Sopenharmony_cistruct idt_ntb_msg {
11768c2ecf20Sopenharmony_ci	unsigned int in;
11778c2ecf20Sopenharmony_ci	unsigned int out;
11788c2ecf20Sopenharmony_ci	unsigned int src;
11798c2ecf20Sopenharmony_ci};
11808c2ecf20Sopenharmony_ci
11818c2ecf20Sopenharmony_ci/*
11828c2ecf20Sopenharmony_ci * Descriptor of the IDT PCIe-switch NT-function specific parameters in the
11838c2ecf20Sopenharmony_ci * PCI Configuration Space
11848c2ecf20Sopenharmony_ci * @bars:	BARs related registers
11858c2ecf20Sopenharmony_ci * @msgs:	Messaging related registers
11868c2ecf20Sopenharmony_ci */
11878c2ecf20Sopenharmony_cistruct idt_ntb_regs {
11888c2ecf20Sopenharmony_ci	struct idt_ntb_bar bars[IDT_BAR_CNT];
11898c2ecf20Sopenharmony_ci	struct idt_ntb_msg msgs[IDT_MSG_CNT];
11908c2ecf20Sopenharmony_ci};
11918c2ecf20Sopenharmony_ci
11928c2ecf20Sopenharmony_ci/*
11938c2ecf20Sopenharmony_ci * Descriptor of the IDT PCIe-switch port specific parameters in the
11948c2ecf20Sopenharmony_ci * Global Configuration Space
11958c2ecf20Sopenharmony_ci * @pcicmdsts:	 PCI command/status register
11968c2ecf20Sopenharmony_ci * @pcielctlsts: PCIe link control/status
11978c2ecf20Sopenharmony_ci *
11988c2ecf20Sopenharmony_ci * @ctl:	Port control register
11998c2ecf20Sopenharmony_ci * @sts:	Port status register
12008c2ecf20Sopenharmony_ci *
12018c2ecf20Sopenharmony_ci * @bars:	BARs related registers
12028c2ecf20Sopenharmony_ci */
12038c2ecf20Sopenharmony_cistruct idt_ntb_port {
12048c2ecf20Sopenharmony_ci	unsigned int pcicmdsts;
12058c2ecf20Sopenharmony_ci	unsigned int pcielctlsts;
12068c2ecf20Sopenharmony_ci	unsigned int ntctl;
12078c2ecf20Sopenharmony_ci
12088c2ecf20Sopenharmony_ci	unsigned int ctl;
12098c2ecf20Sopenharmony_ci	unsigned int sts;
12108c2ecf20Sopenharmony_ci
12118c2ecf20Sopenharmony_ci	struct idt_ntb_bar bars[IDT_BAR_CNT];
12128c2ecf20Sopenharmony_ci};
12138c2ecf20Sopenharmony_ci
12148c2ecf20Sopenharmony_ci/*
12158c2ecf20Sopenharmony_ci * Descriptor of the IDT PCIe-switch partition specific parameters.
12168c2ecf20Sopenharmony_ci * @ctl:	Partition control register in the Global Address Space
12178c2ecf20Sopenharmony_ci * @sts:	Partition status register in the Global Address Space
12188c2ecf20Sopenharmony_ci * @msgctl:	Messages control registers
12198c2ecf20Sopenharmony_ci */
12208c2ecf20Sopenharmony_cistruct idt_ntb_part {
12218c2ecf20Sopenharmony_ci	unsigned int ctl;
12228c2ecf20Sopenharmony_ci	unsigned int sts;
12238c2ecf20Sopenharmony_ci	unsigned int msgctl[IDT_MSG_CNT];
12248c2ecf20Sopenharmony_ci};
12258c2ecf20Sopenharmony_ci
12268c2ecf20Sopenharmony_ci#endif /* NTB_HW_IDT_H */
1227