&ioc->ioc_hpa->io_chain_id_mask); 
&ioc->ioc_regs->io_chain_id_mask); 
ccio_ioc_init(struct ioc *ioc){	int i;	unsigned int iov_order;	u32 iova_space_size;	/*	** 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).	*/	iova_space_size = (u32) (num_physpages / count_parisc_driver(&ccio_driver));	/* 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().	*/	/* We could use larger page sizes in order to *decrease* the number	** of mappings needed.  (ie 8k pages means 1/2 the mappings).	**	** Note: Grant Grunder says "Using 8k I/O pages isn't trivial either	**   since the pages must also be physically contiguous - typically	**   this is the case under linux."	*/	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 = (iova_space_size / IOVP_SIZE) * sizeof(u64);	BUG_ON(ioc->pdir_size >= 4 * 1024 * 1024);   /* max pdir size < 4MB */	/* Verify it's a power of two */	BUG_ON((1 << get_order(ioc->pdir_size)) != (ioc->pdir_size >> PAGE_SHIFT));	DBG_INIT("%s() hpa 0x%lx mem %luMB 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 = (u64 *)__get_free_pages(GFP_KERNEL, 						 get_order(ioc->pdir_size));	if(NULL == ioc->pdir_base) {		panic("%s:%s() could not allocate I/O Page Table\n", __FILE__,		      __FUNCTION__);	}	memset(ioc->pdir_base, 0, ioc->pdir_size);	BUG_ON((((unsigned long)ioc->pdir_base) & PAGE_MASK) != (unsigned long)ioc->pdir_base);	DBG_INIT(" base %p", ioc->pdir_base);	/* resource map size dictated by pdir_size */ 	ioc->res_size = (ioc->pdir_size / sizeof(u64)) >> 3;	DBG_INIT("%s() res_size 0x%x\n", __FUNCTION__, ioc->res_size);		ioc->res_map = (u8 *)__get_free_pages(GFP_KERNEL, 					      get_order(ioc->res_size));	if(NULL == ioc->res_map) {		panic("%s:%s() could not allocate resource map\n", __FILE__,		      __FUNCTION__);	}	memset(ioc->res_map, 0, ioc->res_size);	/* Initialize the res_hint to 16 */	ioc->res_hint = 16;	/* Initialize the spinlock */	spin_lock_init(&ioc->res_lock);	/*	** Chainid is the upper most bits of an IOVP used to determine	** which TLB entry an IOVP will use.	*/	ioc->chainid_shift = get_order(iova_space_size) + PAGE_SHIFT - CCIO_CHAINID_SHIFT;	DBG_INIT(" chainid_shift 0x%x\n", ioc->chainid_shift);	/*	** Initialize IOA hardware	*/	WRITE_U32(CCIO_CHAINID_MASK << ioc->chainid_shift, 		  &ioc->ioc_hpa->io_chain_id_mask);	WRITE_U32(virt_to_phys(ioc->pdir_base), 		  &ioc->ioc_hpa->io_pdir_base);	/*	** Go to "Virtual Mode"	*/	WRITE_U32(IOA_NORMAL_MODE, &ioc->ioc_hpa->io_control);	/*	** Initialize all I/O TLB entries to 0 (Valid bit off).	*/	WRITE_U32(0, &ioc->ioc_hpa->io_tlb_entry_m);	WRITE_U32(0, &ioc->ioc_hpa->io_tlb_entry_l);	for(i = 1 << CCIO_CHAINID_SHIFT; i ; i--) {		WRITE_U32((CMD_TLB_DIRECT_WRITE | (i << ioc->chainid_shift)),			  &ioc->ioc_hpa->io_command);	}}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/86a61ee9c9f3d8b632d29e86ac6610c43ebbb4f0/ccio-dma.c/buggy/drivers/parisc/ccio-dma.c