 /* Initialize target map database. */ qla2x00_init_tgt_map(ha); 
qla2x00_initialize_adapter(scsi_qla_host_t *ha){	int	rval;	uint8_t	restart_risc = 0;	uint8_t	retry;	uint32_t wait_time;	/* Clear adapter flags. */	ha->flags.online = 0;	ha->flags.reset_active = 0;	atomic_set(&ha->loop_down_timer, LOOP_DOWN_TIME);	atomic_set(&ha->loop_state, LOOP_DOWN);	ha->device_flags = 0;	ha->sns_retry_cnt = 0;	ha->dpc_flags = 0;	ha->failback_delay = 0;	ha->flags.management_server_logged_in = 0;	ha->marker_needed = 0;	ha->mbx_flags = 0;	ha->isp_abort_cnt = 0;	ha->beacon_blink_led = 0;	rval = qla2x00_pci_config(ha);	if (rval) {		DEBUG2(printk("scsi(%ld): Unable to configure PCI space=n",		    ha->host_no));		return (rval);	}	qla2x00_reset_chip(ha);	/* Initialize target map database. */	qla2x00_init_tgt_map(ha);	qla_printk(KERN_INFO, ha, "Configure NVRAM parameters...\n");	qla2x00_nvram_config(ha);	qla_printk(KERN_INFO, ha, "Verifying loaded RISC code...\n");	retry = 10;	/*	 * Try to configure the loop.	 */	do {		restart_risc = 0;		/* If firmware needs to be loaded */		if (qla2x00_isp_firmware(ha) != QLA_SUCCESS) {			if ((rval = qla2x00_chip_diag(ha)) == QLA_SUCCESS) {				rval = qla2x00_setup_chip(ha);			}		}		if (rval == QLA_SUCCESS &&		    (rval = qla2x00_init_rings(ha)) == QLA_SUCCESS) {check_fw_ready_again:			/*			 * Wait for a successful LIP up to a maximum 			 * of (in seconds): RISC login timeout value,			 * RISC retry count value, and port down retry			 * value OR a minimum of 4 seconds OR If no 			 * cable, only 5 seconds.			 */			rval = qla2x00_fw_ready(ha);			if (rval == QLA_SUCCESS) {				clear_bit(RESET_MARKER_NEEDED, &ha->dpc_flags);				/*				 * Wait at most MAX_TARGET RSCNs for a stable				 * link.				 */				wait_time = 256;				do {					clear_bit(LOOP_RESYNC_NEEDED,					    &ha->dpc_flags);					rval = qla2x00_configure_loop(ha);					if (test_and_clear_bit(ISP_ABORT_NEEDED,					    &ha->dpc_flags)) {						restart_risc = 1;						break;					}					/*					 * If loop state change while we were					 * discoverying devices then wait for					 * LIP to complete					 */					if (atomic_read(&ha->loop_state) ==					    LOOP_DOWN && retry--) {						goto check_fw_ready_again;					}					wait_time--;				} while (!atomic_read(&ha->loop_down_timer) &&				    retry &&				    wait_time &&				    (test_bit(LOOP_RESYNC_NEEDED,					&ha->dpc_flags)));				if (wait_time == 0)					rval = QLA_FUNCTION_FAILED;				if (ha->mem_err)					restart_risc = 1;			} else if (ha->device_flags & DFLG_NO_CABLE)				/* If no cable, then all is good. */				rval = QLA_SUCCESS;		}	} while (restart_risc && retry--);	if (rval == QLA_SUCCESS) {		clear_bit(RESET_MARKER_NEEDED, &ha->dpc_flags);		ha->marker_needed = 1;		qla2x00_marker(ha, 0, 0, MK_SYNC_ALL);		ha->marker_needed = 0;		ha->flags.online = 1;	} else {		DEBUG2_3(printk("%s(): **** FAILED ****\n", __func__));	}	return (rval);}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/bdf796210e01145fd77bbb3ae644d04f982b6c3b/qla_init.c/buggy/drivers/scsi/qla2xxx/qla_init.c