]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - drivers/scsi/aacraid/aacraid.h
scsi: aacraid: Added support for response path
[mirror_ubuntu-artful-kernel.git] / drivers / scsi / aacraid / aacraid.h
index f059c14efa0c7cb0c094451ef13e41a0f6d6bee4..d1f5a66770aad9c993147db2a4a5f984ca91233e 100644 (file)
@@ -1,3 +1,5 @@
+#ifndef _AACRAID_H_
+#define _AACRAID_H_
 #ifndef dprintk
 # define dprintk(x)
 #endif
@@ -79,6 +81,32 @@ enum {
 
 #define AAC_DEBUG_INSTRUMENT_AIF_DELETE
 
+#define AAC_MAX_NATIVE_TARGETS         1024
+/* Thor: 5 phys. buses: #0: empty, 1-4: 256 targets each */
+#define AAC_MAX_BUSES                  5
+#define AAC_MAX_TARGETS                256
+#define AAC_MAX_NATIVE_SIZE            2048
+
+#define CISS_REPORT_PHYSICAL_LUNS      0xc3
+
+struct aac_ciss_phys_luns_resp {
+       u8      list_length[4];         /* LUN list length (N-7, big endian) */
+       u8      resp_flag;              /* extended response_flag */
+       u8      reserved[3];
+       struct _ciss_lun {
+               u8      tid[3];         /* Target ID */
+               u8      bus;            /* Bus, flag (bits 6,7) */
+               u8      level3[2];
+               u8      level2[2];
+               u8      node_ident[16]; /* phys. node identifier */
+       } lun[1];                       /* List of phys. devices */
+};
+
+/*
+ * Interrupts
+ */
+#define AAC_MAX_HRRQ           64
+
 /*
  * These macros convert from physical channels to virtual channels
  */
@@ -379,7 +407,7 @@ struct aac_fibhdr {
                __le32 SenderFibAddressHigh;/* upper 32bit of phys. FIB address */
                __le32 TimeStamp;       /* otherwise timestamp for FW internal use */
        } u;
-       u32 Handle;             /* FIB handle used for MSGU commnunication */
+       __le32 Handle;          /* FIB handle used for MSGU commnunication */
        u32 Previous;           /* FW internal use */
        u32 Next;               /* FW internal use */
 };
@@ -489,41 +517,64 @@ enum fib_xfer_state {
 #define ADAPTER_INIT_STRUCT_REVISION_4         4 // rocket science
 #define ADAPTER_INIT_STRUCT_REVISION_6         6 /* PMC src */
 #define ADAPTER_INIT_STRUCT_REVISION_7         7 /* Denali */
+#define ADAPTER_INIT_STRUCT_REVISION_8         8 // Thor
 
-struct aac_init
+union aac_init
 {
-       __le32  InitStructRevision;
-       __le32  Sa_MSIXVectors;
-       __le32  fsrev;
-       __le32  CommHeaderAddress;
-       __le32  FastIoCommAreaAddress;
-       __le32  AdapterFibsPhysicalAddress;
-       __le32  AdapterFibsVirtualAddress;
-       __le32  AdapterFibsSize;
-       __le32  AdapterFibAlign;
-       __le32  printfbuf;
-       __le32  printfbufsiz;
-       __le32  HostPhysMemPages;   /* number of 4k pages of host
-                                      physical memory */
-       __le32  HostElapsedSeconds; /* number of seconds since 1970. */
-       /*
-        * ADAPTER_INIT_STRUCT_REVISION_4 begins here
-        */
-       __le32  InitFlags;      /* flags for supported features */
+       struct _r7 {
+               __le32  init_struct_revision;
+               __le32  no_of_msix_vectors;
+               __le32  fsrev;
+               __le32  comm_header_address;
+               __le32  fast_io_comm_area_address;
+               __le32  adapter_fibs_physical_address;
+               __le32  adapter_fibs_virtual_address;
+               __le32  adapter_fibs_size;
+               __le32  adapter_fib_align;
+               __le32  printfbuf;
+               __le32  printfbufsiz;
+               /* number of 4k pages of host phys. mem. */
+               __le32  host_phys_mem_pages;
+               /* number of seconds since 1970. */
+               __le32  host_elapsed_seconds;
+               /* ADAPTER_INIT_STRUCT_REVISION_4 begins here */
+               __le32  init_flags;     /* flags for supported features */
 #define INITFLAGS_NEW_COMM_SUPPORTED   0x00000001
 #define INITFLAGS_DRIVER_USES_UTC_TIME 0x00000010
 #define INITFLAGS_DRIVER_SUPPORTS_PM   0x00000020
 #define INITFLAGS_NEW_COMM_TYPE1_SUPPORTED     0x00000040
 #define INITFLAGS_FAST_JBOD_SUPPORTED  0x00000080
 #define INITFLAGS_NEW_COMM_TYPE2_SUPPORTED     0x00000100
-       __le32  MaxIoCommands;  /* max outstanding commands */
-       __le32  MaxIoSize;      /* largest I/O command */
-       __le32  MaxFibSize;     /* largest FIB to adapter */
-       /* ADAPTER_INIT_STRUCT_REVISION_5 begins here */
-       __le32  MaxNumAif;      /* max number of aif */
-       /* ADAPTER_INIT_STRUCT_REVISION_6 begins here */
-       __le32  HostRRQ_AddrLow;
-       __le32  HostRRQ_AddrHigh;       /* Host RRQ (response queue) for SRC */
+#define INITFLAGS_DRIVER_SUPPORTS_HBA_MODE  0x00000400
+               __le32  max_io_commands;        /* max outstanding commands */
+               __le32  max_io_size;    /* largest I/O command */
+               __le32  max_fib_size;   /* largest FIB to adapter */
+               /* ADAPTER_INIT_STRUCT_REVISION_5 begins here */
+               __le32  max_num_aif;    /* max number of aif */
+               /* ADAPTER_INIT_STRUCT_REVISION_6 begins here */
+               /* Host RRQ (response queue) for SRC */
+               __le32  host_rrq_addr_low;
+               __le32  host_rrq_addr_high;
+       } r7;
+       struct _r8 {
+               /* ADAPTER_INIT_STRUCT_REVISION_8 */
+               __le32  init_struct_revision;
+               __le32  rr_queue_count;
+               __le32  host_elapsed_seconds; /* number of secs since 1970. */
+               __le32  init_flags;
+               __le32  max_io_size;    /* largest I/O command */
+               __le32  max_num_aif;    /* max number of aif */
+               __le32  reserved1;
+               __le32  reserved2;
+               struct _rrq {
+                       __le32  host_addr_low;
+                       __le32  host_addr_high;
+                       __le16  msix_id;
+                       __le16  element_count;
+                       __le16  comp_thresh;
+                       __le16  unused;
+               } rrq[1];               /* up to 64 RRQ addresses */
+       } r8;
 };
 
 enum aac_log_level {
@@ -727,6 +778,7 @@ struct sa_registers {
 
 
 #define SA_INIT_NUM_MSIXVECTORS                1
+#define SA_MINIPORT_REVISION           SA_INIT_NUM_MSIXVECTORS
 
 #define sa_readw(AEP, CSR)             readl(&((AEP)->regs.sa->CSR))
 #define sa_readl(AEP, CSR)             readl(&((AEP)->regs.sa->CSR))
@@ -820,18 +872,20 @@ struct rkt_registers {
 #define src_inbound rx_inbound
 
 struct src_mu_registers {
-                               /*      PCI*| Name */
-       __le32  reserved0[6];   /*      00h | Reserved */
-       __le32  IOAR[2];        /*      18h | IOA->host interrupt register */
-       __le32  IDR;            /*      20h | Inbound Doorbell Register */
-       __le32  IISR;           /*      24h | Inbound Int. Status Register */
-       __le32  reserved1[3];   /*      28h | Reserved */
-       __le32  OIMR;           /*      34h | Outbound Int. Mask Register */
-       __le32  reserved2[25];  /*      38h | Reserved */
-       __le32  ODR_R;          /*      9ch | Outbound Doorbell Read */
-       __le32  ODR_C;          /*      a0h | Outbound Doorbell Clear */
-       __le32  reserved3[6];   /*      a4h | Reserved */
-       __le32  OMR;            /*      bch | Outbound Message Register */
+                               /*  PCI*| Name */
+       __le32  reserved0[6];   /*  00h | Reserved */
+       __le32  IOAR[2];        /*  18h | IOA->host interrupt register */
+       __le32  IDR;            /*  20h | Inbound Doorbell Register */
+       __le32  IISR;           /*  24h | Inbound Int. Status Register */
+       __le32  reserved1[3];   /*  28h | Reserved */
+       __le32  OIMR;           /*  34h | Outbound Int. Mask Register */
+       __le32  reserved2[25];  /*  38h | Reserved */
+       __le32  ODR_R;          /*  9ch | Outbound Doorbell Read */
+       __le32  ODR_C;          /*  a0h | Outbound Doorbell Clear */
+       __le32  reserved3[3];   /*  a4h | Reserved */
+       __le32  SCR0;           /*  b0h | Scratchpad 0 */
+       __le32  reserved4[2];   /*  b4h | Reserved */
+       __le32  OMR;            /*  bch | Outbound Message Register */
        __le32  IQ_L;           /*  c0h | Inbound Queue (Low address) */
        __le32  IQ_H;           /*  c4h | Inbound Queue (High address) */
        __le32  ODR_MSI;        /*  c8h | MSI register for sync./AIF */
@@ -930,6 +984,7 @@ struct fsa_dev_info {
        char            devname[8];
        struct sense_data sense_data;
        u32             block_size;
+       u8              identifier[16];
 };
 
 struct fib {
@@ -960,6 +1015,21 @@ struct fib {
        u32                     vector_no;
        struct hw_fib           *hw_fib_va;             /* Actual shared object */
        dma_addr_t              hw_fib_pa;              /* physical address of hw_fib*/
+       u32                     hbacmd_size;    /* cmd size for native */
+};
+
+#define AAC_DEVTYPE_RAID_MEMBER        1
+#define AAC_DEVTYPE_ARC_RAW            2
+#define AAC_DEVTYPE_NATIVE_RAW         3
+#define AAC_EXPOSE_DISK                0
+#define AAC_HIDE_DISK                  3
+
+struct aac_hba_map_info {
+       __le32  rmw_nexus;              /* nexus for native HBA devices */
+       u8              devtype;        /* device type */
+       u8              reset_state;    /* 0 - no reset, 1..x - */
+                                       /* after xth TM LUN reset */
+       u8              expose;         /*checks if to expose or not*/
 };
 
 /*
@@ -1025,7 +1095,28 @@ struct aac_supplement_adapter_info
        /* StructExpansion == 1 */
        __le32  FeatureBits3;
        __le32  SupportedPerformanceModes;
-       __le32  ReservedForFutureGrowth[80];
+       u8      HostBusType;            /* uses HOST_BUS_TYPE_xxx defines */
+       u8      HostBusWidth;           /* actual width in bits or links */
+       u16     HostBusSpeed;           /* actual bus speed/link rate in MHz */
+       u8      MaxRRCDrives;           /* max. number of ITP-RRC drives/pool */
+       u8      MaxDiskXtasks;          /* max. possible num of DiskX Tasks */
+
+       u8      CpldVerLoaded;
+       u8      CpldVerInFlash;
+
+       __le64  MaxRRCCapacity;
+       __le32  CompiledMaxHistLogLevel;
+       u8      CustomBoardName[12];
+       u16     SupportedCntlrMode;     /* identify supported controller mode */
+       u16     ReservedForFuture16;
+       __le32  SupportedOptions3;      /* reserved for future options */
+
+       __le16  VirtDeviceBus;          /* virt. SCSI device for Thor */
+       __le16  VirtDeviceTarget;
+       __le16  VirtDeviceLUN;
+       __le16  Unused;
+       __le32  ReservedForFutureGrowth[68];
+
 };
 #define AAC_FEATURE_FALCON     cpu_to_le32(0x00000010)
 #define AAC_FEATURE_JBOD       cpu_to_le32(0x08000000)
@@ -1099,11 +1190,20 @@ struct aac_bus_info_response {
 #define AAC_OPT_SUPPLEMENT_ADAPTER_INFO        cpu_to_le32(1<<16)
 #define AAC_OPT_NEW_COMM               cpu_to_le32(1<<17)
 #define AAC_OPT_NEW_COMM_64            cpu_to_le32(1<<18)
+#define AAC_OPT_EXTENDED               cpu_to_le32(1<<23)
 #define AAC_OPT_NEW_COMM_TYPE1         cpu_to_le32(1<<28)
 #define AAC_OPT_NEW_COMM_TYPE2         cpu_to_le32(1<<29)
 #define AAC_OPT_NEW_COMM_TYPE3         cpu_to_le32(1<<30)
 #define AAC_OPT_NEW_COMM_TYPE4         cpu_to_le32(1<<31)
 
+#define AAC_COMM_PRODUCER              0
+#define AAC_COMM_MESSAGE               1
+#define AAC_COMM_MESSAGE_TYPE1         3
+#define AAC_COMM_MESSAGE_TYPE2         4
+#define AAC_COMM_MESSAGE_TYPE3         5
+
+#define AAC_EXTOPT_SA_FIRMWARE         cpu_to_le32(1<<1)
+
 /* MSIX context */
 struct aac_msix_ctx {
        int             vector_no;
@@ -1119,9 +1219,11 @@ struct aac_dev
        /*
         *      negotiated FIB settings
         */
-       unsigned                max_fib_size;
-       unsigned                sg_tablesize;
-       unsigned                max_num_aif;
+       unsigned int            max_fib_size;
+       unsigned int            sg_tablesize;
+       unsigned int            max_num_aif;
+
+       unsigned int            max_cmd_size;   /* max_fib_size or MAX_NATIVE */
 
        /*
         *      Map for 128 fib objects (64k)
@@ -1157,21 +1259,23 @@ struct aac_dev
 
        resource_size_t         base_size, dbg_size;    /* Size of
                                                         *  mapped in region */
-
-       struct aac_init         *init;          /* Holds initialization info to communicate with adapter */
+       /*
+        * Holds initialization info
+        * to communicate with adapter
+        */
+       union aac_init          *init;
        dma_addr_t              init_pa;        /* Holds physical address of the init struct */
-
-       u32                     *host_rrq;      /* response queue
-                                                * if AAC_COMM_MESSAGE_TYPE1 */
-
+       /* response queue (if AAC_COMM_MESSAGE_TYPE1) */
+       __le32                  *host_rrq;
        dma_addr_t              host_rrq_pa;    /* phys. address */
        /* index into rrq buffer */
        u32                     host_rrq_idx[AAC_MAX_MSIX];
        atomic_t                rrq_outstanding[AAC_MAX_MSIX];
        u32                     fibs_pushed_no;
        struct pci_dev          *pdev;          /* Our PCI interface */
-       void *                  printfbuf;      /* pointer to buffer used for printf's from the adapter */
-       void *                  comm_addr;      /* Base address of Comm area */
+       /* pointer to buffer used for printf's from the adapter */
+       void                    *printfbuf;
+       void                    *comm_addr;     /* Base address of Comm area */
        dma_addr_t              comm_phys;      /* Physical Address of Comm area */
        size_t                  comm_size;
 
@@ -1227,15 +1331,12 @@ struct aac_dev
        u8                      needs_dac;
        u8                      raid_scsi_mode;
        u8                      comm_interface;
-#      define AAC_COMM_PRODUCER 0
-#      define AAC_COMM_MESSAGE  1
-#      define AAC_COMM_MESSAGE_TYPE1   3
-#      define AAC_COMM_MESSAGE_TYPE2   4
        u8                      raw_io_interface;
        u8                      raw_io_64;
        u8                      printf_enabled;
        u8                      in_reset;
        u8                      msi;
+       u8                      sa_firmware;
        int                     management_fib_count;
        spinlock_t              manage_lock;
        spinlock_t              sync_lock;
@@ -1246,7 +1347,10 @@ struct aac_dev
        u32                     max_msix;       /* max. MSI-X vectors */
        u32                     vector_cap;     /* MSI-X vector capab.*/
        int                     msi_enabled;    /* MSI/MSI-X enabled */
+       atomic_t                msix_counter;
+       struct msix_entry       msixentry[AAC_MAX_MSIX];
        struct aac_msix_ctx     aac_msix[AAC_MAX_MSIX]; /* context */
+       struct aac_hba_map_info hba_map[AAC_MAX_BUSES][AAC_MAX_TARGETS];
        u8                      adapter_shutdown;
        u32                     handle_pci_error;
 };
@@ -2131,6 +2235,7 @@ static inline unsigned int cap_to_cyls(sector_t capacity, unsigned divisor)
 
 int aac_acquire_irq(struct aac_dev *dev);
 void aac_free_irq(struct aac_dev *dev);
+int aac_report_phys_luns(struct aac_dev *dev, struct fib *fibptr);
 const char *aac_driverinfo(struct Scsi_Host *);
 void aac_fib_vector_assign(struct aac_dev *dev);
 struct fib *aac_fib_alloc(struct aac_dev *dev);
@@ -2183,7 +2288,6 @@ int aac_rx_select_comm(struct aac_dev *dev, int comm);
 int aac_rx_deliver_producer(struct fib * fib);
 char * get_container_type(unsigned type);
 extern int numacb;
-extern int acbsize;
 extern char aac_driver_version[];
 extern int startup_timeout;
 extern int aif_timeout;
@@ -2194,3 +2298,4 @@ extern int aac_commit;
 extern int update_interval;
 extern int check_interval;
 extern int aac_check_reset;
+#endif