fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / scsi / lpfc / lpfc_hw.h
index b5c023a..f79cb61 100644 (file)
@@ -1,42 +1,35 @@
 /*******************************************************************
  * This file is part of the Emulex Linux Device Driver for         *
- * Enterprise Fibre Channel Host Bus Adapters.                     *
- * Refer to the README file included with this package for         *
- * driver version and adapter support.                             *
- * Copyright (C) 2004 Emulex Corporation.                          *
+ * Fibre Channel Host Bus Adapters.                                *
+ * Copyright (C) 2004-2006 Emulex.  All rights reserved.           *
+ * EMULEX and SLI are trademarks of Emulex.                        *
  * www.emulex.com                                                  *
  *                                                                 *
  * This program is free software; you can redistribute it and/or   *
- * modify it under the terms of the GNU General Public License     *
- * as published by the Free Software Foundation; either version 2  *
- * of the License, or (at your option) any later version.          *
- *                                                                 *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of  *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   *
- * GNU General Public License for more details, a copy of which    *
- * can be found in the file COPYING included with this package.    *
+ * modify it under the terms of version 2 of the GNU General       *
+ * Public License as published by the Free Software Foundation.    *
+ * This program is distributed in the hope that it will be useful. *
+ * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND          *
+ * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,  *
+ * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE      *
+ * DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD *
+ * TO BE LEGALLY INVALID.  See the GNU General Public License for  *
+ * more details, a copy of which can be found in the file COPYING  *
+ * included with this package.                                     *
  *******************************************************************/
 
-/*
- * $Id: lpfc_hw.h 1.29 2004/11/18 17:28:05EST sf_support Exp  $
- */
-
-#ifndef  _H_LPFC_HW
-#define _H_LPFC_HW
-
-#define FDMI_DID        ((uint32_t)0xfffffa)
-#define NameServer_DID  ((uint32_t)0xfffffc)
-#define SCR_DID         ((uint32_t)0xfffffd)
-#define Fabric_DID      ((uint32_t)0xfffffe)
-#define Bcast_DID       ((uint32_t)0xffffff)
-#define Mask_DID        ((uint32_t)0xffffff)
-#define CT_DID_MASK     ((uint32_t)0xffff00)
-#define Fabric_DID_MASK ((uint32_t)0xfff000)
-#define WELL_KNOWN_DID_MASK ((uint32_t)0xfffff0)
+#define FDMI_DID        0xfffffaU
+#define NameServer_DID  0xfffffcU
+#define SCR_DID         0xfffffdU
+#define Fabric_DID      0xfffffeU
+#define Bcast_DID       0xffffffU
+#define Mask_DID        0xffffffU
+#define CT_DID_MASK     0xffff00U
+#define Fabric_DID_MASK 0xfff000U
+#define WELL_KNOWN_DID_MASK 0xfffff0U
 
-#define PT2PT_LocalID   ((uint32_t)1)
-#define PT2PT_RemoteID  ((uint32_t)2)
+#define PT2PT_LocalID  1
+#define PT2PT_RemoteID 2
 
 #define FF_DEF_EDTOV          2000     /* Default E_D_TOV (2000ms) */
 #define FF_DEF_ALTOV            15     /* Default AL_TIME (15ms) */
 
 #define FCELSSIZE             1024     /* maximum ELS transfer size */
 
-#define LPFC_FCP_RING            0     /* ring 2 for FCP initiator commands */
-#define LPFC_IP_RING             1     /* ring 1 for IP commands */
-#define LPFC_ELS_RING            2     /* ring 0 for ELS commands */
+#define LPFC_FCP_RING            0     /* ring 0 for FCP initiator commands */
+#define LPFC_EXTRA_RING          1     /* ring 1 for other protocols */
+#define LPFC_ELS_RING            2     /* ring 2 for ELS commands */
 #define LPFC_FCP_NEXT_RING       3
 
 #define SLI2_IOCB_CMD_R0_ENTRIES    172        /* SLI-2 FCP command ring entries */
 #define SLI2_IOCB_RSP_R0_ENTRIES    134        /* SLI-2 FCP response ring entries */
-#define SLI2_IOCB_CMD_R1_ENTRIES      4        /* SLI-2 IP command ring entries */
-#define SLI2_IOCB_RSP_R1_ENTRIES      4        /* SLI-2 IP response ring entries */
+#define SLI2_IOCB_CMD_R1_ENTRIES      4        /* SLI-2 extra command ring entries */
+#define SLI2_IOCB_RSP_R1_ENTRIES      4        /* SLI-2 extra response ring entries */
 #define SLI2_IOCB_CMD_R1XTRA_ENTRIES 36        /* SLI-2 extra FCP cmd ring entries */
 #define SLI2_IOCB_RSP_R1XTRA_ENTRIES 52        /* SLI-2 extra FCP rsp ring entries */
 #define SLI2_IOCB_CMD_R2_ENTRIES     20        /* SLI-2 ELS command ring entries */
@@ -128,6 +121,20 @@ struct lpfc_sli_ct_request {
 
                        uint32_t rsvd[7];
                } rft;
+               struct rff {
+                       uint32_t PortId;
+                       uint8_t reserved[2];
+#ifdef __BIG_ENDIAN_BITFIELD
+                       uint8_t feature_res:6;
+                       uint8_t feature_init:1;
+                       uint8_t feature_tgt:1;
+#else  /*  __LITTLE_ENDIAN_BITFIELD */
+                       uint8_t feature_tgt:1;
+                       uint8_t feature_init:1;
+                       uint8_t feature_res:6;
+#endif
+                       uint8_t type_code;     /* type=8 for FCP */
+               } rff;
                struct rnn {
                        uint32_t PortId;        /* For RNN_ID requests */
                        uint8_t wwnn[8];
@@ -143,6 +150,7 @@ struct lpfc_sli_ct_request {
 #define  SLI_CT_REVISION        1
 #define  GID_REQUEST_SZ         (sizeof(struct lpfc_sli_ct_request) - 260)
 #define  RFT_REQUEST_SZ         (sizeof(struct lpfc_sli_ct_request) - 228)
+#define  RFF_REQUEST_SZ         (sizeof(struct lpfc_sli_ct_request) - 235)
 #define  RNN_REQUEST_SZ         (sizeof(struct lpfc_sli_ct_request) - 252)
 #define  RSNN_REQUEST_SZ        (sizeof(struct lpfc_sli_ct_request))
 
@@ -232,6 +240,7 @@ struct lpfc_sli_ct_request {
 #define  SLI_CTNS_RNN_ID      0x0213
 #define  SLI_CTNS_RCS_ID      0x0214
 #define  SLI_CTNS_RFT_ID      0x0217
+#define  SLI_CTNS_RFF_ID      0x021F
 #define  SLI_CTNS_RSPN_ID     0x0218
 #define  SLI_CTNS_RPT_ID      0x021A
 #define  SLI_CTNS_RIP_NN      0x0235
@@ -269,12 +278,16 @@ struct lpfc_sli_ct_request {
 #define FF_FRAME_SIZE     2048
 
 struct lpfc_name {
+       union {
+               struct {
 #ifdef __BIG_ENDIAN_BITFIELD
-       uint8_t nameType:4;     /* FC Word 0, bit 28:31 */
-       uint8_t IEEEextMsn:4;   /* FC Word 0, bit 24:27, bit 8:11 of IEEE ext */
+                       uint8_t nameType:4;     /* FC Word 0, bit 28:31 */
+                       uint8_t IEEEextMsn:4;   /* FC Word 0, bit 24:27, bit
+                                                  8:11 of IEEE ext */
 #else  /*  __LITTLE_ENDIAN_BITFIELD */
-       uint8_t IEEEextMsn:4;   /* FC Word 0, bit 24:27, bit 8:11 of IEEE ext */
-       uint8_t nameType:4;     /* FC Word 0, bit 28:31 */
+                       uint8_t IEEEextMsn:4;   /* FC Word 0, bit 24:27, bit
+                                                  8:11 of IEEE ext */
+                       uint8_t nameType:4;     /* FC Word 0, bit 28:31 */
 #endif
 
 #define NAME_IEEE           0x1        /* IEEE name - nameType */
@@ -283,8 +296,12 @@ struct lpfc_name {
 #define NAME_IP_TYPE        0x4        /* IP address */
 #define NAME_CCITT_TYPE     0xC
 #define NAME_CCITT_GR_TYPE  0xE
-       uint8_t IEEEextLsb;     /* FC Word 0, bit 16:23, IEEE extended Lsb */
-       uint8_t IEEE[6];        /* FC IEEE address */
+                       uint8_t IEEEextLsb;     /* FC Word 0, bit 16:23, IEEE
+                                                  extended Lsb */
+                       uint8_t IEEE[6];        /* FC IEEE address */
+               } s;
+               uint8_t wwn[8];
+       } u;
 };
 
 struct csp {
@@ -448,15 +465,19 @@ struct serv_parm {        /* Structure is in Big Endian format */
 #define ELS_CMD_RRQ       0x12000000
 #define ELS_CMD_PRLI      0x20100014
 #define ELS_CMD_PRLO      0x21100014
+#define ELS_CMD_PRLO_ACC  0x02100014
 #define ELS_CMD_PDISC     0x50000000
 #define ELS_CMD_FDISC     0x51000000
 #define ELS_CMD_ADISC     0x52000000
 #define ELS_CMD_FARP      0x54000000
 #define ELS_CMD_FARPR     0x55000000
+#define ELS_CMD_RPS       0x56000000
+#define ELS_CMD_RPL       0x57000000
 #define ELS_CMD_FAN       0x60000000
 #define ELS_CMD_RSCN      0x61040000
 #define ELS_CMD_SCR       0x62000000
 #define ELS_CMD_RNID      0x78000000
+#define ELS_CMD_LIRR      0x7A000000
 #else  /*  __LITTLE_ENDIAN_BITFIELD */
 #define ELS_CMD_MASK      0xffff
 #define ELS_RSP_MASK      0xff
@@ -480,15 +501,19 @@ struct serv_parm {        /* Structure is in Big Endian format */
 #define ELS_CMD_RRQ       0x12
 #define ELS_CMD_PRLI      0x14001020
 #define ELS_CMD_PRLO      0x14001021
+#define ELS_CMD_PRLO_ACC  0x14001002
 #define ELS_CMD_PDISC     0x50
 #define ELS_CMD_FDISC     0x51
 #define ELS_CMD_ADISC     0x52
 #define ELS_CMD_FARP      0x54
 #define ELS_CMD_FARPR     0x55
+#define ELS_CMD_RPS       0x56
+#define ELS_CMD_RPL       0x57
 #define ELS_CMD_FAN       0x60
 #define ELS_CMD_RSCN      0x0461
 #define ELS_CMD_SCR       0x62
 #define ELS_CMD_RNID      0x78
+#define ELS_CMD_LIRR      0x7A
 #endif
 
 /*
@@ -757,12 +782,40 @@ typedef struct _RNID {            /* Structure is in Big Endian format */
        } un;
 } RNID;
 
-typedef struct _RRQ {          /* Structure is in Big Endian format */
-       uint32_t SID;
-       uint16_t Oxid;
-       uint16_t Rxid;
-       uint8_t resv[32];       /* optional association hdr */
-} RRQ;
+typedef struct  _RPS {         /* Structure is in Big Endian format */
+       union {
+               uint32_t portNum;
+               struct lpfc_name portName;
+       } un;
+} RPS;
+
+typedef struct  _RPS_RSP {     /* Structure is in Big Endian format */
+       uint16_t rsvd1;
+       uint16_t portStatus;
+       uint32_t linkFailureCnt;
+       uint32_t lossSyncCnt;
+       uint32_t lossSignalCnt;
+       uint32_t primSeqErrCnt;
+       uint32_t invalidXmitWord;
+       uint32_t crcCnt;
+} RPS_RSP;
+
+typedef struct  _RPL {         /* Structure is in Big Endian format */
+       uint32_t maxsize;
+       uint32_t index;
+} RPL;
+
+typedef struct  _PORT_NUM_BLK {
+       uint32_t portNum;
+       uint32_t portID;
+       struct lpfc_name portName;
+} PORT_NUM_BLK;
+
+typedef struct  _RPL_RSP {     /* Structure is in Big Endian format */
+       uint32_t listLen;
+       uint32_t index;
+       PORT_NUM_BLK port_num_blk;
+} RPL_RSP;
 
 /* This is used for RSCN command */
 typedef struct _D_ID {         /* Structure is in Big Endian format */
@@ -803,7 +856,6 @@ typedef struct _ELS_PKT {   /* Structure is in Big Endian format */
                FARP farp;      /* Payload for FARP/ACC */
                FAN fan;        /* Payload for FAN */
                SCR scr;        /* Payload for SCR/ACC */
-               RRQ rrq;        /* Payload for RRQ */
                RNID rnid;      /* Payload for RNID */
                uint8_t pad[128 - 4];   /* Pad out to payload of 128 bytes */
        } un;
@@ -1025,23 +1077,33 @@ typedef struct {
 
 /* Start FireFly Register definitions */
 #define PCI_VENDOR_ID_EMULEX        0x10df
-#define PCI_DEVICE_ID_FIREFLY      0x1ae5
-#define PCI_DEVICE_ID_SUPERFLY      0xf700
-#define PCI_DEVICE_ID_DRAGONFLY     0xf800
+#define PCI_DEVICE_ID_FIREFLY       0x1ae5
 #define PCI_DEVICE_ID_RFLY          0xf095
 #define PCI_DEVICE_ID_PFLY          0xf098
+#define PCI_DEVICE_ID_LP101         0xf0a1
 #define PCI_DEVICE_ID_TFLY          0xf0a5
+#define PCI_DEVICE_ID_BSMB          0xf0d1
+#define PCI_DEVICE_ID_BMID          0xf0d5
+#define PCI_DEVICE_ID_ZSMB          0xf0e1
+#define PCI_DEVICE_ID_ZMID          0xf0e5
+#define PCI_DEVICE_ID_NEPTUNE       0xf0f5
+#define PCI_DEVICE_ID_NEPTUNE_SCSP  0xf0f6
+#define PCI_DEVICE_ID_NEPTUNE_DCSP  0xf0f7
+#define PCI_DEVICE_ID_SUPERFLY      0xf700
+#define PCI_DEVICE_ID_DRAGONFLY     0xf800
 #define PCI_DEVICE_ID_CENTAUR       0xf900
 #define PCI_DEVICE_ID_PEGASUS       0xf980
 #define PCI_DEVICE_ID_THOR          0xfa00
 #define PCI_DEVICE_ID_VIPER         0xfb00
+#define PCI_DEVICE_ID_LP10000S      0xfc00
+#define PCI_DEVICE_ID_LP11000S      0xfc10
+#define PCI_DEVICE_ID_LPE11000S     0xfc20
 #define PCI_DEVICE_ID_HELIOS        0xfd00
-#define PCI_DEVICE_ID_BMID          0xf0d5
-#define PCI_DEVICE_ID_BSMB          0xf0d1
+#define PCI_DEVICE_ID_HELIOS_SCSP   0xfd11
+#define PCI_DEVICE_ID_HELIOS_DCSP   0xfd12
 #define PCI_DEVICE_ID_ZEPHYR        0xfe00
-#define PCI_DEVICE_ID_ZMID          0xf0e5
-#define PCI_DEVICE_ID_ZSMB          0xf0e1
-#define PCI_DEVICE_ID_LP101        0xf0a1
+#define PCI_DEVICE_ID_ZEPHYR_SCSP   0xfe11
+#define PCI_DEVICE_ID_ZEPHYR_DCSP   0xfe12
 
 #define JEDEC_ID_ADDRESS            0x0080001c
 #define FIREFLY_JEDEC_ID            0x1ACC
@@ -1077,7 +1139,7 @@ typedef struct {          /* FireFly BIU registers */
 
 /* Host Attention Register */
 
-#define HA_REG_OFFSET  0       /* Word offset from register base address */
+#define HA_REG_OFFSET  0       /* Byte offset from register base address */
 
 #define HA_R0RE_REQ    0x00000001      /* Bit  0 */
 #define HA_R0CE_RSP    0x00000002      /* Bit  1 */
@@ -1102,7 +1164,7 @@ typedef struct {          /* FireFly BIU registers */
 
 /* Chip Attention Register */
 
-#define CA_REG_OFFSET  1       /* Word offset from register base address */
+#define CA_REG_OFFSET  4       /* Byte offset from register base address */
 
 #define CA_R0CE_REQ    0x00000001      /* Bit  0 */
 #define CA_R0RE_RSP    0x00000002      /* Bit  1 */
@@ -1120,7 +1182,7 @@ typedef struct {          /* FireFly BIU registers */
 
 /* Host Status Register */
 
-#define HS_REG_OFFSET  2       /* Word offset from register base address */
+#define HS_REG_OFFSET  8       /* Byte offset from register base address */
 
 #define HS_MBRDY       0x00400000      /* Bit 22 */
 #define HS_FFRDY       0x00800000      /* Bit 23 */
@@ -1136,7 +1198,7 @@ typedef struct {          /* FireFly BIU registers */
 
 /* Host Control Register */
 
-#define HC_REG_OFFSET        /* Word offset from register base address */
+#define HC_REG_OFFSET  12      /* Word offset from register base address */
 
 #define HC_MBINT_ENA   0x00000001      /* Bit  0 */
 #define HC_R0INT_ENA   0x00000002      /* Bit  1 */
@@ -1183,7 +1245,9 @@ typedef struct {          /* FireFly BIU registers */
 #define MBX_SET_MASK        0x20
 #define MBX_SET_SLIM        0x21
 #define MBX_UNREG_D_ID      0x23
+#define MBX_KILL_BOARD      0x24
 #define MBX_CONFIG_FARP     0x25
+#define MBX_BEACON          0x2A
 
 #define MBX_LOAD_AREA       0x81
 #define MBX_RUN_BIU_DIAG64  0x84
@@ -1230,6 +1294,10 @@ typedef struct {         /* FireFly BIU registers */
 #define CMD_FCP_IREAD_CX        0x1B
 #define CMD_FCP_ICMND_CR        0x1C
 #define CMD_FCP_ICMND_CX        0x1D
+#define CMD_FCP_TSEND_CX        0x1F
+#define CMD_FCP_TRECEIVE_CX     0x21
+#define CMD_FCP_TRSP_CX                0x23
+#define CMD_FCP_AUTO_TRSP_CX    0x29
 
 #define CMD_ADAPTER_MSG         0x20
 #define CMD_ADAPTER_DUMP        0x22
@@ -1256,6 +1324,9 @@ typedef struct {          /* FireFly BIU registers */
 #define CMD_FCP_IREAD64_CX      0x9B
 #define CMD_FCP_ICMND64_CR      0x9C
 #define CMD_FCP_ICMND64_CX      0x9D
+#define CMD_FCP_TSEND64_CX      0x9F
+#define CMD_FCP_TRECEIVE64_CX   0xA1
+#define CMD_FCP_TRSP64_CX       0xA3
 
 #define CMD_GEN_REQUEST64_CR    0xC2
 #define CMD_GEN_REQUEST64_CX    0xC3
@@ -1487,6 +1558,7 @@ typedef struct {
 
 #define FLAGS_TOPOLOGY_FAILOVER      0x0400    /* Bit 10 */
 #define FLAGS_LINK_SPEED             0x0800    /* Bit 11 */
+#define FLAGS_IMED_ABORT             0x04000   /* Bit 14 */
 
        uint32_t link_speed;
 #define LINK_SPEED_AUTO 0       /* Auto selection */
@@ -1659,13 +1731,13 @@ typedef struct {
        uint32_t rttov;
        uint32_t altov;
        uint32_t lmt;
-#define LMT_RESERVED    0x0    /* Not used */
-#define LMT_266_10bit   0x1    /* 265.625 Mbaud 10 bit iface  */
-#define LMT_532_10bit   0x2    /* 531.25  Mbaud 10 bit iface  */
-#define LMT_1063_20bit  0x3    /* 1062.5   Mbaud 20 bit iface */
-#define LMT_1063_10bit  0x4    /* 1062.5   Mbaud 10 bit iface */
-#define LMT_2125_10bit  0x8    /* 2125     Mbaud 10 bit iface */
-#define LMT_4250_10bit  0x40   /* 4250     Mbaud 10 bit iface */
+#define LMT_RESERVED  0x000    /* Not used */
+#define LMT_1Gb       0x004
+#define LMT_2Gb       0x008
+#define LMT_4Gb       0x040
+#define LMT_8Gb       0x080
+#define LMT_10Gb      0x100
+
 
        uint32_t rsvd2;
        uint32_t rsvd3;
@@ -2095,7 +2167,9 @@ typedef struct {
 #define  DMP_NV_PARAMS           0x2
 
 #define  DMP_REGION_VPD          0xe
-#define  DMP_VPD_SIZE            0x100
+#define  DMP_VPD_SIZE            0x400  /* maximum amount of VPD */
+#define  DMP_RSP_OFFSET          0x14   /* word 5 contains first word of rsp */
+#define  DMP_RSP_SIZE            0x6C   /* maximum of 27 words of rsp data */
 
 /* Structure for MB Command CONFIG_PORT (0x88) */
 
@@ -2177,7 +2251,8 @@ typedef struct {
 } CONFIG_FARP_VAR;
 
 /* Union of all Mailbox Command types */
-#define MAILBOX_CMD_WSIZE 32
+#define MAILBOX_CMD_WSIZE      32
+#define MAILBOX_CMD_SIZE       (MAILBOX_CMD_WSIZE * sizeof(uint32_t))
 
 typedef union {
        uint32_t varWords[MAILBOX_CMD_WSIZE - 1];
@@ -2213,27 +2288,27 @@ typedef union {
  * SLI-2 specific structures
  */
 
-typedef struct {
-       uint32_t cmdPutInx;
-       uint32_t rspGetInx;
-} HGP;
+struct lpfc_hgp {
+       __le32 cmdPutInx;
+       __le32 rspGetInx;
+};
 
-typedef struct {
-       uint32_t cmdGetInx;
-       uint32_t rspPutInx;
-} PGP;
+struct lpfc_pgp {
+       __le32 cmdGetInx;
+       __le32 rspPutInx;
+};
 
 typedef struct _SLI2_DESC {
-       HGP host[MAX_RINGS];
+       struct lpfc_hgp host[MAX_RINGS];
        uint32_t unused1[16];
-       PGP port[MAX_RINGS];
+       struct lpfc_pgp port[MAX_RINGS];
 } SLI2_DESC;
 
 typedef union {
        SLI2_DESC s2;
 } SLI_VAR;
 
-typedef volatile struct {
+typedef struct {
 #ifdef __BIG_ENDIAN_BITFIELD
        uint16_t mbxStatus;
        uint8_t mbxCommand;
@@ -2536,7 +2611,7 @@ typedef struct {
        uint32_t fcpt_Length;   /* transfer ready for IWRITE */
 } FCPT_FIELDS64;
 
-typedef volatile struct _IOCB {        /* IOCB structure */
+typedef struct _IOCB { /* IOCB structure */
        union {
                GENERIC_RSP grsp;       /* Generic response */
                XR_SEQ_FIELDS xrseq;    /* XMIT / BCAST / RCV_SEQUENCE cmd */
@@ -2684,5 +2759,3 @@ lpfc_is_LC_HBA(unsigned short device)
        else
                return 0;
 }
-
-#endif                         /* _H_LPFC_HW */