Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 38971
b: refs/heads/master
c: e3bbff9
h: refs/heads/master
i:
  38969: 8463fac
  38967: 6e5143c
v: v3
  • Loading branch information
Sumant Patro authored and James Bottomley committed Oct 4, 2006
1 parent 004d784 commit 3a23692
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 65935ff95cfda67c7b2bf228d6f7083a46f832a1
refs/heads/master: e3bbff9f3cf91c84c76cfdd5e80041ad1b487192
35 changes: 29 additions & 6 deletions trunk/drivers/scsi/megaraid/megaraid_sas.c
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,12 @@ static int megasas_wait_for_outstanding(struct megasas_instance *instance)
}

if (atomic_read(&instance->fw_outstanding)) {
/*
* Send signal to FW to stop processing any pending cmds.
* The controller will be taken offline by the OS now.
*/
writel(MFI_STOP_ADP,
&instance->reg_set->inbound_doorbell);
instance->hw_crit_error = 1;
return FAILED;
}
Expand Down Expand Up @@ -1229,10 +1235,12 @@ megasas_transition_to_ready(struct megasas_instance* instance)

fw_state = instance->instancet->read_fw_status_reg(instance->reg_set) & MFI_STATE_MASK;

if (fw_state != MFI_STATE_READY)
printk(KERN_INFO "megasas: Waiting for FW to come to ready"
" state\n");

while (fw_state != MFI_STATE_READY) {

printk(KERN_INFO "megasas: Waiting for FW to come to ready"
" state\n");
switch (fw_state) {

case MFI_STATE_FAULT:
Expand All @@ -1244,19 +1252,27 @@ megasas_transition_to_ready(struct megasas_instance* instance)
/*
* Set the CLR bit in inbound doorbell
*/
writel(MFI_INIT_CLEAR_HANDSHAKE,
writel(MFI_INIT_CLEAR_HANDSHAKE|MFI_INIT_HOTPLUG,
&instance->reg_set->inbound_doorbell);

max_wait = 2;
cur_state = MFI_STATE_WAIT_HANDSHAKE;
break;

case MFI_STATE_BOOT_MESSAGE_PENDING:
writel(MFI_INIT_HOTPLUG,
&instance->reg_set->inbound_doorbell);

max_wait = 10;
cur_state = MFI_STATE_BOOT_MESSAGE_PENDING;
break;

case MFI_STATE_OPERATIONAL:
/*
* Bring it to READY state; assuming max wait 2 secs
* Bring it to READY state; assuming max wait 10 secs
*/
megasas_disable_intr(instance);
writel(MFI_INIT_READY, &instance->reg_set->inbound_doorbell);
writel(MFI_RESET_FLAGS, &instance->reg_set->inbound_doorbell);

max_wait = 10;
cur_state = MFI_STATE_OPERATIONAL;
Expand Down Expand Up @@ -1323,6 +1339,7 @@ megasas_transition_to_ready(struct megasas_instance* instance)
return -ENODEV;
}
};
printk(KERN_INFO "megasas: FW now in Ready state\n");

return 0;
}
Expand Down Expand Up @@ -1352,7 +1369,7 @@ static void megasas_teardown_frame_pool(struct megasas_instance *instance)
cmd->frame_phys_addr);

if (cmd->sense)
pci_pool_free(instance->sense_dma_pool, cmd->frame,
pci_pool_free(instance->sense_dma_pool, cmd->sense,
cmd->sense_phys_addr);
}

Expand Down Expand Up @@ -1690,6 +1707,12 @@ static int megasas_init_mfi(struct megasas_instance *instance)
* Get various operational parameters from status register
*/
instance->max_fw_cmds = instance->instancet->read_fw_status_reg(reg_set) & 0x00FFFF;
/*
* Reduce the max supported cmds by 1. This is to ensure that the
* reply_q_sz (1 more than the max cmd that driver may send)
* does not exceed max cmds that the FW can support
*/
instance->max_fw_cmds = instance->max_fw_cmds-1;
instance->max_num_sge = (instance->instancet->read_fw_status_reg(reg_set) & 0xFF0000) >>
0x10;
/*
Expand Down
11 changes: 9 additions & 2 deletions trunk/drivers/scsi/megaraid/megaraid_sas.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
#define MFI_STATE_WAIT_HANDSHAKE 0x60000000
#define MFI_STATE_FW_INIT_2 0x70000000
#define MFI_STATE_DEVICE_SCAN 0x80000000
#define MFI_STATE_BOOT_MESSAGE_PENDING 0x90000000
#define MFI_STATE_FLUSH_CACHE 0xA0000000
#define MFI_STATE_READY 0xB0000000
#define MFI_STATE_OPERATIONAL 0xC0000000
Expand All @@ -64,12 +65,18 @@
* READY : Move from OPERATIONAL to READY state; discard queue info
* MFIMODE : Discard (possible) low MFA posted in 64-bit mode (??)
* CLR_HANDSHAKE: FW is waiting for HANDSHAKE from BIOS or Driver
* HOTPLUG : Resume from Hotplug
* MFI_STOP_ADP : Send signal to FW to stop processing
*/
#define MFI_INIT_ABORT 0x00000000
#define MFI_INIT_ABORT 0x00000001
#define MFI_INIT_READY 0x00000002
#define MFI_INIT_MFIMODE 0x00000004
#define MFI_INIT_CLEAR_HANDSHAKE 0x00000008
#define MFI_RESET_FLAGS MFI_INIT_READY|MFI_INIT_MFIMODE
#define MFI_INIT_HOTPLUG 0x00000010
#define MFI_STOP_ADP 0x00000020
#define MFI_RESET_FLAGS MFI_INIT_READY| \
MFI_INIT_MFIMODE| \
MFI_INIT_ABORT

/**
* MFI frame flags
Expand Down

0 comments on commit 3a23692

Please sign in to comment.