pci_set_drvdata(pdev, ha); 
int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info){	int	ret;	device_reg_t __iomem *reg;	struct Scsi_Host *host;	scsi_qla_host_t *ha;	unsigned long	flags = 0;	unsigned long	wait_switch = 0;	char pci_info[20];	char fw_str[30];	if (pci_enable_device(pdev))		return -1;	host = scsi_host_alloc(&qla2x00_driver_template,	    sizeof(scsi_qla_host_t));	if (host == NULL) {		printk(KERN_WARNING		    "qla2xxx: Couldn't allocate host from scsi layer!\n");		goto probe_disable_device;	}	/* Clear our data area */	ha = (scsi_qla_host_t *)host->hostdata;	memset(ha, 0, sizeof(scsi_qla_host_t));	ha->pdev = pdev;	ha->host = host;	ha->host_no = host->host_no;	ha->brd_info = brd_info;	sprintf(ha->host_str, "%s_%ld", ha->brd_info->drv_name, ha->host_no);	/* Configure PCI I/O space */	ret = qla2x00_iospace_config(ha);	if (ret != 0) {		goto probe_failed;	}	/* Sanitize the information from PCI BIOS. */	host->irq = pdev->irq;	qla_printk(KERN_INFO, ha,	    "Found an %s, irq %d, iobase 0x%p\n", ha->brd_info->isp_name,	    host->irq, ha->iobase);	spin_lock_init(&ha->hardware_lock);	/* 4.23 Initialize /proc/scsi/qla2x00 counters */	ha->actthreads = 0;	ha->qthreads   = 0;	ha->total_isr_cnt = 0;	ha->total_isp_aborts = 0;	ha->total_lip_cnt = 0;	ha->total_dev_errs = 0;	ha->total_ios = 0;	ha->total_bytes = 0;	ha->prev_topology = 0;	ha->ports = MAX_BUSES;	if (IS_QLA2100(ha)) {		ha->max_targets = MAX_TARGETS_2100;		ha->mbx_count = MAILBOX_REGISTER_COUNT_2100;		ha->request_q_length = REQUEST_ENTRY_CNT_2100;		ha->response_q_length = RESPONSE_ENTRY_CNT_2100;		ha->last_loop_id = SNS_LAST_LOOP_ID_2100;		host->sg_tablesize = 32;	} else if (IS_QLA2200(ha)) {		ha->max_targets = MAX_TARGETS_2200;		ha->mbx_count = MAILBOX_REGISTER_COUNT;		ha->request_q_length = REQUEST_ENTRY_CNT_2200;		ha->response_q_length = RESPONSE_ENTRY_CNT_2100;		ha->last_loop_id = SNS_LAST_LOOP_ID_2100;	} else /*if (IS_QLA2300(ha))*/ {		ha->max_targets = MAX_TARGETS_2200;		ha->mbx_count = MAILBOX_REGISTER_COUNT;		ha->request_q_length = REQUEST_ENTRY_CNT_2200;		ha->response_q_length = RESPONSE_ENTRY_CNT_2300;		ha->last_loop_id = SNS_LAST_LOOP_ID_2300;	}	host->can_queue = ha->request_q_length + 128;	/* load the F/W, read paramaters, and init the H/W */	ha->instance = num_hosts;	init_MUTEX(&ha->mbx_cmd_sem);	init_MUTEX_LOCKED(&ha->mbx_intr_sem);	INIT_LIST_HEAD(&ha->list);	INIT_LIST_HEAD(&ha->fcports);	INIT_LIST_HEAD(&ha->rscn_fcports);	/*	 * These locks are used to prevent more than one CPU	 * from modifying the queue at the same time. The	 * higher level "host_lock" will reduce most	 * contention for these locks.	 */	spin_lock_init(&ha->mbx_reg_lock);	ha->dpc_pid = -1;	init_completion(&ha->dpc_inited);	init_completion(&ha->dpc_exited);	qla2x00_config_dma_addressing(ha);	if (qla2x00_mem_alloc(ha)) {		qla_printk(KERN_WARNING, ha,		    "[ERROR] Failed to allocate memory for adapter\n");		goto probe_failed;	}	if (qla2x00_initialize_adapter(ha) &&	    !(ha->device_flags & DFLG_NO_CABLE)) {		qla_printk(KERN_WARNING, ha,		    "Failed to initialize adapter\n");		DEBUG2(printk("scsi(%ld): Failed to initialize adapter - "		    "Adapter flags %x.\n",		    ha->host_no, ha->device_flags));		goto probe_failed;	}	/*	 * Startup the kernel thread for this host adapter	 */	ha->dpc_should_die = 0;	ha->dpc_pid = kernel_thread(qla2x00_do_dpc, ha, 0);	if (ha->dpc_pid < 0) {		qla_printk(KERN_WARNING, ha,		    "Unable to start DPC thread!\n");		goto probe_failed;	}	wait_for_completion(&ha->dpc_inited);	host->this_id = 255;	host->cmd_per_lun = 3;	host->max_cmd_len = MAX_CMDSZ;	host->max_channel = ha->ports - 1;	host->max_lun = ha->max_luns;	BUG_ON(qla2xxx_transport_template == NULL);	host->transportt = qla2xxx_transport_template;	host->unique_id = ha->instance;	host->max_id = ha->max_targets;	if (IS_QLA2100(ha) || IS_QLA2200(ha))		ret = request_irq(host->irq, qla2100_intr_handler,		    SA_INTERRUPT|SA_SHIRQ, ha->brd_info->drv_name, ha);	else		ret = request_irq(host->irq, qla2300_intr_handler,		    SA_INTERRUPT|SA_SHIRQ, ha->brd_info->drv_name, ha);	if (ret != 0) {		qla_printk(KERN_WARNING, ha,		    "Failed to reserve interrupt %d already in use.\n",		    host->irq);		goto probe_failed;	}	/* Initialized the timer */	qla2x00_start_timer(ha, qla2x00_timer, WATCH_INTERVAL);	DEBUG2(printk("DEBUG: detect hba %ld at address = %p\n",	    ha->host_no, ha));	reg = ha->iobase;	/* Disable ISP interrupts. */	qla2x00_disable_intrs(ha);	/* Ensure mailbox registers are free. */	spin_lock_irqsave(&ha->hardware_lock, flags);	WRT_REG_WORD(&reg->semaphore, 0);	WRT_REG_WORD(&reg->hccr, HCCR_CLR_RISC_INT);	WRT_REG_WORD(&reg->hccr, HCCR_CLR_HOST_INT);	/* Enable proper parity */	if (!IS_QLA2100(ha) && !IS_QLA2200(ha)) {		if (IS_QLA2300(ha))			/* SRAM parity */			WRT_REG_WORD(&reg->hccr, (HCCR_ENABLE_PARITY + 0x1));		else			/* SRAM, Instruction RAM and GP RAM parity */			WRT_REG_WORD(&reg->hccr, (HCCR_ENABLE_PARITY + 0x7));	}	spin_unlock_irqrestore(&ha->hardware_lock, flags);	/* Enable chip interrupts. */	qla2x00_enable_intrs(ha);	/* v2.19.5b6 */	/*	 * Wait around max loop_reset_delay secs for the devices to come	 * on-line. We don't want Linux scanning before we are ready.	 *	 */	for (wait_switch = jiffies + (ha->loop_reset_delay * HZ);	    time_before(jiffies,wait_switch) &&	     !(ha->device_flags & (DFLG_NO_CABLE | DFLG_FABRIC_DEVICES))	     && (ha->device_flags & SWITCH_FOUND) ;) {		qla2x00_check_fabric_devices(ha);		msleep(10);	}	pci_set_drvdata(pdev, ha);	ha->flags.init_done = 1;	num_hosts++;	/* List the target we have found */	if (displayConfig) {		qla2x00_display_fc_names(ha);	}	if (scsi_add_host(host, &pdev->dev))		goto probe_failed;	sysfs_create_bin_file(&host->shost_gendev.kobj, &sysfs_fw_dump_attr);	sysfs_create_bin_file(&host->shost_gendev.kobj, &sysfs_nvram_attr);	qla_printk(KERN_INFO, ha, "\n"	    " QLogic Fibre Channel HBA Driver: %s\n"	    "  QLogic %s - %s\n"	    "  %s: %s @ %s hdma%c, host#=%ld, fw=%s\n", qla2x00_version_str,	    ha->model_number, ha->model_desc ? ha->model_desc: "",	    ha->brd_info->isp_name, qla2x00_get_pci_info_str(ha, pci_info),	    pci_name(ha->pdev), ha->flags.enable_64bit_addressing ? '+': '-',	    ha->host_no, qla2x00_get_fw_version_str(ha, fw_str));	if (ql2xdoinitscan)		scsi_scan_host(host);	return 0;probe_failed:	qla2x00_free_device(ha);	scsi_host_put(host);probe_disable_device:	pci_disable_device(pdev);	return -1;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/8482e118afa0cb4321ab3d30b1100d27d63130c0/qla_os.c/clean/drivers/scsi/qla2xxx/qla_os.c