diff options
Diffstat (limited to 'drivers/scsi/pm8001/pm8001_sas.h')
-rw-r--r-- | drivers/scsi/pm8001/pm8001_sas.h | 181 |
1 files changed, 158 insertions, 23 deletions
diff --git a/drivers/scsi/pm8001/pm8001_sas.h b/drivers/scsi/pm8001/pm8001_sas.h index 11008205aeb3..570819464d90 100644 --- a/drivers/scsi/pm8001/pm8001_sas.h +++ b/drivers/scsi/pm8001/pm8001_sas.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * PMC-Sierra SPC 8001 SAS/SATA based host adapters driver | 2 | * PMC-Sierra PM8001/8081/8088/8089 SAS/SATA based host adapters driver |
3 | * | 3 | * |
4 | * Copyright (c) 2008-2009 USI Co., Ltd. | 4 | * Copyright (c) 2008-2009 USI Co., Ltd. |
5 | * All rights reserved. | 5 | * All rights reserved. |
@@ -57,8 +57,8 @@ | |||
57 | #include <linux/atomic.h> | 57 | #include <linux/atomic.h> |
58 | #include "pm8001_defs.h" | 58 | #include "pm8001_defs.h" |
59 | 59 | ||
60 | #define DRV_NAME "pm8001" | 60 | #define DRV_NAME "pm80xx" |
61 | #define DRV_VERSION "0.1.36" | 61 | #define DRV_VERSION "0.1.37" |
62 | #define PM8001_FAIL_LOGGING 0x01 /* Error message logging */ | 62 | #define PM8001_FAIL_LOGGING 0x01 /* Error message logging */ |
63 | #define PM8001_INIT_LOGGING 0x02 /* driver init logging */ | 63 | #define PM8001_INIT_LOGGING 0x02 /* driver init logging */ |
64 | #define PM8001_DISC_LOGGING 0x04 /* discovery layer logging */ | 64 | #define PM8001_DISC_LOGGING 0x04 /* discovery layer logging */ |
@@ -66,8 +66,8 @@ | |||
66 | #define PM8001_EH_LOGGING 0x10 /* libsas EH function logging*/ | 66 | #define PM8001_EH_LOGGING 0x10 /* libsas EH function logging*/ |
67 | #define PM8001_IOCTL_LOGGING 0x20 /* IOCTL message logging */ | 67 | #define PM8001_IOCTL_LOGGING 0x20 /* IOCTL message logging */ |
68 | #define PM8001_MSG_LOGGING 0x40 /* misc message logging */ | 68 | #define PM8001_MSG_LOGGING 0x40 /* misc message logging */ |
69 | #define pm8001_printk(format, arg...) printk(KERN_INFO "%s %d:" format,\ | 69 | #define pm8001_printk(format, arg...) printk(KERN_INFO "pm80xx %s %d:" \ |
70 | __func__, __LINE__, ## arg) | 70 | format, __func__, __LINE__, ## arg) |
71 | #define PM8001_CHECK_LOGGING(HBA, LEVEL, CMD) \ | 71 | #define PM8001_CHECK_LOGGING(HBA, LEVEL, CMD) \ |
72 | do { \ | 72 | do { \ |
73 | if (unlikely(HBA->logging_level & LEVEL)) \ | 73 | if (unlikely(HBA->logging_level & LEVEL)) \ |
@@ -103,11 +103,12 @@ do { \ | |||
103 | #define PM8001_READ_VPD | 103 | #define PM8001_READ_VPD |
104 | 104 | ||
105 | 105 | ||
106 | #define DEV_IS_EXPANDER(type) ((type == EDGE_DEV) || (type == FANOUT_DEV)) | 106 | #define DEV_IS_EXPANDER(type) ((type == SAS_EDGE_EXPANDER_DEVICE) || (type == SAS_FANOUT_EXPANDER_DEVICE)) |
107 | 107 | ||
108 | #define PM8001_NAME_LENGTH 32/* generic length of strings */ | 108 | #define PM8001_NAME_LENGTH 32/* generic length of strings */ |
109 | extern struct list_head hba_list; | 109 | extern struct list_head hba_list; |
110 | extern const struct pm8001_dispatch pm8001_8001_dispatch; | 110 | extern const struct pm8001_dispatch pm8001_8001_dispatch; |
111 | extern const struct pm8001_dispatch pm8001_80xx_dispatch; | ||
111 | 112 | ||
112 | struct pm8001_hba_info; | 113 | struct pm8001_hba_info; |
113 | struct pm8001_ccb_info; | 114 | struct pm8001_ccb_info; |
@@ -131,15 +132,15 @@ struct pm8001_ioctl_payload { | |||
131 | struct pm8001_dispatch { | 132 | struct pm8001_dispatch { |
132 | char *name; | 133 | char *name; |
133 | int (*chip_init)(struct pm8001_hba_info *pm8001_ha); | 134 | int (*chip_init)(struct pm8001_hba_info *pm8001_ha); |
134 | int (*chip_soft_rst)(struct pm8001_hba_info *pm8001_ha, u32 signature); | 135 | int (*chip_soft_rst)(struct pm8001_hba_info *pm8001_ha); |
135 | void (*chip_rst)(struct pm8001_hba_info *pm8001_ha); | 136 | void (*chip_rst)(struct pm8001_hba_info *pm8001_ha); |
136 | int (*chip_ioremap)(struct pm8001_hba_info *pm8001_ha); | 137 | int (*chip_ioremap)(struct pm8001_hba_info *pm8001_ha); |
137 | void (*chip_iounmap)(struct pm8001_hba_info *pm8001_ha); | 138 | void (*chip_iounmap)(struct pm8001_hba_info *pm8001_ha); |
138 | irqreturn_t (*isr)(struct pm8001_hba_info *pm8001_ha); | 139 | irqreturn_t (*isr)(struct pm8001_hba_info *pm8001_ha, u8 vec); |
139 | u32 (*is_our_interupt)(struct pm8001_hba_info *pm8001_ha); | 140 | u32 (*is_our_interupt)(struct pm8001_hba_info *pm8001_ha); |
140 | int (*isr_process_oq)(struct pm8001_hba_info *pm8001_ha); | 141 | int (*isr_process_oq)(struct pm8001_hba_info *pm8001_ha, u8 vec); |
141 | void (*interrupt_enable)(struct pm8001_hba_info *pm8001_ha); | 142 | void (*interrupt_enable)(struct pm8001_hba_info *pm8001_ha, u8 vec); |
142 | void (*interrupt_disable)(struct pm8001_hba_info *pm8001_ha); | 143 | void (*interrupt_disable)(struct pm8001_hba_info *pm8001_ha, u8 vec); |
143 | void (*make_prd)(struct scatterlist *scatter, int nr, void *prd); | 144 | void (*make_prd)(struct scatterlist *scatter, int nr, void *prd); |
144 | int (*smp_req)(struct pm8001_hba_info *pm8001_ha, | 145 | int (*smp_req)(struct pm8001_hba_info *pm8001_ha, |
145 | struct pm8001_ccb_info *ccb); | 146 | struct pm8001_ccb_info *ccb); |
@@ -173,6 +174,7 @@ struct pm8001_dispatch { | |||
173 | }; | 174 | }; |
174 | 175 | ||
175 | struct pm8001_chip_info { | 176 | struct pm8001_chip_info { |
177 | u32 encrypt; | ||
176 | u32 n_phy; | 178 | u32 n_phy; |
177 | const struct pm8001_dispatch *dispatch; | 179 | const struct pm8001_dispatch *dispatch; |
178 | }; | 180 | }; |
@@ -204,7 +206,7 @@ struct pm8001_phy { | |||
204 | }; | 206 | }; |
205 | 207 | ||
206 | struct pm8001_device { | 208 | struct pm8001_device { |
207 | enum sas_dev_type dev_type; | 209 | enum sas_device_type dev_type; |
208 | struct domain_device *sas_device; | 210 | struct domain_device *sas_device; |
209 | u32 attached_phy; | 211 | u32 attached_phy; |
210 | u32 id; | 212 | u32 id; |
@@ -256,7 +258,20 @@ struct mpi_mem_req { | |||
256 | struct mpi_mem region[USI_MAX_MEMCNT]; | 258 | struct mpi_mem region[USI_MAX_MEMCNT]; |
257 | }; | 259 | }; |
258 | 260 | ||
259 | struct main_cfg_table { | 261 | struct encrypt { |
262 | u32 cipher_mode; | ||
263 | u32 sec_mode; | ||
264 | u32 status; | ||
265 | u32 flag; | ||
266 | }; | ||
267 | |||
268 | struct sas_phy_attribute_table { | ||
269 | u32 phystart1_16[16]; | ||
270 | u32 outbound_hw_event_pid1_16[16]; | ||
271 | }; | ||
272 | |||
273 | union main_cfg_table { | ||
274 | struct { | ||
260 | u32 signature; | 275 | u32 signature; |
261 | u32 interface_rev; | 276 | u32 interface_rev; |
262 | u32 firmware_rev; | 277 | u32 firmware_rev; |
@@ -292,19 +307,69 @@ struct main_cfg_table { | |||
292 | u32 fatal_err_dump_length1; | 307 | u32 fatal_err_dump_length1; |
293 | u32 hda_mode_flag; | 308 | u32 hda_mode_flag; |
294 | u32 anolog_setup_table_offset; | 309 | u32 anolog_setup_table_offset; |
310 | u32 rsvd[4]; | ||
311 | } pm8001_tbl; | ||
312 | |||
313 | struct { | ||
314 | u32 signature; | ||
315 | u32 interface_rev; | ||
316 | u32 firmware_rev; | ||
317 | u32 max_out_io; | ||
318 | u32 max_sgl; | ||
319 | u32 ctrl_cap_flag; | ||
320 | u32 gst_offset; | ||
321 | u32 inbound_queue_offset; | ||
322 | u32 outbound_queue_offset; | ||
323 | u32 inbound_q_nppd_hppd; | ||
324 | u32 rsvd[8]; | ||
325 | u32 crc_core_dump; | ||
326 | u32 rsvd1; | ||
327 | u32 upper_event_log_addr; | ||
328 | u32 lower_event_log_addr; | ||
329 | u32 event_log_size; | ||
330 | u32 event_log_severity; | ||
331 | u32 upper_pcs_event_log_addr; | ||
332 | u32 lower_pcs_event_log_addr; | ||
333 | u32 pcs_event_log_size; | ||
334 | u32 pcs_event_log_severity; | ||
335 | u32 fatal_err_interrupt; | ||
336 | u32 fatal_err_dump_offset0; | ||
337 | u32 fatal_err_dump_length0; | ||
338 | u32 fatal_err_dump_offset1; | ||
339 | u32 fatal_err_dump_length1; | ||
340 | u32 gpio_led_mapping; | ||
341 | u32 analog_setup_table_offset; | ||
342 | u32 int_vec_table_offset; | ||
343 | u32 phy_attr_table_offset; | ||
344 | u32 port_recovery_timer; | ||
345 | u32 interrupt_reassertion_delay; | ||
346 | } pm80xx_tbl; | ||
295 | }; | 347 | }; |
296 | struct general_status_table { | 348 | |
349 | union general_status_table { | ||
350 | struct { | ||
297 | u32 gst_len_mpistate; | 351 | u32 gst_len_mpistate; |
298 | u32 iq_freeze_state0; | 352 | u32 iq_freeze_state0; |
299 | u32 iq_freeze_state1; | 353 | u32 iq_freeze_state1; |
300 | u32 msgu_tcnt; | 354 | u32 msgu_tcnt; |
301 | u32 iop_tcnt; | 355 | u32 iop_tcnt; |
302 | u32 reserved; | 356 | u32 rsvd; |
303 | u32 phy_state[8]; | 357 | u32 phy_state[8]; |
304 | u32 reserved1; | 358 | u32 gpio_input_val; |
305 | u32 reserved2; | 359 | u32 rsvd1[2]; |
306 | u32 reserved3; | 360 | u32 recover_err_info[8]; |
361 | } pm8001_tbl; | ||
362 | struct { | ||
363 | u32 gst_len_mpistate; | ||
364 | u32 iq_freeze_state0; | ||
365 | u32 iq_freeze_state1; | ||
366 | u32 msgu_tcnt; | ||
367 | u32 iop_tcnt; | ||
368 | u32 rsvd[9]; | ||
369 | u32 gpio_input_val; | ||
370 | u32 rsvd1[2]; | ||
307 | u32 recover_err_info[8]; | 371 | u32 recover_err_info[8]; |
372 | } pm80xx_tbl; | ||
308 | }; | 373 | }; |
309 | struct inbound_queue_table { | 374 | struct inbound_queue_table { |
310 | u32 element_pri_size_cnt; | 375 | u32 element_pri_size_cnt; |
@@ -351,15 +416,21 @@ struct pm8001_hba_info { | |||
351 | struct device *dev; | 416 | struct device *dev; |
352 | struct pm8001_hba_memspace io_mem[6]; | 417 | struct pm8001_hba_memspace io_mem[6]; |
353 | struct mpi_mem_req memoryMap; | 418 | struct mpi_mem_req memoryMap; |
419 | struct encrypt encrypt_info; /* support encryption */ | ||
354 | void __iomem *msg_unit_tbl_addr;/*Message Unit Table Addr*/ | 420 | void __iomem *msg_unit_tbl_addr;/*Message Unit Table Addr*/ |
355 | void __iomem *main_cfg_tbl_addr;/*Main Config Table Addr*/ | 421 | void __iomem *main_cfg_tbl_addr;/*Main Config Table Addr*/ |
356 | void __iomem *general_stat_tbl_addr;/*General Status Table Addr*/ | 422 | void __iomem *general_stat_tbl_addr;/*General Status Table Addr*/ |
357 | void __iomem *inbnd_q_tbl_addr;/*Inbound Queue Config Table Addr*/ | 423 | void __iomem *inbnd_q_tbl_addr;/*Inbound Queue Config Table Addr*/ |
358 | void __iomem *outbnd_q_tbl_addr;/*Outbound Queue Config Table Addr*/ | 424 | void __iomem *outbnd_q_tbl_addr;/*Outbound Queue Config Table Addr*/ |
359 | struct main_cfg_table main_cfg_tbl; | 425 | void __iomem *pspa_q_tbl_addr; |
360 | struct general_status_table gs_tbl; | 426 | /*MPI SAS PHY attributes Queue Config Table Addr*/ |
361 | struct inbound_queue_table inbnd_q_tbl[PM8001_MAX_INB_NUM]; | 427 | void __iomem *ivt_tbl_addr; /*MPI IVT Table Addr */ |
362 | struct outbound_queue_table outbnd_q_tbl[PM8001_MAX_OUTB_NUM]; | 428 | union main_cfg_table main_cfg_tbl; |
429 | union general_status_table gs_tbl; | ||
430 | struct inbound_queue_table inbnd_q_tbl[PM8001_MAX_SPCV_INB_NUM]; | ||
431 | struct outbound_queue_table outbnd_q_tbl[PM8001_MAX_SPCV_OUTB_NUM]; | ||
432 | struct sas_phy_attribute_table phy_attr_table; | ||
433 | /* MPI SAS PHY attributes */ | ||
363 | u8 sas_addr[SAS_ADDR_SIZE]; | 434 | u8 sas_addr[SAS_ADDR_SIZE]; |
364 | struct sas_ha_struct *sas;/* SCSI/SAS glue */ | 435 | struct sas_ha_struct *sas;/* SCSI/SAS glue */ |
365 | struct Scsi_Host *shost; | 436 | struct Scsi_Host *shost; |
@@ -372,10 +443,12 @@ struct pm8001_hba_info { | |||
372 | struct pm8001_port port[PM8001_MAX_PHYS]; | 443 | struct pm8001_port port[PM8001_MAX_PHYS]; |
373 | u32 id; | 444 | u32 id; |
374 | u32 irq; | 445 | u32 irq; |
446 | u32 iomb_size; /* SPC and SPCV IOMB size */ | ||
375 | struct pm8001_device *devices; | 447 | struct pm8001_device *devices; |
376 | struct pm8001_ccb_info *ccb_info; | 448 | struct pm8001_ccb_info *ccb_info; |
377 | #ifdef PM8001_USE_MSIX | 449 | #ifdef PM8001_USE_MSIX |
378 | struct msix_entry msix_entries[16];/*for msi-x interrupt*/ | 450 | struct msix_entry msix_entries[PM8001_MAX_MSIX_VEC]; |
451 | /*for msi-x interrupt*/ | ||
379 | int number_of_intr;/*will be used in remove()*/ | 452 | int number_of_intr;/*will be used in remove()*/ |
380 | #endif | 453 | #endif |
381 | #ifdef PM8001_USE_TASKLET | 454 | #ifdef PM8001_USE_TASKLET |
@@ -383,7 +456,10 @@ struct pm8001_hba_info { | |||
383 | #endif | 456 | #endif |
384 | u32 logging_level; | 457 | u32 logging_level; |
385 | u32 fw_status; | 458 | u32 fw_status; |
459 | u32 smp_exp_mode; | ||
460 | u32 int_vector; | ||
386 | const struct firmware *fw_image; | 461 | const struct firmware *fw_image; |
462 | u8 outq[PM8001_MAX_MSIX_VEC]; | ||
387 | }; | 463 | }; |
388 | 464 | ||
389 | struct pm8001_work { | 465 | struct pm8001_work { |
@@ -419,6 +495,9 @@ struct pm8001_fw_image_header { | |||
419 | #define FLASH_UPDATE_DNLD_NOT_SUPPORTED 0x10 | 495 | #define FLASH_UPDATE_DNLD_NOT_SUPPORTED 0x10 |
420 | #define FLASH_UPDATE_DISABLED 0x11 | 496 | #define FLASH_UPDATE_DISABLED 0x11 |
421 | 497 | ||
498 | #define NCQ_READ_LOG_FLAG 0x80000000 | ||
499 | #define NCQ_ABORT_ALL_FLAG 0x40000000 | ||
500 | #define NCQ_2ND_RLE_FLAG 0x20000000 | ||
422 | /** | 501 | /** |
423 | * brief param structure for firmware flash update. | 502 | * brief param structure for firmware flash update. |
424 | */ | 503 | */ |
@@ -484,6 +563,7 @@ int pm8001_dev_found(struct domain_device *dev); | |||
484 | void pm8001_dev_gone(struct domain_device *dev); | 563 | void pm8001_dev_gone(struct domain_device *dev); |
485 | int pm8001_lu_reset(struct domain_device *dev, u8 *lun); | 564 | int pm8001_lu_reset(struct domain_device *dev, u8 *lun); |
486 | int pm8001_I_T_nexus_reset(struct domain_device *dev); | 565 | int pm8001_I_T_nexus_reset(struct domain_device *dev); |
566 | int pm8001_I_T_nexus_event_handler(struct domain_device *dev); | ||
487 | int pm8001_query_task(struct sas_task *task); | 567 | int pm8001_query_task(struct sas_task *task); |
488 | void pm8001_open_reject_retry( | 568 | void pm8001_open_reject_retry( |
489 | struct pm8001_hba_info *pm8001_ha, | 569 | struct pm8001_hba_info *pm8001_ha, |
@@ -493,6 +573,61 @@ int pm8001_mem_alloc(struct pci_dev *pdev, void **virt_addr, | |||
493 | dma_addr_t *pphys_addr, u32 *pphys_addr_hi, u32 *pphys_addr_lo, | 573 | dma_addr_t *pphys_addr, u32 *pphys_addr_hi, u32 *pphys_addr_lo, |
494 | u32 mem_size, u32 align); | 574 | u32 mem_size, u32 align); |
495 | 575 | ||
576 | void pm8001_chip_iounmap(struct pm8001_hba_info *pm8001_ha); | ||
577 | int pm8001_mpi_build_cmd(struct pm8001_hba_info *pm8001_ha, | ||
578 | struct inbound_queue_table *circularQ, | ||
579 | u32 opCode, void *payload, u32 responseQueue); | ||
580 | int pm8001_mpi_msg_free_get(struct inbound_queue_table *circularQ, | ||
581 | u16 messageSize, void **messagePtr); | ||
582 | u32 pm8001_mpi_msg_free_set(struct pm8001_hba_info *pm8001_ha, void *pMsg, | ||
583 | struct outbound_queue_table *circularQ, u8 bc); | ||
584 | u32 pm8001_mpi_msg_consume(struct pm8001_hba_info *pm8001_ha, | ||
585 | struct outbound_queue_table *circularQ, | ||
586 | void **messagePtr1, u8 *pBC); | ||
587 | int pm8001_chip_set_dev_state_req(struct pm8001_hba_info *pm8001_ha, | ||
588 | struct pm8001_device *pm8001_dev, u32 state); | ||
589 | int pm8001_chip_fw_flash_update_req(struct pm8001_hba_info *pm8001_ha, | ||
590 | void *payload); | ||
591 | int pm8001_chip_fw_flash_update_build(struct pm8001_hba_info *pm8001_ha, | ||
592 | void *fw_flash_updata_info, u32 tag); | ||
593 | int pm8001_chip_set_nvmd_req(struct pm8001_hba_info *pm8001_ha, void *payload); | ||
594 | int pm8001_chip_get_nvmd_req(struct pm8001_hba_info *pm8001_ha, void *payload); | ||
595 | int pm8001_chip_ssp_tm_req(struct pm8001_hba_info *pm8001_ha, | ||
596 | struct pm8001_ccb_info *ccb, | ||
597 | struct pm8001_tmf_task *tmf); | ||
598 | int pm8001_chip_abort_task(struct pm8001_hba_info *pm8001_ha, | ||
599 | struct pm8001_device *pm8001_dev, | ||
600 | u8 flag, u32 task_tag, u32 cmd_tag); | ||
601 | int pm8001_chip_dereg_dev_req(struct pm8001_hba_info *pm8001_ha, u32 device_id); | ||
602 | void pm8001_chip_make_sg(struct scatterlist *scatter, int nr, void *prd); | ||
603 | void pm8001_work_fn(struct work_struct *work); | ||
604 | int pm8001_handle_event(struct pm8001_hba_info *pm8001_ha, | ||
605 | void *data, int handler); | ||
606 | void pm8001_mpi_set_dev_state_resp(struct pm8001_hba_info *pm8001_ha, | ||
607 | void *piomb); | ||
608 | void pm8001_mpi_set_nvmd_resp(struct pm8001_hba_info *pm8001_ha, | ||
609 | void *piomb); | ||
610 | void pm8001_mpi_get_nvmd_resp(struct pm8001_hba_info *pm8001_ha, | ||
611 | void *piomb); | ||
612 | int pm8001_mpi_local_phy_ctl(struct pm8001_hba_info *pm8001_ha, | ||
613 | void *piomb); | ||
614 | void pm8001_get_lrate_mode(struct pm8001_phy *phy, u8 link_rate); | ||
615 | void pm8001_get_attached_sas_addr(struct pm8001_phy *phy, u8 *sas_addr); | ||
616 | void pm8001_bytes_dmaed(struct pm8001_hba_info *pm8001_ha, int i); | ||
617 | int pm8001_mpi_reg_resp(struct pm8001_hba_info *pm8001_ha, void *piomb); | ||
618 | int pm8001_mpi_dereg_resp(struct pm8001_hba_info *pm8001_ha, void *piomb); | ||
619 | int pm8001_mpi_fw_flash_update_resp(struct pm8001_hba_info *pm8001_ha, | ||
620 | void *piomb); | ||
621 | int pm8001_mpi_general_event(struct pm8001_hba_info *pm8001_ha , void *piomb); | ||
622 | int pm8001_mpi_task_abort_resp(struct pm8001_hba_info *pm8001_ha, void *piomb); | ||
623 | struct sas_task *pm8001_alloc_task(void); | ||
624 | void pm8001_task_done(struct sas_task *task); | ||
625 | void pm8001_free_task(struct sas_task *task); | ||
626 | void pm8001_tag_free(struct pm8001_hba_info *pm8001_ha, u32 tag); | ||
627 | struct pm8001_device *pm8001_find_dev(struct pm8001_hba_info *pm8001_ha, | ||
628 | u32 device_id); | ||
629 | int pm80xx_set_thermal_config(struct pm8001_hba_info *pm8001_ha); | ||
630 | |||
496 | int pm8001_bar4_shift(struct pm8001_hba_info *pm8001_ha, u32 shiftValue); | 631 | int pm8001_bar4_shift(struct pm8001_hba_info *pm8001_ha, u32 shiftValue); |
497 | 632 | ||
498 | /* ctl shared API */ | 633 | /* ctl shared API */ |