ctx = iommu->iommu_cur_ctx++; 
ctx = iommu_alloc_ctx(iommu); 
void *pci_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr_t *dma_addrp){	struct pcidev_cookie *pcp;	struct pci_iommu *iommu;	iopte_t *iopte;	unsigned long flags, order, first_page, ctx;	void *ret;	int npages;	size = IO_PAGE_ALIGN(size);	order = get_order(size);	if (order >= 10)		return NULL;	first_page = __get_free_pages(GFP_ATOMIC, order);	if (first_page == 0UL)		return NULL;	memset((char *)first_page, 0, PAGE_SIZE << order);	pcp = pdev->sysdata;	iommu = pcp->pbm->iommu;	spin_lock_irqsave(&iommu->lock, flags);	iopte = alloc_consistent_cluster(iommu, size >> IO_PAGE_SHIFT);	if (iopte == NULL) {		spin_unlock_irqrestore(&iommu->lock, flags);		free_pages(first_page, order);		return NULL;	}	*dma_addrp = (iommu->page_table_map_base +		      ((iopte - iommu->page_table) << IO_PAGE_SHIFT));	ret = (void *) first_page;	npages = size >> IO_PAGE_SHIFT;	ctx = 0;	if (iommu->iommu_ctxflush)		ctx = iommu->iommu_cur_ctx++;	first_page = __pa(first_page);	while (npages--) {		iopte_val(*iopte) = (IOPTE_CONSISTENT(ctx) |				     IOPTE_WRITE |				     (first_page & IOPTE_PAGE));		iopte++;		first_page += IO_PAGE_SIZE;	}	{		int i;		u32 daddr = *dma_addrp;		npages = size >> IO_PAGE_SHIFT;		for (i = 0; i < npages; i++) {			pci_iommu_write(iommu->iommu_flush, daddr);			daddr += IO_PAGE_SIZE;		}	}	spin_unlock_irqrestore(&iommu->lock, flags);	return ret;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/7c963ad1d113790a8c723a178988b675868f3abe/pci_iommu.c/clean/arch/sparc64/kernel/pci_iommu.c