[SCSI] bfa: Resume BFA operations after firmware mismatch is resolved.

bfad.c & bfad_drv.h:
  * Created a kernel thread from pci_probe that does the bfad start
    operations after BFA init done on a firmware mismatch.
  * The kernel thread on a fw mismatch waits for an event from IOC
    call back and is woken up from bfa_cb_init() on BFA init success.
  * In normal cases of no firmware mismatch this thread is terminated
    in pci_probe.

bfa_fcs_lport.c, fabric.c, fcs_lport.h & vport.c:
  * Split the lport init to attach time and init time code, so that
    proper config attributes are set after firmware mismatch.

bfa_iocfc.c:
  * Handle an IOC timer issue, where the IOC timer would expire before
    the init completion and send Init fail event to the driver,
    however IOC init continues and completes successfully at the later
    stage. The bfa and driver were not handling this kind of deferred
    init completion.

Signed-off-by: Krishna Gudipati <kgudipat@brocade.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
diff --git a/drivers/scsi/bfa/bfad_drv.h b/drivers/scsi/bfa/bfad_drv.h
index 172c81e..9fa801a 100644
--- a/drivers/scsi/bfa/bfad_drv.h
+++ b/drivers/scsi/bfa/bfad_drv.h
@@ -62,7 +62,9 @@
 #define BFAD_HAL_START_DONE			0x00000010
 #define BFAD_PORT_ONLINE			0x00000020
 #define BFAD_RPORT_ONLINE			0x00000040
-
+#define BFAD_FCS_INIT_DONE                      0x00000080
+#define BFAD_HAL_INIT_FAIL                      0x00000100
+#define BFAD_FC4_PROBE_DONE                     0x00000200
 #define BFAD_PORT_DELETE			0x00000001
 
 /*
@@ -168,6 +170,7 @@
 	u32        inst_no;	/* BFAD instance number */
 	u32        bfad_flags;
 	spinlock_t      bfad_lock;
+	struct task_struct *bfad_tsk;
 	struct bfad_cfg_param_s cfg_data;
 	struct bfad_msix_s msix_tab[MAX_MSIX_ENTRY];
 	int             nvec;
@@ -258,6 +261,7 @@
 			       struct bfa_port_cfg_s *port_cfg);
 bfa_status_t    bfad_cfg_pport(struct bfad_s *bfad, enum bfa_port_role role);
 bfa_status_t    bfad_drv_init(struct bfad_s *bfad);
+bfa_status_t	bfad_start_ops(struct bfad_s *bfad);
 void            bfad_drv_start(struct bfad_s *bfad);
 void            bfad_uncfg_pport(struct bfad_s *bfad);
 void            bfad_drv_stop(struct bfad_s *bfad);
@@ -280,6 +284,12 @@
 bfa_status_t	bfad_fc4_module_init(void);
 void		bfad_fc4_module_exit(void);
 
+bfa_status_t	bfad_os_kthread_create(struct bfad_s *bfad);
+void		bfad_os_kthread_stop(struct bfad_s *bfad);
+void		bfad_os_kthread_wakeup(struct bfad_s *bfad);
+int		bfad_os_kthread_should_stop(void);
+int		bfad_worker (void *ptr);
+
 void bfad_pci_remove(struct pci_dev *pdev);
 int bfad_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pid);
 void bfad_os_rport_online_wait(struct bfad_s *bfad);