162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci *   This file is provided under a GPLv2 license.  When using or
362306a36Sopenharmony_ci *   redistributing this file, you may do so under that license.
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci *   GPL LICENSE SUMMARY
662306a36Sopenharmony_ci *
762306a36Sopenharmony_ci *   Copyright (C) 2016-2018 T-Platforms JSC All Rights Reserved.
862306a36Sopenharmony_ci *
962306a36Sopenharmony_ci *   This program is free software; you can redistribute it and/or modify it
1062306a36Sopenharmony_ci *   under the terms and conditions of the GNU General Public License,
1162306a36Sopenharmony_ci *   version 2, as published by the Free Software Foundation.
1262306a36Sopenharmony_ci *
1362306a36Sopenharmony_ci *   This program is distributed in the hope that it will be useful, but
1462306a36Sopenharmony_ci *   WITHOUT ANY WARRANTY; without even the implied warranty of
1562306a36Sopenharmony_ci *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
1662306a36Sopenharmony_ci *   Public License for more details.
1762306a36Sopenharmony_ci *
1862306a36Sopenharmony_ci *   You should have received a copy of the GNU General Public License along
1962306a36Sopenharmony_ci *   with this program; if not, one can be found http://www.gnu.org/licenses/.
2062306a36Sopenharmony_ci *
2162306a36Sopenharmony_ci *   The full GNU General Public License is included in this distribution in
2262306a36Sopenharmony_ci *   the file called "COPYING".
2362306a36Sopenharmony_ci *
2462306a36Sopenharmony_ci *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2562306a36Sopenharmony_ci *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2662306a36Sopenharmony_ci *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2762306a36Sopenharmony_ci *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2862306a36Sopenharmony_ci *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2962306a36Sopenharmony_ci *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3062306a36Sopenharmony_ci *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3162306a36Sopenharmony_ci *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3262306a36Sopenharmony_ci *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3362306a36Sopenharmony_ci *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3462306a36Sopenharmony_ci *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3562306a36Sopenharmony_ci *
3662306a36Sopenharmony_ci * IDT PCIe-switch NTB Linux driver
3762306a36Sopenharmony_ci *
3862306a36Sopenharmony_ci * Contact Information:
3962306a36Sopenharmony_ci * Serge Semin <fancer.lancer@gmail.com>, <Sergey.Semin@t-platforms.ru>
4062306a36Sopenharmony_ci */
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_ci#ifndef NTB_HW_IDT_H
4362306a36Sopenharmony_ci#define NTB_HW_IDT_H
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ci#include <linux/types.h>
4662306a36Sopenharmony_ci#include <linux/pci.h>
4762306a36Sopenharmony_ci#include <linux/pci_ids.h>
4862306a36Sopenharmony_ci#include <linux/interrupt.h>
4962306a36Sopenharmony_ci#include <linux/spinlock.h>
5062306a36Sopenharmony_ci#include <linux/mutex.h>
5162306a36Sopenharmony_ci#include <linux/ntb.h>
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ci/*
5462306a36Sopenharmony_ci * Macro is used to create the struct pci_device_id that matches
5562306a36Sopenharmony_ci * the supported IDT PCIe-switches
5662306a36Sopenharmony_ci * @devname: Capitalized name of the particular device
5762306a36Sopenharmony_ci * @data: Variable passed to the driver of the particular device
5862306a36Sopenharmony_ci */
5962306a36Sopenharmony_ci#define IDT_PCI_DEVICE_IDS(devname, data) \
6062306a36Sopenharmony_ci	.vendor = PCI_VENDOR_ID_IDT, .device = PCI_DEVICE_ID_IDT_##devname, \
6162306a36Sopenharmony_ci	.subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, \
6262306a36Sopenharmony_ci	.class = (PCI_CLASS_BRIDGE_OTHER << 8), .class_mask = (0xFFFF00), \
6362306a36Sopenharmony_ci	.driver_data = (kernel_ulong_t)&data
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ci/*
6662306a36Sopenharmony_ci * IDT PCIe-switches device IDs
6762306a36Sopenharmony_ci */
6862306a36Sopenharmony_ci#define PCI_DEVICE_ID_IDT_89HPES24NT6AG2  0x8091
6962306a36Sopenharmony_ci#define PCI_DEVICE_ID_IDT_89HPES32NT8AG2  0x808F
7062306a36Sopenharmony_ci#define PCI_DEVICE_ID_IDT_89HPES32NT8BG2  0x8088
7162306a36Sopenharmony_ci#define PCI_DEVICE_ID_IDT_89HPES12NT12G2  0x8092
7262306a36Sopenharmony_ci#define PCI_DEVICE_ID_IDT_89HPES16NT16G2  0x8090
7362306a36Sopenharmony_ci#define PCI_DEVICE_ID_IDT_89HPES24NT24G2  0x808E
7462306a36Sopenharmony_ci#define PCI_DEVICE_ID_IDT_89HPES32NT24AG2 0x808C
7562306a36Sopenharmony_ci#define PCI_DEVICE_ID_IDT_89HPES32NT24BG2 0x808A
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_ci/*
7862306a36Sopenharmony_ci * NT-function Configuration Space registers
7962306a36Sopenharmony_ci * NOTE 1) The IDT PCIe-switch internal data is little-endian
8062306a36Sopenharmony_ci *      so it must be taken into account in the driver
8162306a36Sopenharmony_ci *      internals.
8262306a36Sopenharmony_ci *      2) Additionally the registers should be accessed either
8362306a36Sopenharmony_ci *      with byte-enables corresponding to their native size or
8462306a36Sopenharmony_ci *      the size of one DWORD
8562306a36Sopenharmony_ci *
8662306a36Sopenharmony_ci * So to simplify the driver code, there is only DWORD-sized read/write
8762306a36Sopenharmony_ci * operations utilized.
8862306a36Sopenharmony_ci */
8962306a36Sopenharmony_ci/* PCI Express Configuration Space */
9062306a36Sopenharmony_ci/* PCI Express command/status register	(DWORD) */
9162306a36Sopenharmony_ci#define IDT_NT_PCICMDSTS		0x00004U
9262306a36Sopenharmony_ci/* PCI Express Device Capabilities	(DWORD) */
9362306a36Sopenharmony_ci#define IDT_NT_PCIEDCAP			0x00044U
9462306a36Sopenharmony_ci/* PCI Express Device Control/Status	(WORD+WORD) */
9562306a36Sopenharmony_ci#define IDT_NT_PCIEDCTLSTS		0x00048U
9662306a36Sopenharmony_ci/* PCI Express Link Capabilities	(DWORD) */
9762306a36Sopenharmony_ci#define IDT_NT_PCIELCAP			0x0004CU
9862306a36Sopenharmony_ci/* PCI Express Link Control/Status	(WORD+WORD) */
9962306a36Sopenharmony_ci#define IDT_NT_PCIELCTLSTS		0x00050U
10062306a36Sopenharmony_ci/* PCI Express Device Capabilities 2	(DWORD) */
10162306a36Sopenharmony_ci#define IDT_NT_PCIEDCAP2		0x00064U
10262306a36Sopenharmony_ci/* PCI Express Device Control 2		(WORD+WORD) */
10362306a36Sopenharmony_ci#define IDT_NT_PCIEDCTL2		0x00068U
10462306a36Sopenharmony_ci/* PCI Power Management Control and Status (DWORD) */
10562306a36Sopenharmony_ci#define IDT_NT_PMCSR			0x000C4U
10662306a36Sopenharmony_ci/*==========================================*/
10762306a36Sopenharmony_ci/* IDT Proprietary NT-port-specific registers */
10862306a36Sopenharmony_ci/* NT-function main control registers */
10962306a36Sopenharmony_ci/* NT Endpoint Control			(DWORD) */
11062306a36Sopenharmony_ci#define IDT_NT_NTCTL			0x00400U
11162306a36Sopenharmony_ci/* NT Endpoint Interrupt Status/Mask	(DWORD) */
11262306a36Sopenharmony_ci#define IDT_NT_NTINTSTS			0x00404U
11362306a36Sopenharmony_ci#define IDT_NT_NTINTMSK			0x00408U
11462306a36Sopenharmony_ci/* NT Endpoint Signal Data		(DWORD) */
11562306a36Sopenharmony_ci#define IDT_NT_NTSDATA			0x0040CU
11662306a36Sopenharmony_ci/* NT Endpoint Global Signal		(DWORD) */
11762306a36Sopenharmony_ci#define IDT_NT_NTGSIGNAL		0x00410U
11862306a36Sopenharmony_ci/* Internal Error Reporting Mask 0/1	(DWORD) */
11962306a36Sopenharmony_ci#define IDT_NT_NTIERRORMSK0		0x00414U
12062306a36Sopenharmony_ci#define IDT_NT_NTIERRORMSK1		0x00418U
12162306a36Sopenharmony_ci/* Doorbel registers */
12262306a36Sopenharmony_ci/* NT Outbound Doorbell Set		(DWORD) */
12362306a36Sopenharmony_ci#define IDT_NT_OUTDBELLSET		0x00420U
12462306a36Sopenharmony_ci/* NT Inbound Doorbell Status/Mask	(DWORD) */
12562306a36Sopenharmony_ci#define IDT_NT_INDBELLSTS		0x00428U
12662306a36Sopenharmony_ci#define IDT_NT_INDBELLMSK		0x0042CU
12762306a36Sopenharmony_ci/* Message registers */
12862306a36Sopenharmony_ci/* Outbound Message N			(DWORD) */
12962306a36Sopenharmony_ci#define IDT_NT_OUTMSG0			0x00430U
13062306a36Sopenharmony_ci#define IDT_NT_OUTMSG1			0x00434U
13162306a36Sopenharmony_ci#define IDT_NT_OUTMSG2			0x00438U
13262306a36Sopenharmony_ci#define IDT_NT_OUTMSG3			0x0043CU
13362306a36Sopenharmony_ci/* Inbound Message N			(DWORD) */
13462306a36Sopenharmony_ci#define IDT_NT_INMSG0			0x00440U
13562306a36Sopenharmony_ci#define IDT_NT_INMSG1			0x00444U
13662306a36Sopenharmony_ci#define IDT_NT_INMSG2			0x00448U
13762306a36Sopenharmony_ci#define IDT_NT_INMSG3			0x0044CU
13862306a36Sopenharmony_ci/* Inbound Message Source N		(DWORD) */
13962306a36Sopenharmony_ci#define IDT_NT_INMSGSRC0		0x00450U
14062306a36Sopenharmony_ci#define IDT_NT_INMSGSRC1		0x00454U
14162306a36Sopenharmony_ci#define IDT_NT_INMSGSRC2		0x00458U
14262306a36Sopenharmony_ci#define IDT_NT_INMSGSRC3		0x0045CU
14362306a36Sopenharmony_ci/* Message Status			(DWORD) */
14462306a36Sopenharmony_ci#define IDT_NT_MSGSTS			0x00460U
14562306a36Sopenharmony_ci/* Message Status Mask			(DWORD) */
14662306a36Sopenharmony_ci#define IDT_NT_MSGSTSMSK		0x00464U
14762306a36Sopenharmony_ci/* BAR-setup registers */
14862306a36Sopenharmony_ci/* BAR N Setup/Limit Address/Lower and Upper Translated Base Address (DWORD) */
14962306a36Sopenharmony_ci#define IDT_NT_BARSETUP0		0x00470U
15062306a36Sopenharmony_ci#define IDT_NT_BARLIMIT0		0x00474U
15162306a36Sopenharmony_ci#define IDT_NT_BARLTBASE0		0x00478U
15262306a36Sopenharmony_ci#define IDT_NT_BARUTBASE0		0x0047CU
15362306a36Sopenharmony_ci#define IDT_NT_BARSETUP1		0x00480U
15462306a36Sopenharmony_ci#define IDT_NT_BARLIMIT1		0x00484U
15562306a36Sopenharmony_ci#define IDT_NT_BARLTBASE1		0x00488U
15662306a36Sopenharmony_ci#define IDT_NT_BARUTBASE1		0x0048CU
15762306a36Sopenharmony_ci#define IDT_NT_BARSETUP2		0x00490U
15862306a36Sopenharmony_ci#define IDT_NT_BARLIMIT2		0x00494U
15962306a36Sopenharmony_ci#define IDT_NT_BARLTBASE2		0x00498U
16062306a36Sopenharmony_ci#define IDT_NT_BARUTBASE2		0x0049CU
16162306a36Sopenharmony_ci#define IDT_NT_BARSETUP3		0x004A0U
16262306a36Sopenharmony_ci#define IDT_NT_BARLIMIT3		0x004A4U
16362306a36Sopenharmony_ci#define IDT_NT_BARLTBASE3		0x004A8U
16462306a36Sopenharmony_ci#define IDT_NT_BARUTBASE3		0x004ACU
16562306a36Sopenharmony_ci#define IDT_NT_BARSETUP4		0x004B0U
16662306a36Sopenharmony_ci#define IDT_NT_BARLIMIT4		0x004B4U
16762306a36Sopenharmony_ci#define IDT_NT_BARLTBASE4		0x004B8U
16862306a36Sopenharmony_ci#define IDT_NT_BARUTBASE4		0x004BCU
16962306a36Sopenharmony_ci#define IDT_NT_BARSETUP5		0x004C0U
17062306a36Sopenharmony_ci#define IDT_NT_BARLIMIT5		0x004C4U
17162306a36Sopenharmony_ci#define IDT_NT_BARLTBASE5		0x004C8U
17262306a36Sopenharmony_ci#define IDT_NT_BARUTBASE5		0x004CCU
17362306a36Sopenharmony_ci/* NT mapping table registers */
17462306a36Sopenharmony_ci/* NT Mapping Table Address/Status/Data	(DWORD) */
17562306a36Sopenharmony_ci#define IDT_NT_NTMTBLADDR		0x004D0U
17662306a36Sopenharmony_ci#define IDT_NT_NTMTBLSTS		0x004D4U
17762306a36Sopenharmony_ci#define IDT_NT_NTMTBLDATA		0x004D8U
17862306a36Sopenharmony_ci/* Requester ID (Bus:Device:Function) Capture	(DWORD) */
17962306a36Sopenharmony_ci#define IDT_NT_REQIDCAP			0x004DCU
18062306a36Sopenharmony_ci/* Memory Windows Lookup table registers */
18162306a36Sopenharmony_ci/* Lookup Table Offset/Lower, Middle and Upper data	(DWORD) */
18262306a36Sopenharmony_ci#define IDT_NT_LUTOFFSET		0x004E0U
18362306a36Sopenharmony_ci#define IDT_NT_LUTLDATA			0x004E4U
18462306a36Sopenharmony_ci#define IDT_NT_LUTMDATA			0x004E8U
18562306a36Sopenharmony_ci#define IDT_NT_LUTUDATA			0x004ECU
18662306a36Sopenharmony_ci/* NT Endpoint Uncorrectable/Correctable Errors Emulation registers (DWORD) */
18762306a36Sopenharmony_ci#define IDT_NT_NTUEEM			0x004F0U
18862306a36Sopenharmony_ci#define IDT_NT_NTCEEM			0x004F4U
18962306a36Sopenharmony_ci/* Global Address Space Access/Data registers	(DWARD) */
19062306a36Sopenharmony_ci#define IDT_NT_GASAADDR			0x00FF8U
19162306a36Sopenharmony_ci#define IDT_NT_GASADATA			0x00FFCU
19262306a36Sopenharmony_ci
19362306a36Sopenharmony_ci/*
19462306a36Sopenharmony_ci * IDT PCIe-switch Global Configuration and Status registers
19562306a36Sopenharmony_ci */
19662306a36Sopenharmony_ci/* Port N Configuration register in global space */
19762306a36Sopenharmony_ci/* PCI Express command/status and link control/status registers (WORD+WORD) */
19862306a36Sopenharmony_ci#define IDT_SW_NTP0_PCIECMDSTS		0x01004U
19962306a36Sopenharmony_ci#define IDT_SW_NTP0_PCIELCTLSTS		0x01050U
20062306a36Sopenharmony_ci/* NT-function control register		(DWORD) */
20162306a36Sopenharmony_ci#define IDT_SW_NTP0_NTCTL		0x01400U
20262306a36Sopenharmony_ci/* BAR setup/limit/base address registers (DWORD) */
20362306a36Sopenharmony_ci#define IDT_SW_NTP0_BARSETUP0		0x01470U
20462306a36Sopenharmony_ci#define IDT_SW_NTP0_BARLIMIT0		0x01474U
20562306a36Sopenharmony_ci#define IDT_SW_NTP0_BARLTBASE0		0x01478U
20662306a36Sopenharmony_ci#define IDT_SW_NTP0_BARUTBASE0		0x0147CU
20762306a36Sopenharmony_ci#define IDT_SW_NTP0_BARSETUP1		0x01480U
20862306a36Sopenharmony_ci#define IDT_SW_NTP0_BARLIMIT1		0x01484U
20962306a36Sopenharmony_ci#define IDT_SW_NTP0_BARLTBASE1		0x01488U
21062306a36Sopenharmony_ci#define IDT_SW_NTP0_BARUTBASE1		0x0148CU
21162306a36Sopenharmony_ci#define IDT_SW_NTP0_BARSETUP2		0x01490U
21262306a36Sopenharmony_ci#define IDT_SW_NTP0_BARLIMIT2		0x01494U
21362306a36Sopenharmony_ci#define IDT_SW_NTP0_BARLTBASE2		0x01498U
21462306a36Sopenharmony_ci#define IDT_SW_NTP0_BARUTBASE2		0x0149CU
21562306a36Sopenharmony_ci#define IDT_SW_NTP0_BARSETUP3		0x014A0U
21662306a36Sopenharmony_ci#define IDT_SW_NTP0_BARLIMIT3		0x014A4U
21762306a36Sopenharmony_ci#define IDT_SW_NTP0_BARLTBASE3		0x014A8U
21862306a36Sopenharmony_ci#define IDT_SW_NTP0_BARUTBASE3		0x014ACU
21962306a36Sopenharmony_ci#define IDT_SW_NTP0_BARSETUP4		0x014B0U
22062306a36Sopenharmony_ci#define IDT_SW_NTP0_BARLIMIT4		0x014B4U
22162306a36Sopenharmony_ci#define IDT_SW_NTP0_BARLTBASE4		0x014B8U
22262306a36Sopenharmony_ci#define IDT_SW_NTP0_BARUTBASE4		0x014BCU
22362306a36Sopenharmony_ci#define IDT_SW_NTP0_BARSETUP5		0x014C0U
22462306a36Sopenharmony_ci#define IDT_SW_NTP0_BARLIMIT5		0x014C4U
22562306a36Sopenharmony_ci#define IDT_SW_NTP0_BARLTBASE5		0x014C8U
22662306a36Sopenharmony_ci#define IDT_SW_NTP0_BARUTBASE5		0x014CCU
22762306a36Sopenharmony_ci/* PCI Express command/status and link control/status registers (WORD+WORD) */
22862306a36Sopenharmony_ci#define IDT_SW_NTP2_PCIECMDSTS		0x05004U
22962306a36Sopenharmony_ci#define IDT_SW_NTP2_PCIELCTLSTS		0x05050U
23062306a36Sopenharmony_ci/* NT-function control register		(DWORD) */
23162306a36Sopenharmony_ci#define IDT_SW_NTP2_NTCTL		0x05400U
23262306a36Sopenharmony_ci/* BAR setup/limit/base address registers (DWORD) */
23362306a36Sopenharmony_ci#define IDT_SW_NTP2_BARSETUP0		0x05470U
23462306a36Sopenharmony_ci#define IDT_SW_NTP2_BARLIMIT0		0x05474U
23562306a36Sopenharmony_ci#define IDT_SW_NTP2_BARLTBASE0		0x05478U
23662306a36Sopenharmony_ci#define IDT_SW_NTP2_BARUTBASE0		0x0547CU
23762306a36Sopenharmony_ci#define IDT_SW_NTP2_BARSETUP1		0x05480U
23862306a36Sopenharmony_ci#define IDT_SW_NTP2_BARLIMIT1		0x05484U
23962306a36Sopenharmony_ci#define IDT_SW_NTP2_BARLTBASE1		0x05488U
24062306a36Sopenharmony_ci#define IDT_SW_NTP2_BARUTBASE1		0x0548CU
24162306a36Sopenharmony_ci#define IDT_SW_NTP2_BARSETUP2		0x05490U
24262306a36Sopenharmony_ci#define IDT_SW_NTP2_BARLIMIT2		0x05494U
24362306a36Sopenharmony_ci#define IDT_SW_NTP2_BARLTBASE2		0x05498U
24462306a36Sopenharmony_ci#define IDT_SW_NTP2_BARUTBASE2		0x0549CU
24562306a36Sopenharmony_ci#define IDT_SW_NTP2_BARSETUP3		0x054A0U
24662306a36Sopenharmony_ci#define IDT_SW_NTP2_BARLIMIT3		0x054A4U
24762306a36Sopenharmony_ci#define IDT_SW_NTP2_BARLTBASE3		0x054A8U
24862306a36Sopenharmony_ci#define IDT_SW_NTP2_BARUTBASE3		0x054ACU
24962306a36Sopenharmony_ci#define IDT_SW_NTP2_BARSETUP4		0x054B0U
25062306a36Sopenharmony_ci#define IDT_SW_NTP2_BARLIMIT4		0x054B4U
25162306a36Sopenharmony_ci#define IDT_SW_NTP2_BARLTBASE4		0x054B8U
25262306a36Sopenharmony_ci#define IDT_SW_NTP2_BARUTBASE4		0x054BCU
25362306a36Sopenharmony_ci#define IDT_SW_NTP2_BARSETUP5		0x054C0U
25462306a36Sopenharmony_ci#define IDT_SW_NTP2_BARLIMIT5		0x054C4U
25562306a36Sopenharmony_ci#define IDT_SW_NTP2_BARLTBASE5		0x054C8U
25662306a36Sopenharmony_ci#define IDT_SW_NTP2_BARUTBASE5		0x054CCU
25762306a36Sopenharmony_ci/* PCI Express command/status and link control/status registers (WORD+WORD) */
25862306a36Sopenharmony_ci#define IDT_SW_NTP4_PCIECMDSTS		0x09004U
25962306a36Sopenharmony_ci#define IDT_SW_NTP4_PCIELCTLSTS		0x09050U
26062306a36Sopenharmony_ci/* NT-function control register		(DWORD) */
26162306a36Sopenharmony_ci#define IDT_SW_NTP4_NTCTL		0x09400U
26262306a36Sopenharmony_ci/* BAR setup/limit/base address registers (DWORD) */
26362306a36Sopenharmony_ci#define IDT_SW_NTP4_BARSETUP0		0x09470U
26462306a36Sopenharmony_ci#define IDT_SW_NTP4_BARLIMIT0		0x09474U
26562306a36Sopenharmony_ci#define IDT_SW_NTP4_BARLTBASE0		0x09478U
26662306a36Sopenharmony_ci#define IDT_SW_NTP4_BARUTBASE0		0x0947CU
26762306a36Sopenharmony_ci#define IDT_SW_NTP4_BARSETUP1		0x09480U
26862306a36Sopenharmony_ci#define IDT_SW_NTP4_BARLIMIT1		0x09484U
26962306a36Sopenharmony_ci#define IDT_SW_NTP4_BARLTBASE1		0x09488U
27062306a36Sopenharmony_ci#define IDT_SW_NTP4_BARUTBASE1		0x0948CU
27162306a36Sopenharmony_ci#define IDT_SW_NTP4_BARSETUP2		0x09490U
27262306a36Sopenharmony_ci#define IDT_SW_NTP4_BARLIMIT2		0x09494U
27362306a36Sopenharmony_ci#define IDT_SW_NTP4_BARLTBASE2		0x09498U
27462306a36Sopenharmony_ci#define IDT_SW_NTP4_BARUTBASE2		0x0949CU
27562306a36Sopenharmony_ci#define IDT_SW_NTP4_BARSETUP3		0x094A0U
27662306a36Sopenharmony_ci#define IDT_SW_NTP4_BARLIMIT3		0x094A4U
27762306a36Sopenharmony_ci#define IDT_SW_NTP4_BARLTBASE3		0x094A8U
27862306a36Sopenharmony_ci#define IDT_SW_NTP4_BARUTBASE3		0x094ACU
27962306a36Sopenharmony_ci#define IDT_SW_NTP4_BARSETUP4		0x094B0U
28062306a36Sopenharmony_ci#define IDT_SW_NTP4_BARLIMIT4		0x094B4U
28162306a36Sopenharmony_ci#define IDT_SW_NTP4_BARLTBASE4		0x094B8U
28262306a36Sopenharmony_ci#define IDT_SW_NTP4_BARUTBASE4		0x094BCU
28362306a36Sopenharmony_ci#define IDT_SW_NTP4_BARSETUP5		0x094C0U
28462306a36Sopenharmony_ci#define IDT_SW_NTP4_BARLIMIT5		0x094C4U
28562306a36Sopenharmony_ci#define IDT_SW_NTP4_BARLTBASE5		0x094C8U
28662306a36Sopenharmony_ci#define IDT_SW_NTP4_BARUTBASE5		0x094CCU
28762306a36Sopenharmony_ci/* PCI Express command/status and link control/status registers (WORD+WORD) */
28862306a36Sopenharmony_ci#define IDT_SW_NTP6_PCIECMDSTS		0x0D004U
28962306a36Sopenharmony_ci#define IDT_SW_NTP6_PCIELCTLSTS		0x0D050U
29062306a36Sopenharmony_ci/* NT-function control register		(DWORD) */
29162306a36Sopenharmony_ci#define IDT_SW_NTP6_NTCTL		0x0D400U
29262306a36Sopenharmony_ci/* BAR setup/limit/base address registers (DWORD) */
29362306a36Sopenharmony_ci#define IDT_SW_NTP6_BARSETUP0		0x0D470U
29462306a36Sopenharmony_ci#define IDT_SW_NTP6_BARLIMIT0		0x0D474U
29562306a36Sopenharmony_ci#define IDT_SW_NTP6_BARLTBASE0		0x0D478U
29662306a36Sopenharmony_ci#define IDT_SW_NTP6_BARUTBASE0		0x0D47CU
29762306a36Sopenharmony_ci#define IDT_SW_NTP6_BARSETUP1		0x0D480U
29862306a36Sopenharmony_ci#define IDT_SW_NTP6_BARLIMIT1		0x0D484U
29962306a36Sopenharmony_ci#define IDT_SW_NTP6_BARLTBASE1		0x0D488U
30062306a36Sopenharmony_ci#define IDT_SW_NTP6_BARUTBASE1		0x0D48CU
30162306a36Sopenharmony_ci#define IDT_SW_NTP6_BARSETUP2		0x0D490U
30262306a36Sopenharmony_ci#define IDT_SW_NTP6_BARLIMIT2		0x0D494U
30362306a36Sopenharmony_ci#define IDT_SW_NTP6_BARLTBASE2		0x0D498U
30462306a36Sopenharmony_ci#define IDT_SW_NTP6_BARUTBASE2		0x0D49CU
30562306a36Sopenharmony_ci#define IDT_SW_NTP6_BARSETUP3		0x0D4A0U
30662306a36Sopenharmony_ci#define IDT_SW_NTP6_BARLIMIT3		0x0D4A4U
30762306a36Sopenharmony_ci#define IDT_SW_NTP6_BARLTBASE3		0x0D4A8U
30862306a36Sopenharmony_ci#define IDT_SW_NTP6_BARUTBASE3		0x0D4ACU
30962306a36Sopenharmony_ci#define IDT_SW_NTP6_BARSETUP4		0x0D4B0U
31062306a36Sopenharmony_ci#define IDT_SW_NTP6_BARLIMIT4		0x0D4B4U
31162306a36Sopenharmony_ci#define IDT_SW_NTP6_BARLTBASE4		0x0D4B8U
31262306a36Sopenharmony_ci#define IDT_SW_NTP6_BARUTBASE4		0x0D4BCU
31362306a36Sopenharmony_ci#define IDT_SW_NTP6_BARSETUP5		0x0D4C0U
31462306a36Sopenharmony_ci#define IDT_SW_NTP6_BARLIMIT5		0x0D4C4U
31562306a36Sopenharmony_ci#define IDT_SW_NTP6_BARLTBASE5		0x0D4C8U
31662306a36Sopenharmony_ci#define IDT_SW_NTP6_BARUTBASE5		0x0D4CCU
31762306a36Sopenharmony_ci/* PCI Express command/status and link control/status registers (WORD+WORD) */
31862306a36Sopenharmony_ci#define IDT_SW_NTP8_PCIECMDSTS		0x11004U
31962306a36Sopenharmony_ci#define IDT_SW_NTP8_PCIELCTLSTS		0x11050U
32062306a36Sopenharmony_ci/* NT-function control register		(DWORD) */
32162306a36Sopenharmony_ci#define IDT_SW_NTP8_NTCTL		0x11400U
32262306a36Sopenharmony_ci/* BAR setup/limit/base address registers (DWORD) */
32362306a36Sopenharmony_ci#define IDT_SW_NTP8_BARSETUP0		0x11470U
32462306a36Sopenharmony_ci#define IDT_SW_NTP8_BARLIMIT0		0x11474U
32562306a36Sopenharmony_ci#define IDT_SW_NTP8_BARLTBASE0		0x11478U
32662306a36Sopenharmony_ci#define IDT_SW_NTP8_BARUTBASE0		0x1147CU
32762306a36Sopenharmony_ci#define IDT_SW_NTP8_BARSETUP1		0x11480U
32862306a36Sopenharmony_ci#define IDT_SW_NTP8_BARLIMIT1		0x11484U
32962306a36Sopenharmony_ci#define IDT_SW_NTP8_BARLTBASE1		0x11488U
33062306a36Sopenharmony_ci#define IDT_SW_NTP8_BARUTBASE1		0x1148CU
33162306a36Sopenharmony_ci#define IDT_SW_NTP8_BARSETUP2		0x11490U
33262306a36Sopenharmony_ci#define IDT_SW_NTP8_BARLIMIT2		0x11494U
33362306a36Sopenharmony_ci#define IDT_SW_NTP8_BARLTBASE2		0x11498U
33462306a36Sopenharmony_ci#define IDT_SW_NTP8_BARUTBASE2		0x1149CU
33562306a36Sopenharmony_ci#define IDT_SW_NTP8_BARSETUP3		0x114A0U
33662306a36Sopenharmony_ci#define IDT_SW_NTP8_BARLIMIT3		0x114A4U
33762306a36Sopenharmony_ci#define IDT_SW_NTP8_BARLTBASE3		0x114A8U
33862306a36Sopenharmony_ci#define IDT_SW_NTP8_BARUTBASE3		0x114ACU
33962306a36Sopenharmony_ci#define IDT_SW_NTP8_BARSETUP4		0x114B0U
34062306a36Sopenharmony_ci#define IDT_SW_NTP8_BARLIMIT4		0x114B4U
34162306a36Sopenharmony_ci#define IDT_SW_NTP8_BARLTBASE4		0x114B8U
34262306a36Sopenharmony_ci#define IDT_SW_NTP8_BARUTBASE4		0x114BCU
34362306a36Sopenharmony_ci#define IDT_SW_NTP8_BARSETUP5		0x114C0U
34462306a36Sopenharmony_ci#define IDT_SW_NTP8_BARLIMIT5		0x114C4U
34562306a36Sopenharmony_ci#define IDT_SW_NTP8_BARLTBASE5		0x114C8U
34662306a36Sopenharmony_ci#define IDT_SW_NTP8_BARUTBASE5		0x114CCU
34762306a36Sopenharmony_ci/* PCI Express command/status and link control/status registers (WORD+WORD) */
34862306a36Sopenharmony_ci#define IDT_SW_NTP12_PCIECMDSTS		0x19004U
34962306a36Sopenharmony_ci#define IDT_SW_NTP12_PCIELCTLSTS	0x19050U
35062306a36Sopenharmony_ci/* NT-function control register		(DWORD) */
35162306a36Sopenharmony_ci#define IDT_SW_NTP12_NTCTL		0x19400U
35262306a36Sopenharmony_ci/* BAR setup/limit/base address registers (DWORD) */
35362306a36Sopenharmony_ci#define IDT_SW_NTP12_BARSETUP0		0x19470U
35462306a36Sopenharmony_ci#define IDT_SW_NTP12_BARLIMIT0		0x19474U
35562306a36Sopenharmony_ci#define IDT_SW_NTP12_BARLTBASE0		0x19478U
35662306a36Sopenharmony_ci#define IDT_SW_NTP12_BARUTBASE0		0x1947CU
35762306a36Sopenharmony_ci#define IDT_SW_NTP12_BARSETUP1		0x19480U
35862306a36Sopenharmony_ci#define IDT_SW_NTP12_BARLIMIT1		0x19484U
35962306a36Sopenharmony_ci#define IDT_SW_NTP12_BARLTBASE1		0x19488U
36062306a36Sopenharmony_ci#define IDT_SW_NTP12_BARUTBASE1		0x1948CU
36162306a36Sopenharmony_ci#define IDT_SW_NTP12_BARSETUP2		0x19490U
36262306a36Sopenharmony_ci#define IDT_SW_NTP12_BARLIMIT2		0x19494U
36362306a36Sopenharmony_ci#define IDT_SW_NTP12_BARLTBASE2		0x19498U
36462306a36Sopenharmony_ci#define IDT_SW_NTP12_BARUTBASE2		0x1949CU
36562306a36Sopenharmony_ci#define IDT_SW_NTP12_BARSETUP3		0x194A0U
36662306a36Sopenharmony_ci#define IDT_SW_NTP12_BARLIMIT3		0x194A4U
36762306a36Sopenharmony_ci#define IDT_SW_NTP12_BARLTBASE3		0x194A8U
36862306a36Sopenharmony_ci#define IDT_SW_NTP12_BARUTBASE3		0x194ACU
36962306a36Sopenharmony_ci#define IDT_SW_NTP12_BARSETUP4		0x194B0U
37062306a36Sopenharmony_ci#define IDT_SW_NTP12_BARLIMIT4		0x194B4U
37162306a36Sopenharmony_ci#define IDT_SW_NTP12_BARLTBASE4		0x194B8U
37262306a36Sopenharmony_ci#define IDT_SW_NTP12_BARUTBASE4		0x194BCU
37362306a36Sopenharmony_ci#define IDT_SW_NTP12_BARSETUP5		0x194C0U
37462306a36Sopenharmony_ci#define IDT_SW_NTP12_BARLIMIT5		0x194C4U
37562306a36Sopenharmony_ci#define IDT_SW_NTP12_BARLTBASE5		0x194C8U
37662306a36Sopenharmony_ci#define IDT_SW_NTP12_BARUTBASE5		0x194CCU
37762306a36Sopenharmony_ci/* PCI Express command/status and link control/status registers (WORD+WORD) */
37862306a36Sopenharmony_ci#define IDT_SW_NTP16_PCIECMDSTS		0x21004U
37962306a36Sopenharmony_ci#define IDT_SW_NTP16_PCIELCTLSTS	0x21050U
38062306a36Sopenharmony_ci/* NT-function control register		(DWORD) */
38162306a36Sopenharmony_ci#define IDT_SW_NTP16_NTCTL		0x21400U
38262306a36Sopenharmony_ci/* BAR setup/limit/base address registers (DWORD) */
38362306a36Sopenharmony_ci#define IDT_SW_NTP16_BARSETUP0		0x21470U
38462306a36Sopenharmony_ci#define IDT_SW_NTP16_BARLIMIT0		0x21474U
38562306a36Sopenharmony_ci#define IDT_SW_NTP16_BARLTBASE0		0x21478U
38662306a36Sopenharmony_ci#define IDT_SW_NTP16_BARUTBASE0		0x2147CU
38762306a36Sopenharmony_ci#define IDT_SW_NTP16_BARSETUP1		0x21480U
38862306a36Sopenharmony_ci#define IDT_SW_NTP16_BARLIMIT1		0x21484U
38962306a36Sopenharmony_ci#define IDT_SW_NTP16_BARLTBASE1		0x21488U
39062306a36Sopenharmony_ci#define IDT_SW_NTP16_BARUTBASE1		0x2148CU
39162306a36Sopenharmony_ci#define IDT_SW_NTP16_BARSETUP2		0x21490U
39262306a36Sopenharmony_ci#define IDT_SW_NTP16_BARLIMIT2		0x21494U
39362306a36Sopenharmony_ci#define IDT_SW_NTP16_BARLTBASE2		0x21498U
39462306a36Sopenharmony_ci#define IDT_SW_NTP16_BARUTBASE2		0x2149CU
39562306a36Sopenharmony_ci#define IDT_SW_NTP16_BARSETUP3		0x214A0U
39662306a36Sopenharmony_ci#define IDT_SW_NTP16_BARLIMIT3		0x214A4U
39762306a36Sopenharmony_ci#define IDT_SW_NTP16_BARLTBASE3		0x214A8U
39862306a36Sopenharmony_ci#define IDT_SW_NTP16_BARUTBASE3		0x214ACU
39962306a36Sopenharmony_ci#define IDT_SW_NTP16_BARSETUP4		0x214B0U
40062306a36Sopenharmony_ci#define IDT_SW_NTP16_BARLIMIT4		0x214B4U
40162306a36Sopenharmony_ci#define IDT_SW_NTP16_BARLTBASE4		0x214B8U
40262306a36Sopenharmony_ci#define IDT_SW_NTP16_BARUTBASE4		0x214BCU
40362306a36Sopenharmony_ci#define IDT_SW_NTP16_BARSETUP5		0x214C0U
40462306a36Sopenharmony_ci#define IDT_SW_NTP16_BARLIMIT5		0x214C4U
40562306a36Sopenharmony_ci#define IDT_SW_NTP16_BARLTBASE5		0x214C8U
40662306a36Sopenharmony_ci#define IDT_SW_NTP16_BARUTBASE5		0x214CCU
40762306a36Sopenharmony_ci/* PCI Express command/status and link control/status registers (WORD+WORD) */
40862306a36Sopenharmony_ci#define IDT_SW_NTP20_PCIECMDSTS		0x29004U
40962306a36Sopenharmony_ci#define IDT_SW_NTP20_PCIELCTLSTS	0x29050U
41062306a36Sopenharmony_ci/* NT-function control register		(DWORD) */
41162306a36Sopenharmony_ci#define IDT_SW_NTP20_NTCTL		0x29400U
41262306a36Sopenharmony_ci/* BAR setup/limit/base address registers (DWORD) */
41362306a36Sopenharmony_ci#define IDT_SW_NTP20_BARSETUP0		0x29470U
41462306a36Sopenharmony_ci#define IDT_SW_NTP20_BARLIMIT0		0x29474U
41562306a36Sopenharmony_ci#define IDT_SW_NTP20_BARLTBASE0		0x29478U
41662306a36Sopenharmony_ci#define IDT_SW_NTP20_BARUTBASE0		0x2947CU
41762306a36Sopenharmony_ci#define IDT_SW_NTP20_BARSETUP1		0x29480U
41862306a36Sopenharmony_ci#define IDT_SW_NTP20_BARLIMIT1		0x29484U
41962306a36Sopenharmony_ci#define IDT_SW_NTP20_BARLTBASE1		0x29488U
42062306a36Sopenharmony_ci#define IDT_SW_NTP20_BARUTBASE1		0x2948CU
42162306a36Sopenharmony_ci#define IDT_SW_NTP20_BARSETUP2		0x29490U
42262306a36Sopenharmony_ci#define IDT_SW_NTP20_BARLIMIT2		0x29494U
42362306a36Sopenharmony_ci#define IDT_SW_NTP20_BARLTBASE2		0x29498U
42462306a36Sopenharmony_ci#define IDT_SW_NTP20_BARUTBASE2		0x2949CU
42562306a36Sopenharmony_ci#define IDT_SW_NTP20_BARSETUP3		0x294A0U
42662306a36Sopenharmony_ci#define IDT_SW_NTP20_BARLIMIT3		0x294A4U
42762306a36Sopenharmony_ci#define IDT_SW_NTP20_BARLTBASE3		0x294A8U
42862306a36Sopenharmony_ci#define IDT_SW_NTP20_BARUTBASE3		0x294ACU
42962306a36Sopenharmony_ci#define IDT_SW_NTP20_BARSETUP4		0x294B0U
43062306a36Sopenharmony_ci#define IDT_SW_NTP20_BARLIMIT4		0x294B4U
43162306a36Sopenharmony_ci#define IDT_SW_NTP20_BARLTBASE4		0x294B8U
43262306a36Sopenharmony_ci#define IDT_SW_NTP20_BARUTBASE4		0x294BCU
43362306a36Sopenharmony_ci#define IDT_SW_NTP20_BARSETUP5		0x294C0U
43462306a36Sopenharmony_ci#define IDT_SW_NTP20_BARLIMIT5		0x294C4U
43562306a36Sopenharmony_ci#define IDT_SW_NTP20_BARLTBASE5		0x294C8U
43662306a36Sopenharmony_ci#define IDT_SW_NTP20_BARUTBASE5		0x294CCU
43762306a36Sopenharmony_ci/* IDT PCIe-switch control register	(DWORD) */
43862306a36Sopenharmony_ci#define IDT_SW_CTL			0x3E000U
43962306a36Sopenharmony_ci/* Boot Configuration Vector Status	(DWORD) */
44062306a36Sopenharmony_ci#define IDT_SW_BCVSTS			0x3E004U
44162306a36Sopenharmony_ci/* Port Clocking Mode			(DWORD) */
44262306a36Sopenharmony_ci#define IDT_SW_PCLKMODE			0x3E008U
44362306a36Sopenharmony_ci/* Reset Drain Delay			(DWORD) */
44462306a36Sopenharmony_ci#define IDT_SW_RDRAINDELAY		0x3E080U
44562306a36Sopenharmony_ci/* Port Operating Mode Change Drain Delay (DWORD) */
44662306a36Sopenharmony_ci#define IDT_SW_POMCDELAY		0x3E084U
44762306a36Sopenharmony_ci/* Side Effect Delay			(DWORD) */
44862306a36Sopenharmony_ci#define IDT_SW_SEDELAY			0x3E088U
44962306a36Sopenharmony_ci/* Upstream Secondary Bus Reset Delay	(DWORD) */
45062306a36Sopenharmony_ci#define IDT_SW_SSBRDELAY		0x3E08CU
45162306a36Sopenharmony_ci/* Switch partition N Control/Status/Failover registers */
45262306a36Sopenharmony_ci#define IDT_SW_SWPART0CTL		0x3E100U
45362306a36Sopenharmony_ci#define IDT_SW_SWPART0STS		0x3E104U
45462306a36Sopenharmony_ci#define IDT_SW_SWPART0FCTL		0x3E108U
45562306a36Sopenharmony_ci#define IDT_SW_SWPART1CTL		0x3E120U
45662306a36Sopenharmony_ci#define IDT_SW_SWPART1STS		0x3E124U
45762306a36Sopenharmony_ci#define IDT_SW_SWPART1FCTL		0x3E128U
45862306a36Sopenharmony_ci#define IDT_SW_SWPART2CTL		0x3E140U
45962306a36Sopenharmony_ci#define IDT_SW_SWPART2STS		0x3E144U
46062306a36Sopenharmony_ci#define IDT_SW_SWPART2FCTL		0x3E148U
46162306a36Sopenharmony_ci#define IDT_SW_SWPART3CTL		0x3E160U
46262306a36Sopenharmony_ci#define IDT_SW_SWPART3STS		0x3E164U
46362306a36Sopenharmony_ci#define IDT_SW_SWPART3FCTL		0x3E168U
46462306a36Sopenharmony_ci#define IDT_SW_SWPART4CTL		0x3E180U
46562306a36Sopenharmony_ci#define IDT_SW_SWPART4STS		0x3E184U
46662306a36Sopenharmony_ci#define IDT_SW_SWPART4FCTL		0x3E188U
46762306a36Sopenharmony_ci#define IDT_SW_SWPART5CTL		0x3E1A0U
46862306a36Sopenharmony_ci#define IDT_SW_SWPART5STS		0x3E1A4U
46962306a36Sopenharmony_ci#define IDT_SW_SWPART5FCTL		0x3E1A8U
47062306a36Sopenharmony_ci#define IDT_SW_SWPART6CTL		0x3E1C0U
47162306a36Sopenharmony_ci#define IDT_SW_SWPART6STS		0x3E1C4U
47262306a36Sopenharmony_ci#define IDT_SW_SWPART6FCTL		0x3E1C8U
47362306a36Sopenharmony_ci#define IDT_SW_SWPART7CTL		0x3E1E0U
47462306a36Sopenharmony_ci#define IDT_SW_SWPART7STS		0x3E1E4U
47562306a36Sopenharmony_ci#define IDT_SW_SWPART7FCTL		0x3E1E8U
47662306a36Sopenharmony_ci/* Switch port N control and status registers */
47762306a36Sopenharmony_ci#define IDT_SW_SWPORT0CTL		0x3E200U
47862306a36Sopenharmony_ci#define IDT_SW_SWPORT0STS		0x3E204U
47962306a36Sopenharmony_ci#define IDT_SW_SWPORT0FCTL		0x3E208U
48062306a36Sopenharmony_ci#define IDT_SW_SWPORT2CTL		0x3E240U
48162306a36Sopenharmony_ci#define IDT_SW_SWPORT2STS		0x3E244U
48262306a36Sopenharmony_ci#define IDT_SW_SWPORT2FCTL		0x3E248U
48362306a36Sopenharmony_ci#define IDT_SW_SWPORT4CTL		0x3E280U
48462306a36Sopenharmony_ci#define IDT_SW_SWPORT4STS		0x3E284U
48562306a36Sopenharmony_ci#define IDT_SW_SWPORT4FCTL		0x3E288U
48662306a36Sopenharmony_ci#define IDT_SW_SWPORT6CTL		0x3E2C0U
48762306a36Sopenharmony_ci#define IDT_SW_SWPORT6STS		0x3E2C4U
48862306a36Sopenharmony_ci#define IDT_SW_SWPORT6FCTL		0x3E2C8U
48962306a36Sopenharmony_ci#define IDT_SW_SWPORT8CTL		0x3E300U
49062306a36Sopenharmony_ci#define IDT_SW_SWPORT8STS		0x3E304U
49162306a36Sopenharmony_ci#define IDT_SW_SWPORT8FCTL		0x3E308U
49262306a36Sopenharmony_ci#define IDT_SW_SWPORT12CTL		0x3E380U
49362306a36Sopenharmony_ci#define IDT_SW_SWPORT12STS		0x3E384U
49462306a36Sopenharmony_ci#define IDT_SW_SWPORT12FCTL		0x3E388U
49562306a36Sopenharmony_ci#define IDT_SW_SWPORT16CTL		0x3E400U
49662306a36Sopenharmony_ci#define IDT_SW_SWPORT16STS		0x3E404U
49762306a36Sopenharmony_ci#define IDT_SW_SWPORT16FCTL		0x3E408U
49862306a36Sopenharmony_ci#define IDT_SW_SWPORT20CTL		0x3E480U
49962306a36Sopenharmony_ci#define IDT_SW_SWPORT20STS		0x3E484U
50062306a36Sopenharmony_ci#define IDT_SW_SWPORT20FCTL		0x3E488U
50162306a36Sopenharmony_ci/* Switch Event registers */
50262306a36Sopenharmony_ci/* Switch Event Status/Mask/Partition mask (DWORD) */
50362306a36Sopenharmony_ci#define IDT_SW_SESTS			0x3EC00U
50462306a36Sopenharmony_ci#define IDT_SW_SEMSK			0x3EC04U
50562306a36Sopenharmony_ci#define IDT_SW_SEPMSK			0x3EC08U
50662306a36Sopenharmony_ci/* Switch Event Link Up/Down Status/Mask (DWORD) */
50762306a36Sopenharmony_ci#define IDT_SW_SELINKUPSTS		0x3EC0CU
50862306a36Sopenharmony_ci#define IDT_SW_SELINKUPMSK		0x3EC10U
50962306a36Sopenharmony_ci#define IDT_SW_SELINKDNSTS		0x3EC14U
51062306a36Sopenharmony_ci#define IDT_SW_SELINKDNMSK		0x3EC18U
51162306a36Sopenharmony_ci/* Switch Event Fundamental Reset Status/Mask (DWORD) */
51262306a36Sopenharmony_ci#define IDT_SW_SEFRSTSTS		0x3EC1CU
51362306a36Sopenharmony_ci#define IDT_SW_SEFRSTMSK		0x3EC20U
51462306a36Sopenharmony_ci/* Switch Event Hot Reset Status/Mask	(DWORD) */
51562306a36Sopenharmony_ci#define IDT_SW_SEHRSTSTS		0x3EC24U
51662306a36Sopenharmony_ci#define IDT_SW_SEHRSTMSK		0x3EC28U
51762306a36Sopenharmony_ci/* Switch Event Failover Mask		(DWORD) */
51862306a36Sopenharmony_ci#define IDT_SW_SEFOVRMSK		0x3EC2CU
51962306a36Sopenharmony_ci/* Switch Event Global Signal Status/Mask (DWORD) */
52062306a36Sopenharmony_ci#define IDT_SW_SEGSIGSTS		0x3EC30U
52162306a36Sopenharmony_ci#define IDT_SW_SEGSIGMSK		0x3EC34U
52262306a36Sopenharmony_ci/* NT Global Doorbell Status		(DWORD) */
52362306a36Sopenharmony_ci#define IDT_SW_GDBELLSTS		0x3EC3CU
52462306a36Sopenharmony_ci/* Switch partition N message M control (msgs routing table) (DWORD) */
52562306a36Sopenharmony_ci#define IDT_SW_SWP0MSGCTL0		0x3EE00U
52662306a36Sopenharmony_ci#define IDT_SW_SWP1MSGCTL0		0x3EE04U
52762306a36Sopenharmony_ci#define IDT_SW_SWP2MSGCTL0		0x3EE08U
52862306a36Sopenharmony_ci#define IDT_SW_SWP3MSGCTL0		0x3EE0CU
52962306a36Sopenharmony_ci#define IDT_SW_SWP4MSGCTL0		0x3EE10U
53062306a36Sopenharmony_ci#define IDT_SW_SWP5MSGCTL0		0x3EE14U
53162306a36Sopenharmony_ci#define IDT_SW_SWP6MSGCTL0		0x3EE18U
53262306a36Sopenharmony_ci#define IDT_SW_SWP7MSGCTL0		0x3EE1CU
53362306a36Sopenharmony_ci#define IDT_SW_SWP0MSGCTL1		0x3EE20U
53462306a36Sopenharmony_ci#define IDT_SW_SWP1MSGCTL1		0x3EE24U
53562306a36Sopenharmony_ci#define IDT_SW_SWP2MSGCTL1		0x3EE28U
53662306a36Sopenharmony_ci#define IDT_SW_SWP3MSGCTL1		0x3EE2CU
53762306a36Sopenharmony_ci#define IDT_SW_SWP4MSGCTL1		0x3EE30U
53862306a36Sopenharmony_ci#define IDT_SW_SWP5MSGCTL1		0x3EE34U
53962306a36Sopenharmony_ci#define IDT_SW_SWP6MSGCTL1		0x3EE38U
54062306a36Sopenharmony_ci#define IDT_SW_SWP7MSGCTL1		0x3EE3CU
54162306a36Sopenharmony_ci#define IDT_SW_SWP0MSGCTL2		0x3EE40U
54262306a36Sopenharmony_ci#define IDT_SW_SWP1MSGCTL2		0x3EE44U
54362306a36Sopenharmony_ci#define IDT_SW_SWP2MSGCTL2		0x3EE48U
54462306a36Sopenharmony_ci#define IDT_SW_SWP3MSGCTL2		0x3EE4CU
54562306a36Sopenharmony_ci#define IDT_SW_SWP4MSGCTL2		0x3EE50U
54662306a36Sopenharmony_ci#define IDT_SW_SWP5MSGCTL2		0x3EE54U
54762306a36Sopenharmony_ci#define IDT_SW_SWP6MSGCTL2		0x3EE58U
54862306a36Sopenharmony_ci#define IDT_SW_SWP7MSGCTL2		0x3EE5CU
54962306a36Sopenharmony_ci#define IDT_SW_SWP0MSGCTL3		0x3EE60U
55062306a36Sopenharmony_ci#define IDT_SW_SWP1MSGCTL3		0x3EE64U
55162306a36Sopenharmony_ci#define IDT_SW_SWP2MSGCTL3		0x3EE68U
55262306a36Sopenharmony_ci#define IDT_SW_SWP3MSGCTL3		0x3EE6CU
55362306a36Sopenharmony_ci#define IDT_SW_SWP4MSGCTL3		0x3EE70U
55462306a36Sopenharmony_ci#define IDT_SW_SWP5MSGCTL3		0x3EE74U
55562306a36Sopenharmony_ci#define IDT_SW_SWP6MSGCTL3		0x3EE78U
55662306a36Sopenharmony_ci#define IDT_SW_SWP7MSGCTL3		0x3EE7CU
55762306a36Sopenharmony_ci/* SMBus Status and Control registers	(DWORD) */
55862306a36Sopenharmony_ci#define IDT_SW_SMBUSSTS			0x3F188U
55962306a36Sopenharmony_ci#define IDT_SW_SMBUSCTL			0x3F18CU
56062306a36Sopenharmony_ci/* Serial EEPROM Interface		(DWORD) */
56162306a36Sopenharmony_ci#define IDT_SW_EEPROMINTF		0x3F190U
56262306a36Sopenharmony_ci/* MBus I/O Expander Address N		(DWORD) */
56362306a36Sopenharmony_ci#define IDT_SW_IOEXPADDR0		0x3F198U
56462306a36Sopenharmony_ci#define IDT_SW_IOEXPADDR1		0x3F19CU
56562306a36Sopenharmony_ci#define IDT_SW_IOEXPADDR2		0x3F1A0U
56662306a36Sopenharmony_ci#define IDT_SW_IOEXPADDR3		0x3F1A4U
56762306a36Sopenharmony_ci#define IDT_SW_IOEXPADDR4		0x3F1A8U
56862306a36Sopenharmony_ci#define IDT_SW_IOEXPADDR5		0x3F1ACU
56962306a36Sopenharmony_ci/* General Purpose Events Control and Status registers (DWORD) */
57062306a36Sopenharmony_ci#define IDT_SW_GPECTL			0x3F1B0U
57162306a36Sopenharmony_ci#define IDT_SW_GPESTS			0x3F1B4U
57262306a36Sopenharmony_ci/* Temperature sensor Control/Status/Alarm/Adjustment/Slope registers */
57362306a36Sopenharmony_ci#define IDT_SW_TMPCTL			0x3F1D4U
57462306a36Sopenharmony_ci#define IDT_SW_TMPSTS			0x3F1D8U
57562306a36Sopenharmony_ci#define IDT_SW_TMPALARM			0x3F1DCU
57662306a36Sopenharmony_ci#define IDT_SW_TMPADJ			0x3F1E0U
57762306a36Sopenharmony_ci#define IDT_SW_TSSLOPE			0x3F1E4U
57862306a36Sopenharmony_ci/* SMBus Configuration Block header log	(DWORD) */
57962306a36Sopenharmony_ci#define IDT_SW_SMBUSCBHL		0x3F1E8U
58062306a36Sopenharmony_ci
58162306a36Sopenharmony_ci/*
58262306a36Sopenharmony_ci * Common registers related constants
58362306a36Sopenharmony_ci * @IDT_REG_ALIGN:	Registers alignment used in the driver
58462306a36Sopenharmony_ci * @IDT_REG_PCI_MAX:	Maximum PCI configuration space register value
58562306a36Sopenharmony_ci * @IDT_REG_SW_MAX:	Maximum global register value
58662306a36Sopenharmony_ci */
58762306a36Sopenharmony_ci#define IDT_REG_ALIGN			4
58862306a36Sopenharmony_ci#define IDT_REG_PCI_MAX			0x00FFFU
58962306a36Sopenharmony_ci#define IDT_REG_SW_MAX			0x3FFFFU
59062306a36Sopenharmony_ci
59162306a36Sopenharmony_ci/*
59262306a36Sopenharmony_ci * PCICMDSTS register fields related constants
59362306a36Sopenharmony_ci * @IDT_PCICMDSTS_IOAE:	I/O access enable
59462306a36Sopenharmony_ci * @IDT_PCICMDSTS_MAE:	Memory access enable
59562306a36Sopenharmony_ci * @IDT_PCICMDSTS_BME:	Bus master enable
59662306a36Sopenharmony_ci */
59762306a36Sopenharmony_ci#define IDT_PCICMDSTS_IOAE		0x00000001U
59862306a36Sopenharmony_ci#define IDT_PCICMDSTS_MAE		0x00000002U
59962306a36Sopenharmony_ci#define IDT_PCICMDSTS_BME		0x00000004U
60062306a36Sopenharmony_ci
60162306a36Sopenharmony_ci/*
60262306a36Sopenharmony_ci * PCIEDCAP register fields related constants
60362306a36Sopenharmony_ci * @IDT_PCIEDCAP_MPAYLOAD_MASK:	 Maximum payload size mask
60462306a36Sopenharmony_ci * @IDT_PCIEDCAP_MPAYLOAD_FLD:	 Maximum payload size field offset
60562306a36Sopenharmony_ci * @IDT_PCIEDCAP_MPAYLOAD_S128:	 Max supported payload size of 128 bytes
60662306a36Sopenharmony_ci * @IDT_PCIEDCAP_MPAYLOAD_S256:	 Max supported payload size of 256 bytes
60762306a36Sopenharmony_ci * @IDT_PCIEDCAP_MPAYLOAD_S512:	 Max supported payload size of 512 bytes
60862306a36Sopenharmony_ci * @IDT_PCIEDCAP_MPAYLOAD_S1024: Max supported payload size of 1024 bytes
60962306a36Sopenharmony_ci * @IDT_PCIEDCAP_MPAYLOAD_S2048: Max supported payload size of 2048 bytes
61062306a36Sopenharmony_ci */
61162306a36Sopenharmony_ci#define IDT_PCIEDCAP_MPAYLOAD_MASK	0x00000007U
61262306a36Sopenharmony_ci#define IDT_PCIEDCAP_MPAYLOAD_FLD	0
61362306a36Sopenharmony_ci#define IDT_PCIEDCAP_MPAYLOAD_S128	0x00000000U
61462306a36Sopenharmony_ci#define IDT_PCIEDCAP_MPAYLOAD_S256	0x00000001U
61562306a36Sopenharmony_ci#define IDT_PCIEDCAP_MPAYLOAD_S512	0x00000002U
61662306a36Sopenharmony_ci#define IDT_PCIEDCAP_MPAYLOAD_S1024	0x00000003U
61762306a36Sopenharmony_ci#define IDT_PCIEDCAP_MPAYLOAD_S2048	0x00000004U
61862306a36Sopenharmony_ci
61962306a36Sopenharmony_ci/*
62062306a36Sopenharmony_ci * PCIEDCTLSTS registers fields related constants
62162306a36Sopenharmony_ci * @IDT_PCIEDCTL_MPS_MASK:	Maximum payload size mask
62262306a36Sopenharmony_ci * @IDT_PCIEDCTL_MPS_FLD:	MPS field offset
62362306a36Sopenharmony_ci * @IDT_PCIEDCTL_MPS_S128:	Max payload size of 128 bytes
62462306a36Sopenharmony_ci * @IDT_PCIEDCTL_MPS_S256:	Max payload size of 256 bytes
62562306a36Sopenharmony_ci * @IDT_PCIEDCTL_MPS_S512:	Max payload size of 512 bytes
62662306a36Sopenharmony_ci * @IDT_PCIEDCTL_MPS_S1024:	Max payload size of 1024 bytes
62762306a36Sopenharmony_ci * @IDT_PCIEDCTL_MPS_S2048:	Max payload size of 2048 bytes
62862306a36Sopenharmony_ci * @IDT_PCIEDCTL_MPS_S4096:	Max payload size of 4096 bytes
62962306a36Sopenharmony_ci */
63062306a36Sopenharmony_ci#define IDT_PCIEDCTLSTS_MPS_MASK	0x000000E0U
63162306a36Sopenharmony_ci#define IDT_PCIEDCTLSTS_MPS_FLD		5
63262306a36Sopenharmony_ci#define IDT_PCIEDCTLSTS_MPS_S128	0x00000000U
63362306a36Sopenharmony_ci#define IDT_PCIEDCTLSTS_MPS_S256	0x00000020U
63462306a36Sopenharmony_ci#define IDT_PCIEDCTLSTS_MPS_S512	0x00000040U
63562306a36Sopenharmony_ci#define IDT_PCIEDCTLSTS_MPS_S1024	0x00000060U
63662306a36Sopenharmony_ci#define IDT_PCIEDCTLSTS_MPS_S2048	0x00000080U
63762306a36Sopenharmony_ci#define IDT_PCIEDCTLSTS_MPS_S4096	0x000000A0U
63862306a36Sopenharmony_ci
63962306a36Sopenharmony_ci/*
64062306a36Sopenharmony_ci * PCIELCAP register fields related constants
64162306a36Sopenharmony_ci * @IDT_PCIELCAP_PORTNUM_MASK:	Port number field mask
64262306a36Sopenharmony_ci * @IDT_PCIELCAP_PORTNUM_FLD:	Port number field offset
64362306a36Sopenharmony_ci */
64462306a36Sopenharmony_ci#define IDT_PCIELCAP_PORTNUM_MASK	0xFF000000U
64562306a36Sopenharmony_ci#define IDT_PCIELCAP_PORTNUM_FLD	24
64662306a36Sopenharmony_ci
64762306a36Sopenharmony_ci/*
64862306a36Sopenharmony_ci * PCIELCTLSTS registers fields related constants
64962306a36Sopenharmony_ci * @IDT_PCIELSTS_CLS_MASK:	Current link speed mask
65062306a36Sopenharmony_ci * @IDT_PCIELSTS_CLS_FLD:	Current link speed field offset
65162306a36Sopenharmony_ci * @IDT_PCIELSTS_NLW_MASK:	Negotiated link width mask
65262306a36Sopenharmony_ci * @IDT_PCIELSTS_NLW_FLD:	Negotiated link width field offset
65362306a36Sopenharmony_ci * @IDT_PCIELSTS_SCLK_COM:	Common slot clock configuration
65462306a36Sopenharmony_ci */
65562306a36Sopenharmony_ci#define IDT_PCIELCTLSTS_CLS_MASK	0x000F0000U
65662306a36Sopenharmony_ci#define IDT_PCIELCTLSTS_CLS_FLD		16
65762306a36Sopenharmony_ci#define IDT_PCIELCTLSTS_NLW_MASK	0x03F00000U
65862306a36Sopenharmony_ci#define IDT_PCIELCTLSTS_NLW_FLD		20
65962306a36Sopenharmony_ci#define IDT_PCIELCTLSTS_SCLK_COM	0x10000000U
66062306a36Sopenharmony_ci
66162306a36Sopenharmony_ci/*
66262306a36Sopenharmony_ci * NTCTL register fields related constants
66362306a36Sopenharmony_ci * @IDT_NTCTL_IDPROTDIS:	ID Protection check disable (disable MTBL)
66462306a36Sopenharmony_ci * @IDT_NTCTL_CPEN:		Completion enable
66562306a36Sopenharmony_ci * @IDT_NTCTL_RNS:		Request no snoop processing (if MTBL disabled)
66662306a36Sopenharmony_ci * @IDT_NTCTL_ATP:		Address type processing (if MTBL disabled)
66762306a36Sopenharmony_ci */
66862306a36Sopenharmony_ci#define IDT_NTCTL_IDPROTDIS		0x00000001U
66962306a36Sopenharmony_ci#define IDT_NTCTL_CPEN			0x00000002U
67062306a36Sopenharmony_ci#define IDT_NTCTL_RNS			0x00000004U
67162306a36Sopenharmony_ci#define IDT_NTCTL_ATP			0x00000008U
67262306a36Sopenharmony_ci
67362306a36Sopenharmony_ci/*
67462306a36Sopenharmony_ci * NTINTSTS register fields related constants
67562306a36Sopenharmony_ci * @IDT_NTINTSTS_MSG:		Message interrupt bit
67662306a36Sopenharmony_ci * @IDT_NTINTSTS_DBELL:		Doorbell interrupt bit
67762306a36Sopenharmony_ci * @IDT_NTINTSTS_SEVENT:	Switch Event interrupt bit
67862306a36Sopenharmony_ci * @IDT_NTINTSTS_TMPSENSOR:	Temperature sensor interrupt bit
67962306a36Sopenharmony_ci */
68062306a36Sopenharmony_ci#define IDT_NTINTSTS_MSG		0x00000001U
68162306a36Sopenharmony_ci#define IDT_NTINTSTS_DBELL		0x00000002U
68262306a36Sopenharmony_ci#define IDT_NTINTSTS_SEVENT		0x00000008U
68362306a36Sopenharmony_ci#define IDT_NTINTSTS_TMPSENSOR		0x00000080U
68462306a36Sopenharmony_ci
68562306a36Sopenharmony_ci/*
68662306a36Sopenharmony_ci * NTINTMSK register fields related constants
68762306a36Sopenharmony_ci * @IDT_NTINTMSK_MSG:		Message interrupt mask bit
68862306a36Sopenharmony_ci * @IDT_NTINTMSK_DBELL:		Doorbell interrupt mask bit
68962306a36Sopenharmony_ci * @IDT_NTINTMSK_SEVENT:	Switch Event interrupt mask bit
69062306a36Sopenharmony_ci * @IDT_NTINTMSK_TMPSENSOR:	Temperature sensor interrupt mask bit
69162306a36Sopenharmony_ci * @IDT_NTINTMSK_ALL:		NTB-related interrupts mask
69262306a36Sopenharmony_ci */
69362306a36Sopenharmony_ci#define IDT_NTINTMSK_MSG		0x00000001U
69462306a36Sopenharmony_ci#define IDT_NTINTMSK_DBELL		0x00000002U
69562306a36Sopenharmony_ci#define IDT_NTINTMSK_SEVENT		0x00000008U
69662306a36Sopenharmony_ci#define IDT_NTINTMSK_TMPSENSOR		0x00000080U
69762306a36Sopenharmony_ci#define IDT_NTINTMSK_ALL \
69862306a36Sopenharmony_ci	(IDT_NTINTMSK_MSG | IDT_NTINTMSK_DBELL | IDT_NTINTMSK_SEVENT)
69962306a36Sopenharmony_ci
70062306a36Sopenharmony_ci/*
70162306a36Sopenharmony_ci * NTGSIGNAL register fields related constants
70262306a36Sopenharmony_ci * @IDT_NTGSIGNAL_SET:	Set global signal of the local partition
70362306a36Sopenharmony_ci */
70462306a36Sopenharmony_ci#define IDT_NTGSIGNAL_SET		0x00000001U
70562306a36Sopenharmony_ci
70662306a36Sopenharmony_ci/*
70762306a36Sopenharmony_ci * BARSETUP register fields related constants
70862306a36Sopenharmony_ci * @IDT_BARSETUP_TYPE_MASK:	Mask of the TYPE field
70962306a36Sopenharmony_ci * @IDT_BARSETUP_TYPE_32:	32-bit addressing BAR
71062306a36Sopenharmony_ci * @IDT_BARSETUP_TYPE_64:	64-bit addressing BAR
71162306a36Sopenharmony_ci * @IDT_BARSETUP_PREF:		Value of the BAR prefetchable field
71262306a36Sopenharmony_ci * @IDT_BARSETUP_SIZE_MASK:	Mask of the SIZE field
71362306a36Sopenharmony_ci * @IDT_BARSETUP_SIZE_FLD:	SIZE field offset
71462306a36Sopenharmony_ci * @IDT_BARSETUP_SIZE_CFG:	SIZE field value in case of config space MODE
71562306a36Sopenharmony_ci * @IDT_BARSETUP_MODE_CFG:	Configuration space BAR mode
71662306a36Sopenharmony_ci * @IDT_BARSETUP_ATRAN_MASK:	ATRAN field mask
71762306a36Sopenharmony_ci * @IDT_BARSETUP_ATRAN_FLD:	ATRAN field offset
71862306a36Sopenharmony_ci * @IDT_BARSETUP_ATRAN_DIR:	Direct address translation memory window
71962306a36Sopenharmony_ci * @IDT_BARSETUP_ATRAN_LUT12:	12-entry lookup table
72062306a36Sopenharmony_ci * @IDT_BARSETUP_ATRAN_LUT24:	24-entry lookup table
72162306a36Sopenharmony_ci * @IDT_BARSETUP_TPART_MASK:	TPART field mask
72262306a36Sopenharmony_ci * @IDT_BARSETUP_TPART_FLD:	TPART field offset
72362306a36Sopenharmony_ci * @IDT_BARSETUP_EN:		BAR enable bit
72462306a36Sopenharmony_ci */
72562306a36Sopenharmony_ci#define IDT_BARSETUP_TYPE_MASK		0x00000006U
72662306a36Sopenharmony_ci#define IDT_BARSETUP_TYPE_FLD		0
72762306a36Sopenharmony_ci#define IDT_BARSETUP_TYPE_32		0x00000000U
72862306a36Sopenharmony_ci#define IDT_BARSETUP_TYPE_64		0x00000004U
72962306a36Sopenharmony_ci#define IDT_BARSETUP_PREF		0x00000008U
73062306a36Sopenharmony_ci#define IDT_BARSETUP_SIZE_MASK		0x000003F0U
73162306a36Sopenharmony_ci#define IDT_BARSETUP_SIZE_FLD		4
73262306a36Sopenharmony_ci#define IDT_BARSETUP_SIZE_CFG		0x000000C0U
73362306a36Sopenharmony_ci#define IDT_BARSETUP_MODE_CFG		0x00000400U
73462306a36Sopenharmony_ci#define IDT_BARSETUP_ATRAN_MASK		0x00001800U
73562306a36Sopenharmony_ci#define IDT_BARSETUP_ATRAN_FLD		11
73662306a36Sopenharmony_ci#define IDT_BARSETUP_ATRAN_DIR		0x00000000U
73762306a36Sopenharmony_ci#define IDT_BARSETUP_ATRAN_LUT12	0x00000800U
73862306a36Sopenharmony_ci#define IDT_BARSETUP_ATRAN_LUT24	0x00001000U
73962306a36Sopenharmony_ci#define IDT_BARSETUP_TPART_MASK		0x0000E000U
74062306a36Sopenharmony_ci#define IDT_BARSETUP_TPART_FLD		13
74162306a36Sopenharmony_ci#define IDT_BARSETUP_EN			0x80000000U
74262306a36Sopenharmony_ci
74362306a36Sopenharmony_ci/*
74462306a36Sopenharmony_ci * NTMTBLDATA register fields related constants
74562306a36Sopenharmony_ci * @IDT_NTMTBLDATA_VALID:	Set the MTBL entry being valid
74662306a36Sopenharmony_ci * @IDT_NTMTBLDATA_REQID_MASK:	Bus:Device:Function field mask
74762306a36Sopenharmony_ci * @IDT_NTMTBLDATA_REQID_FLD:	Bus:Device:Function field offset
74862306a36Sopenharmony_ci * @IDT_NTMTBLDATA_PART_MASK:	Partition field mask
74962306a36Sopenharmony_ci * @IDT_NTMTBLDATA_PART_FLD:	Partition field offset
75062306a36Sopenharmony_ci * @IDT_NTMTBLDATA_ATP_TRANS:	Enable AT field translation on request TLPs
75162306a36Sopenharmony_ci * @IDT_NTMTBLDATA_CNS_INV:	Enable No Snoop attribute inversion of
75262306a36Sopenharmony_ci *				Completion TLPs
75362306a36Sopenharmony_ci * @IDT_NTMTBLDATA_RNS_INV:	Enable No Snoop attribute inversion of
75462306a36Sopenharmony_ci *				Request TLPs
75562306a36Sopenharmony_ci */
75662306a36Sopenharmony_ci#define IDT_NTMTBLDATA_VALID		0x00000001U
75762306a36Sopenharmony_ci#define IDT_NTMTBLDATA_REQID_MASK	0x0001FFFEU
75862306a36Sopenharmony_ci#define IDT_NTMTBLDATA_REQID_FLD	1
75962306a36Sopenharmony_ci#define IDT_NTMTBLDATA_PART_MASK	0x000E0000U
76062306a36Sopenharmony_ci#define IDT_NTMTBLDATA_PART_FLD		17
76162306a36Sopenharmony_ci#define IDT_NTMTBLDATA_ATP_TRANS	0x20000000U
76262306a36Sopenharmony_ci#define IDT_NTMTBLDATA_CNS_INV		0x40000000U
76362306a36Sopenharmony_ci#define IDT_NTMTBLDATA_RNS_INV		0x80000000U
76462306a36Sopenharmony_ci
76562306a36Sopenharmony_ci/*
76662306a36Sopenharmony_ci * REQIDCAP register fields related constants
76762306a36Sopenharmony_ci * @IDT_REQIDCAP_REQID_MASK:	Request ID field mask
76862306a36Sopenharmony_ci * @IDT_REQIDCAP_REQID_FLD:	Request ID field offset
76962306a36Sopenharmony_ci */
77062306a36Sopenharmony_ci#define IDT_REQIDCAP_REQID_MASK		0x0000FFFFU
77162306a36Sopenharmony_ci#define IDT_REQIDCAP_REQID_FLD		0
77262306a36Sopenharmony_ci
77362306a36Sopenharmony_ci/*
77462306a36Sopenharmony_ci * LUTOFFSET register fields related constants
77562306a36Sopenharmony_ci * @IDT_LUTOFFSET_INDEX_MASK:	Lookup table index field mask
77662306a36Sopenharmony_ci * @IDT_LUTOFFSET_INDEX_FLD:	Lookup table index field offset
77762306a36Sopenharmony_ci * @IDT_LUTOFFSET_BAR_MASK:	Lookup table BAR select field mask
77862306a36Sopenharmony_ci * @IDT_LUTOFFSET_BAR_FLD:	Lookup table BAR select field offset
77962306a36Sopenharmony_ci */
78062306a36Sopenharmony_ci#define IDT_LUTOFFSET_INDEX_MASK	0x0000001FU
78162306a36Sopenharmony_ci#define IDT_LUTOFFSET_INDEX_FLD		0
78262306a36Sopenharmony_ci#define IDT_LUTOFFSET_BAR_MASK		0x00000700U
78362306a36Sopenharmony_ci#define IDT_LUTOFFSET_BAR_FLD		8
78462306a36Sopenharmony_ci
78562306a36Sopenharmony_ci/*
78662306a36Sopenharmony_ci * LUTUDATA register fields related constants
78762306a36Sopenharmony_ci * @IDT_LUTUDATA_PART_MASK:	Partition field mask
78862306a36Sopenharmony_ci * @IDT_LUTUDATA_PART_FLD:	Partition field offset
78962306a36Sopenharmony_ci * @IDT_LUTUDATA_VALID:		Lookup table entry valid bit
79062306a36Sopenharmony_ci */
79162306a36Sopenharmony_ci#define IDT_LUTUDATA_PART_MASK		0x0000000FU
79262306a36Sopenharmony_ci#define IDT_LUTUDATA_PART_FLD		0
79362306a36Sopenharmony_ci#define IDT_LUTUDATA_VALID		0x80000000U
79462306a36Sopenharmony_ci
79562306a36Sopenharmony_ci/*
79662306a36Sopenharmony_ci * SWPARTxSTS register fields related constants
79762306a36Sopenharmony_ci * @IDT_SWPARTxSTS_SCI:		Switch partition state change initiated
79862306a36Sopenharmony_ci * @IDT_SWPARTxSTS_SCC:		Switch partition state change completed
79962306a36Sopenharmony_ci * @IDT_SWPARTxSTS_STATE_MASK:	Switch partition state mask
80062306a36Sopenharmony_ci * @IDT_SWPARTxSTS_STATE_FLD:	Switch partition state field offset
80162306a36Sopenharmony_ci * @IDT_SWPARTxSTS_STATE_DIS:	Switch partition disabled
80262306a36Sopenharmony_ci * @IDT_SWPARTxSTS_STATE_ACT:	Switch partition enabled
80362306a36Sopenharmony_ci * @IDT_SWPARTxSTS_STATE_RES:	Switch partition in reset
80462306a36Sopenharmony_ci * @IDT_SWPARTxSTS_US:		Switch partition has upstream port
80562306a36Sopenharmony_ci * @IDT_SWPARTxSTS_USID_MASK:	Switch partition upstream port ID mask
80662306a36Sopenharmony_ci * @IDT_SWPARTxSTS_USID_FLD:	Switch partition upstream port ID field offset
80762306a36Sopenharmony_ci * @IDT_SWPARTxSTS_NT:		Upstream port has NT function
80862306a36Sopenharmony_ci * @IDT_SWPARTxSTS_DMA:		Upstream port has DMA function
80962306a36Sopenharmony_ci */
81062306a36Sopenharmony_ci#define IDT_SWPARTxSTS_SCI		0x00000001U
81162306a36Sopenharmony_ci#define IDT_SWPARTxSTS_SCC		0x00000002U
81262306a36Sopenharmony_ci#define IDT_SWPARTxSTS_STATE_MASK	0x00000060U
81362306a36Sopenharmony_ci#define IDT_SWPARTxSTS_STATE_FLD	5
81462306a36Sopenharmony_ci#define IDT_SWPARTxSTS_STATE_DIS	0x00000000U
81562306a36Sopenharmony_ci#define IDT_SWPARTxSTS_STATE_ACT	0x00000020U
81662306a36Sopenharmony_ci#define IDT_SWPARTxSTS_STATE_RES	0x00000060U
81762306a36Sopenharmony_ci#define IDT_SWPARTxSTS_US		0x00000100U
81862306a36Sopenharmony_ci#define IDT_SWPARTxSTS_USID_MASK	0x00003E00U
81962306a36Sopenharmony_ci#define IDT_SWPARTxSTS_USID_FLD		9
82062306a36Sopenharmony_ci#define IDT_SWPARTxSTS_NT		0x00004000U
82162306a36Sopenharmony_ci#define IDT_SWPARTxSTS_DMA		0x00008000U
82262306a36Sopenharmony_ci
82362306a36Sopenharmony_ci/*
82462306a36Sopenharmony_ci * SWPORTxSTS register fields related constants
82562306a36Sopenharmony_ci * @IDT_SWPORTxSTS_OMCI:	Operation mode change initiated
82662306a36Sopenharmony_ci * @IDT_SWPORTxSTS_OMCC:	Operation mode change completed
82762306a36Sopenharmony_ci * @IDT_SWPORTxSTS_LINKUP:	Link up status
82862306a36Sopenharmony_ci * @IDT_SWPORTxSTS_DS:		Port lanes behave as downstream lanes
82962306a36Sopenharmony_ci * @IDT_SWPORTxSTS_MODE_MASK:	Port mode field mask
83062306a36Sopenharmony_ci * @IDT_SWPORTxSTS_MODE_FLD:	Port mode field offset
83162306a36Sopenharmony_ci * @IDT_SWPORTxSTS_MODE_DIS:	Port mode - disabled
83262306a36Sopenharmony_ci * @IDT_SWPORTxSTS_MODE_DS:	Port mode - downstream switch port
83362306a36Sopenharmony_ci * @IDT_SWPORTxSTS_MODE_US:	Port mode - upstream switch port
83462306a36Sopenharmony_ci * @IDT_SWPORTxSTS_MODE_NT:	Port mode - NT function
83562306a36Sopenharmony_ci * @IDT_SWPORTxSTS_MODE_USNT:	Port mode - upstream switch port with NTB
83662306a36Sopenharmony_ci * @IDT_SWPORTxSTS_MODE_UNAT:	Port mode - unattached
83762306a36Sopenharmony_ci * @IDT_SWPORTxSTS_MODE_USDMA:	Port mode - upstream switch port with DMA
83862306a36Sopenharmony_ci * @IDT_SWPORTxSTS_MODE_USNTDMA:Port mode - upstream port with NTB and DMA
83962306a36Sopenharmony_ci * @IDT_SWPORTxSTS_MODE_NTDMA:	Port mode - NT function with DMA
84062306a36Sopenharmony_ci * @IDT_SWPORTxSTS_SWPART_MASK:	Port partition field mask
84162306a36Sopenharmony_ci * @IDT_SWPORTxSTS_SWPART_FLD:	Port partition field offset
84262306a36Sopenharmony_ci * @IDT_SWPORTxSTS_DEVNUM_MASK:	Port device number field mask
84362306a36Sopenharmony_ci * @IDT_SWPORTxSTS_DEVNUM_FLD:	Port device number field offset
84462306a36Sopenharmony_ci */
84562306a36Sopenharmony_ci#define IDT_SWPORTxSTS_OMCI		0x00000001U
84662306a36Sopenharmony_ci#define IDT_SWPORTxSTS_OMCC		0x00000002U
84762306a36Sopenharmony_ci#define IDT_SWPORTxSTS_LINKUP		0x00000010U
84862306a36Sopenharmony_ci#define IDT_SWPORTxSTS_DS		0x00000020U
84962306a36Sopenharmony_ci#define IDT_SWPORTxSTS_MODE_MASK	0x000003C0U
85062306a36Sopenharmony_ci#define IDT_SWPORTxSTS_MODE_FLD		6
85162306a36Sopenharmony_ci#define IDT_SWPORTxSTS_MODE_DIS		0x00000000U
85262306a36Sopenharmony_ci#define IDT_SWPORTxSTS_MODE_DS		0x00000040U
85362306a36Sopenharmony_ci#define IDT_SWPORTxSTS_MODE_US		0x00000080U
85462306a36Sopenharmony_ci#define IDT_SWPORTxSTS_MODE_NT		0x000000C0U
85562306a36Sopenharmony_ci#define IDT_SWPORTxSTS_MODE_USNT	0x00000100U
85662306a36Sopenharmony_ci#define IDT_SWPORTxSTS_MODE_UNAT	0x00000140U
85762306a36Sopenharmony_ci#define IDT_SWPORTxSTS_MODE_USDMA	0x00000180U
85862306a36Sopenharmony_ci#define IDT_SWPORTxSTS_MODE_USNTDMA	0x000001C0U
85962306a36Sopenharmony_ci#define IDT_SWPORTxSTS_MODE_NTDMA	0x00000200U
86062306a36Sopenharmony_ci#define IDT_SWPORTxSTS_SWPART_MASK	0x00001C00U
86162306a36Sopenharmony_ci#define IDT_SWPORTxSTS_SWPART_FLD	10
86262306a36Sopenharmony_ci#define IDT_SWPORTxSTS_DEVNUM_MASK	0x001F0000U
86362306a36Sopenharmony_ci#define IDT_SWPORTxSTS_DEVNUM_FLD	16
86462306a36Sopenharmony_ci
86562306a36Sopenharmony_ci/*
86662306a36Sopenharmony_ci * SEMSK register fields related constants
86762306a36Sopenharmony_ci * @IDT_SEMSK_LINKUP:	Link Up event mask bit
86862306a36Sopenharmony_ci * @IDT_SEMSK_LINKDN:	Link Down event mask bit
86962306a36Sopenharmony_ci * @IDT_SEMSK_GSIGNAL:	Global Signal event mask bit
87062306a36Sopenharmony_ci */
87162306a36Sopenharmony_ci#define IDT_SEMSK_LINKUP		0x00000001U
87262306a36Sopenharmony_ci#define IDT_SEMSK_LINKDN		0x00000002U
87362306a36Sopenharmony_ci#define IDT_SEMSK_GSIGNAL		0x00000020U
87462306a36Sopenharmony_ci
87562306a36Sopenharmony_ci/*
87662306a36Sopenharmony_ci * SWPxMSGCTL register fields related constants
87762306a36Sopenharmony_ci * @IDT_SWPxMSGCTL_REG_MASK:	Register select field mask
87862306a36Sopenharmony_ci * @IDT_SWPxMSGCTL_REG_FLD:	Register select field offset
87962306a36Sopenharmony_ci * @IDT_SWPxMSGCTL_PART_MASK:	Partition select field mask
88062306a36Sopenharmony_ci * @IDT_SWPxMSGCTL_PART_FLD:	Partition select field offset
88162306a36Sopenharmony_ci */
88262306a36Sopenharmony_ci#define IDT_SWPxMSGCTL_REG_MASK		0x00000003U
88362306a36Sopenharmony_ci#define IDT_SWPxMSGCTL_REG_FLD		0
88462306a36Sopenharmony_ci#define IDT_SWPxMSGCTL_PART_MASK	0x00000070U
88562306a36Sopenharmony_ci#define IDT_SWPxMSGCTL_PART_FLD		4
88662306a36Sopenharmony_ci
88762306a36Sopenharmony_ci/*
88862306a36Sopenharmony_ci * TMPCTL register fields related constants
88962306a36Sopenharmony_ci * @IDT_TMPCTL_LTH_MASK:	Low temperature threshold field mask
89062306a36Sopenharmony_ci * @IDT_TMPCTL_LTH_FLD:		Low temperature threshold field offset
89162306a36Sopenharmony_ci * @IDT_TMPCTL_MTH_MASK:	Middle temperature threshold field mask
89262306a36Sopenharmony_ci * @IDT_TMPCTL_MTH_FLD:		Middle temperature threshold field offset
89362306a36Sopenharmony_ci * @IDT_TMPCTL_HTH_MASK:	High temperature threshold field mask
89462306a36Sopenharmony_ci * @IDT_TMPCTL_HTH_FLD:		High temperature threshold field offset
89562306a36Sopenharmony_ci * @IDT_TMPCTL_PDOWN:		Temperature sensor power down
89662306a36Sopenharmony_ci */
89762306a36Sopenharmony_ci#define IDT_TMPCTL_LTH_MASK		0x000000FFU
89862306a36Sopenharmony_ci#define IDT_TMPCTL_LTH_FLD		0
89962306a36Sopenharmony_ci#define IDT_TMPCTL_MTH_MASK		0x0000FF00U
90062306a36Sopenharmony_ci#define IDT_TMPCTL_MTH_FLD		8
90162306a36Sopenharmony_ci#define IDT_TMPCTL_HTH_MASK		0x00FF0000U
90262306a36Sopenharmony_ci#define IDT_TMPCTL_HTH_FLD		16
90362306a36Sopenharmony_ci#define IDT_TMPCTL_PDOWN		0x80000000U
90462306a36Sopenharmony_ci
90562306a36Sopenharmony_ci/*
90662306a36Sopenharmony_ci * TMPSTS register fields related constants
90762306a36Sopenharmony_ci * @IDT_TMPSTS_TEMP_MASK:	Current temperature field mask
90862306a36Sopenharmony_ci * @IDT_TMPSTS_TEMP_FLD:	Current temperature field offset
90962306a36Sopenharmony_ci * @IDT_TMPSTS_LTEMP_MASK:	Lowest temperature field mask
91062306a36Sopenharmony_ci * @IDT_TMPSTS_LTEMP_FLD:	Lowest temperature field offset
91162306a36Sopenharmony_ci * @IDT_TMPSTS_HTEMP_MASK:	Highest temperature field mask
91262306a36Sopenharmony_ci * @IDT_TMPSTS_HTEMP_FLD:	Highest temperature field offset
91362306a36Sopenharmony_ci */
91462306a36Sopenharmony_ci#define IDT_TMPSTS_TEMP_MASK		0x000000FFU
91562306a36Sopenharmony_ci#define IDT_TMPSTS_TEMP_FLD		0
91662306a36Sopenharmony_ci#define IDT_TMPSTS_LTEMP_MASK		0x0000FF00U
91762306a36Sopenharmony_ci#define IDT_TMPSTS_LTEMP_FLD		8
91862306a36Sopenharmony_ci#define IDT_TMPSTS_HTEMP_MASK		0x00FF0000U
91962306a36Sopenharmony_ci#define IDT_TMPSTS_HTEMP_FLD		16
92062306a36Sopenharmony_ci
92162306a36Sopenharmony_ci/*
92262306a36Sopenharmony_ci * TMPALARM register fields related constants
92362306a36Sopenharmony_ci * @IDT_TMPALARM_LTEMP_MASK:	Lowest temperature field mask
92462306a36Sopenharmony_ci * @IDT_TMPALARM_LTEMP_FLD:	Lowest temperature field offset
92562306a36Sopenharmony_ci * @IDT_TMPALARM_HTEMP_MASK:	Highest temperature field mask
92662306a36Sopenharmony_ci * @IDT_TMPALARM_HTEMP_FLD:	Highest temperature field offset
92762306a36Sopenharmony_ci * @IDT_TMPALARM_IRQ_MASK:	Alarm IRQ status mask
92862306a36Sopenharmony_ci */
92962306a36Sopenharmony_ci#define IDT_TMPALARM_LTEMP_MASK		0x0000FF00U
93062306a36Sopenharmony_ci#define IDT_TMPALARM_LTEMP_FLD		8
93162306a36Sopenharmony_ci#define IDT_TMPALARM_HTEMP_MASK		0x00FF0000U
93262306a36Sopenharmony_ci#define IDT_TMPALARM_HTEMP_FLD		16
93362306a36Sopenharmony_ci#define IDT_TMPALARM_IRQ_MASK		0x3F000000U
93462306a36Sopenharmony_ci
93562306a36Sopenharmony_ci/*
93662306a36Sopenharmony_ci * TMPADJ register fields related constants
93762306a36Sopenharmony_ci * @IDT_TMPADJ_OFFSET_MASK:	Temperature value offset field mask
93862306a36Sopenharmony_ci * @IDT_TMPADJ_OFFSET_FLD:	Temperature value offset field offset
93962306a36Sopenharmony_ci */
94062306a36Sopenharmony_ci#define IDT_TMPADJ_OFFSET_MASK		0x000000FFU
94162306a36Sopenharmony_ci#define IDT_TMPADJ_OFFSET_FLD		0
94262306a36Sopenharmony_ci
94362306a36Sopenharmony_ci/*
94462306a36Sopenharmony_ci * Helper macro to get/set the corresponding field value
94562306a36Sopenharmony_ci * @GET_FIELD:		Retrieve the value of the corresponding field
94662306a36Sopenharmony_ci * @SET_FIELD:		Set the specified field up
94762306a36Sopenharmony_ci * @IS_FLD_SET:		Check whether a field is set with value
94862306a36Sopenharmony_ci */
94962306a36Sopenharmony_ci#define GET_FIELD(field, data) \
95062306a36Sopenharmony_ci	(((u32)(data) & IDT_ ##field## _MASK) >> IDT_ ##field## _FLD)
95162306a36Sopenharmony_ci#define SET_FIELD(field, data, value) \
95262306a36Sopenharmony_ci	(((u32)(data) & ~IDT_ ##field## _MASK) | \
95362306a36Sopenharmony_ci	 ((u32)(value) << IDT_ ##field## _FLD))
95462306a36Sopenharmony_ci#define IS_FLD_SET(field, data, value) \
95562306a36Sopenharmony_ci	(((u32)(data) & IDT_ ##field## _MASK) == IDT_ ##field## _ ##value)
95662306a36Sopenharmony_ci
95762306a36Sopenharmony_ci/*
95862306a36Sopenharmony_ci * Useful registers masks:
95962306a36Sopenharmony_ci * @IDT_DBELL_MASK:	Doorbell bits mask
96062306a36Sopenharmony_ci * @IDT_OUTMSG_MASK:	Out messages status bits mask
96162306a36Sopenharmony_ci * @IDT_INMSG_MASK:	In messages status bits mask
96262306a36Sopenharmony_ci * @IDT_MSG_MASK:	Any message status bits mask
96362306a36Sopenharmony_ci */
96462306a36Sopenharmony_ci#define IDT_DBELL_MASK		((u32)0xFFFFFFFFU)
96562306a36Sopenharmony_ci#define IDT_OUTMSG_MASK		((u32)0x0000000FU)
96662306a36Sopenharmony_ci#define IDT_INMSG_MASK		((u32)0x000F0000U)
96762306a36Sopenharmony_ci#define IDT_MSG_MASK		(IDT_INMSG_MASK | IDT_OUTMSG_MASK)
96862306a36Sopenharmony_ci
96962306a36Sopenharmony_ci/*
97062306a36Sopenharmony_ci * Number of IDT NTB resources:
97162306a36Sopenharmony_ci * @IDT_MSG_CNT:	Number of Message registers
97262306a36Sopenharmony_ci * @IDT_BAR_CNT:	Number of BARs of each port
97362306a36Sopenharmony_ci * @IDT_MTBL_ENTRY_CNT:	Number mapping table entries
97462306a36Sopenharmony_ci */
97562306a36Sopenharmony_ci#define IDT_MSG_CNT		4
97662306a36Sopenharmony_ci#define IDT_BAR_CNT		6
97762306a36Sopenharmony_ci#define IDT_MTBL_ENTRY_CNT	64
97862306a36Sopenharmony_ci
97962306a36Sopenharmony_ci/*
98062306a36Sopenharmony_ci * General IDT PCIe-switch constant
98162306a36Sopenharmony_ci * @IDT_MAX_NR_PORTS:	Maximum number of ports per IDT PCIe-switch
98262306a36Sopenharmony_ci * @IDT_MAX_NR_PARTS:	Maximum number of partitions per IDT PCIe-switch
98362306a36Sopenharmony_ci * @IDT_MAX_NR_PEERS:	Maximum number of NT-peers per IDT PCIe-switch
98462306a36Sopenharmony_ci * @IDT_MAX_NR_MWS:	Maximum number of Memory Widows
98562306a36Sopenharmony_ci * @IDT_PCIE_REGSIZE:	Size of the registers in bytes
98662306a36Sopenharmony_ci * @IDT_TRANS_ALIGN:	Alignment of translated base address
98762306a36Sopenharmony_ci * @IDT_DIR_SIZE_ALIGN:	Alignment of size setting for direct translated MWs.
98862306a36Sopenharmony_ci *			Even though the lower 10 bits are reserved, they are
98962306a36Sopenharmony_ci *			treated by IDT as one's so basically there is no any
99062306a36Sopenharmony_ci *			alignment of size limit for DIR address translation.
99162306a36Sopenharmony_ci */
99262306a36Sopenharmony_ci#define IDT_MAX_NR_PORTS	24
99362306a36Sopenharmony_ci#define IDT_MAX_NR_PARTS	8
99462306a36Sopenharmony_ci#define IDT_MAX_NR_PEERS	8
99562306a36Sopenharmony_ci#define IDT_MAX_NR_MWS		29
99662306a36Sopenharmony_ci#define IDT_PCIE_REGSIZE	4
99762306a36Sopenharmony_ci#define IDT_TRANS_ALIGN		4
99862306a36Sopenharmony_ci#define IDT_DIR_SIZE_ALIGN	1
99962306a36Sopenharmony_ci
100062306a36Sopenharmony_ci/*
100162306a36Sopenharmony_ci * IDT PCIe-switch temperature sensor value limits
100262306a36Sopenharmony_ci * @IDT_TEMP_MIN_MDEG:	Minimal integer value of temperature
100362306a36Sopenharmony_ci * @IDT_TEMP_MAX_MDEG:	Maximal integer value of temperature
100462306a36Sopenharmony_ci * @IDT_TEMP_MIN_OFFSET:Minimal integer value of temperature offset
100562306a36Sopenharmony_ci * @IDT_TEMP_MAX_OFFSET:Maximal integer value of temperature offset
100662306a36Sopenharmony_ci */
100762306a36Sopenharmony_ci#define IDT_TEMP_MIN_MDEG	0
100862306a36Sopenharmony_ci#define IDT_TEMP_MAX_MDEG	127500
100962306a36Sopenharmony_ci#define IDT_TEMP_MIN_OFFSET	-64000
101062306a36Sopenharmony_ci#define IDT_TEMP_MAX_OFFSET	63500
101162306a36Sopenharmony_ci
101262306a36Sopenharmony_ci/*
101362306a36Sopenharmony_ci * Temperature sensor values enumeration
101462306a36Sopenharmony_ci * @IDT_TEMP_CUR:	Current temperature
101562306a36Sopenharmony_ci * @IDT_TEMP_LOW:	Lowest historical temperature
101662306a36Sopenharmony_ci * @IDT_TEMP_HIGH:	Highest historical temperature
101762306a36Sopenharmony_ci * @IDT_TEMP_OFFSET:	Current temperature offset
101862306a36Sopenharmony_ci */
101962306a36Sopenharmony_cienum idt_temp_val {
102062306a36Sopenharmony_ci	IDT_TEMP_CUR,
102162306a36Sopenharmony_ci	IDT_TEMP_LOW,
102262306a36Sopenharmony_ci	IDT_TEMP_HIGH,
102362306a36Sopenharmony_ci	IDT_TEMP_OFFSET
102462306a36Sopenharmony_ci};
102562306a36Sopenharmony_ci
102662306a36Sopenharmony_ci/*
102762306a36Sopenharmony_ci * IDT Memory Windows type. Depending on the device settings, IDT supports
102862306a36Sopenharmony_ci * Direct Address Translation MW registers and Lookup Table registers
102962306a36Sopenharmony_ci * @IDT_MW_DIR:		Direct address translation
103062306a36Sopenharmony_ci * @IDT_MW_LUT12:	12-entry lookup table entry
103162306a36Sopenharmony_ci * @IDT_MW_LUT24:	24-entry lookup table entry
103262306a36Sopenharmony_ci *
103362306a36Sopenharmony_ci * NOTE These values are exactly the same as one of the BARSETUP ATRAN field
103462306a36Sopenharmony_ci */
103562306a36Sopenharmony_cienum idt_mw_type {
103662306a36Sopenharmony_ci	IDT_MW_DIR = 0x0,
103762306a36Sopenharmony_ci	IDT_MW_LUT12 = 0x1,
103862306a36Sopenharmony_ci	IDT_MW_LUT24 = 0x2
103962306a36Sopenharmony_ci};
104062306a36Sopenharmony_ci
104162306a36Sopenharmony_ci/*
104262306a36Sopenharmony_ci * IDT PCIe-switch model private data
104362306a36Sopenharmony_ci * @name:	Device name
104462306a36Sopenharmony_ci * @port_cnt:	Total number of NT endpoint ports
104562306a36Sopenharmony_ci * @ports:	Port ids
104662306a36Sopenharmony_ci */
104762306a36Sopenharmony_cistruct idt_89hpes_cfg {
104862306a36Sopenharmony_ci	char *name;
104962306a36Sopenharmony_ci	unsigned char port_cnt;
105062306a36Sopenharmony_ci	unsigned char ports[];
105162306a36Sopenharmony_ci};
105262306a36Sopenharmony_ci
105362306a36Sopenharmony_ci/*
105462306a36Sopenharmony_ci * Memory window configuration structure
105562306a36Sopenharmony_ci * @type:	Type of the memory window (direct address translation or lookup
105662306a36Sopenharmony_ci *		table)
105762306a36Sopenharmony_ci *
105862306a36Sopenharmony_ci * @bar:	PCIe BAR the memory window referenced to
105962306a36Sopenharmony_ci * @idx:	Index of the memory window within the BAR
106062306a36Sopenharmony_ci *
106162306a36Sopenharmony_ci * @addr_align:	Alignment of translated address
106262306a36Sopenharmony_ci * @size_align:	Alignment of memory window size
106362306a36Sopenharmony_ci * @size_max:	Maximum size of memory window
106462306a36Sopenharmony_ci */
106562306a36Sopenharmony_cistruct idt_mw_cfg {
106662306a36Sopenharmony_ci	enum idt_mw_type type;
106762306a36Sopenharmony_ci
106862306a36Sopenharmony_ci	unsigned char bar;
106962306a36Sopenharmony_ci	unsigned char idx;
107062306a36Sopenharmony_ci
107162306a36Sopenharmony_ci	u64 addr_align;
107262306a36Sopenharmony_ci	u64 size_align;
107362306a36Sopenharmony_ci	u64 size_max;
107462306a36Sopenharmony_ci};
107562306a36Sopenharmony_ci
107662306a36Sopenharmony_ci/*
107762306a36Sopenharmony_ci * Description structure of peer IDT NT-functions:
107862306a36Sopenharmony_ci * @port:		NT-function port
107962306a36Sopenharmony_ci * @part:		NT-function partition
108062306a36Sopenharmony_ci *
108162306a36Sopenharmony_ci * @mw_cnt:		Number of memory windows supported by NT-function
108262306a36Sopenharmony_ci * @mws:		Array of memory windows descriptors
108362306a36Sopenharmony_ci */
108462306a36Sopenharmony_cistruct idt_ntb_peer {
108562306a36Sopenharmony_ci	unsigned char port;
108662306a36Sopenharmony_ci	unsigned char part;
108762306a36Sopenharmony_ci
108862306a36Sopenharmony_ci	unsigned char mw_cnt;
108962306a36Sopenharmony_ci	struct idt_mw_cfg *mws;
109062306a36Sopenharmony_ci};
109162306a36Sopenharmony_ci
109262306a36Sopenharmony_ci/*
109362306a36Sopenharmony_ci * Description structure of local IDT NT-function:
109462306a36Sopenharmony_ci * @ntb:		Linux NTB-device description structure
109562306a36Sopenharmony_ci * @swcfg:		Pointer to the structure of local IDT PCIe-switch
109662306a36Sopenharmony_ci *			specific cofnfigurations
109762306a36Sopenharmony_ci *
109862306a36Sopenharmony_ci * @port:		Local NT-function port
109962306a36Sopenharmony_ci * @part:		Local NT-function partition
110062306a36Sopenharmony_ci *
110162306a36Sopenharmony_ci * @peer_cnt:		Number of peers with activated NTB-function
110262306a36Sopenharmony_ci * @peers:		Array of peers descripting structures
110362306a36Sopenharmony_ci * @port_idx_map:	Map of port number -> peer index
110462306a36Sopenharmony_ci * @part_idx_map:	Map of partition number -> peer index
110562306a36Sopenharmony_ci *
110662306a36Sopenharmony_ci * @mtbl_lock:		Mapping table access lock
110762306a36Sopenharmony_ci *
110862306a36Sopenharmony_ci * @mw_cnt:		Number of memory windows supported by NT-function
110962306a36Sopenharmony_ci * @mws:		Array of memory windows descriptors
111062306a36Sopenharmony_ci * @lut_lock:		Lookup table access lock
111162306a36Sopenharmony_ci *
111262306a36Sopenharmony_ci * @msg_locks:		Message registers mapping table lockers
111362306a36Sopenharmony_ci *
111462306a36Sopenharmony_ci * @cfgspc:		Virtual address of the memory mapped configuration
111562306a36Sopenharmony_ci *			space of the NT-function
111662306a36Sopenharmony_ci * @db_mask_lock:	Doorbell mask register lock
111762306a36Sopenharmony_ci * @msg_mask_lock:	Message mask register lock
111862306a36Sopenharmony_ci * @gasa_lock:		GASA registers access lock
111962306a36Sopenharmony_ci *
112062306a36Sopenharmony_ci * @hwmon_mtx:		Temperature sensor interface update mutex
112162306a36Sopenharmony_ci *
112262306a36Sopenharmony_ci * @dbgfs_info:		DebugFS info node
112362306a36Sopenharmony_ci */
112462306a36Sopenharmony_cistruct idt_ntb_dev {
112562306a36Sopenharmony_ci	struct ntb_dev ntb;
112662306a36Sopenharmony_ci	struct idt_89hpes_cfg *swcfg;
112762306a36Sopenharmony_ci
112862306a36Sopenharmony_ci	unsigned char port;
112962306a36Sopenharmony_ci	unsigned char part;
113062306a36Sopenharmony_ci
113162306a36Sopenharmony_ci	unsigned char peer_cnt;
113262306a36Sopenharmony_ci	struct idt_ntb_peer peers[IDT_MAX_NR_PEERS];
113362306a36Sopenharmony_ci	char port_idx_map[IDT_MAX_NR_PORTS];
113462306a36Sopenharmony_ci	char part_idx_map[IDT_MAX_NR_PARTS];
113562306a36Sopenharmony_ci
113662306a36Sopenharmony_ci	spinlock_t mtbl_lock;
113762306a36Sopenharmony_ci
113862306a36Sopenharmony_ci	unsigned char mw_cnt;
113962306a36Sopenharmony_ci	struct idt_mw_cfg *mws;
114062306a36Sopenharmony_ci	spinlock_t lut_lock;
114162306a36Sopenharmony_ci
114262306a36Sopenharmony_ci	spinlock_t msg_locks[IDT_MSG_CNT];
114362306a36Sopenharmony_ci
114462306a36Sopenharmony_ci	void __iomem *cfgspc;
114562306a36Sopenharmony_ci	spinlock_t db_mask_lock;
114662306a36Sopenharmony_ci	spinlock_t msg_mask_lock;
114762306a36Sopenharmony_ci	spinlock_t gasa_lock;
114862306a36Sopenharmony_ci
114962306a36Sopenharmony_ci	struct mutex hwmon_mtx;
115062306a36Sopenharmony_ci
115162306a36Sopenharmony_ci	struct dentry *dbgfs_info;
115262306a36Sopenharmony_ci};
115362306a36Sopenharmony_ci#define to_ndev_ntb(__ntb) container_of(__ntb, struct idt_ntb_dev, ntb)
115462306a36Sopenharmony_ci
115562306a36Sopenharmony_ci/*
115662306a36Sopenharmony_ci * Descriptor of the IDT PCIe-switch BAR resources
115762306a36Sopenharmony_ci * @setup:	BAR setup register
115862306a36Sopenharmony_ci * @limit:	BAR limit register
115962306a36Sopenharmony_ci * @ltbase:	Lower translated base address
116062306a36Sopenharmony_ci * @utbase:	Upper translated base address
116162306a36Sopenharmony_ci */
116262306a36Sopenharmony_cistruct idt_ntb_bar {
116362306a36Sopenharmony_ci	unsigned int setup;
116462306a36Sopenharmony_ci	unsigned int limit;
116562306a36Sopenharmony_ci	unsigned int ltbase;
116662306a36Sopenharmony_ci	unsigned int utbase;
116762306a36Sopenharmony_ci};
116862306a36Sopenharmony_ci
116962306a36Sopenharmony_ci/*
117062306a36Sopenharmony_ci * Descriptor of the IDT PCIe-switch message resources
117162306a36Sopenharmony_ci * @in:		Inbound message register
117262306a36Sopenharmony_ci * @out:	Outbound message register
117362306a36Sopenharmony_ci * @src:	Source of inbound message register
117462306a36Sopenharmony_ci */
117562306a36Sopenharmony_cistruct idt_ntb_msg {
117662306a36Sopenharmony_ci	unsigned int in;
117762306a36Sopenharmony_ci	unsigned int out;
117862306a36Sopenharmony_ci	unsigned int src;
117962306a36Sopenharmony_ci};
118062306a36Sopenharmony_ci
118162306a36Sopenharmony_ci/*
118262306a36Sopenharmony_ci * Descriptor of the IDT PCIe-switch NT-function specific parameters in the
118362306a36Sopenharmony_ci * PCI Configuration Space
118462306a36Sopenharmony_ci * @bars:	BARs related registers
118562306a36Sopenharmony_ci * @msgs:	Messaging related registers
118662306a36Sopenharmony_ci */
118762306a36Sopenharmony_cistruct idt_ntb_regs {
118862306a36Sopenharmony_ci	struct idt_ntb_bar bars[IDT_BAR_CNT];
118962306a36Sopenharmony_ci	struct idt_ntb_msg msgs[IDT_MSG_CNT];
119062306a36Sopenharmony_ci};
119162306a36Sopenharmony_ci
119262306a36Sopenharmony_ci/*
119362306a36Sopenharmony_ci * Descriptor of the IDT PCIe-switch port specific parameters in the
119462306a36Sopenharmony_ci * Global Configuration Space
119562306a36Sopenharmony_ci * @pcicmdsts:	 PCI command/status register
119662306a36Sopenharmony_ci * @pcielctlsts: PCIe link control/status
119762306a36Sopenharmony_ci *
119862306a36Sopenharmony_ci * @ctl:	Port control register
119962306a36Sopenharmony_ci * @sts:	Port status register
120062306a36Sopenharmony_ci *
120162306a36Sopenharmony_ci * @bars:	BARs related registers
120262306a36Sopenharmony_ci */
120362306a36Sopenharmony_cistruct idt_ntb_port {
120462306a36Sopenharmony_ci	unsigned int pcicmdsts;
120562306a36Sopenharmony_ci	unsigned int pcielctlsts;
120662306a36Sopenharmony_ci	unsigned int ntctl;
120762306a36Sopenharmony_ci
120862306a36Sopenharmony_ci	unsigned int ctl;
120962306a36Sopenharmony_ci	unsigned int sts;
121062306a36Sopenharmony_ci
121162306a36Sopenharmony_ci	struct idt_ntb_bar bars[IDT_BAR_CNT];
121262306a36Sopenharmony_ci};
121362306a36Sopenharmony_ci
121462306a36Sopenharmony_ci/*
121562306a36Sopenharmony_ci * Descriptor of the IDT PCIe-switch partition specific parameters.
121662306a36Sopenharmony_ci * @ctl:	Partition control register in the Global Address Space
121762306a36Sopenharmony_ci * @sts:	Partition status register in the Global Address Space
121862306a36Sopenharmony_ci * @msgctl:	Messages control registers
121962306a36Sopenharmony_ci */
122062306a36Sopenharmony_cistruct idt_ntb_part {
122162306a36Sopenharmony_ci	unsigned int ctl;
122262306a36Sopenharmony_ci	unsigned int sts;
122362306a36Sopenharmony_ci	unsigned int msgctl[IDT_MSG_CNT];
122462306a36Sopenharmony_ci};
122562306a36Sopenharmony_ci
122662306a36Sopenharmony_ci#endif /* NTB_HW_IDT_H */
1227