These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / scsi / hpsa.h
index 6577130..ae5beda 100644 (file)
@@ -1,6 +1,7 @@
 /*
  *    Disk Array driver for HP Smart Array SAS controllers
- *    Copyright 2000, 2014 Hewlett-Packard Development Company, L.P.
+ *    Copyright 2014-2015 PMC-Sierra, Inc.
+ *    Copyright 2000,2009-2015 Hewlett-Packard Development Company, L.P.
  *
  *    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
  *    MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  *    NON INFRINGEMENT.  See the GNU General Public License for more details.
  *
- *    You should have received a copy of the GNU General Public License
- *    along with this program; if not, write to the Free Software
- *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *    Questions/Comments/Bugfixes to iss_storagedev@hp.com
+ *    Questions/Comments/Bugfixes to storagedev@pmcs.com
  *
  */
 #ifndef HPSA_H
@@ -36,24 +33,58 @@ struct access_method {
        unsigned long (*command_completed)(struct ctlr_info *h, u8 q);
 };
 
+/* for SAS hosts and SAS expanders */
+struct hpsa_sas_node {
+       struct device *parent_dev;
+       struct list_head port_list_head;
+};
+
+struct hpsa_sas_port {
+       struct list_head port_list_entry;
+       u64 sas_address;
+       struct sas_port *port;
+       int next_phy_index;
+       struct list_head phy_list_head;
+       struct hpsa_sas_node *parent_node;
+       struct sas_rphy *rphy;
+};
+
+struct hpsa_sas_phy {
+       struct list_head phy_list_entry;
+       struct sas_phy *phy;
+       struct hpsa_sas_port *parent_port;
+       bool added_to_port;
+};
+
 struct hpsa_scsi_dev_t {
-       int devtype;
+       unsigned int devtype;
        int bus, target, lun;           /* as presented to the OS */
        unsigned char scsi3addr[8];     /* as presented to the HW */
+       u8 physical_device : 1;
+       u8 expose_device;
 #define RAID_CTLR_LUNID "\0\0\0\0\0\0\0\0"
        unsigned char device_id[16];    /* from inquiry pg. 0x83 */
+       u64 sas_address;
        unsigned char vendor[8];        /* bytes 8-15 of inquiry data */
        unsigned char model[16];        /* bytes 16-31 of inquiry data */
        unsigned char raid_level;       /* from inquiry page 0xC1 */
        unsigned char volume_offline;   /* discovered via TUR or VPD */
        u16 queue_depth;                /* max queue_depth for this device */
+       atomic_t reset_cmds_out;        /* Count of commands to-be affected */
        atomic_t ioaccel_cmds_out;      /* Only used for physical devices
                                         * counts commands sent to physical
                                         * device via "ioaccel" path.
                                         */
        u32 ioaccel_handle;
+       u8 active_path_index;
+       u8 path_map;
+       u8 bay;
+       u8 box[8];
+       u16 phys_connector[8];
        int offload_config;             /* I/O accel RAID offload configured */
        int offload_enabled;            /* I/O accel RAID offload enabled */
+       int offload_to_be_enabled;
+       int hba_ioaccel_enabled;
        int offload_to_mirror;          /* Send next I/O accelerator RAID
                                         * offload request to mirror drive
                                         */
@@ -68,6 +99,10 @@ struct hpsa_scsi_dev_t {
         * devices in order to honor physical device queue depth limits.
         */
        struct hpsa_scsi_dev_t *phys_disk[RAID_MAP_MAX_ENTRIES];
+       int nphysical_disks;
+       int supports_aborts;
+       struct hpsa_sas_port *sas_port;
+       int external;   /* 1-from external array 0-not <0-unknown */
 };
 
 struct reply_queue_buffer {
@@ -104,7 +139,6 @@ struct bmic_controller_parameters {
        u8   automatic_drive_slamming;
        u8   reserved1;
        u8   nvram_flags;
-#define HBA_MODE_ENABLED_FLAG (1 << 3)
        u8   cache_nvram_flags;
        u8   drive_config_flags;
        u16  reserved2;
@@ -125,6 +159,7 @@ struct ctlr_info {
        char    *product_name;
        struct pci_dev *pdev;
        u32     board_id;
+       u64     sas_address;
        void __iomem *vaddr;
        unsigned long paddr;
        int     nr_cmds; /* Number of commands allowed on this controller */
@@ -133,7 +168,6 @@ struct ctlr_info {
        struct CfgTable __iomem *cfgtable;
        int     interrupts_enabled;
        int     max_commands;
-       int last_allocation;
        atomic_t commands_outstanding;
 #      define PERF_MODE_INT    0
 #      define DOORBELL_INT     1
@@ -144,7 +178,6 @@ struct ctlr_info {
        unsigned int msi_vector;
        int intr_mode; /* either PERF_MODE_INT or SIMPLE_MODE_INT */
        struct access_method access;
-       char hba_mode_enabled;
 
        /* queue and queue Info */
        unsigned int Qdepth;
@@ -154,6 +187,7 @@ struct ctlr_info {
        u8 max_cmd_sg_entries;
        int chainsize;
        struct SGDescriptor **cmd_sg_list;
+       struct ioaccel2_sg_element **ioaccel2_cmd_sg_list;
 
        /* pointers to command and error info pool */
        struct CommandList      *cmd_pool;
@@ -211,6 +245,7 @@ struct ctlr_info {
        int remove_in_progress;
        /* Address of h->q[x] is passed to intr handler to know which queue */
        u8 q[MAX_REPLY_QUEUES];
+       char intrname[MAX_REPLY_QUEUES][16];    /* "hpsa0-msix00" names */
        u32 TMFSupportFlags; /* cache what task mgmt funcs are supported. */
 #define HPSATMF_BITS_SUPPORTED  (1 << 0)
 #define HPSATMF_PHYS_LUN_RESET  (1 << 1)
@@ -222,6 +257,7 @@ struct ctlr_info {
 #define HPSATMF_PHYS_QRY_TASK   (1 << 7)
 #define HPSATMF_PHYS_QRY_TSET   (1 << 8)
 #define HPSATMF_PHYS_QRY_ASYNC  (1 << 9)
+#define HPSATMF_IOACCEL_ENABLED (1 << 15)
 #define HPSATMF_MASK_SUPPORTED  (1 << 16)
 #define HPSATMF_LOG_LUN_RESET   (1 << 17)
 #define HPSATMF_LOG_NEX_RESET   (1 << 18)
@@ -250,9 +286,19 @@ struct ctlr_info {
        spinlock_t offline_device_lock;
        struct list_head offline_device_list;
        int     acciopath_status;
+       int     drv_req_rescan;
        int     raid_offload_debug;
+       int     discovery_polling;
+       struct  ReportLUNdata *lastlogicals;
+       int     needs_abort_tags_swizzled;
        struct workqueue_struct *resubmit_wq;
        struct workqueue_struct *rescan_ctlr_wq;
+       atomic_t abort_cmds_available;
+       wait_queue_head_t abort_cmd_wait_queue;
+       wait_queue_head_t event_sync_wait_queue;
+       struct mutex reset_mutex;
+       u8 reset_in_progress;
+       struct hpsa_sas_node *sas_host;
 };
 
 struct offline_device_entry {
@@ -266,6 +312,7 @@ struct offline_device_entry {
 #define HPSA_RESET_TYPE_BUS 0x01
 #define HPSA_RESET_TYPE_TARGET 0x03
 #define HPSA_RESET_TYPE_LUN 0x04
+#define HPSA_PHYS_TARGET_RESET 0x99 /* not defined by cciss spec */
 #define HPSA_MSG_SEND_RETRY_LIMIT 10
 #define HPSA_MSG_SEND_RETRY_INTERVAL_MSECS (10000)
 
@@ -350,6 +397,11 @@ struct offline_device_entry {
 #define IOACCEL2_INBOUND_POSTQ_64_LOW  0xd0
 #define IOACCEL2_INBOUND_POSTQ_64_HI   0xd4
 
+#define HPSA_PHYSICAL_DEVICE_BUS       0
+#define HPSA_RAID_VOLUME_BUS           1
+#define HPSA_EXTERNAL_RAID_VOLUME_BUS  2
+#define HPSA_HBA_BUS                   3
+
 /*
        Send the command to the hardware
 */