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