#ifndef _PM8001_SAS_H_
#define _PM8001_SAS_H_
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/spinlock.h>
#include <linux/delay.h>
#include <linux/types.h>
#include <linux/ctype.h>
#include <linux/dma-mapping.h>
#include <linux/pci.h>
#include <linux/interrupt.h>
#include <linux/workqueue.h>
#include <scsi/libsas.h>
#include <scsi/scsi_tcq.h>
#include <scsi/sas_ata.h>
#include <linux/atomic.h>
#include <linux/blk-mq.h>
#include <linux/blk-mq-pci.h>
#include "pm8001_defs.h"
#define DRV_NAME …
#define DRV_VERSION …
#define PM8001_FAIL_LOGGING …
#define PM8001_INIT_LOGGING …
#define PM8001_DISC_LOGGING …
#define PM8001_IO_LOGGING …
#define PM8001_EH_LOGGING …
#define PM8001_IOCTL_LOGGING …
#define PM8001_MSG_LOGGING …
#define PM8001_DEV_LOGGING …
#define PM8001_DEVIO_LOGGING …
#define PM8001_IOERR_LOGGING …
#define PM8001_EVENT_LOGGING …
#define pm8001_info(HBA, fmt, ...) …
#define pm8001_dbg(HBA, level, fmt, ...) …
extern bool pm8001_use_msix;
#define IS_SPCV_12G(dev) …
#define PM8001_NAME_LENGTH …
extern struct list_head hba_list;
extern const struct pm8001_dispatch pm8001_8001_dispatch;
extern const struct pm8001_dispatch pm8001_80xx_dispatch;
struct pm8001_hba_info;
struct pm8001_ccb_info;
struct pm8001_device;
struct pm8001_ioctl_payload { … };
#define MPI_FATAL_ERROR_TABLE_OFFSET_MASK …
#define MPI_FATAL_ERROR_TABLE_SIZE(value) …
#define MPI_FATAL_EDUMP_TABLE_LO_OFFSET …
#define MPI_FATAL_EDUMP_TABLE_HI_OFFSET …
#define MPI_FATAL_EDUMP_TABLE_LENGTH …
#define MPI_FATAL_EDUMP_TABLE_HANDSHAKE …
#define MPI_FATAL_EDUMP_TABLE_STATUS …
#define MPI_FATAL_EDUMP_TABLE_ACCUM_LEN …
#define MPI_FATAL_EDUMP_TABLE_TOTAL_LEN …
#define MPI_FATAL_EDUMP_TABLE_SIGNATURE …
#define MPI_FATAL_EDUMP_HANDSHAKE_RDY …
#define MPI_FATAL_EDUMP_HANDSHAKE_BUSY …
#define MPI_FATAL_EDUMP_TABLE_STAT_RSVD …
#define MPI_FATAL_EDUMP_TABLE_STAT_DMA_FAILED …
#define MPI_FATAL_EDUMP_TABLE_STAT_NF_SUCCESS_MORE_DATA …
#define MPI_FATAL_EDUMP_TABLE_STAT_NF_SUCCESS_DONE …
#define TYPE_GSM_SPACE …
#define TYPE_QUEUE …
#define TYPE_FATAL …
#define TYPE_NON_FATAL …
#define TYPE_INBOUND …
#define TYPE_OUTBOUND …
struct forensic_data { … };
#define SCRATCH_PAD0_BAR_MASK …
#define SCRATCH_PAD0_OFFSET_MASK …
#define SCRATCH_PAD0_AAPERR_MASK …
#define SPCv_MSGU_CFG_TABLE_NONFATAL_DUMP …
#define SPCV_MSGU_CFG_TABLE_TRANSFER_DEBUG_INFO …
#define MAIN_MERRDCTO_MERRDCES …
struct pm8001_dispatch { … };
struct pm8001_chip_info { … };
#define PM8001_CHIP_DISP …
struct pm8001_port { … };
struct pm8001_phy { … };
#define PORT_RESET_SUCCESS …
#define PORT_RESET_TMO …
struct pm8001_device { … };
struct pm8001_prd_imt { … };
struct pm8001_prd { … } __attribute__ ((packed));
struct pm8001_ccb_info { … };
struct mpi_mem { … };
struct mpi_mem_req { … };
struct encrypt { … };
struct sas_phy_attribute_table { … };
main_cfg_table;
general_status_table;
struct inbound_queue_table { … };
struct outbound_queue_table { … };
struct pm8001_hba_memspace { … };
struct isr_param { … };
struct pm8001_hba_info { … };
struct pm8001_work { … };
struct pm8001_fw_image_header { … } __attribute__((packed, aligned …));
#define FLASH_UPDATE_COMPLETE_PENDING_REBOOT …
#define FLASH_UPDATE_IN_PROGRESS …
#define FLASH_UPDATE_HDR_ERR …
#define FLASH_UPDATE_OFFSET_ERR …
#define FLASH_UPDATE_CRC_ERR …
#define FLASH_UPDATE_LENGTH_ERR …
#define FLASH_UPDATE_HW_ERR …
#define FLASH_UPDATE_DNLD_NOT_SUPPORTED …
#define FLASH_UPDATE_DISABLED …
#define DS_OPERATIONAL …
#define DS_PORT_IN_RESET …
#define DS_IN_RECOVERY …
#define DS_IN_ERROR …
#define DS_NON_OPERATIONAL …
struct fw_flash_updata_info { … };
struct fw_control_info { … };
struct fw_control_ex { … };
extern struct workqueue_struct *pm8001_wq;
int pm8001_tag_alloc(struct pm8001_hba_info *pm8001_ha, u32 *tag_out);
u32 pm8001_get_ncq_tag(struct sas_task *task, u32 *tag);
void pm8001_ccb_task_free(struct pm8001_hba_info *pm8001_ha,
struct pm8001_ccb_info *ccb);
int pm8001_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func,
void *funcdata);
void pm8001_scan_start(struct Scsi_Host *shost);
int pm8001_scan_finished(struct Scsi_Host *shost, unsigned long time);
int pm8001_queue_command(struct sas_task *task, gfp_t gfp_flags);
int pm8001_abort_task(struct sas_task *task);
int pm8001_clear_task_set(struct domain_device *dev, u8 *lun);
int pm8001_dev_found(struct domain_device *dev);
void pm8001_dev_gone(struct domain_device *dev);
int pm8001_lu_reset(struct domain_device *dev, u8 *lun);
int pm8001_I_T_nexus_reset(struct domain_device *dev);
int pm8001_I_T_nexus_event_handler(struct domain_device *dev);
int pm8001_query_task(struct sas_task *task);
void pm8001_port_formed(struct asd_sas_phy *sas_phy);
void pm8001_open_reject_retry(
struct pm8001_hba_info *pm8001_ha,
struct sas_task *task_to_close,
struct pm8001_device *device_to_close);
int pm8001_mem_alloc(struct pci_dev *pdev, void **virt_addr,
dma_addr_t *pphys_addr, u32 *pphys_addr_hi, u32 *pphys_addr_lo,
u32 mem_size, u32 align);
void pm8001_chip_iounmap(struct pm8001_hba_info *pm8001_ha);
int pm8001_mpi_build_cmd(struct pm8001_hba_info *pm8001_ha,
u32 q_index, u32 opCode, void *payload, size_t nb,
u32 responseQueue);
int pm8001_mpi_msg_free_get(struct inbound_queue_table *circularQ,
u16 messageSize, void **messagePtr);
u32 pm8001_mpi_msg_free_set(struct pm8001_hba_info *pm8001_ha, void *pMsg,
struct outbound_queue_table *circularQ, u8 bc);
u32 pm8001_mpi_msg_consume(struct pm8001_hba_info *pm8001_ha,
struct outbound_queue_table *circularQ,
void **messagePtr1, u8 *pBC);
int pm8001_chip_set_dev_state_req(struct pm8001_hba_info *pm8001_ha,
struct pm8001_device *pm8001_dev, u32 state);
int pm8001_chip_fw_flash_update_req(struct pm8001_hba_info *pm8001_ha,
void *payload);
int pm8001_chip_fw_flash_update_build(struct pm8001_hba_info *pm8001_ha,
void *fw_flash_updata_info, u32 tag);
int pm8001_chip_set_nvmd_req(struct pm8001_hba_info *pm8001_ha, void *payload);
int pm8001_chip_get_nvmd_req(struct pm8001_hba_info *pm8001_ha, void *payload);
int pm8001_chip_ssp_tm_req(struct pm8001_hba_info *pm8001_ha,
struct pm8001_ccb_info *ccb,
struct sas_tmf_task *tmf);
int pm8001_chip_abort_task(struct pm8001_hba_info *pm8001_ha,
struct pm8001_ccb_info *ccb);
int pm8001_chip_dereg_dev_req(struct pm8001_hba_info *pm8001_ha, u32 device_id);
void pm8001_chip_make_sg(struct scatterlist *scatter, int nr, void *prd);
void pm8001_work_fn(struct work_struct *work);
int pm8001_handle_event(struct pm8001_hba_info *pm8001_ha,
void *data, int handler);
void pm8001_mpi_set_dev_state_resp(struct pm8001_hba_info *pm8001_ha,
void *piomb);
void pm8001_mpi_set_nvmd_resp(struct pm8001_hba_info *pm8001_ha,
void *piomb);
void pm8001_mpi_get_nvmd_resp(struct pm8001_hba_info *pm8001_ha,
void *piomb);
int pm8001_mpi_local_phy_ctl(struct pm8001_hba_info *pm8001_ha,
void *piomb);
void pm8001_get_lrate_mode(struct pm8001_phy *phy, u8 link_rate);
void pm8001_get_attached_sas_addr(struct pm8001_phy *phy, u8 *sas_addr);
void pm8001_bytes_dmaed(struct pm8001_hba_info *pm8001_ha, int i);
int pm8001_mpi_reg_resp(struct pm8001_hba_info *pm8001_ha, void *piomb);
int pm8001_mpi_dereg_resp(struct pm8001_hba_info *pm8001_ha, void *piomb);
int pm8001_mpi_fw_flash_update_resp(struct pm8001_hba_info *pm8001_ha,
void *piomb);
int pm8001_mpi_general_event(struct pm8001_hba_info *pm8001_ha, void *piomb);
int pm8001_mpi_task_abort_resp(struct pm8001_hba_info *pm8001_ha, void *piomb);
void pm8001_tag_free(struct pm8001_hba_info *pm8001_ha, u32 tag);
struct pm8001_device *pm8001_find_dev(struct pm8001_hba_info *pm8001_ha,
u32 device_id);
int pm80xx_set_thermal_config(struct pm8001_hba_info *pm8001_ha);
int pm8001_bar4_shift(struct pm8001_hba_info *pm8001_ha, u32 shiftValue);
void pm8001_set_phy_profile(struct pm8001_hba_info *pm8001_ha,
u32 length, u8 *buf);
void pm8001_set_phy_profile_single(struct pm8001_hba_info *pm8001_ha,
u32 phy, u32 length, u32 *buf);
int pm80xx_bar4_shift(struct pm8001_hba_info *pm8001_ha, u32 shiftValue);
ssize_t pm80xx_get_fatal_dump(struct device *cdev,
struct device_attribute *attr, char *buf);
ssize_t pm80xx_get_non_fatal_dump(struct device *cdev,
struct device_attribute *attr, char *buf);
ssize_t pm8001_get_gsm_dump(struct device *cdev, u32, char *buf);
int pm80xx_fatal_errors(struct pm8001_hba_info *pm8001_ha);
void pm8001_free_dev(struct pm8001_device *pm8001_dev);
extern const struct attribute_group *pm8001_host_groups[];
extern const struct attribute_group *pm8001_sdev_groups[];
#define PM8001_INVALID_TAG …
static inline struct pm8001_ccb_info *
pm8001_ccb_alloc(struct pm8001_hba_info *pm8001_ha,
struct pm8001_device *dev, struct sas_task *task)
{ … }
static inline void pm8001_ccb_free(struct pm8001_hba_info *pm8001_ha,
struct pm8001_ccb_info *ccb)
{ … }
static inline void pm8001_ccb_task_free_done(struct pm8001_hba_info *pm8001_ha,
struct pm8001_ccb_info *ccb)
{ … }
void pm8001_setds_completion(struct domain_device *dev);
void pm8001_tmf_aborted(struct sas_task *task);
#endif