diff options
Diffstat (limited to 'drivers/scsi/megaraid/megaraid_sas.h')
-rw-r--r-- | drivers/scsi/megaraid/megaraid_sas.h | 149 |
1 files changed, 134 insertions, 15 deletions
diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 0d033248fdf1..72b28e436e32 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h | |||
@@ -18,9 +18,9 @@ | |||
18 | /* | 18 | /* |
19 | * MegaRAID SAS Driver meta data | 19 | * MegaRAID SAS Driver meta data |
20 | */ | 20 | */ |
21 | #define MEGASAS_VERSION "00.00.04.01" | 21 | #define MEGASAS_VERSION "00.00.04.12-rc1" |
22 | #define MEGASAS_RELDATE "July 24, 2008" | 22 | #define MEGASAS_RELDATE "Sep. 17, 2009" |
23 | #define MEGASAS_EXT_VERSION "Thu July 24 11:41:51 PST 2008" | 23 | #define MEGASAS_EXT_VERSION "Thu Sep. 17 11:41:51 PST 2009" |
24 | 24 | ||
25 | /* | 25 | /* |
26 | * Device IDs | 26 | * Device IDs |
@@ -30,6 +30,8 @@ | |||
30 | #define PCI_DEVICE_ID_LSI_VERDE_ZCR 0x0413 | 30 | #define PCI_DEVICE_ID_LSI_VERDE_ZCR 0x0413 |
31 | #define PCI_DEVICE_ID_LSI_SAS1078GEN2 0x0078 | 31 | #define PCI_DEVICE_ID_LSI_SAS1078GEN2 0x0078 |
32 | #define PCI_DEVICE_ID_LSI_SAS0079GEN2 0x0079 | 32 | #define PCI_DEVICE_ID_LSI_SAS0079GEN2 0x0079 |
33 | #define PCI_DEVICE_ID_LSI_SAS0073SKINNY 0x0073 | ||
34 | #define PCI_DEVICE_ID_LSI_SAS0071SKINNY 0x0071 | ||
33 | 35 | ||
34 | /* | 36 | /* |
35 | * ===================================== | 37 | * ===================================== |
@@ -94,6 +96,7 @@ | |||
94 | #define MFI_FRAME_DIR_WRITE 0x0008 | 96 | #define MFI_FRAME_DIR_WRITE 0x0008 |
95 | #define MFI_FRAME_DIR_READ 0x0010 | 97 | #define MFI_FRAME_DIR_READ 0x0010 |
96 | #define MFI_FRAME_DIR_BOTH 0x0018 | 98 | #define MFI_FRAME_DIR_BOTH 0x0018 |
99 | #define MFI_FRAME_IEEE 0x0020 | ||
97 | 100 | ||
98 | /* | 101 | /* |
99 | * Definition for cmd_status | 102 | * Definition for cmd_status |
@@ -131,6 +134,7 @@ | |||
131 | #define MR_DCMD_CLUSTER 0x08000000 | 134 | #define MR_DCMD_CLUSTER 0x08000000 |
132 | #define MR_DCMD_CLUSTER_RESET_ALL 0x08010100 | 135 | #define MR_DCMD_CLUSTER_RESET_ALL 0x08010100 |
133 | #define MR_DCMD_CLUSTER_RESET_LD 0x08010200 | 136 | #define MR_DCMD_CLUSTER_RESET_LD 0x08010200 |
137 | #define MR_DCMD_PD_LIST_QUERY 0x02010100 | ||
134 | 138 | ||
135 | /* | 139 | /* |
136 | * MFI command completion codes | 140 | * MFI command completion codes |
@@ -251,9 +255,100 @@ enum MR_EVT_ARGS { | |||
251 | MR_EVT_ARGS_STR, | 255 | MR_EVT_ARGS_STR, |
252 | MR_EVT_ARGS_TIME, | 256 | MR_EVT_ARGS_TIME, |
253 | MR_EVT_ARGS_ECC, | 257 | MR_EVT_ARGS_ECC, |
258 | MR_EVT_ARGS_LD_PROP, | ||
259 | MR_EVT_ARGS_PD_SPARE, | ||
260 | MR_EVT_ARGS_PD_INDEX, | ||
261 | MR_EVT_ARGS_DIAG_PASS, | ||
262 | MR_EVT_ARGS_DIAG_FAIL, | ||
263 | MR_EVT_ARGS_PD_LBA_LBA, | ||
264 | MR_EVT_ARGS_PORT_PHY, | ||
265 | MR_EVT_ARGS_PD_MISSING, | ||
266 | MR_EVT_ARGS_PD_ADDRESS, | ||
267 | MR_EVT_ARGS_BITMAP, | ||
268 | MR_EVT_ARGS_CONNECTOR, | ||
269 | MR_EVT_ARGS_PD_PD, | ||
270 | MR_EVT_ARGS_PD_FRU, | ||
271 | MR_EVT_ARGS_PD_PATHINFO, | ||
272 | MR_EVT_ARGS_PD_POWER_STATE, | ||
273 | MR_EVT_ARGS_GENERIC, | ||
274 | }; | ||
254 | 275 | ||
276 | /* | ||
277 | * define constants for device list query options | ||
278 | */ | ||
279 | enum MR_PD_QUERY_TYPE { | ||
280 | MR_PD_QUERY_TYPE_ALL = 0, | ||
281 | MR_PD_QUERY_TYPE_STATE = 1, | ||
282 | MR_PD_QUERY_TYPE_POWER_STATE = 2, | ||
283 | MR_PD_QUERY_TYPE_MEDIA_TYPE = 3, | ||
284 | MR_PD_QUERY_TYPE_SPEED = 4, | ||
285 | MR_PD_QUERY_TYPE_EXPOSED_TO_HOST = 5, | ||
255 | }; | 286 | }; |
256 | 287 | ||
288 | #define MR_EVT_CFG_CLEARED 0x0004 | ||
289 | #define MR_EVT_LD_STATE_CHANGE 0x0051 | ||
290 | #define MR_EVT_PD_INSERTED 0x005b | ||
291 | #define MR_EVT_PD_REMOVED 0x0070 | ||
292 | #define MR_EVT_LD_CREATED 0x008a | ||
293 | #define MR_EVT_LD_DELETED 0x008b | ||
294 | #define MR_EVT_FOREIGN_CFG_IMPORTED 0x00db | ||
295 | #define MR_EVT_LD_OFFLINE 0x00fc | ||
296 | #define MR_EVT_CTRL_HOST_BUS_SCAN_REQUESTED 0x0152 | ||
297 | #define MAX_LOGICAL_DRIVES 64 | ||
298 | |||
299 | enum MR_PD_STATE { | ||
300 | MR_PD_STATE_UNCONFIGURED_GOOD = 0x00, | ||
301 | MR_PD_STATE_UNCONFIGURED_BAD = 0x01, | ||
302 | MR_PD_STATE_HOT_SPARE = 0x02, | ||
303 | MR_PD_STATE_OFFLINE = 0x10, | ||
304 | MR_PD_STATE_FAILED = 0x11, | ||
305 | MR_PD_STATE_REBUILD = 0x14, | ||
306 | MR_PD_STATE_ONLINE = 0x18, | ||
307 | MR_PD_STATE_COPYBACK = 0x20, | ||
308 | MR_PD_STATE_SYSTEM = 0x40, | ||
309 | }; | ||
310 | |||
311 | |||
312 | /* | ||
313 | * defines the physical drive address structure | ||
314 | */ | ||
315 | struct MR_PD_ADDRESS { | ||
316 | u16 deviceId; | ||
317 | u16 enclDeviceId; | ||
318 | |||
319 | union { | ||
320 | struct { | ||
321 | u8 enclIndex; | ||
322 | u8 slotNumber; | ||
323 | } mrPdAddress; | ||
324 | struct { | ||
325 | u8 enclPosition; | ||
326 | u8 enclConnectorIndex; | ||
327 | } mrEnclAddress; | ||
328 | }; | ||
329 | u8 scsiDevType; | ||
330 | union { | ||
331 | u8 connectedPortBitmap; | ||
332 | u8 connectedPortNumbers; | ||
333 | }; | ||
334 | u64 sasAddr[2]; | ||
335 | } __packed; | ||
336 | |||
337 | /* | ||
338 | * defines the physical drive list structure | ||
339 | */ | ||
340 | struct MR_PD_LIST { | ||
341 | u32 size; | ||
342 | u32 count; | ||
343 | struct MR_PD_ADDRESS addr[1]; | ||
344 | } __packed; | ||
345 | |||
346 | struct megasas_pd_list { | ||
347 | u16 tid; | ||
348 | u8 driveType; | ||
349 | u8 driveState; | ||
350 | } __packed; | ||
351 | |||
257 | /* | 352 | /* |
258 | * SAS controller properties | 353 | * SAS controller properties |
259 | */ | 354 | */ |
@@ -282,7 +377,7 @@ struct megasas_ctrl_prop { | |||
282 | u8 expose_encl_devices; | 377 | u8 expose_encl_devices; |
283 | u8 reserved[38]; | 378 | u8 reserved[38]; |
284 | 379 | ||
285 | } __attribute__ ((packed)); | 380 | } __packed; |
286 | 381 | ||
287 | /* | 382 | /* |
288 | * SAS controller information | 383 | * SAS controller information |
@@ -525,7 +620,7 @@ struct megasas_ctrl_info { | |||
525 | 620 | ||
526 | u8 pad[0x800 - 0x6a0]; | 621 | u8 pad[0x800 - 0x6a0]; |
527 | 622 | ||
528 | } __attribute__ ((packed)); | 623 | } __packed; |
529 | 624 | ||
530 | /* | 625 | /* |
531 | * =============================== | 626 | * =============================== |
@@ -540,6 +635,8 @@ struct megasas_ctrl_info { | |||
540 | #define MEGASAS_DEFAULT_INIT_ID -1 | 635 | #define MEGASAS_DEFAULT_INIT_ID -1 |
541 | #define MEGASAS_MAX_LUN 8 | 636 | #define MEGASAS_MAX_LUN 8 |
542 | #define MEGASAS_MAX_LD 64 | 637 | #define MEGASAS_MAX_LD 64 |
638 | #define MEGASAS_MAX_PD (MEGASAS_MAX_PD_CHANNELS * \ | ||
639 | MEGASAS_MAX_DEV_PER_CHANNEL) | ||
543 | 640 | ||
544 | #define MEGASAS_DBG_LVL 1 | 641 | #define MEGASAS_DBG_LVL 1 |
545 | 642 | ||
@@ -570,6 +667,7 @@ struct megasas_ctrl_info { | |||
570 | * is shown below | 667 | * is shown below |
571 | */ | 668 | */ |
572 | #define MEGASAS_INT_CMDS 32 | 669 | #define MEGASAS_INT_CMDS 32 |
670 | #define MEGASAS_SKINNY_INT_CMDS 5 | ||
573 | 671 | ||
574 | /* | 672 | /* |
575 | * FW can accept both 32 and 64 bit SGLs. We want to allocate 32/64 bit | 673 | * FW can accept both 32 and 64 bit SGLs. We want to allocate 32/64 bit |
@@ -584,6 +682,8 @@ struct megasas_ctrl_info { | |||
584 | #define MFI_REPLY_1078_MESSAGE_INTERRUPT 0x80000000 | 682 | #define MFI_REPLY_1078_MESSAGE_INTERRUPT 0x80000000 |
585 | #define MFI_REPLY_GEN2_MESSAGE_INTERRUPT 0x00000001 | 683 | #define MFI_REPLY_GEN2_MESSAGE_INTERRUPT 0x00000001 |
586 | #define MFI_GEN2_ENABLE_INTERRUPT_MASK (0x00000001 | 0x00000004) | 684 | #define MFI_GEN2_ENABLE_INTERRUPT_MASK (0x00000001 | 0x00000004) |
685 | #define MFI_REPLY_SKINNY_MESSAGE_INTERRUPT 0x40000000 | ||
686 | #define MFI_SKINNY_ENABLE_INTERRUPT_MASK (0x00000001) | ||
587 | 687 | ||
588 | /* | 688 | /* |
589 | * register set for both 1068 and 1078 controllers | 689 | * register set for both 1068 and 1078 controllers |
@@ -644,10 +744,17 @@ struct megasas_sge64 { | |||
644 | 744 | ||
645 | } __attribute__ ((packed)); | 745 | } __attribute__ ((packed)); |
646 | 746 | ||
747 | struct megasas_sge_skinny { | ||
748 | u64 phys_addr; | ||
749 | u32 length; | ||
750 | u32 flag; | ||
751 | } __packed; | ||
752 | |||
647 | union megasas_sgl { | 753 | union megasas_sgl { |
648 | 754 | ||
649 | struct megasas_sge32 sge32[1]; | 755 | struct megasas_sge32 sge32[1]; |
650 | struct megasas_sge64 sge64[1]; | 756 | struct megasas_sge64 sge64[1]; |
757 | struct megasas_sge_skinny sge_skinny[1]; | ||
651 | 758 | ||
652 | } __attribute__ ((packed)); | 759 | } __attribute__ ((packed)); |
653 | 760 | ||
@@ -1061,16 +1168,10 @@ struct megasas_evt_detail { | |||
1061 | 1168 | ||
1062 | } __attribute__ ((packed)); | 1169 | } __attribute__ ((packed)); |
1063 | 1170 | ||
1064 | struct megasas_instance_template { | 1171 | struct megasas_aen_event { |
1065 | void (*fire_cmd)(dma_addr_t ,u32 ,struct megasas_register_set __iomem *); | 1172 | struct work_struct hotplug_work; |
1066 | 1173 | struct megasas_instance *instance; | |
1067 | void (*enable_intr)(struct megasas_register_set __iomem *) ; | 1174 | }; |
1068 | void (*disable_intr)(struct megasas_register_set __iomem *); | ||
1069 | |||
1070 | int (*clear_intr)(struct megasas_register_set __iomem *); | ||
1071 | |||
1072 | u32 (*read_fw_status_reg)(struct megasas_register_set __iomem *); | ||
1073 | }; | ||
1074 | 1175 | ||
1075 | struct megasas_instance { | 1176 | struct megasas_instance { |
1076 | 1177 | ||
@@ -1085,17 +1186,21 @@ struct megasas_instance { | |||
1085 | unsigned long base_addr; | 1186 | unsigned long base_addr; |
1086 | struct megasas_register_set __iomem *reg_set; | 1187 | struct megasas_register_set __iomem *reg_set; |
1087 | 1188 | ||
1189 | struct megasas_pd_list pd_list[MEGASAS_MAX_PD]; | ||
1088 | s8 init_id; | 1190 | s8 init_id; |
1089 | 1191 | ||
1090 | u16 max_num_sge; | 1192 | u16 max_num_sge; |
1091 | u16 max_fw_cmds; | 1193 | u16 max_fw_cmds; |
1092 | u32 max_sectors_per_req; | 1194 | u32 max_sectors_per_req; |
1195 | struct megasas_aen_event *ev; | ||
1093 | 1196 | ||
1094 | struct megasas_cmd **cmd_list; | 1197 | struct megasas_cmd **cmd_list; |
1095 | struct list_head cmd_pool; | 1198 | struct list_head cmd_pool; |
1096 | spinlock_t cmd_pool_lock; | 1199 | spinlock_t cmd_pool_lock; |
1097 | /* used to synch producer, consumer ptrs in dpc */ | 1200 | /* used to synch producer, consumer ptrs in dpc */ |
1098 | spinlock_t completion_lock; | 1201 | spinlock_t completion_lock; |
1202 | /* used to sync fire the cmd to fw */ | ||
1203 | spinlock_t fire_lock; | ||
1099 | struct dma_pool *frame_dma_pool; | 1204 | struct dma_pool *frame_dma_pool; |
1100 | struct dma_pool *sense_dma_pool; | 1205 | struct dma_pool *sense_dma_pool; |
1101 | 1206 | ||
@@ -1120,11 +1225,25 @@ struct megasas_instance { | |||
1120 | struct tasklet_struct isr_tasklet; | 1225 | struct tasklet_struct isr_tasklet; |
1121 | 1226 | ||
1122 | u8 flag; | 1227 | u8 flag; |
1228 | u8 unload; | ||
1229 | u8 flag_ieee; | ||
1123 | unsigned long last_time; | 1230 | unsigned long last_time; |
1124 | 1231 | ||
1125 | struct timer_list io_completion_timer; | 1232 | struct timer_list io_completion_timer; |
1126 | }; | 1233 | }; |
1127 | 1234 | ||
1235 | struct megasas_instance_template { | ||
1236 | void (*fire_cmd)(struct megasas_instance *, dma_addr_t, \ | ||
1237 | u32, struct megasas_register_set __iomem *); | ||
1238 | |||
1239 | void (*enable_intr)(struct megasas_register_set __iomem *) ; | ||
1240 | void (*disable_intr)(struct megasas_register_set __iomem *); | ||
1241 | |||
1242 | int (*clear_intr)(struct megasas_register_set __iomem *); | ||
1243 | |||
1244 | u32 (*read_fw_status_reg)(struct megasas_register_set __iomem *); | ||
1245 | }; | ||
1246 | |||
1128 | #define MEGASAS_IS_LOGICAL(scp) \ | 1247 | #define MEGASAS_IS_LOGICAL(scp) \ |
1129 | (scp->device->channel < MEGASAS_MAX_PD_CHANNELS) ? 0 : 1 | 1248 | (scp->device->channel < MEGASAS_MAX_PD_CHANNELS) ? 0 : 1 |
1130 | 1249 | ||