aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/megaraid/megaraid_sas.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/megaraid/megaraid_sas.h')
-rw-r--r--drivers/scsi/megaraid/megaraid_sas.h179
1 files changed, 164 insertions, 15 deletions
diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h
index 0d033248fdf1..9d8b6bf605aa 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.17.1-rc1"
22#define MEGASAS_RELDATE "July 24, 2008" 22#define MEGASAS_RELDATE "Oct. 29, 2009"
23#define MEGASAS_EXT_VERSION "Thu July 24 11:41:51 PST 2008" 23#define MEGASAS_EXT_VERSION "Thu. Oct. 29, 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
@@ -114,6 +117,7 @@
114#define MFI_CMD_STP 0x08 117#define MFI_CMD_STP 0x08
115 118
116#define MR_DCMD_CTRL_GET_INFO 0x01010000 119#define MR_DCMD_CTRL_GET_INFO 0x01010000
120#define MR_DCMD_LD_GET_LIST 0x03010000
117 121
118#define MR_DCMD_CTRL_CACHE_FLUSH 0x01101000 122#define MR_DCMD_CTRL_CACHE_FLUSH 0x01101000
119#define MR_FLUSH_CTRL_CACHE 0x01 123#define MR_FLUSH_CTRL_CACHE 0x01
@@ -131,6 +135,7 @@
131#define MR_DCMD_CLUSTER 0x08000000 135#define MR_DCMD_CLUSTER 0x08000000
132#define MR_DCMD_CLUSTER_RESET_ALL 0x08010100 136#define MR_DCMD_CLUSTER_RESET_ALL 0x08010100
133#define MR_DCMD_CLUSTER_RESET_LD 0x08010200 137#define MR_DCMD_CLUSTER_RESET_LD 0x08010200
138#define MR_DCMD_PD_LIST_QUERY 0x02010100
134 139
135/* 140/*
136 * MFI command completion codes 141 * MFI command completion codes
@@ -251,9 +256,126 @@ enum MR_EVT_ARGS {
251 MR_EVT_ARGS_STR, 256 MR_EVT_ARGS_STR,
252 MR_EVT_ARGS_TIME, 257 MR_EVT_ARGS_TIME,
253 MR_EVT_ARGS_ECC, 258 MR_EVT_ARGS_ECC,
259 MR_EVT_ARGS_LD_PROP,
260 MR_EVT_ARGS_PD_SPARE,
261 MR_EVT_ARGS_PD_INDEX,
262 MR_EVT_ARGS_DIAG_PASS,
263 MR_EVT_ARGS_DIAG_FAIL,
264 MR_EVT_ARGS_PD_LBA_LBA,
265 MR_EVT_ARGS_PORT_PHY,
266 MR_EVT_ARGS_PD_MISSING,
267 MR_EVT_ARGS_PD_ADDRESS,
268 MR_EVT_ARGS_BITMAP,
269 MR_EVT_ARGS_CONNECTOR,
270 MR_EVT_ARGS_PD_PD,
271 MR_EVT_ARGS_PD_FRU,
272 MR_EVT_ARGS_PD_PATHINFO,
273 MR_EVT_ARGS_PD_POWER_STATE,
274 MR_EVT_ARGS_GENERIC,
275};
254 276
277/*
278 * define constants for device list query options
279 */
280enum MR_PD_QUERY_TYPE {
281 MR_PD_QUERY_TYPE_ALL = 0,
282 MR_PD_QUERY_TYPE_STATE = 1,
283 MR_PD_QUERY_TYPE_POWER_STATE = 2,
284 MR_PD_QUERY_TYPE_MEDIA_TYPE = 3,
285 MR_PD_QUERY_TYPE_SPEED = 4,
286 MR_PD_QUERY_TYPE_EXPOSED_TO_HOST = 5,
255}; 287};
256 288
289#define MR_EVT_CFG_CLEARED 0x0004
290#define MR_EVT_LD_STATE_CHANGE 0x0051
291#define MR_EVT_PD_INSERTED 0x005b
292#define MR_EVT_PD_REMOVED 0x0070
293#define MR_EVT_LD_CREATED 0x008a
294#define MR_EVT_LD_DELETED 0x008b
295#define MR_EVT_FOREIGN_CFG_IMPORTED 0x00db
296#define MR_EVT_LD_OFFLINE 0x00fc
297#define MR_EVT_CTRL_HOST_BUS_SCAN_REQUESTED 0x0152
298#define MAX_LOGICAL_DRIVES 64
299
300enum MR_PD_STATE {
301 MR_PD_STATE_UNCONFIGURED_GOOD = 0x00,
302 MR_PD_STATE_UNCONFIGURED_BAD = 0x01,
303 MR_PD_STATE_HOT_SPARE = 0x02,
304 MR_PD_STATE_OFFLINE = 0x10,
305 MR_PD_STATE_FAILED = 0x11,
306 MR_PD_STATE_REBUILD = 0x14,
307 MR_PD_STATE_ONLINE = 0x18,
308 MR_PD_STATE_COPYBACK = 0x20,
309 MR_PD_STATE_SYSTEM = 0x40,
310 };
311
312
313 /*
314 * defines the physical drive address structure
315 */
316struct MR_PD_ADDRESS {
317 u16 deviceId;
318 u16 enclDeviceId;
319
320 union {
321 struct {
322 u8 enclIndex;
323 u8 slotNumber;
324 } mrPdAddress;
325 struct {
326 u8 enclPosition;
327 u8 enclConnectorIndex;
328 } mrEnclAddress;
329 };
330 u8 scsiDevType;
331 union {
332 u8 connectedPortBitmap;
333 u8 connectedPortNumbers;
334 };
335 u64 sasAddr[2];
336} __packed;
337
338/*
339 * defines the physical drive list structure
340 */
341struct MR_PD_LIST {
342 u32 size;
343 u32 count;
344 struct MR_PD_ADDRESS addr[1];
345} __packed;
346
347struct megasas_pd_list {
348 u16 tid;
349 u8 driveType;
350 u8 driveState;
351} __packed;
352
353 /*
354 * defines the logical drive reference structure
355 */
356union MR_LD_REF {
357 struct {
358 u8 targetId;
359 u8 reserved;
360 u16 seqNum;
361 };
362 u32 ref;
363} __packed;
364
365/*
366 * defines the logical drive list structure
367 */
368struct MR_LD_LIST {
369 u32 ldCount;
370 u32 reserved;
371 struct {
372 union MR_LD_REF ref;
373 u8 state;
374 u8 reserved[3];
375 u64 size;
376 } ldList[MAX_LOGICAL_DRIVES];
377} __packed;
378
257/* 379/*
258 * SAS controller properties 380 * SAS controller properties
259 */ 381 */
@@ -282,7 +404,7 @@ struct megasas_ctrl_prop {
282 u8 expose_encl_devices; 404 u8 expose_encl_devices;
283 u8 reserved[38]; 405 u8 reserved[38];
284 406
285} __attribute__ ((packed)); 407} __packed;
286 408
287/* 409/*
288 * SAS controller information 410 * SAS controller information
@@ -525,7 +647,7 @@ struct megasas_ctrl_info {
525 647
526 u8 pad[0x800 - 0x6a0]; 648 u8 pad[0x800 - 0x6a0];
527 649
528} __attribute__ ((packed)); 650} __packed;
529 651
530/* 652/*
531 * =============================== 653 * ===============================
@@ -540,6 +662,10 @@ struct megasas_ctrl_info {
540#define MEGASAS_DEFAULT_INIT_ID -1 662#define MEGASAS_DEFAULT_INIT_ID -1
541#define MEGASAS_MAX_LUN 8 663#define MEGASAS_MAX_LUN 8
542#define MEGASAS_MAX_LD 64 664#define MEGASAS_MAX_LD 64
665#define MEGASAS_MAX_PD (MEGASAS_MAX_PD_CHANNELS * \
666 MEGASAS_MAX_DEV_PER_CHANNEL)
667#define MEGASAS_MAX_LD_IDS (MEGASAS_MAX_LD_CHANNELS * \
668 MEGASAS_MAX_DEV_PER_CHANNEL)
543 669
544#define MEGASAS_DBG_LVL 1 670#define MEGASAS_DBG_LVL 1
545 671
@@ -570,6 +696,7 @@ struct megasas_ctrl_info {
570 * is shown below 696 * is shown below
571 */ 697 */
572#define MEGASAS_INT_CMDS 32 698#define MEGASAS_INT_CMDS 32
699#define MEGASAS_SKINNY_INT_CMDS 5
573 700
574/* 701/*
575 * FW can accept both 32 and 64 bit SGLs. We want to allocate 32/64 bit 702 * FW can accept both 32 and 64 bit SGLs. We want to allocate 32/64 bit
@@ -584,6 +711,8 @@ struct megasas_ctrl_info {
584#define MFI_REPLY_1078_MESSAGE_INTERRUPT 0x80000000 711#define MFI_REPLY_1078_MESSAGE_INTERRUPT 0x80000000
585#define MFI_REPLY_GEN2_MESSAGE_INTERRUPT 0x00000001 712#define MFI_REPLY_GEN2_MESSAGE_INTERRUPT 0x00000001
586#define MFI_GEN2_ENABLE_INTERRUPT_MASK (0x00000001 | 0x00000004) 713#define MFI_GEN2_ENABLE_INTERRUPT_MASK (0x00000001 | 0x00000004)
714#define MFI_REPLY_SKINNY_MESSAGE_INTERRUPT 0x40000000
715#define MFI_SKINNY_ENABLE_INTERRUPT_MASK (0x00000001)
587 716
588/* 717/*
589* register set for both 1068 and 1078 controllers 718* register set for both 1068 and 1078 controllers
@@ -644,10 +773,17 @@ struct megasas_sge64 {
644 773
645} __attribute__ ((packed)); 774} __attribute__ ((packed));
646 775
776struct megasas_sge_skinny {
777 u64 phys_addr;
778 u32 length;
779 u32 flag;
780} __packed;
781
647union megasas_sgl { 782union megasas_sgl {
648 783
649 struct megasas_sge32 sge32[1]; 784 struct megasas_sge32 sge32[1];
650 struct megasas_sge64 sge64[1]; 785 struct megasas_sge64 sge64[1];
786 struct megasas_sge_skinny sge_skinny[1];
651 787
652} __attribute__ ((packed)); 788} __attribute__ ((packed));
653 789
@@ -1061,16 +1197,10 @@ struct megasas_evt_detail {
1061 1197
1062} __attribute__ ((packed)); 1198} __attribute__ ((packed));
1063 1199
1064 struct megasas_instance_template { 1200struct megasas_aen_event {
1065 void (*fire_cmd)(dma_addr_t ,u32 ,struct megasas_register_set __iomem *); 1201 struct work_struct hotplug_work;
1066 1202 struct megasas_instance *instance;
1067 void (*enable_intr)(struct megasas_register_set __iomem *) ; 1203};
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 1204
1075struct megasas_instance { 1205struct megasas_instance {
1076 1206
@@ -1085,17 +1215,22 @@ struct megasas_instance {
1085 unsigned long base_addr; 1215 unsigned long base_addr;
1086 struct megasas_register_set __iomem *reg_set; 1216 struct megasas_register_set __iomem *reg_set;
1087 1217
1218 struct megasas_pd_list pd_list[MEGASAS_MAX_PD];
1219 u8 ld_ids[MEGASAS_MAX_LD_IDS];
1088 s8 init_id; 1220 s8 init_id;
1089 1221
1090 u16 max_num_sge; 1222 u16 max_num_sge;
1091 u16 max_fw_cmds; 1223 u16 max_fw_cmds;
1092 u32 max_sectors_per_req; 1224 u32 max_sectors_per_req;
1225 struct megasas_aen_event *ev;
1093 1226
1094 struct megasas_cmd **cmd_list; 1227 struct megasas_cmd **cmd_list;
1095 struct list_head cmd_pool; 1228 struct list_head cmd_pool;
1096 spinlock_t cmd_pool_lock; 1229 spinlock_t cmd_pool_lock;
1097 /* used to synch producer, consumer ptrs in dpc */ 1230 /* used to synch producer, consumer ptrs in dpc */
1098 spinlock_t completion_lock; 1231 spinlock_t completion_lock;
1232 /* used to sync fire the cmd to fw */
1233 spinlock_t fire_lock;
1099 struct dma_pool *frame_dma_pool; 1234 struct dma_pool *frame_dma_pool;
1100 struct dma_pool *sense_dma_pool; 1235 struct dma_pool *sense_dma_pool;
1101 1236
@@ -1120,11 +1255,25 @@ struct megasas_instance {
1120 struct tasklet_struct isr_tasklet; 1255 struct tasklet_struct isr_tasklet;
1121 1256
1122 u8 flag; 1257 u8 flag;
1258 u8 unload;
1259 u8 flag_ieee;
1123 unsigned long last_time; 1260 unsigned long last_time;
1124 1261
1125 struct timer_list io_completion_timer; 1262 struct timer_list io_completion_timer;
1126}; 1263};
1127 1264
1265struct megasas_instance_template {
1266 void (*fire_cmd)(struct megasas_instance *, dma_addr_t, \
1267 u32, struct megasas_register_set __iomem *);
1268
1269 void (*enable_intr)(struct megasas_register_set __iomem *) ;
1270 void (*disable_intr)(struct megasas_register_set __iomem *);
1271
1272 int (*clear_intr)(struct megasas_register_set __iomem *);
1273
1274 u32 (*read_fw_status_reg)(struct megasas_register_set __iomem *);
1275};
1276
1128#define MEGASAS_IS_LOGICAL(scp) \ 1277#define MEGASAS_IS_LOGICAL(scp) \
1129 (scp->device->channel < MEGASAS_MAX_PD_CHANNELS) ? 0 : 1 1278 (scp->device->channel < MEGASAS_MAX_PD_CHANNELS) ? 0 : 1
1130 1279