/* Print out device port names */ for (t = 0; t < MAX_FIBRE_DEVICES; t++) { if ((tq = TGT_Q(ha, t)) == NULL) continue;  copy_info(&info, "scsi-qla%d-target-%d=" "%02x%02x%02x%02x%02x%02x%02x%02x;\n", (int)ha->instance, t, tq->port_name[0], tq->port_name[1], tq->port_name[2], tq->port_name[3], tq->port_name[4], tq->port_name[5], tq->port_name[6], tq->port_name[7]); }  copy_info(&info, "\nSCSI LUN Information:\n"); copy_info(&info, "(Id:Lun)  * - indicates lun is not registered with the OS.\n");  /* scan for all equipment stats */ for (t = 0; t < MAX_FIBRE_DEVICES; t++) { /* scan all luns */ for (l = 0; l < ha->max_luns; l++) { up = (os_lun_t *) GET_LU_Q(ha, t, l);  if (up == NULL) { continue; } if (up->fclun == NULL) { continue; }  copy_info(&info, "(%2d:%2d): Total reqs %ld,", t,l,up->io_cnt);  copy_info(&info, " Pending reqs %ld,", up->out_cnt);  if (up->io_cnt < 4) { copy_info(&info, " flags 0x%x*,", (int)up->q_flag); } else { copy_info(&info, " flags 0x%x,", (int)up->q_flag); }  copy_info(&info, " %ld:%d:%02x %02x", up->fclun->fcport->ha->instance, up->fclun->fcport->cur_path, up->fclun->fcport->loop_id, up->fclun->device_type);  copy_info(&info, "\n");  if (info.pos >= info.offset + info.length) { /* No need to continue */ goto profile_stop; } }  if (info.pos >= info.offset + info.length) { /* No need to continue */ break; } }  profile_stop:  
qla2x00_proc_info(struct Scsi_Host *shost, char *buffer,    char **start, off_t offset, int length, int inout){	struct info_str	info;	int             retval = -EINVAL;	os_lun_t	*up;	os_tgt_t	*tq;	unsigned int	t, l;	uint32_t        tmp_sn;	uint32_t	*flags;	uint8_t		*loop_state;	scsi_qla_host_t *ha;	char fw_info[30]; 	DEBUG3(printk(KERN_INFO	    "Entering proc_info buff_in=%p, offset=0x%lx, length=0x%x\n",	    buffer, offset, length);)	ha = (scsi_qla_host_t *) shost->hostdata;	if (inout) {		/* Has data been written to the file? */		DEBUG3(printk(		    "%s: has data been written to the file. \n",		    __func__);)		return -ENOSYS;	}	if (start) {		*start = buffer;	}	info.buffer = buffer;	info.length = length;	info.offset = offset;	info.pos    = 0;	/* start building the print buffer */	copy_info(&info,	    "QLogic PCI to Fibre Channel Host Adapter for %s:\n"	    "        Firmware version %s, ",	    ha->model_number, qla2x00_get_fw_version_str(ha, fw_info));	copy_info(&info, "Driver version %s\n", qla2x00_version_str);	tmp_sn = ((ha->serial0 & 0x1f) << 16) | (ha->serial2 << 8) | 	    ha->serial1;	copy_info(&info, "ISP: %s, Serial# %c%05d\n",	    ha->brd_info->isp_name, ('A' + tmp_sn/100000), (tmp_sn%100000));	copy_info(&info,	    "Request Queue = 0x%llx, Response Queue = 0x%llx\n",		(unsigned long long)ha->request_dma,		(unsigned long long)ha->response_dma);	copy_info(&info,	    "Request Queue count = %d, Response Queue count = %d\n",	    ha->request_q_length, ha->response_q_length);	copy_info(&info,	    "Total number of active commands = %ld\n",	    ha->actthreads);	copy_info(&info,	    "Total number of interrupts = %ld\n",	    (long)ha->total_isr_cnt);	copy_info(&info,	    "    Device queue depth = 0x%x\n",	    (ql2xmaxqdepth == 0) ? 16 : ql2xmaxqdepth);	copy_info(&info,	    "Number of free request entries = %d\n", ha->req_q_cnt);	copy_info(&info,	    "Number of mailbox timeouts = %ld\n", ha->total_mbx_timeout);	copy_info(&info,	    "Number of ISP aborts = %ld\n", ha->total_isp_aborts);	copy_info(&info,	    "Number of loop resyncs = %ld\n", ha->total_loop_resync);	copy_info(&info,	    "Number of retries for empty slots = %ld\n",	    qla2x00_stats.outarray_full);	flags = (uint32_t *) &ha->flags;	if (atomic_read(&ha->loop_state) == LOOP_DOWN) {		loop_state = "DOWN";	} else if (atomic_read(&ha->loop_state) == LOOP_UP) {		loop_state = "UP";	} else if (atomic_read(&ha->loop_state) == LOOP_READY) {		loop_state = "READY";	} else if (atomic_read(&ha->loop_state) == LOOP_TIMEOUT) {		loop_state = "TIMEOUT";	} else if (atomic_read(&ha->loop_state) == LOOP_UPDATE) {		loop_state = "UPDATE";	} else {		loop_state = "UNKNOWN";	}	copy_info(&info, 	    "Host adapter:loop state = <%s>, flags = 0x%lx\n",	    loop_state , *flags);	copy_info(&info, "Dpc flags = 0x%lx\n", ha->dpc_flags);	copy_info(&info, "MBX flags = 0x%x\n", ha->mbx_flags);	copy_info(&info, "Link down Timeout = %3.3d\n",	    ha->link_down_timeout);	copy_info(&info, "Port down retry = %3.3d\n",	    ha->port_down_retry_count);	copy_info(&info, "Login retry count = %3.3d\n",	    ha->login_retry_count);	copy_info(&info,	    "Commands retried with dropped frame(s) = %d\n",	    ha->dropped_frame_error_cnt);	copy_info(&info,	    "Product ID = %04x %04x %04x %04x\n", ha->product_id[0],	    ha->product_id[1], ha->product_id[2], ha->product_id[3]);	copy_info(&info, "\n");	/* 2.25 node/port display to proc */	/* Display the node name for adapter */	copy_info(&info, "\nSCSI Device Information:\n");	copy_info(&info,	    "scsi-qla%d-adapter-node="	    "%02x%02x%02x%02x%02x%02x%02x%02x;\n",	    (int)ha->instance,	    ha->init_cb->node_name[0],	    ha->init_cb->node_name[1],	    ha->init_cb->node_name[2],	    ha->init_cb->node_name[3],	    ha->init_cb->node_name[4],	    ha->init_cb->node_name[5],	    ha->init_cb->node_name[6],	    ha->init_cb->node_name[7]);	/* display the port name for adapter */	copy_info(&info,	    "scsi-qla%d-adapter-port="	    "%02x%02x%02x%02x%02x%02x%02x%02x;\n",	    (int)ha->instance,	    ha->init_cb->port_name[0],	    ha->init_cb->port_name[1],	    ha->init_cb->port_name[2],	    ha->init_cb->port_name[3],	    ha->init_cb->port_name[4],	    ha->init_cb->port_name[5],	    ha->init_cb->port_name[6],	    ha->init_cb->port_name[7]);	/* Print out device port names */	for (t = 0; t < MAX_FIBRE_DEVICES; t++) {		if ((tq = TGT_Q(ha, t)) == NULL)			continue;		copy_info(&info,		    "scsi-qla%d-target-%d="		    "%02x%02x%02x%02x%02x%02x%02x%02x;\n",		    (int)ha->instance, t,		    tq->port_name[0], tq->port_name[1],		    tq->port_name[2], tq->port_name[3],		    tq->port_name[4], tq->port_name[5],		    tq->port_name[6], tq->port_name[7]);	}	copy_info(&info, "\nSCSI LUN Information:\n");	copy_info(&info,	    "(Id:Lun)  * - indicates lun is not registered with the OS.\n");	/* scan for all equipment stats */	for (t = 0; t < MAX_FIBRE_DEVICES; t++) {		/* scan all luns */		for (l = 0; l < ha->max_luns; l++) {			up = (os_lun_t *) GET_LU_Q(ha, t, l);			if (up == NULL) {				continue;			}			if (up->fclun == NULL) {				continue;			}			copy_info(&info,			    "(%2d:%2d): Total reqs %ld,",			    t,l,up->io_cnt);			copy_info(&info,			    " Pending reqs %ld,",			    up->out_cnt);			if (up->io_cnt < 4) {				copy_info(&info,				    " flags 0x%x*,",				    (int)up->q_flag);			} else {				copy_info(&info,				    " flags 0x%x,",				    (int)up->q_flag);			}			copy_info(&info, 			    " %ld:%d:%02x %02x",			    up->fclun->fcport->ha->instance,			    up->fclun->fcport->cur_path,			    up->fclun->fcport->loop_id,			    up->fclun->device_type);			copy_info(&info, "\n");			if (info.pos >= info.offset + info.length) {				/* No need to continue */				goto profile_stop;			}		}		if (info.pos >= info.offset + info.length) {			/* No need to continue */			break;		}	}profile_stop:	retval = info.pos > info.offset ? info.pos - info.offset : 0;	DEBUG3(printk(KERN_INFO 	    "Exiting proc_info: info.pos=%d, offset=0x%lx, "	    "length=0x%x\n", info.pos, offset, length);)	return (retval);}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/bdf796210e01145fd77bbb3ae644d04f982b6c3b/qla_os.c/buggy/drivers/scsi/qla2xxx/qla_os.c