pide = sba_search_bitmap(ioc, pages_needed); 
pide = sba_search_bitmap(ioc, pages_needed, 0); 
sba_alloc_range(struct ioc *ioc, size_t size){	unsigned int pages_needed = size >> iovp_shift;#ifdef PDIR_SEARCH_TIMING	unsigned long itc_start;#endif	unsigned long pide;	unsigned long flags;	ASSERT(pages_needed);	ASSERT(0 == (size & ~iovp_mask));	spin_lock_irqsave(&ioc->res_lock, flags);#ifdef PDIR_SEARCH_TIMING	itc_start = ia64_get_itc();#endif	/*	** "seek and ye shall find"...praying never hurts either...	*/	pide = sba_search_bitmap(ioc, pages_needed);	if (unlikely(pide >= (ioc->res_size << 3))) {		pide = sba_search_bitmap(ioc, pages_needed);		if (unlikely(pide >= (ioc->res_size << 3))) {#if DELAYED_RESOURCE_CNT > 0			/*			** With delayed resource freeing, we can give this one more shot.  We're			** getting close to being in trouble here, so do what we can to make this			** one count.			*/			spin_lock(&ioc->saved_lock);			if (ioc->saved_cnt > 0) {				struct sba_dma_pair *d;				int cnt = ioc->saved_cnt;				d = &(ioc->saved[ioc->saved_cnt]);				while (cnt--) {					sba_mark_invalid(ioc, d->iova, d->size);					sba_free_range(ioc, d->iova, d->size);					d--;				}				ioc->saved_cnt = 0;				READ_REG(ioc->ioc_hpa+IOC_PCOM);	/* flush purges */			}			spin_unlock(&ioc->saved_lock);			pide = sba_search_bitmap(ioc, pages_needed);			if (unlikely(pide >= (ioc->res_size << 3)))				panic(__FILE__ ": I/O MMU @ %p is out of mapping resources\n",				      ioc->ioc_hpa);#else			panic(__FILE__ ": I/O MMU @ %p is out of mapping resources\n",			      ioc->ioc_hpa);#endif		}	}#ifdef PDIR_SEARCH_TIMING	ioc->avg_search[ioc->avg_idx++] = (ia64_get_itc() - itc_start) / pages_needed;	ioc->avg_idx &= SBA_SEARCH_SAMPLE - 1;#endif	prefetchw(&(ioc->pdir_base[pide]));#ifdef ASSERT_PDIR_SANITY	/* verify the first enable bit is clear */	if(0x00 != ((u8 *) ioc->pdir_base)[pide*PDIR_ENTRY_SIZE + 7]) {		sba_dump_pdir_entry(ioc, "sba_search_bitmap() botched it?", pide);	}#endif	DBG_RES("%s(%x) %d -> %lx hint %x/%x\n",		__FUNCTION__, size, pages_needed, pide,		(uint) ((unsigned long) ioc->res_hint - (unsigned long) ioc->res_map),		ioc->res_bitshift );	spin_unlock_irqrestore(&ioc->res_lock, flags);	return (pide);}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/5f6602a101993592b437b801c401443bec65d0cf/sba_iommu.c/clean/arch/ia64/hp/common/sba_iommu.c