diff options
author | Yang, Bo <Bo.Yang@lsi.com> | 2009-10-06 16:52:20 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2009-10-29 13:03:22 -0400 |
commit | 7218df69e3609d1fcf4d83cf8f3fc89dbfbf82a8 (patch) | |
tree | 5528220f7f6f18df96fea4e48ce08879e05b4f75 /drivers/scsi/megaraid | |
parent | 7b2519afa1abd1b9f63aa1e90879307842422dae (diff) |
[SCSI] megaraid_sas: use the firmware boot timeout when waiting for commands
use the constant MEGASAS_RESET_WAIT_TIME when waiting for firmware
commands to complete (currently 3 minutes).
Signed-off-by Bo Yang<bo.yang@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/megaraid')
-rw-r--r-- | drivers/scsi/megaraid/megaraid_sas.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c index 23056721a8c9..efd41c1f946c 100644 --- a/drivers/scsi/megaraid/megaraid_sas.c +++ b/drivers/scsi/megaraid/megaraid_sas.c | |||
@@ -1820,6 +1820,7 @@ megasas_transition_to_ready(struct megasas_instance* instance) | |||
1820 | u8 max_wait; | 1820 | u8 max_wait; |
1821 | u32 fw_state; | 1821 | u32 fw_state; |
1822 | u32 cur_state; | 1822 | u32 cur_state; |
1823 | u32 abs_state, curr_abs_state; | ||
1823 | 1824 | ||
1824 | fw_state = instance->instancet->read_fw_status_reg(instance->reg_set) & MFI_STATE_MASK; | 1825 | fw_state = instance->instancet->read_fw_status_reg(instance->reg_set) & MFI_STATE_MASK; |
1825 | 1826 | ||
@@ -1829,6 +1830,9 @@ megasas_transition_to_ready(struct megasas_instance* instance) | |||
1829 | 1830 | ||
1830 | while (fw_state != MFI_STATE_READY) { | 1831 | while (fw_state != MFI_STATE_READY) { |
1831 | 1832 | ||
1833 | abs_state = | ||
1834 | instance->instancet->read_fw_status_reg(instance->reg_set); | ||
1835 | |||
1832 | switch (fw_state) { | 1836 | switch (fw_state) { |
1833 | 1837 | ||
1834 | case MFI_STATE_FAULT: | 1838 | case MFI_STATE_FAULT: |
@@ -1854,7 +1858,7 @@ megasas_transition_to_ready(struct megasas_instance* instance) | |||
1854 | &instance->reg_set->inbound_doorbell); | 1858 | &instance->reg_set->inbound_doorbell); |
1855 | } | 1859 | } |
1856 | 1860 | ||
1857 | max_wait = 2; | 1861 | max_wait = MEGASAS_RESET_WAIT_TIME; |
1858 | cur_state = MFI_STATE_WAIT_HANDSHAKE; | 1862 | cur_state = MFI_STATE_WAIT_HANDSHAKE; |
1859 | break; | 1863 | break; |
1860 | 1864 | ||
@@ -1869,7 +1873,7 @@ megasas_transition_to_ready(struct megasas_instance* instance) | |||
1869 | writel(MFI_INIT_HOTPLUG, | 1873 | writel(MFI_INIT_HOTPLUG, |
1870 | &instance->reg_set->inbound_doorbell); | 1874 | &instance->reg_set->inbound_doorbell); |
1871 | 1875 | ||
1872 | max_wait = 10; | 1876 | max_wait = MEGASAS_RESET_WAIT_TIME; |
1873 | cur_state = MFI_STATE_BOOT_MESSAGE_PENDING; | 1877 | cur_state = MFI_STATE_BOOT_MESSAGE_PENDING; |
1874 | break; | 1878 | break; |
1875 | 1879 | ||
@@ -1888,7 +1892,7 @@ megasas_transition_to_ready(struct megasas_instance* instance) | |||
1888 | writel(MFI_RESET_FLAGS, | 1892 | writel(MFI_RESET_FLAGS, |
1889 | &instance->reg_set->inbound_doorbell); | 1893 | &instance->reg_set->inbound_doorbell); |
1890 | 1894 | ||
1891 | max_wait = 60; | 1895 | max_wait = MEGASAS_RESET_WAIT_TIME; |
1892 | cur_state = MFI_STATE_OPERATIONAL; | 1896 | cur_state = MFI_STATE_OPERATIONAL; |
1893 | break; | 1897 | break; |
1894 | 1898 | ||
@@ -1896,32 +1900,32 @@ megasas_transition_to_ready(struct megasas_instance* instance) | |||
1896 | /* | 1900 | /* |
1897 | * This state should not last for more than 2 seconds | 1901 | * This state should not last for more than 2 seconds |
1898 | */ | 1902 | */ |
1899 | max_wait = 2; | 1903 | max_wait = MEGASAS_RESET_WAIT_TIME; |
1900 | cur_state = MFI_STATE_UNDEFINED; | 1904 | cur_state = MFI_STATE_UNDEFINED; |
1901 | break; | 1905 | break; |
1902 | 1906 | ||
1903 | case MFI_STATE_BB_INIT: | 1907 | case MFI_STATE_BB_INIT: |
1904 | max_wait = 2; | 1908 | max_wait = MEGASAS_RESET_WAIT_TIME; |
1905 | cur_state = MFI_STATE_BB_INIT; | 1909 | cur_state = MFI_STATE_BB_INIT; |
1906 | break; | 1910 | break; |
1907 | 1911 | ||
1908 | case MFI_STATE_FW_INIT: | 1912 | case MFI_STATE_FW_INIT: |
1909 | max_wait = 20; | 1913 | max_wait = MEGASAS_RESET_WAIT_TIME; |
1910 | cur_state = MFI_STATE_FW_INIT; | 1914 | cur_state = MFI_STATE_FW_INIT; |
1911 | break; | 1915 | break; |
1912 | 1916 | ||
1913 | case MFI_STATE_FW_INIT_2: | 1917 | case MFI_STATE_FW_INIT_2: |
1914 | max_wait = 20; | 1918 | max_wait = MEGASAS_RESET_WAIT_TIME; |
1915 | cur_state = MFI_STATE_FW_INIT_2; | 1919 | cur_state = MFI_STATE_FW_INIT_2; |
1916 | break; | 1920 | break; |
1917 | 1921 | ||
1918 | case MFI_STATE_DEVICE_SCAN: | 1922 | case MFI_STATE_DEVICE_SCAN: |
1919 | max_wait = 20; | 1923 | max_wait = MEGASAS_RESET_WAIT_TIME; |
1920 | cur_state = MFI_STATE_DEVICE_SCAN; | 1924 | cur_state = MFI_STATE_DEVICE_SCAN; |
1921 | break; | 1925 | break; |
1922 | 1926 | ||
1923 | case MFI_STATE_FLUSH_CACHE: | 1927 | case MFI_STATE_FLUSH_CACHE: |
1924 | max_wait = 20; | 1928 | max_wait = MEGASAS_RESET_WAIT_TIME; |
1925 | cur_state = MFI_STATE_FLUSH_CACHE; | 1929 | cur_state = MFI_STATE_FLUSH_CACHE; |
1926 | break; | 1930 | break; |
1927 | 1931 | ||
@@ -1937,8 +1941,10 @@ megasas_transition_to_ready(struct megasas_instance* instance) | |||
1937 | for (i = 0; i < (max_wait * 1000); i++) { | 1941 | for (i = 0; i < (max_wait * 1000); i++) { |
1938 | fw_state = instance->instancet->read_fw_status_reg(instance->reg_set) & | 1942 | fw_state = instance->instancet->read_fw_status_reg(instance->reg_set) & |
1939 | MFI_STATE_MASK ; | 1943 | MFI_STATE_MASK ; |
1944 | curr_abs_state = | ||
1945 | instance->instancet->read_fw_status_reg(instance->reg_set); | ||
1940 | 1946 | ||
1941 | if (fw_state == cur_state) { | 1947 | if (abs_state == curr_abs_state) { |
1942 | msleep(1); | 1948 | msleep(1); |
1943 | } else | 1949 | } else |
1944 | break; | 1950 | break; |
@@ -1947,7 +1953,7 @@ megasas_transition_to_ready(struct megasas_instance* instance) | |||
1947 | /* | 1953 | /* |
1948 | * Return error if fw_state hasn't changed after max_wait | 1954 | * Return error if fw_state hasn't changed after max_wait |
1949 | */ | 1955 | */ |
1950 | if (fw_state == cur_state) { | 1956 | if (curr_abs_state == abs_state) { |
1951 | printk(KERN_DEBUG "FW state [%d] hasn't changed " | 1957 | printk(KERN_DEBUG "FW state [%d] hasn't changed " |
1952 | "in %d secs\n", fw_state, max_wait); | 1958 | "in %d secs\n", fw_state, max_wait); |
1953 | return -ENODEV; | 1959 | return -ENODEV; |