outptr = (uint8_t *) & phba->fc_nodename.IEEE[0]; 
outptr = &phba->fc_nodename.u.s.IEEE[0]; 
lpfc_config_port_post(struct lpfc_hba * phba){	LPFC_MBOXQ_t *pmb;	MAILBOX_t *mb;	struct lpfc_dmabuf *mp;	struct lpfc_sli *psli = &phba->sli;	uint32_t status, timeout;	int i, j, rc;	pmb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);	if (!pmb) {		phba->hba_state = LPFC_HBA_ERROR;		return -ENOMEM;	}	mb = &pmb->mb;	lpfc_config_link(phba, pmb);	rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL);	if (rc != MBX_SUCCESS) {		lpfc_printf_log(phba,				KERN_ERR,				LOG_INIT,				"%d:0447 Adapter failed init, mbxCmd x%x "				"CONFIG_LINK mbxStatus x%x\n",				phba->brd_no,				mb->mbxCommand, mb->mbxStatus);		phba->hba_state = LPFC_HBA_ERROR;		mempool_free( pmb, phba->mbox_mem_pool);		return -EIO;	}	/* Get login parameters for NID.  */	lpfc_read_sparam(phba, pmb);	if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) {		lpfc_printf_log(phba,				KERN_ERR,				LOG_INIT,				"%d:0448 Adapter failed init, mbxCmd x%x "				"READ_SPARM mbxStatus x%x\n",				phba->brd_no,				mb->mbxCommand, mb->mbxStatus);		phba->hba_state = LPFC_HBA_ERROR;		mp = (struct lpfc_dmabuf *) pmb->context1;		mempool_free( pmb, phba->mbox_mem_pool);		lpfc_mbuf_free(phba, mp->virt, mp->phys);		kfree(mp);		return -EIO;	}	mp = (struct lpfc_dmabuf *) pmb->context1;	memcpy(&phba->fc_sparam, mp->virt, sizeof (struct serv_parm));	lpfc_mbuf_free(phba, mp->virt, mp->phys);	kfree(mp);	pmb->context1 = NULL;	memcpy(&phba->fc_nodename, &phba->fc_sparam.nodeName,	       sizeof (struct lpfc_name));	memcpy(&phba->fc_portname, &phba->fc_sparam.portName,	       sizeof (struct lpfc_name));	/* If no serial number in VPD data, use low 6 bytes of WWNN */	/* This should be consolidated into parse_vpd ? - mr */	if (phba->SerialNumber[0] == 0) {		uint8_t *outptr;		outptr = (uint8_t *) & phba->fc_nodename.IEEE[0];		for (i = 0; i < 12; i++) {			status = *outptr++;			j = ((status & 0xf0) >> 4);			if (j <= 9)				phba->SerialNumber[i] =				    (char)((uint8_t) 0x30 + (uint8_t) j);			else				phba->SerialNumber[i] =				    (char)((uint8_t) 0x61 + (uint8_t) (j - 10));			i++;			j = (status & 0xf);			if (j <= 9)				phba->SerialNumber[i] =				    (char)((uint8_t) 0x30 + (uint8_t) j);			else				phba->SerialNumber[i] =				    (char)((uint8_t) 0x61 + (uint8_t) (j - 10));		}	}	/* This should turn on DELAYED ABTS for ELS timeouts */	lpfc_set_slim(phba, pmb, 0x052198, 0x1);	if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) {		phba->hba_state = LPFC_HBA_ERROR;		mempool_free( pmb, phba->mbox_mem_pool);		return -EIO;	}	lpfc_read_config(phba, pmb);	if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) {		lpfc_printf_log(phba,				KERN_ERR,				LOG_INIT,				"%d:0453 Adapter failed to init, mbxCmd x%x "				"READ_CONFIG, mbxStatus x%x\n",				phba->brd_no,				mb->mbxCommand, mb->mbxStatus);		phba->hba_state = LPFC_HBA_ERROR;		mempool_free( pmb, phba->mbox_mem_pool);		return -EIO;	}	/* Reset the DFT_HBA_Q_DEPTH to the max xri  */	if (phba->cfg_hba_queue_depth > (mb->un.varRdConfig.max_xri+1))		phba->cfg_hba_queue_depth =			mb->un.varRdConfig.max_xri + 1;	phba->lmt = mb->un.varRdConfig.lmt;	/* HBA is not 4GB capable, or HBA is not 2GB capable,	don't let link speed ask for it */	if ((((phba->lmt & LMT_4250_10bit) != LMT_4250_10bit) &&		(phba->cfg_link_speed > LINK_SPEED_2G)) ||		(((phba->lmt & LMT_2125_10bit) != LMT_2125_10bit) &&		(phba->cfg_link_speed > LINK_SPEED_1G))) {		/* Reset link speed to auto. 1G/2GB HBA cfg'd for 4G */		lpfc_printf_log(phba,			KERN_WARNING,			LOG_LINK_EVENT,			"%d:1302 Invalid speed for this board: "			"Reset link speed to auto: x%x\n",			phba->brd_no,			phba->cfg_link_speed);			phba->cfg_link_speed = LINK_SPEED_AUTO;	}	phba->hba_state = LPFC_LINK_DOWN;	/* Only process IOCBs on ring 0 till hba_state is READY */	if (psli->ring[psli->ip_ring].cmdringaddr)		psli->ring[psli->ip_ring].flag |= LPFC_STOP_IOCB_EVENT;	if (psli->ring[psli->fcp_ring].cmdringaddr)		psli->ring[psli->fcp_ring].flag |= LPFC_STOP_IOCB_EVENT;	if (psli->ring[psli->next_ring].cmdringaddr)		psli->ring[psli->next_ring].flag |= LPFC_STOP_IOCB_EVENT;	/* Post receive buffers for desired rings */	lpfc_post_rcv_buf(phba);	/* Enable appropriate host interrupts */	spin_lock_irq(phba->host->host_lock);	status = readl(phba->HCregaddr);	status |= HC_MBINT_ENA | HC_ERINT_ENA | HC_LAINT_ENA;	if (psli->num_rings > 0)		status |= HC_R0INT_ENA;	if (psli->num_rings > 1)		status |= HC_R1INT_ENA;	if (psli->num_rings > 2)		status |= HC_R2INT_ENA;	if (psli->num_rings > 3)		status |= HC_R3INT_ENA;	writel(status, phba->HCregaddr);	readl(phba->HCregaddr); /* flush */	spin_unlock_irq(phba->host->host_lock);	/*	 * Setup the ring 0 (els)  timeout handler	 */	timeout = phba->fc_ratov << 1;	phba->els_tmofunc.expires = jiffies + HZ * timeout;	add_timer(&phba->els_tmofunc);	lpfc_init_link(phba, pmb, phba->cfg_topology, phba->cfg_link_speed);	pmb->mbox_cmpl = lpfc_sli_def_mbox_cmpl;	if (lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT) != MBX_SUCCESS) {		lpfc_printf_log(phba,				KERN_ERR,				LOG_INIT,				"%d:0454 Adapter failed to init, mbxCmd x%x "				"INIT_LINK, mbxStatus x%x\n",				phba->brd_no,				mb->mbxCommand, mb->mbxStatus);		/* Clear all interrupt enable conditions */		writel(0, phba->HCregaddr);		readl(phba->HCregaddr); /* flush */		/* Clear all pending interrupts */		writel(0xffffffff, phba->HAregaddr);		readl(phba->HAregaddr); /* flush */		phba->hba_state = LPFC_HBA_ERROR;		mempool_free(pmb, phba->mbox_mem_pool);		return -EIO;	}	/* MBOX buffer will be freed in mbox compl */	i = 0;	while ((phba->hba_state != LPFC_HBA_READY) ||	       (phba->num_disc_nodes) || (phba->fc_prli_sent) ||	       ((phba->fc_map_cnt == 0) && (i<2)) ||	       (psli->sli_flag & LPFC_SLI_MBOX_ACTIVE)) {		/* Check every second for 30 retries. */		i++;		if (i > 30) {			break;		}		if ((i >= 15) && (phba->hba_state <= LPFC_LINK_DOWN)) {			/* The link is down.  Set linkdown timeout */			break;		}		/* Delay for 1 second to give discovery time to complete. */		msleep(1000);	}	/* Since num_disc_nodes keys off of PLOGI, delay a bit to let	 * any potential PRLIs to flush thru the SLI sub-system.	 */	msleep(50);	return (0);}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/68ce1eb54056e4fad6e73968e958b926d28cb0dd/lpfc_init.c/clean/drivers/scsi/lpfc/lpfc_init.c