123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095 |
- #ifndef _PMCRAID_H
- #define _PMCRAID_H
- #include <linux/types.h>
- #include <linux/completion.h>
- #include <linux/list.h>
- #include <scsi/scsi.h>
- #include <scsi/scsi_cmnd.h>
- #include <linux/cdev.h>
- #include <net/netlink.h>
- #include <net/genetlink.h>
- #include <linux/connector.h>
- #define PMCRAID_DRIVER_NAME "PMC MaxRAID"
- #define PMCRAID_DEVFILE "pmcsas"
- #define PMCRAID_DRIVER_VERSION "1.0.3"
- #define PMCRAID_FW_VERSION_1 0x002
- #define PMCRAID_MAX_ADAPTERS 1024
- #define PMC_BIT8(n) (1 << (7-n))
- #define PMC_BIT16(n) (1 << (15-n))
- #define PMC_BIT32(n) (1 << (31-n))
- #define PCI_VENDOR_ID_PMC 0x11F8
- #define PCI_DEVICE_ID_PMC_MAXRAID 0x5220
- #define PMCRAID_MAX_CMD 1024
- #define PMCRAID_MAX_IO_CMD 1020
- #define PMCRAID_MAX_HCAM_CMD 2
- #define PMCRAID_MAX_INTERNAL_CMD 2
- #define PMCRAID_IOADLS_INTERNAL 27
- #define PMCRAID_IOADLS_EXTERNAL 37
- #define PMCRAID_MAX_IOADLS PMCRAID_IOADLS_INTERNAL
- #define HRRQ_ENTRY_SIZE sizeof(__le32)
- #define PMCRAID_IOARCB_ALIGNMENT 32
- #define PMCRAID_IOADL_ALIGNMENT 16
- #define PMCRAID_IOASA_ALIGNMENT 4
- #define PMCRAID_NUM_MSIX_VECTORS 16
- #define PMCRAID_VENDOR_ID_LEN 8
- #define PMCRAID_PRODUCT_ID_LEN 16
- #define PMCRAID_SERIAL_NUM_LEN 8
- #define PMCRAID_LUN_LEN 8
- #define PMCRAID_MAX_CDB_LEN 16
- #define PMCRAID_DEVICE_ID_LEN 8
- #define PMCRAID_SENSE_DATA_LEN 256
- #define PMCRAID_ADD_CMD_PARAM_LEN 48
- #define PMCRAID_MAX_BUS_TO_SCAN 1
- #define PMCRAID_MAX_NUM_TARGETS_PER_BUS 256
- #define PMCRAID_MAX_NUM_LUNS_PER_TARGET 8
- #define PMCRAID_IOA_BUS_ID 0xfe
- #define PMCRAID_IOA_TARGET_ID 0xff
- #define PMCRAID_IOA_LUN_ID 0xff
- #define PMCRAID_VSET_BUS_ID 0x1
- #define PMCRAID_VSET_LUN_ID 0x0
- #define PMCRAID_PHYS_BUS_ID 0x0
- #define PMCRAID_VIRTUAL_ENCL_BUS_ID 0x8
- #define PMCRAID_MAX_VSET_TARGETS 0x7F
- #define PMCRAID_MAX_VSET_LUNS_PER_TARGET 8
- #define PMCRAID_IOA_MAX_SECTORS 32767
- #define PMCRAID_VSET_MAX_SECTORS 512
- #define PMCRAID_MAX_CMD_PER_LUN 254
- #define PMCRAID_MAX_RESOURCES 256
- #define PMCRAID_QUERY_RESOURCE_STATE 0xC2
- #define PMCRAID_RESET_DEVICE 0xC3
- #define ENABLE_RESET_MODIFIER 0x80
- #define RESET_DEVICE_LUN 0x40
- #define RESET_DEVICE_TARGET 0x20
- #define RESET_DEVICE_BUS 0x10
- #define PMCRAID_IDENTIFY_HRRQ 0xC4
- #define PMCRAID_QUERY_IOA_CONFIG 0xC5
- #define PMCRAID_QUERY_CMD_STATUS 0xCB
- #define PMCRAID_ABORT_CMD 0xC7
- #define PMCRAID_CANCEL_ALL_REQUESTS 0xCE
- #define PMCRAID_SYNC_COMPLETE_AFTER_CANCEL PMC_BIT8(0)
- #define PMCRAID_HOST_CONTROLLED_ASYNC 0xCF
- #define PMCRAID_HCAM_CODE_CONFIG_CHANGE 0x01
- #define PMCRAID_HCAM_CODE_LOG_DATA 0x02
- #define PMCRAID_IOA_SHUTDOWN 0xF7
- #define PMCRAID_SHUTDOWN_NORMAL 0x00
- #define PMCRAID_SHUTDOWN_PREPARE_FOR_NORMAL 0x40
- #define PMCRAID_SHUTDOWN_NONE 0x100
- #define PMCRAID_SHUTDOWN_ABBREV 0x80
- #define PMCRAID_SET_SUPPORTED_DEVICES 0xFB
- #define ALL_DEVICES_SUPPORTED PMC_BIT8(0)
- #define PMCRAID_WR_BUF_DOWNLOAD_AND_SAVE 0x05
- #define PMCRAID_IOASC_SENSE_MASK 0xFFFFFF00
- #define PMCRAID_IOASC_SENSE_KEY(ioasc) ((ioasc) >> 24)
- #define PMCRAID_IOASC_SENSE_CODE(ioasc) (((ioasc) & 0x00ff0000) >> 16)
- #define PMCRAID_IOASC_SENSE_QUAL(ioasc) (((ioasc) & 0x0000ff00) >> 8)
- #define PMCRAID_IOASC_SENSE_STATUS(ioasc) ((ioasc) & 0x000000ff)
- #define PMCRAID_IOASC_GOOD_COMPLETION 0x00000000
- #define PMCRAID_IOASC_GC_IOARCB_NOTFOUND 0x005A0000
- #define PMCRAID_IOASC_NR_INIT_CMD_REQUIRED 0x02040200
- #define PMCRAID_IOASC_NR_IOA_RESET_REQUIRED 0x02048000
- #define PMCRAID_IOASC_NR_SYNC_REQUIRED 0x023F0000
- #define PMCRAID_IOASC_ME_READ_ERROR_NO_REALLOC 0x03110C00
- #define PMCRAID_IOASC_HW_CANNOT_COMMUNICATE 0x04050000
- #define PMCRAID_IOASC_HW_DEVICE_TIMEOUT 0x04080100
- #define PMCRAID_IOASC_HW_DEVICE_BUS_STATUS_ERROR 0x04448500
- #define PMCRAID_IOASC_HW_IOA_RESET_REQUIRED 0x04448600
- #define PMCRAID_IOASC_IR_INVALID_RESOURCE_HANDLE 0x05250000
- #define PMCRAID_IOASC_AC_TERMINATED_BY_HOST 0x0B5A0000
- #define PMCRAID_IOASC_UA_BUS_WAS_RESET 0x06290000
- #define PMCRAID_IOASC_TIME_STAMP_OUT_OF_SYNC 0x06908B00
- #define PMCRAID_IOASC_UA_BUS_WAS_RESET_BY_OTHER 0x06298000
- #define PMCRAID_IOASC_IOA_WAS_RESET 0x10000001
- #define PMCRAID_IOASC_PCI_ACCESS_ERROR 0x10000002
- #define PMCRAID_PCI_DEASSERT_TIMEOUT 2000
- #define PMCRAID_BIST_TIMEOUT 2000
- #define PMCRAID_AENWAIT_TIMEOUT 5000
- #define PMCRAID_TRANSOP_TIMEOUT 60000
- #define PMCRAID_RESET_TIMEOUT (2 * HZ)
- #define PMCRAID_CHECK_FOR_RESET_TIMEOUT ((HZ / 10))
- #define PMCRAID_VSET_IO_TIMEOUT (60 * HZ)
- #define PMCRAID_INTERNAL_TIMEOUT (60 * HZ)
- #define PMCRAID_SHUTDOWN_TIMEOUT (150 * HZ)
- #define PMCRAID_RESET_BUS_TIMEOUT (60 * HZ)
- #define PMCRAID_RESET_HOST_TIMEOUT (150 * HZ)
- #define PMCRAID_REQUEST_SENSE_TIMEOUT (30 * HZ)
- #define PMCRAID_SET_SUP_DEV_TIMEOUT (2 * 60 * HZ)
- struct pmcraid_ioadl_desc {
- __le64 address;
- __le32 data_len;
- __u8 reserved[3];
- __u8 flags;
- } __attribute__((packed, aligned(PMCRAID_IOADL_ALIGNMENT)));
- #define IOADL_FLAGS_CHAINED PMC_BIT8(0)
- #define IOADL_FLAGS_LAST_DESC PMC_BIT8(1)
- #define IOADL_FLAGS_READ_LAST PMC_BIT8(1)
- #define IOADL_FLAGS_WRITE_LAST PMC_BIT8(1)
- struct pmcraid_ioarcb_add_data {
- union {
- struct pmcraid_ioadl_desc ioadl[PMCRAID_IOADLS_INTERNAL];
- __u8 add_cmd_params[PMCRAID_ADD_CMD_PARAM_LEN];
- } u;
- };
- struct pmcraid_ioarcb {
- __le64 ioarcb_bus_addr;
- __le32 resource_handle;
- __le32 response_handle;
- __le64 ioadl_bus_addr;
- __le32 ioadl_length;
- __le32 data_transfer_length;
- __le64 ioasa_bus_addr;
- __le16 ioasa_len;
- __le16 cmd_timeout;
- __le16 add_cmd_param_offset;
- __le16 add_cmd_param_length;
- __le32 reserved1[2];
- __le32 reserved2;
- __u8 request_type;
- __u8 request_flags0;
- __u8 request_flags1;
- __u8 hrrq_id;
- __u8 cdb[PMCRAID_MAX_CDB_LEN];
- struct pmcraid_ioarcb_add_data add_data;
- } __attribute__((packed, aligned(PMCRAID_IOARCB_ALIGNMENT)));
- #define PMCRAID_IOA_RES_HANDLE 0xffffffff
- #define PMCRAID_INVALID_RES_HANDLE 0
- #define REQ_TYPE_SCSI 0x00
- #define REQ_TYPE_IOACMD 0x01
- #define REQ_TYPE_HCAM 0x02
- #define TRANSFER_DIR_WRITE PMC_BIT8(0)
- #define INHIBIT_UL_CHECK PMC_BIT8(2)
- #define SYNC_OVERRIDE PMC_BIT8(3)
- #define SYNC_COMPLETE PMC_BIT8(4)
- #define NO_LINK_DESCS PMC_BIT8(5)
- #define DELAY_AFTER_RESET PMC_BIT8(0)
- #define TASK_TAG_SIMPLE 0x10
- #define TASK_TAG_ORDERED 0x20
- #define TASK_TAG_QUEUE_HEAD 0x30
- #define HRRQ_TOGGLE_BIT 0x01
- #define HRRQ_RESPONSE_BIT 0x02
- struct pmcraid_ioasa_vset {
- __le32 failing_lba_hi;
- __le32 failing_lba_lo;
- __le32 reserved;
- } __attribute__((packed, aligned(4)));
- struct pmcraid_ioasa {
- __le32 ioasc;
- __le16 returned_status_length;
- __le16 available_status_length;
- __le32 residual_data_length;
- __le32 ilid;
- __le32 fd_ioasc;
- __le32 fd_res_address;
- __le32 fd_res_handle;
- __le32 reserved;
-
- union {
- struct pmcraid_ioasa_vset vset;
- } u;
-
- __le16 auto_sense_length;
- __le16 error_data_length;
- __u8 sense_data[PMCRAID_SENSE_DATA_LEN];
- } __attribute__((packed, aligned(4)));
- #define PMCRAID_DRIVER_ILID 0xffffffff
- struct pmcraid_config_table_entry {
- __u8 resource_type;
- __u8 bus_protocol;
- __le16 array_id;
- __u8 common_flags0;
- __u8 common_flags1;
- __u8 unique_flags0;
- __u8 unique_flags1;
- __le32 resource_handle;
- __le32 resource_address;
- __u8 device_id[PMCRAID_DEVICE_ID_LEN];
- __u8 lun[PMCRAID_LUN_LEN];
- } __attribute__((packed, aligned(4)));
- struct pmcraid_config_table_entry_ext {
- struct pmcraid_config_table_entry cfgte;
- };
- #define RES_TYPE_AF_DASD 0x00
- #define RES_TYPE_GSCSI 0x01
- #define RES_TYPE_VSET 0x02
- #define RES_TYPE_IOA_FP 0xFF
- #define RES_IS_IOA(res) ((res).resource_type == RES_TYPE_IOA_FP)
- #define RES_IS_GSCSI(res) ((res).resource_type == RES_TYPE_GSCSI)
- #define RES_IS_VSET(res) ((res).resource_type == RES_TYPE_VSET)
- #define RES_IS_AFDASD(res) ((res).resource_type == RES_TYPE_AF_DASD)
- #define RES_TYPE_VENCLOSURE 0x8
- #define MULTIPATH_RESOURCE PMC_BIT32(0)
- #define IMPORT_MODE_MANUAL PMC_BIT8(0)
- #define RES_HANDLE_IOA 0xFFFFFFFF
- #define RES_HANDLE_NONE 0x00000000
- #define RES_ADDRESS_IOAFP 0xFEFFFFFF
- #define RES_ADDRESS_INVALID 0xFFFFFFFF
- #define RES_BUS(res_addr) (le32_to_cpu(res_addr) & 0xFF)
- #define RES_TARGET(res_addr) ((le32_to_cpu(res_addr) >> 16) & 0xFF)
- #define RES_LUN(res_addr) 0x0
- struct pmcraid_config_table {
- __le16 num_entries;
- __u8 table_format;
- __u8 reserved1;
- __u8 flags;
- __u8 reserved2[11];
- union {
- struct pmcraid_config_table_entry
- entries[PMCRAID_MAX_RESOURCES];
- struct pmcraid_config_table_entry_ext
- entries_ext[PMCRAID_MAX_RESOURCES];
- };
- } __attribute__((packed, aligned(4)));
- #define MICROCODE_UPDATE_REQUIRED PMC_BIT32(0)
- #define PMCRAID_HOSTRCB_LDNSIZE 4056
- struct pmcraid_hostrcb_error {
- __le32 fd_ioasc;
- __le32 fd_ra;
- __le32 fd_rh;
- __le32 prc;
- union {
- __u8 data[PMCRAID_HOSTRCB_LDNSIZE];
- } u;
- } __attribute__ ((packed, aligned(4)));
- struct pmcraid_hcam_hdr {
- __u8 op_code;
- __u8 notification_type;
- __u8 notification_lost;
- __u8 flags;
- __u8 overlay_id;
- __u8 reserved1[3];
- __le32 ilid;
- __le32 timestamp1;
- __le32 timestamp2;
- __le32 data_len;
- } __attribute__((packed, aligned(4)));
- #define PMCRAID_AEN_GROUP 0x3
- struct pmcraid_hcam_ccn {
- struct pmcraid_hcam_hdr header;
- struct pmcraid_config_table_entry cfg_entry;
- struct pmcraid_config_table_entry cfg_entry_old;
- } __attribute__((packed, aligned(4)));
- #define PMCRAID_CCN_EXT_SIZE 3944
- struct pmcraid_hcam_ccn_ext {
- struct pmcraid_hcam_hdr header;
- struct pmcraid_config_table_entry_ext cfg_entry;
- struct pmcraid_config_table_entry_ext cfg_entry_old;
- __u8 reserved[PMCRAID_CCN_EXT_SIZE];
- } __attribute__((packed, aligned(4)));
- struct pmcraid_hcam_ldn {
- struct pmcraid_hcam_hdr header;
- struct pmcraid_hostrcb_error error_log;
- } __attribute__((packed, aligned(4)));
- #define HOSTRCB_TYPE_CCN 0xE1
- #define HOSTRCB_TYPE_LDN 0xE2
- #define NOTIFICATION_TYPE_ENTRY_CHANGED 0x0
- #define NOTIFICATION_TYPE_ENTRY_NEW 0x1
- #define NOTIFICATION_TYPE_ENTRY_DELETED 0x2
- #define NOTIFICATION_TYPE_STATE_CHANGE 0x3
- #define NOTIFICATION_TYPE_ENTRY_STATECHANGED 0x4
- #define NOTIFICATION_TYPE_ERROR_LOG 0x10
- #define NOTIFICATION_TYPE_INFORMATION_LOG 0x11
- #define HOSTRCB_NOTIFICATIONS_LOST PMC_BIT8(0)
- #define HOSTRCB_INTERNAL_OP_ERROR PMC_BIT8(0)
- #define HOSTRCB_ERROR_RESPONSE_SENT PMC_BIT8(1)
- #define HOSTRCB_OVERLAY_ID_08 0x08
- #define HOSTRCB_OVERLAY_ID_09 0x09
- #define HOSTRCB_OVERLAY_ID_11 0x11
- #define HOSTRCB_OVERLAY_ID_12 0x12
- #define HOSTRCB_OVERLAY_ID_13 0x13
- #define HOSTRCB_OVERLAY_ID_14 0x14
- #define HOSTRCB_OVERLAY_ID_16 0x16
- #define HOSTRCB_OVERLAY_ID_17 0x17
- #define HOSTRCB_OVERLAY_ID_20 0x20
- #define HOSTRCB_OVERLAY_ID_FF 0xFF
- struct pmcraid_chip_details {
-
- unsigned long ioastatus;
- unsigned long ioarrin;
- unsigned long mailbox;
- unsigned long global_intr_mask;
- unsigned long ioa_host_intr;
- unsigned long ioa_host_msix_intr;
- unsigned long ioa_host_intr_clr;
- unsigned long ioa_host_mask;
- unsigned long ioa_host_mask_clr;
- unsigned long host_ioa_intr;
- unsigned long host_ioa_intr_clr;
-
- unsigned long transop_timeout;
- };
- #define INTRS_TRANSITION_TO_OPERATIONAL PMC_BIT32(0)
- #define INTRS_IOARCB_TRANSFER_FAILED PMC_BIT32(3)
- #define INTRS_IOA_UNIT_CHECK PMC_BIT32(4)
- #define INTRS_NO_HRRQ_FOR_CMD_RESPONSE PMC_BIT32(5)
- #define INTRS_CRITICAL_OP_IN_PROGRESS PMC_BIT32(6)
- #define INTRS_IO_DEBUG_ACK PMC_BIT32(7)
- #define INTRS_IOARRIN_LOST PMC_BIT32(27)
- #define INTRS_SYSTEM_BUS_MMIO_ERROR PMC_BIT32(28)
- #define INTRS_IOA_PROCESSOR_ERROR PMC_BIT32(29)
- #define INTRS_HRRQ_VALID PMC_BIT32(30)
- #define INTRS_OPERATIONAL_STATUS PMC_BIT32(0)
- #define INTRS_ALLOW_MSIX_VECTOR0 PMC_BIT32(31)
- #define DOORBELL_RUNTIME_RESET PMC_BIT32(1)
- #define DOORBELL_IOA_RESET_ALERT PMC_BIT32(7)
- #define DOORBELL_IOA_DEBUG_ALERT PMC_BIT32(9)
- #define DOORBELL_ENABLE_DESTRUCTIVE_DIAGS PMC_BIT32(8)
- #define DOORBELL_IOA_START_BIST PMC_BIT32(23)
- #define DOORBELL_INTR_MODE_MSIX PMC_BIT32(25)
- #define DOORBELL_INTR_MSIX_CLR PMC_BIT32(26)
- #define DOORBELL_RESET_IOA PMC_BIT32(31)
- #define GLOBAL_INTERRUPT_MASK 0x5ULL
- #define PMCRAID_ERROR_INTERRUPTS (INTRS_IOARCB_TRANSFER_FAILED | \
- INTRS_IOA_UNIT_CHECK | \
- INTRS_NO_HRRQ_FOR_CMD_RESPONSE | \
- INTRS_IOARRIN_LOST | \
- INTRS_SYSTEM_BUS_MMIO_ERROR | \
- INTRS_IOA_PROCESSOR_ERROR)
- #define PMCRAID_PCI_INTERRUPTS (PMCRAID_ERROR_INTERRUPTS | \
- INTRS_HRRQ_VALID | \
- INTRS_TRANSITION_TO_OPERATIONAL |\
- INTRS_ALLOW_MSIX_VECTOR0)
- struct pmcraid_control_block {
- struct pmcraid_ioarcb ioarcb;
- struct pmcraid_ioadl_desc ioadl[PMCRAID_IOADLS_EXTERNAL + 3];
- struct pmcraid_ioasa ioasa;
- } __attribute__ ((packed, aligned(PMCRAID_IOARCB_ALIGNMENT)));
- struct pmcraid_sglist {
- u32 order;
- u32 num_sg;
- u32 num_dma_sg;
- u32 buffer_len;
- struct scatterlist scatterlist[1];
- };
- struct pmcraid_inquiry_data {
- __u8 ph_dev_type;
- __u8 page_code;
- __u8 reserved1;
- __u8 add_page_len;
- __u8 length;
- __u8 reserved2;
- __le16 fw_version;
- __u8 reserved3[16];
- };
- #define PMCRAID_TIMESTAMP_LEN 12
- #define PMCRAID_REQ_TM_STR_LEN 6
- #define PMCRAID_SCSI_SET_TIMESTAMP 0xA4
- #define PMCRAID_SCSI_SERVICE_ACTION 0x0F
- struct pmcraid_timestamp_data {
- __u8 reserved1[4];
- __u8 timestamp[PMCRAID_REQ_TM_STR_LEN];
- __u8 reserved2[2];
- };
- struct pmcraid_cmd {
-
- struct pmcraid_control_block *ioa_cb;
- dma_addr_t ioa_cb_bus_addr;
- dma_addr_t dma_handle;
-
- struct scsi_cmnd *scsi_cmd;
- struct list_head free_list;
- struct completion wait_for_completion;
- struct timer_list timer;
- u32 timeout;
- u32 index;
- u8 completion_req;
- u8 release;
- void (*cmd_done) (struct pmcraid_cmd *);
- struct pmcraid_instance *drv_inst;
- struct pmcraid_sglist *sglist;
-
- union {
-
- unsigned long time_left;
- struct pmcraid_resource_entry *res;
- int hrrq_index;
-
- struct {
- u8 *sense_buffer;
- dma_addr_t sense_buffer_dma;
- };
- };
- };
- struct pmcraid_interrupts {
- void __iomem *ioa_host_interrupt_reg;
- void __iomem *ioa_host_msix_interrupt_reg;
- void __iomem *ioa_host_interrupt_clr_reg;
- void __iomem *ioa_host_interrupt_mask_reg;
- void __iomem *ioa_host_interrupt_mask_clr_reg;
- void __iomem *global_interrupt_mask_reg;
- void __iomem *host_ioa_interrupt_reg;
- void __iomem *host_ioa_interrupt_clr_reg;
- };
- struct pmcraid_isr_param {
- struct pmcraid_instance *drv_inst;
- u16 vector;
- u8 hrrq_id;
- };
- struct pmcraid_aen_msg {
- u32 hostno;
- u32 length;
- u8 reserved[8];
- u8 data[0];
- };
- struct pmcraid_state_msg {
- struct pmcraid_aen_msg msg;
- u32 ioa_state;
- };
- #define PMC_DEVICE_EVENT_RESET_START 0x11000000
- #define PMC_DEVICE_EVENT_RESET_SUCCESS 0x11000001
- #define PMC_DEVICE_EVENT_RESET_FAILED 0x11000002
- #define PMC_DEVICE_EVENT_SHUTDOWN_START 0x11000003
- #define PMC_DEVICE_EVENT_SHUTDOWN_SUCCESS 0x11000004
- #define PMC_DEVICE_EVENT_SHUTDOWN_FAILED 0x11000005
- struct pmcraid_hostrcb {
- struct pmcraid_instance *drv_inst;
- struct pmcraid_aen_msg *msg;
- struct pmcraid_hcam_hdr *hcam;
- struct pmcraid_cmd *cmd;
- dma_addr_t baddr;
- atomic_t ignore;
- };
- #define PMCRAID_AEN_HDR_SIZE sizeof(struct pmcraid_aen_msg)
- struct pmcraid_instance {
-
- struct pmcraid_resource_entry *res_entries;
- struct list_head free_res_q;
- struct list_head used_res_q;
- spinlock_t resource_lock;
- void __iomem *mapped_dma_addr;
- void __iomem *ioa_status;
- void __iomem *mailbox;
- void __iomem *ioarrin;
- struct pmcraid_interrupts int_regs;
- struct pmcraid_chip_details *chip_cfg;
-
- struct pmcraid_hostrcb ldn;
- struct pmcraid_hostrcb ccn;
- struct pmcraid_state_msg scn;
-
- dma_addr_t hrrq_start_bus_addr[PMCRAID_NUM_MSIX_VECTORS];
-
- __be32 *hrrq_start[PMCRAID_NUM_MSIX_VECTORS];
-
- __be32 *hrrq_end[PMCRAID_NUM_MSIX_VECTORS];
-
- __be32 *hrrq_curr[PMCRAID_NUM_MSIX_VECTORS];
-
- spinlock_t hrrq_lock[PMCRAID_NUM_MSIX_VECTORS];
- struct pmcraid_inquiry_data *inq_data;
- dma_addr_t inq_data_baddr;
- struct pmcraid_timestamp_data *timestamp_data;
- dma_addr_t timestamp_data_baddr;
-
- u32 config_table_entry_size;
-
- u8 host_toggle_bit[PMCRAID_NUM_MSIX_VECTORS];
-
- wait_queue_head_t reset_wait_q;
- struct pmcraid_cmd *reset_cmd;
-
- struct fasync_struct *aen_queue;
- struct mutex aen_queue_lock;
- struct cdev cdev;
- struct Scsi_Host *host;
- struct pci_dev *pdev;
-
- u8 ioa_reset_attempts;
- #define PMCRAID_RESET_ATTEMPTS 3
- u8 current_log_level;
- u8 num_hrrq;
- u8 interrupt_mode;
- dev_t dev;
-
- struct pmcraid_isr_param hrrq_vector[PMCRAID_NUM_MSIX_VECTORS];
-
- atomic_t last_message_id;
-
- struct pmcraid_config_table *cfg_table;
- dma_addr_t cfg_table_bus_addr;
-
- struct kmem_cache *cmd_cachep;
- struct pci_pool *control_pool;
- char cmd_pool_name[64];
- char ctl_pool_name[64];
- struct pmcraid_cmd *cmd_list[PMCRAID_MAX_CMD];
- struct list_head free_cmd_pool;
- struct list_head pending_cmd_pool;
- spinlock_t free_pool_lock;
- spinlock_t pending_pool_lock;
-
- struct tasklet_struct isr_tasklet[PMCRAID_NUM_MSIX_VECTORS];
-
- struct work_struct worker_q;
-
- atomic_t outstanding_cmds;
-
- atomic_t expose_resources;
- u32 ioa_state:4;
- #define IOA_STATE_OPERATIONAL 0x0
- #define IOA_STATE_UNKNOWN 0x1
- #define IOA_STATE_DEAD 0x2
- #define IOA_STATE_IN_SOFT_RESET 0x3
- #define IOA_STATE_IN_HARD_RESET 0x4
- #define IOA_STATE_IN_RESET_ALERT 0x5
- #define IOA_STATE_IN_BRINGDOWN 0x6
- #define IOA_STATE_IN_BRINGUP 0x7
- u32 ioa_reset_in_progress:1;
- u32 ioa_hard_reset:1;
- u32 ioa_unit_check:1;
- u32 ioa_bringdown:1;
- u32 force_ioa_reset:1;
- u32 reinit_cfg_table:1;
- u32 ioa_shutdown_type:2;
- #define SHUTDOWN_NONE 0x0
- #define SHUTDOWN_NORMAL 0x1
- #define SHUTDOWN_ABBREV 0x2
- u32 timestamp_error:1;
- };
- struct pmcraid_resource_entry {
- struct list_head queue;
- union {
- struct pmcraid_config_table_entry cfg_entry;
- struct pmcraid_config_table_entry_ext cfg_entry_ext;
- };
- struct scsi_device *scsi_dev;
- atomic_t read_failures;
- atomic_t write_failures;
-
- u8 change_detected;
- #define RES_CHANGE_ADD 0x1
- #define RES_CHANGE_DEL 0x2
- u8 reset_progress;
-
- u8 sync_reqd;
-
- u8 target;
- };
- struct pmcraid_ioasc_error {
- u32 ioasc_code;
- u8 log_level;
- char *error_string;
- };
- #define IOASC_LOG_LEVEL_NONE 0x0
- #define IOASC_LOG_LEVEL_MUST 0x1
- #define IOASC_LOG_LEVEL_HARD 0x2
- static struct pmcraid_ioasc_error pmcraid_ioasc_error_table[] = {
- {0x01180600, IOASC_LOG_LEVEL_HARD,
- "Recovered Error, soft media error, sector reassignment suggested"},
- {0x015D0000, IOASC_LOG_LEVEL_HARD,
- "Recovered Error, failure prediction threshold exceeded"},
- {0x015D9200, IOASC_LOG_LEVEL_HARD,
- "Recovered Error, soft Cache Card Battery error threshold"},
- {0x015D9200, IOASC_LOG_LEVEL_HARD,
- "Recovered Error, soft Cache Card Battery error threshold"},
- {0x02048000, IOASC_LOG_LEVEL_HARD,
- "Not Ready, IOA Reset Required"},
- {0x02408500, IOASC_LOG_LEVEL_HARD,
- "Not Ready, IOA microcode download required"},
- {0x03110B00, IOASC_LOG_LEVEL_HARD,
- "Medium Error, data unreadable, reassignment suggested"},
- {0x03110C00, IOASC_LOG_LEVEL_MUST,
- "Medium Error, data unreadable do not reassign"},
- {0x03310000, IOASC_LOG_LEVEL_HARD,
- "Medium Error, media corrupted"},
- {0x04050000, IOASC_LOG_LEVEL_HARD,
- "Hardware Error, IOA can't communicate with device"},
- {0x04080000, IOASC_LOG_LEVEL_MUST,
- "Hardware Error, device bus error"},
- {0x04088000, IOASC_LOG_LEVEL_MUST,
- "Hardware Error, device bus is not functioning"},
- {0x04118000, IOASC_LOG_LEVEL_HARD,
- "Hardware Error, IOA reserved area data check"},
- {0x04118100, IOASC_LOG_LEVEL_HARD,
- "Hardware Error, IOA reserved area invalid data pattern"},
- {0x04118200, IOASC_LOG_LEVEL_HARD,
- "Hardware Error, IOA reserved area LRC error"},
- {0x04320000, IOASC_LOG_LEVEL_HARD,
- "Hardware Error, reassignment space exhausted"},
- {0x04330000, IOASC_LOG_LEVEL_HARD,
- "Hardware Error, data transfer underlength error"},
- {0x04330000, IOASC_LOG_LEVEL_HARD,
- "Hardware Error, data transfer overlength error"},
- {0x04418000, IOASC_LOG_LEVEL_MUST,
- "Hardware Error, PCI bus error"},
- {0x04440000, IOASC_LOG_LEVEL_HARD,
- "Hardware Error, device error"},
- {0x04448200, IOASC_LOG_LEVEL_MUST,
- "Hardware Error, IOA error"},
- {0x04448300, IOASC_LOG_LEVEL_HARD,
- "Hardware Error, undefined device response"},
- {0x04448400, IOASC_LOG_LEVEL_HARD,
- "Hardware Error, IOA microcode error"},
- {0x04448600, IOASC_LOG_LEVEL_HARD,
- "Hardware Error, IOA reset required"},
- {0x04449200, IOASC_LOG_LEVEL_HARD,
- "Hardware Error, hard Cache Fearuee Card Battery error"},
- {0x0444A000, IOASC_LOG_LEVEL_HARD,
- "Hardware Error, failed device altered"},
- {0x0444A200, IOASC_LOG_LEVEL_HARD,
- "Hardware Error, data check after reassignment"},
- {0x0444A300, IOASC_LOG_LEVEL_HARD,
- "Hardware Error, LRC error after reassignment"},
- {0x044A0000, IOASC_LOG_LEVEL_HARD,
- "Hardware Error, device bus error (msg/cmd phase)"},
- {0x04670400, IOASC_LOG_LEVEL_HARD,
- "Hardware Error, new device can't be used"},
- {0x04678000, IOASC_LOG_LEVEL_HARD,
- "Hardware Error, invalid multiadapter configuration"},
- {0x04678100, IOASC_LOG_LEVEL_HARD,
- "Hardware Error, incorrect connection between enclosures"},
- {0x04678200, IOASC_LOG_LEVEL_HARD,
- "Hardware Error, connections exceed IOA design limits"},
- {0x04678300, IOASC_LOG_LEVEL_HARD,
- "Hardware Error, incorrect multipath connection"},
- {0x04679000, IOASC_LOG_LEVEL_HARD,
- "Hardware Error, command to LUN failed"},
- {0x064C8000, IOASC_LOG_LEVEL_HARD,
- "Unit Attention, cache exists for missing/failed device"},
- {0x06670100, IOASC_LOG_LEVEL_HARD,
- "Unit Attention, incompatible exposed mode device"},
- {0x06670600, IOASC_LOG_LEVEL_HARD,
- "Unit Attention, attachment of logical unit failed"},
- {0x06678000, IOASC_LOG_LEVEL_HARD,
- "Unit Attention, cables exceed connective design limit"},
- {0x06678300, IOASC_LOG_LEVEL_HARD,
- "Unit Attention, incomplete multipath connection between" \
- "IOA and enclosure"},
- {0x06678400, IOASC_LOG_LEVEL_HARD,
- "Unit Attention, incomplete multipath connection between" \
- "device and enclosure"},
- {0x06678500, IOASC_LOG_LEVEL_HARD,
- "Unit Attention, incomplete multipath connection between" \
- "IOA and remote IOA"},
- {0x06678600, IOASC_LOG_LEVEL_HARD,
- "Unit Attention, missing remote IOA"},
- {0x06679100, IOASC_LOG_LEVEL_HARD,
- "Unit Attention, enclosure doesn't support required multipath" \
- "function"},
- {0x06698200, IOASC_LOG_LEVEL_HARD,
- "Unit Attention, corrupt array parity detected on device"},
- {0x066B0200, IOASC_LOG_LEVEL_HARD,
- "Unit Attention, array exposed"},
- {0x066B8200, IOASC_LOG_LEVEL_HARD,
- "Unit Attention, exposed array is still protected"},
- {0x066B9200, IOASC_LOG_LEVEL_HARD,
- "Unit Attention, Multipath redundancy level got worse"},
- {0x07270000, IOASC_LOG_LEVEL_HARD,
- "Data Protect, device is read/write protected by IOA"},
- {0x07278000, IOASC_LOG_LEVEL_HARD,
- "Data Protect, IOA doesn't support device attribute"},
- {0x07278100, IOASC_LOG_LEVEL_HARD,
- "Data Protect, NVRAM mirroring prohibited"},
- {0x07278400, IOASC_LOG_LEVEL_HARD,
- "Data Protect, array is short 2 or more devices"},
- {0x07278600, IOASC_LOG_LEVEL_HARD,
- "Data Protect, exposed array is short a required device"},
- {0x07278700, IOASC_LOG_LEVEL_HARD,
- "Data Protect, array members not at required addresses"},
- {0x07278800, IOASC_LOG_LEVEL_HARD,
- "Data Protect, exposed mode device resource address conflict"},
- {0x07278900, IOASC_LOG_LEVEL_HARD,
- "Data Protect, incorrect resource address of exposed mode device"},
- {0x07278A00, IOASC_LOG_LEVEL_HARD,
- "Data Protect, Array is missing a device and parity is out of sync"},
- {0x07278B00, IOASC_LOG_LEVEL_HARD,
- "Data Protect, maximum number of arrays already exist"},
- {0x07278C00, IOASC_LOG_LEVEL_HARD,
- "Data Protect, cannot locate cache data for device"},
- {0x07278D00, IOASC_LOG_LEVEL_HARD,
- "Data Protect, cache data exits for a changed device"},
- {0x07279100, IOASC_LOG_LEVEL_HARD,
- "Data Protect, detection of a device requiring format"},
- {0x07279200, IOASC_LOG_LEVEL_HARD,
- "Data Protect, IOA exceeds maximum number of devices"},
- {0x07279600, IOASC_LOG_LEVEL_HARD,
- "Data Protect, missing array, volume set is not functional"},
- {0x07279700, IOASC_LOG_LEVEL_HARD,
- "Data Protect, single device for a volume set"},
- {0x07279800, IOASC_LOG_LEVEL_HARD,
- "Data Protect, missing multiple devices for a volume set"},
- {0x07279900, IOASC_LOG_LEVEL_HARD,
- "Data Protect, maximum number of volument sets already exists"},
- {0x07279A00, IOASC_LOG_LEVEL_HARD,
- "Data Protect, other volume set problem"},
- };
- #define pmcraid_err(...) \
- printk(KERN_ERR "MaxRAID: "__VA_ARGS__)
- #define pmcraid_info(...) \
- if (pmcraid_debug_log) \
- printk(KERN_INFO "MaxRAID: "__VA_ARGS__)
- #define SCSI_READ_CMD 0x1
- #define SCSI_WRITE_CMD 0x2
- #define SCSI_CMD_TYPE(opcode) \
- ({ u8 op = opcode; u8 __type = 0;\
- if (op == READ_6 || op == READ_10 || op == READ_12 || op == READ_16)\
- __type = SCSI_READ_CMD;\
- else if (op == WRITE_6 || op == WRITE_10 || op == WRITE_12 || \
- op == WRITE_16)\
- __type = SCSI_WRITE_CMD;\
- __type;\
- })
- #define IS_SCSI_READ_WRITE(opcode) \
- ({ u8 __type = SCSI_CMD_TYPE(opcode); \
- (__type == SCSI_READ_CMD || __type == SCSI_WRITE_CMD) ? 1 : 0;\
- })
- struct pmcraid_ioctl_header {
- u8 signature[8];
- u32 reserved;
- u32 buffer_length;
- };
- #define PMCRAID_IOCTL_SIGNATURE "PMCRAID"
- struct pmcraid_passthrough_ioctl_buffer {
- struct pmcraid_ioctl_header ioctl_header;
- struct pmcraid_ioarcb ioarcb;
- struct pmcraid_ioasa ioasa;
- u8 request_buffer[1];
- } __attribute__ ((packed));
- #define PMCRAID_DRIVER_IOCTL 'D'
- #define PMCRAID_PASSTHROUGH_IOCTL 'F'
- #define DRV_IOCTL(n, size) \
- _IOC(_IOC_READ|_IOC_WRITE, PMCRAID_DRIVER_IOCTL, (n), (size))
- #define FMW_IOCTL(n, size) \
- _IOC(_IOC_READ|_IOC_WRITE, PMCRAID_PASSTHROUGH_IOCTL, (n), (size))
- #define _ARGSIZE(arg) (sizeof(struct pmcraid_ioctl_header) + sizeof(arg))
- #define PMCRAID_IOCTL_RESET_ADAPTER \
- DRV_IOCTL(5, sizeof(struct pmcraid_ioctl_header))
- #define PMCRAID_IOCTL_PASSTHROUGH_COMMAND \
- FMW_IOCTL(1, sizeof(struct pmcraid_passthrough_ioctl_buffer))
- #define PMCRAID_IOCTL_DOWNLOAD_MICROCODE \
- FMW_IOCTL(2, sizeof(struct pmcraid_passthrough_ioctl_buffer))
- #endif
|