Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1433564 > unrolled thread
| Started by | Amir Levy <amir.jer.levy@intel.com> |
|---|---|
| First post | 2016-06-29 10:40 +0200 |
| Last post | 2016-06-29 10:50 +0200 |
| Articles | 5 — 1 participant |
Back to article view | Back to linux.kernel
[PATCH v2 0/8] thunderbolt: Introducing Thunderbolt(TM) networking Amir Levy <amir.jer.levy@intel.com> - 2016-06-29 10:40 +0200
[PATCH v2 8/8] thunderbolt: Networking doc Amir Levy <amir.jer.levy@intel.com> - 2016-06-29 10:40 +0200
[PATCH v2 2/8] thunderbolt: Updating device IDs Amir Levy <amir.jer.levy@intel.com> - 2016-06-29 10:50 +0200
[PATCH v2 4/8] thunderbolt: Kconfig for Thunderbolt(TM) networking Amir Levy <amir.jer.levy@intel.com> - 2016-06-29 10:50 +0200
[PATCH v2 3/8] thunderbolt: Updating the register definitions Amir Levy <amir.jer.levy@intel.com> - 2016-06-29 10:50 +0200
| From | Amir Levy <amir.jer.levy@intel.com> |
|---|---|
| Date | 2016-06-29 10:40 +0200 |
| Subject | [PATCH v2 0/8] thunderbolt: Introducing Thunderbolt(TM) networking |
| Message-ID | <rPjcm-1RY-15@gated-at.bofh.it> |
This is version 2 of Thunderbolt(TM) driver for non-Apple hardware. Changes since v1: - Separation to 2 modules. - Moved ICM specific registers definition to ICM header file. - Added new Thunderbolt device IDs. - Renamed the Thunderbolt networking documentation. - General cleanups These patches were pushed to GitHub where they can be reviewed more comfortably with green/red highlighting: https://github.com/01org/thunderbolt-software-kernel-tree Daemon code: https://github.com/01org/thunderbolt-software-daemon For reference, here's a link to version 1: [v1]: http://www.spinics.net/lists/linux-pci/msg51287.html Amir Levy (8): thunderbolt: Macro rename thunderbolt: Updating device IDs thunderbolt: Updating the register definitions thunderbolt: Kconfig for Thunderbolt(TM) networking thunderbolt: Communication with the ICM (firmware) thunderbolt: Networking state machine thunderbolt: Networking transmit and receive thunderbolt: Networking doc Documentation/00-INDEX | 2 + Documentation/thunderbolt-networking.txt | 135 ++ drivers/thunderbolt/Kconfig | 25 +- drivers/thunderbolt/Makefile | 4 +- drivers/thunderbolt/icm_nhi.c | 1631 +++++++++++++++++++++ drivers/thunderbolt/icm_nhi.h | 84 ++ drivers/thunderbolt/net.c | 2277 ++++++++++++++++++++++++++++++ drivers/thunderbolt/net.h | 274 ++++ drivers/thunderbolt/nhi_regs.h | 115 +- include/linux/pci_ids.h | 44 +- 10 files changed, 4565 insertions(+), 26 deletions(-) create mode 100644 Documentation/thunderbolt-networking.txt create mode 100644 drivers/thunderbolt/icm_nhi.c create mode 100644 drivers/thunderbolt/icm_nhi.h create mode 100644 drivers/thunderbolt/net.c create mode 100644 drivers/thunderbolt/net.h -- 2.7.4
[toc] | [next] | [standalone]
| From | Amir Levy <amir.jer.levy@intel.com> |
|---|---|
| Date | 2016-06-29 10:40 +0200 |
| Subject | [PATCH v2 8/8] thunderbolt: Networking doc |
| Message-ID | <rPjcm-1RY-21@gated-at.bofh.it> |
| In reply to | #1433564 |
Adding Thunderbolt(TM) networking documentation. Signed-off-by: Amir Levy <amir.jer.levy@intel.com> --- Documentation/00-INDEX | 2 + Documentation/thunderbolt-networking.txt | 135 +++++++++++++++++++++++++++++++ 2 files changed, 137 insertions(+) create mode 100644 Documentation/thunderbolt-networking.txt diff --git a/Documentation/00-INDEX b/Documentation/00-INDEX index cd077ca..8cf1717 100644 --- a/Documentation/00-INDEX +++ b/Documentation/00-INDEX @@ -439,6 +439,8 @@ this_cpu_ops.txt - List rationale behind and the way to use this_cpu operations. thermal/ - directory with information on managing thermal issues (CPU/temp) +thunderbolt-networking.txt + - Thunderbolt(TM) Networking driver description. trace/ - directory with info on tracing technologies within linux unaligned-memory-access.txt diff --git a/Documentation/thunderbolt-networking.txt b/Documentation/thunderbolt-networking.txt new file mode 100644 index 0000000..b7714cf --- /dev/null +++ b/Documentation/thunderbolt-networking.txt @@ -0,0 +1,135 @@ +Intel Thunderbolt(TM) Linux driver +================================== + +Copyright(c) 2013 - 2016 Intel Corporation. + +Contact Information: +Intel Thunderbolt mailing list <thunderbolt-software@lists.01.org> +Edited by Michael Jamet <michael.jamet@intel.com> + +Overview +======== + +Thunderbolt(TM) Networking mode is introduced with this driver. +This kernel code creates an ethernet device utilized in computer to computer +communication over a Thunderbolt cable. +This driver has been added on the top of the existing thunderbolt driver +for systems with firwmare (FW) based Thunderbolt controllers supporting +Thunderbolt Networking. + +Files +===== + +- icm_nhi.c/h: These files allow communication with the FW (a.k.a ICM) based controller. + In addition, they create an interface for netlink communication with + a user space daemon. + +- net.c/net.h: These files implement the 'eth' interface for the Thunderbolt(TM) + networking. + +Interface to user space +======================= + +The interface to the user space module is implemented through a Generic Netlink. +In order to be accessed by the user space module, both kernel and user space +modules have to register with the same GENL_NAME. In our case, this is +simply "thunderbolt". +The registration is done at driver initialization time for all instances of +the Thunderbolt controllers. +The communication is then carried through pre-defined Thunderbolt messages. +Each specific message has a callback function that is called when +the related message is received. + +The messages are defined as follows: +* NHI_CMD_UNSPEC: Not used. +* NHI_CMD_SUBSCRIBE: Subscription request from daemon to driver to open the + communication channel. +* NHI_CMD_UNSUBSCRIBE: Request from daemon to driver to unsubscribe + to close communication channel. +* NHI_CMD_QUERY_INFORMATION: Request information from the driver such as + driver version, FW version offset, number of ports in the controller + and DMA port. +* NHI_CMD_MSG_TO_ICM: Message from user space module to FW. +* NHI_CMD_MSG_FROM_ICM: Response from FW to user space module. +* NHI_CMD_MAILBOX: Message that uses mailbox mechanism such as FW policy + changes or disconnect path. +* NHI_CMD_APPROVE_TBT_NETWORKING: Request from user space + module to FW to establish path. +* NHI_CMD_ICM_IN_SAFE_MODE: Indication that the FW has entered safe mode. + +Communication with ICM (Firmware) +================================= + +The communication with ICM is principally achieved through +a DMA mechanism on Ring 0. +The driver allocates a shared memory that is physically mapped onto +the DMA physical space at Ring 0. + +Interrupts +========== + +Thunderbolt relies on MSI-X interrupts. +The MSI-X vector is allocated as follows: +ICM + - Tx: MSI-X vector index 0 + - Rx: MSI-X vector index 1 + +Port 0 + - Tx: MSI-X vector index 2 + - Rx: MSI-X vector index 3 + +Port 1 + - Tx: MSI-X vector index 4 + - Rx: MSI-X vector index 5 + +ICM interrupts are used for communication with ICM only. +Port 0 and Port 1 interrupts are used for Thunderbolt Networking +communications. +In case MSI-X is not available, the driver requests to enable MSI only. + +Mutexes, semaphores and spinlocks +================================= + +The driver should be able to operate in an environment where hardware +is asynchronously accessed by multiple entities such as netlink, +multiple controllers etc. + +* send_sem: This semaphore enforces unique sender (one sender at a time) + to avoid wrong impairing with responses. FW may process one message + at the time. +* d0_exit_send_mutex: This mutex protects D0 exit (D3) situation + to avoid continuing to send messages to FW. +* d0_exit_mailbox_mutex: This mutex protects D0 exit (D3) situation to + avoid continuing to send commands to mailbox. +* mailbox_mutex: This mutex enforces unique sender (one sender at a time) + for the mailbox command. + A mutex is sufficient since the mailbox mechanism uses a polling mechanism + to get the command response. +* lock: This spinlock protects from simultaneous changes during + disable/enable interrupts. +* state_lock: This mutex comes to protect changes during net device state + changes and net_device operations. +* controllers_list_rwsem: This read/write sempahore syncs the access to + the controllers list when there are multiple controllers in the system. + +FW path enablement +================== + +In order to SW to communicate with the FW, the driver needs to send to FW +the PDF driver ready command and receive response from FW. +The driver ready command PDF value is 12 and the response is 13. +Once the exchange is completed, the user space module should be able to send +messages through the driver to the FW and FW starts to send notifications +about HW/FW events. + +Information +=========== + +Mailing list: + thunderbolt-software@lists.01.org + Register at: https://lists.01.org/mailman/listinfo/thunderbolt-software + Archives at: https://lists.01.org/pipermail/thunderbolt-software/ + +For additional information about Thunderbolt technology visit: + https://01.org/thunderbolt-sw + https://thunderbolttechnology.net/ -- 2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Amir Levy <amir.jer.levy@intel.com> |
|---|---|
| Date | 2016-06-29 10:50 +0200 |
| Subject | [PATCH v2 2/8] thunderbolt: Updating device IDs |
| Message-ID | <rPjm1-1VD-7@gated-at.bofh.it> |
| In reply to | #1433564 |
Adding the new Thunderbolt(TM) device IDs to the list. Signed-off-by: Amir Levy <amir.jer.levy@intel.com> --- include/linux/pci_ids.h | 44 ++++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index c58752f..2d4cc50 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h @@ -2604,24 +2604,32 @@ #define PCI_DEVICE_ID_INTEL_82441 0x1237 #define PCI_DEVICE_ID_INTEL_82380FB 0x124b #define PCI_DEVICE_ID_INTEL_82439 0x1250 -#define PCI_DEVICE_ID_INTEL_LIGHT_RIDGE 0x1513 /* Tbt 1 Gen 1 */ -#define PCI_DEVICE_ID_INTEL_EAGLE_RIDGE 0x151a -#define PCI_DEVICE_ID_INTEL_LIGHT_PEAK 0x151b -#define PCI_DEVICE_ID_INTEL_CACTUS_RIDGE_4C 0x1547 /* Tbt 1 Gen 2 */ -#define PCI_DEVICE_ID_INTEL_CACTUS_RIDGE_2C 0x1548 -#define PCI_DEVICE_ID_INTEL_PORT_RIDGE 0x1549 -#define PCI_DEVICE_ID_INTEL_REDWOOD_RIDGE_2C_NHI 0x1566 /* Tbt 1 Gen 3 */ -#define PCI_DEVICE_ID_INTEL_REDWOOD_RIDGE_2C_BRIDGE 0x1567 -#define PCI_DEVICE_ID_INTEL_REDWOOD_RIDGE_4C_NHI 0x1568 -#define PCI_DEVICE_ID_INTEL_REDWOOD_RIDGE_4C_BRIDGE 0x1569 -#define PCI_DEVICE_ID_INTEL_FALCON_RIDGE_2C_NHI 0x156a /* Thunderbolt 2 */ -#define PCI_DEVICE_ID_INTEL_FALCON_RIDGE_2C_BRIDGE 0x156b -#define PCI_DEVICE_ID_INTEL_FALCON_RIDGE_4C_NHI 0x156c -#define PCI_DEVICE_ID_INTEL_FALCON_RIDGE_4C_BRIDGE 0x156d -#define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_2C_NHI 0x1575 /* Thunderbolt 3 */ -#define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_2C_BRIDGE 0x1576 -#define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_4C_NHI 0x1577 -#define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_4C_BRIDGE 0x1578 +#define PCI_DEVICE_ID_INTEL_LIGHT_RIDGE 0x1513 /* Tbt 1 Gen 1 */ +#define PCI_DEVICE_ID_INTEL_EAGLE_RIDGE 0x151a +#define PCI_DEVICE_ID_INTEL_LIGHT_PEAK 0x151b +#define PCI_DEVICE_ID_INTEL_CACTUS_RIDGE_4C 0x1547 /* Tbt 1 Gen 2 */ +#define PCI_DEVICE_ID_INTEL_CACTUS_RIDGE_2C 0x1548 +#define PCI_DEVICE_ID_INTEL_PORT_RIDGE 0x1549 +#define PCI_DEVICE_ID_INTEL_REDWOOD_RIDGE_2C_NHI 0x1566 /* Tbt 1 Gen 3 */ +#define PCI_DEVICE_ID_INTEL_REDWOOD_RIDGE_2C_BRIDGE 0x1567 +#define PCI_DEVICE_ID_INTEL_REDWOOD_RIDGE_4C_NHI 0x1568 +#define PCI_DEVICE_ID_INTEL_REDWOOD_RIDGE_4C_BRIDGE 0x1569 +#define PCI_DEVICE_ID_INTEL_FALCON_RIDGE_2C_NHI 0x156a /* Thunderbolt 2 */ +#define PCI_DEVICE_ID_INTEL_FALCON_RIDGE_2C_BRIDGE 0x156b +#define PCI_DEVICE_ID_INTEL_FALCON_RIDGE_4C_NHI 0x156c +#define PCI_DEVICE_ID_INTEL_FALCON_RIDGE_4C_BRIDGE 0x156d +#define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_2C_NHI 0x1575 /* Thunderbolt 3 */ +#define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_2C_BRIDGE 0x1576 +#define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_4C_NHI 0x1577 +#define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_4C_BRIDGE 0x1578 +#define PCI_DEVICE_ID_INTEL_WIN_RIDGE_2C_NHI 0x157d /* Tbt 2 Low Pwr */ +#define PCI_DEVICE_ID_INTEL_WIN_RIDGE_2C_BRIDGE 0x157e +#define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_LP_NHI 0x15bf /* Tbt 3 Low Pwr */ +#define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_LP_BRIDGE 0x15c0 +#define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_C_4C_NHI 0x15d2 /* Thunderbolt 3 */ +#define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_C_4C_BRIDGE 0x15d3 +#define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_C_2C_NHI 0x15d9 +#define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_C_2C_BRIDGE 0x15da #define PCI_DEVICE_ID_INTEL_80960_RP 0x1960 #define PCI_DEVICE_ID_INTEL_82840_HB 0x1a21 #define PCI_DEVICE_ID_INTEL_82845_HB 0x1a30 -- 2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Amir Levy <amir.jer.levy@intel.com> |
|---|---|
| Date | 2016-06-29 10:50 +0200 |
| Subject | [PATCH v2 4/8] thunderbolt: Kconfig for Thunderbolt(TM) networking |
| Message-ID | <rPjm2-1VD-23@gated-at.bofh.it> |
| In reply to | #1433564 |
Updating the Kconfig Thunderbolt(TM) description.
Signed-off-by: Amir Levy <amir.jer.levy@intel.com>
---
drivers/thunderbolt/Kconfig | 25 +++++++++++++++++++++----
drivers/thunderbolt/Makefile | 2 +-
2 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/drivers/thunderbolt/Kconfig b/drivers/thunderbolt/Kconfig
index c121acc..d34b0f5 100644
--- a/drivers/thunderbolt/Kconfig
+++ b/drivers/thunderbolt/Kconfig
@@ -1,13 +1,30 @@
-menuconfig THUNDERBOLT
- tristate "Thunderbolt support for Apple devices"
+config THUNDERBOLT
+ tristate "Thunderbolt(TM) support"
depends on PCI
select CRC32
help
- Cactus Ridge Thunderbolt Controller driver
+ Thunderbolt(TM) Controller driver
+
+if THUNDERBOLT
+
+config THUNDERBOLT_APPLE
+ tristate "Apple hardware support"
+ help
This driver is required if you want to hotplug Thunderbolt devices on
Apple hardware.
Device chaining is currently not supported.
- To compile this driver a module, choose M here. The module will be
+ To compile this driver as a module, choose M here. The module will be
called thunderbolt.
+
+config THUNDERBOLT_ICM
+ tristate "Thunderbolt(TM) Networking"
+ help
+ This driver is required if you want Thunderbolt(TM) Networking on
+ non-Apple hardware.
+
+ To compile this driver as a module, choose M here. The module will be
+ called thunderbolt_icm.
+
+endif
diff --git a/drivers/thunderbolt/Makefile b/drivers/thunderbolt/Makefile
index 5d1053c..7a85bd1 100644
--- a/drivers/thunderbolt/Makefile
+++ b/drivers/thunderbolt/Makefile
@@ -1,3 +1,3 @@
-obj-${CONFIG_THUNDERBOLT} := thunderbolt.o
+obj-${CONFIG_THUNDERBOLT_APPLE} := thunderbolt.o
thunderbolt-objs := nhi.o ctl.o tb.o switch.o cap.o path.o tunnel_pci.o eeprom.o
--
2.7.4
[toc] | [prev] | [next] | [standalone]
| From | Amir Levy <amir.jer.levy@intel.com> |
|---|---|
| Date | 2016-06-29 10:50 +0200 |
| Subject | [PATCH v2 3/8] thunderbolt: Updating the register definitions |
| Message-ID | <rPjm2-1VD-21@gated-at.bofh.it> |
| In reply to | #1433564 |
Adding more Thunderbolt(TM) register definitions
and some helper macros.
Signed-off-by: Amir Levy <amir.jer.levy@intel.com>
---
drivers/thunderbolt/nhi_regs.h | 109 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 109 insertions(+)
diff --git a/drivers/thunderbolt/nhi_regs.h b/drivers/thunderbolt/nhi_regs.h
index 75cf069..b8e961f 100644
--- a/drivers/thunderbolt/nhi_regs.h
+++ b/drivers/thunderbolt/nhi_regs.h
@@ -9,6 +9,11 @@
#include <linux/types.h>
+#define NHI_MMIO_BAR 0
+
+#define TBT_RING_MIN_NUM_BUFFERS 2
+#define TBT_RING_MAX_FRAME_SIZE (4 * 1024)
+
enum ring_flags {
RING_FLAG_ISOCH_ENABLE = 1 << 27, /* TX only? */
RING_FLAG_E2E_FLOW_CONTROL = 1 << 28,
@@ -39,6 +44,33 @@ struct ring_desc {
u32 time; /* write zero */
} __packed;
+/**
+ * struct tbt_buf_desc - TX/RX ring buffer descriptor.
+ * This is same as struct ring_desc, but without the use of bitfields and
+ * with explicit endianity.
+ */
+struct tbt_buf_desc {
+ __le64 phys;
+ __le32 attributes;
+ __le32 time;
+};
+
+#define DESC_ATTR_LEN_SHIFT 0
+#define DESC_ATTR_LEN_MASK GENMASK(11, DESC_ATTR_LEN_SHIFT)
+#define DESC_ATTR_EOF_SHIFT 12
+#define DESC_ATTR_EOF_MASK GENMASK(15, DESC_ATTR_EOF_SHIFT)
+#define DESC_ATTR_SOF_SHIFT 16
+#define DESC_ATTR_SOF_MASK GENMASK(19, DESC_ATTR_SOF_SHIFT)
+#define DESC_ATTR_TX_ISOCH_DMA_EN BIT(20) /* TX */
+#define DESC_ATTR_RX_CRC_ERR BIT(20) /* RX after use */
+#define DESC_ATTR_DESC_DONE BIT(21)
+#define DESC_ATTR_REQ_STS BIT(22) /* TX and RX before use */
+#define DESC_ATTR_RX_BUF_OVRN_ERR BIT(22) /* RX after use */
+#define DESC_ATTR_INT_EN BIT(23)
+#define DESC_ATTR_OFFSET_SHIFT 24
+#define DESC_ATTR_OFFSET_MASK GENMASK(31, DESC_ATTR_OFFSET_SHIFT)
+
+
/* NHI registers in bar 0 */
/*
@@ -60,6 +92,30 @@ struct ring_desc {
*/
#define REG_RX_RING_BASE 0x08000
+#define REG_RING_STEP 16
+#define REG_RING_PHYS_LO_OFFSET 0
+#define REG_RING_PHYS_HI_OFFSET 4
+#define REG_RING_CONS_PROD_OFFSET 8 /* cons - RO, prod - RW */
+#define REG_RING_CONS_SHIFT 0
+#define REG_RING_CONS_MASK GENMASK(15, REG_RING_CONS_SHIFT)
+#define REG_RING_PROD_SHIFT 16
+#define REG_RING_PROD_MASK GENMASK(31, REG_RING_PROD_SHIFT)
+#define REG_RING_SIZE_OFFSET 12
+#define REG_RING_SIZE_SHIFT 0
+#define REG_RING_SIZE_MASK GENMASK(15, REG_RING_SIZE_SHIFT)
+#define REG_RING_BUF_SIZE_SHIFT 16
+#define REG_RING_BUF_SIZE_MASK GENMASK(27, REG_RING_BUF_SIZE_SHIFT)
+
+#define TBT_RING_CONS_PROD_REG(iobase, ringbase, ringnumber) \
+ ((iobase) + (ringbase) + \
+ ((ringnumber) * REG_RING_STEP) + \
+ REG_RING_CONS_PROD_OFFSET)
+
+#define TBT_REG_RING_PROD_EXTRACT(val) (((val) & REG_RING_PROD_MASK) >> \
+ REG_RING_PROD_SHIFT)
+
+#define TBT_REG_RING_CONS_EXTRACT(val) (((val) & REG_RING_CONS_MASK) >> \
+ REG_RING_CONS_SHIFT)
/*
* 32 bytes per entry, one entry for every hop (REG_HOP_COUNT)
* 00: enum_ring_flags
@@ -77,6 +133,19 @@ struct ring_desc {
* ..: unknown
*/
#define REG_RX_OPTIONS_BASE 0x29800
+#define REG_RX_OPTS_TX_E2E_HOP_ID_SHIFT 12
+#define REG_RX_OPTS_TX_E2E_HOP_ID_MASK \
+ GENMASK(22, REG_RX_OPTS_TX_E2E_HOP_ID_SHIFT)
+#define REG_RX_OPTS_MASK_OFFSET 4
+#define REG_RX_OPTS_MASK_EOF_SHIFT 0
+#define REG_RX_OPTS_MASK_EOF_MASK GENMASK(15, REG_RX_OPTS_MASK_EOF_SHIFT)
+#define REG_RX_OPTS_MASK_SOF_SHIFT 16
+#define REG_RX_OPTS_MASK_SOF_MASK GENMASK(31, REG_RX_OPTS_MASK_SOF_SHIFT)
+
+#define REG_OPTS_STEP 32
+#define REG_OPTS_E2E_EN BIT(28)
+#define REG_OPTS_RAW BIT(30)
+#define REG_OPTS_VALID BIT(31)
/*
* three bitfields: tx, rx, rx overflow
@@ -86,6 +155,7 @@ struct ring_desc {
*/
#define REG_RING_NOTIFY_BASE 0x37800
#define RING_NOTIFY_REG_COUNT(nhi) ((31 + 3 * nhi->hop_count) / 32)
+#define REG_RING_NOTIFY_STEP 4
/*
* two bitfields: rx, tx
@@ -94,8 +164,47 @@ struct ring_desc {
*/
#define REG_RING_INTERRUPT_BASE 0x38200
#define RING_INTERRUPT_REG_COUNT(nhi) ((31 + 2 * nhi->hop_count) / 32)
+#define REG_RING_INT_TX_PROCESSED(ring_num) BIT(ring_num)
+#define REG_RING_INT_RX_PROCESSED(ring_num, num_paths) BIT((ring_num) + \
+ (num_paths))
+#define RING_INT_DISABLE(base, val) iowrite32( \
+ ioread32((base) + REG_RING_INTERRUPT_BASE) & ~(val), \
+ (base) + REG_RING_INTERRUPT_BASE)
+#define RING_INT_ENABLE(base, val) iowrite32( \
+ ioread32((base) + REG_RING_INTERRUPT_BASE) | (val), \
+ (base) + REG_RING_INTERRUPT_BASE)
+#define RING_INT_DISABLE_TX(base, ring_num) \
+ RING_INT_DISABLE(base, REG_RING_INT_TX_PROCESSED(ring_num))
+#define RING_INT_DISABLE_RX(base, ring_num, num_paths) \
+ RING_INT_DISABLE(base, REG_RING_INT_RX_PROCESSED(ring_num, num_paths))
+#define RING_INT_ENABLE_TX(base, ring_num) \
+ RING_INT_ENABLE(base, REG_RING_INT_TX_PROCESSED(ring_num))
+#define RING_INT_ENABLE_RX(base, ring_num, num_paths) \
+ RING_INT_ENABLE(base, REG_RING_INT_RX_PROCESSED(ring_num, num_paths))
+#define RING_INT_DISABLE_TX_RX(base, ring_num, num_paths) \
+ RING_INT_DISABLE(base, REG_RING_INT_TX_PROCESSED(ring_num) | \
+ REG_RING_INT_RX_PROCESSED(ring_num, num_paths))
+
+#define REG_RING_INTERRUPT_STEP 4
+
+#define REG_INT_THROTTLING_RATE 0x38c00
+#define REG_INT_THROTTLING_RATE_STEP 4
+#define NUM_INT_VECTORS 16
+
+#define REG_INT_VEC_ALLOC_BASE 0x38c40
+#define REG_INT_VEC_ALLOC_STEP 4
+#define REG_INT_VEC_ALLOC_FIELD_BITS 4
+#define REG_INT_VEC_ALLOC_FIELD_MASK (BIT(REG_INT_VEC_ALLOC_FIELD_BITS) - 1)
+#define REG_INT_VEC_ALLOC_PER_REG ((BITS_PER_BYTE * sizeof(u32)) / \
+ REG_INT_VEC_ALLOC_FIELD_BITS)
/* The last 11 bits contain the number of hops supported by the NHI port. */
#define REG_HOP_COUNT 0x39640
+#define REG_HOP_COUNT_TOTAL_PATHS_MASK GENMASK(10, 0)
+
+#define REG_HOST_INTERFACE_RST 0x39858
+
+#define REG_DMA_MISC 0x39864
+#define REG_DMA_MISC_INT_AUTO_CLEAR BIT(2)
#endif
--
2.7.4
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web