30 #ifndef LSI_MEGARAID_SAS_H
31 #define LSI_MEGARAID_SAS_H
36 #define MEGASAS_VERSION "06.504.01.00-rc1"
37 #define MEGASAS_RELDATE "Oct. 1, 2012"
38 #define MEGASAS_EXT_VERSION "Mon. Oct. 1 17:00:00 PDT 2012"
43 #define PCI_DEVICE_ID_LSI_SAS1078R 0x0060
44 #define PCI_DEVICE_ID_LSI_SAS1078DE 0x007C
45 #define PCI_DEVICE_ID_LSI_VERDE_ZCR 0x0413
46 #define PCI_DEVICE_ID_LSI_SAS1078GEN2 0x0078
47 #define PCI_DEVICE_ID_LSI_SAS0079GEN2 0x0079
48 #define PCI_DEVICE_ID_LSI_SAS0073SKINNY 0x0073
49 #define PCI_DEVICE_ID_LSI_SAS0071SKINNY 0x0071
50 #define PCI_DEVICE_ID_LSI_FUSION 0x005b
51 #define PCI_DEVICE_ID_LSI_INVADER 0x005d
68 #define MFI_STATE_MASK 0xF0000000
69 #define MFI_STATE_UNDEFINED 0x00000000
70 #define MFI_STATE_BB_INIT 0x10000000
71 #define MFI_STATE_FW_INIT 0x40000000
72 #define MFI_STATE_WAIT_HANDSHAKE 0x60000000
73 #define MFI_STATE_FW_INIT_2 0x70000000
74 #define MFI_STATE_DEVICE_SCAN 0x80000000
75 #define MFI_STATE_BOOT_MESSAGE_PENDING 0x90000000
76 #define MFI_STATE_FLUSH_CACHE 0xA0000000
77 #define MFI_STATE_READY 0xB0000000
78 #define MFI_STATE_OPERATIONAL 0xC0000000
79 #define MFI_STATE_FAULT 0xF0000000
80 #define MFI_RESET_REQUIRED 0x00000001
81 #define MFI_RESET_ADAPTER 0x00000002
82 #define MEGAMFI_FRAME_SIZE 64
94 #define WRITE_SEQUENCE_OFFSET (0x0000000FC)
95 #define HOST_DIAGNOSTIC_OFFSET (0x000000F8)
96 #define DIAG_WRITE_ENABLE (0x00000080)
97 #define DIAG_RESET_ADAPTER (0x00000004)
99 #define MFI_ADP_RESET 0x00000040
100 #define MFI_INIT_ABORT 0x00000001
101 #define MFI_INIT_READY 0x00000002
102 #define MFI_INIT_MFIMODE 0x00000004
103 #define MFI_INIT_CLEAR_HANDSHAKE 0x00000008
104 #define MFI_INIT_HOTPLUG 0x00000010
105 #define MFI_STOP_ADP 0x00000020
106 #define MFI_RESET_FLAGS MFI_INIT_READY| \
113 #define MFI_FRAME_POST_IN_REPLY_QUEUE 0x0000
114 #define MFI_FRAME_DONT_POST_IN_REPLY_QUEUE 0x0001
115 #define MFI_FRAME_SGL32 0x0000
116 #define MFI_FRAME_SGL64 0x0002
117 #define MFI_FRAME_SENSE32 0x0000
118 #define MFI_FRAME_SENSE64 0x0004
119 #define MFI_FRAME_DIR_NONE 0x0000
120 #define MFI_FRAME_DIR_WRITE 0x0008
121 #define MFI_FRAME_DIR_READ 0x0010
122 #define MFI_FRAME_DIR_BOTH 0x0018
123 #define MFI_FRAME_IEEE 0x0020
128 #define MFI_CMD_STATUS_POLL_MODE 0xFF
133 #define MFI_CMD_INIT 0x00
134 #define MFI_CMD_LD_READ 0x01
135 #define MFI_CMD_LD_WRITE 0x02
136 #define MFI_CMD_LD_SCSI_IO 0x03
137 #define MFI_CMD_PD_SCSI_IO 0x04
138 #define MFI_CMD_DCMD 0x05
139 #define MFI_CMD_ABORT 0x06
140 #define MFI_CMD_SMP 0x07
141 #define MFI_CMD_STP 0x08
142 #define MFI_CMD_INVALID 0xff
144 #define MR_DCMD_CTRL_GET_INFO 0x01010000
145 #define MR_DCMD_LD_GET_LIST 0x03010000
147 #define MR_DCMD_CTRL_CACHE_FLUSH 0x01101000
148 #define MR_FLUSH_CTRL_CACHE 0x01
149 #define MR_FLUSH_DISK_CACHE 0x02
151 #define MR_DCMD_CTRL_SHUTDOWN 0x01050000
152 #define MR_DCMD_HIBERNATE_SHUTDOWN 0x01060000
153 #define MR_ENABLE_DRIVE_SPINDOWN 0x01
155 #define MR_DCMD_CTRL_EVENT_GET_INFO 0x01040100
156 #define MR_DCMD_CTRL_EVENT_GET 0x01040300
157 #define MR_DCMD_CTRL_EVENT_WAIT 0x01040500
158 #define MR_DCMD_LD_GET_PROPERTIES 0x03030000
160 #define MR_DCMD_CLUSTER 0x08000000
161 #define MR_DCMD_CLUSTER_RESET_ALL 0x08010100
162 #define MR_DCMD_CLUSTER_RESET_LD 0x08010200
163 #define MR_DCMD_PD_LIST_QUERY 0x02010100
234 #define MFI_MBOX_SIZE 12
315 #define MR_EVT_CFG_CLEARED 0x0004
316 #define MR_EVT_LD_STATE_CHANGE 0x0051
317 #define MR_EVT_PD_INSERTED 0x005b
318 #define MR_EVT_PD_REMOVED 0x0070
319 #define MR_EVT_LD_CREATED 0x008a
320 #define MR_EVT_LD_DELETED 0x008b
321 #define MR_EVT_FOREIGN_CFG_IMPORTED 0x00db
322 #define MR_EVT_LD_OFFLINE 0x00fc
323 #define MR_EVT_CTRL_HOST_BUS_SCAN_REQUESTED 0x0152
324 #define MAX_LOGICAL_DRIVES 64
714 #define MEGASAS_MAX_PD_CHANNELS 2
715 #define MEGASAS_MAX_LD_CHANNELS 2
716 #define MEGASAS_MAX_CHANNELS (MEGASAS_MAX_PD_CHANNELS + \
717 MEGASAS_MAX_LD_CHANNELS)
718 #define MEGASAS_MAX_DEV_PER_CHANNEL 128
719 #define MEGASAS_DEFAULT_INIT_ID -1
720 #define MEGASAS_MAX_LUN 8
721 #define MEGASAS_MAX_LD 64
722 #define MEGASAS_DEFAULT_CMD_PER_LUN 256
723 #define MEGASAS_MAX_PD (MEGASAS_MAX_PD_CHANNELS * \
724 MEGASAS_MAX_DEV_PER_CHANNEL)
725 #define MEGASAS_MAX_LD_IDS (MEGASAS_MAX_LD_CHANNELS * \
726 MEGASAS_MAX_DEV_PER_CHANNEL)
728 #define MEGASAS_MAX_SECTORS (2*1024)
729 #define MEGASAS_MAX_SECTORS_IEEE (2*128)
730 #define MEGASAS_DBG_LVL 1
732 #define MEGASAS_FW_BUSY 1
736 #define PTHRU_FRAME 1
745 #define MEGASAS_RESET_WAIT_TIME 180
746 #define MEGASAS_INTERNAL_CMD_WAIT_TIME 180
747 #define MEGASAS_RESET_NOTICE_INTERVAL 5
748 #define MEGASAS_IOCTL_CMD 0
749 #define MEGASAS_DEFAULT_CMD_TIMEOUT 90
750 #define MEGASAS_THROTTLE_QUEUE_DEPTH 16
759 #define MEGASAS_INT_CMDS 32
760 #define MEGASAS_SKINNY_INT_CMDS 5
762 #define MEGASAS_MAX_MSIX_QUEUES 16
767 #define IS_DMA64 (sizeof(dma_addr_t) == 8)
769 #define MFI_XSCALE_OMR0_CHANGE_INTERRUPT 0x00000001
771 #define MFI_INTR_FLAG_REPLY_MESSAGE 0x00000001
772 #define MFI_INTR_FLAG_FIRMWARE_STATE_CHANGE 0x00000002
773 #define MFI_G2_OUTBOUND_DOORBELL_CHANGE_INTERRUPT 0x00000004
775 #define MFI_OB_INTR_STATUS_MASK 0x00000002
776 #define MFI_POLL_TIMEOUT_SECS 60
778 #define MFI_REPLY_1078_MESSAGE_INTERRUPT 0x80000000
779 #define MFI_REPLY_GEN2_MESSAGE_INTERRUPT 0x00000001
780 #define MFI_GEN2_ENABLE_INTERRUPT_MASK (0x00000001 | 0x00000004)
781 #define MFI_REPLY_SKINNY_MESSAGE_INTERRUPT 0x40000000
782 #define MFI_SKINNY_ENABLE_INTERRUPT_MASK (0x00000001)
784 #define MFI_1068_PCSR_OFFSET 0x84
785 #define MFI_1068_FW_HANDSHAKE_OFFSET 0x64
786 #define MFI_1068_FW_READY 0xDDDD0000
1403 #define MEGASAS_IS_LOGICAL(scp) \
1404 (scp->device->channel < MEGASAS_MAX_PD_CHANNELS) ? 0 : 1
1406 #define MEGASAS_DEV_INDEX(inst, scp) \
1407 ((scp->device->channel % 2) * MEGASAS_MAX_DEV_PER_CHANNEL) + \
1436 #define MAX_MGMT_ADAPTERS 1024
1437 #define MAX_IOCTL_SGE 16
1463 #ifdef CONFIG_COMPAT
1464 struct compat_megasas_iocpacket {
1478 #define MEGASAS_IOC_FIRMWARE32 _IOWR('M', 1, struct compat_megasas_iocpacket)
1481 #define MEGASAS_IOC_FIRMWARE _IOWR('M', 1, struct megasas_iocpacket)
1482 #define MEGASAS_IOC_GET_AEN _IOW('M', 3, struct megasas_aen)
1491 #define msi_control_reg(base) (base + PCI_MSI_FLAGS)
1492 #define PCI_MSIX_FLAGS_ENABLE (1 << 15)