[SCSI] bfa: IOCFC state machine enhancements
- Add support to handle STOP/DISABLE events in the IOCFC state machine. - Made changes to bring the IOC down on a flash driver config read failure. - Added logic to clean the use count and fail sync registers during IOCFC init. Signed-off-by: Vijaya Mohan Guvva <vmohan@brocade.com> Signed-off-by: Krishna Gudipati <kgudipat@brocade.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
This commit is contained in:
Родитель
bc0e2c2a97
Коммит
7ac83b1fd0
|
@ -274,6 +274,15 @@ bfa_iocfc_sm_initing(struct bfa_iocfc_s *iocfc, enum iocfc_event event)
|
|||
case IOCFC_E_IOC_ENABLED:
|
||||
bfa_fsm_set_state(iocfc, bfa_iocfc_sm_dconf_read);
|
||||
break;
|
||||
|
||||
case IOCFC_E_DISABLE:
|
||||
bfa_fsm_set_state(iocfc, bfa_iocfc_sm_disabling);
|
||||
break;
|
||||
|
||||
case IOCFC_E_STOP:
|
||||
bfa_fsm_set_state(iocfc, bfa_iocfc_sm_stopping);
|
||||
break;
|
||||
|
||||
case IOCFC_E_IOC_FAILED:
|
||||
bfa_fsm_set_state(iocfc, bfa_iocfc_sm_init_failed);
|
||||
break;
|
||||
|
@ -298,6 +307,15 @@ bfa_iocfc_sm_dconf_read(struct bfa_iocfc_s *iocfc, enum iocfc_event event)
|
|||
case IOCFC_E_DCONF_DONE:
|
||||
bfa_fsm_set_state(iocfc, bfa_iocfc_sm_init_cfg_wait);
|
||||
break;
|
||||
|
||||
case IOCFC_E_DISABLE:
|
||||
bfa_fsm_set_state(iocfc, bfa_iocfc_sm_disabling);
|
||||
break;
|
||||
|
||||
case IOCFC_E_STOP:
|
||||
bfa_fsm_set_state(iocfc, bfa_iocfc_sm_stopping);
|
||||
break;
|
||||
|
||||
case IOCFC_E_IOC_FAILED:
|
||||
bfa_fsm_set_state(iocfc, bfa_iocfc_sm_init_failed);
|
||||
break;
|
||||
|
@ -322,6 +340,15 @@ bfa_iocfc_sm_init_cfg_wait(struct bfa_iocfc_s *iocfc, enum iocfc_event event)
|
|||
case IOCFC_E_CFG_DONE:
|
||||
bfa_fsm_set_state(iocfc, bfa_iocfc_sm_init_cfg_done);
|
||||
break;
|
||||
|
||||
case IOCFC_E_DISABLE:
|
||||
bfa_fsm_set_state(iocfc, bfa_iocfc_sm_disabling);
|
||||
break;
|
||||
|
||||
case IOCFC_E_STOP:
|
||||
bfa_fsm_set_state(iocfc, bfa_iocfc_sm_stopping);
|
||||
break;
|
||||
|
||||
case IOCFC_E_IOC_FAILED:
|
||||
bfa_fsm_set_state(iocfc, bfa_iocfc_sm_init_failed);
|
||||
break;
|
||||
|
@ -433,6 +460,12 @@ bfa_iocfc_sm_stopping(struct bfa_iocfc_s *iocfc, enum iocfc_event event)
|
|||
bfa_cb_queue(iocfc->bfa, &iocfc->bfa->iocfc.stop_hcb_qe,
|
||||
bfa_iocfc_stop_cb, iocfc->bfa);
|
||||
break;
|
||||
|
||||
case IOCFC_E_IOC_ENABLED:
|
||||
case IOCFC_E_DCONF_DONE:
|
||||
case IOCFC_E_CFG_DONE:
|
||||
break;
|
||||
|
||||
default:
|
||||
bfa_sm_fault(iocfc->bfa, event);
|
||||
break;
|
||||
|
@ -454,6 +487,15 @@ bfa_iocfc_sm_enabling(struct bfa_iocfc_s *iocfc, enum iocfc_event event)
|
|||
case IOCFC_E_IOC_ENABLED:
|
||||
bfa_fsm_set_state(iocfc, bfa_iocfc_sm_cfg_wait);
|
||||
break;
|
||||
|
||||
case IOCFC_E_DISABLE:
|
||||
bfa_fsm_set_state(iocfc, bfa_iocfc_sm_disabling);
|
||||
break;
|
||||
|
||||
case IOCFC_E_STOP:
|
||||
bfa_fsm_set_state(iocfc, bfa_iocfc_sm_dconf_write);
|
||||
break;
|
||||
|
||||
case IOCFC_E_IOC_FAILED:
|
||||
bfa_fsm_set_state(iocfc, bfa_iocfc_sm_failed);
|
||||
|
||||
|
@ -493,6 +535,13 @@ bfa_iocfc_sm_cfg_wait(struct bfa_iocfc_s *iocfc, enum iocfc_event event)
|
|||
bfa_iocfc_enable_cb, iocfc->bfa);
|
||||
iocfc->bfa->iocfc.cb_reqd = BFA_FALSE;
|
||||
break;
|
||||
case IOCFC_E_DISABLE:
|
||||
bfa_fsm_set_state(iocfc, bfa_iocfc_sm_disabling);
|
||||
break;
|
||||
|
||||
case IOCFC_E_STOP:
|
||||
bfa_fsm_set_state(iocfc, bfa_iocfc_sm_dconf_write);
|
||||
break;
|
||||
case IOCFC_E_IOC_FAILED:
|
||||
bfa_fsm_set_state(iocfc, bfa_iocfc_sm_failed);
|
||||
if (iocfc->bfa->iocfc.cb_reqd == BFA_FALSE)
|
||||
|
@ -524,6 +573,10 @@ bfa_iocfc_sm_disabling(struct bfa_iocfc_s *iocfc, enum iocfc_event event)
|
|||
case IOCFC_E_IOC_DISABLED:
|
||||
bfa_fsm_set_state(iocfc, bfa_iocfc_sm_disabled);
|
||||
break;
|
||||
case IOCFC_E_IOC_ENABLED:
|
||||
case IOCFC_E_DCONF_DONE:
|
||||
case IOCFC_E_CFG_DONE:
|
||||
break;
|
||||
default:
|
||||
bfa_sm_fault(iocfc->bfa, event);
|
||||
break;
|
||||
|
|
|
@ -731,8 +731,7 @@ bfa_iocpf_sm_fwcheck_entry(struct bfa_iocpf_s *iocpf)
|
|||
/*
|
||||
* Unlock the hw semaphore. Should be here only once per boot.
|
||||
*/
|
||||
readl(iocpf->ioc->ioc_regs.ioc_sem_reg);
|
||||
writel(1, iocpf->ioc->ioc_regs.ioc_sem_reg);
|
||||
bfa_ioc_ownership_reset(iocpf->ioc);
|
||||
|
||||
/*
|
||||
* unlock init semaphore.
|
||||
|
@ -2923,7 +2922,7 @@ bfa_ioc_poll_fwinit(struct bfa_ioc_s *ioc)
|
|||
return;
|
||||
}
|
||||
|
||||
if (ioc->iocpf.poll_time >= BFA_IOC_TOV)
|
||||
if (ioc->iocpf.poll_time >= (3 * BFA_IOC_TOV))
|
||||
bfa_iocpf_timeout(ioc);
|
||||
else {
|
||||
ioc->iocpf.poll_time += BFA_IOC_POLL_TOV;
|
||||
|
@ -5615,7 +5614,7 @@ bfa_dconf_sm_uninit(struct bfa_dconf_mod_s *dconf, enum bfa_dconf_event event)
|
|||
}
|
||||
bfa_sm_set_state(dconf, bfa_dconf_sm_flash_read);
|
||||
bfa_timer_start(dconf->bfa, &dconf->timer,
|
||||
bfa_dconf_timer, dconf, BFA_DCONF_UPDATE_TOV);
|
||||
bfa_dconf_timer, dconf, 2 * BFA_DCONF_UPDATE_TOV);
|
||||
bfa_status = bfa_flash_read_part(BFA_FLASH(dconf->bfa),
|
||||
BFA_FLASH_PART_DRV, dconf->instance,
|
||||
dconf->dconf,
|
||||
|
@ -5655,7 +5654,7 @@ bfa_dconf_sm_flash_read(struct bfa_dconf_mod_s *dconf,
|
|||
break;
|
||||
case BFA_DCONF_SM_TIMEOUT:
|
||||
bfa_sm_set_state(dconf, bfa_dconf_sm_ready);
|
||||
bfa_fsm_send_event(&dconf->bfa->iocfc, IOCFC_E_IOC_FAILED);
|
||||
bfa_ioc_suspend(&dconf->bfa->ioc);
|
||||
break;
|
||||
case BFA_DCONF_SM_EXIT:
|
||||
bfa_timer_stop(&dconf->timer);
|
||||
|
@ -5853,7 +5852,6 @@ bfa_dconf_init_cb(void *arg, bfa_status_t status)
|
|||
struct bfa_s *bfa = arg;
|
||||
struct bfa_dconf_mod_s *dconf = BFA_DCONF_MOD(bfa);
|
||||
|
||||
bfa_sm_send_event(dconf, BFA_DCONF_SM_FLASH_COMP);
|
||||
if (status == BFA_STATUS_OK) {
|
||||
bfa_dconf_read_data_valid(bfa) = BFA_TRUE;
|
||||
if (dconf->dconf->hdr.signature != BFI_DCONF_SIGNATURE)
|
||||
|
@ -5861,6 +5859,7 @@ bfa_dconf_init_cb(void *arg, bfa_status_t status)
|
|||
if (dconf->dconf->hdr.version != BFI_DCONF_VERSION)
|
||||
dconf->dconf->hdr.version = BFI_DCONF_VERSION;
|
||||
}
|
||||
bfa_sm_send_event(dconf, BFA_DCONF_SM_FLASH_COMP);
|
||||
bfa_fsm_send_event(&bfa->iocfc, IOCFC_E_DCONF_DONE);
|
||||
}
|
||||
|
||||
|
|
|
@ -57,13 +57,6 @@ bfa_ioc_ct_firmware_lock(struct bfa_ioc_s *ioc)
|
|||
u32 usecnt;
|
||||
struct bfi_ioc_image_hdr_s fwhdr;
|
||||
|
||||
/*
|
||||
* If bios boot (flash based) -- do not increment usage count
|
||||
*/
|
||||
if (bfa_cb_image_get_size(bfa_ioc_asic_gen(ioc)) <
|
||||
BFA_IOC_FWIMG_MINSZ)
|
||||
return BFA_TRUE;
|
||||
|
||||
bfa_ioc_sem_get(ioc->ioc_regs.ioc_usage_sem_reg);
|
||||
usecnt = readl(ioc->ioc_regs.ioc_usage_reg);
|
||||
|
||||
|
@ -114,13 +107,6 @@ bfa_ioc_ct_firmware_unlock(struct bfa_ioc_s *ioc)
|
|||
{
|
||||
u32 usecnt;
|
||||
|
||||
/*
|
||||
* If bios boot (flash based) -- do not decrement usage count
|
||||
*/
|
||||
if (bfa_cb_image_get_size(bfa_ioc_asic_gen(ioc)) <
|
||||
BFA_IOC_FWIMG_MINSZ)
|
||||
return;
|
||||
|
||||
/*
|
||||
* decrement usage count
|
||||
*/
|
||||
|
@ -400,13 +386,12 @@ static void
|
|||
bfa_ioc_ct_ownership_reset(struct bfa_ioc_s *ioc)
|
||||
{
|
||||
|
||||
if (bfa_ioc_is_cna(ioc)) {
|
||||
bfa_ioc_sem_get(ioc->ioc_regs.ioc_usage_sem_reg);
|
||||
writel(0, ioc->ioc_regs.ioc_usage_reg);
|
||||
readl(ioc->ioc_regs.ioc_usage_sem_reg);
|
||||
writel(1, ioc->ioc_regs.ioc_usage_sem_reg);
|
||||
}
|
||||
bfa_ioc_sem_get(ioc->ioc_regs.ioc_usage_sem_reg);
|
||||
writel(0, ioc->ioc_regs.ioc_usage_reg);
|
||||
readl(ioc->ioc_regs.ioc_usage_sem_reg);
|
||||
writel(1, ioc->ioc_regs.ioc_usage_sem_reg);
|
||||
|
||||
writel(0, ioc->ioc_regs.ioc_fail_sync);
|
||||
/*
|
||||
* Read the hw sem reg to make sure that it is locked
|
||||
* before we clear it. If it is not locked, writing 1
|
||||
|
|
Загрузка…
Ссылка в новой задаче