RDMA/nes: FIN during MPA startup causes timeout
[safe/jmp/linux-2.6] / drivers / infiniband / hw / ipath / ipath_registers.h
index 25c901e..8f44d0c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006 QLogic, Inc. All rights reserved.
+ * Copyright (c) 2006, 2007 QLogic Corporation. All rights reserved.
  * Copyright (c) 2003, 2004, 2005, 2006 PathScale, Inc. All rights reserved.
  *
  * This software is available to you under a choice of one of two
 /* kr_control bits */
 #define INFINIPATH_C_FREEZEMODE 0x00000002
 #define INFINIPATH_C_LINKENABLE 0x00000004
-#define INFINIPATH_C_RESET 0x00000001
 
 /* kr_sendctrl bits */
 #define INFINIPATH_S_DISARMPIOBUF_SHIFT 16
+#define INFINIPATH_S_UPDTHRESH_SHIFT 24
+#define INFINIPATH_S_UPDTHRESH_MASK 0x1f
 
 #define IPATH_S_ABORT          0
 #define IPATH_S_PIOINTBUFAVAIL 1
 #define IPATH_S_PIOBUFAVAILUPD 2
 #define IPATH_S_PIOENABLE      3
+#define IPATH_S_SDMAINTENABLE  9
+#define IPATH_S_SDMASINGLEDESCRIPTOR   10
+#define IPATH_S_SDMAENABLE     11
+#define IPATH_S_SDMAHALT       12
 #define IPATH_S_DISARM         31
 
 #define INFINIPATH_S_ABORT             (1U << IPATH_S_ABORT)
 #define INFINIPATH_S_PIOINTBUFAVAIL    (1U << IPATH_S_PIOINTBUFAVAIL)
 #define INFINIPATH_S_PIOBUFAVAILUPD    (1U << IPATH_S_PIOBUFAVAILUPD)
 #define INFINIPATH_S_PIOENABLE         (1U << IPATH_S_PIOENABLE)
+#define INFINIPATH_S_SDMAINTENABLE     (1U << IPATH_S_SDMAINTENABLE)
+#define INFINIPATH_S_SDMASINGLEDESCRIPTOR \
+                                       (1U << IPATH_S_SDMASINGLEDESCRIPTOR)
+#define INFINIPATH_S_SDMAENABLE                (1U << IPATH_S_SDMAENABLE)
+#define INFINIPATH_S_SDMAHALT          (1U << IPATH_S_SDMAHALT)
 #define INFINIPATH_S_DISARM            (1U << IPATH_S_DISARM)
 
-/* kr_rcvctrl bits */
+/* kr_rcvctrl bits that are the same on multiple chips */
 #define INFINIPATH_R_PORTENABLE_SHIFT 0
-#define INFINIPATH_R_INTRAVAIL_SHIFT 16
-#define INFINIPATH_R_TAILUPD   0x80000000
+#define INFINIPATH_R_QPMAP_ENABLE (1ULL << 38)
 
 /* kr_intstatus, kr_intclear, kr_intmask bits */
-#define INFINIPATH_I_RCVURG_SHIFT 0
-#define INFINIPATH_I_RCVAVAIL_SHIFT 12
-#define INFINIPATH_I_ERROR        0x80000000
-#define INFINIPATH_I_SPIOSENT     0x40000000
-#define INFINIPATH_I_SPIOBUFAVAIL 0x20000000
-#define INFINIPATH_I_GPIO         0x10000000
+#define INFINIPATH_I_SDMAINT           0x8000000000000000ULL
+#define INFINIPATH_I_SDMADISABLED      0x4000000000000000ULL
+#define INFINIPATH_I_ERROR             0x0000000080000000ULL
+#define INFINIPATH_I_SPIOSENT          0x0000000040000000ULL
+#define INFINIPATH_I_SPIOBUFAVAIL      0x0000000020000000ULL
+#define INFINIPATH_I_GPIO              0x0000000010000000ULL
+#define INFINIPATH_I_JINT              0x0000000004000000ULL
 
 /* kr_errorstatus, kr_errorclear, kr_errormask bits */
-#define INFINIPATH_E_RFORMATERR      0x0000000000000001ULL
-#define INFINIPATH_E_RVCRC           0x0000000000000002ULL
-#define INFINIPATH_E_RICRC           0x0000000000000004ULL
-#define INFINIPATH_E_RMINPKTLEN      0x0000000000000008ULL
-#define INFINIPATH_E_RMAXPKTLEN      0x0000000000000010ULL
-#define INFINIPATH_E_RLONGPKTLEN     0x0000000000000020ULL
-#define INFINIPATH_E_RSHORTPKTLEN    0x0000000000000040ULL
-#define INFINIPATH_E_RUNEXPCHAR      0x0000000000000080ULL
-#define INFINIPATH_E_RUNSUPVL        0x0000000000000100ULL
-#define INFINIPATH_E_REBP            0x0000000000000200ULL
-#define INFINIPATH_E_RIBFLOW         0x0000000000000400ULL
-#define INFINIPATH_E_RBADVERSION     0x0000000000000800ULL
-#define INFINIPATH_E_RRCVEGRFULL     0x0000000000001000ULL
-#define INFINIPATH_E_RRCVHDRFULL     0x0000000000002000ULL
-#define INFINIPATH_E_RBADTID         0x0000000000004000ULL
-#define INFINIPATH_E_RHDRLEN         0x0000000000008000ULL
-#define INFINIPATH_E_RHDR            0x0000000000010000ULL
-#define INFINIPATH_E_RIBLOSTLINK     0x0000000000020000ULL
-#define INFINIPATH_E_SMINPKTLEN      0x0000000020000000ULL
-#define INFINIPATH_E_SMAXPKTLEN      0x0000000040000000ULL
-#define INFINIPATH_E_SUNDERRUN       0x0000000080000000ULL
-#define INFINIPATH_E_SPKTLEN         0x0000000100000000ULL
-#define INFINIPATH_E_SDROPPEDSMPPKT  0x0000000200000000ULL
-#define INFINIPATH_E_SDROPPEDDATAPKT 0x0000000400000000ULL
-#define INFINIPATH_E_SPIOARMLAUNCH   0x0000000800000000ULL
-#define INFINIPATH_E_SUNEXPERRPKTNUM 0x0000001000000000ULL
-#define INFINIPATH_E_SUNSUPVL        0x0000002000000000ULL
-#define INFINIPATH_E_IBSTATUSCHANGED 0x0001000000000000ULL
-#define INFINIPATH_E_INVALIDADDR     0x0002000000000000ULL
-#define INFINIPATH_E_RESET           0x0004000000000000ULL
-#define INFINIPATH_E_HARDWARE        0x0008000000000000ULL
+#define INFINIPATH_E_RFORMATERR                        0x0000000000000001ULL
+#define INFINIPATH_E_RVCRC                     0x0000000000000002ULL
+#define INFINIPATH_E_RICRC                     0x0000000000000004ULL
+#define INFINIPATH_E_RMINPKTLEN                        0x0000000000000008ULL
+#define INFINIPATH_E_RMAXPKTLEN                        0x0000000000000010ULL
+#define INFINIPATH_E_RLONGPKTLEN               0x0000000000000020ULL
+#define INFINIPATH_E_RSHORTPKTLEN              0x0000000000000040ULL
+#define INFINIPATH_E_RUNEXPCHAR                        0x0000000000000080ULL
+#define INFINIPATH_E_RUNSUPVL                  0x0000000000000100ULL
+#define INFINIPATH_E_REBP                      0x0000000000000200ULL
+#define INFINIPATH_E_RIBFLOW                   0x0000000000000400ULL
+#define INFINIPATH_E_RBADVERSION               0x0000000000000800ULL
+#define INFINIPATH_E_RRCVEGRFULL               0x0000000000001000ULL
+#define INFINIPATH_E_RRCVHDRFULL               0x0000000000002000ULL
+#define INFINIPATH_E_RBADTID                   0x0000000000004000ULL
+#define INFINIPATH_E_RHDRLEN                   0x0000000000008000ULL
+#define INFINIPATH_E_RHDR                      0x0000000000010000ULL
+#define INFINIPATH_E_RIBLOSTLINK               0x0000000000020000ULL
+#define INFINIPATH_E_SENDSPECIALTRIGGER                0x0000000008000000ULL
+#define INFINIPATH_E_SDMADISABLED              0x0000000010000000ULL
+#define INFINIPATH_E_SMINPKTLEN                        0x0000000020000000ULL
+#define INFINIPATH_E_SMAXPKTLEN                        0x0000000040000000ULL
+#define INFINIPATH_E_SUNDERRUN                 0x0000000080000000ULL
+#define INFINIPATH_E_SPKTLEN                   0x0000000100000000ULL
+#define INFINIPATH_E_SDROPPEDSMPPKT            0x0000000200000000ULL
+#define INFINIPATH_E_SDROPPEDDATAPKT           0x0000000400000000ULL
+#define INFINIPATH_E_SPIOARMLAUNCH             0x0000000800000000ULL
+#define INFINIPATH_E_SUNEXPERRPKTNUM           0x0000001000000000ULL
+#define INFINIPATH_E_SUNSUPVL                  0x0000002000000000ULL
+#define INFINIPATH_E_SENDBUFMISUSE             0x0000004000000000ULL
+#define INFINIPATH_E_SDMAGENMISMATCH           0x0000008000000000ULL
+#define INFINIPATH_E_SDMAOUTOFBOUND            0x0000010000000000ULL
+#define INFINIPATH_E_SDMATAILOUTOFBOUND                0x0000020000000000ULL
+#define INFINIPATH_E_SDMABASE                  0x0000040000000000ULL
+#define INFINIPATH_E_SDMA1STDESC               0x0000080000000000ULL
+#define INFINIPATH_E_SDMARPYTAG                        0x0000100000000000ULL
+#define INFINIPATH_E_SDMADWEN                  0x0000200000000000ULL
+#define INFINIPATH_E_SDMAMISSINGDW             0x0000400000000000ULL
+#define INFINIPATH_E_SDMAUNEXPDATA             0x0000800000000000ULL
+#define INFINIPATH_E_IBSTATUSCHANGED           0x0001000000000000ULL
+#define INFINIPATH_E_INVALIDADDR               0x0002000000000000ULL
+#define INFINIPATH_E_RESET                     0x0004000000000000ULL
+#define INFINIPATH_E_HARDWARE                  0x0008000000000000ULL
+#define INFINIPATH_E_SDMADESCADDRMISALIGN      0x0010000000000000ULL
+#define INFINIPATH_E_INVALIDEEPCMD             0x0020000000000000ULL
+
+/*
+ * this is used to print "common" packet errors only when the
+ * __IPATH_ERRPKTDBG bit is set in ipath_debug.
+ */
+#define INFINIPATH_E_PKTERRS ( INFINIPATH_E_SPKTLEN \
+               | INFINIPATH_E_SDROPPEDDATAPKT | INFINIPATH_E_RVCRC \
+               | INFINIPATH_E_RICRC | INFINIPATH_E_RSHORTPKTLEN \
+               | INFINIPATH_E_REBP )
+
+/* Convenience for decoding Send DMA errors */
+#define INFINIPATH_E_SDMAERRS ( \
+       INFINIPATH_E_SDMAGENMISMATCH | INFINIPATH_E_SDMAOUTOFBOUND | \
+       INFINIPATH_E_SDMATAILOUTOFBOUND | INFINIPATH_E_SDMABASE | \
+       INFINIPATH_E_SDMA1STDESC | INFINIPATH_E_SDMARPYTAG | \
+       INFINIPATH_E_SDMADWEN | INFINIPATH_E_SDMAMISSINGDW | \
+       INFINIPATH_E_SDMAUNEXPDATA | \
+       INFINIPATH_E_SDMADESCADDRMISALIGN | \
+       INFINIPATH_E_SDMADISABLED | \
+       INFINIPATH_E_SENDBUFMISUSE)
 
 /* kr_hwerrclear, kr_hwerrmask, kr_hwerrstatus, bits */
 /* TXEMEMPARITYERR bit 0: PIObuf, 1: PIOpbc, 2: launchfifo
- * RXEMEMPARITYERR bit 0: rcvbuf, 1: lookupq, 2: eagerTID, 3: expTID
+ * RXEMEMPARITYERR bit 0: rcvbuf, 1: lookupq, 2:  expTID, 3: eagerTID
  *             bit 4: flag buffer, 5: datainfo, 6: header info */
 #define INFINIPATH_HWE_TXEMEMPARITYERR_MASK 0xFULL
 #define INFINIPATH_HWE_TXEMEMPARITYERR_SHIFT 40
 /* rxe mem parity errors (shift by INFINIPATH_HWE_RXEMEMPARITYERR_SHIFT) */
 #define INFINIPATH_HWE_RXEMEMPARITYERR_RCVBUF   0x01ULL
 #define INFINIPATH_HWE_RXEMEMPARITYERR_LOOKUPQ  0x02ULL
-#define INFINIPATH_HWE_RXEMEMPARITYERR_EAGERTID 0x04ULL
-#define INFINIPATH_HWE_RXEMEMPARITYERR_EXPTID   0x08ULL
+#define INFINIPATH_HWE_RXEMEMPARITYERR_EXPTID   0x04ULL
+#define INFINIPATH_HWE_RXEMEMPARITYERR_EAGERTID 0x08ULL
 #define INFINIPATH_HWE_RXEMEMPARITYERR_FLAGBUF  0x10ULL
 #define INFINIPATH_HWE_RXEMEMPARITYERR_DATAINFO 0x20ULL
 #define INFINIPATH_HWE_RXEMEMPARITYERR_HDRINFO  0x40ULL
 /* waldo specific -- find the rest in ipath_6110.c */
 #define INFINIPATH_HWE_RXDSYNCMEMPARITYERR  0x0000000400000000ULL
-/* monty specific -- find the rest in ipath_6120.c */
+/* 6120/7220 specific -- find the rest in ipath_6120.c and ipath_7220.c */
 #define INFINIPATH_HWE_MEMBISTFAILED   0x0040000000000000ULL
 
 /* kr_hwdiagctrl bits */
 #define INFINIPATH_IBCC_LINKINITCMD_SLEEP 3
 #define INFINIPATH_IBCC_LINKINITCMD_SHIFT 16
 #define INFINIPATH_IBCC_LINKCMD_MASK 0x3ULL
-#define INFINIPATH_IBCC_LINKCMD_INIT 1 /* move to 0x11 */
-#define INFINIPATH_IBCC_LINKCMD_ARMED 2        /* move to 0x21 */
+#define INFINIPATH_IBCC_LINKCMD_DOWN 1         /* move to 0x11 */
+#define INFINIPATH_IBCC_LINKCMD_ARMED 2                /* move to 0x21 */
 #define INFINIPATH_IBCC_LINKCMD_ACTIVE 3       /* move to 0x31 */
 #define INFINIPATH_IBCC_LINKCMD_SHIFT 18
 #define INFINIPATH_IBCC_MAXPKTLEN_MASK 0x7FFULL
 #define INFINIPATH_IBCC_LINKDOWNDEFAULTSTATE 0x4000000000000000ULL
 
 /* kr_ibcstatus bits */
-#define INFINIPATH_IBCS_LINKTRAININGSTATE_MASK 0xF
 #define INFINIPATH_IBCS_LINKTRAININGSTATE_SHIFT 0
 #define INFINIPATH_IBCS_LINKSTATE_MASK 0x7
-#define INFINIPATH_IBCS_LINKSTATE_SHIFT 4
+
 #define INFINIPATH_IBCS_TXREADY       0x40000000
 #define INFINIPATH_IBCS_TXCREDITOK    0x80000000
 /* link training states (shift by
 #define INFINIPATH_IBCS_LT_STATE_RECOVERRETRAIN        0x0c
 #define INFINIPATH_IBCS_LT_STATE_RECOVERWAITRMT        0x0e
 #define INFINIPATH_IBCS_LT_STATE_RECOVERIDLE   0x0f
-/* link state machine states (shift by INFINIPATH_IBCS_LINKSTATE_SHIFT) */
+/* link state machine states (shift by ibcs_ls_shift) */
 #define INFINIPATH_IBCS_L_STATE_DOWN           0x0
 #define INFINIPATH_IBCS_L_STATE_INIT           0x1
 #define INFINIPATH_IBCS_L_STATE_ARM            0x2
 #define INFINIPATH_IBCS_L_STATE_ACTIVE         0x3
 #define INFINIPATH_IBCS_L_STATE_ACT_DEFER      0x4
 
-/* combination link status states that we use with some frequency */
-#define IPATH_IBSTATE_MASK ((INFINIPATH_IBCS_LINKTRAININGSTATE_MASK \
-               << INFINIPATH_IBCS_LINKTRAININGSTATE_SHIFT) | \
-               (INFINIPATH_IBCS_LINKSTATE_MASK \
-               <<INFINIPATH_IBCS_LINKSTATE_SHIFT))
-#define IPATH_IBSTATE_INIT ((INFINIPATH_IBCS_L_STATE_INIT \
-               << INFINIPATH_IBCS_LINKSTATE_SHIFT) | \
-               (INFINIPATH_IBCS_LT_STATE_LINKUP \
-               <<INFINIPATH_IBCS_LINKTRAININGSTATE_SHIFT))
-#define IPATH_IBSTATE_ARM ((INFINIPATH_IBCS_L_STATE_ARM \
-               << INFINIPATH_IBCS_LINKSTATE_SHIFT) | \
-               (INFINIPATH_IBCS_LT_STATE_LINKUP \
-               <<INFINIPATH_IBCS_LINKTRAININGSTATE_SHIFT))
-#define IPATH_IBSTATE_ACTIVE ((INFINIPATH_IBCS_L_STATE_ACTIVE \
-               << INFINIPATH_IBCS_LINKSTATE_SHIFT) | \
-               (INFINIPATH_IBCS_LT_STATE_LINKUP \
-               <<INFINIPATH_IBCS_LINKTRAININGSTATE_SHIFT))
 
 /* kr_extstatus bits */
 #define INFINIPATH_EXTS_SERDESPLLLOCK 0x1
 #define INFINIPATH_EXTC_LEDGBLOK_ON          0x00000002ULL
 #define INFINIPATH_EXTC_LEDGBLERR_OFF        0x00000001ULL
 
-/* kr_mdio bits */
-#define INFINIPATH_MDIO_CLKDIV_MASK 0x7FULL
-#define INFINIPATH_MDIO_CLKDIV_SHIFT 32
-#define INFINIPATH_MDIO_COMMAND_MASK 0x7ULL
-#define INFINIPATH_MDIO_COMMAND_SHIFT 26
-#define INFINIPATH_MDIO_DEVADDR_MASK 0x1FULL
-#define INFINIPATH_MDIO_DEVADDR_SHIFT 21
-#define INFINIPATH_MDIO_REGADDR_MASK 0x1FULL
-#define INFINIPATH_MDIO_REGADDR_SHIFT 16
-#define INFINIPATH_MDIO_DATA_MASK 0xFFFFULL
-#define INFINIPATH_MDIO_DATA_SHIFT 0
-#define INFINIPATH_MDIO_CMDVALID    0x0000000040000000ULL
-#define INFINIPATH_MDIO_RDDATAVALID 0x0000000080000000ULL
-
 /* kr_partitionkey bits */
 #define INFINIPATH_PKEY_SIZE 16
 #define INFINIPATH_PKEY_MASK 0xFFFF
 /* L1 Power down; use with RXDETECT, Otherwise not used on IB side */
 #define INFINIPATH_SERDC0_L1PWR_DN      0xF0ULL
 
-/* kr_xgxsconfig bits */
-#define INFINIPATH_XGXS_RESET          0x7ULL
-#define INFINIPATH_XGXS_MDIOADDR_MASK  0xfULL
-#define INFINIPATH_XGXS_MDIOADDR_SHIFT 4
+/* common kr_xgxsconfig bits (or safe in all, even if not implemented) */
 #define INFINIPATH_XGXS_RX_POL_SHIFT 19
 #define INFINIPATH_XGXS_RX_POL_MASK 0xfULL
 
-#define INFINIPATH_RT_ADDR_MASK 0xFFFFFFFFFFULL        /* 40 bits valid */
-
-/* TID entries (memory), HT-only */
-#define INFINIPATH_RT_VALID 0x8000000000000000ULL
-#define INFINIPATH_RT_ADDR_SHIFT 0
-#define INFINIPATH_RT_BUFSIZE_MASK 0x3FFF
-#define INFINIPATH_RT_BUFSIZE_SHIFT 48
 
 /*
  * IPATH_PIO_MAXIBHDR is the max IB header size allowed for in our
 
 typedef u64 ipath_err_t;
 
+/* The following change with the type of device, so
+ * need to be part of the ipath_devdata struct, or
+ * we could have problems plugging in devices of
+ * different types (e.g. one HT, one PCIE)
+ * in one system, to be managed by one driver.
+ * On the other hand, this file is may also be included
+ * by other code, so leave the declarations here
+ * temporarily. Minor footprint issue if common-model
+ * linker used, none if C89+ linker used.
+ */
+
 /* mask of defined bits for various registers */
 extern u64 infinipath_i_bitsextant;
 extern ipath_err_t infinipath_e_bitsextant, infinipath_hwe_bitsextant;
@@ -324,13 +337,6 @@ extern ipath_err_t infinipath_e_bitsextant, infinipath_hwe_bitsextant;
 extern u32 infinipath_i_rcvavail_mask, infinipath_i_rcvurg_mask;
 
 /*
- * register bits for selecting i2c direction and values, used for I2C serial
- * flash
- */
-extern u16 ipath_gpio_sda_num, ipath_gpio_scl_num;
-extern u64 ipath_gpio_sda, ipath_gpio_scl;
-
-/*
  * These are the infinipath general register numbers (not offsets).
  * The kernel registers are used directly, those beyond the kernel
  * registers are calculated from one of the base registers.  The use of
@@ -428,6 +434,29 @@ struct ipath_kregs {
        ipath_kreg kr_pcieq1serdesconfig0;
        ipath_kreg kr_pcieq1serdesconfig1;
        ipath_kreg kr_pcieq1serdesstatus;
+       ipath_kreg kr_hrtbt_guid;
+       ipath_kreg kr_ibcddrctrl;
+       ipath_kreg kr_ibcddrstatus;
+       ipath_kreg kr_jintreload;
+
+       /* send dma related regs */
+       ipath_kreg kr_senddmabase;
+       ipath_kreg kr_senddmalengen;
+       ipath_kreg kr_senddmatail;
+       ipath_kreg kr_senddmahead;
+       ipath_kreg kr_senddmaheadaddr;
+       ipath_kreg kr_senddmabufmask0;
+       ipath_kreg kr_senddmabufmask1;
+       ipath_kreg kr_senddmabufmask2;
+       ipath_kreg kr_senddmastatus;
+
+       /* SerDes related regs (IBA7220-only) */
+       ipath_kreg kr_ibserdesctrl;
+       ipath_kreg kr_ib_epbacc;
+       ipath_kreg kr_ib_epbtrans;
+       ipath_kreg kr_pcie_epbacc;
+       ipath_kreg kr_pcie_epbtrans;
+       ipath_kreg kr_ib_ddsrxeq;
 };
 
 struct ipath_cregs {
@@ -464,6 +493,20 @@ struct ipath_cregs {
        ipath_creg cr_unsupvlcnt;
        ipath_creg cr_wordrcvcnt;
        ipath_creg cr_wordsendcnt;
+       ipath_creg cr_vl15droppedpktcnt;
+       ipath_creg cr_rxotherlocalphyerrcnt;
+       ipath_creg cr_excessbufferovflcnt;
+       ipath_creg cr_locallinkintegrityerrcnt;
+       ipath_creg cr_rxvlerrcnt;
+       ipath_creg cr_rxdlidfltrcnt;
+       ipath_creg cr_psstat;
+       ipath_creg cr_psstart;
+       ipath_creg cr_psinterval;
+       ipath_creg cr_psrcvdatacount;
+       ipath_creg cr_psrcvpktscount;
+       ipath_creg cr_psxmitdatacount;
+       ipath_creg cr_psxmitpktscount;
+       ipath_creg cr_psxmitwaitcount;
 };
 
 #endif                         /* _IPATH_REGISTERS_H */