Linux Audio
Check our new training course
Embedded Linux Audio
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
/* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */ /* Copyright(c) 2020 Intel Corporation. All rights reserved. */ #ifndef _NTB_INTEL_GEN4_H_ #define _NTB_INTEL_GEN4_H_ #include "ntb_hw_intel.h" /* Supported PCI device revision range for ICX */ #define PCI_DEVICE_REVISION_ICX_MIN 0x2 #define PCI_DEVICE_REVISION_ICX_MAX 0xF /* Intel Gen4 NTB hardware */ /* PCIe config space */ #define GEN4_IMBAR23SZ_OFFSET 0x00c4 #define GEN4_IMBAR45SZ_OFFSET 0x00c5 #define GEN4_EMBAR23SZ_OFFSET 0x00c6 #define GEN4_EMBAR45SZ_OFFSET 0x00c7 #define GEN4_DEVCTRL_OFFSET 0x0048 #define GEN4_DEVSTS_OFFSET 0x004a #define GEN4_UNCERRSTS_OFFSET 0x0104 #define GEN4_CORERRSTS_OFFSET 0x0110 /* BAR0 MMIO */ #define GEN4_NTBCNTL_OFFSET 0x0000 #define GEN4_IM23XBASE_OFFSET 0x0010 /* IMBAR1XBASE */ #define GEN4_IM23XLMT_OFFSET 0x0018 /* IMBAR1XLMT */ #define GEN4_IM45XBASE_OFFSET 0x0020 /* IMBAR2XBASE */ #define GEN4_IM45XLMT_OFFSET 0x0028 /* IMBAR2XLMT */ #define GEN4_IM_INT_STATUS_OFFSET 0x0040 #define GEN4_IM_INT_DISABLE_OFFSET 0x0048 #define GEN4_INTVEC_OFFSET 0x0050 /* 0-32 vecs */ #define GEN4_IM23XBASEIDX_OFFSET 0x0074 #define GEN4_IM45XBASEIDX_OFFSET 0x0076 #define GEN4_IM_SPAD_OFFSET 0x0080 /* 0-15 SPADs */ #define GEN4_IM_SPAD_SEM_OFFSET 0x00c0 /* SPAD hw semaphore */ #define GEN4_IM_SPAD_STICKY_OFFSET 0x00c4 /* sticky SPAD */ #define GEN4_IM_DOORBELL_OFFSET 0x0100 /* 0-31 doorbells */ #define GEN4_LTR_SWSEL_OFFSET 0x30ec #define GEN4_LTR_ACTIVE_OFFSET 0x30f0 #define GEN4_LTR_IDLE_OFFSET 0x30f4 #define GEN4_EM_SPAD_OFFSET 0x8080 /* note, link status is now in MMIO and not config space for NTB */ #define GEN4_LINK_CTRL_OFFSET 0xb050 #define GEN4_LINK_STATUS_OFFSET 0xb052 #define GEN4_PPD0_OFFSET 0xb0d4 #define GEN4_PPD1_OFFSET 0xb4c0 #define GEN4_LTSSMSTATEJMP 0xf040 #define GEN4_PPD_CLEAR_TRN 0x0001 #define GEN4_PPD_LINKTRN 0x0008 #define GEN4_PPD_CONN_MASK 0x0300 #define SPR_PPD_CONN_MASK 0x0700 #define GEN4_PPD_CONN_B2B 0x0200 #define GEN4_PPD_DEV_MASK 0x1000 #define GEN4_PPD_DEV_DSD 0x1000 #define GEN4_PPD_DEV_USD 0x0000 #define SPR_PPD_DEV_MASK 0x4000 #define SPR_PPD_DEV_DSD 0x4000 #define SPR_PPD_DEV_USD 0x0000 #define GEN4_LINK_CTRL_LINK_DISABLE 0x0010 #define GEN4_SLOTSTS 0xb05a #define GEN4_SLOTSTS_DLLSCS 0x100 #define GEN4_PPD_TOPO_MASK (GEN4_PPD_CONN_MASK | GEN4_PPD_DEV_MASK) #define GEN4_PPD_TOPO_B2B_USD (GEN4_PPD_CONN_B2B | GEN4_PPD_DEV_USD) #define GEN4_PPD_TOPO_B2B_DSD (GEN4_PPD_CONN_B2B | GEN4_PPD_DEV_DSD) #define SPR_PPD_TOPO_MASK (SPR_PPD_CONN_MASK | SPR_PPD_DEV_MASK) #define SPR_PPD_TOPO_B2B_USD (GEN4_PPD_CONN_B2B | SPR_PPD_DEV_USD) #define SPR_PPD_TOPO_B2B_DSD (GEN4_PPD_CONN_B2B | SPR_PPD_DEV_DSD) #define GEN4_DB_COUNT 32 #define GEN4_DB_LINK 32 #define GEN4_DB_LINK_BIT BIT_ULL(GEN4_DB_LINK) #define GEN4_DB_MSIX_VECTOR_COUNT 33 #define GEN4_DB_MSIX_VECTOR_SHIFT 1 #define GEN4_DB_TOTAL_SHIFT 33 #define GEN4_SPAD_COUNT 16 #define NTB_CTL_E2I_BAR23_SNOOP 0x000004 #define NTB_CTL_E2I_BAR23_NOSNOOP 0x000008 #define NTB_CTL_I2E_BAR23_SNOOP 0x000010 #define NTB_CTL_I2E_BAR23_NOSNOOP 0x000020 #define NTB_CTL_E2I_BAR45_SNOOP 0x000040 #define NTB_CTL_E2I_BAR45_NOSNOO 0x000080 #define NTB_CTL_I2E_BAR45_SNOOP 0x000100 #define NTB_CTL_I2E_BAR45_NOSNOOP 0x000200 #define NTB_CTL_BUSNO_DIS_INC 0x000400 #define NTB_CTL_LINK_DOWN 0x010000 #define NTB_SJC_FORCEDETECT 0x000004 #define NTB_LTR_SWSEL_ACTIVE 0x0 #define NTB_LTR_SWSEL_IDLE 0x1 #define NTB_LTR_NS_SHIFT 16 #define NTB_LTR_ACTIVE_VAL 0x0000 /* 0 us */ #define NTB_LTR_ACTIVE_LATSCALE 0x0800 /* 1us scale */ #define NTB_LTR_ACTIVE_REQMNT 0x8000 /* snoop req enable */ #define NTB_LTR_IDLE_VAL 0x0258 /* 600 us */ #define NTB_LTR_IDLE_LATSCALE 0x0800 /* 1us scale */ #define NTB_LTR_IDLE_REQMNT 0x8000 /* snoop req enable */ ssize_t ndev_ntb4_debugfs_read(struct file *filp, char __user *ubuf, size_t count, loff_t *offp); int gen4_init_dev(struct intel_ntb_dev *ndev); ssize_t ndev_ntb4_debugfs_read(struct file *filp, char __user *ubuf, size_t count, loff_t *offp); extern const struct ntb_dev_ops intel_ntb4_ops; static inline int pdev_is_ICX(struct pci_dev *pdev) { if (pdev_is_gen4(pdev) && pdev->revision >= PCI_DEVICE_REVISION_ICX_MIN && pdev->revision <= PCI_DEVICE_REVISION_ICX_MAX) return 1; return 0; } static inline int pdev_is_SPR(struct pci_dev *pdev) { if (pdev_is_gen4(pdev) && pdev->revision > PCI_DEVICE_REVISION_ICX_MAX) return 1; return 0; } #endif