scsi: hisi_sas: Try wait commands before before controller reset
[linux-2.6-microblaze.git] / drivers / scsi / hisi_sas / hisi_sas.h
index d1153e8..8ce6abb 100644 (file)
@@ -137,7 +137,6 @@ struct hisi_sas_phy {
        struct asd_sas_phy      sas_phy;
        struct sas_identify     identify;
        u64             port_id; /* from hw */
-       u64             dev_sas_addr;
        u64             frame_rcvd_size;
        u8              frame_rcvd[32];
        u8              phy_attached;
@@ -162,7 +161,7 @@ struct hisi_sas_cq {
 
 struct hisi_sas_dq {
        struct hisi_hba *hisi_hba;
-       struct hisi_sas_slot    *slot_prep;
+       struct list_head list;
        spinlock_t lock;
        int     wr_point;
        int     id;
@@ -174,7 +173,6 @@ struct hisi_sas_device {
        struct completion *completion;
        struct hisi_sas_dq      *dq;
        struct list_head        list;
-       u64 attached_phy;
        enum sas_device_type    dev_type;
        int device_id;
        int sata_idx;
@@ -183,6 +181,7 @@ struct hisi_sas_device {
 
 struct hisi_sas_slot {
        struct list_head entry;
+       struct list_head delivery;
        struct sas_task *task;
        struct hisi_sas_port    *port;
        u64     n_elem;
@@ -192,12 +191,14 @@ struct hisi_sas_slot {
        int     cmplt_queue_slot;
        int     idx;
        int     abort;
+       int     ready;
        void    *buf;
        dma_addr_t buf_dma;
        void    *cmd_hdr;
        dma_addr_t cmd_hdr_dma;
        struct work_struct abort_slot;
        struct timer_list internal_abort_timer;
+       bool is_internal;
 };
 
 struct hisi_sas_tmf_task {
@@ -215,14 +216,14 @@ struct hisi_sas_hw {
        void (*sl_notify)(struct hisi_hba *hisi_hba, int phy_no);
        int (*get_free_slot)(struct hisi_hba *hisi_hba, struct hisi_sas_dq *dq);
        void (*start_delivery)(struct hisi_sas_dq *dq);
-       int (*prep_ssp)(struct hisi_hba *hisi_hba,
+       void (*prep_ssp)(struct hisi_hba *hisi_hba,
                        struct hisi_sas_slot *slot, int is_tmf,
                        struct hisi_sas_tmf_task *tmf);
-       int (*prep_smp)(struct hisi_hba *hisi_hba,
+       void (*prep_smp)(struct hisi_hba *hisi_hba,
                        struct hisi_sas_slot *slot);
-       int (*prep_stp)(struct hisi_hba *hisi_hba,
+       void (*prep_stp)(struct hisi_hba *hisi_hba,
                        struct hisi_sas_slot *slot);
-       int (*prep_abort)(struct hisi_hba *hisi_hba,
+       void (*prep_abort)(struct hisi_hba *hisi_hba,
                          struct hisi_sas_slot *slot,
                          int device_id, int abort_flag, int tag_to_abort);
        int (*slot_complete)(struct hisi_hba *hisi_hba,
@@ -245,8 +246,11 @@ struct hisi_sas_hw {
        u32 (*get_phys_state)(struct hisi_hba *hisi_hba);
        int (*write_gpio)(struct hisi_hba *hisi_hba, u8 reg_type,
                                u8 reg_index, u8 reg_count, u8 *write_data);
+       void (*wait_cmds_complete_timeout)(struct hisi_hba *hisi_hba,
+                                          int delay_ms, int timeout_ms);
        int max_command_entries;
        int complete_hdr_size;
+       struct scsi_host_template *sht;
 };
 
 struct hisi_hba {
@@ -273,6 +277,8 @@ struct hisi_hba {
        struct workqueue_struct *wq;
 
        int slot_index_count;
+       int last_slot_index;
+       int last_dev_id;
        unsigned long *slot_index_tags;
        unsigned long reject_stp_links_msk;
 
@@ -411,7 +417,7 @@ struct hisi_sas_command_table_ssp {
        union {
                struct {
                        struct ssp_command_iu task;
-                       u32 prot[6];
+                       u32 prot[7];
                };
                struct ssp_tmf_iu ssp_task;
                struct xfer_rdy_iu xfer_rdy;
@@ -437,10 +443,7 @@ struct hisi_sas_slot_buf_table {
 };
 
 extern struct scsi_transport_template *hisi_sas_stt;
-extern struct scsi_host_template *hisi_sas_sht;
-
 extern void hisi_sas_stop_phys(struct hisi_hba *hisi_hba);
-extern void hisi_sas_init_add(struct hisi_hba *hisi_hba);
 extern int hisi_sas_alloc(struct hisi_hba *hisi_hba, struct Scsi_Host *shost);
 extern void hisi_sas_free(struct hisi_hba *hisi_hba);
 extern u8 hisi_sas_get_ata_protocol(struct host_to_dev_fis *fis,
@@ -454,6 +457,11 @@ extern int hisi_sas_probe(struct platform_device *pdev,
                          const struct hisi_sas_hw *ops);
 extern int hisi_sas_remove(struct platform_device *pdev);
 
+extern int hisi_sas_slave_configure(struct scsi_device *sdev);
+extern int hisi_sas_scan_finished(struct Scsi_Host *shost, unsigned long time);
+extern void hisi_sas_scan_start(struct Scsi_Host *shost);
+extern struct device_attribute *host_attrs[];
+extern int hisi_sas_host_reset(struct Scsi_Host *shost, int reset_type);
 extern void hisi_sas_phy_down(struct hisi_hba *hisi_hba, int phy_no, int rdy);
 extern void hisi_sas_slot_task_free(struct hisi_hba *hisi_hba,
                                    struct sas_task *task,
@@ -465,4 +473,5 @@ extern void hisi_sas_kill_tasklets(struct hisi_hba *hisi_hba);
 extern bool hisi_sas_notify_phy_event(struct hisi_sas_phy *phy,
                                enum hisi_sas_phy_event event);
 extern void hisi_sas_release_tasks(struct hisi_hba *hisi_hba);
+extern u8 hisi_sas_get_prog_phy_linkrate_mask(enum sas_linkrate max);
 #endif