aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/pmcraid.h
diff options
context:
space:
mode:
authorAnil Ravindranath <anil_ravindranath@pmc-sierra.com>2010-06-08 13:56:34 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-07-27 13:01:35 -0400
commitc20c426732a5a5d21e99b36286f79c2024115341 (patch)
treea4fd06a0caba3fca41b8f65e7c50582bfa1f64a7 /drivers/scsi/pmcraid.h
parent18cacc34887df274feb3f1ff420d7592e4ea246f (diff)
[SCSI] pmcraid: MSI-X support and other changes
1. MSI-X interrupt support 2. Driver changes to support new maxRAID controller FW version. The changes are mainly done to handle async notification changes done in newer controller FW version. 3. Added state change notifications to notify applications of controller states. Signed-off-by: Anil Ravindranath <anil_ravindranath@pmc-sierra.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/pmcraid.h')
-rw-r--r--drivers/scsi/pmcraid.h305
1 files changed, 179 insertions, 126 deletions
diff --git a/drivers/scsi/pmcraid.h b/drivers/scsi/pmcraid.h
index b8ad07c3449e..6cfa0145a1d7 100644
--- a/drivers/scsi/pmcraid.h
+++ b/drivers/scsi/pmcraid.h
@@ -40,10 +40,12 @@
40 * Driver version: version string in major_version.minor_version.patch format 40 * Driver version: version string in major_version.minor_version.patch format
41 * Driver date : date information in "Mon dd yyyy" format 41 * Driver date : date information in "Mon dd yyyy" format
42 */ 42 */
43#define PMCRAID_DRIVER_NAME "PMC MaxRAID" 43#define PMCRAID_DRIVER_NAME "PMC MaxRAID"
44#define PMCRAID_DEVFILE "pmcsas" 44#define PMCRAID_DEVFILE "pmcsas"
45#define PMCRAID_DRIVER_VERSION "1.0.2" 45#define PMCRAID_DRIVER_VERSION "2.0.2"
46#define PMCRAID_DRIVER_DATE __DATE__ 46#define PMCRAID_DRIVER_DATE __DATE__
47
48#define PMCRAID_FW_VERSION_1 0x002
47 49
48/* Maximum number of adapters supported by current version of the driver */ 50/* Maximum number of adapters supported by current version of the driver */
49#define PMCRAID_MAX_ADAPTERS 1024 51#define PMCRAID_MAX_ADAPTERS 1024
@@ -85,17 +87,17 @@
85#define PMCRAID_IOARCB_ALIGNMENT 32 87#define PMCRAID_IOARCB_ALIGNMENT 32
86#define PMCRAID_IOADL_ALIGNMENT 16 88#define PMCRAID_IOADL_ALIGNMENT 16
87#define PMCRAID_IOASA_ALIGNMENT 4 89#define PMCRAID_IOASA_ALIGNMENT 4
88#define PMCRAID_NUM_MSIX_VECTORS 1 90#define PMCRAID_NUM_MSIX_VECTORS 16
89 91
90/* various other limits */ 92/* various other limits */
91#define PMCRAID_VENDOR_ID_LEN 8 93#define PMCRAID_VENDOR_ID_LEN 8
92#define PMCRAID_PRODUCT_ID_LEN 16 94#define PMCRAID_PRODUCT_ID_LEN 16
93#define PMCRAID_SERIAL_NUM_LEN 8 95#define PMCRAID_SERIAL_NUM_LEN 8
94#define PMCRAID_LUN_LEN 8 96#define PMCRAID_LUN_LEN 8
95#define PMCRAID_MAX_CDB_LEN 16 97#define PMCRAID_MAX_CDB_LEN 16
96#define PMCRAID_DEVICE_ID_LEN 8 98#define PMCRAID_DEVICE_ID_LEN 8
97#define PMCRAID_SENSE_DATA_LEN 256 99#define PMCRAID_SENSE_DATA_LEN 256
98#define PMCRAID_ADD_CMD_PARAM_LEN 48 100#define PMCRAID_ADD_CMD_PARAM_LEN 48
99 101
100#define PMCRAID_MAX_BUS_TO_SCAN 1 102#define PMCRAID_MAX_BUS_TO_SCAN 1
101#define PMCRAID_MAX_NUM_TARGETS_PER_BUS 256 103#define PMCRAID_MAX_NUM_TARGETS_PER_BUS 256
@@ -116,17 +118,10 @@
116#define PMCRAID_VSET_MAX_SECTORS 512 118#define PMCRAID_VSET_MAX_SECTORS 512
117#define PMCRAID_MAX_CMD_PER_LUN 254 119#define PMCRAID_MAX_CMD_PER_LUN 254
118 120
119/* Number of configuration table entries (resources) */ 121/* Number of configuration table entries (resources), includes 1 FP,
120#define PMCRAID_MAX_NUM_OF_VSETS 240 122 * 1 Enclosure device
121 123 */
122/* Todo : Check max limit for Phase 1 */ 124#define PMCRAID_MAX_RESOURCES 256
123#define PMCRAID_MAX_NUM_OF_PHY_DEVS 256
124
125/* MAX_NUM_OF_DEVS includes 1 FP, 1 Dummy Enclosure device */
126#define PMCRAID_MAX_NUM_OF_DEVS \
127 (PMCRAID_MAX_NUM_OF_VSETS + PMCRAID_MAX_NUM_OF_PHY_DEVS + 2)
128
129#define PMCRAID_MAX_RESOURCES PMCRAID_MAX_NUM_OF_DEVS
130 125
131/* Adapter Commands used by driver */ 126/* Adapter Commands used by driver */
132#define PMCRAID_QUERY_RESOURCE_STATE 0xC2 127#define PMCRAID_QUERY_RESOURCE_STATE 0xC2
@@ -177,6 +172,7 @@
177#define PMCRAID_IOASC_SENSE_STATUS(ioasc) ((ioasc) & 0x000000ff) 172#define PMCRAID_IOASC_SENSE_STATUS(ioasc) ((ioasc) & 0x000000ff)
178 173
179#define PMCRAID_IOASC_GOOD_COMPLETION 0x00000000 174#define PMCRAID_IOASC_GOOD_COMPLETION 0x00000000
175#define PMCRAID_IOASC_GC_IOARCB_NOTFOUND 0x005A0000
180#define PMCRAID_IOASC_NR_INIT_CMD_REQUIRED 0x02040200 176#define PMCRAID_IOASC_NR_INIT_CMD_REQUIRED 0x02040200
181#define PMCRAID_IOASC_NR_IOA_RESET_REQUIRED 0x02048000 177#define PMCRAID_IOASC_NR_IOA_RESET_REQUIRED 0x02048000
182#define PMCRAID_IOASC_NR_SYNC_REQUIRED 0x023F0000 178#define PMCRAID_IOASC_NR_SYNC_REQUIRED 0x023F0000
@@ -187,12 +183,12 @@
187#define PMCRAID_IOASC_HW_IOA_RESET_REQUIRED 0x04448600 183#define PMCRAID_IOASC_HW_IOA_RESET_REQUIRED 0x04448600
188#define PMCRAID_IOASC_IR_INVALID_RESOURCE_HANDLE 0x05250000 184#define PMCRAID_IOASC_IR_INVALID_RESOURCE_HANDLE 0x05250000
189#define PMCRAID_IOASC_AC_TERMINATED_BY_HOST 0x0B5A0000 185#define PMCRAID_IOASC_AC_TERMINATED_BY_HOST 0x0B5A0000
190#define PMCRAID_IOASC_UA_BUS_WAS_RESET 0x06290000 186#define PMCRAID_IOASC_UA_BUS_WAS_RESET 0x06290000
191#define PMCRAID_IOASC_UA_BUS_WAS_RESET_BY_OTHER 0x06298000 187#define PMCRAID_IOASC_UA_BUS_WAS_RESET_BY_OTHER 0x06298000
192 188
193/* Driver defined IOASCs */ 189/* Driver defined IOASCs */
194#define PMCRAID_IOASC_IOA_WAS_RESET 0x10000001 190#define PMCRAID_IOASC_IOA_WAS_RESET 0x10000001
195#define PMCRAID_IOASC_PCI_ACCESS_ERROR 0x10000002 191#define PMCRAID_IOASC_PCI_ACCESS_ERROR 0x10000002
196 192
197/* Various timeout values (in milliseconds) used. If any of these are chip 193/* Various timeout values (in milliseconds) used. If any of these are chip
198 * specific, move them to pmcraid_chip_details structure. 194 * specific, move them to pmcraid_chip_details structure.
@@ -336,6 +332,13 @@ struct pmcraid_config_table_entry {
336 __u8 lun[PMCRAID_LUN_LEN]; 332 __u8 lun[PMCRAID_LUN_LEN];
337} __attribute__((packed, aligned(4))); 333} __attribute__((packed, aligned(4)));
338 334
335/* extended configuration table sizes are of 64 bytes in size */
336#define PMCRAID_CFGTE_EXT_SIZE 32
337struct pmcraid_config_table_entry_ext {
338 struct pmcraid_config_table_entry cfgte;
339 __u8 cfgte_ext[PMCRAID_CFGTE_EXT_SIZE];
340};
341
339/* resource types (config_table_entry.resource_type values) */ 342/* resource types (config_table_entry.resource_type values) */
340#define RES_TYPE_AF_DASD 0x00 343#define RES_TYPE_AF_DASD 0x00
341#define RES_TYPE_GSCSI 0x01 344#define RES_TYPE_GSCSI 0x01
@@ -376,7 +379,12 @@ struct pmcraid_config_table {
376 __u8 reserved1; 379 __u8 reserved1;
377 __u8 flags; 380 __u8 flags;
378 __u8 reserved2[11]; 381 __u8 reserved2[11];
379 struct pmcraid_config_table_entry entries[PMCRAID_MAX_RESOURCES]; 382 union {
383 struct pmcraid_config_table_entry
384 entries[PMCRAID_MAX_RESOURCES];
385 struct pmcraid_config_table_entry_ext
386 entries_ext[PMCRAID_MAX_RESOURCES];
387 };
380} __attribute__((packed, aligned(4))); 388} __attribute__((packed, aligned(4)));
381 389
382/* config_table.flags value */ 390/* config_table.flags value */
@@ -385,7 +393,7 @@ struct pmcraid_config_table {
385/* 393/*
386 * HCAM format 394 * HCAM format
387 */ 395 */
388#define PMCRAID_HOSTRCB_LDNSIZE 4056 396#define PMCRAID_HOSTRCB_LDNSIZE 4056
389 397
390/* Error log notification format */ 398/* Error log notification format */
391struct pmcraid_hostrcb_error { 399struct pmcraid_hostrcb_error {
@@ -416,6 +424,15 @@ struct pmcraid_hcam_hdr {
416struct pmcraid_hcam_ccn { 424struct pmcraid_hcam_ccn {
417 struct pmcraid_hcam_hdr header; 425 struct pmcraid_hcam_hdr header;
418 struct pmcraid_config_table_entry cfg_entry; 426 struct pmcraid_config_table_entry cfg_entry;
427 struct pmcraid_config_table_entry cfg_entry_old;
428} __attribute__((packed, aligned(4)));
429
430#define PMCRAID_CCN_EXT_SIZE 3944
431struct pmcraid_hcam_ccn_ext {
432 struct pmcraid_hcam_hdr header;
433 struct pmcraid_config_table_entry_ext cfg_entry;
434 struct pmcraid_config_table_entry_ext cfg_entry_old;
435 __u8 reserved[PMCRAID_CCN_EXT_SIZE];
419} __attribute__((packed, aligned(4))); 436} __attribute__((packed, aligned(4)));
420 437
421struct pmcraid_hcam_ldn { 438struct pmcraid_hcam_ldn {
@@ -431,6 +448,8 @@ struct pmcraid_hcam_ldn {
431#define NOTIFICATION_TYPE_ENTRY_CHANGED 0x0 448#define NOTIFICATION_TYPE_ENTRY_CHANGED 0x0
432#define NOTIFICATION_TYPE_ENTRY_NEW 0x1 449#define NOTIFICATION_TYPE_ENTRY_NEW 0x1
433#define NOTIFICATION_TYPE_ENTRY_DELETED 0x2 450#define NOTIFICATION_TYPE_ENTRY_DELETED 0x2
451#define NOTIFICATION_TYPE_STATE_CHANGE 0x3
452#define NOTIFICATION_TYPE_ENTRY_STATECHANGED 0x4
434#define NOTIFICATION_TYPE_ERROR_LOG 0x10 453#define NOTIFICATION_TYPE_ERROR_LOG 0x10
435#define NOTIFICATION_TYPE_INFORMATION_LOG 0x11 454#define NOTIFICATION_TYPE_INFORMATION_LOG 0x11
436 455
@@ -460,6 +479,7 @@ struct pmcraid_chip_details {
460 unsigned long mailbox; 479 unsigned long mailbox;
461 unsigned long global_intr_mask; 480 unsigned long global_intr_mask;
462 unsigned long ioa_host_intr; 481 unsigned long ioa_host_intr;
482 unsigned long ioa_host_msix_intr;
463 unsigned long ioa_host_intr_clr; 483 unsigned long ioa_host_intr_clr;
464 unsigned long ioa_host_mask; 484 unsigned long ioa_host_mask;
465 unsigned long ioa_host_mask_clr; 485 unsigned long ioa_host_mask_clr;
@@ -482,6 +502,7 @@ struct pmcraid_chip_details {
482#define INTRS_IOA_PROCESSOR_ERROR PMC_BIT32(29) 502#define INTRS_IOA_PROCESSOR_ERROR PMC_BIT32(29)
483#define INTRS_HRRQ_VALID PMC_BIT32(30) 503#define INTRS_HRRQ_VALID PMC_BIT32(30)
484#define INTRS_OPERATIONAL_STATUS PMC_BIT32(0) 504#define INTRS_OPERATIONAL_STATUS PMC_BIT32(0)
505#define INTRS_ALLOW_MSIX_VECTOR0 PMC_BIT32(31)
485 506
486/* Host to IOA Doorbells */ 507/* Host to IOA Doorbells */
487#define DOORBELL_RUNTIME_RESET PMC_BIT32(1) 508#define DOORBELL_RUNTIME_RESET PMC_BIT32(1)
@@ -489,10 +510,12 @@ struct pmcraid_chip_details {
489#define DOORBELL_IOA_DEBUG_ALERT PMC_BIT32(9) 510#define DOORBELL_IOA_DEBUG_ALERT PMC_BIT32(9)
490#define DOORBELL_ENABLE_DESTRUCTIVE_DIAGS PMC_BIT32(8) 511#define DOORBELL_ENABLE_DESTRUCTIVE_DIAGS PMC_BIT32(8)
491#define DOORBELL_IOA_START_BIST PMC_BIT32(23) 512#define DOORBELL_IOA_START_BIST PMC_BIT32(23)
513#define DOORBELL_INTR_MODE_MSIX PMC_BIT32(25)
514#define DOORBELL_INTR_MSIX_CLR PMC_BIT32(26)
492#define DOORBELL_RESET_IOA PMC_BIT32(31) 515#define DOORBELL_RESET_IOA PMC_BIT32(31)
493 516
494/* Global interrupt mask register value */ 517/* Global interrupt mask register value */
495#define GLOBAL_INTERRUPT_MASK 0x4ULL 518#define GLOBAL_INTERRUPT_MASK 0x5ULL
496 519
497#define PMCRAID_ERROR_INTERRUPTS (INTRS_IOARCB_TRANSFER_FAILED | \ 520#define PMCRAID_ERROR_INTERRUPTS (INTRS_IOARCB_TRANSFER_FAILED | \
498 INTRS_IOA_UNIT_CHECK | \ 521 INTRS_IOA_UNIT_CHECK | \
@@ -503,8 +526,8 @@ struct pmcraid_chip_details {
503 526
504#define PMCRAID_PCI_INTERRUPTS (PMCRAID_ERROR_INTERRUPTS | \ 527#define PMCRAID_PCI_INTERRUPTS (PMCRAID_ERROR_INTERRUPTS | \
505 INTRS_HRRQ_VALID | \ 528 INTRS_HRRQ_VALID | \
506 INTRS_CRITICAL_OP_IN_PROGRESS |\ 529 INTRS_TRANSITION_TO_OPERATIONAL |\
507 INTRS_TRANSITION_TO_OPERATIONAL) 530 INTRS_ALLOW_MSIX_VECTOR0)
508 531
509/* control_block, associated with each of the commands contains IOARCB, IOADLs 532/* control_block, associated with each of the commands contains IOARCB, IOADLs
510 * memory for IOASA. Additional 3 * 16 bytes are allocated in order to support 533 * memory for IOASA. Additional 3 * 16 bytes are allocated in order to support
@@ -526,17 +549,24 @@ struct pmcraid_sglist {
526 struct scatterlist scatterlist[1]; 549 struct scatterlist scatterlist[1];
527}; 550};
528 551
552/* page D0 inquiry data of focal point resource */
553struct pmcraid_inquiry_data {
554 __u8 ph_dev_type;
555 __u8 page_code;
556 __u8 reserved1;
557 __u8 add_page_len;
558 __u8 length;
559 __u8 reserved2;
560 __le16 fw_version;
561 __u8 reserved3[16];
562};
563
529/* pmcraid_cmd - LLD representation of SCSI command */ 564/* pmcraid_cmd - LLD representation of SCSI command */
530struct pmcraid_cmd { 565struct pmcraid_cmd {
531 566
532 /* Ptr and bus address of DMA.able control block for this command */ 567 /* Ptr and bus address of DMA.able control block for this command */
533 struct pmcraid_control_block *ioa_cb; 568 struct pmcraid_control_block *ioa_cb;
534 dma_addr_t ioa_cb_bus_addr; 569 dma_addr_t ioa_cb_bus_addr;
535
536 /* sense buffer for REQUEST SENSE command if firmware is not sending
537 * auto sense data
538 */
539 dma_addr_t sense_buffer_dma;
540 dma_addr_t dma_handle; 570 dma_addr_t dma_handle;
541 u8 *sense_buffer; 571 u8 *sense_buffer;
542 572
@@ -556,11 +586,22 @@ struct pmcraid_cmd {
556 586
557 struct pmcraid_sglist *sglist; /* used for passthrough IOCTLs */ 587 struct pmcraid_sglist *sglist; /* used for passthrough IOCTLs */
558 588
559 /* scratch used during reset sequence */ 589 /* scratch used */
560 union { 590 union {
591 /* during reset sequence */
561 unsigned long time_left; 592 unsigned long time_left;
562 struct pmcraid_resource_entry *res; 593 struct pmcraid_resource_entry *res;
563 } u; 594 int hrrq_index;
595
596 /* used during IO command error handling. Sense buffer
597 * for REQUEST SENSE command if firmware is not sending
598 * auto sense data
599 */
600 struct {
601 u8 *sense_buffer;
602 dma_addr_t sense_buffer_dma;
603 };
604 };
564}; 605};
565 606
566/* 607/*
@@ -568,6 +609,7 @@ struct pmcraid_cmd {
568 */ 609 */
569struct pmcraid_interrupts { 610struct pmcraid_interrupts {
570 void __iomem *ioa_host_interrupt_reg; 611 void __iomem *ioa_host_interrupt_reg;
612 void __iomem *ioa_host_msix_interrupt_reg;
571 void __iomem *ioa_host_interrupt_clr_reg; 613 void __iomem *ioa_host_interrupt_clr_reg;
572 void __iomem *ioa_host_interrupt_mask_reg; 614 void __iomem *ioa_host_interrupt_mask_reg;
573 void __iomem *ioa_host_interrupt_mask_clr_reg; 615 void __iomem *ioa_host_interrupt_mask_clr_reg;
@@ -578,11 +620,12 @@ struct pmcraid_interrupts {
578 620
579/* ISR parameters LLD allocates (one for each MSI-X if enabled) vectors */ 621/* ISR parameters LLD allocates (one for each MSI-X if enabled) vectors */
580struct pmcraid_isr_param { 622struct pmcraid_isr_param {
581 u8 hrrq_id; /* hrrq entry index */
582 u16 vector; /* allocated msi-x vector */
583 struct pmcraid_instance *drv_inst; 623 struct pmcraid_instance *drv_inst;
624 u16 vector; /* allocated msi-x vector */
625 u8 hrrq_id; /* hrrq entry index */
584}; 626};
585 627
628
586/* AEN message header sent as part of event data to applications */ 629/* AEN message header sent as part of event data to applications */
587struct pmcraid_aen_msg { 630struct pmcraid_aen_msg {
588 u32 hostno; 631 u32 hostno;
@@ -591,6 +634,19 @@ struct pmcraid_aen_msg {
591 u8 data[0]; 634 u8 data[0];
592}; 635};
593 636
637/* Controller state event message type */
638struct pmcraid_state_msg {
639 struct pmcraid_aen_msg msg;
640 u32 ioa_state;
641};
642
643#define PMC_DEVICE_EVENT_RESET_START 0x11000000
644#define PMC_DEVICE_EVENT_RESET_SUCCESS 0x11000001
645#define PMC_DEVICE_EVENT_RESET_FAILED 0x11000002
646#define PMC_DEVICE_EVENT_SHUTDOWN_START 0x11000003
647#define PMC_DEVICE_EVENT_SHUTDOWN_SUCCESS 0x11000004
648#define PMC_DEVICE_EVENT_SHUTDOWN_FAILED 0x11000005
649
594struct pmcraid_hostrcb { 650struct pmcraid_hostrcb {
595 struct pmcraid_instance *drv_inst; 651 struct pmcraid_instance *drv_inst;
596 struct pmcraid_aen_msg *msg; 652 struct pmcraid_aen_msg *msg;
@@ -628,6 +684,7 @@ struct pmcraid_instance {
628 /* HostRCBs needed for HCAM */ 684 /* HostRCBs needed for HCAM */
629 struct pmcraid_hostrcb ldn; 685 struct pmcraid_hostrcb ldn;
630 struct pmcraid_hostrcb ccn; 686 struct pmcraid_hostrcb ccn;
687 struct pmcraid_state_msg scn; /* controller state change msg */
631 688
632 689
633 /* Bus address of start of HRRQ */ 690 /* Bus address of start of HRRQ */
@@ -645,12 +702,15 @@ struct pmcraid_instance {
645 /* Lock for HRRQ access */ 702 /* Lock for HRRQ access */
646 spinlock_t hrrq_lock[PMCRAID_NUM_MSIX_VECTORS]; 703 spinlock_t hrrq_lock[PMCRAID_NUM_MSIX_VECTORS];
647 704
705 struct pmcraid_inquiry_data *inq_data;
706 dma_addr_t inq_data_baddr;
707
708 /* size of configuration table entry, varies based on the firmware */
709 u32 config_table_entry_size;
710
648 /* Expected toggle bit at host */ 711 /* Expected toggle bit at host */
649 u8 host_toggle_bit[PMCRAID_NUM_MSIX_VECTORS]; 712 u8 host_toggle_bit[PMCRAID_NUM_MSIX_VECTORS];
650 713
651 /* No of Reset IOA retries . IOA marked dead if threshold exceeds */
652 u8 ioa_reset_attempts;
653#define PMCRAID_RESET_ATTEMPTS 3
654 714
655 /* Wait Q for threads to wait for Reset IOA completion */ 715 /* Wait Q for threads to wait for Reset IOA completion */
656 wait_queue_head_t reset_wait_q; 716 wait_queue_head_t reset_wait_q;
@@ -664,14 +724,22 @@ struct pmcraid_instance {
664 struct Scsi_Host *host; /* mid layer interface structure handle */ 724 struct Scsi_Host *host; /* mid layer interface structure handle */
665 struct pci_dev *pdev; /* PCI device structure handle */ 725 struct pci_dev *pdev; /* PCI device structure handle */
666 726
727 /* No of Reset IOA retries . IOA marked dead if threshold exceeds */
728 u8 ioa_reset_attempts;
729#define PMCRAID_RESET_ATTEMPTS 3
730
667 u8 current_log_level; /* default level for logging IOASC errors */ 731 u8 current_log_level; /* default level for logging IOASC errors */
668 732
669 u8 num_hrrq; /* Number of interrupt vectors allocated */ 733 u8 num_hrrq; /* Number of interrupt vectors allocated */
734 u8 interrupt_mode; /* current interrupt mode legacy or msix */
670 dev_t dev; /* Major-Minor numbers for Char device */ 735 dev_t dev; /* Major-Minor numbers for Char device */
671 736
672 /* Used as ISR handler argument */ 737 /* Used as ISR handler argument */
673 struct pmcraid_isr_param hrrq_vector[PMCRAID_NUM_MSIX_VECTORS]; 738 struct pmcraid_isr_param hrrq_vector[PMCRAID_NUM_MSIX_VECTORS];
674 739
740 /* Message id as filled in last fired IOARCB, used to identify HRRQ */
741 atomic_t last_message_id;
742
675 /* configuration table */ 743 /* configuration table */
676 struct pmcraid_config_table *cfg_table; 744 struct pmcraid_config_table *cfg_table;
677 dma_addr_t cfg_table_bus_addr; 745 dma_addr_t cfg_table_bus_addr;
@@ -686,8 +754,14 @@ struct pmcraid_instance {
686 754
687 struct list_head free_cmd_pool; 755 struct list_head free_cmd_pool;
688 struct list_head pending_cmd_pool; 756 struct list_head pending_cmd_pool;
689 spinlock_t free_pool_lock; /* free pool lock */ 757 spinlock_t free_pool_lock; /* free pool lock */
690 spinlock_t pending_pool_lock; /* pending pool lock */ 758 spinlock_t pending_pool_lock; /* pending pool lock */
759
760 /* Tasklet to handle deferred processing */
761 struct tasklet_struct isr_tasklet[PMCRAID_NUM_MSIX_VECTORS];
762
763 /* Work-queue (Shared) for deferred reset processing */
764 struct work_struct worker_q;
691 765
692 /* No of IO commands pending with FW */ 766 /* No of IO commands pending with FW */
693 atomic_t outstanding_cmds; 767 atomic_t outstanding_cmds;
@@ -695,11 +769,6 @@ struct pmcraid_instance {
695 /* should add/delete resources to mid-layer now ?*/ 769 /* should add/delete resources to mid-layer now ?*/
696 atomic_t expose_resources; 770 atomic_t expose_resources;
697 771
698 /* Tasklet to handle deferred processing */
699 struct tasklet_struct isr_tasklet[PMCRAID_NUM_MSIX_VECTORS];
700
701 /* Work-queue (Shared) for deferred reset processing */
702 struct work_struct worker_q;
703 772
704 773
705 u32 ioa_state:4; /* For IOA Reset sequence FSM */ 774 u32 ioa_state:4; /* For IOA Reset sequence FSM */
@@ -728,7 +797,10 @@ struct pmcraid_instance {
728/* LLD maintained resource entry structure */ 797/* LLD maintained resource entry structure */
729struct pmcraid_resource_entry { 798struct pmcraid_resource_entry {
730 struct list_head queue; /* link to "to be exposed" resources */ 799 struct list_head queue; /* link to "to be exposed" resources */
731 struct pmcraid_config_table_entry cfg_entry; 800 union {
801 struct pmcraid_config_table_entry cfg_entry;
802 struct pmcraid_config_table_entry_ext cfg_entry_ext;
803 };
732 struct scsi_device *scsi_dev; /* Link scsi_device structure */ 804 struct scsi_device *scsi_dev; /* Link scsi_device structure */
733 atomic_t read_failures; /* count of failed READ commands */ 805 atomic_t read_failures; /* count of failed READ commands */
734 atomic_t write_failures; /* count of failed WRITE commands */ 806 atomic_t write_failures; /* count of failed WRITE commands */
@@ -771,73 +843,75 @@ struct pmcraid_ioasc_error {
771 * statically. 843 * statically.
772 */ 844 */
773static struct pmcraid_ioasc_error pmcraid_ioasc_error_table[] = { 845static struct pmcraid_ioasc_error pmcraid_ioasc_error_table[] = {
774 {0x01180600, IOASC_LOG_LEVEL_MUST, 846 {0x01180600, IOASC_LOG_LEVEL_HARD,
775 "Recovered Error, soft media error, sector reassignment suggested"}, 847 "Recovered Error, soft media error, sector reassignment suggested"},
776 {0x015D0000, IOASC_LOG_LEVEL_MUST, 848 {0x015D0000, IOASC_LOG_LEVEL_HARD,
777 "Recovered Error, failure prediction threshold exceeded"}, 849 "Recovered Error, failure prediction thresold exceeded"},
778 {0x015D9200, IOASC_LOG_LEVEL_MUST, 850 {0x015D9200, IOASC_LOG_LEVEL_HARD,
779 "Recovered Error, soft Cache Card Battery error threshold"}, 851 "Recovered Error, soft Cache Card Battery error thresold"},
780 {0x015D9200, IOASC_LOG_LEVEL_MUST, 852 {0x015D9200, IOASC_LOG_LEVEL_HARD,
781 "Recovered Error, soft Cache Card Battery error threshold"}, 853 "Recovered Error, soft Cache Card Battery error thresold"},
782 {0x02048000, IOASC_LOG_LEVEL_MUST, 854 {0x02048000, IOASC_LOG_LEVEL_HARD,
783 "Not Ready, IOA Reset Required"}, 855 "Not Ready, IOA Reset Required"},
784 {0x02408500, IOASC_LOG_LEVEL_MUST, 856 {0x02408500, IOASC_LOG_LEVEL_HARD,
785 "Not Ready, IOA microcode download required"}, 857 "Not Ready, IOA microcode download required"},
786 {0x03110B00, IOASC_LOG_LEVEL_MUST, 858 {0x03110B00, IOASC_LOG_LEVEL_HARD,
787 "Medium Error, data unreadable, reassignment suggested"}, 859 "Medium Error, data unreadable, reassignment suggested"},
788 {0x03110C00, IOASC_LOG_LEVEL_MUST, 860 {0x03110C00, IOASC_LOG_LEVEL_MUST,
789 "Medium Error, data unreadable do not reassign"}, 861 "Medium Error, data unreadable do not reassign"},
790 {0x03310000, IOASC_LOG_LEVEL_MUST, 862 {0x03310000, IOASC_LOG_LEVEL_HARD,
791 "Medium Error, media corrupted"}, 863 "Medium Error, media corrupted"},
792 {0x04050000, IOASC_LOG_LEVEL_MUST, 864 {0x04050000, IOASC_LOG_LEVEL_HARD,
793 "Hardware Error, IOA can't communicate with device"}, 865 "Hardware Error, IOA can't communicate with device"},
794 {0x04080000, IOASC_LOG_LEVEL_MUST, 866 {0x04080000, IOASC_LOG_LEVEL_MUST,
795 "Hardware Error, device bus error"}, 867 "Hardware Error, device bus error"},
796 {0x04080000, IOASC_LOG_LEVEL_MUST, 868 {0x04088000, IOASC_LOG_LEVEL_MUST,
797 "Hardware Error, device bus is not functioning"}, 869 "Hardware Error, device bus is not functioning"},
798 {0x04118000, IOASC_LOG_LEVEL_MUST, 870 {0x04118000, IOASC_LOG_LEVEL_HARD,
799 "Hardware Error, IOA reserved area data check"}, 871 "Hardware Error, IOA reserved area data check"},
800 {0x04118100, IOASC_LOG_LEVEL_MUST, 872 {0x04118100, IOASC_LOG_LEVEL_HARD,
801 "Hardware Error, IOA reserved area invalid data pattern"}, 873 "Hardware Error, IOA reserved area invalid data pattern"},
802 {0x04118200, IOASC_LOG_LEVEL_MUST, 874 {0x04118200, IOASC_LOG_LEVEL_HARD,
803 "Hardware Error, IOA reserved area LRC error"}, 875 "Hardware Error, IOA reserved area LRC error"},
804 {0x04320000, IOASC_LOG_LEVEL_MUST, 876 {0x04320000, IOASC_LOG_LEVEL_HARD,
805 "Hardware Error, reassignment space exhausted"}, 877 "Hardware Error, reassignment space exhausted"},
806 {0x04330000, IOASC_LOG_LEVEL_MUST, 878 {0x04330000, IOASC_LOG_LEVEL_HARD,
807 "Hardware Error, data transfer underlength error"}, 879 "Hardware Error, data transfer underlength error"},
808 {0x04330000, IOASC_LOG_LEVEL_MUST, 880 {0x04330000, IOASC_LOG_LEVEL_HARD,
809 "Hardware Error, data transfer overlength error"}, 881 "Hardware Error, data transfer overlength error"},
810 {0x04418000, IOASC_LOG_LEVEL_MUST, 882 {0x04418000, IOASC_LOG_LEVEL_MUST,
811 "Hardware Error, PCI bus error"}, 883 "Hardware Error, PCI bus error"},
812 {0x04440000, IOASC_LOG_LEVEL_MUST, 884 {0x04440000, IOASC_LOG_LEVEL_HARD,
813 "Hardware Error, device error"}, 885 "Hardware Error, device error"},
814 {0x04448300, IOASC_LOG_LEVEL_MUST, 886 {0x04448200, IOASC_LOG_LEVEL_MUST,
887 "Hardware Error, IOA error"},
888 {0x04448300, IOASC_LOG_LEVEL_HARD,
815 "Hardware Error, undefined device response"}, 889 "Hardware Error, undefined device response"},
816 {0x04448400, IOASC_LOG_LEVEL_MUST, 890 {0x04448400, IOASC_LOG_LEVEL_HARD,
817 "Hardware Error, IOA microcode error"}, 891 "Hardware Error, IOA microcode error"},
818 {0x04448600, IOASC_LOG_LEVEL_MUST, 892 {0x04448600, IOASC_LOG_LEVEL_HARD,
819 "Hardware Error, IOA reset required"}, 893 "Hardware Error, IOA reset required"},
820 {0x04449200, IOASC_LOG_LEVEL_MUST, 894 {0x04449200, IOASC_LOG_LEVEL_HARD,
821 "Hardware Error, hard Cache Fearuee Card Battery error"}, 895 "Hardware Error, hard Cache Fearuee Card Battery error"},
822 {0x0444A000, IOASC_LOG_LEVEL_MUST, 896 {0x0444A000, IOASC_LOG_LEVEL_HARD,
823 "Hardware Error, failed device altered"}, 897 "Hardware Error, failed device altered"},
824 {0x0444A200, IOASC_LOG_LEVEL_MUST, 898 {0x0444A200, IOASC_LOG_LEVEL_HARD,
825 "Hardware Error, data check after reassignment"}, 899 "Hardware Error, data check after reassignment"},
826 {0x0444A300, IOASC_LOG_LEVEL_MUST, 900 {0x0444A300, IOASC_LOG_LEVEL_HARD,
827 "Hardware Error, LRC error after reassignment"}, 901 "Hardware Error, LRC error after reassignment"},
828 {0x044A0000, IOASC_LOG_LEVEL_MUST, 902 {0x044A0000, IOASC_LOG_LEVEL_HARD,
829 "Hardware Error, device bus error (msg/cmd phase)"}, 903 "Hardware Error, device bus error (msg/cmd phase)"},
830 {0x04670400, IOASC_LOG_LEVEL_MUST, 904 {0x04670400, IOASC_LOG_LEVEL_HARD,
831 "Hardware Error, new device can't be used"}, 905 "Hardware Error, new device can't be used"},
832 {0x04678000, IOASC_LOG_LEVEL_MUST, 906 {0x04678000, IOASC_LOG_LEVEL_HARD,
833 "Hardware Error, invalid multiadapter configuration"}, 907 "Hardware Error, invalid multiadapter configuration"},
834 {0x04678100, IOASC_LOG_LEVEL_MUST, 908 {0x04678100, IOASC_LOG_LEVEL_HARD,
835 "Hardware Error, incorrect connection between enclosures"}, 909 "Hardware Error, incorrect connection between enclosures"},
836 {0x04678200, IOASC_LOG_LEVEL_MUST, 910 {0x04678200, IOASC_LOG_LEVEL_HARD,
837 "Hardware Error, connections exceed IOA design limits"}, 911 "Hardware Error, connections exceed IOA design limits"},
838 {0x04678300, IOASC_LOG_LEVEL_MUST, 912 {0x04678300, IOASC_LOG_LEVEL_HARD,
839 "Hardware Error, incorrect multipath connection"}, 913 "Hardware Error, incorrect multipath connection"},
840 {0x04679000, IOASC_LOG_LEVEL_MUST, 914 {0x04679000, IOASC_LOG_LEVEL_HARD,
841 "Hardware Error, command to LUN failed"}, 915 "Hardware Error, command to LUN failed"},
842 {0x064C8000, IOASC_LOG_LEVEL_HARD, 916 {0x064C8000, IOASC_LOG_LEVEL_HARD,
843 "Unit Attention, cache exists for missing/failed device"}, 917 "Unit Attention, cache exists for missing/failed device"},
@@ -845,15 +919,15 @@ static struct pmcraid_ioasc_error pmcraid_ioasc_error_table[] = {
845 "Unit Attention, incompatible exposed mode device"}, 919 "Unit Attention, incompatible exposed mode device"},
846 {0x06670600, IOASC_LOG_LEVEL_HARD, 920 {0x06670600, IOASC_LOG_LEVEL_HARD,
847 "Unit Attention, attachment of logical unit failed"}, 921 "Unit Attention, attachment of logical unit failed"},
848 {0x06678000, IOASC_LOG_LEVEL_MUST, 922 {0x06678000, IOASC_LOG_LEVEL_HARD,
849 "Unit Attention, cables exceed connective design limit"}, 923 "Unit Attention, cables exceed connective design limit"},
850 {0x06678300, IOASC_LOG_LEVEL_MUST, 924 {0x06678300, IOASC_LOG_LEVEL_HARD,
851 "Unit Attention, incomplete multipath connection between" \ 925 "Unit Attention, incomplete multipath connection between" \
852 "IOA and enclosure"}, 926 "IOA and enclosure"},
853 {0x06678400, IOASC_LOG_LEVEL_MUST, 927 {0x06678400, IOASC_LOG_LEVEL_HARD,
854 "Unit Attention, incomplete multipath connection between" \ 928 "Unit Attention, incomplete multipath connection between" \
855 "device and enclosure"}, 929 "device and enclosure"},
856 {0x06678500, IOASC_LOG_LEVEL_MUST, 930 {0x06678500, IOASC_LOG_LEVEL_HARD,
857 "Unit Attention, incomplete multipath connection between" \ 931 "Unit Attention, incomplete multipath connection between" \
858 "IOA and remote IOA"}, 932 "IOA and remote IOA"},
859 {0x06678600, IOASC_LOG_LEVEL_HARD, 933 {0x06678600, IOASC_LOG_LEVEL_HARD,
@@ -863,11 +937,11 @@ static struct pmcraid_ioasc_error pmcraid_ioasc_error_table[] = {
863 "function"}, 937 "function"},
864 {0x06698200, IOASC_LOG_LEVEL_HARD, 938 {0x06698200, IOASC_LOG_LEVEL_HARD,
865 "Unit Attention, corrupt array parity detected on device"}, 939 "Unit Attention, corrupt array parity detected on device"},
866 {0x066B0200, IOASC_LOG_LEVEL_MUST, 940 {0x066B0200, IOASC_LOG_LEVEL_HARD,
867 "Unit Attention, array exposed"}, 941 "Unit Attention, array exposed"},
868 {0x066B8200, IOASC_LOG_LEVEL_HARD, 942 {0x066B8200, IOASC_LOG_LEVEL_HARD,
869 "Unit Attention, exposed array is still protected"}, 943 "Unit Attention, exposed array is still protected"},
870 {0x066B9200, IOASC_LOG_LEVEL_MUST, 944 {0x066B9200, IOASC_LOG_LEVEL_HARD,
871 "Unit Attention, Multipath redundancy level got worse"}, 945 "Unit Attention, Multipath redundancy level got worse"},
872 {0x07270000, IOASC_LOG_LEVEL_HARD, 946 {0x07270000, IOASC_LOG_LEVEL_HARD,
873 "Data Protect, device is read/write protected by IOA"}, 947 "Data Protect, device is read/write protected by IOA"},
@@ -875,37 +949,37 @@ static struct pmcraid_ioasc_error pmcraid_ioasc_error_table[] = {
875 "Data Protect, IOA doesn't support device attribute"}, 949 "Data Protect, IOA doesn't support device attribute"},
876 {0x07278100, IOASC_LOG_LEVEL_HARD, 950 {0x07278100, IOASC_LOG_LEVEL_HARD,
877 "Data Protect, NVRAM mirroring prohibited"}, 951 "Data Protect, NVRAM mirroring prohibited"},
878 {0x07278400, IOASC_LOG_LEVEL_MUST, 952 {0x07278400, IOASC_LOG_LEVEL_HARD,
879 "Data Protect, array is short 2 or more devices"}, 953 "Data Protect, array is short 2 or more devices"},
880 {0x07278600, IOASC_LOG_LEVEL_MUST, 954 {0x07278600, IOASC_LOG_LEVEL_HARD,
881 "Data Protect, exposed array is short a required device"}, 955 "Data Protect, exposed array is short a required device"},
882 {0x07278700, IOASC_LOG_LEVEL_MUST, 956 {0x07278700, IOASC_LOG_LEVEL_HARD,
883 "Data Protect, array members not at required addresses"}, 957 "Data Protect, array members not at required addresses"},
884 {0x07278800, IOASC_LOG_LEVEL_MUST, 958 {0x07278800, IOASC_LOG_LEVEL_HARD,
885 "Data Protect, exposed mode device resource address conflict"}, 959 "Data Protect, exposed mode device resource address conflict"},
886 {0x07278900, IOASC_LOG_LEVEL_MUST, 960 {0x07278900, IOASC_LOG_LEVEL_HARD,
887 "Data Protect, incorrect resource address of exposed mode device"}, 961 "Data Protect, incorrect resource address of exposed mode device"},
888 {0x07278A00, IOASC_LOG_LEVEL_MUST, 962 {0x07278A00, IOASC_LOG_LEVEL_HARD,
889 "Data Protect, Array is missing a device and parity is out of sync"}, 963 "Data Protect, Array is missing a device and parity is out of sync"},
890 {0x07278B00, IOASC_LOG_LEVEL_MUST, 964 {0x07278B00, IOASC_LOG_LEVEL_HARD,
891 "Data Protect, maximum number of arrays already exist"}, 965 "Data Protect, maximum number of arrays already exist"},
892 {0x07278C00, IOASC_LOG_LEVEL_HARD, 966 {0x07278C00, IOASC_LOG_LEVEL_HARD,
893 "Data Protect, cannot locate cache data for device"}, 967 "Data Protect, cannot locate cache data for device"},
894 {0x07278D00, IOASC_LOG_LEVEL_HARD, 968 {0x07278D00, IOASC_LOG_LEVEL_HARD,
895 "Data Protect, cache data exits for a changed device"}, 969 "Data Protect, cache data exits for a changed device"},
896 {0x07279100, IOASC_LOG_LEVEL_MUST, 970 {0x07279100, IOASC_LOG_LEVEL_HARD,
897 "Data Protect, detection of a device requiring format"}, 971 "Data Protect, detection of a device requiring format"},
898 {0x07279200, IOASC_LOG_LEVEL_MUST, 972 {0x07279200, IOASC_LOG_LEVEL_HARD,
899 "Data Protect, IOA exceeds maximum number of devices"}, 973 "Data Protect, IOA exceeds maximum number of devices"},
900 {0x07279600, IOASC_LOG_LEVEL_MUST, 974 {0x07279600, IOASC_LOG_LEVEL_HARD,
901 "Data Protect, missing array, volume set is not functional"}, 975 "Data Protect, missing array, volume set is not functional"},
902 {0x07279700, IOASC_LOG_LEVEL_MUST, 976 {0x07279700, IOASC_LOG_LEVEL_HARD,
903 "Data Protect, single device for a volume set"}, 977 "Data Protect, single device for a volume set"},
904 {0x07279800, IOASC_LOG_LEVEL_MUST, 978 {0x07279800, IOASC_LOG_LEVEL_HARD,
905 "Data Protect, missing multiple devices for a volume set"}, 979 "Data Protect, missing multiple devices for a volume set"},
906 {0x07279900, IOASC_LOG_LEVEL_HARD, 980 {0x07279900, IOASC_LOG_LEVEL_HARD,
907 "Data Protect, maximum number of volument sets already exists"}, 981 "Data Protect, maximum number of volument sets already exists"},
908 {0x07279A00, IOASC_LOG_LEVEL_MUST, 982 {0x07279A00, IOASC_LOG_LEVEL_HARD,
909 "Data Protect, other volume set problem"}, 983 "Data Protect, other volume set problem"},
910}; 984};
911 985
@@ -952,27 +1026,6 @@ struct pmcraid_ioctl_header {
952 1026
953#define PMCRAID_IOCTL_SIGNATURE "PMCRAID" 1027#define PMCRAID_IOCTL_SIGNATURE "PMCRAID"
954 1028
955
956/*
957 * pmcraid_event_details - defines AEN details that apps can retrieve from LLD
958 *
959 * .rcb_ccn - complete RCB of CCN
960 * .rcb_ldn - complete RCB of CCN
961 */
962struct pmcraid_event_details {
963 struct pmcraid_hcam_ccn rcb_ccn;
964 struct pmcraid_hcam_ldn rcb_ldn;
965};
966
967/*
968 * pmcraid_driver_ioctl_buffer - structure passed as argument to most of the
969 * PMC driver handled ioctls.
970 */
971struct pmcraid_driver_ioctl_buffer {
972 struct pmcraid_ioctl_header ioctl_header;
973 struct pmcraid_event_details event_details;
974};
975
976/* 1029/*
977 * pmcraid_passthrough_ioctl_buffer - structure given as argument to 1030 * pmcraid_passthrough_ioctl_buffer - structure given as argument to
978 * passthrough(or firmware handled) IOCTL commands. Note that ioarcb requires 1031 * passthrough(or firmware handled) IOCTL commands. Note that ioarcb requires