Merge git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6
[pandora-kernel.git] / drivers / scsi / lpfc / lpfc.h
index 3f64c4b..f26b953 100644 (file)
@@ -29,7 +29,8 @@ struct lpfc_sli2_slim;
 #define LPFC_MAX_NS_RETRY      3       /* Number of retry attempts to contact
                                           the NameServer  before giving up. */
 #define LPFC_CMD_PER_LUN       3       /* max outstanding cmds per lun */
-#define LPFC_SG_SEG_CNT                64      /* sg element count per scsi cmnd */
+#define LPFC_DEFAULT_SG_SEG_CNT        64      /* sg element count per scsi cmnd */
+#define LPFC_MAX_SG_SEG_CNT    256     /* sg element count per scsi cmnd */
 #define LPFC_IOCB_LIST_CNT     2250    /* list of IOCBs for fast-path usage. */
 #define LPFC_Q_RAMP_UP_INTERVAL 120     /* lun q_depth ramp up interval */
 
@@ -45,7 +46,7 @@ struct lpfc_sli2_slim;
 #define LPFC_DISC_IOCB_BUFF_COUNT 20
 
 #define LPFC_HB_MBOX_INTERVAL   5      /* Heart beat interval in seconds. */
-#define LPFC_HB_MBOX_TIMEOUT    30     /* Heart beat timeout  in seconds. */
+#define LPFC_HB_MBOX_TIMEOUT    30     /* Heart beat timeout  in seconds. */
 
 /* Define macros for 64 bit support */
 #define putPaddrLow(addr)    ((uint32_t) (0xffffffff & (u64)(addr)))
@@ -68,6 +69,7 @@ struct lpfc_dmabuf {
        struct list_head list;
        void *virt;             /* virtual address ptr */
        dma_addr_t phys;        /* mapped address */
+       uint32_t   buffer_tag;  /* used for tagged queue ring */
 };
 
 struct lpfc_dma_pool {
@@ -78,6 +80,7 @@ struct lpfc_dma_pool {
 
 struct hbq_dmabuf {
        struct lpfc_dmabuf dbuf;
+       uint32_t size;
        uint32_t tag;
 };
 
@@ -271,10 +274,16 @@ struct lpfc_vport {
 #define FC_ABORT_DISCOVERY      0x8000  /* we want to abort discovery */
 #define FC_NDISC_ACTIVE         0x10000         /* NPort discovery active */
 #define FC_BYPASSED_MODE        0x20000         /* NPort is in bypassed mode */
-#define FC_RFF_NOT_SUPPORTED    0x40000         /* RFF_ID was rejected by switch */
 #define FC_VPORT_NEEDS_REG_VPI 0x80000  /* Needs to have its vpi registered */
 #define FC_RSCN_DEFERRED       0x100000 /* A deferred RSCN being processed */
 
+       uint32_t ct_flags;
+#define FC_CT_RFF_ID           0x1      /* RFF_ID accepted by switch */
+#define FC_CT_RNN_ID           0x2      /* RNN_ID accepted by switch */
+#define FC_CT_RSNN_NN          0x4      /* RSNN_NN accepted by switch */
+#define FC_CT_RSPN_ID          0x8      /* RSPN_ID accepted by switch */
+#define FC_CT_RFT_ID           0x10     /* RFT_ID accepted by switch */
+
        struct list_head fc_nodes;
 
        /* Keep counters for the number of entries in each list. */
@@ -329,6 +338,24 @@ struct lpfc_vport {
 #define FC_LOADING             0x1     /* HBA in process of loading drvr */
 #define FC_UNLOADING           0x2     /* HBA in process of unloading drvr */
        char  *vname;                   /* Application assigned name */
+
+       /* Vport Config Parameters */
+       uint32_t cfg_scan_down;
+       uint32_t cfg_lun_queue_depth;
+       uint32_t cfg_nodev_tmo;
+       uint32_t cfg_devloss_tmo;
+       uint32_t cfg_restrict_login;
+       uint32_t cfg_peer_port_login;
+       uint32_t cfg_fcp_class;
+       uint32_t cfg_use_adisc;
+       uint32_t cfg_fdmi_on;
+       uint32_t cfg_discovery_threads;
+       uint32_t cfg_log_verbose;
+       uint32_t cfg_max_luns;
+       uint32_t cfg_enable_da_id;
+
+       uint32_t dev_loss_tmo_changed;
+
        struct fc_vport *fc_vport;
 
 #ifdef CONFIG_LPFC_DEBUG_FS
@@ -342,20 +369,34 @@ struct lpfc_vport {
 
 struct hbq_s {
        uint16_t entry_count;     /* Current number of HBQ slots */
+       uint16_t buffer_count;    /* Current number of buffers posted */
        uint32_t next_hbqPutIdx;  /* Index to next HBQ slot to use */
        uint32_t hbqPutIdx;       /* HBQ slot to use */
        uint32_t local_hbqGetIdx; /* Local copy of Get index from Port */
+       void    *hbq_virt;        /* Virtual ptr to this hbq */
+       struct list_head hbq_buffer_list;  /* buffers assigned to this HBQ */
+                                 /* Callback for HBQ buffer allocation */
+       struct hbq_dmabuf *(*hbq_alloc_buffer) (struct lpfc_hba *);
+                                 /* Callback for HBQ buffer free */
+       void               (*hbq_free_buffer) (struct lpfc_hba *,
+                                              struct hbq_dmabuf *);
 };
 
-#define LPFC_MAX_HBQS  16
-/* this matches the possition in the lpfc_hbq_defs array */
+#define LPFC_MAX_HBQS  4
+/* this matches the position in the lpfc_hbq_defs array */
 #define LPFC_ELS_HBQ   0
+#define LPFC_EXTRA_HBQ 1
+
+enum hba_temp_state {
+       HBA_NORMAL_TEMP,
+       HBA_OVER_TEMP
+};
 
 struct lpfc_hba {
        struct lpfc_sli sli;
        uint32_t sli_rev;               /* SLI2 or SLI3 */
        uint32_t sli3_options;          /* Mask of enabled SLI3 options */
-#define LPFC_SLI3_ENABLED       0x01
+#define LPFC_SLI3_ENABLED       0x01
 #define LPFC_SLI3_HBQ_ENABLED   0x02
 #define LPFC_SLI3_NPIV_ENABLED  0x04
 #define LPFC_SLI3_VPORT_TEARDOWN 0x08
@@ -364,7 +405,7 @@ struct lpfc_hba {
 
        enum hba_state link_state;
        uint32_t link_flag;     /* link state flags */
-#define LS_LOOPBACK_MODE      0x1      /* NPort is in Loopback mode */
+#define LS_LOOPBACK_MODE      0x1      /* NPort is in Loopback mode */
                                        /* This flag is set while issuing */
                                        /* INIT_LINK mailbox command */
 #define LS_NPIV_FAB_SUPPORTED 0x2      /* Fabric supports NPIV */
@@ -413,28 +454,16 @@ struct lpfc_hba {
        uint8_t  wwpn[8];
        uint32_t RandomData[7];
 
-       uint32_t cfg_log_verbose;
-       uint32_t cfg_lun_queue_depth;
-       uint32_t cfg_nodev_tmo;
-       uint32_t cfg_devloss_tmo;
-       uint32_t cfg_hba_queue_depth;
-       uint32_t cfg_peer_port_login;
-       uint32_t cfg_vport_restrict_login;
-       uint32_t cfg_npiv_enable;
-       uint32_t cfg_fcp_class;
-       uint32_t cfg_use_adisc;
+       /* HBA Config Parameters */
        uint32_t cfg_ack0;
+       uint32_t cfg_enable_npiv;
        uint32_t cfg_topology;
-       uint32_t cfg_scan_down;
        uint32_t cfg_link_speed;
        uint32_t cfg_cr_delay;
        uint32_t cfg_cr_count;
        uint32_t cfg_multi_ring_support;
        uint32_t cfg_multi_ring_rctl;
        uint32_t cfg_multi_ring_type;
-       uint32_t cfg_fdmi_on;
-       uint32_t cfg_discovery_threads;
-       uint32_t cfg_max_luns;
        uint32_t cfg_poll;
        uint32_t cfg_poll_tmo;
        uint32_t cfg_use_msi;
@@ -442,8 +471,9 @@ struct lpfc_hba {
        uint32_t cfg_sg_dma_buf_size;
        uint64_t cfg_soft_wwnn;
        uint64_t cfg_soft_wwpn;
-
-       uint32_t dev_loss_tmo_changed;
+       uint32_t cfg_hba_queue_depth;
+       uint32_t cfg_enable_hba_reset;
+       uint32_t cfg_enable_hba_heartbeat;
 
        lpfc_vpd_t vpd;         /* vital product data */
 
@@ -457,7 +487,6 @@ struct lpfc_hba {
        wait_queue_head_t    *work_wait;
        struct task_struct   *worker_thread;
 
-       struct list_head hbq_buffer_list;
        uint32_t hbq_count;             /* Count of configured HBQs */
        struct hbq_s hbqs[LPFC_MAX_HBQS]; /* local copy of hbq indicies  */
 
@@ -526,12 +555,13 @@ struct lpfc_hba {
        mempool_t *nlp_mem_pool;
 
        struct fc_host_statistics link_stats;
+       uint8_t using_msi;
 
        struct list_head port_list;
-       struct lpfc_vport *pport; /* physical lpfc_vport pointer */
-       uint16_t max_vpi;       /* Maximum virtual nports */
-#define LPFC_MAX_VPI 100  /* Max number of VPorts supported */
-       unsigned long *vpi_bmask; /* vpi allocation table */
+       struct lpfc_vport *pport;       /* physical lpfc_vport pointer */
+       uint16_t max_vpi;               /* Maximum virtual nports */
+#define LPFC_MAX_VPI 0xFFFF            /* Max number of VPI supported */
+       unsigned long *vpi_bmask;       /* vpi allocation table */
 
        /* Data structure used by fabric iocb scheduler */
        struct list_head fabric_iocb_list;
@@ -547,16 +577,31 @@ struct lpfc_hba {
 #ifdef CONFIG_LPFC_DEBUG_FS
        struct dentry *hba_debugfs_root;
        atomic_t debugfs_vport_count;
-       struct dentry *debug_dumpslim;
+       struct dentry *debug_hbqinfo;
+       struct dentry *debug_dumpHostSlim;
+       struct dentry *debug_dumpHBASlim;
        struct dentry *debug_slow_ring_trc;
        struct lpfc_debugfs_trc *slow_ring_trc;
        atomic_t slow_ring_trc_cnt;
 #endif
 
+       /* Used for deferred freeing of ELS data buffers */
+       struct list_head elsbuf;
+       int elsbuf_cnt;
+       int elsbuf_prev_cnt;
+
+       uint8_t temp_sensor_support;
        /* Fields used for heart beat. */
        unsigned long last_completion_time;
        struct timer_list hb_tmofunc;
        uint8_t hb_outstanding;
+       /*
+        * Following bit will be set for all buffer tags which are not
+        * associated with any HBQ.
+        */
+#define QUE_BUFTAG_BIT  (1<<31)
+       uint32_t buffer_tag_count;
+       enum hba_temp_state over_temp_state;
 };
 
 static inline struct Scsi_Host *
@@ -582,5 +627,15 @@ lpfc_is_link_up(struct lpfc_hba *phba)
                phba->link_state == LPFC_HBA_READY;
 }
 
-#define FC_REG_DUMP_EVENT      0x10    /* Register for Dump events */
+#define FC_REG_DUMP_EVENT              0x10    /* Register for Dump events */
+#define FC_REG_TEMPERATURE_EVENT       0x20    /* Register for temperature
+                                                  event */
 
+struct temp_event {
+       uint32_t event_type;
+       uint32_t event_code;
+       uint32_t data;
+};
+#define LPFC_CRIT_TEMP         0x1
+#define LPFC_THRESHOLD_TEMP    0x2
+#define LPFC_NORMAL_TEMP       0x3