#if CHK_PARITY 
#ifdef CHK_PARITY 
static int init_tulip(HCS * pCurHcb, SCB * scbp, int tul_num_scb,		      BYTE * pbBiosAdr, int seconds){	int i;	BYTE *pwFlags;	BYTE *pbHeads;	SCB *pTmpScb, *pPrevScb = NULL;	pCurHcb->HCS_NumScbs = tul_num_scb;	pCurHcb->HCS_Semaph = 1;	spin_lock_init(&pCurHcb->HCS_SemaphLock);	pCurHcb->HCS_JSStatus0 = 0;	pCurHcb->HCS_Scb = scbp;	pCurHcb->HCS_NxtPend = scbp;	pCurHcb->HCS_NxtAvail = scbp;	for (i = 0, pTmpScb = scbp; i < tul_num_scb; i++, pTmpScb++) {		pTmpScb->SCB_TagId = i;		if (i != 0)			pPrevScb->SCB_NxtScb = pTmpScb;		pPrevScb = pTmpScb;	}	pPrevScb->SCB_NxtScb = NULL;	pCurHcb->HCS_ScbEnd = pTmpScb;	pCurHcb->HCS_FirstAvail = scbp;	pCurHcb->HCS_LastAvail = pPrevScb;	spin_lock_init(&pCurHcb->HCS_AvailLock);	pCurHcb->HCS_FirstPend = NULL;	pCurHcb->HCS_LastPend = NULL;	pCurHcb->HCS_FirstBusy = NULL;	pCurHcb->HCS_LastBusy = NULL;	pCurHcb->HCS_FirstDone = NULL;	pCurHcb->HCS_LastDone = NULL;	pCurHcb->HCS_ActScb = NULL;	pCurHcb->HCS_ActTcs = NULL;	tul_read_eeprom(pCurHcb->HCS_Base);/*---------- get H/A configuration -------------*/	if (i91unvramp->NVM_SCSIInfo[0].NVM_NumOfTarg == 8)		pCurHcb->HCS_MaxTar = 8;	else		pCurHcb->HCS_MaxTar = 16;	pCurHcb->HCS_Config = i91unvramp->NVM_SCSIInfo[0].NVM_ChConfig1;	pCurHcb->HCS_SCSI_ID = i91unvramp->NVM_SCSIInfo[0].NVM_ChSCSIID;	pCurHcb->HCS_IdMask = ~(1 << pCurHcb->HCS_SCSI_ID);#if CHK_PARITY	/* Enable parity error response */	TUL_WR(pCurHcb->HCS_Base + TUL_PCMD, TUL_RD(pCurHcb->HCS_Base, TUL_PCMD) | 0x40);#endif	/* Mask all the interrupt       */	TUL_WR(pCurHcb->HCS_Base + TUL_Mask, 0x1F);	tul_stop_bm(pCurHcb);	/* --- Initialize the tulip --- */	TUL_WR(pCurHcb->HCS_Base + TUL_SCtrl0, TSC_RST_CHIP);	/* program HBA's SCSI ID        */	TUL_WR(pCurHcb->HCS_Base + TUL_SScsiId, pCurHcb->HCS_SCSI_ID << 4);	/* Enable Initiator Mode ,phase latch,alternate sync period mode,	   disable SCSI reset */	if (pCurHcb->HCS_Config & HCC_EN_PAR)		pCurHcb->HCS_SConf1 = (TSC_INITDEFAULT | TSC_EN_SCSI_PAR);	else		pCurHcb->HCS_SConf1 = (TSC_INITDEFAULT);	TUL_WR(pCurHcb->HCS_Base + TUL_SConfig, pCurHcb->HCS_SConf1);	/* Enable HW reselect           */	TUL_WR(pCurHcb->HCS_Base + TUL_SCtrl1, TSC_HW_RESELECT);	TUL_WR(pCurHcb->HCS_Base + TUL_SPeriod, 0);	/* selection time out = 250 ms */	TUL_WR(pCurHcb->HCS_Base + TUL_STimeOut, 153);/*--------- Enable SCSI terminator -----*/	TUL_WR(pCurHcb->HCS_Base + TUL_XCtrl, (pCurHcb->HCS_Config & (HCC_ACT_TERM1 | HCC_ACT_TERM2)));	TUL_WR(pCurHcb->HCS_Base + TUL_GCTRL1,	       ((pCurHcb->HCS_Config & HCC_AUTO_TERM) >> 4) | (TUL_RD(pCurHcb->HCS_Base, TUL_GCTRL1) & 0xFE));	for (i = 0,	     pwFlags = & (i91unvramp->NVM_SCSIInfo[0].NVM_Targ0Config),	     pbHeads = pbBiosAdr + 0x180;	     i < pCurHcb->HCS_MaxTar;	     i++, pwFlags++) {		pCurHcb->HCS_Tcs[i].TCS_Flags = *pwFlags & ~(TCF_SYNC_DONE | TCF_WDTR_DONE);		if (pCurHcb->HCS_Tcs[i].TCS_Flags & TCF_EN_255)			pCurHcb->HCS_Tcs[i].TCS_DrvFlags = TCF_DRV_255_63;		else			pCurHcb->HCS_Tcs[i].TCS_DrvFlags = 0;		pCurHcb->HCS_Tcs[i].TCS_JS_Period = 0;		pCurHcb->HCS_Tcs[i].TCS_SConfig0 = pCurHcb->HCS_SConf1;		pCurHcb->HCS_Tcs[i].TCS_DrvHead = *pbHeads++;		if (pCurHcb->HCS_Tcs[i].TCS_DrvHead == 255)			pCurHcb->HCS_Tcs[i].TCS_DrvFlags = TCF_DRV_255_63;		else			pCurHcb->HCS_Tcs[i].TCS_DrvFlags = 0;		pCurHcb->HCS_Tcs[i].TCS_DrvSector = *pbHeads++;		pCurHcb->HCS_Tcs[i].TCS_Flags &= ~TCF_BUSY;		pCurHcb->HCS_ActTags[i] = 0;		pCurHcb->HCS_MaxTags[i] = 0xFF;	}			/* for                          */	printk("i91u: PCI Base=0x%04X, IRQ=%d, BIOS=0x%04X0, SCSI ID=%d\n",	       pCurHcb->HCS_Base, pCurHcb->HCS_Intr,	       pCurHcb->HCS_BIOS, pCurHcb->HCS_SCSI_ID);/*------------------- reset SCSI Bus ---------------------------*/	if (pCurHcb->HCS_Config & HCC_SCSI_RESET) {		printk("i91u: Reset SCSI Bus ... \n");		tul_reset_scsi(pCurHcb, seconds);	}	TUL_WR(pCurHcb->HCS_Base + TUL_SCFG1, 0x17);	TUL_WR(pCurHcb->HCS_Base + TUL_SIntEnable, 0xE9);	return (0);}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/44456d37b59d8e541936ed26d8b6e08d27e88ac1/initio.c/clean/drivers/scsi/initio.c