scsi: hisi_sas: Switch v3 hw to MQ
[linux-2.6-microblaze.git] / drivers / scsi / hisi_sas / hisi_sas.h
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * Copyright (c) 2015 Linaro Ltd.
4  * Copyright (c) 2015 Hisilicon Limited.
5  */
6
7 #ifndef _HISI_SAS_H_
8 #define _HISI_SAS_H_
9
10 #include <linux/acpi.h>
11 #include <linux/blk-mq.h>
12 #include <linux/blk-mq-pci.h>
13 #include <linux/clk.h>
14 #include <linux/debugfs.h>
15 #include <linux/dmapool.h>
16 #include <linux/iopoll.h>
17 #include <linux/lcm.h>
18 #include <linux/libata.h>
19 #include <linux/mfd/syscon.h>
20 #include <linux/module.h>
21 #include <linux/of_address.h>
22 #include <linux/pci.h>
23 #include <linux/platform_device.h>
24 #include <linux/property.h>
25 #include <linux/regmap.h>
26 #include <linux/timer.h>
27 #include <scsi/sas_ata.h>
28 #include <scsi/libsas.h>
29
30 #define HISI_SAS_MAX_PHYS       9
31 #define HISI_SAS_MAX_QUEUES     32
32 #define HISI_SAS_QUEUE_SLOTS    4096
33 #define HISI_SAS_MAX_ITCT_ENTRIES 1024
34 #define HISI_SAS_MAX_DEVICES HISI_SAS_MAX_ITCT_ENTRIES
35 #define HISI_SAS_RESET_BIT      0
36 #define HISI_SAS_REJECT_CMD_BIT 1
37 #define HISI_SAS_MAX_COMMANDS (HISI_SAS_QUEUE_SLOTS)
38 #define HISI_SAS_RESERVED_IPTT  96
39 #define HISI_SAS_UNRESERVED_IPTT \
40         (HISI_SAS_MAX_COMMANDS - HISI_SAS_RESERVED_IPTT)
41
42 #define HISI_SAS_IOST_ITCT_CACHE_NUM 64
43 #define HISI_SAS_IOST_ITCT_CACHE_DW_SZ 10
44
45 #define HISI_SAS_STATUS_BUF_SZ (sizeof(struct hisi_sas_status_buffer))
46 #define HISI_SAS_COMMAND_TABLE_SZ (sizeof(union hisi_sas_command_table))
47
48 #define hisi_sas_status_buf_addr(buf) \
49         ((buf) + offsetof(struct hisi_sas_slot_buf_table, status_buffer))
50 #define hisi_sas_status_buf_addr_mem(slot) hisi_sas_status_buf_addr((slot)->buf)
51 #define hisi_sas_status_buf_addr_dma(slot) \
52         hisi_sas_status_buf_addr((slot)->buf_dma)
53
54 #define hisi_sas_cmd_hdr_addr(buf) \
55         ((buf) + offsetof(struct hisi_sas_slot_buf_table, command_header))
56 #define hisi_sas_cmd_hdr_addr_mem(slot) hisi_sas_cmd_hdr_addr((slot)->buf)
57 #define hisi_sas_cmd_hdr_addr_dma(slot) hisi_sas_cmd_hdr_addr((slot)->buf_dma)
58
59 #define hisi_sas_sge_addr(buf) \
60         ((buf) + offsetof(struct hisi_sas_slot_buf_table, sge_page))
61 #define hisi_sas_sge_addr_mem(slot) hisi_sas_sge_addr((slot)->buf)
62 #define hisi_sas_sge_addr_dma(slot) hisi_sas_sge_addr((slot)->buf_dma)
63
64 #define hisi_sas_sge_dif_addr(buf) \
65         ((buf) + offsetof(struct hisi_sas_slot_dif_buf_table, sge_dif_page))
66 #define hisi_sas_sge_dif_addr_mem(slot) hisi_sas_sge_dif_addr((slot)->buf)
67 #define hisi_sas_sge_dif_addr_dma(slot) hisi_sas_sge_dif_addr((slot)->buf_dma)
68
69 #define HISI_SAS_MAX_SSP_RESP_SZ (sizeof(struct ssp_frame_hdr) + 1024)
70 #define HISI_SAS_MAX_SMP_RESP_SZ 1028
71 #define HISI_SAS_MAX_STP_RESP_SZ 28
72
73 #define HISI_SAS_SATA_PROTOCOL_NONDATA          0x1
74 #define HISI_SAS_SATA_PROTOCOL_PIO                      0x2
75 #define HISI_SAS_SATA_PROTOCOL_DMA                      0x4
76 #define HISI_SAS_SATA_PROTOCOL_FPDMA            0x8
77 #define HISI_SAS_SATA_PROTOCOL_ATAPI            0x10
78
79 #define HISI_SAS_DIF_PROT_MASK (SHOST_DIF_TYPE1_PROTECTION | \
80                                 SHOST_DIF_TYPE2_PROTECTION | \
81                                 SHOST_DIF_TYPE3_PROTECTION)
82
83 #define HISI_SAS_DIX_PROT_MASK (SHOST_DIX_TYPE1_PROTECTION | \
84                                 SHOST_DIX_TYPE2_PROTECTION | \
85                                 SHOST_DIX_TYPE3_PROTECTION)
86
87 #define HISI_SAS_PROT_MASK (HISI_SAS_DIF_PROT_MASK | HISI_SAS_DIX_PROT_MASK)
88
89 #define HISI_SAS_WAIT_PHYUP_TIMEOUT 20
90 #define CLEAR_ITCT_TIMEOUT      20
91
92 struct hisi_hba;
93
94 enum {
95         PORT_TYPE_SAS = (1U << 1),
96         PORT_TYPE_SATA = (1U << 0),
97 };
98
99 enum dev_status {
100         HISI_SAS_DEV_INIT,
101         HISI_SAS_DEV_NORMAL,
102 };
103
104 enum {
105         HISI_SAS_INT_ABT_CMD = 0,
106         HISI_SAS_INT_ABT_DEV = 1,
107 };
108
109 enum hisi_sas_dev_type {
110         HISI_SAS_DEV_TYPE_STP = 0,
111         HISI_SAS_DEV_TYPE_SSP,
112         HISI_SAS_DEV_TYPE_SATA,
113 };
114
115 struct hisi_sas_hw_error {
116         u32 irq_msk;
117         u32 msk;
118         int shift;
119         const char *msg;
120         int reg;
121         const struct hisi_sas_hw_error *sub;
122 };
123
124 struct hisi_sas_rst {
125         struct hisi_hba *hisi_hba;
126         struct completion *completion;
127         struct work_struct work;
128         bool done;
129 };
130
131 #define HISI_SAS_RST_WORK_INIT(r, c) \
132         {       .hisi_hba = hisi_hba, \
133                 .completion = &c, \
134                 .work = __WORK_INITIALIZER(r.work, \
135                                 hisi_sas_sync_rst_work_handler), \
136                 .done = false, \
137                 }
138
139 #define HISI_SAS_DECLARE_RST_WORK_ON_STACK(r) \
140         DECLARE_COMPLETION_ONSTACK(c); \
141         struct hisi_sas_rst r = HISI_SAS_RST_WORK_INIT(r, c)
142
143 enum hisi_sas_bit_err_type {
144         HISI_SAS_ERR_SINGLE_BIT_ECC = 0x0,
145         HISI_SAS_ERR_MULTI_BIT_ECC = 0x1,
146 };
147
148 enum hisi_sas_phy_event {
149         HISI_PHYE_PHY_UP   = 0U,
150         HISI_PHYE_LINK_RESET,
151         HISI_PHYES_NUM,
152 };
153
154 struct hisi_sas_phy {
155         struct work_struct      works[HISI_PHYES_NUM];
156         struct hisi_hba *hisi_hba;
157         struct hisi_sas_port    *port;
158         struct asd_sas_phy      sas_phy;
159         struct sas_identify     identify;
160         struct completion *reset_completion;
161         struct timer_list timer;
162         spinlock_t lock;
163         u64             port_id; /* from hw */
164         u64             frame_rcvd_size;
165         u8              frame_rcvd[32];
166         u8              phy_attached;
167         u8              in_reset;
168         u8              reserved[2];
169         u32             phy_type;
170         u32             code_violation_err_count;
171         enum sas_linkrate       minimum_linkrate;
172         enum sas_linkrate       maximum_linkrate;
173         int enable;
174         atomic_t down_cnt;
175 };
176
177 struct hisi_sas_port {
178         struct asd_sas_port     sas_port;
179         u8      port_attached;
180         u8      id; /* from hw */
181 };
182
183 struct hisi_sas_cq {
184         struct hisi_hba *hisi_hba;
185         const struct cpumask *irq_mask;
186         int     rd_point;
187         int     id;
188         int     irq_no;
189 };
190
191 struct hisi_sas_dq {
192         struct hisi_hba *hisi_hba;
193         struct list_head list;
194         spinlock_t lock;
195         int     wr_point;
196         int     id;
197 };
198
199 struct hisi_sas_device {
200         struct hisi_hba         *hisi_hba;
201         struct domain_device    *sas_device;
202         struct completion *completion;
203         struct hisi_sas_dq      *dq;
204         struct list_head        list;
205         enum sas_device_type    dev_type;
206         enum dev_status dev_status;
207         int device_id;
208         int sata_idx;
209         spinlock_t lock; /* For protecting slots */
210 };
211
212 struct hisi_sas_tmf_task {
213         int force_phy;
214         int phy_id;
215         u8 tmf;
216         u16 tag_of_task_to_be_managed;
217 };
218
219 struct hisi_sas_slot {
220         struct list_head entry;
221         struct list_head delivery;
222         struct sas_task *task;
223         struct hisi_sas_port    *port;
224         u64     n_elem;
225         u64     n_elem_dif;
226         int     dlvry_queue;
227         int     dlvry_queue_slot;
228         int     cmplt_queue;
229         int     cmplt_queue_slot;
230         int     abort;
231         int     ready;
232         int     device_id;
233         void    *cmd_hdr;
234         dma_addr_t cmd_hdr_dma;
235         struct timer_list internal_abort_timer;
236         bool is_internal;
237         struct hisi_sas_tmf_task *tmf;
238         /* Do not reorder/change members after here */
239         void    *buf;
240         dma_addr_t buf_dma;
241         u16     idx;
242 };
243
244 #define HISI_SAS_DEBUGFS_REG(x) {#x, x}
245
246 struct hisi_sas_debugfs_reg_lu {
247         char *name;
248         int off;
249 };
250
251 struct hisi_sas_debugfs_reg {
252         const struct hisi_sas_debugfs_reg_lu *lu;
253         int count;
254         int base_off;
255         union {
256                 u32 (*read_global_reg)(struct hisi_hba *hisi_hba, u32 off);
257                 u32 (*read_port_reg)(struct hisi_hba *hisi_hba, int port,
258                                      u32 off);
259         };
260 };
261
262 struct hisi_sas_iost_itct_cache {
263         u32 data[HISI_SAS_IOST_ITCT_CACHE_DW_SZ];
264 };
265
266 enum hisi_sas_debugfs_reg_array_member {
267         DEBUGFS_GLOBAL = 0,
268         DEBUGFS_AXI,
269         DEBUGFS_RAS,
270         DEBUGFS_REGS_NUM
271 };
272
273 enum hisi_sas_debugfs_cache_type {
274         HISI_SAS_ITCT_CACHE,
275         HISI_SAS_IOST_CACHE,
276 };
277
278 struct hisi_sas_hw {
279         int (*hw_init)(struct hisi_hba *hisi_hba);
280         void (*setup_itct)(struct hisi_hba *hisi_hba,
281                            struct hisi_sas_device *device);
282         int (*slot_index_alloc)(struct hisi_hba *hisi_hba,
283                                 struct domain_device *device);
284         struct hisi_sas_device *(*alloc_dev)(struct domain_device *device);
285         void (*sl_notify_ssp)(struct hisi_hba *hisi_hba, int phy_no);
286         void (*start_delivery)(struct hisi_sas_dq *dq);
287         void (*prep_ssp)(struct hisi_hba *hisi_hba,
288                         struct hisi_sas_slot *slot);
289         void (*prep_smp)(struct hisi_hba *hisi_hba,
290                         struct hisi_sas_slot *slot);
291         void (*prep_stp)(struct hisi_hba *hisi_hba,
292                         struct hisi_sas_slot *slot);
293         void (*prep_abort)(struct hisi_hba *hisi_hba,
294                           struct hisi_sas_slot *slot,
295                           int device_id, int abort_flag, int tag_to_abort);
296         void (*phys_init)(struct hisi_hba *hisi_hba);
297         void (*phy_start)(struct hisi_hba *hisi_hba, int phy_no);
298         void (*phy_disable)(struct hisi_hba *hisi_hba, int phy_no);
299         void (*phy_hard_reset)(struct hisi_hba *hisi_hba, int phy_no);
300         void (*get_events)(struct hisi_hba *hisi_hba, int phy_no);
301         void (*phy_set_linkrate)(struct hisi_hba *hisi_hba, int phy_no,
302                         struct sas_phy_linkrates *linkrates);
303         enum sas_linkrate (*phy_get_max_linkrate)(void);
304         int (*clear_itct)(struct hisi_hba *hisi_hba,
305                           struct hisi_sas_device *dev);
306         void (*free_device)(struct hisi_sas_device *sas_dev);
307         int (*get_wideport_bitmap)(struct hisi_hba *hisi_hba, int port_id);
308         void (*dereg_device)(struct hisi_hba *hisi_hba,
309                                 struct domain_device *device);
310         int (*soft_reset)(struct hisi_hba *hisi_hba);
311         u32 (*get_phys_state)(struct hisi_hba *hisi_hba);
312         int (*write_gpio)(struct hisi_hba *hisi_hba, u8 reg_type,
313                                 u8 reg_index, u8 reg_count, u8 *write_data);
314         void (*wait_cmds_complete_timeout)(struct hisi_hba *hisi_hba,
315                                            int delay_ms, int timeout_ms);
316         void (*snapshot_prepare)(struct hisi_hba *hisi_hba);
317         void (*snapshot_restore)(struct hisi_hba *hisi_hba);
318         int (*set_bist)(struct hisi_hba *hisi_hba, bool enable);
319         void (*read_iost_itct_cache)(struct hisi_hba *hisi_hba,
320                                      enum hisi_sas_debugfs_cache_type type,
321                                      u32 *cache);
322         int complete_hdr_size;
323         struct scsi_host_template *sht;
324
325         const struct hisi_sas_debugfs_reg *debugfs_reg_array[DEBUGFS_REGS_NUM];
326         const struct hisi_sas_debugfs_reg *debugfs_reg_port;
327 };
328
329 #define HISI_SAS_MAX_DEBUGFS_DUMP (50)
330
331 struct hisi_sas_debugfs_cq {
332         struct hisi_sas_cq *cq;
333         void *complete_hdr;
334 };
335
336 struct hisi_sas_debugfs_dq {
337         struct hisi_sas_dq *dq;
338         struct hisi_sas_cmd_hdr *hdr;
339 };
340
341 struct hisi_sas_debugfs_regs {
342         struct hisi_hba *hisi_hba;
343         u32 *data;
344 };
345
346 struct hisi_sas_debugfs_port {
347         struct hisi_sas_phy *phy;
348         u32 *data;
349 };
350
351 struct hisi_sas_debugfs_iost {
352         struct hisi_sas_iost *iost;
353 };
354
355 struct hisi_sas_debugfs_itct {
356         struct hisi_sas_itct *itct;
357 };
358
359 struct hisi_sas_debugfs_iost_cache {
360         struct hisi_sas_iost_itct_cache *cache;
361 };
362
363 struct hisi_sas_debugfs_itct_cache {
364         struct hisi_sas_iost_itct_cache *cache;
365 };
366
367 struct hisi_hba {
368         /* This must be the first element, used by SHOST_TO_SAS_HA */
369         struct sas_ha_struct *p;
370
371         struct platform_device *platform_dev;
372         struct pci_dev *pci_dev;
373         struct device *dev;
374
375         int prot_mask;
376
377         void __iomem *regs;
378         void __iomem *sgpio_regs;
379         struct regmap *ctrl;
380         u32 ctrl_reset_reg;
381         u32 ctrl_reset_sts_reg;
382         u32 ctrl_clock_ena_reg;
383         u32 refclk_frequency_mhz;
384         u8 sas_addr[SAS_ADDR_SIZE];
385
386         int n_phy;
387         spinlock_t lock;
388         struct semaphore sem;
389
390         struct timer_list timer;
391         struct workqueue_struct *wq;
392
393         int slot_index_count;
394         int last_slot_index;
395         int last_dev_id;
396         unsigned long *slot_index_tags;
397         unsigned long reject_stp_links_msk;
398
399         /* SCSI/SAS glue */
400         struct sas_ha_struct sha;
401         struct Scsi_Host *shost;
402
403         struct hisi_sas_cq cq[HISI_SAS_MAX_QUEUES];
404         struct hisi_sas_dq dq[HISI_SAS_MAX_QUEUES];
405         struct hisi_sas_phy phy[HISI_SAS_MAX_PHYS];
406         struct hisi_sas_port port[HISI_SAS_MAX_PHYS];
407
408         int     queue_count;
409
410         struct hisi_sas_device  devices[HISI_SAS_MAX_DEVICES];
411         struct hisi_sas_cmd_hdr *cmd_hdr[HISI_SAS_MAX_QUEUES];
412         dma_addr_t cmd_hdr_dma[HISI_SAS_MAX_QUEUES];
413         void *complete_hdr[HISI_SAS_MAX_QUEUES];
414         dma_addr_t complete_hdr_dma[HISI_SAS_MAX_QUEUES];
415         struct hisi_sas_initial_fis *initial_fis;
416         dma_addr_t initial_fis_dma;
417         struct hisi_sas_itct *itct;
418         dma_addr_t itct_dma;
419         struct hisi_sas_iost *iost;
420         dma_addr_t iost_dma;
421         struct hisi_sas_breakpoint *breakpoint;
422         dma_addr_t breakpoint_dma;
423         struct hisi_sas_breakpoint *sata_breakpoint;
424         dma_addr_t sata_breakpoint_dma;
425         struct hisi_sas_slot    *slot_info;
426         unsigned long flags;
427         const struct hisi_sas_hw *hw;   /* Low level hw interface */
428         unsigned long sata_dev_bitmap[BITS_TO_LONGS(HISI_SAS_MAX_DEVICES)];
429         struct work_struct rst_work;
430         struct work_struct debugfs_work;
431         u32 phy_state;
432         u32 intr_coal_ticks;    /* Time of interrupt coalesce in us */
433         u32 intr_coal_count;    /* Interrupt count to coalesce */
434
435         int cq_nvecs;
436
437         /* bist */
438         enum sas_linkrate debugfs_bist_linkrate;
439         int debugfs_bist_code_mode;
440         int debugfs_bist_phy_no;
441         int debugfs_bist_mode;
442         u32 debugfs_bist_cnt;
443         int debugfs_bist_enable;
444
445         /* debugfs memories */
446         /* Put Global AXI and RAS Register into register array */
447         struct hisi_sas_debugfs_regs debugfs_regs[HISI_SAS_MAX_DEBUGFS_DUMP][DEBUGFS_REGS_NUM];
448         struct hisi_sas_debugfs_port debugfs_port_reg[HISI_SAS_MAX_DEBUGFS_DUMP][HISI_SAS_MAX_PHYS];
449         struct hisi_sas_debugfs_cq debugfs_cq[HISI_SAS_MAX_DEBUGFS_DUMP][HISI_SAS_MAX_QUEUES];
450         struct hisi_sas_debugfs_dq debugfs_dq[HISI_SAS_MAX_DEBUGFS_DUMP][HISI_SAS_MAX_QUEUES];
451         struct hisi_sas_debugfs_iost debugfs_iost[HISI_SAS_MAX_DEBUGFS_DUMP];
452         struct hisi_sas_debugfs_itct debugfs_itct[HISI_SAS_MAX_DEBUGFS_DUMP];
453         struct hisi_sas_debugfs_iost_cache debugfs_iost_cache[HISI_SAS_MAX_DEBUGFS_DUMP];
454         struct hisi_sas_debugfs_itct_cache debugfs_itct_cache[HISI_SAS_MAX_DEBUGFS_DUMP];
455
456         u64 debugfs_timestamp[HISI_SAS_MAX_DEBUGFS_DUMP];
457         int debugfs_dump_index;
458         struct dentry *debugfs_dir;
459         struct dentry *debugfs_dump_dentry;
460         struct dentry *debugfs_bist_dentry;
461 };
462
463 /* Generic HW DMA host memory structures */
464 /* Delivery queue header */
465 struct hisi_sas_cmd_hdr {
466         /* dw0 */
467         __le32 dw0;
468
469         /* dw1 */
470         __le32 dw1;
471
472         /* dw2 */
473         __le32 dw2;
474
475         /* dw3 */
476         __le32 transfer_tags;
477
478         /* dw4 */
479         __le32 data_transfer_len;
480
481         /* dw5 */
482         __le32 first_burst_num;
483
484         /* dw6 */
485         __le32 sg_len;
486
487         /* dw7 */
488         __le32 dw7;
489
490         /* dw8-9 */
491         __le64 cmd_table_addr;
492
493         /* dw10-11 */
494         __le64 sts_buffer_addr;
495
496         /* dw12-13 */
497         __le64 prd_table_addr;
498
499         /* dw14-15 */
500         __le64 dif_prd_table_addr;
501 };
502
503 struct hisi_sas_itct {
504         __le64 qw0;
505         __le64 sas_addr;
506         __le64 qw2;
507         __le64 qw3;
508         __le64 qw4_15[12];
509 };
510
511 struct hisi_sas_iost {
512         __le64 qw0;
513         __le64 qw1;
514         __le64 qw2;
515         __le64 qw3;
516 };
517
518 struct hisi_sas_err_record {
519         u32     data[4];
520 };
521
522 struct hisi_sas_initial_fis {
523         struct hisi_sas_err_record err_record;
524         struct dev_to_host_fis fis;
525         u32 rsvd[3];
526 };
527
528 struct hisi_sas_breakpoint {
529         u8      data[128];
530 };
531
532 struct hisi_sas_sata_breakpoint {
533         struct hisi_sas_breakpoint tag[32];
534 };
535
536 struct hisi_sas_sge {
537         __le64 addr;
538         __le32 page_ctrl_0;
539         __le32 page_ctrl_1;
540         __le32 data_len;
541         __le32 data_off;
542 };
543
544 struct hisi_sas_command_table_smp {
545         u8 bytes[44];
546 };
547
548 struct hisi_sas_command_table_stp {
549         struct  host_to_dev_fis command_fis;
550         u8      dummy[12];
551         u8      atapi_cdb[ATAPI_CDB_LEN];
552 };
553
554 #define HISI_SAS_SGE_PAGE_CNT (124)
555 struct hisi_sas_sge_page {
556         struct hisi_sas_sge sge[HISI_SAS_SGE_PAGE_CNT];
557 }  __aligned(16);
558
559 #define HISI_SAS_SGE_DIF_PAGE_CNT   HISI_SAS_SGE_PAGE_CNT
560 struct hisi_sas_sge_dif_page {
561         struct hisi_sas_sge sge[HISI_SAS_SGE_DIF_PAGE_CNT];
562 }  __aligned(16);
563
564 struct hisi_sas_command_table_ssp {
565         struct ssp_frame_hdr hdr;
566         union {
567                 struct {
568                         struct ssp_command_iu task;
569                         u32 prot[7];
570                 };
571                 struct ssp_tmf_iu ssp_task;
572                 struct xfer_rdy_iu xfer_rdy;
573                 struct ssp_response_iu ssp_res;
574         } u;
575 };
576
577 union hisi_sas_command_table {
578         struct hisi_sas_command_table_ssp ssp;
579         struct hisi_sas_command_table_smp smp;
580         struct hisi_sas_command_table_stp stp;
581 }  __aligned(16);
582
583 struct hisi_sas_status_buffer {
584         struct hisi_sas_err_record err;
585         u8      iu[1024];
586 }  __aligned(16);
587
588 struct hisi_sas_slot_buf_table {
589         struct hisi_sas_status_buffer status_buffer;
590         union hisi_sas_command_table command_header;
591         struct hisi_sas_sge_page sge_page;
592 };
593
594 struct hisi_sas_slot_dif_buf_table {
595         struct hisi_sas_slot_buf_table slot_buf;
596         struct hisi_sas_sge_dif_page sge_dif_page;
597 };
598
599 extern struct scsi_transport_template *hisi_sas_stt;
600
601 extern bool hisi_sas_debugfs_enable;
602 extern u32 hisi_sas_debugfs_dump_count;
603 extern struct dentry *hisi_sas_debugfs_dir;
604
605 extern void hisi_sas_stop_phys(struct hisi_hba *hisi_hba);
606 extern int hisi_sas_alloc(struct hisi_hba *hisi_hba);
607 extern void hisi_sas_free(struct hisi_hba *hisi_hba);
608 extern u8 hisi_sas_get_ata_protocol(struct host_to_dev_fis *fis,
609                                 int direction);
610 extern struct hisi_sas_port *to_hisi_sas_port(struct asd_sas_port *sas_port);
611 extern void hisi_sas_sata_done(struct sas_task *task,
612                             struct hisi_sas_slot *slot);
613 extern int hisi_sas_get_fw_info(struct hisi_hba *hisi_hba);
614 extern int hisi_sas_probe(struct platform_device *pdev,
615                           const struct hisi_sas_hw *ops);
616 extern int hisi_sas_remove(struct platform_device *pdev);
617
618 extern int hisi_sas_slave_configure(struct scsi_device *sdev);
619 extern int hisi_sas_scan_finished(struct Scsi_Host *shost, unsigned long time);
620 extern void hisi_sas_scan_start(struct Scsi_Host *shost);
621 extern int hisi_sas_host_reset(struct Scsi_Host *shost, int reset_type);
622 extern void hisi_sas_phy_enable(struct hisi_hba *hisi_hba, int phy_no,
623                                 int enable);
624 extern void hisi_sas_phy_down(struct hisi_hba *hisi_hba, int phy_no, int rdy);
625 extern void hisi_sas_slot_task_free(struct hisi_hba *hisi_hba,
626                                     struct sas_task *task,
627                                     struct hisi_sas_slot *slot);
628 extern void hisi_sas_init_mem(struct hisi_hba *hisi_hba);
629 extern void hisi_sas_rst_work_handler(struct work_struct *work);
630 extern void hisi_sas_sync_rst_work_handler(struct work_struct *work);
631 extern void hisi_sas_sync_irqs(struct hisi_hba *hisi_hba);
632 extern void hisi_sas_phy_oob_ready(struct hisi_hba *hisi_hba, int phy_no);
633 extern bool hisi_sas_notify_phy_event(struct hisi_sas_phy *phy,
634                                 enum hisi_sas_phy_event event);
635 extern void hisi_sas_release_tasks(struct hisi_hba *hisi_hba);
636 extern u8 hisi_sas_get_prog_phy_linkrate_mask(enum sas_linkrate max);
637 extern void hisi_sas_controller_reset_prepare(struct hisi_hba *hisi_hba);
638 extern void hisi_sas_controller_reset_done(struct hisi_hba *hisi_hba);
639 extern void hisi_sas_debugfs_init(struct hisi_hba *hisi_hba);
640 extern void hisi_sas_debugfs_exit(struct hisi_hba *hisi_hba);
641 extern void hisi_sas_debugfs_work_handler(struct work_struct *work);
642 #endif