diff options
Diffstat (limited to 'drivers/scsi/arcmsr/arcmsr.h')
-rw-r--r-- | drivers/scsi/arcmsr/arcmsr.h | 146 |
1 files changed, 134 insertions, 12 deletions
diff --git a/drivers/scsi/arcmsr/arcmsr.h b/drivers/scsi/arcmsr/arcmsr.h index 77b26f5b9c33..3bcaaac0ae4b 100644 --- a/drivers/scsi/arcmsr/arcmsr.h +++ b/drivers/scsi/arcmsr/arcmsr.h | |||
@@ -45,13 +45,14 @@ | |||
45 | #include <linux/interrupt.h> | 45 | #include <linux/interrupt.h> |
46 | struct device_attribute; | 46 | struct device_attribute; |
47 | /*The limit of outstanding scsi command that firmware can handle*/ | 47 | /*The limit of outstanding scsi command that firmware can handle*/ |
48 | #define ARCMSR_MAX_OUTSTANDING_CMD 256 | ||
49 | #ifdef CONFIG_XEN | 48 | #ifdef CONFIG_XEN |
50 | #define ARCMSR_MAX_FREECCB_NUM 160 | 49 | #define ARCMSR_MAX_FREECCB_NUM 160 |
50 | #define ARCMSR_MAX_OUTSTANDING_CMD 155 | ||
51 | #else | 51 | #else |
52 | #define ARCMSR_MAX_FREECCB_NUM 320 | 52 | #define ARCMSR_MAX_FREECCB_NUM 320 |
53 | #define ARCMSR_MAX_OUTSTANDING_CMD 255 | ||
53 | #endif | 54 | #endif |
54 | #define ARCMSR_DRIVER_VERSION "Driver Version 1.20.00.15 2010/08/05" | 55 | #define ARCMSR_DRIVER_VERSION "v1.30.00.04-20140919" |
55 | #define ARCMSR_SCSI_INITIATOR_ID 255 | 56 | #define ARCMSR_SCSI_INITIATOR_ID 255 |
56 | #define ARCMSR_MAX_XFER_SECTORS 512 | 57 | #define ARCMSR_MAX_XFER_SECTORS 512 |
57 | #define ARCMSR_MAX_XFER_SECTORS_B 4096 | 58 | #define ARCMSR_MAX_XFER_SECTORS_B 4096 |
@@ -62,11 +63,17 @@ struct device_attribute; | |||
62 | #define ARCMSR_MAX_QBUFFER 4096 | 63 | #define ARCMSR_MAX_QBUFFER 4096 |
63 | #define ARCMSR_DEFAULT_SG_ENTRIES 38 | 64 | #define ARCMSR_DEFAULT_SG_ENTRIES 38 |
64 | #define ARCMSR_MAX_HBB_POSTQUEUE 264 | 65 | #define ARCMSR_MAX_HBB_POSTQUEUE 264 |
66 | #define ARCMSR_MAX_ARC1214_POSTQUEUE 256 | ||
67 | #define ARCMSR_MAX_ARC1214_DONEQUEUE 257 | ||
65 | #define ARCMSR_MAX_XFER_LEN 0x26000 /* 152K */ | 68 | #define ARCMSR_MAX_XFER_LEN 0x26000 /* 152K */ |
66 | #define ARCMSR_CDB_SG_PAGE_LENGTH 256 | 69 | #define ARCMSR_CDB_SG_PAGE_LENGTH 256 |
70 | #define ARCMST_NUM_MSIX_VECTORS 4 | ||
67 | #ifndef PCI_DEVICE_ID_ARECA_1880 | 71 | #ifndef PCI_DEVICE_ID_ARECA_1880 |
68 | #define PCI_DEVICE_ID_ARECA_1880 0x1880 | 72 | #define PCI_DEVICE_ID_ARECA_1880 0x1880 |
69 | #endif | 73 | #endif |
74 | #ifndef PCI_DEVICE_ID_ARECA_1214 | ||
75 | #define PCI_DEVICE_ID_ARECA_1214 0x1214 | ||
76 | #endif | ||
70 | /* | 77 | /* |
71 | ********************************************************************************** | 78 | ********************************************************************************** |
72 | ** | 79 | ** |
@@ -100,10 +107,11 @@ struct CMD_MESSAGE | |||
100 | ** IOP Message Transfer Data for user space | 107 | ** IOP Message Transfer Data for user space |
101 | ******************************************************************************* | 108 | ******************************************************************************* |
102 | */ | 109 | */ |
110 | #define ARCMSR_API_DATA_BUFLEN 1032 | ||
103 | struct CMD_MESSAGE_FIELD | 111 | struct CMD_MESSAGE_FIELD |
104 | { | 112 | { |
105 | struct CMD_MESSAGE cmdmessage; | 113 | struct CMD_MESSAGE cmdmessage; |
106 | uint8_t messagedatabuffer[1032]; | 114 | uint8_t messagedatabuffer[ARCMSR_API_DATA_BUFLEN]; |
107 | }; | 115 | }; |
108 | /* IOP message transfer */ | 116 | /* IOP message transfer */ |
109 | #define ARCMSR_MESSAGE_FAIL 0x0001 | 117 | #define ARCMSR_MESSAGE_FAIL 0x0001 |
@@ -337,6 +345,56 @@ struct FIRMWARE_INFO | |||
337 | #define ARCMSR_HBCMU_MESSAGE_FIRMWARE_OK 0x80000000 | 345 | #define ARCMSR_HBCMU_MESSAGE_FIRMWARE_OK 0x80000000 |
338 | /* | 346 | /* |
339 | ******************************************************************************* | 347 | ******************************************************************************* |
348 | ** SPEC. for Areca Type D adapter | ||
349 | ******************************************************************************* | ||
350 | */ | ||
351 | #define ARCMSR_ARC1214_CHIP_ID 0x00004 | ||
352 | #define ARCMSR_ARC1214_CPU_MEMORY_CONFIGURATION 0x00008 | ||
353 | #define ARCMSR_ARC1214_I2_HOST_INTERRUPT_MASK 0x00034 | ||
354 | #define ARCMSR_ARC1214_SAMPLE_RESET 0x00100 | ||
355 | #define ARCMSR_ARC1214_RESET_REQUEST 0x00108 | ||
356 | #define ARCMSR_ARC1214_MAIN_INTERRUPT_STATUS 0x00200 | ||
357 | #define ARCMSR_ARC1214_PCIE_F0_INTERRUPT_ENABLE 0x0020C | ||
358 | #define ARCMSR_ARC1214_INBOUND_MESSAGE0 0x00400 | ||
359 | #define ARCMSR_ARC1214_INBOUND_MESSAGE1 0x00404 | ||
360 | #define ARCMSR_ARC1214_OUTBOUND_MESSAGE0 0x00420 | ||
361 | #define ARCMSR_ARC1214_OUTBOUND_MESSAGE1 0x00424 | ||
362 | #define ARCMSR_ARC1214_INBOUND_DOORBELL 0x00460 | ||
363 | #define ARCMSR_ARC1214_OUTBOUND_DOORBELL 0x00480 | ||
364 | #define ARCMSR_ARC1214_OUTBOUND_DOORBELL_ENABLE 0x00484 | ||
365 | #define ARCMSR_ARC1214_INBOUND_LIST_BASE_LOW 0x01000 | ||
366 | #define ARCMSR_ARC1214_INBOUND_LIST_BASE_HIGH 0x01004 | ||
367 | #define ARCMSR_ARC1214_INBOUND_LIST_WRITE_POINTER 0x01018 | ||
368 | #define ARCMSR_ARC1214_OUTBOUND_LIST_BASE_LOW 0x01060 | ||
369 | #define ARCMSR_ARC1214_OUTBOUND_LIST_BASE_HIGH 0x01064 | ||
370 | #define ARCMSR_ARC1214_OUTBOUND_LIST_COPY_POINTER 0x0106C | ||
371 | #define ARCMSR_ARC1214_OUTBOUND_LIST_READ_POINTER 0x01070 | ||
372 | #define ARCMSR_ARC1214_OUTBOUND_INTERRUPT_CAUSE 0x01088 | ||
373 | #define ARCMSR_ARC1214_OUTBOUND_INTERRUPT_ENABLE 0x0108C | ||
374 | #define ARCMSR_ARC1214_MESSAGE_WBUFFER 0x02000 | ||
375 | #define ARCMSR_ARC1214_MESSAGE_RBUFFER 0x02100 | ||
376 | #define ARCMSR_ARC1214_MESSAGE_RWBUFFER 0x02200 | ||
377 | /* Host Interrupt Mask */ | ||
378 | #define ARCMSR_ARC1214_ALL_INT_ENABLE 0x00001010 | ||
379 | #define ARCMSR_ARC1214_ALL_INT_DISABLE 0x00000000 | ||
380 | /* Host Interrupt Status */ | ||
381 | #define ARCMSR_ARC1214_OUTBOUND_DOORBELL_ISR 0x00001000 | ||
382 | #define ARCMSR_ARC1214_OUTBOUND_POSTQUEUE_ISR 0x00000010 | ||
383 | /* DoorBell*/ | ||
384 | #define ARCMSR_ARC1214_DRV2IOP_DATA_IN_READY 0x00000001 | ||
385 | #define ARCMSR_ARC1214_DRV2IOP_DATA_OUT_READ 0x00000002 | ||
386 | /*inbound message 0 ready*/ | ||
387 | #define ARCMSR_ARC1214_IOP2DRV_DATA_WRITE_OK 0x00000001 | ||
388 | /*outbound DATA WRITE isr door bell clear*/ | ||
389 | #define ARCMSR_ARC1214_IOP2DRV_DATA_READ_OK 0x00000002 | ||
390 | /*outbound message 0 ready*/ | ||
391 | #define ARCMSR_ARC1214_IOP2DRV_MESSAGE_CMD_DONE 0x02000000 | ||
392 | /*outbound message cmd isr door bell clear*/ | ||
393 | /*ARCMSR_HBAMU_MESSAGE_FIRMWARE_OK*/ | ||
394 | #define ARCMSR_ARC1214_MESSAGE_FIRMWARE_OK 0x80000000 | ||
395 | #define ARCMSR_ARC1214_OUTBOUND_LIST_INTERRUPT_CLEAR 0x00000001 | ||
396 | /* | ||
397 | ******************************************************************************* | ||
340 | ** ARECA SCSI COMMAND DESCRIPTOR BLOCK size 0x1F8 (504) | 398 | ** ARECA SCSI COMMAND DESCRIPTOR BLOCK size 0x1F8 (504) |
341 | ******************************************************************************* | 399 | ******************************************************************************* |
342 | */ | 400 | */ |
@@ -357,7 +415,7 @@ struct ARCMSR_CDB | |||
357 | #define ARCMSR_CDB_FLAG_ORDEREDQ 0x10 | 415 | #define ARCMSR_CDB_FLAG_ORDEREDQ 0x10 |
358 | 416 | ||
359 | uint8_t msgPages; | 417 | uint8_t msgPages; |
360 | uint32_t Context; | 418 | uint32_t msgContext; |
361 | uint32_t DataLength; | 419 | uint32_t DataLength; |
362 | uint8_t Cdb[16]; | 420 | uint8_t Cdb[16]; |
363 | uint8_t DeviceStatus; | 421 | uint8_t DeviceStatus; |
@@ -494,6 +552,56 @@ struct MessageUnit_C{ | |||
494 | uint32_t msgcode_rwbuffer[256]; /*2200 23FF*/ | 552 | uint32_t msgcode_rwbuffer[256]; /*2200 23FF*/ |
495 | }; | 553 | }; |
496 | /* | 554 | /* |
555 | ********************************************************************* | ||
556 | ** Messaging Unit (MU) of Type D processor | ||
557 | ********************************************************************* | ||
558 | */ | ||
559 | struct InBound_SRB { | ||
560 | uint32_t addressLow; /* pointer to SRB block */ | ||
561 | uint32_t addressHigh; | ||
562 | uint32_t length; /* in DWORDs */ | ||
563 | uint32_t reserved0; | ||
564 | }; | ||
565 | |||
566 | struct OutBound_SRB { | ||
567 | uint32_t addressLow; /* pointer to SRB block */ | ||
568 | uint32_t addressHigh; | ||
569 | }; | ||
570 | |||
571 | struct MessageUnit_D { | ||
572 | struct InBound_SRB post_qbuffer[ARCMSR_MAX_ARC1214_POSTQUEUE]; | ||
573 | volatile struct OutBound_SRB | ||
574 | done_qbuffer[ARCMSR_MAX_ARC1214_DONEQUEUE]; | ||
575 | u16 postq_index; | ||
576 | volatile u16 doneq_index; | ||
577 | u32 __iomem *chip_id; /* 0x00004 */ | ||
578 | u32 __iomem *cpu_mem_config; /* 0x00008 */ | ||
579 | u32 __iomem *i2o_host_interrupt_mask; /* 0x00034 */ | ||
580 | u32 __iomem *sample_at_reset; /* 0x00100 */ | ||
581 | u32 __iomem *reset_request; /* 0x00108 */ | ||
582 | u32 __iomem *host_int_status; /* 0x00200 */ | ||
583 | u32 __iomem *pcief0_int_enable; /* 0x0020C */ | ||
584 | u32 __iomem *inbound_msgaddr0; /* 0x00400 */ | ||
585 | u32 __iomem *inbound_msgaddr1; /* 0x00404 */ | ||
586 | u32 __iomem *outbound_msgaddr0; /* 0x00420 */ | ||
587 | u32 __iomem *outbound_msgaddr1; /* 0x00424 */ | ||
588 | u32 __iomem *inbound_doorbell; /* 0x00460 */ | ||
589 | u32 __iomem *outbound_doorbell; /* 0x00480 */ | ||
590 | u32 __iomem *outbound_doorbell_enable; /* 0x00484 */ | ||
591 | u32 __iomem *inboundlist_base_low; /* 0x01000 */ | ||
592 | u32 __iomem *inboundlist_base_high; /* 0x01004 */ | ||
593 | u32 __iomem *inboundlist_write_pointer; /* 0x01018 */ | ||
594 | u32 __iomem *outboundlist_base_low; /* 0x01060 */ | ||
595 | u32 __iomem *outboundlist_base_high; /* 0x01064 */ | ||
596 | u32 __iomem *outboundlist_copy_pointer; /* 0x0106C */ | ||
597 | u32 __iomem *outboundlist_read_pointer; /* 0x01070 0x01072 */ | ||
598 | u32 __iomem *outboundlist_interrupt_cause; /* 0x1088 */ | ||
599 | u32 __iomem *outboundlist_interrupt_enable; /* 0x108C */ | ||
600 | u32 __iomem *message_wbuffer; /* 0x2000 */ | ||
601 | u32 __iomem *message_rbuffer; /* 0x2100 */ | ||
602 | u32 __iomem *msgcode_rwbuffer; /* 0x2200 */ | ||
603 | }; | ||
604 | /* | ||
497 | ******************************************************************************* | 605 | ******************************************************************************* |
498 | ** Adapter Control Block | 606 | ** Adapter Control Block |
499 | ******************************************************************************* | 607 | ******************************************************************************* |
@@ -505,19 +613,26 @@ struct AdapterControlBlock | |||
505 | #define ACB_ADAPTER_TYPE_B 0x00000002 /* hbb M IOP */ | 613 | #define ACB_ADAPTER_TYPE_B 0x00000002 /* hbb M IOP */ |
506 | #define ACB_ADAPTER_TYPE_C 0x00000004 /* hbc P IOP */ | 614 | #define ACB_ADAPTER_TYPE_C 0x00000004 /* hbc P IOP */ |
507 | #define ACB_ADAPTER_TYPE_D 0x00000008 /* hbd A IOP */ | 615 | #define ACB_ADAPTER_TYPE_D 0x00000008 /* hbd A IOP */ |
616 | u32 roundup_ccbsize; | ||
508 | struct pci_dev * pdev; | 617 | struct pci_dev * pdev; |
509 | struct Scsi_Host * host; | 618 | struct Scsi_Host * host; |
510 | unsigned long vir2phy_offset; | 619 | unsigned long vir2phy_offset; |
620 | struct msix_entry entries[ARCMST_NUM_MSIX_VECTORS]; | ||
511 | /* Offset is used in making arc cdb physical to virtual calculations */ | 621 | /* Offset is used in making arc cdb physical to virtual calculations */ |
512 | uint32_t outbound_int_enable; | 622 | uint32_t outbound_int_enable; |
513 | uint32_t cdb_phyaddr_hi32; | 623 | uint32_t cdb_phyaddr_hi32; |
514 | uint32_t reg_mu_acc_handle0; | 624 | uint32_t reg_mu_acc_handle0; |
515 | spinlock_t eh_lock; | 625 | spinlock_t eh_lock; |
516 | spinlock_t ccblist_lock; | 626 | spinlock_t ccblist_lock; |
627 | spinlock_t postq_lock; | ||
628 | spinlock_t doneq_lock; | ||
629 | spinlock_t rqbuffer_lock; | ||
630 | spinlock_t wqbuffer_lock; | ||
517 | union { | 631 | union { |
518 | struct MessageUnit_A __iomem *pmuA; | 632 | struct MessageUnit_A __iomem *pmuA; |
519 | struct MessageUnit_B *pmuB; | 633 | struct MessageUnit_B *pmuB; |
520 | struct MessageUnit_C __iomem *pmuC; | 634 | struct MessageUnit_C __iomem *pmuC; |
635 | struct MessageUnit_D *pmuD; | ||
521 | }; | 636 | }; |
522 | /* message unit ATU inbound base address0 */ | 637 | /* message unit ATU inbound base address0 */ |
523 | void __iomem *mem_base0; | 638 | void __iomem *mem_base0; |
@@ -544,6 +659,8 @@ struct AdapterControlBlock | |||
544 | /* iop init */ | 659 | /* iop init */ |
545 | #define ACB_F_ABORT 0x0200 | 660 | #define ACB_F_ABORT 0x0200 |
546 | #define ACB_F_FIRMWARE_TRAP 0x0400 | 661 | #define ACB_F_FIRMWARE_TRAP 0x0400 |
662 | #define ACB_F_MSI_ENABLED 0x1000 | ||
663 | #define ACB_F_MSIX_ENABLED 0x2000 | ||
547 | struct CommandControlBlock * pccb_pool[ARCMSR_MAX_FREECCB_NUM]; | 664 | struct CommandControlBlock * pccb_pool[ARCMSR_MAX_FREECCB_NUM]; |
548 | /* used for memory free */ | 665 | /* used for memory free */ |
549 | struct list_head ccb_free_list; | 666 | struct list_head ccb_free_list; |
@@ -557,19 +674,20 @@ struct AdapterControlBlock | |||
557 | /* dma_coherent used for memory free */ | 674 | /* dma_coherent used for memory free */ |
558 | dma_addr_t dma_coherent_handle; | 675 | dma_addr_t dma_coherent_handle; |
559 | /* dma_coherent_handle used for memory free */ | 676 | /* dma_coherent_handle used for memory free */ |
560 | dma_addr_t dma_coherent_handle_hbb_mu; | 677 | dma_addr_t dma_coherent_handle2; |
678 | void *dma_coherent2; | ||
561 | unsigned int uncache_size; | 679 | unsigned int uncache_size; |
562 | uint8_t rqbuffer[ARCMSR_MAX_QBUFFER]; | 680 | uint8_t rqbuffer[ARCMSR_MAX_QBUFFER]; |
563 | /* data collection buffer for read from 80331 */ | 681 | /* data collection buffer for read from 80331 */ |
564 | int32_t rqbuf_firstindex; | 682 | int32_t rqbuf_getIndex; |
565 | /* first of read buffer */ | 683 | /* first of read buffer */ |
566 | int32_t rqbuf_lastindex; | 684 | int32_t rqbuf_putIndex; |
567 | /* last of read buffer */ | 685 | /* last of read buffer */ |
568 | uint8_t wqbuffer[ARCMSR_MAX_QBUFFER]; | 686 | uint8_t wqbuffer[ARCMSR_MAX_QBUFFER]; |
569 | /* data collection buffer for write to 80331 */ | 687 | /* data collection buffer for write to 80331 */ |
570 | int32_t wqbuf_firstindex; | 688 | int32_t wqbuf_getIndex; |
571 | /* first of write buffer */ | 689 | /* first of write buffer */ |
572 | int32_t wqbuf_lastindex; | 690 | int32_t wqbuf_putIndex; |
573 | /* last of write buffer */ | 691 | /* last of write buffer */ |
574 | uint8_t devstate[ARCMSR_MAX_TARGETID][ARCMSR_MAX_TARGETLUN]; | 692 | uint8_t devstate[ARCMSR_MAX_TARGETID][ARCMSR_MAX_TARGETLUN]; |
575 | /* id0 ..... id15, lun0...lun7 */ | 693 | /* id0 ..... id15, lun0...lun7 */ |
@@ -594,6 +712,8 @@ struct AdapterControlBlock | |||
594 | #define FW_DEADLOCK 0x0010 | 712 | #define FW_DEADLOCK 0x0010 |
595 | atomic_t rq_map_token; | 713 | atomic_t rq_map_token; |
596 | atomic_t ante_token_value; | 714 | atomic_t ante_token_value; |
715 | uint32_t maxOutstanding; | ||
716 | int msix_vector_count; | ||
597 | };/* HW_DEVICE_EXTENSION */ | 717 | };/* HW_DEVICE_EXTENSION */ |
598 | /* | 718 | /* |
599 | ******************************************************************************* | 719 | ******************************************************************************* |
@@ -606,7 +726,7 @@ struct CommandControlBlock{ | |||
606 | struct list_head list; /*x32: 8byte, x64: 16byte*/ | 726 | struct list_head list; /*x32: 8byte, x64: 16byte*/ |
607 | struct scsi_cmnd *pcmd; /*8 bytes pointer of linux scsi command */ | 727 | struct scsi_cmnd *pcmd; /*8 bytes pointer of linux scsi command */ |
608 | struct AdapterControlBlock *acb; /*x32: 4byte, x64: 8byte*/ | 728 | struct AdapterControlBlock *acb; /*x32: 4byte, x64: 8byte*/ |
609 | uint32_t cdb_phyaddr_pattern; /*x32: 4byte, x64: 4byte*/ | 729 | uint32_t cdb_phyaddr; /*x32: 4byte, x64: 4byte*/ |
610 | uint32_t arc_cdb_size; /*x32:4byte,x64:4byte*/ | 730 | uint32_t arc_cdb_size; /*x32:4byte,x64:4byte*/ |
611 | uint16_t ccb_flags; /*x32: 2byte, x64: 2byte*/ | 731 | uint16_t ccb_flags; /*x32: 2byte, x64: 2byte*/ |
612 | #define CCB_FLAG_READ 0x0000 | 732 | #define CCB_FLAG_READ 0x0000 |
@@ -684,8 +804,10 @@ struct SENSE_DATA | |||
684 | #define ARCMSR_MU_OUTBOUND_MESSAGE0_INTMASKENABLE 0x01 | 804 | #define ARCMSR_MU_OUTBOUND_MESSAGE0_INTMASKENABLE 0x01 |
685 | #define ARCMSR_MU_OUTBOUND_ALL_INTMASKENABLE 0x1F | 805 | #define ARCMSR_MU_OUTBOUND_ALL_INTMASKENABLE 0x1F |
686 | 806 | ||
687 | extern void arcmsr_post_ioctldata2iop(struct AdapterControlBlock *); | 807 | extern void arcmsr_write_ioctldata2iop(struct AdapterControlBlock *); |
688 | extern void arcmsr_iop_message_read(struct AdapterControlBlock *); | 808 | extern uint32_t arcmsr_Read_iop_rqbuffer_data(struct AdapterControlBlock *, |
809 | struct QBUFFER __iomem *); | ||
810 | extern void arcmsr_clear_iop2drv_rqueue_buffer(struct AdapterControlBlock *); | ||
689 | extern struct QBUFFER __iomem *arcmsr_get_iop_rqbuffer(struct AdapterControlBlock *); | 811 | extern struct QBUFFER __iomem *arcmsr_get_iop_rqbuffer(struct AdapterControlBlock *); |
690 | extern struct device_attribute *arcmsr_host_attrs[]; | 812 | extern struct device_attribute *arcmsr_host_attrs[]; |
691 | extern int arcmsr_alloc_sysfs_attr(struct AdapterControlBlock *); | 813 | extern int arcmsr_alloc_sysfs_attr(struct AdapterControlBlock *); |