Commit 0e9973ed authored by Raghava Aditya Renukunta's avatar Raghava Aditya Renukunta Committed by Martin K. Petersen

scsi: aacraid: Add periodic checks to see IOP reset status

Added function that waits with a timeout for the ctrl to be up and running
after triggering an IOP reset. Also removed 30 sec sleep as it is not
needed.
Signed-off-by: default avatarRaghava Aditya Renukunta <RaghavaAditya.Renukunta@microsemi.com>
Reviewed-by: default avatarDavid Carroll <david.carroll@microsemi.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 80c7d8a5
...@@ -2516,6 +2516,7 @@ struct aac_hba_info { ...@@ -2516,6 +2516,7 @@ struct aac_hba_info {
#define SELF_TEST_FAILED 0x00000004 #define SELF_TEST_FAILED 0x00000004
#define MONITOR_PANIC 0x00000020 #define MONITOR_PANIC 0x00000020
#define KERNEL_BOOTING 0x00000040
#define KERNEL_UP_AND_RUNNING 0x00000080 #define KERNEL_UP_AND_RUNNING 0x00000080
#define KERNEL_PANIC 0x00000100 #define KERNEL_PANIC 0x00000100
#define FLASH_UPD_PENDING 0x00002000 #define FLASH_UPD_PENDING 0x00002000
......
...@@ -694,6 +694,37 @@ static void aac_dump_fw_fib_iop_reset(struct aac_dev *dev) ...@@ -694,6 +694,37 @@ static void aac_dump_fw_fib_iop_reset(struct aac_dev *dev)
0, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL); 0, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL);
} }
static bool aac_is_ctrl_up_and_running(struct aac_dev *dev)
{
bool ctrl_up = true;
unsigned long status, start;
bool is_up = false;
start = jiffies;
do {
schedule();
status = src_readl(dev, MUnit.OMR);
if (status == 0xffffffff)
status = 0;
if (status & KERNEL_BOOTING) {
start = jiffies;
continue;
}
if (time_after(jiffies, start+HZ*SOFT_RESET_TIME)) {
ctrl_up = false;
break;
}
is_up = status & KERNEL_UP_AND_RUNNING;
} while (!is_up);
return ctrl_up;
}
static void aac_notify_fw_of_iop_reset(struct aac_dev *dev) static void aac_notify_fw_of_iop_reset(struct aac_dev *dev)
{ {
aac_adapter_sync_cmd(dev, IOP_RESET_ALWAYS, 0, 0, 0, 0, 0, 0, NULL, aac_adapter_sync_cmd(dev, IOP_RESET_ALWAYS, 0, 0, 0, 0, 0, 0, NULL,
...@@ -709,8 +740,6 @@ static void aac_send_iop_reset(struct aac_dev *dev) ...@@ -709,8 +740,6 @@ static void aac_send_iop_reset(struct aac_dev *dev)
aac_set_intx_mode(dev); aac_set_intx_mode(dev);
src_writel(dev, MUnit.IDR, IOP_SRC_RESET_MASK); src_writel(dev, MUnit.IDR, IOP_SRC_RESET_MASK);
msleep(30000);
} }
static void aac_send_hardware_soft_reset(struct aac_dev *dev) static void aac_send_hardware_soft_reset(struct aac_dev *dev)
...@@ -726,6 +755,7 @@ static void aac_send_hardware_soft_reset(struct aac_dev *dev) ...@@ -726,6 +755,7 @@ static void aac_send_hardware_soft_reset(struct aac_dev *dev)
static int aac_src_restart_adapter(struct aac_dev *dev, int bled, u8 reset_type) static int aac_src_restart_adapter(struct aac_dev *dev, int bled, u8 reset_type)
{ {
unsigned long status, start; unsigned long status, start;
bool is_ctrl_up;
if (bled < 0) if (bled < 0)
goto invalid_out; goto invalid_out;
...@@ -745,6 +775,16 @@ static int aac_src_restart_adapter(struct aac_dev *dev, int bled, u8 reset_type) ...@@ -745,6 +775,16 @@ static int aac_src_restart_adapter(struct aac_dev *dev, int bled, u8 reset_type)
switch (reset_type) { switch (reset_type) {
case IOP_HWSOFT_RESET: case IOP_HWSOFT_RESET:
aac_send_iop_reset(dev); aac_send_iop_reset(dev);
/*
* Creates a delay or wait till up and running comes thru
*/
is_ctrl_up = aac_is_ctrl_up_and_running(dev);
if (!is_ctrl_up)
dev_err(&dev->pdev->dev, "IOP reset failed\n");
else
goto set_startup;
/* /*
* Check to see if KERNEL_UP_AND_RUNNING * Check to see if KERNEL_UP_AND_RUNNING
* Wait for the adapter to be up and running. * Wait for the adapter to be up and running.
...@@ -780,6 +820,7 @@ static int aac_src_restart_adapter(struct aac_dev *dev, int bled, u8 reset_type) ...@@ -780,6 +820,7 @@ static int aac_src_restart_adapter(struct aac_dev *dev, int bled, u8 reset_type)
if (src_readl(dev, MUnit.OMR) & KERNEL_PANIC) if (src_readl(dev, MUnit.OMR) & KERNEL_PANIC)
return -ENODEV; return -ENODEV;
set_startup:
if (startup_timeout < 300) if (startup_timeout < 300)
startup_timeout = 300; startup_timeout = 300;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment