#if SBA_HINT_SUPPORT 
#ifdef SBA_HINT_SUPPORT 
sba_ioc_init(struct parisc_device *sba, struct ioc *ioc, int ioc_num){	u32 iova_space_size, iova_space_mask;	unsigned int pdir_size, iov_order;	/*	** Determine IOVA Space size from memory size.	**	** Ideally, PCI drivers would register the maximum number	** of DMA they can have outstanding for each device they	** own.  Next best thing would be to guess how much DMA	** can be outstanding based on PCI Class/sub-class. Both	** methods still require some "extra" to support PCI	** Hot-Plug/Removal of PCI cards. (aka PCI OLARD).	**	** While we have 32-bits "IOVA" space, top two 2 bits are used	** for DMA hints - ergo only 30 bits max.	*/	iova_space_size = (u32) (num_physpages/global_ioc_cnt);	/* limit IOVA space size to 1MB-1GB */	if (iova_space_size < (1 << (20 - PAGE_SHIFT))) {		iova_space_size = 1 << (20 - PAGE_SHIFT);	}#ifdef __LP64__	else if (iova_space_size > (1 << (30 - PAGE_SHIFT))) {		iova_space_size = 1 << (30 - PAGE_SHIFT);	}#endif	/*	** iova space must be log2() in size.	** thus, pdir/res_map will also be log2().	** PIRANHA BUG: Exception is when IO Pdir is 2MB (gets reduced)	*/	iov_order = get_order(iova_space_size << PAGE_SHIFT);	/* iova_space_size is now bytes, not pages */	iova_space_size = 1 << (iov_order + PAGE_SHIFT);	ioc->pdir_size = pdir_size = (iova_space_size/IOVP_SIZE) * sizeof(u64);	DBG_INIT("%s() hpa 0x%lx mem %ldMB IOV %dMB (%d bits)\n",			__FUNCTION__,			ioc->ioc_hpa,			(unsigned long) num_physpages >> (20 - PAGE_SHIFT),			iova_space_size>>20,			iov_order + PAGE_SHIFT);	ioc->pdir_base = sba_alloc_pdir(pdir_size);	DBG_INIT("%s() pdir %p size %x\n",			__FUNCTION__, ioc->pdir_base, pdir_size);#if SBA_HINT_SUPPORT	/* FIXME : DMA HINTs not used */	ioc->hint_shift_pdir = iov_order + PAGE_SHIFT;	ioc->hint_mask_pdir = ~(0x3 << (iov_order + PAGE_SHIFT));	DBG_INIT("	hint_shift_pdir %x hint_mask_pdir %lx\n",			ioc->hint_shift_pdir, ioc->hint_mask_pdir);#endif	WRITE_REG64(virt_to_phys(ioc->pdir_base), ioc->ioc_hpa + IOC_PDIR_BASE);	/* build IMASK for IOC and Elroy */	iova_space_mask =  0xffffffff;	iova_space_mask <<= (iov_order + PAGE_SHIFT);	/*	** On C3000 w/512MB mem, HP-UX 10.20 reports:	**     ibase=0, imask=0xFE000000, size=0x2000000.	*/	ioc->ibase = 0;	ioc->imask = iova_space_mask;	/* save it */#ifdef ZX1_SUPPORT	ioc->iovp_mask = ~(iova_space_mask + PAGE_SIZE - 1);#endif	DBG_INIT("%s() IOV base 0x%lx mask 0x%0lx\n",		__FUNCTION__, ioc->ibase, ioc->imask);	/*	** FIXME: Hint registers are programmed with default hint	** values during boot, so hints should be sane even if we	** can't reprogram them the way drivers want.	*/	setup_ibase_imask(sba, ioc, ioc_num);	/*	** Program the IOC's ibase and enable IOVA translation	*/	WRITE_REG(ioc->ibase | 1, ioc->ioc_hpa+IOC_IBASE);	WRITE_REG(ioc->imask, ioc->ioc_hpa+IOC_IMASK);	/* Set I/O PDIR Page size to 4K */	WRITE_REG(0, ioc->ioc_hpa+IOC_TCNFG);	/*	** Clear I/O TLB of any possible entries.	** (Yes. This is a bit paranoid...but so what)	*/	WRITE_REG(0 | 31, ioc->ioc_hpa+IOC_PCOM);	ioc->ibase = 0; /* used by SBA_IOVA and related macros */		DBG_INIT("%s() DONE\n", __FUNCTION__);}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/64908ad95c34f25849412d6d4735ac10f8fb6575/sba_iommu.c/buggy/drivers/parisc/sba_iommu.c