[SCSI] pm80xx: MSI-X implementation for using 64 interrupts
[platform/adaptation/renesas_rcar/renesas_kernel.git] / drivers / scsi / pm8001 / pm8001_sas.h
1 /*
2  * PMC-Sierra 8001/8081/8088/8089 SAS/SATA based host adapters driver
3  *
4  * Copyright (c) 2008-2009 USI Co., Ltd.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions, and the following disclaimer,
12  *    without modification.
13  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
14  *    substantially similar to the "NO WARRANTY" disclaimer below
15  *    ("Disclaimer") and any redistribution must be conditioned upon
16  *    including a substantially similar Disclaimer requirement for further
17  *    binary redistribution.
18  * 3. Neither the names of the above-listed copyright holders nor the names
19  *    of any contributors may be used to endorse or promote products derived
20  *    from this software without specific prior written permission.
21  *
22  * Alternatively, this software may be distributed under the terms of the
23  * GNU General Public License ("GPL") version 2 as published by the Free
24  * Software Foundation.
25  *
26  * NO WARRANTY
27  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
30  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
31  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
35  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
36  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37  * POSSIBILITY OF SUCH DAMAGES.
38  *
39  */
40
41 #ifndef _PM8001_SAS_H_
42 #define _PM8001_SAS_H_
43
44 #include <linux/kernel.h>
45 #include <linux/module.h>
46 #include <linux/spinlock.h>
47 #include <linux/delay.h>
48 #include <linux/types.h>
49 #include <linux/ctype.h>
50 #include <linux/dma-mapping.h>
51 #include <linux/pci.h>
52 #include <linux/interrupt.h>
53 #include <linux/workqueue.h>
54 #include <scsi/libsas.h>
55 #include <scsi/scsi_tcq.h>
56 #include <scsi/sas_ata.h>
57 #include <linux/atomic.h>
58 #include "pm8001_defs.h"
59
60 #define DRV_NAME                "pm8001"
61 #define DRV_VERSION             "0.1.36"
62 #define PM8001_FAIL_LOGGING     0x01 /* Error message logging */
63 #define PM8001_INIT_LOGGING     0x02 /* driver init logging */
64 #define PM8001_DISC_LOGGING     0x04 /* discovery layer logging */
65 #define PM8001_IO_LOGGING       0x08 /* I/O path logging */
66 #define PM8001_EH_LOGGING       0x10 /* libsas EH function logging*/
67 #define PM8001_IOCTL_LOGGING    0x20 /* IOCTL message logging */
68 #define PM8001_MSG_LOGGING      0x40 /* misc message logging */
69 #define pm8001_printk(format, arg...)   printk(KERN_INFO "%s %d:" format,\
70                                 __func__, __LINE__, ## arg)
71 #define PM8001_CHECK_LOGGING(HBA, LEVEL, CMD)   \
72 do {                                            \
73         if (unlikely(HBA->logging_level & LEVEL))       \
74                 do {                                    \
75                         CMD;                            \
76                 } while (0);                            \
77 } while (0);
78
79 #define PM8001_EH_DBG(HBA, CMD)                 \
80         PM8001_CHECK_LOGGING(HBA, PM8001_EH_LOGGING, CMD)
81
82 #define PM8001_INIT_DBG(HBA, CMD)               \
83         PM8001_CHECK_LOGGING(HBA, PM8001_INIT_LOGGING, CMD)
84
85 #define PM8001_DISC_DBG(HBA, CMD)               \
86         PM8001_CHECK_LOGGING(HBA, PM8001_DISC_LOGGING, CMD)
87
88 #define PM8001_IO_DBG(HBA, CMD)         \
89         PM8001_CHECK_LOGGING(HBA, PM8001_IO_LOGGING, CMD)
90
91 #define PM8001_FAIL_DBG(HBA, CMD)               \
92         PM8001_CHECK_LOGGING(HBA, PM8001_FAIL_LOGGING, CMD)
93
94 #define PM8001_IOCTL_DBG(HBA, CMD)              \
95         PM8001_CHECK_LOGGING(HBA, PM8001_IOCTL_LOGGING, CMD)
96
97 #define PM8001_MSG_DBG(HBA, CMD)                \
98         PM8001_CHECK_LOGGING(HBA, PM8001_MSG_LOGGING, CMD)
99
100
101 #define PM8001_USE_TASKLET
102 #define PM8001_USE_MSIX
103 #define PM8001_READ_VPD
104
105
106 #define DEV_IS_EXPANDER(type)   ((type == EDGE_DEV) || (type == FANOUT_DEV))
107
108 #define PM8001_NAME_LENGTH              32/* generic length of strings */
109 extern struct list_head hba_list;
110 extern const struct pm8001_dispatch pm8001_8001_dispatch;
111
112 struct pm8001_hba_info;
113 struct pm8001_ccb_info;
114 struct pm8001_device;
115 /* define task management IU */
116 struct pm8001_tmf_task {
117         u8      tmf;
118         u32     tag_of_task_to_be_managed;
119 };
120 struct pm8001_ioctl_payload {
121         u32     signature;
122         u16     major_function;
123         u16     minor_function;
124         u16     length;
125         u16     status;
126         u16     offset;
127         u16     id;
128         u8      *func_specific;
129 };
130
131 struct pm8001_dispatch {
132         char *name;
133         int (*chip_init)(struct pm8001_hba_info *pm8001_ha);
134         int (*chip_soft_rst)(struct pm8001_hba_info *pm8001_ha, u32 signature);
135         void (*chip_rst)(struct pm8001_hba_info *pm8001_ha);
136         int (*chip_ioremap)(struct pm8001_hba_info *pm8001_ha);
137         void (*chip_iounmap)(struct pm8001_hba_info *pm8001_ha);
138         irqreturn_t (*isr)(struct pm8001_hba_info *pm8001_ha, u8 vec);
139         u32 (*is_our_interupt)(struct pm8001_hba_info *pm8001_ha);
140         int (*isr_process_oq)(struct pm8001_hba_info *pm8001_ha, u8 vec);
141         void (*interrupt_enable)(struct pm8001_hba_info *pm8001_ha, u8 vec);
142         void (*interrupt_disable)(struct pm8001_hba_info *pm8001_ha, u8 vec);
143         void (*make_prd)(struct scatterlist *scatter, int nr, void *prd);
144         int (*smp_req)(struct pm8001_hba_info *pm8001_ha,
145                 struct pm8001_ccb_info *ccb);
146         int (*ssp_io_req)(struct pm8001_hba_info *pm8001_ha,
147                 struct pm8001_ccb_info *ccb);
148         int (*sata_req)(struct pm8001_hba_info *pm8001_ha,
149                 struct pm8001_ccb_info *ccb);
150         int (*phy_start_req)(struct pm8001_hba_info *pm8001_ha, u8 phy_id);
151         int (*phy_stop_req)(struct pm8001_hba_info *pm8001_ha, u8 phy_id);
152         int (*reg_dev_req)(struct pm8001_hba_info *pm8001_ha,
153                 struct pm8001_device *pm8001_dev, u32 flag);
154         int (*dereg_dev_req)(struct pm8001_hba_info *pm8001_ha, u32 device_id);
155         int (*phy_ctl_req)(struct pm8001_hba_info *pm8001_ha,
156                 u32 phy_id, u32 phy_op);
157         int (*task_abort)(struct pm8001_hba_info *pm8001_ha,
158                 struct pm8001_device *pm8001_dev, u8 flag, u32 task_tag,
159                 u32 cmd_tag);
160         int (*ssp_tm_req)(struct pm8001_hba_info *pm8001_ha,
161                 struct pm8001_ccb_info *ccb, struct pm8001_tmf_task *tmf);
162         int (*get_nvmd_req)(struct pm8001_hba_info *pm8001_ha, void *payload);
163         int (*set_nvmd_req)(struct pm8001_hba_info *pm8001_ha, void *payload);
164         int (*fw_flash_update_req)(struct pm8001_hba_info *pm8001_ha,
165                 void *payload);
166         int (*set_dev_state_req)(struct pm8001_hba_info *pm8001_ha,
167                 struct pm8001_device *pm8001_dev, u32 state);
168         int (*sas_diag_start_end_req)(struct pm8001_hba_info *pm8001_ha,
169                 u32 state);
170         int (*sas_diag_execute_req)(struct pm8001_hba_info *pm8001_ha,
171                 u32 state);
172         int (*sas_re_init_req)(struct pm8001_hba_info *pm8001_ha);
173 };
174
175 struct pm8001_chip_info {
176         u32     encrypt;
177         u32     n_phy;
178         const struct pm8001_dispatch    *dispatch;
179 };
180 #define PM8001_CHIP_DISP        (pm8001_ha->chip->dispatch)
181
182 struct pm8001_port {
183         struct asd_sas_port     sas_port;
184         u8                      port_attached;
185         u8                      wide_port_phymap;
186         u8                      port_state;
187         struct list_head        list;
188 };
189
190 struct pm8001_phy {
191         struct pm8001_hba_info  *pm8001_ha;
192         struct pm8001_port      *port;
193         struct asd_sas_phy      sas_phy;
194         struct sas_identify     identify;
195         struct scsi_device      *sdev;
196         u64                     dev_sas_addr;
197         u32                     phy_type;
198         struct completion       *enable_completion;
199         u32                     frame_rcvd_size;
200         u8                      frame_rcvd[32];
201         u8                      phy_attached;
202         u8                      phy_state;
203         enum sas_linkrate       minimum_linkrate;
204         enum sas_linkrate       maximum_linkrate;
205 };
206
207 struct pm8001_device {
208         enum sas_dev_type       dev_type;
209         struct domain_device    *sas_device;
210         u32                     attached_phy;
211         u32                     id;
212         struct completion       *dcompletion;
213         struct completion       *setds_completion;
214         u32                     device_id;
215         u32                     running_req;
216 };
217
218 struct pm8001_prd_imt {
219         __le32                  len;
220         __le32                  e;
221 };
222
223 struct pm8001_prd {
224         __le64                  addr;           /* 64-bit buffer address */
225         struct pm8001_prd_imt   im_len;         /* 64-bit length */
226 } __attribute__ ((packed));
227 /*
228  * CCB(Command Control Block)
229  */
230 struct pm8001_ccb_info {
231         struct list_head        entry;
232         struct sas_task         *task;
233         u32                     n_elem;
234         u32                     ccb_tag;
235         dma_addr_t              ccb_dma_handle;
236         struct pm8001_device    *device;
237         struct pm8001_prd       buf_prd[PM8001_MAX_DMA_SG];
238         struct fw_control_ex    *fw_control_context;
239         u8                      open_retry;
240 };
241
242 struct mpi_mem {
243         void                    *virt_ptr;
244         dma_addr_t              phys_addr;
245         u32                     phys_addr_hi;
246         u32                     phys_addr_lo;
247         u32                     total_len;
248         u32                     num_elements;
249         u32                     element_size;
250         u32                     alignment;
251 };
252
253 struct mpi_mem_req {
254         /* The number of element in the  mpiMemory array */
255         u32                     count;
256         /* The array of structures that define memroy regions*/
257         struct mpi_mem          region[USI_MAX_MEMCNT];
258 };
259
260 struct encrypt {
261         u32     cipher_mode;
262         u32     sec_mode;
263         u32     status;
264         u32     flag;
265 };
266
267 struct sas_phy_attribute_table {
268         u32     phystart1_16[16];
269         u32     outbound_hw_event_pid1_16[16];
270 };
271
272 union main_cfg_table {
273         struct {
274         u32                     signature;
275         u32                     interface_rev;
276         u32                     firmware_rev;
277         u32                     max_out_io;
278         u32                     max_sgl;
279         u32                     ctrl_cap_flag;
280         u32                     gst_offset;
281         u32                     inbound_queue_offset;
282         u32                     outbound_queue_offset;
283         u32                     inbound_q_nppd_hppd;
284         u32                     outbound_hw_event_pid0_3;
285         u32                     outbound_hw_event_pid4_7;
286         u32                     outbound_ncq_event_pid0_3;
287         u32                     outbound_ncq_event_pid4_7;
288         u32                     outbound_tgt_ITNexus_event_pid0_3;
289         u32                     outbound_tgt_ITNexus_event_pid4_7;
290         u32                     outbound_tgt_ssp_event_pid0_3;
291         u32                     outbound_tgt_ssp_event_pid4_7;
292         u32                     outbound_tgt_smp_event_pid0_3;
293         u32                     outbound_tgt_smp_event_pid4_7;
294         u32                     upper_event_log_addr;
295         u32                     lower_event_log_addr;
296         u32                     event_log_size;
297         u32                     event_log_option;
298         u32                     upper_iop_event_log_addr;
299         u32                     lower_iop_event_log_addr;
300         u32                     iop_event_log_size;
301         u32                     iop_event_log_option;
302         u32                     fatal_err_interrupt;
303         u32                     fatal_err_dump_offset0;
304         u32                     fatal_err_dump_length0;
305         u32                     fatal_err_dump_offset1;
306         u32                     fatal_err_dump_length1;
307         u32                     hda_mode_flag;
308         u32                     anolog_setup_table_offset;
309         u32                     rsvd[4];
310         } pm8001_tbl;
311
312         struct {
313         u32                     signature;
314         u32                     interface_rev;
315         u32                     firmware_rev;
316         u32                     max_out_io;
317         u32                     max_sgl;
318         u32                     ctrl_cap_flag;
319         u32                     gst_offset;
320         u32                     inbound_queue_offset;
321         u32                     outbound_queue_offset;
322         u32                     inbound_q_nppd_hppd;
323         u32                     rsvd[10];
324         u32                     upper_event_log_addr;
325         u32                     lower_event_log_addr;
326         u32                     event_log_size;
327         u32                     event_log_severity;
328         u32                     upper_pcs_event_log_addr;
329         u32                     lower_pcs_event_log_addr;
330         u32                     pcs_event_log_size;
331         u32                     pcs_event_log_severity;
332         u32                     fatal_err_interrupt;
333         u32                     fatal_err_dump_offset0;
334         u32                     fatal_err_dump_length0;
335         u32                     fatal_err_dump_offset1;
336         u32                     fatal_err_dump_length1;
337         u32                     gpio_led_mapping;
338         u32                     analog_setup_table_offset;
339         u32                     int_vec_table_offset;
340         u32                     phy_attr_table_offset;
341         u32                     port_recovery_timer;
342         u32                     interrupt_reassertion_delay;
343         } pm80xx_tbl;
344 };
345
346 union general_status_table {
347         struct {
348         u32                     gst_len_mpistate;
349         u32                     iq_freeze_state0;
350         u32                     iq_freeze_state1;
351         u32                     msgu_tcnt;
352         u32                     iop_tcnt;
353         u32                     rsvd;
354         u32                     phy_state[8];
355         u32                     gpio_input_val;
356         u32                     rsvd1[2];
357         u32                     recover_err_info[8];
358         } pm8001_tbl;
359         struct {
360         u32                     gst_len_mpistate;
361         u32                     iq_freeze_state0;
362         u32                     iq_freeze_state1;
363         u32                     msgu_tcnt;
364         u32                     iop_tcnt;
365         u32                     rsvd[9];
366         u32                     gpio_input_val;
367         u32                     rsvd1[2];
368         u32                     recover_err_info[8];
369         } pm80xx_tbl;
370 };
371 struct inbound_queue_table {
372         u32                     element_pri_size_cnt;
373         u32                     upper_base_addr;
374         u32                     lower_base_addr;
375         u32                     ci_upper_base_addr;
376         u32                     ci_lower_base_addr;
377         u32                     pi_pci_bar;
378         u32                     pi_offset;
379         u32                     total_length;
380         void                    *base_virt;
381         void                    *ci_virt;
382         u32                     reserved;
383         __le32                  consumer_index;
384         u32                     producer_idx;
385 };
386 struct outbound_queue_table {
387         u32                     element_size_cnt;
388         u32                     upper_base_addr;
389         u32                     lower_base_addr;
390         void                    *base_virt;
391         u32                     pi_upper_base_addr;
392         u32                     pi_lower_base_addr;
393         u32                     ci_pci_bar;
394         u32                     ci_offset;
395         u32                     total_length;
396         void                    *pi_virt;
397         u32                     interrup_vec_cnt_delay;
398         u32                     dinterrup_to_pci_offset;
399         __le32                  producer_index;
400         u32                     consumer_idx;
401 };
402 struct pm8001_hba_memspace {
403         void __iomem            *memvirtaddr;
404         u64                     membase;
405         u32                     memsize;
406 };
407 struct pm8001_hba_info {
408         char                    name[PM8001_NAME_LENGTH];
409         struct list_head        list;
410         unsigned long           flags;
411         spinlock_t              lock;/* host-wide lock */
412         struct pci_dev          *pdev;/* our device */
413         struct device           *dev;
414         struct pm8001_hba_memspace io_mem[6];
415         struct mpi_mem_req      memoryMap;
416         struct encrypt          encrypt_info; /* support encryption */
417         void __iomem    *msg_unit_tbl_addr;/*Message Unit Table Addr*/
418         void __iomem    *main_cfg_tbl_addr;/*Main Config Table Addr*/
419         void __iomem    *general_stat_tbl_addr;/*General Status Table Addr*/
420         void __iomem    *inbnd_q_tbl_addr;/*Inbound Queue Config Table Addr*/
421         void __iomem    *outbnd_q_tbl_addr;/*Outbound Queue Config Table Addr*/
422         void __iomem    *pspa_q_tbl_addr;
423                         /*MPI SAS PHY attributes Queue Config Table Addr*/
424         void __iomem    *ivt_tbl_addr; /*MPI IVT Table Addr */
425         union main_cfg_table    main_cfg_tbl;
426         union general_status_table      gs_tbl;
427         struct inbound_queue_table      inbnd_q_tbl[PM8001_MAX_SPCV_INB_NUM];
428         struct outbound_queue_table     outbnd_q_tbl[PM8001_MAX_SPCV_OUTB_NUM];
429         struct sas_phy_attribute_table  phy_attr_table;
430                                         /* MPI SAS PHY attributes */
431         u8                      sas_addr[SAS_ADDR_SIZE];
432         struct sas_ha_struct    *sas;/* SCSI/SAS glue */
433         struct Scsi_Host        *shost;
434         u32                     chip_id;
435         const struct pm8001_chip_info   *chip;
436         struct completion       *nvmd_completion;
437         int                     tags_num;
438         unsigned long           *tags;
439         struct pm8001_phy       phy[PM8001_MAX_PHYS];
440         struct pm8001_port      port[PM8001_MAX_PHYS];
441         u32                     id;
442         u32                     irq;
443         u32                     iomb_size; /* SPC and SPCV IOMB size */
444         struct pm8001_device    *devices;
445         struct pm8001_ccb_info  *ccb_info;
446 #ifdef PM8001_USE_MSIX
447         struct msix_entry       msix_entries[PM8001_MAX_MSIX_VEC];
448                                         /*for msi-x interrupt*/
449         int                     number_of_intr;/*will be used in remove()*/
450 #endif
451 #ifdef PM8001_USE_TASKLET
452         struct tasklet_struct   tasklet;
453 #endif
454         u32                     logging_level;
455         u32                     fw_status;
456         u32                     int_vector;
457         const struct firmware   *fw_image;
458         u8                      outq[PM8001_MAX_MSIX_VEC];
459 };
460
461 struct pm8001_work {
462         struct work_struct work;
463         struct pm8001_hba_info *pm8001_ha;
464         void *data;
465         int handler;
466 };
467
468 struct pm8001_fw_image_header {
469         u8 vender_id[8];
470         u8 product_id;
471         u8 hardware_rev;
472         u8 dest_partition;
473         u8 reserved;
474         u8 fw_rev[4];
475         __be32  image_length;
476         __be32 image_crc;
477         __be32 startup_entry;
478 } __attribute__((packed, aligned(4)));
479
480
481 /**
482  * FW Flash Update status values
483  */
484 #define FLASH_UPDATE_COMPLETE_PENDING_REBOOT    0x00
485 #define FLASH_UPDATE_IN_PROGRESS                0x01
486 #define FLASH_UPDATE_HDR_ERR                    0x02
487 #define FLASH_UPDATE_OFFSET_ERR                 0x03
488 #define FLASH_UPDATE_CRC_ERR                    0x04
489 #define FLASH_UPDATE_LENGTH_ERR                 0x05
490 #define FLASH_UPDATE_HW_ERR                     0x06
491 #define FLASH_UPDATE_DNLD_NOT_SUPPORTED         0x10
492 #define FLASH_UPDATE_DISABLED                   0x11
493
494 /**
495  * brief param structure for firmware flash update.
496  */
497 struct fw_flash_updata_info {
498         u32                     cur_image_offset;
499         u32                     cur_image_len;
500         u32                     total_image_len;
501         struct pm8001_prd       sgl;
502 };
503
504 struct fw_control_info {
505         u32                     retcode;/*ret code (status)*/
506         u32                     phase;/*ret code phase*/
507         u32                     phaseCmplt;/*percent complete for the current
508         update phase */
509         u32                     version;/*Hex encoded firmware version number*/
510         u32                     offset;/*Used for downloading firmware  */
511         u32                     len; /*len of buffer*/
512         u32                     size;/* Used in OS VPD and Trace get size
513         operations.*/
514         u32                     reserved;/* padding required for 64 bit
515         alignment */
516         u8                      buffer[1];/* Start of buffer */
517 };
518 struct fw_control_ex {
519         struct fw_control_info *fw_control;
520         void                    *buffer;/* keep buffer pointer to be
521         freed when the response comes*/
522         void                    *virtAddr;/* keep virtual address of the data */
523         void                    *usrAddr;/* keep virtual address of the
524         user data */
525         dma_addr_t              phys_addr;
526         u32                     len; /* len of buffer  */
527         void                    *payload; /* pointer to IOCTL Payload */
528         u8                      inProgress;/*if 1 - the IOCTL request is in
529         progress */
530         void                    *param1;
531         void                    *param2;
532         void                    *param3;
533 };
534
535 /* pm8001 workqueue */
536 extern struct workqueue_struct *pm8001_wq;
537
538 /******************** function prototype *********************/
539 int pm8001_tag_alloc(struct pm8001_hba_info *pm8001_ha, u32 *tag_out);
540 void pm8001_tag_init(struct pm8001_hba_info *pm8001_ha);
541 u32 pm8001_get_ncq_tag(struct sas_task *task, u32 *tag);
542 void pm8001_ccb_free(struct pm8001_hba_info *pm8001_ha, u32 ccb_idx);
543 void pm8001_ccb_task_free(struct pm8001_hba_info *pm8001_ha,
544         struct sas_task *task, struct pm8001_ccb_info *ccb, u32 ccb_idx);
545 int pm8001_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func,
546         void *funcdata);
547 void pm8001_scan_start(struct Scsi_Host *shost);
548 int pm8001_scan_finished(struct Scsi_Host *shost, unsigned long time);
549 int pm8001_queue_command(struct sas_task *task, const int num,
550         gfp_t gfp_flags);
551 int pm8001_abort_task(struct sas_task *task);
552 int pm8001_abort_task_set(struct domain_device *dev, u8 *lun);
553 int pm8001_clear_aca(struct domain_device *dev, u8 *lun);
554 int pm8001_clear_task_set(struct domain_device *dev, u8 *lun);
555 int pm8001_dev_found(struct domain_device *dev);
556 void pm8001_dev_gone(struct domain_device *dev);
557 int pm8001_lu_reset(struct domain_device *dev, u8 *lun);
558 int pm8001_I_T_nexus_reset(struct domain_device *dev);
559 int pm8001_query_task(struct sas_task *task);
560 void pm8001_open_reject_retry(
561         struct pm8001_hba_info *pm8001_ha,
562         struct sas_task *task_to_close,
563         struct pm8001_device *device_to_close);
564 int pm8001_mem_alloc(struct pci_dev *pdev, void **virt_addr,
565         dma_addr_t *pphys_addr, u32 *pphys_addr_hi, u32 *pphys_addr_lo,
566         u32 mem_size, u32 align);
567
568 /********** functions common to spc & spcv - begins ************/
569 void pm8001_chip_iounmap(struct pm8001_hba_info *pm8001_ha);
570 int pm8001_mpi_build_cmd(struct pm8001_hba_info *pm8001_ha,
571                         struct inbound_queue_table *circularQ,
572                         u32 opCode, void *payload, u32 responseQueue);
573 int pm8001_mpi_msg_free_get(struct inbound_queue_table *circularQ,
574                                 u16 messageSize, void **messagePtr);
575 u32 pm8001_mpi_msg_free_set(struct pm8001_hba_info *pm8001_ha, void *pMsg,
576                         struct outbound_queue_table *circularQ, u8 bc);
577 u32 pm8001_mpi_msg_consume(struct pm8001_hba_info *pm8001_ha,
578                         struct outbound_queue_table *circularQ,
579                         void **messagePtr1, u8 *pBC);
580 int pm8001_chip_set_dev_state_req(struct pm8001_hba_info *pm8001_ha,
581                         struct pm8001_device *pm8001_dev, u32 state);
582 int pm8001_chip_fw_flash_update_req(struct pm8001_hba_info *pm8001_ha,
583                                         void *payload);
584 int pm8001_chip_fw_flash_update_build(struct pm8001_hba_info *pm8001_ha,
585                                         void *fw_flash_updata_info, u32 tag);
586 int pm8001_chip_set_nvmd_req(struct pm8001_hba_info *pm8001_ha, void *payload);
587 int pm8001_chip_get_nvmd_req(struct pm8001_hba_info *pm8001_ha, void *payload);
588 int pm8001_chip_ssp_tm_req(struct pm8001_hba_info *pm8001_ha,
589                                 struct pm8001_ccb_info *ccb,
590                                 struct pm8001_tmf_task *tmf);
591 int pm8001_chip_abort_task(struct pm8001_hba_info *pm8001_ha,
592                                 struct pm8001_device *pm8001_dev,
593                                 u8 flag, u32 task_tag, u32 cmd_tag);
594 int pm8001_chip_dereg_dev_req(struct pm8001_hba_info *pm8001_ha, u32 device_id);
595 void pm8001_chip_make_sg(struct scatterlist *scatter, int nr, void *prd);
596 void pm8001_work_fn(struct work_struct *work);
597 int pm8001_handle_event(struct pm8001_hba_info *pm8001_ha,
598                                         void *data, int handler);
599 void pm8001_mpi_set_dev_state_resp(struct pm8001_hba_info *pm8001_ha,
600                                                         void *piomb);
601 void pm8001_mpi_set_nvmd_resp(struct pm8001_hba_info *pm8001_ha,
602                                                         void *piomb);
603 void pm8001_mpi_get_nvmd_resp(struct pm8001_hba_info *pm8001_ha,
604                                                         void *piomb);
605 int pm8001_mpi_local_phy_ctl(struct pm8001_hba_info *pm8001_ha,
606                                                         void *piomb);
607 void pm8001_get_lrate_mode(struct pm8001_phy *phy, u8 link_rate);
608 void pm8001_get_attached_sas_addr(struct pm8001_phy *phy, u8 *sas_addr);
609 void pm8001_bytes_dmaed(struct pm8001_hba_info *pm8001_ha, int i);
610 int pm8001_mpi_reg_resp(struct pm8001_hba_info *pm8001_ha, void *piomb);
611 int pm8001_mpi_dereg_resp(struct pm8001_hba_info *pm8001_ha, void *piomb);
612 int pm8001_mpi_fw_flash_update_resp(struct pm8001_hba_info *pm8001_ha,
613                                                         void *piomb);
614 int pm8001_mpi_general_event(struct pm8001_hba_info *pm8001_ha , void *piomb);
615 int pm8001_mpi_task_abort_resp(struct pm8001_hba_info *pm8001_ha, void *piomb);
616 /*********** functions common to spc & spcv - ends ************/
617
618 int pm8001_bar4_shift(struct pm8001_hba_info *pm8001_ha, u32 shiftValue);
619
620 /* ctl shared API */
621 extern struct device_attribute *pm8001_host_attrs[];
622
623 #endif
624