diff options
author | bo yang <boyang1288@gmail.com> | 2010-09-22 22:36:29 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-10-07 18:33:09 -0400 |
commit | 39a985547cbfcbb0b23667b69b8ae82a6cf312ac (patch) | |
tree | 1a4f526e4de45b56408e03f353d584cbd8c1ab37 /drivers/scsi/megaraid/megaraid_sas.h | |
parent | 969c9165581fbb55cab0f500f555a69279cecb57 (diff) |
[SCSI] megaraid_sas: Add Online Controller Reset to MegaRAID SAS drive
To add the Online controller reset support, driver need to do:
a). reset the controller chips -- Xscale and Gen2 which will change
the function calls and add the reset function related to this two
chips.
b). during the reset, driver will store the pending cmds which not
returned by FW to driver's pending queue. Driver will re-issue those
pending cmds again to FW after the OCR finished.
c). In driver's timeout routine, driver will report to OS as reset.
Also driver's queue routine will block the cmds until the OCR
finished.
d). in Driver's ISR routine, if driver get the FW state as state
change, FW in Failure status and FW support online controller
reset (OCR), driver will start to do the controller reset.
e). In driver's IOCTL routine, the application cmds will wait for the
OCR to finish, then issue the cmds to FW.
Signed-off-by Bo Yang <bo.yang@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/megaraid/megaraid_sas.h')
-rw-r--r-- | drivers/scsi/megaraid/megaraid_sas.h | 88 |
1 files changed, 81 insertions, 7 deletions
diff --git a/drivers/scsi/megaraid/megaraid_sas.h b/drivers/scsi/megaraid/megaraid_sas.h index 9d8b6bf605aa..16a4f68a34b0 100644 --- a/drivers/scsi/megaraid/megaraid_sas.h +++ b/drivers/scsi/megaraid/megaraid_sas.h | |||
@@ -60,6 +60,7 @@ | |||
60 | #define MFI_STATE_READY 0xB0000000 | 60 | #define MFI_STATE_READY 0xB0000000 |
61 | #define MFI_STATE_OPERATIONAL 0xC0000000 | 61 | #define MFI_STATE_OPERATIONAL 0xC0000000 |
62 | #define MFI_STATE_FAULT 0xF0000000 | 62 | #define MFI_STATE_FAULT 0xF0000000 |
63 | #define MFI_RESET_REQUIRED 0x00000001 | ||
63 | 64 | ||
64 | #define MEGAMFI_FRAME_SIZE 64 | 65 | #define MEGAMFI_FRAME_SIZE 64 |
65 | 66 | ||
@@ -73,6 +74,12 @@ | |||
73 | * HOTPLUG : Resume from Hotplug | 74 | * HOTPLUG : Resume from Hotplug |
74 | * MFI_STOP_ADP : Send signal to FW to stop processing | 75 | * MFI_STOP_ADP : Send signal to FW to stop processing |
75 | */ | 76 | */ |
77 | #define WRITE_SEQUENCE_OFFSET (0x0000000FC) /* I20 */ | ||
78 | #define HOST_DIAGNOSTIC_OFFSET (0x000000F8) /* I20 */ | ||
79 | #define DIAG_WRITE_ENABLE (0x00000080) | ||
80 | #define DIAG_RESET_ADAPTER (0x00000004) | ||
81 | |||
82 | #define MFI_ADP_RESET 0x00000040 | ||
76 | #define MFI_INIT_ABORT 0x00000001 | 83 | #define MFI_INIT_ABORT 0x00000001 |
77 | #define MFI_INIT_READY 0x00000002 | 84 | #define MFI_INIT_READY 0x00000002 |
78 | #define MFI_INIT_MFIMODE 0x00000004 | 85 | #define MFI_INIT_MFIMODE 0x00000004 |
@@ -402,8 +409,40 @@ struct megasas_ctrl_prop { | |||
402 | u16 ecc_bucket_leak_rate; | 409 | u16 ecc_bucket_leak_rate; |
403 | u8 restore_hotspare_on_insertion; | 410 | u8 restore_hotspare_on_insertion; |
404 | u8 expose_encl_devices; | 411 | u8 expose_encl_devices; |
405 | u8 reserved[38]; | 412 | u8 maintainPdFailHistory; |
413 | u8 disallowHostRequestReordering; | ||
414 | u8 abortCCOnError; | ||
415 | u8 loadBalanceMode; | ||
416 | u8 disableAutoDetectBackplane; | ||
417 | |||
418 | u8 snapVDSpace; | ||
419 | |||
420 | /* | ||
421 | * Add properties that can be controlled by | ||
422 | * a bit in the following structure. | ||
423 | */ | ||
406 | 424 | ||
425 | struct { | ||
426 | u32 copyBackDisabled : 1; | ||
427 | u32 SMARTerEnabled : 1; | ||
428 | u32 prCorrectUnconfiguredAreas : 1; | ||
429 | u32 useFdeOnly : 1; | ||
430 | u32 disableNCQ : 1; | ||
431 | u32 SSDSMARTerEnabled : 1; | ||
432 | u32 SSDPatrolReadEnabled : 1; | ||
433 | u32 enableSpinDownUnconfigured : 1; | ||
434 | u32 autoEnhancedImport : 1; | ||
435 | u32 enableSecretKeyControl : 1; | ||
436 | u32 disableOnlineCtrlReset : 1; | ||
437 | u32 allowBootWithPinnedCache : 1; | ||
438 | u32 disableSpinDownHS : 1; | ||
439 | u32 enableJBOD : 1; | ||
440 | u32 reserved :18; | ||
441 | } OnOffProperties; | ||
442 | u8 autoSnapVDSpace; | ||
443 | u8 viewSpace; | ||
444 | u16 spinDownTime; | ||
445 | u8 reserved[24]; | ||
407 | } __packed; | 446 | } __packed; |
408 | 447 | ||
409 | /* | 448 | /* |
@@ -704,6 +743,12 @@ struct megasas_ctrl_info { | |||
704 | */ | 743 | */ |
705 | #define IS_DMA64 (sizeof(dma_addr_t) == 8) | 744 | #define IS_DMA64 (sizeof(dma_addr_t) == 8) |
706 | 745 | ||
746 | #define MFI_XSCALE_OMR0_CHANGE_INTERRUPT 0x00000001 | ||
747 | |||
748 | #define MFI_INTR_FLAG_REPLY_MESSAGE 0x00000001 | ||
749 | #define MFI_INTR_FLAG_FIRMWARE_STATE_CHANGE 0x00000002 | ||
750 | #define MFI_G2_OUTBOUND_DOORBELL_CHANGE_INTERRUPT 0x00000004 | ||
751 | |||
707 | #define MFI_OB_INTR_STATUS_MASK 0x00000002 | 752 | #define MFI_OB_INTR_STATUS_MASK 0x00000002 |
708 | #define MFI_POLL_TIMEOUT_SECS 60 | 753 | #define MFI_POLL_TIMEOUT_SECS 60 |
709 | #define MEGASAS_COMPLETION_TIMER_INTERVAL (HZ/10) | 754 | #define MEGASAS_COMPLETION_TIMER_INTERVAL (HZ/10) |
@@ -714,6 +759,9 @@ struct megasas_ctrl_info { | |||
714 | #define MFI_REPLY_SKINNY_MESSAGE_INTERRUPT 0x40000000 | 759 | #define MFI_REPLY_SKINNY_MESSAGE_INTERRUPT 0x40000000 |
715 | #define MFI_SKINNY_ENABLE_INTERRUPT_MASK (0x00000001) | 760 | #define MFI_SKINNY_ENABLE_INTERRUPT_MASK (0x00000001) |
716 | 761 | ||
762 | #define MFI_1068_PCSR_OFFSET 0x84 | ||
763 | #define MFI_1068_FW_HANDSHAKE_OFFSET 0x64 | ||
764 | #define MFI_1068_FW_READY 0xDDDD0000 | ||
717 | /* | 765 | /* |
718 | * register set for both 1068 and 1078 controllers | 766 | * register set for both 1068 and 1078 controllers |
719 | * structure extended for 1078 registers | 767 | * structure extended for 1078 registers |
@@ -755,8 +803,10 @@ struct megasas_register_set { | |||
755 | u32 inbound_high_queue_port ; /*00C4h*/ | 803 | u32 inbound_high_queue_port ; /*00C4h*/ |
756 | 804 | ||
757 | u32 reserved_5; /*00C8h*/ | 805 | u32 reserved_5; /*00C8h*/ |
758 | u32 index_registers[820]; /*00CCh*/ | 806 | u32 res_6[11]; /*CCh*/ |
759 | 807 | u32 host_diag; | |
808 | u32 seq_offset; | ||
809 | u32 index_registers[807]; /*00CCh*/ | ||
760 | } __attribute__ ((packed)); | 810 | } __attribute__ ((packed)); |
761 | 811 | ||
762 | struct megasas_sge32 { | 812 | struct megasas_sge32 { |
@@ -1226,11 +1276,12 @@ struct megasas_instance { | |||
1226 | 1276 | ||
1227 | struct megasas_cmd **cmd_list; | 1277 | struct megasas_cmd **cmd_list; |
1228 | struct list_head cmd_pool; | 1278 | struct list_head cmd_pool; |
1279 | /* used to sync fire the cmd to fw */ | ||
1229 | spinlock_t cmd_pool_lock; | 1280 | spinlock_t cmd_pool_lock; |
1281 | /* used to sync fire the cmd to fw */ | ||
1282 | spinlock_t hba_lock; | ||
1230 | /* used to synch producer, consumer ptrs in dpc */ | 1283 | /* used to synch producer, consumer ptrs in dpc */ |
1231 | spinlock_t completion_lock; | 1284 | spinlock_t completion_lock; |
1232 | /* used to sync fire the cmd to fw */ | ||
1233 | spinlock_t fire_lock; | ||
1234 | struct dma_pool *frame_dma_pool; | 1285 | struct dma_pool *frame_dma_pool; |
1235 | struct dma_pool *sense_dma_pool; | 1286 | struct dma_pool *sense_dma_pool; |
1236 | 1287 | ||
@@ -1247,19 +1298,36 @@ struct megasas_instance { | |||
1247 | 1298 | ||
1248 | struct pci_dev *pdev; | 1299 | struct pci_dev *pdev; |
1249 | u32 unique_id; | 1300 | u32 unique_id; |
1301 | u32 fw_support_ieee; | ||
1250 | 1302 | ||
1251 | atomic_t fw_outstanding; | 1303 | atomic_t fw_outstanding; |
1252 | u32 hw_crit_error; | 1304 | atomic_t fw_reset_no_pci_access; |
1253 | 1305 | ||
1254 | struct megasas_instance_template *instancet; | 1306 | struct megasas_instance_template *instancet; |
1255 | struct tasklet_struct isr_tasklet; | 1307 | struct tasklet_struct isr_tasklet; |
1308 | struct work_struct work_init; | ||
1256 | 1309 | ||
1257 | u8 flag; | 1310 | u8 flag; |
1258 | u8 unload; | 1311 | u8 unload; |
1259 | u8 flag_ieee; | 1312 | u8 flag_ieee; |
1313 | u8 issuepend_done; | ||
1314 | u8 disableOnlineCtrlReset; | ||
1315 | u8 adprecovery; | ||
1260 | unsigned long last_time; | 1316 | unsigned long last_time; |
1317 | u32 mfiStatus; | ||
1318 | u32 last_seq_num; | ||
1261 | 1319 | ||
1262 | struct timer_list io_completion_timer; | 1320 | struct timer_list io_completion_timer; |
1321 | struct list_head internal_reset_pending_q; | ||
1322 | }; | ||
1323 | |||
1324 | enum { | ||
1325 | MEGASAS_HBA_OPERATIONAL = 0, | ||
1326 | MEGASAS_ADPRESET_SM_INFAULT = 1, | ||
1327 | MEGASAS_ADPRESET_SM_FW_RESET_SUCCESS = 2, | ||
1328 | MEGASAS_ADPRESET_SM_OPERATIONAL = 3, | ||
1329 | MEGASAS_HW_CRITICAL_ERROR = 4, | ||
1330 | MEGASAS_ADPRESET_INPROG_SIGN = 0xDEADDEAD, | ||
1263 | }; | 1331 | }; |
1264 | 1332 | ||
1265 | struct megasas_instance_template { | 1333 | struct megasas_instance_template { |
@@ -1272,6 +1340,10 @@ struct megasas_instance_template { | |||
1272 | int (*clear_intr)(struct megasas_register_set __iomem *); | 1340 | int (*clear_intr)(struct megasas_register_set __iomem *); |
1273 | 1341 | ||
1274 | u32 (*read_fw_status_reg)(struct megasas_register_set __iomem *); | 1342 | u32 (*read_fw_status_reg)(struct megasas_register_set __iomem *); |
1343 | int (*adp_reset)(struct megasas_instance *, \ | ||
1344 | struct megasas_register_set __iomem *); | ||
1345 | int (*check_reset)(struct megasas_instance *, \ | ||
1346 | struct megasas_register_set __iomem *); | ||
1275 | }; | 1347 | }; |
1276 | 1348 | ||
1277 | #define MEGASAS_IS_LOGICAL(scp) \ | 1349 | #define MEGASAS_IS_LOGICAL(scp) \ |
@@ -1291,7 +1363,9 @@ struct megasas_cmd { | |||
1291 | u32 index; | 1363 | u32 index; |
1292 | u8 sync_cmd; | 1364 | u8 sync_cmd; |
1293 | u8 cmd_status; | 1365 | u8 cmd_status; |
1294 | u16 abort_aen; | 1366 | u8 abort_aen; |
1367 | u8 retry_for_fw_reset; | ||
1368 | |||
1295 | 1369 | ||
1296 | struct list_head list; | 1370 | struct list_head list; |
1297 | struct scsi_cmnd *scmd; | 1371 | struct scsi_cmnd *scmd; |