| .. | .. |
|---|
| 58 | 58 | #include "pm8001_defs.h" |
|---|
| 59 | 59 | |
|---|
| 60 | 60 | #define DRV_NAME "pm80xx" |
|---|
| 61 | | -#define DRV_VERSION "0.1.38" |
|---|
| 61 | +#define DRV_VERSION "0.1.40" |
|---|
| 62 | 62 | #define PM8001_FAIL_LOGGING 0x01 /* Error message logging */ |
|---|
| 63 | 63 | #define PM8001_INIT_LOGGING 0x02 /* driver init logging */ |
|---|
| 64 | 64 | #define PM8001_DISC_LOGGING 0x04 /* discovery layer logging */ |
|---|
| .. | .. |
|---|
| 66 | 66 | #define PM8001_EH_LOGGING 0x10 /* libsas EH function logging*/ |
|---|
| 67 | 67 | #define PM8001_IOCTL_LOGGING 0x20 /* IOCTL message logging */ |
|---|
| 68 | 68 | #define PM8001_MSG_LOGGING 0x40 /* misc message logging */ |
|---|
| 69 | | -#define pm8001_printk(format, arg...) printk(KERN_INFO "pm80xx %s %d:" \ |
|---|
| 70 | | - format, __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); |
|---|
| 69 | +#define PM8001_DEV_LOGGING 0x80 /* development message logging */ |
|---|
| 70 | +#define PM8001_DEVIO_LOGGING 0x100 /* development io message logging */ |
|---|
| 71 | +#define PM8001_IOERR_LOGGING 0x200 /* development io err message logging */ |
|---|
| 78 | 72 | |
|---|
| 79 | | -#define PM8001_EH_DBG(HBA, CMD) \ |
|---|
| 80 | | - PM8001_CHECK_LOGGING(HBA, PM8001_EH_LOGGING, CMD) |
|---|
| 73 | +#define pm8001_printk(fmt, ...) \ |
|---|
| 74 | + pr_info("%s:: %s %d:" fmt, \ |
|---|
| 75 | + pm8001_ha->name, __func__, __LINE__, ##__VA_ARGS__) |
|---|
| 81 | 76 | |
|---|
| 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 | | - |
|---|
| 77 | +#define pm8001_dbg(HBA, level, fmt, ...) \ |
|---|
| 78 | +do { \ |
|---|
| 79 | + if (unlikely((HBA)->logging_level & PM8001_##level##_LOGGING)) \ |
|---|
| 80 | + pm8001_printk(fmt, ##__VA_ARGS__); \ |
|---|
| 81 | +} while (0) |
|---|
| 100 | 82 | |
|---|
| 101 | 83 | #define PM8001_USE_TASKLET |
|---|
| 102 | 84 | #define PM8001_USE_MSIX |
|---|
| 103 | 85 | #define PM8001_READ_VPD |
|---|
| 104 | 86 | |
|---|
| 105 | 87 | |
|---|
| 106 | | -#define DEV_IS_EXPANDER(type) ((type == SAS_EDGE_EXPANDER_DEVICE) || (type == SAS_FANOUT_EXPANDER_DEVICE)) |
|---|
| 107 | 88 | #define IS_SPCV_12G(dev) ((dev->device == 0X8074) \ |
|---|
| 108 | 89 | || (dev->device == 0X8076) \ |
|---|
| 109 | 90 | || (dev->device == 0X8077) \ |
|---|
| .. | .. |
|---|
| 127 | 108 | u32 signature; |
|---|
| 128 | 109 | u16 major_function; |
|---|
| 129 | 110 | u16 minor_function; |
|---|
| 130 | | - u16 length; |
|---|
| 131 | 111 | u16 status; |
|---|
| 132 | 112 | u16 offset; |
|---|
| 133 | 113 | u16 id; |
|---|
| 114 | + u32 wr_length; |
|---|
| 115 | + u32 rd_length; |
|---|
| 134 | 116 | u8 *func_specific; |
|---|
| 135 | 117 | }; |
|---|
| 136 | 118 | |
|---|
| .. | .. |
|---|
| 142 | 124 | #define MPI_FATAL_EDUMP_TABLE_HANDSHAKE 0x0C /* FDDHSHK */ |
|---|
| 143 | 125 | #define MPI_FATAL_EDUMP_TABLE_STATUS 0x10 /* FDDTSTAT */ |
|---|
| 144 | 126 | #define MPI_FATAL_EDUMP_TABLE_ACCUM_LEN 0x14 /* ACCDDLEN */ |
|---|
| 127 | +#define MPI_FATAL_EDUMP_TABLE_TOTAL_LEN 0x18 /* TOTALLEN */ |
|---|
| 128 | +#define MPI_FATAL_EDUMP_TABLE_SIGNATURE 0x1C /* SIGNITURE */ |
|---|
| 145 | 129 | #define MPI_FATAL_EDUMP_HANDSHAKE_RDY 0x1 |
|---|
| 146 | 130 | #define MPI_FATAL_EDUMP_HANDSHAKE_BUSY 0x0 |
|---|
| 147 | 131 | #define MPI_FATAL_EDUMP_TABLE_STAT_RSVD 0x0 |
|---|
| .. | .. |
|---|
| 197 | 181 | int (*chip_ioremap)(struct pm8001_hba_info *pm8001_ha); |
|---|
| 198 | 182 | void (*chip_iounmap)(struct pm8001_hba_info *pm8001_ha); |
|---|
| 199 | 183 | irqreturn_t (*isr)(struct pm8001_hba_info *pm8001_ha, u8 vec); |
|---|
| 200 | | - u32 (*is_our_interupt)(struct pm8001_hba_info *pm8001_ha); |
|---|
| 184 | + u32 (*is_our_interrupt)(struct pm8001_hba_info *pm8001_ha); |
|---|
| 201 | 185 | int (*isr_process_oq)(struct pm8001_hba_info *pm8001_ha, u8 vec); |
|---|
| 202 | 186 | void (*interrupt_enable)(struct pm8001_hba_info *pm8001_ha, u8 vec); |
|---|
| 203 | 187 | void (*interrupt_disable)(struct pm8001_hba_info *pm8001_ha, u8 vec); |
|---|
| .. | .. |
|---|
| 280 | 264 | struct completion *dcompletion; |
|---|
| 281 | 265 | struct completion *setds_completion; |
|---|
| 282 | 266 | u32 device_id; |
|---|
| 283 | | - u32 running_req; |
|---|
| 267 | + atomic_t running_req; |
|---|
| 284 | 268 | }; |
|---|
| 285 | 269 | |
|---|
| 286 | 270 | struct pm8001_prd_imt { |
|---|
| .. | .. |
|---|
| 302 | 286 | u32 ccb_tag; |
|---|
| 303 | 287 | dma_addr_t ccb_dma_handle; |
|---|
| 304 | 288 | struct pm8001_device *device; |
|---|
| 305 | | - struct pm8001_prd buf_prd[PM8001_MAX_DMA_SG]; |
|---|
| 289 | + struct pm8001_prd *buf_prd; |
|---|
| 306 | 290 | struct fw_control_ex *fw_control_context; |
|---|
| 307 | 291 | u8 open_retry; |
|---|
| 308 | 292 | }; |
|---|
| .. | .. |
|---|
| 455 | 439 | u32 reserved; |
|---|
| 456 | 440 | __le32 consumer_index; |
|---|
| 457 | 441 | u32 producer_idx; |
|---|
| 442 | + spinlock_t iq_lock; |
|---|
| 458 | 443 | }; |
|---|
| 459 | 444 | struct outbound_queue_table { |
|---|
| 460 | 445 | u32 element_size_cnt; |
|---|
| .. | .. |
|---|
| 497 | 482 | u32 forensic_last_offset; |
|---|
| 498 | 483 | u32 fatal_forensic_shift_offset; |
|---|
| 499 | 484 | u32 forensic_fatal_step; |
|---|
| 485 | + u32 forensic_preserved_accumulated_transfer; |
|---|
| 500 | 486 | u32 evtlog_ib_offset; |
|---|
| 501 | 487 | u32 evtlog_ob_offset; |
|---|
| 502 | 488 | void __iomem *msg_unit_tbl_addr;/*Message Unit Table Addr*/ |
|---|
| .. | .. |
|---|
| 510 | 496 | void __iomem *fatal_tbl_addr; /*MPI IVT Table Addr */ |
|---|
| 511 | 497 | union main_cfg_table main_cfg_tbl; |
|---|
| 512 | 498 | union general_status_table gs_tbl; |
|---|
| 513 | | - struct inbound_queue_table inbnd_q_tbl[PM8001_MAX_SPCV_INB_NUM]; |
|---|
| 514 | | - struct outbound_queue_table outbnd_q_tbl[PM8001_MAX_SPCV_OUTB_NUM]; |
|---|
| 499 | + struct inbound_queue_table inbnd_q_tbl[PM8001_MAX_INB_NUM]; |
|---|
| 500 | + struct outbound_queue_table outbnd_q_tbl[PM8001_MAX_OUTB_NUM]; |
|---|
| 515 | 501 | struct sas_phy_attribute_table phy_attr_table; |
|---|
| 516 | 502 | /* MPI SAS PHY attributes */ |
|---|
| 517 | 503 | u8 sas_addr[SAS_ADDR_SIZE]; |
|---|
| .. | .. |
|---|
| 531 | 517 | struct pm8001_ccb_info *ccb_info; |
|---|
| 532 | 518 | #ifdef PM8001_USE_MSIX |
|---|
| 533 | 519 | int number_of_intr;/*will be used in remove()*/ |
|---|
| 520 | + char intr_drvname[PM8001_MAX_MSIX_VEC] |
|---|
| 521 | + [PM8001_NAME_LENGTH+1+3+1]; |
|---|
| 534 | 522 | #endif |
|---|
| 535 | 523 | #ifdef PM8001_USE_TASKLET |
|---|
| 536 | 524 | struct tasklet_struct tasklet[PM8001_MAX_MSIX_VEC]; |
|---|
| 537 | 525 | #endif |
|---|
| 538 | 526 | u32 logging_level; |
|---|
| 527 | + u32 link_rate; |
|---|
| 539 | 528 | u32 fw_status; |
|---|
| 540 | 529 | u32 smp_exp_mode; |
|---|
| 541 | 530 | bool controller_fatal_error; |
|---|
| 542 | 531 | const struct firmware *fw_image; |
|---|
| 543 | 532 | struct isr_param irq_vector[PM8001_MAX_MSIX_VEC]; |
|---|
| 544 | 533 | u32 reset_in_progress; |
|---|
| 534 | + u32 non_fatal_count; |
|---|
| 535 | + u32 non_fatal_read_length; |
|---|
| 536 | + u32 max_q_num; |
|---|
| 537 | + u32 ib_offset; |
|---|
| 538 | + u32 ob_offset; |
|---|
| 539 | + u32 ci_offset; |
|---|
| 540 | + u32 pi_offset; |
|---|
| 541 | + u32 max_memcnt; |
|---|
| 545 | 542 | }; |
|---|
| 546 | 543 | |
|---|
| 547 | 544 | struct pm8001_work { |
|---|
| .. | .. |
|---|
| 664 | 661 | void pm8001_chip_iounmap(struct pm8001_hba_info *pm8001_ha); |
|---|
| 665 | 662 | int pm8001_mpi_build_cmd(struct pm8001_hba_info *pm8001_ha, |
|---|
| 666 | 663 | struct inbound_queue_table *circularQ, |
|---|
| 667 | | - u32 opCode, void *payload, u32 responseQueue); |
|---|
| 664 | + u32 opCode, void *payload, size_t nb, |
|---|
| 665 | + u32 responseQueue); |
|---|
| 668 | 666 | int pm8001_mpi_msg_free_get(struct inbound_queue_table *circularQ, |
|---|
| 669 | 667 | u16 messageSize, void **messagePtr); |
|---|
| 670 | 668 | u32 pm8001_mpi_msg_free_set(struct pm8001_hba_info *pm8001_ha, void *pMsg, |
|---|
| .. | .. |
|---|
| 724 | 722 | int pm80xx_bar4_shift(struct pm8001_hba_info *pm8001_ha, u32 shiftValue); |
|---|
| 725 | 723 | ssize_t pm80xx_get_fatal_dump(struct device *cdev, |
|---|
| 726 | 724 | struct device_attribute *attr, char *buf); |
|---|
| 725 | +ssize_t pm80xx_get_non_fatal_dump(struct device *cdev, |
|---|
| 726 | + struct device_attribute *attr, char *buf); |
|---|
| 727 | 727 | ssize_t pm8001_get_gsm_dump(struct device *cdev, u32, char *buf); |
|---|
| 728 | 728 | /* ctl shared API */ |
|---|
| 729 | 729 | extern struct device_attribute *pm8001_host_attrs[]; |
|---|