These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / scsi / hpsa_cmd.h
index 3a621c7..d92ef0d 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_CMD_H
 #define CMD_UNSOLICITED_ABORT   0x000A
 #define CMD_TIMEOUT             0x000B
 #define CMD_UNABORTABLE                0x000C
+#define CMD_TMF_STATUS         0x000D
 #define CMD_IOACCEL_DISABLED   0x000E
+#define CMD_CTLR_LOCKUP                0xffff
+/* Note: CMD_CTLR_LOCKUP is not a value defined by the CISS spec
+ * it is a value defined by the driver that commands can be marked
+ * with when a controller lockup has been detected by the driver
+ */
 
+/* TMF function status values */
+#define CISS_TMF_COMPLETE      0x00
+#define CISS_TMF_INVALID_FRAME 0x02
+#define CISS_TMF_NOT_SUPPORTED 0x04
+#define CISS_TMF_FAILED                0x05
+#define CISS_TMF_SUCCESS       0x08
+#define CISS_TMF_WRONG_LUN     0x09
+#define CISS_TMF_OVERLAPPED_TAG 0x0a
 
 /* Unit Attentions ASC's as defined for the MSA2012sa */
 #define POWER_OR_RESET                 0x29
 /* Logical volume states */
 #define HPSA_VPD_LV_STATUS_UNSUPPORTED                 0xff
 #define HPSA_LV_OK                                      0x0
+#define HPSA_LV_NOT_AVAILABLE                          0x0b
 #define HPSA_LV_UNDERGOING_ERASE                       0x0F
 #define HPSA_LV_UNDERGOING_RPI                         0x12
 #define HPSA_LV_PENDING_RPI                            0x13
@@ -240,6 +252,7 @@ struct ReportLUNdata {
 
 struct ext_report_lun_entry {
        u8 lunid[8];
+#define MASKED_DEVICE(x) ((x)[3] & 0xC0)
 #define GET_BMIC_BUS(lunid) ((lunid)[7] & 0x3F)
 #define GET_BMIC_LEVEL_TWO_TARGET(lunid) ((lunid)[6])
 #define GET_BMIC_DRIVE_NUMBER(lunid) (((GET_BMIC_BUS((lunid)) - 1) << 8) + \
@@ -273,6 +286,11 @@ struct SenseSubsystem_info {
 #define BMIC_FLASH_FIRMWARE 0xF7
 #define BMIC_SENSE_CONTROLLER_PARAMETERS 0x64
 #define BMIC_IDENTIFY_PHYSICAL_DEVICE 0x15
+#define BMIC_IDENTIFY_CONTROLLER 0x11
+#define BMIC_SET_DIAG_OPTIONS 0xF4
+#define BMIC_SENSE_DIAG_OPTIONS 0xF5
+#define HPSA_DIAG_OPTS_DISABLE_RLD_CACHING 0x40000000
+#define BMIC_SENSE_SUBSYSTEM_INFORMATION 0x66
 
 /* Command List Structure */
 union SCSI3Addr {
@@ -379,6 +397,7 @@ struct ErrorInfo {
 #define CMD_SCSI       0x03
 #define CMD_IOACCEL1   0x04
 #define CMD_IOACCEL2   0x05
+#define IOACCEL2_TMF   0x06
 
 #define DIRECT_LOOKUP_SHIFT 4
 #define DIRECT_LOOKUP_MASK (~((1 << DIRECT_LOOKUP_SHIFT) - 1))
@@ -421,7 +440,10 @@ struct CommandList {
         * not used.
         */
        struct hpsa_scsi_dev_t *phys_disk;
-       atomic_t refcount; /* Must be last to avoid memset in cmd_alloc */
+
+       int abort_pending;
+       struct hpsa_scsi_dev_t *reset_pending;
+       atomic_t refcount; /* Must be last to avoid memset in hpsa_cmd_init() */
 } __aligned(COMMANDLIST_ALIGNMENT);
 
 /* Max S/G elements in I/O accelerator command */
@@ -515,6 +537,12 @@ struct io_accel2_scsi_response {
 #define IOACCEL2_STATUS_SR_TASK_COMP_SET_FULL  0x28
 #define IOACCEL2_STATUS_SR_TASK_COMP_ABORTED   0x40
 #define IOACCEL2_STATUS_SR_IOACCEL_DISABLED    0x0E
+#define IOACCEL2_STATUS_SR_IO_ERROR            0x01
+#define IOACCEL2_STATUS_SR_IO_ABORTED          0x02
+#define IOACCEL2_STATUS_SR_NO_PATH_TO_DEVICE   0x03
+#define IOACCEL2_STATUS_SR_INVALID_DEVICE      0x04
+#define IOACCEL2_STATUS_SR_UNDERRUN            0x51
+#define IOACCEL2_STATUS_SR_OVERRUN             0x75
        u8 data_present;                /* low 2 bits */
 #define IOACCEL2_NO_DATAPRESENT                0x000
 #define IOACCEL2_RESPONSE_DATAPRESENT  0x001
@@ -567,6 +595,7 @@ struct io_accel2_cmd {
 #define IOACCEL2_DIR_NO_DATA   0x00
 #define IOACCEL2_DIR_DATA_IN   0x01
 #define IOACCEL2_DIR_DATA_OUT  0x02
+#define IOACCEL2_TMF_ABORT     0x01
 /*
  * SCSI Task Management Request format for Accelerator Mode 2
  */
@@ -575,13 +604,13 @@ struct hpsa_tmf_struct {
        u8 reply_queue;         /* Reply Queue ID */
        u8 tmf;                 /* Task Management Function */
        u8 reserved1;           /* byte 3 Reserved */
-       u32 it_nexus;           /* SCSI I-T Nexus */
+       __le32 it_nexus;        /* SCSI I-T Nexus */
        u8 lun_id[8];           /* LUN ID for TMF request */
        __le64 tag;             /* cciss tag associated w/ request */
        __le64 abort_tag;       /* cciss tag of SCSI cmd or TMF to abort */
        __le64 error_ptr;               /* Error Pointer */
        __le32 error_len;               /* Error Length */
-};
+} __aligned(IOACCEL2_COMMANDLIST_ALIGNMENT);
 
 /* Configuration Table Structure */
 struct HostWrite {
@@ -658,6 +687,16 @@ struct hpsa_pci_info {
        u32             board_id;
 };
 
+struct bmic_identify_controller {
+       u8      configured_logical_drive_count; /* offset 0 */
+       u8      pad1[153];
+       __le16  extended_logical_unit_count;    /* offset 154 */
+       u8      pad2[136];
+       u8      controller_mode;        /* offset 292 */
+       u8      pad3[32];
+};
+
+
 struct bmic_identify_physical_device {
        u8    scsi_bus;          /* SCSI Bus number on controller */
        u8    scsi_id;           /* SCSI ID on this bus */
@@ -790,5 +829,18 @@ struct bmic_identify_physical_device {
        u8     padding[112];
 };
 
+struct bmic_sense_subsystem_info {
+       u8      primary_slot_number;
+       u8      reserved[3];
+       u8      chasis_serial_number[32];
+       u8      primary_world_wide_id[8];
+       u8      primary_array_serial_number[32]; /* NULL terminated */
+       u8      primary_cache_serial_number[32]; /* NULL terminated */
+       u8      reserved_2[8];
+       u8      secondary_array_serial_number[32];
+       u8      secondary_cache_serial_number[32];
+       u8      pad[332];
+};
+
 #pragma pack()
 #endif /* HPSA_CMD_H */